**OR Tuples solution codechef** – Chef has $3$ numbers $P$, $Q$ and $R$. Chef wants to find the number of triples $(A,B,C)$ such that:

- $(A∣B)=P,$ $(B∣C)=Q$ and $(C∣A)=R$ (Here, $∣$ denotes the bitwise OR operation)
- $0≤A,B,C<_{20}$

## [Solution] OR Tuples solution codechef

Can you help Chef?

### Input Format

- The first line of input will contain a single integer $T$, denoting the number of test cases.
- Each test case consists of a single line of input containing $3$ space-separated integers denoting $P,Q$ and $R$ respectively.

### Output Format

For each test case, output a single integer denoting the number of triplets $(A,B,C)$ that satisfy the given conditions.

## OR Tuples solution codechef

- $1≤T≤1_{5}$
- $0≤P,Q,R<_{20}$

### Sample 1:

Input

Output

3 10 12 14 0 5 5 0 0 7

4 1 0

## OR Tuples solution codechef Explanation:

**Test case $1$:** The following $4$ triplets $(A,B,C)$ satisfy $A∣B=10,B∣C=12,$ and $C∣A=14$: $(2,8,12),(10,0,12),(10,8,4),$ and $(10,8,12)$.

**Test case $2$:** The following triplet $(A,B,C)$ satisfies $A∣B=0,B∣C=5,$ and $C∣A=5$: $(0,0,5)$.

**Test case $3$:** There are no triplets satisfying all the conditions.

More Info