There are $$$n$$$ positive integers $$$a_1, a_2, \dots, a_n$$$. For the one move you can choose any even value $$$c$$$ and divide by two all elements that equal $$$c$$$.For example, if $$$a=[6,8,12,6,3,12]$$$ and you choose $$$c=6$$$, and $$$a$$$ is transformed into $$$a=[3,8,12,3,3,12]$$$ after the move.You need to find the minimal number of moves for transforming $$$a$$$ to an array of only odd integers (each element shouldn't be divisible by $$$2$$$).

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of a test case contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — the number of integers in the sequence $$$a$$$. The second line contains positive integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). The sum of $$$n$$$ for all test cases in the input doesn't exceed $$$2\cdot10^5$$$.

For $$$t$$$ test cases print the answers in the order of test cases in the input. The answer for the test case is the minimal number of moves needed to make all numbers in the test case odd (i.e. not divisible by $$$2$$$).

NoteIn the first test case of the example, the optimal sequence of moves can be as follows:  before making moves $$$a=[40, 6, 40, 3, 20, 1]$$$;  choose $$$c=6$$$;  now $$$a=[40, 3, 40, 3, 20, 1]$$$;  choose $$$c=40$$$;  now $$$a=[20, 3, 20, 3, 20, 1]$$$;  choose $$$c=20$$$;  now $$$a=[10, 3, 10, 3, 10, 1]$$$;  choose $$$c=10$$$;  now $$$a=[5, 3, 5, 3, 5, 1]$$$ — all numbers are odd. Thus, all numbers became odd after $$$4$$$ moves. In $$$3$$$ or fewer moves, you cannot make them all odd.

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))

  const t = parseInt(arr.shift())

  for(let j = 0; j < t; j++) {
    const n = parseInt(arr[2 * j])
    let map = {}
    const arrN = arr[2 * j + 1].split(' ').map(a => {
      let x =  parseInt(a)
      if(a % 2 == 1) return -1
      else {
        map[x] = true
        return x
      }
    })

    arrN.sort(sort2)

    let s = new Set(arrN)
    const size = s.size
    let i = size - 1
    let setArray = Array.from(s)
    let count = 0
    let flag = false

    while(i >= 0 && !flag) {
      let max = setArray[i]
      if(max < 0) break
      let half = max / 2
      if(half % 2 == 1) {
        count ++
        i --
        delete map[max]
      }
      else if(map[half]) {
        delete map[max]
        i--
        count ++
      }
      else {
        delete map[max]
        map[half] = true
        setArray[i] = half
        count ++
      }
    }

    // while(!flag) {
    //   // let v = Array.from(s)
    //   let max = Math.max(...s)
    //   console.log(max)
    //   let half = max / 2
    //   if(half % 2 == 0) {
    //     s.delete(max)
    //     s.add(half)
    //     count ++
    //   }
    //   else {
    //     s.delete(max)
    //     count ++
    //   }
    //   if(s.size == 1) flag  = true
    // }

    console.log(count)

  }
})

function sort2(a, b) {
  return a - b
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))

  const t = parseInt(arr.shift())

  for(let j = 0; j < t; j++) {
    const n = parseInt(arr[2 * j])
    const arrN = arr[2 * j + 1].split(' ').map(a => parseInt(a))

    arrN.sort((a, b) => b - a)

    let s = new Set(arrN)
    let count = 0
    let flag = false

    while(!flag) {
      let v = Array.from(s)
      if(v[0] % 2 == 0) {
        s.delete(v[0])
        s.add(v[0] / 2)
        s = new Set(Array.from(s).sort((a, b) => b - a))
        count ++
      }
      else flag = true
    }

    console.log(count)

  }
})


