This is a problem with graders.
For an array of positive integers of length , we define as follows:
Let initially a variable be equal to ;
For one coin, it is allowed to increase the value of by ;
For one coin, it is allowed to choose an element of the array b_i (1\le i\le m) and replace it with (b_i \oplus x), where denotes the operation of bitwise exclusive OR;
equals the minimum number of coins needed to make all elements of the array simultaneously equal to zero.
The bitwise exclusive OR of non-negative integers and (a \oplus b) equals a non-negative integer, in which in the binary representation, there is a one at a certain position only if in the binary representations of and at this position there are different values. For example, 3_{10} \oplus 5_{10} = 0011_{2} \oplus 0101_{2} = 0110_{2} = 6_{10}.
An array of positive integers of length and queries of the form , are given. For each query, it is necessary to find f([a_l,a_{l+1},\ldots,a_r]).
The first line contains three integers , , and (1 \leq n, q \leq 2 \cdot 10^5; 1 \leq t \leq 2) — the number of numbers, the number of queries, and the format of the queries, respectively.
The second line contains integers a_1, a_2, \dots, a_n (1 \leq a_i < 2^{60}) — the elements of the array .
The next lines contain two integers and (1 \leq l \leq r \leq n) — the parameters of the -th query.
The function init will be called exactly once.
If t=1, then the function askAll with all queries will be called exactly once. If t=2, then the function ask will be called exactly times.
You need to implement the following functions:
void init(integer n, array of integers a)— an integer representing the length of the array;
— an array of integers of length ;
this function does not return anything.
integer ask(integer l, integer r)— an integer representing the left boundary of the query;
— an integer representing the right boundary of the query;
this function returns an integer — f([a_l,a_{l+1},\ldots,a_r]).
array of integers askAll(integer q, array of integers l, array of integers r)— an integer representing the number of queries;
— an array of integers of length ; l_i represents the left boundary of the -th query;
— an array of integers of length ; r_i represents the right boundary of the -th query;
this function returns an array of integers; the -th number should be equal to the answer to the -th query.
The grader will output integers in separate lines — the answers to the queries.
Example 1
Example 2
( points): t=1, a_i=a_1 for 1\le i\le n;
( points): t=1, a_i \neq a_j for i \neq j;
( points): t=1, 2^m+n \le a_i<2^{m+1} for some natural ;
( points): t=1, a_i \le a_{i+1} for 1 \le i < n;
( points): t=1, n, q \le 1000;
( points): t=1, l_i=1 and r_i=i for 1\le i\le q.
( points): t=1, n, q \le 50000;
( points): t=1;
( points): t=2, n, q \le 10^5;
( points): t=2.