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


a={}
b=[]
for i in range(1,120):
    for j in range(i,120):
        for k in range(j,120):
            n=i*i+j*j+k*k+i*j+i*k+j*k

            if n not in a:
                if i==j and j==k:
                    a[n]=1
                elif i==j or j==k or i==k:
                    a[n]=3
                else:
                    a[n]=6
            else:
                if i==j and j==k:
                    a[n]+=1
                elif i==j or j==k or i==k:
                    a[n]+=3
                else:
                    a[n]+=6

t=int(input())
for i in range(1,t+1):
    if i in a:
        print(a[i])
    else:
        print(0)

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

ans = [0]*10001
a = [1,1,1]

while (a[0]+1)**2 <= n-2:
    a[1]=1
    while (a[1]+a[0])*(a[1]+1)+a[0]**2<=n-1:
        a[2]=1
        while a[0]**2+a[1]**2+a[2]**2+a[0]*a[1]+a[1]*a[2]+a[2]*a[0] <= n:
            ans[a[0]**2+a[1]**2+a[2]**2+a[0]*a[1]+a[1]*a[2]+a[2]*a[0]] += 1
            a[2] += 1
        a[1]+=1
    a[0]+=1
for i in range(1,n+1):
    print(ans[i])

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

l = [0] *(10005)

for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            k = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if k <= 10004:
                l[k] += 1

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

Solution (Python):
import sys
import math
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    N = readint()

    ans = {i: 0 for i in range(1, 20000)}
    for i in range(3, 124):
        for j in range(1, i):
            for k in range(1, i):
                l = i - j - k
                if l <= 0:
                    break
                else:
                    v = j ** 2 + k ** 2 + l ** 2 + j * k + k * l + j * l
                    ans[v] += 1
    for i in range(1, N + 1):
        print(ans[i])


if __name__ == "__main__":
    main()

Solution (Python):
import collections
n = int(input())
s = 10**2
A = []
for i in range(1,s+1):
    for j in range(1,s+1):
        for k in range(1,s+1):
            A.append(i**2 + j**2 + k**2 + i*j + j*k + k*i)
Ac = collections.Counter(A)

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

Solution (Python):
import sys

def L(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI():return list(map(int,sys.stdin.readline().rstrip().split()))
def LS():return list(sys.stdin.readline().rstrip().split())

def solver(N):
    ans = 0

    list = [0] * (10**4+1)
    for x in range(1,101):
        for y in range(1,101):
            for z in range(1,101):
                n = x*x+y*y+z*z+x*y+y*z+z*x
                if n <= 10**4:
                    
                    list[n] += 1
    for i in range(1,N+1):
        print(list[i])

def main():

    N = I()

    solver(N)

if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np


arr = np.zeros(100000, dtype=np.int32)

for s in range(3, 128+1):
    for x in range(1, s-2+1):
        for y in range(1, s-1+1):
            z = s - (x + y)
            if z <= 0:
                continue
            arr[s**2 - (x*y + y*z + z*x) - 1] += 1

num = int(input())
for i in range(0, num):
    print(arr[i])

Solution (Python):
n = int(input())
ans = [0] * 10001
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x <= n:
                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):
import math
N=int(input())
ans=[0]*(N+1)

for x in range(1,int(math.sqrt(N))+1):
    for y in range(1,int(math.sqrt(N))+1):
        for z in range(1,int(math.sqrt(N)+1)):
            c=x**2+y**2+z**2+x*y+y*z+z*x
            if c<=N:
                ans[c]+=1

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

Solution (Python):
n=int(input())
lis=[0]*(n+1)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            k=x**2+y**2+z**2+x*y+y*z+x*z
            if k<=n:
                lis[k]+=1
for i in range(1,n+1):
    print(lis[i])

Solution (Python):
n=int(input())
num=100
d={}
for i in range(1,n+1):
    d[i]=0
