Problem:
Score : 300 points

Problem Statement

Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:

1 \leq x,y,z

x^2 + y^2 + z^2 + xy + yz + zx = n

Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).

Constraints

All values in input are integers.

1 \leq N \leq 10^4

Input

Input is given from Standard Input in the following format:

N

Output

Print N lines. The i-th line should contain the value f(i).

Sample Input 1

20

Sample Output 1

0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0

For n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.

For n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.

For n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.

For n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.

Solution in C# (.NET Core 3.1.201) (judge verdict: Time Limit Exceeded)

using System;
namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] F = new int[n + 1];
            for(int x = 1; x <= (n / 3) + 1; x++)
            {
                for (int y = x; y <= (n / 3) + 1; y++)
                {
                    for(int z=y; z <= (n / 3) + 1; z++)
                    {
                        int t = x * x + y * y + z * z + x * y + y * z + z * x;
                        if (t <= n)
                        {
                            if (x == y && y == z) F[t] = 1;
                            else if (x == y || y == z || z == x) F[t] = 3;
                            else if(x!=y && y!=z && z != x)
                            {
                                F[t] = 6;
                            }
                        }
                    }
                }
            }
            for(int i = 1; i <= n; i++)
            {
                Console.WriteLine(F[i]);
            }
        }
    }
}
//namespace C
//{
//    class Program
//    {
//        static void Main(string[] args)
//        {
//            int n = int.Parse(Console.ReadLine());
//            bool[] F = new bool[n+1];
//            F[6] = true;
//            for(int i = 4; i <= 123; i++)
//            {
//                for(int x = 1; x <= (i % 3)+1; x++)
//                {
//                    for(int y = x; y <= (i % 2)+1; y++)
//                    {
//                        for(int z = y; z <= i - 2; z++)
//                        {
//                            if (x + y + z == i)
//                            {
//                                int t = (int)Math.Pow(i, 2) - (x * y +y*z+z*x);
//                                if (t <= n) F[t] = true;
//                            }
//                        }
//                    }
//                }
//            }
//            for(int i = 1; i <= n; i++)
//            {
//                if (!F[i]) Console.WriteLine(0);
//                else if (i == 6) Console.WriteLine(1);
//                else Console.WriteLine(3);
//            }
//        }
//    }
//}

//間に合わない
//namespace C
//{
//    class Program
//    {
//        static void Main(string[] args)
//        {
//            int n = int.Parse(Console.ReadLine());
//            int[] F = new int[n + 1];
//            for(int m = 1; m <= n; m++)
//            {
//                for (int i = 1; i <= 123; i++)
//                {
//                    for (int j = 1; j <= 123; j++)
//                    {
//                        for (int k = 1; k <= 123; k++)
//                        {
//                            if (Chk(n, i, j, k)) F[n]++;
//                        }
//                    }
//                }
//            }
//            for(int i = 1; i <= n; i++)
//            {
//                Console.WriteLine(F[i]);
//            }
//        }
//        static public bool Chk(int n,int x,int y,int z)
//        {
//            if (n == (int)Math.Pow(x + y + z, 2) - (x * y + y * z + z * x)) return true;
//            return false;
//        }
//    }
//}