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++ (GCC 9.2.1) (judge verdict: Wrong Answer)

#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
#include<limits.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;

//最大公約数
int gcd(int a,int b){
    return b ? gcd(b,a%b):a;
}

//最小公倍数
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

//素数判定
bool isPrime(int x){
    if(x<2)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

//桁ごとの足し算
int digsum(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}

//約数列挙
vector<int> enum_div(int n){
    vector<int> ret;
    for(int i=1;i*i<=n;++i){
        if(n%i==0){
            ret.push_back(i);
            if(i*i !=n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

//累乗の計算とあまり,0で累乗そのまま出力
long long modpow(long long a,long long n,long long mod){
    if(mod==0)mod=__LONG_LONG_MAX__;
    long long res=1;
    while(n>0){
        if(n & 1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int N;
int main(){
    cin>>N;
    for(int i=1;i<=N;++i){
        int ans=0;
        int x=1;
        int y=1;
        int z=1;
        while(1){
            int result=x*x + y*y + z*z + x*y + y*z + z*x;
            if(result == i)ans++;
            else if(result>i) break;
            x++;
            y++;
            z++;
        }
        x=1;
        y=1;
        z=1;
        while(1){
            while(1){
                int result=x*x + y*y + z*z + x*y + y*z + z*x;
                if(result == i && x!=z)ans+=3;
                else if(result>i) break;
                z++;
            }
            z=1;
            int result=x*x + y*y + z*z + x*y + y*z + z*x;
            if(result>i) break;
            x++;
            y++;
        }
        while(1){
            while(1){
                while(1){
                    int result=x*x + y*y + z*z + x*y + y*z + z*x;
                    if(result == i)ans+=6;
                    else if(result>i) break;
                    z++;
                }
                y++;
                z=y+1;
                int result=x*x + y*y + z*z + x*y + y*z + z*x;
                if(result>i) break;
            }
            x++;
            y=x+1;
            z=y+1;
            int result=x*x + y*y + z*z + x*y + y*z + z*x;
            if(result>i) break;
        }
        cout<<ans<<endl;
    }
    
    return 0;
}