TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

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 which all the 3 corners at the grid node (integer coordinates). Your task is to count the number of those triangles.

Input Format

The input begins with C – number of test cases. (C<=100000)
Each test case consists of X, Y. (0<=X, Y<=10000)

Output Format

For each test case, output the result in a line.

Sample Input 1

2
0 3
1 1

Sample Output 1

0
4

Hints

Problem Source

Migrated from old NTUJ.

Shik and Tmt

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 200