You are learning how to count in math class today! To demonstrate this invaluable ability, your teacher wrote the first
positive integers on the chalkboard. However, when he went for a quick bathroom break, Jennifer the delinquent took the chance to erase
of the numbers on the board! When your teacher returned, he summed up all the remaining numbers on the board and called it
. Naturally, since your teacher is a genius, he did not mess up his calculations when summing up the numbers and
is computationally correct. However,
wasn't exactly the number he expected to get! As the teacher's pet an exemplary student, please help your teacher find the number of possible unordered pairs of numbers Jennifer erased. To ensure the integrity of your solution, there may be up to
test cases.
Constraints



Subtask 1 [10%]

Subtask 2 [20%]

Subtask 3 [70%]
No additional constraints.
Input Specification
The first line contains an integer
, the number of test cases. The next
lines describe the test cases.
The first and only line of each test case contains
integers
and
, as specified in the problem statement.
Output Specification
For each test case output one integer on its own line, the number of possible unordered pairs of numbers Jennifer erased.
Sample Input
Copy
2
5 9
2 0
Sample Output
Copy
2
1
Explanation
For the first test case, your teacher initially wrote the numbers
on the board. After Jennifer erased
numbers, the remaining sum is
. There are
possible unordered pairs of numbers Jennifer could've erased, namely
leaving
, or
leaving
.
For the second test case, the only possibility is that Jennifer erased
and
since those are the only numbers on the board, so the answer is
.
Comments