CT2  Counting triangles 2
Consider a 2D integer grid with lower left corner at (0, 0) and upper right corner at (X, Y).
We are interested in isosceles right triangles with all the 3 corners at the grid nodes (integer coordinates).
Input
The input begins with the number T of test cases in a single line.
In each of the next T lines there are two integers X, Y.
Output
For each test case, on a single line, print the number of such triangles.
Example
Input: 2 0 3 1 1 Output: 0 4
Constraints
1 <= T <= 10^4 0 <= X <= 10^4 0 <= Y <= 10^4
Information
Your challenge is to give in time the answer with the shortest code.
This problem is CT with more challenging constraints. Source limit is 512B
My poorly golfed Py3 code scored 158B in 0.87s (for two input files). (time updated 20170211 ; compiler changes)
hide comments
shubhankaryash:
20150529 16:44:15
can u give some more test cases?


Francky:
20140605 09:43:55
I've increase a little time limit for slower languages.

Added by:  Francky 
Date:  20140604 
Time limit:  5s 
Source limit:  512B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 