#P12828. 「DLESS-2」XOR and Number Theory
「DLESS-2」XOR and Number Theory
Description
Given two integers and . You need to find the sum of over all pairs of integers that satisfy the following two conditions:
Here, denotes the bitwise XOR operation.
Since the result can be very large, output the answer modulo .
Input Format
There are multiple test cases. The first line contains a single positive integer , indicating the number of test cases.
For each test case, there is a single line containing two integers, and .
Output Format
For each test case, output a single line containing one integer, representing the answer modulo .
3
8 3
11 3
114514 11451
7
13
184193935
Hint
For all test data, it is guaranteed that:
This problem uses subtasks for grading. The description for each subtask is as follows:
| Subtask | Points | |||
|---|---|---|---|---|
京公网安备 11011102002149号