AT_code_festival_china_j XORAND

Description

[problemUrl]: https://atcoder.jp/contests/code-festival-2014-china-open/tasks/code_festival_china_j

Input Format

> $ N $ $ Q $ $ A_1 $ $ A_2 $ ... $ A_N $ $ l'_1 $ $ r'_1 $ $ l'_2 $ $ r'_2 $ : $ l'_Q $ $ r'_Q $ - On the first line, you will be given two integers $ N $ ($ 2\ \leq\ N\ \leq\ 10^5 $), $ Q $ ($ 1\ \leq\ Q\ \leq\ 10^5 $) separated by space, the number of elements in the array $ A $ and the number of queries respectively. - On the second line, you will be given $ N $ integers separated by space. The $ i $-th ($ 1\ \leq\ i\ \leq\ N $) integer is $ A_i $ ($ 0\ \leq\ A_i\

Output Format

Output $ Q $ lines. The $ j $-th ($ 1\ \leq\ j\ \leq\ Q $) line should contain the answer to the $ j $-th query. Make sure to insert a line break at the end of the output.

Explanation/Hint

### Problem Yu loves bitwise AND operation and big number. Yu's friend Yihuo loves bitwise XOR operation and small number. They are good friends that whenever someone sends them an array of numbers as a gift, they share the numbers with each other. For an array of non-negative integers $ p_1,\ p_2,\ ...,\ p_k $, let $ D $ be the result of bitwise AND between all numbers in the array ($ p_1 $$ \rm{\ AND\ } $$ p_2 $$ \rm{\ AND\ } $$ ... $$ \rm{\ AND\ } $$ p_k $), and let $ X $ be the result of bitwise XOR between all numbers in the array ($ p_1 $$ \rm{\ XOR\ } $$ p_2 $$ \rm{\ XOR\ } $$ ... $$ \rm{\ XOR\ } $$ p_k $). Yu's satisfaction value for $ p_1,\ p_2,\ ...,\ p_k $ is $ D $, Yihuo's satisfaction value for the same array of numbers is **$ -X $** (Note that Yihuo loves small number. The less $ X $ is, the more Yihuo satisfies.) Whenever they receive an array of non-negative integer $ p_1,\ p_2,\ ...,\ p_k $ as a gift, they cut the array in the middle and Yu gets the former part, Yihuo gets the latter part. The place they cut the array is determined to maximize the sum of each satisfaction value for the array each get. To say more precisely, they cut the array at after the $ i $-th number within $ 1\ \leq\ i\