409225: GYM103463 E The King Of Sum Xor
Description
If you have solved CrossFire #6XX (Div.998244353) D, you will have the potential to become the king of sum xor.
Today Dup4 meets a problem and he asks you for help. He wants to know whether there exists an array $$$n$$$ non-negative integers $$$a_1, a_2, \cdots ,a_n$$$(the array can be empty) that follow these rules.
- $$$\displaystyle a_1+a_2+\cdots +a_n = S$$$
- $$$\displaystyle a_1 \oplus a_2 \oplus \cdots \oplus a_n = X$$$(Here $$$\oplus$$$ denotes bitwise xor operation)
However, Dup4 thinks the problem is so easy. He thinks he needs to change something.
- He constructs all arrays that satisfying the requirements.
- He defines the maximum value of the $$$i$$$-th array as $$$M_i$$$.
- He finds the minimum $$$M_i$$$ of the all arrays as $$$MIN$$$.
- He defines a set $$$V$$$ to be composed of arrays which satisfying the condition of $$$M_i = MIN$$$.
Finally, He wants to know the minimum $$$n$$$(the length of the array) of the $$$V$$$.
InputThere are several test cases.
The first line contains a single integer $$$T(1 \leq T \leq 10^2)$$$, denoting the number of test cases. Then follow all the test cases.
For each test case, the first line contains two integers $$$s$$$, $$$x$$$ $$$(0 \leq s, x \le 2^{60} - 1)$$$.
OutputFor each test case, print $$$-1$$$ if there doesn't exist an array with the mentioned property else print your answer.
ExampleInput2 9 3 19 1Output
6 19