Input: N = 5, A1[] = {1, 2, 3, 4, 5}, A2[] = {1, 2, 3, 4, 5}, Q = 2, query[][] = {{2, 2, 4, 1, 3}, {1, 1, 1, 3, 5}
Output: 4 1
Explanation: For 1st query: Segment from A1 -> {2, 3, 4} Segment from A2 -> {1, 2, 3} Possible pairs(i, j) expressed in terms of (arr[i], arr[j]) will be: (2, 1), (3, 1), (4, 2), (4, 3) . Let's check for (4, 3) -> 4^3 = 7 binary representation will be 111, and it has a kth bit(2nd bit) from the end set. For 2nd query: Only pair will be (1,4)
Input: N = 1, A1[] = {3}, A2[] = {1}, Q = 1, query[][] = {{2, 1, 1, 1, 1}}
Output: 1
Explanation: Only pair in terms of (arr[i],arr[j]) will be (3,1) -> 3^1 = 2, which has 2nd bit set from the last.