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 <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,j,n) for(int i = (int)(j); i < (int)(n); i++)
#define mrep(i,n) for (int i = (int)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20)
ll INF = 1LL << 60;
ll mod = 1e9 + 7;
ll modn = 998244353;

int vec[10001];
int cosuu(int n) {
	if(n<20) {
		return vec[n];
	}
	int ans=0;
	for(int i=1;i<=41;i++)for(int j=i;j<=41;j++)for(int k=j;k<=41;k++) {
		int s=i*i+j*j+k*k+i*j+j*k+k*i;
		if(s==n) {
			if(i==j==k) ans++;
			else if(i==j||i==k||j==k) ans+=3;
			else ans+=6;
		}
		if(s>n) break;
	}
	vec[n-1]=ans;
  	return vec[n-1];
}
int main() {
	vec[0]=0;
	vec[1]=0;
	vec[2]=0;
	vec[3]=0;
	vec[4]=0;
	vec[5]=1;
	vec[6]=0;
	vec[7]=0;
	vec[8]=0;
	vec[9]=0;
	vec[10]=3;
	vec[11]=0;
	vec[12]=0;
	vec[13]=0;
	vec[14]=0;
	vec[15]=0;
	vec[16]=3;
	vec[17]=3;
	vec[18]=0;
	vec[19]=0;
	int n; cin >> n;
	rep(i,n) {
		cout << cosuu(i) << endl;
	}
}