for i in range(1,num+1):
    for j in range(1,num+1):
        for k in range(1,num+1):
            val=(i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(k*i)
            if val>n:
                continue
            
            
            
            d[val]=d[val]+1
for i in range(1,n+1):
    print(d[i])

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
















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





for i in range(1, N + 1):
    f = 0
    
    right = 2 * i
    
    for x in range(1, 101):
        if f1(x, 1, 1) > right:
            break
        for y in range(x, 101):
            if f1(x, y, 1) > right:
                break

            for z in range(y, 101):
                
                left = f1(x, y, z)
                if left > right:
                    break
                if left == right:
                    
                    if x == y == z:
                        
                        f += 1
                    elif x == y or y == z or z == x:
                        
                        f += 3
                    else:
                        
                        f += 6
    print(f)

Solution (Python):
n = int(input())
ans = [0] * n
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):
            res = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if res <= n:
                ans[res - 1] += 1
            elif res > n:
                break

for x in ans:
    print(x)

Solution (Python):
n=int(input())
from collections import Counter
c=Counter([])
k=int(pow(n//3,0.5))
for i in range (1,k+1):
    c[12*i*i]+=1
z=int(pow(2*n,0.5))+1
for i in range(2,z):
    for j in range(i+1,z):
        if (i+i+j)%2==0 and ((i+i+j)//2)>j:
            c[i**2+i**2+j**2]+=3
        if (i+j+j)%2==0 and ((i+j+j)//2)>j:
            c[i**2+j**2+j**2]+=3
for i in range(2,z):
    for j in range(i+1,z):
        for k in range(j+1,z):
            a=(i+j+k)
            if a%2==0 and a//2 > k:
                c[i**2+j**2+k**2]+=6
                
for i in range(1,n+1):
    print (c[2*i])

Solution (Python):
n = int(input())
ans = [0 for i in range(n)]
for x in range(1, n+1):
    if x ** 2 >= n:
        break
    for y in range(x, n+1):
        if x**2 + y**2 >= n:
            break
        for z in range(y, n+1):
            val = (x+y+z)**2 - x*y - y*z - z*x
            if val > n:
                break
            if x == y == z:
                ans[val-1] += 1
            elif x == y or y == z:
                ans[val-1] += 3
            else:
                ans[val-1] += 6
                
for i in ans:
    print(i)

Solution (Python):
n=int(input())
a=[0]*60003
for i in range(1,99):
    for j in range(i,100):
        for k in range(j,101):
            if i==j and j==k:
                l=6*k**2
                a[l]+=1
            elif i!=j and j!=k:
                l=i**2+j**2+k**2+i*j+j*k+k*i
                a[l]+=6
            else:
                l=i**2+j**2+k**2+i*j+j*k+k*i
                a[l]+=3

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

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

from collections import defaultdict
d = defaultdict(int)

ul=int(n**0.5)

for i in range(1,ul):
  for j in range(1,ul):
    for k in range(1,ul):
      d[i**2+j**2+k**2+i*j+j*k+k*i]+=1
for j in range(1,n+1):
  print(d.get(j,0))

Solution (Python):
n=int(input())
c=[0 for _ in range(n+1)]
flag=[False for _ in range(n+1)]

for x in range(1,n+1):
    for y in range(1,n+1):
        for z in range(1,n+1):
            i=x*x + y*y + z*z + x*y + y*z + z*x
            if(i>n):
                break
            elif(x==y and y==z and z==x):

                if(flag[i]):
                    pass
                else:
                    c[i]+=1
                    flag[i]=True
            else:

                c[i]+=1
        j=x*x + y*y + 1 + x*y + y + x
        if(j>n):
            break
    k=x*x + 1 + 1 + x + 1 + x
    if(k>n):
        break

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

Solution (Python):
import sys
import math
import statistics
import itertools
from collections import deque
N=int(input())

ans_lis =[0]*10000000


nn=math.sqrt(N)
n=int(nn)

for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            tmp=0
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            ans_lis[tmp-1]+=1
for g in range(N):
    print(ans_lis[g])

Solution (Python):
from itertools import product

N = int(input())

cnt = [0]*100000000

for x in range(1,N):
    flag=0
    for y in range(1,N):
        if x*y>=10**4:
            flag=1
            break
        for z in range(1,N):
            if flag==1:
                break
            elif x*z>=10**4 or y*z>=10**4:
                
                break
            else:
                if x**2 + y**2 + z**2 + x*y + y*z + z*x <=10**4+1:
                    cnt[x**2 + y**2 + z**2 + x*y + y*z + z*x -1] += 1



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

Solution (Python):
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case 


def solve(n):
    result = [0] * n
    for i in range(1, n+1):
        i2 = pow(i, 2)
        for j in range(i, n+1):
            j2 = pow(j, 2)
            for k in range(j, n+1):
                k2 = pow(k, 2)
                curr = i2 + j2 + k2 + i*j + i*k + j*k
                if curr > n:
                    break
                count = 6
                if i == j and i == k:
                    count = 1
                elif i == j or i == k or j == k:
                    count = 3
                result[curr-1] += count
    return result


if __name__ == "__main__":
    n = int_in()
    result = solve(n)
    for item in result:
        out(item)

Solution (Python):
N = int(input())
ans = [0]*N
if N > 3:
    n = int((N-3)**(0.5))+1
    nums = [i for i in range(1, n)]
    for x in range(1, n):
        for y in range(1, n):
            for z in range(1, n):
                i = x**2+y**2+z**2+x*y+x*z+y*z
                if i > N:
                    break
                else:
                    ans[i-1] += 1
for a in ans:
    print(a)

Solution (Python):






def main():
    N = int(input())
    f = [{} for _ in range(N+1)] 
    if len(f) > 6:
        f[6] = {(1,1,1):1}
    for i in range(N):
        args = f[i]
        for (x,y,z),k in args.items():
            index = i + 2*x + y + z + 1
            arg = (x+1,y,z)
            if index < N+1:
                f[index][arg] = 1
            index = i + x + 2*y + z + 1
            arg = (x,y+1,z)
            if index < N+1:
                f[index][arg] = 1
            index = i + x + y + 2*z + 1
            arg = (x,y,z+1)
            if index < N+1:
                f[index][arg] = 1

    for i in range(1,N+1):
        print(sum(f[i].values()))


main()

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

ans = [0 for i in range(n)]

for x in range(1, 99):
    for y in range(1, 99):
        for z in range(1, 99):
            m = x*x + y*y + z*z + x*y + x*z + y*z
            if m > n:
                break
            ans[m-1] += 1
            
    
for i in range(n):
    print(ans[i])

Solution (Python):
N = int(input())
def cul(x, y, z):
    return(x**2 + y**2 + z**2 + x*y + y*z + z*x)

for n in range(1, N+1):
    m = 0
    ma = int((n**0.5)//1)
    ans = 0
    lim = ma + 1
    for x in range(1, lim):
        for y in range(x, lim):
            for z in range(y, lim):
                a = cul(x, y, z)
                if a == n:
                    if x == y == z:
                        ans += 1
                    elif x == y or y == z or z == x:
                        ans += 3
                    else:
                        ans += 6
                if a > n:
                    break
    print(ans)

Solution (Python):
N = int(input())
ans = [0] * N
for i in range(1,101):
    for j in range(1,101):
        if i ** 2 + j ** 2 > N: break
        for k in range(1,101):
            if i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i <= N:
                ans[i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i - 1] += 1
for i in ans: print(i)

Solution (Python):



def a():
    l, r, d = map(int, input().split())
    count = 0
    for i in range(l, r+1):
        if i % d == 0:
            count += 1
    print(count)


def b():
    n = int(input())
    a = list(map(int, input().split()))
    count = 0
    for i in range(0, n, 2):
        if a[i] % 2 == 1:
            count += 1
    print(count)


def c():
    n = int(input())
    f = [0]*n
    for x in range(1, 100):
        for y in range(x, 100):
            for z in range(y, 100):
                result = pow(x, 2)+pow(y, 2)+pow(z, 2)+x*y+y*z+x*z
                if result <= n:
                    if x == y == z:
                        f[result-1] += 1
                    elif x == y or y == z or x == z:
                        f[result-1] += 3
                    else:
                        f[result-1] += 6
                else:
                    break
    for i in f:
        print(i)


def d():
    print('')



c()

Solution (Python):
N=int(input())
dic={}
for i in range(1,N+1):
    dic[i]=0
for x in range(1,int(N**0.5)):
    for y in range(1,N-x**2):
        for z in range(1,N-(x**2+y**2+x*y)):
            if x**2+y**2+z**2+x*y+x*z+y*z>N:break
            if x**2+y**2+z**2+x*y+x*z+y*z in dic:
                dic[x**2+y**2+z**2+x*y+x*z+y*z]+=1


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

Solution (Python):
def resolve():
    '''
    code here
    '''
    import math
    N = int(input())

    num_max = int(math.sqrt(N)) +1

    n_list = [[] for _ in range(N+1)]
    for i in range(1, num_max+1):
        for j in range(1, num_max+1):
            for k in range(1, num_max+1):
                if i**2+j**2+k**2+i*j+j*k+k*i <= N:
                    n_list[i**2+j**2+k**2+i*j+j*k+k*i] += [[i, j, k]]
    
    
    for i in range(1, N+1):
        temp = n_list[i]
        if temp:
            print(len(temp))
        else:
            print(0)


if __name__ == "__main__":
    resolve()

Solution (Python):
N=input()
L=[ 0 for _ in range(N+1) ]
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):
            a=x**2+y**2+z**2+x*y+y*z+z*x
            if 1<=a<=N:
                L[a]+=1
for i in range(1,N+1):
    print L[i]

Solution (Python):
n = int(input())
ans = [0] * n
cnt = 0
k = []
x = 1
while x ** 2 < n:
    y = 1
    s_x = x ** 2
    while y ** 2 < n:
        z = 1
        s_y = y ** 2
        while z ** 2 < n:
            ans_tmp = s_x + s_y + z ** 2 + x * y + y * z + z * x
            if ans_tmp <= n:
                ans[ans_tmp - 1] += 1
            cnt += 1
            z += 1
        y += 1
    x += 1

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

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
    n = int(input())
    ans = [0]*(10**4+1)
    h = 0

    for i in range(1,99):
        for j in range(1,99):
            for m in range(1,99):
                h = i**2 + j**2 + m**2 + i*j + j*m + m*i
                if h >= (10**4)+1:
                    break
                ans[h] += 1

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

if __name__ == '__main__':
	main()

Solution (Python):
n = int(input())
ans = [0] * n
s = max(4, n - 2)
import math
t = math.sqrt(s)
t = math.floor(t)
for i in range(1, t + 1):
    for j in range(i, t + 2):
        for k in range(j, t + 3):
            x = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if x <= n:
                if i == j == k:
                    ans[x - 1] += 1
                elif i == j != k or i != j == k or i == k != j:
                    ans[x - 1] += 3
                elif i != k != j:
                    ans[x - 1] += 6
        
for i in ans:
    print(i)

Solution (Python):
import itertools
import math
import collections

def main():
    n = int(input())

    s = int(math.sqrt(n))
    a = list(itertools.product(range(1,s),repeat=3))

    ans = []
    for i in range(len(a)):
        t = a[i][0] ** 2 + a[i][1] ** 2 + a[i][2] ** 2 + a[i][0] * a[i][1] + a[i][1] * a[i][2] + a[i][2] * a[i][0]
        ans.append(t)
        

    c = collections.Counter(ans)
    for i in range(1,n+1):
        print(c[i])
        
        
main()