#P1586. 四方定理

四方定理

Description

The four-square theorem is well known: any positive integer nn can be written as a sum of at most four squares of integers. For example: 25=12+22+22+4225=1^{2}+2^{2}+2^{2}+4^{2}, and there are other representations as well, 25=42+3225=4^{2}+3^{2} and 25=5225=5^{2}. Given a positive integer nn, write a program to count the total number of its representations. Note: 25=42+3225=4^{2}+3^{2} and 25=32+4225=3^{2}+4^{2} are considered the same representation.

Input Format

The first line contains a positive integer t(1t100)t(1 \le t \le 100), followed by tt lines, each containing a positive integer n(1n32768)n(1 \le n \le 32768).

Output Format

For each positive integer nn, output the total number of representations.

1
2003
48

Hint

Translated by ChatGPT 5