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 (Python):

N = int(input())
a = []
for n in range(1, N+1):
    ans = 0
    for x in range(1, int(n**(1/2))+1):
        for y in range(x, int(n**(1/2))+1):
            c = x**2 + y**2 + x*y - n
            b = x+y
            if b**2 - 4*c >= 0:
                d = (-b+(b**2-4*c)**(1/2))/2
                if int(d) == d and d >= 1:
                    if x != y:
                        ans += 2
                    else:
                        ans += 1
    print(ans)

Solution (Python):
n = int(input())
a = []
for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            a.append(i**2 + j**2 + k**2 + i*j + j*k + k*i)
a.sort()
ix = 0
for i in range(1, n+1):
    res = 0
    while(a[ix] == i):
        res+=1
        ix+=1
    print(res)

Solution (Python):
N=int(input())
ans=[0]*(N+1)
for x in range(1,int(N**0.5)+2):
  for y in range(1,int(N**0.5)+2):
    for z in range(1,int(N**0.5)+2):
      if x**2+y**2+z**2+x*y+x*z+y*z<=N:
        ans[x**2+y**2+z**2+x*y+x*z+y*z]+=1

for i in range(1,N+1):
  print(ans[i])

Solution (Python):
n=int(input())
l=[0]*10000000
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            k1=((i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(i*k))
            l[k1]+=1
for i in range(1,n+1):
    print(l[i])

Solution (Python):
N = int(input())
n = int(N**(1/2))

ans_list = [0]*(N)

for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            index = i**2+j**2+k**2+i*j+j*k+k*i

            if index>N:
                break

            ans_list[index-1] += 1

for i in ans_list:
    print(i)

Solution (Python):
import math
N=int(input())

ans=[0]*(10**4+1)

x,y,z=1,1,1
while True:
  if(x*x+y*y+z*z+x*y+y*z+z*x)<=N:
    ans[x*x+y*y+z*z+x*y+y*z+z*x]+=1
    z+=1
  else:
    z=1
    y+=1
    if not (x*x+y*y+z*z+x*y+y*z+z*x)<=N:
      y=1
      x+=1
      if x==N+1:break
for i in range(1,N+1):
  print(ans[i])

Solution (Python):
n=int(input())
ans=[0]*(6*(10**4)+1)
for i in range(1, 101):
  for j in range(1, 101):
    for k in range(1, 101):
      ans[i**2+j**2+k**2+i*j+j*k+k*i]+=1

for i in range(1, n+1):
  print(ans[i])

Solution (Python):
n = int(input())
import math
res = 0
arr = [0]*(n+1)
for i in range(1,int(math.sqrt(n)+2)):
    for j in range(1,int(math.sqrt(n)+2)):
        for k in range(1,int(math.sqrt(n)+2)):
            tmp = int(pow(i,2)+pow(j,2)+pow(k,2)+i*j+j*k+k*i)
            if tmp <= n:
                arr[tmp] += 1
for i in range(1,n+1):
    print(arr[i])

Solution (Python):
n = int(input())
dp = [0 for i in range(n+1)]
maxn = n**0.5
maxn = int(maxn)+1
for x in range(1,maxn):
    for y in range(1,maxn):
        for z in range(1,maxn):
            p = x*x + y*y + z*z + x*y + y*z +z*x
            if p<=n:
                dp[p]+=1
for i in dp[1::]:
    print(i)

Solution (Python):
n=int(input())
rt_n=int(n**0.5)
ans=[0]*n
for x in range(1,rt_n):
    for y in range(1,rt_n):
        for z in range(1,rt_n):
            t= x*x + y*y + z*z + x*y + y*z + z*x
            if t<=n:
                ans[t-1]+=1
print(*ans,sep="\n")

Solution (Python):
from itertools import combinations_with_replacement
from collections import Counter

N = int(input())
ans = [0] * (N+1)
for x in combinations_with_replacement(range(1,99),3):
    temp = x[0] ** 2 + x[1] ** 2 + x[2] ** 2 + x[0] * x[1] + x[1] * x[2] + x[2] * x[0]
    if temp <= N:
        tc = Counter(x)
        if len(tc) == 1:
            ans[temp] += 1
        elif len(tc) == 2:
            ans[temp] += 3
        else:
            ans[temp] += 6
for x in ans[1:]:
    print(x)

Solution (Python):
n = int(input())

from collections import defaultdict
d = defaultdict(int)

def f(x, y, z):
    return pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x


for x in range(1, 100):
    for y in range(x, 100):
        for z in range(y, 100):
            tmp = f(x, y, z)
            if x == y == z:
                d[tmp] += 1
            elif x == y or y == z or z == x:
                d[tmp] += 3
            else:
                d[tmp] += 6

for i in range(1, n + 1):
    print(d[i])

Solution (Python):
N = int(input())
a = [0]*60001
for i in range(1,100):
  for j in range(1,100):
    for k in range(1,100):
      a[i**2+j**2+k**2+i*j+j*k+k*i]+=1
for i in a[1:N+1]:
  print(i)

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
li = [0]*10**5
for x in range(1, 100):
  for y in range(1, 100):
    for z in range(1, 100):
      a = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if a > 10**4 + 10:
          continue
      li[a-1] += 1
for ans in li[0:n]:
  print(ans)

Solution (Python):
from math import sqrt
from itertools import combinations_with_replacement
from collections import defaultdict

N=int(input())
MAX=int(sqrt(N))
num=[i for i in range(1,MAX+1)]
d=defaultdict(int)
for x,y,z in list(combinations_with_replacement(num,3)):
    val=x**2+y**2+z**2+x*y+y*z+z*x
    if x==y and y==z and z==x:
        d[val]+=1
    elif x==y or y==z or z==x:
        d[val]+=3
    else:
        d[val]+=6

for i in range(1,N+1):
    print(d[i])

Solution (Python):
n = int(input())
ans = [0]*(10**5)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            a = x**2 + y**2 + z**2 + x*y + y*z + z*x
            ans[a] += 1
for i in range(n):
    print(ans[i+1])

Solution (Python):
import math
N=int(input())
K=int(math.sqrt(N/6))+1
L=int(math.sqrt(N/3))+1
M=int(math.sqrt(N))+1


ls=[0 for i in range(M**3+1)]

def f(x,y,z):
  return x**2+y**2+z**2+x*y+y*z+z*x

for i in range(1,K):
  ls[f(i,i,i)]+=1

for i in range(1,K):
  for j in range(i+1,M):
    ls[f(i,i,j)]+=3
    ls[f(i,j,j)]+=3
    
for i in range(1,K):
  for j in range(i+1,L):
    for k in range(j+1,M):
      ls[f(i,j,k)]+=6
      
for i in range(1,N+1):
  print(ls[i])

Solution (Python):
n=int(input())
import math
nn=int(math.sqrt(n))+1
a=[0]*(100*n)
for x in range(1,nn+1):
    for y in range(1,nn+1):
        for z in range(1,nn+1):
            a[(x+y+z)**2-x*y-x*z-y*z]+=1
for i in range(1,n+1):
    print(a[i])

Solution (Python):
N = int(input())

ans = [0]*(10**5)
for x in range(1,110):
    for y in range(1,110):
        for z in range(1,110):
            cnt = x**2 + y**2 + z**2 + x*y + y*z + z*x
            ans[cnt] += 1
        
for i in range(1,N+1):
    print(ans[i])

Solution (Python):
f=[0 for i in range(10**4 + 1)]



for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            if (x**2 + y**2 + z**2 + x*y+y*z+x*z) < len(f):
                f[x**2 + y**2 + z**2 + x*y+y*z+x*z]+=1

N=int(input())
for i in range(1,N+1):
    print(f[i])

Solution (Python):
n=int(input())
ans=[0]*10000
for x in range(1,101):
    for y in range(x,101):
        for z in range(y,101):
            k=x**2+y**2+z**2+x*y+y*z+z*x
            if k<=10**4:
                if x==y and x==z:
                    ans[k-1]+=1
                elif x==y and x!=z:
                    ans[k-1]+=3
                elif x!=y and y==z:
                    ans[k-1]+=3
                elif x!=y and x!=z:
                    ans[k-1]+=6
for x in range(n):
    print(ans[x])

Solution (Python):
N = int(input())
ans = [0]*(N)

if N <= 3:
  for i in range(N):
    print(0)
  exit()

M = int((N-2)**0.5)
 
for x in range(1, M+1):
  for y in range(1, M+1):
    for z in range(1, M+1):
      a = (x+y+z)**2 - (x*y + y*z + z*x)
      if a <= N:
      	ans[a-1] += 1
 
for i in range(N):
  print(ans[i])

Solution (Python):
from math import sqrt
N=int(input())
cnt=[0]*(N+1)
sn=int(sqrt(N))+1
for i in range(1,sn+1):
  for j in range(1,sn+1):
    for k in range(1,sn+1):
      l=i**2+j**2+k**2+i*j+j*k+k*i
      if l<N+1:
        cnt[l]+=1

for i in range(1,N+1):
  print(cnt[i])

Solution (Python):
def f(x,y,z):
  return x**2+y**2+z**2+x*y+y*z+z*x







n=int(input())
a=[0]*n
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      t=f(i,j,k)
      if t<=n:
        a[t-1]+=1

for aa in a:
  print(aa)

Solution (Python):
N = int(input())

memo = [0]*(N+1)
for i in range(1,150):
  for j in range(1,150):
    for k in range(1,150):
      n = (i+j)**2 + (j+k)**2 + (k+i)**2
      if n <= 2*N and n%2 == 0:
        memo[n//2] += 1
        
for i in memo[1:]:
  print(i)

Solution (Python):
N = int(input())
ans = [0]*(10**5)
a = 0
for x in range(1,10**2):
  for y in range(1,10**2):
    for z in range(1,10**2):
      ans[x**2 + y**2 + z**2 + x*y + y*z + z*x] += 1
for i in range(1,N+1):
  print(ans[i])

Solution (Python):
from collections import defaultdict

def f(x,y,z):
  return x**2 + y**2 + z**2 + x*y + y*z + z*x

N = int(input())

i = 1
dic = defaultdict(lambda: set())
dic[6].add((1,1,1))

while i <= N:
  if i in dic:
    print(len(dic[i]))
    for trio in dic[i]:
      x,y,z = trio
      dic[f(x,y,z+1)].add((x,y,z+1))
      dic[f(x,y+1,z)].add((x,y+1,z))
      dic[f(x+1,y,z)].add((x+1,y,z))
  else:
    print(0)
  i += 1

Solution (Python):
n = int(input())

a = int(n ** 0.5) + 1

m = {}
for x in range(1, a):
    for y in range(1, a):
        for z in range(1, a):
            v = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            m[v] = m.get(v, 0) + 1
for i in range(1, n + 1):
    print(m.get(i, 0))

Solution (Python):
print_cnt = int(input())

result = [0] * 10000

for x in range(100):
  for y in range(100):
    for z in range(100):
      if x*y*z == 0:
        continue
      tmp = x*x + y*y + z*z + x*y + y*z + z*x
      if tmp <= 10000:
        result[tmp-1] += 1

for i in range(print_cnt):
  print(result[i])

Solution (Python):


import collections
import sys
input=sys.stdin.readline

n=int(input())
ans=[0]*n
tmp=[]
for x in range(1,int(n**0.5)+1):
    for y in range(1,int(n**0.5)+1):
        for z in range(1,int(n**0.5)+1):
            tmp.append(x**2+y**2+z**2+x*y+y*z+z*x)

cnt=collections.Counter(tmp)
for i in range(1,n+1):
    print(cnt[i])

Solution (Python):
n=int(input())

n2=int(n**(0.5)+0.5)+1+1
f=[0]*(n+1)

for x in range(1,n2):
    for y in range(1,n2):
        for z in range(1,n2):
            v=x*x+y*y+z*z+x*y+y*z+z*x
            if v<=n:
                f[v]+=1
                
for v in range(1,n+1):
    print(f[v])

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 

from decimal import *



N = INT()
ans = [0]*N

for x in range(1, 110):
	for y in range(1, 110):
		for z in range(1, 110):
			n = (x+y+z)**2 - x*y-y*z-z*x
			if n <= N:
				ans[n-1] += 1

print(*ans, sep = "\n")

Solution (Python):
import math
con = 0;
n = int(input())
a = [0]*n

m = int(math.sqrt(n) // 1);
for x in range(1,m+1):
    for y in range(1,m+1):
        for z in range(1,m+1):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x;
            if s <= n:
                a[s-1] += 1;


for v in range(n):
    print(a[v]);

Solution (Python):
import itertools
import collections
n=int(input())
Lst=list(range(1,101))
lst=list(itertools.combinations_with_replacement(Lst,3))
a=[]
for i in range(len(lst)):
  x=lst[i][0]
  y=lst[i][1]
  z=lst[i][2]
  if x==y==z:
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)
  elif x!=y and y!=z and z!=x:
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)    
  else:
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)
    a.append(x**2+y**2+z**2+x*y+y*z+z*x)    
    
b=collections.Counter(a)
for i in range(1,n+1):
  print(b[i])

Solution (Python):
import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N = INT()

C = Counter()
for x in range(1, N+1):
    for y in range(1, N+1):
        if x**2 + y**2 + x*y > N:
            break
        for z in range(1, N+1):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n > N:
                break
            C[n] += 1

for i in range(1, N+1):
    print(C[i])