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())
n = [0 for _ in range(N)]

def cob(m):
    if m <= 0:
        return m
    return m + cob(m-1)


test = 0
for x in range(1,N+1):
    for y in range(1,x+1):
        if N < x*y:
            break
        for z in range(1,y+1):
            ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if len(set([x,y,z])) == 3:
                cnt = 6
            elif len(set([x,y,z])) == 2:
                cnt = 3
            else:
                cnt = 1
            if ans > N:
                break
            n[ans-1] += cnt

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

Solution (Python):

import math


def keisan(N):
    ans = 0
    
    
    j= 100
    
    for x in range(1,j+1):
        for z in range(1,j+1):
            D =  (x+z)*(x+z)-4*(x*x+z*z+z*x-N)
            if D>=0:
                y = -(x+z)+math.sqrt(D)
                y = y/2
                
                
                if y>=1 and y.is_integer() == True:
                    ans = ans+1
                    
    print(ans)
        

N = int(input())
for i in range(1,N+1):
    keisan(i)

Solution (Python):

import math
n = int(input())

sqn = int(math.sqrt(n))+1
count = 0
aset = [0]*(n+1)
for x in range(1,sqn):
    for y in range(x,sqn):
        for z in range(y,sqn):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if a <= n:
                if x == y and y ==z:
                    aset[a] +=1
                else:
                    if x == y or y ==z:
                        aset[a] +=3
                    else:
                        aset[a] +=6

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

Solution (Python):
import itertools

def calculateFunction(x, y, z):
    tmp = x + y + z
    return tmp * tmp - (x*y + y*z + z*x)

lis = []
for i in range(110):
    lis.append(i+1)

fullset = [0] * 10000
for team in itertools.product(lis, repeat = 3):
    ans = calculateFunction(team[0], team[1], team[2])
    if (ans <= 10000):
        fullset[ans - 1] += 1

X = int(input())

for i in range(X):
    print(fullset[i])

Solution (Python):
def func(n):
    cnt = 0
    a = int(n**0.5)
    for x in range(1, a+1):
        for y in range(x, a+1):
            z = y
            while(x**2+y**2+z**2+x*y+y*z+z*x <= n):
                if(x**2+y**2+z**2+x*y+y*z+z*x == n):
                    if(x == y == z):
                        cnt += 1
                    elif(x != y and y != z and z != x):
                        cnt += 6
                    else:
                        cnt += 3    
                    break
                z += 1
    return cnt

N = int(input())
    
for i in range(1, N+1):
    print(func(i))

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

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

for i in ans:
    print(i)

Solution (Python):
N = int(input())
List = [0 for _ in range(10000)]

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 + z*x
      if k<=N:
        List[k-1] += 1
        
for i in range(N):
  print(List[i])

Solution (Python):
import itertools

n = int(input())
ans_d = {i: 0 for i in range(1,10001)}

p = itertools.product(range(1, 100), range(1, 100), range(1, 100))

for x, y, z in p:
    cnt = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (x * z)
    if cnt <= 10000:
        ans_d[cnt] += 1

for i, j in ans_d.items():
    print(j)
    if i == n:
        break

Solution (Python):
import math
N = int(input())
x = math.ceil(math.sqrt(N))
ans = [0]*N

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

for i in range(1,x):
    for j in range(i,x):
        for k in range(j,x):
            s = f(i,j,k)
            t = len(set([i,j,k]))
            if N >= s:
                if t == 3:
                    ans[s-1] += 6
                elif t == 2:
                    ans[s-1] += 3
                elif t ==1:
                    ans[s-1] += 1
for i in range(len(ans)):
    print(ans[i])

Solution (Python):
n=int(input())
def f(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x
fdict={}
for i in range(1,n+1):
    fdict[i]=0
for x in range(1,n):
    if f(x,1,1)>n:
        break
    for y in range(x,n):
        if f(x,y,1)>n:
            break
        for z in range(y,n):
            if f(x,y,z)>n:
                break
            if x==y and y==z:
                fdict[f(x,y,z)]+=1
            elif x==y or y==z or z==x:
                fdict[f(x,y,z)]+=3
            else:
                fdict[f(x,y,z)]+=6
for N in range(1,n+1):
    print(fdict[N])

Solution (Python):
n = int(input())
memo = [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):
            num = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if num <= n:
                memo[num] += 1
            elif num > n:
                break
for i in range(1, n + 1):
    print(memo[i])

Solution (Python):
from collections import defaultdict
n = int(input())
d = defaultdict(lambda: 0)
for a in range(1, 10**2):
    for b in range(1, 10**2):
        for c in range(1, 10**2):
            t = a**2+b**2+c**2+a*b+b*c+c*a
            if t <= n:
                d[t] += 1
            else:
                break

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