This problem is a programming version of Problem 233 from projecteuler.net
Let be the number of points with integer coordinates that are on a circle passing through , , and .
It can be shown that .
Given two integers and , what is the number of all positive integers such that ?
The first line of each test file contains a single integer which is the number of queries.
Each of the next lines contains two space-separated integers and .
Print the answer to each query on a new line.
Sample Input 0
Sample Output 0
Sample Input 1
Sample Output 1
The only integer less than such that is .
Sample Input 2
Sample Output 2
There exist only three integers such that : , and .