It is given a non-negative integer $$$x$$$, the decimal representation of which contains $$$n$$$ digits. You need to color each its digit in red or black, so that the number formed by the red digits is divisible by $$$A$$$, and the number formed by the black digits is divisible by $$$B$$$.At least one digit must be colored in each of two colors. Consider, the count of digits colored in red is $$$r$$$ and the count of digits colored in black is $$$b$$$. Among all possible colorings of the given number $$$x$$$, you need to output any such that the value of $$$|r - b|$$$ is the minimum possible.Note that the number $$$x$$$ and the numbers formed by digits of each color, may contain leading zeros.  Example of painting a number for $$$A = 3$$$ and $$$B = 13$$$ The figure above shows an example of painting the number $$$x = 02165$$$ of $$$n = 5$$$ digits for $$$A = 3$$$ and $$$B = 13$$$. The red digits form the number $$$015$$$, which is divisible by $$$3$$$, and the black ones — $$$26$$$, which is divisible by $$$13$$$. Note that the absolute value of the difference between the counts of red and black digits is $$$1$$$, it is impossible to achieve a smaller value.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of two lines. The first line contains three integers $$$n$$$, $$$A$$$, $$$B$$$ ($$$2 \le n \le 40$$$, $$$1 \le A, B \le 40$$$). The second line contains a non-negative integer $$$x$$$ containing exactly $$$n$$$ digits and probably containing leading zeroes.

For each test case, output in a separate line:   -1 if the desired coloring does not exist;  a string $$$s$$$ of $$$n$$$ characters, each of them is a letter 'R' or 'B'. If the $$$i$$$-th digit of the number $$$x$$$ is colored in red, then the $$$i$$$-th character of the string $$$s$$$ must be the letter 'R', otherwise the letter 'B'.  The number formed by digits colored red should divisible by $$$A$$$. The number formed by digits colored black should divisible by $$$B$$$. The value $$$|r-b|$$$ should be minimal, where $$$r$$$ is the count of red digits, $$$b$$$ is the count of black digits. If there are many possible answers, print any of them.

NoteThe first test case is considered in the statement.In the second test case, there are no even digits, so it is impossible to form a number from its digits that is divisible by $$$2$$$.In the third test case, each coloring containing at least one red and one black digit is possible, so you can color $$$4$$$ digits in red and $$$4$$$ in black ($$$|4 - 4| = 0$$$, it is impossible to improve the result).In the fourth test case, there is a single desired coloring.

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INF = Number.MAX_SAFE_INTEGER;
const INIT = -1;
let n;
let a;
let b;
let dig;
let mx;
function at(i, j, arem, brem) {
    return i * mx * mx * mx + j * mx * mx + arem * mx + brem;
}
function next(rem, d, mod) {
    return (rem * 10 + d) % mod;
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        a = nextInt();
        b = nextInt();
        let s = nextStr();
        mx = Math.max(n, Math.max(a, b)) + 1;
        const dp = new Int32Array(mx * mx * mx * mx);
        const p = new Int32Array(mx * mx * mx * mx);
        dig = af(n);
        for (let i = 0; i < n; i++) {
            dig[i] = Number(s[i]);
        }
        dp.fill(INIT);
        dp[at(0, 0, 0, 0)] = 0;
        for (let i = 0; i < n; i++) {
            for (let j = 0; i + j < n; j++) { // note i + j
                for (let k = 0; k < a; k++) {
                    for (let l = 0; l < b; l++) {
                        if (dp[at(i, j, k, l)] == INIT) {
                            continue;
                        }
                        // transition to i + 1
                        let arem = next(k, dig[i + j], a);
                        let brem = next(l, dig[i + j], b);
                        dp[at(i + 1, j, arem, l)] = 0;
                        p[at(i + 1, j, arem, l)] = at(i, j, k, l);
                        dp[at(i, j + 1, k, brem)] = 0;
                        p[at(i, j + 1, k, brem)] = -(at(i, j, k, l) + 1);
                    }
                }
            }
        }
        let ans = INF;
        let t = INIT;
        for (let i = 1; i < n; i++) {
            let j = n - i;
            if (dp[at(i, j, 0, 0)] != INIT) {
                let rv = Math.abs(i - j);
                if (ans > rv) {
                    ans = rv;
                    t = at(i, j, 0, 0);
                }
            }
        }
        if (ans > mx) {
            printf("-1\n");
            continue;
        }
        // printf("%d\n",ans);
        // printf("t %d\n", t);
        let path = '';
        let u = t;
        while (u != 0) {
            // printf("u %d p[u] %d\n", u, p[u]);
            if (p[u] < 0) {
                path += 'B';
                u = -p[u] - 1;
            }
            else {
                path += 'R';
                u = p[u];
            }
        }
        let rpath = '';
        for (let i = path.length - 1; i >= 0; i--) {
            rpath += path[i];
        }
        printf("%s\n", rpath);
    }
}