spoj#PTC. Pythagorean Triple Counting
Pythagorean Triple Counting
There are already some SPOJ problems related to Pythagorean triples. Here is another one: Given an integer n, calculate the number p(n) of Pythagorean triples with at least one cathetus of length n.
Input
Input starts with a positive integer t≤1000, the number of testcases.
Each of the following t lines contains a positive integer n≤1015.
Output
For every n print the value of p(n) in a single line.
Example
Input: 3 4 5 6</p>Output: 1 1 1
Explanation: The only Pythagorean triple that has a cathetus with length 4 is (3,4,5), so p(4)=1.
Note: If you find the time limit too strict, you may first try the tutorial version with identical test data, but increased time limit. I also recommend to solve problems WPC5A and CATHETEN first.