| JCPC 2022 |
|---|
| Finished |
"There's no difference" said Hanz.
As we all know, Hobz is a hundred-faced person. Damn, With all these hundered-faced people I miss two-faced people.
However, thank god today we will only be dealing with $$$N$$$ two-faced copies of Hobz. The $$$i-th$$$ Hobz has value $$$A_i$$$ on the first face and value $$$B_i$$$ on the second face.
Now let's calculate their Salkan. Salkan is the Xor of values on their faces.
Now Hobz has a plan to deceive us. Because we all know he has $$$0$$$ Salkan. He will choose which face each of his copies will show so that their Salkan is maximum.
However, Hanz knows about Hobz's plan. So he decided to place a parameter $$$K$$$.
If Hobz's copies output Salkan $$$ \gt K$$$ Hanz will be sure that Hobz is playing them. Then Hobz's Salkan Becomes $$$0$$$.
Do you know what value Hobz will print if he wants his Salkan to be maximum?
The first line contains the number of test cases $$$T$$$ $$$(1 \leq T \leq 10)$$$.
The first line of each test case contains two integers $$$N$$$ and $$$K$$$ $$$(1 \leq N \leq 10^5) (0 \leq K \lt 2^{30})$$$.
The second line of each test case contains $$$N$$$ space-separated integers $$$A_{1},A_{2},\dots,A_{N}$$$ $$$(0 \leq A_i \lt 2^{30})$$$.
The third line of each test case contains $$$N$$$ space-separated integers $$$B_{1},B_{2},\dots,B_{N}$$$ $$$(0 \leq B_i \lt 2^{30})$$$.
For each test case, print Hobz's Salkan.
25 101 4 3 4 54 2 4 4 42 1112 1312 13
7 1
| Name |
|---|


