Bitwise operations 2 - MarisaOJ: Marisa Online Judge
Given $q$ queries, each query consists of two non-negative 15-bit integers $a$ and $b$. Print the integer $c$ as the result, where $c$ is calculated as follows:
- For bits from 0 to 4, the corresponding bit of $c$ is the XOR of the two corresponding bits in $a$ and $b$.
- For bits from 5 to 9, the corresponding bit of $c$ is the AND of the two corresponding bits in $a$ and $b$.
- For bits from 10 to 14, the corresponding bit of $c$ is the OR of the two corresponding bits in $a$ and $b$.
For example:
### Input
- The first line contains an integer $q$.
- The next $q$ lines each contain two non-negative integers $a$ and $b$.
### Output
- Print $q$ lines, each line containing an integer representing the result.
### Constraints
- $1 \le q \le 10^5$.
- $0 \le a, b < 2^{15}$.
### Example
Input:
```
5
14770 18964
14658 8827
30303 24969
30474 19570
10695 19875
```
Output:
```
30726
14425
29718
31768
28036
```
Topic
Bitmasks
Rating
1000
Solution (0)
Solution