## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Good Pairs CodeChef Solution | CodeChef Problem Solution 2022

Chef has two arrays $A$ and $B$, each of length $N$.

A pair $\left(i,j\right)$ $\left(1\le i is said to be a good pair if and only if

${A}_{i}\oplus {A}_{j}={B}_{i}\oplus {B}_{j}$

Here, $\oplus$ denotes the bitwise XOR operation.

Determine the number of good pairs.

### Input Format

• The first line of input will contain a single integer $T$, denoting the number of test cases. The description of the test cases follows.

• Each test case consists of three lines of input:
• The first line contains a single integer $N$ — the size of the arrays $A$ and $B$.
• The second line contains $N$ space-separated integers ${A}_{1},{A}_{2},\dots ,{A}_{N}$ — the elements of array $A$.
• The third line contains $N$ space-separated integers ${B}_{1},{B}_{2},\dots ,{B}_{N}$ — the elements of array $B$.

### Output Format

• For each test case, output on a new line the number of good pairs.

### Constraints

• $1\le T\le {10}^{5}$
• $2\le N\le 3\cdot {10}^{5}$
• The sum of $N$ over all test cases does not exceed $3\cdot {10}^{5}$