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.



Sample input:
20


Sample output:
0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0

Submission status: Wrong Answer

Solution code:
def main():
        
    import math

    N = int(input())

    for n in range(1, N + 1):
        max_itr = min(30, int(math.sqrt(n)) + 1)
        
        ans_list = []
        ans = 0
        
        for x in range(1, max_itr):
            # for y in range(1, x+1):
            for y in range(1, max_itr):

                # for z in range(1, x+1):
                for z in range(1, max_itr):

                    left_eq = x * x + y * y + z * z + x * y + y * z + z * x
                    if (left_eq == n):
                        ans_list = [x, y, z]
                        ans_len = len(set(ans_list))
                        


                        ans += 1
                        
                        # if (ans_len==3):
                        #     ans += 6
                        # elif (ans_len == 2):
                        #     ans += 3
                        # else:
                        #     ans += 1

        
        
        print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
n = int(input())

ans = [0]*n
for i in range(n):
	for x in range(1,math.floor(math.sqrt(n))):
		for y in range(1,math.floor(math.sqrt(n))):
			for z in range(1,math.floor(math.sqrt(n))):
				if pow(x,2) + pow(y,2) + pow(z,2) + x*y + y*z + z*x == i:
					ans[i] += 1
for i in range(n):
	print(ans[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
num=1
while True:
    if (num*num)*6>n:
        break
    num=num+1
num=2*num
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])

Submission status: Wrong Answer

Solution code:
def F(n):
    ans = 0
    if n < 6:
        return 0
    else:
        for x in range(1,int((n-3)**0.5)):
            for y in range(1,int((n-3)**0.5)):
                z = (n - 3/4*(x**2+y**2) - 1/2*x*y)**0.5 - (x+y)/2
                if isinstance(z,complex):
                    continue
                if z.is_integer() and z>=1:
                    ans += 1
    return ans
for i in range(1,int(input())+1):
    print(F(i))

Submission status: Wrong Answer

Solution code:
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,51):
        for j in range(1,51):
            for m in range(1,51):
                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()

Submission status: Wrong Answer

Solution code:
N = int(input())
l = [0] * N


x = 1
y = 1
z = 1

ans = 6
first_judge = 1
first_row_increment_judge = 0
#print("ans 6")

if N <= 5:
    for i in range(N):
        print(l[i])
else:
    while ans <= N:
        # print("x,y,z=",x,y,z)
        ans = (x + y + z)**2 - (x*y+ y*z + z*x)
        # print("ans",ans)
        if first_judge == 1 and ans > N:
            if first_row_increment_judge == 1:
                # print("break!")
                break
            else:
                x += 1
                y = x
                z = x
                first_row_increment_judge = 1
        if ans <= N:
            if x==y==z:
                # print("x=y=z!")
                l[ans-1] += 1
                first_judge = 0
            else:
                # print("list in")
                l[ans-1] += 3
                first_judge = 0
            z += 1
        else:
            y += 1
            z = y
            first_judge = 1
            ans = 0
            # print("kousin x,y,z=",x,y,z)
        #print("\n")
        
    for i in range(N):
        print(l[i])

Submission status: Wrong Answer

Solution code:
n = int(input())

def culc(number):
    count = 0
    num = int(number ** 0.5)
    for i in range(1, num+1):
        for j in range(1, num+1):
            x = i ** 2 + j ** 2 + i * j
            tmp = number - x
            if 0 < tmp <= num:
                for k in range(1, num+1):
                    ans = x + k * (k + i + j)
                    if ans == number:
                        count += 1
    return count

for i in range(1, n+1):
    if i < 6:
        print(0)
    elif i == 6:
        print(1)
    else:
        print(culc(i))

Submission status: Wrong Answer

Solution code:
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 flag==1:
            break
        elif x*y>=10**4:
            break
        for z in range(1,N):
            if x*z>=10**4 or y*z>=10**4:
                flag=1
                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])

Submission status: Wrong Answer

Solution code:
import math
 
n = int(input())
li = [0]*n
s = int(math.sqrt(2*n)) - 3
for i in range(1,s):
  for j in range(1,s):
    for k in range(1,s):
      if (i**2+j**2+k**2+i*j+i*k+j*k)<=n:
        if k == j and k == i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)-1] = 1
        elif k>j and j == i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)-1] = 3
        elif k>j and j>i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)-1] = 6
        elif k == j and j>i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)-1] = 3
for i in li:
  print(i)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
z=0
d=0
ans=0
for i in range(1,n+1):
  for x in range(1,int(math.sqrt(n))):
    d=4*x*x-4*(3*x*x-i)
    if d<0:
      continue
    z=(math.sqrt(d)-2*x)/2
    if z.is_integer():
      if x==int(z) and z>=1:
        ans+=1
        continue
      elif z>=1:
        ans+=3
        continue
    else:
      continue
    z=0
  print(ans)
  ans=0

Submission status: Wrong Answer

Solution code:
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)
        # print(ans)

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

Submission status: Wrong Answer

Solution code:
def main():
        
    import math

    N = int(input())

    for n in range(1, N + 1):
        max_itr = min(20, int(math.sqrt(n)) + 1)
        
        ans_list = []
        ans = 0
        
        for x in range(1, max_itr):
            # for y in range(1, x+1):
            for y in range(1, max_itr):

                # for z in range(1, x+1):
                for z in range(1, max_itr):

                    left_eq = x * x + y * y + z * z + x * y + y * z + z * x
                    if (left_eq == n):
                        ans_list = [x, y, z]
                        ans_len = len(set(ans_list))
                        


                        ans += 1
                        
                        # if (ans_len==3):
                        #     ans += 6
                        # elif (ans_len == 2):
                        #     ans += 3
                        # else:
                        #     ans += 1

        
        
        print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

for n in range(N):
    x = 1
    count = 0
    while x**2 < n:
        y = 1
        while x**2 + y**2 + x*y < n:
            z = 1
            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:
                    count += 1
                z += 1
            y += 1
        x += 1
    print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(1, n + 1):
    cnt = 0
    for x in range(1, 42):
        for y in range(x, 42):
            for z in range(y, 42):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == i:
                    cnt += 1
                    if (x == y and y != z) or (y == z and z != x) or (z == x and x != y):
                        print(cnt * 3)
                        break
                    elif x != y and y != z and z != x:
                        print(cnt * 6)
                        break
                    else:
                        print(cnt)
                        break
    if cnt == 0:
        print(cnt)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
def g(x,y,z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x
ans = []
def f(n):
    #sum = 0
    rn = int(math.sqrt(n))
    
    for i in range(1,rn+1):
        #print(i,end='')
        for j in range(1,rn+1):
            for k in range(1,rn+1):
                #print(i,j,k)
                if g(i,j,k) == n:
                    if (i == j and j==k):
                        #sum += 1
                        ans.append(str(1))
                        return
                    elif (i == j and j != k) or (i == k and j != k) or (i != j and j == k):
                        #sum += 3
                        ans.append(str(3))
                        return
                    else:#elif i != j and i != k and j != k:
                        #sum += 6
                        ans.append(str(6))
                        return
                elif g(i,j,k) > n:
                    break
    ans.append(str(0))
                

    

for i in range(1,n+1):
    f(i)

print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
f = [0] * n
sqrt_n = int(math.sqrt(n)/2) +1
for i in range(n) :
    for x in range(1,sqrt_n) :
        for y in range(1,sqrt_n) :
            for z in range(1,sqrt_n) :
                if x*x+y*y+z*z+x*y+y*z+z*x == i+1 :
                    f[i] += 1
for _ in range(n) :
    print(f[_])

Submission status: Wrong Answer

Solution code:
import math


def pattern(x, y, z):
    if x == y == z:
        return 1
    elif x != y and y != z and x != z:
        return 6
    else:
        return 3


def check(ans):
    cnt = 0
    for x in range(1, ans):
        if pow(x, 2) > ans:
            break
        for y in range(x, ans):
            if pow(x+y, 2) > ans:
                break
            for z in range(y, ans):
                tmp = x*(x+y+z) + y*(y+z) + z*z
                if tmp == ans:
                    cnt += pattern(x, y, z)
                elif tmp > ans:
                    break
    print(cnt)


N = int(input())
# x^2 + y^2 + z^2 + x*y + y*z + z*x = n

for i in range(N+1):
    #upper_value = int(math.sqrt(i))
    check(i)

Submission status: Wrong Answer

Solution code:
from numba import jit
nn = int(input())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))
#nn = 10**4

@jit
def aa(nn):
    ans_L = []
    for n in range(1,nn+1):
        ans = 0
        for x in range(1,41):
            for y in range(1,41):
                for z in range(1,41):
                    if x**2 + y**2 + z**2 + x*y + y*z + x*z == n:
                        ans += 1

        ans_L.append(ans)
    return ans_L

ans_L = aa(nn)
for i in ans_L:
    print(i)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())

ans = {}
for x in range(1,int(math.sqrt(n+1))+1):
    for y in range(1, x+1):
        for z in range(1, y+1):
            print(x,y,z)
            k = pow(x, 2) + pow(y, 2) + pow(z, 2) + x*y + x*z + y*z

            if k >n:
                break
            if len(set([x,y,z])) == 3:
                num = 6
            elif len(set([x,y,z])) == 2:
                num = 3
            else:
                num = 1
            if not k in ans:
                ans[k] = num
            else:
                ans[k] += num

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

Submission status: Wrong Answer

Solution code:
n=int(input())

def number(i):
   for j in range(1,41):
      for k in range(1,58):
         for u in range(1,101):
            if i==j*j+k*k+u*u+j*k+k*u+u*j:
               if j==k and k==u:
                  print(1)
                  return
               elif j==k or k==u:
                  print(3)
                  return
               else:
                  print(6)
                  return

   print(0)
   return

for h in range(n):
   number(h)

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
for a in range(1, N+1):
    n = 0
    top = int(math.sqrt(a))
    for b in range(1, top):
        for c in range(1, b+1):
            for d in range(1, c+1):
                sumsum=(b**2) + (c**2) + (d**2) + (b*c) + (c*d) + (d*b)
                if sumsum > a:break
                if sumsum == a:n += 1
    print(n)

Submission status: Wrong Answer

Solution code:
n=int(input())
num=1
while True:
    if (num*num)*6>n:
        break
    num=num+1
num=num+1
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])

Submission status: Wrong Answer

Solution code:
n = int(input())

anslist = [0] * 10**4
for i in range(1, int((10000/3)**0.5)+1):
    x = i
    for j in range(i, int(((10000-i**2)/2)**0.5)+1):
        y = j
        for k in range(j, int((10000-i**2-j**2)**0.5)+1):
            z = k
            uhen = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if uhen-1 >= 10**4:
                continue
            if x == y == z:
                anslist[uhen-1] = 1
            elif x != y and x != z and y != z:
                anslist[uhen-1] = 6
            else:
                anslist[uhen-1] = 3


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

Submission status: Wrong Answer

Solution code:
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(50):
    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])

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

N = int(input())

o = [0] * (N+1)
for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            n = int(i*i + j*j + k*k + i*j + j*k + k*i)
            if n > 1001:
                break
            if n < (N+1):
                o[n] += 1

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

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
N = 1
while N**2 < n:
    N += 1
if N ** 2 > n: N-=1
ans = [0] * n

for x,y,z in itertools.combinations_with_replacement(list(range(1,N+1)), 3):
    a = x**2+y**2+z**2 + x*y+y*z+z*x
    if a > n: continue
    if x==y==z: b = 1
    elif x==y or x==z or y==z: b = 3
    elif x!=y and y!=z and x!=z: b = 6
    ans[a-1] = b
for i in ans: print(i)

Submission status: Wrong Answer

Solution code:
f = lambda x, y, z: (x + y + z) ** 2 - x * y - y * z - z * x - 1

n = int(input())
a = [0] * n
z = 1
while f(1, 1, z) < n:
  y = 1
  while y < z and f(1, y, z) < n:
    x = 1
    while f(x, y, z) < n:
      a[f(x, y, z)] += 1
      x += 1
    y += 1
  z += 1
print(*a, sep='\n')

Submission status: Wrong Answer

Solution code:
import math
N = int(input()) + 1
Nroot = int(math.pow(N,1/3)) + 1
for n in range(1,N):
    count = 0
    if n >= 6:
#        print(Nroot, int(math.pow(n,1/3))-1)
        for x in range(Nroot, int(math.pow(n,1/3))-2 , -1):
            for y in range(x,0,-1):
                if (x+2*y)**2 < n:
                    break
                for z in range(1,y+1):
#                    print((x + y + z)**2 - (x*y + y*z + z*x), n,x,y,z)
#                    print(x,y,z)
                    formula = (x + y + z)**2 - (x*y + y*z + z*x)
                    if formula == n:
                        if x == y and y == z:
                            count += 1
                        else:
                            count += 3
                        break

        print(count)
    else:
        print("0")

Submission status: Wrong Answer

Solution code:
import time
import itertools


N = int(input())
def function(x,y,z,n):
    n_tmp = pow(x+y+z,2) - (x*y) - (y*z) -(x*z)
    if n == n_tmp:
        return True
    else:
        return False

count = 0
start = time.time()

p = list(itertools.combinations_with_replacement(range(1,10), 3))
# print(p)

for n in range(1,N):
    count = 0
    for p_in in p:
        if function(p_in[0],p_in[1],p_in[2],n) == True:
            if(p_in[0] == p_in[1] == p_in[2]):
                count = count + 1
            elif(p_in[0] == p_in[1] or p_in[1] == p_in[2] or p_in[2] == p_in[0]):
                count = count + 3
            else:
                count = count + 6

    print(count)



elapsed_time = time.time() - start
# print("elapsed_time:{0}".format(elapsed_time) + "[sec]")

Submission status: Wrong Answer

Solution code:
from itertools import combinations_with_replacement
N = int(input())

def calc(x: int, y: int, z: int) -> int:
    return x**2 + y**2 + z**2 + x*y + y*z + z*x

memo = {}
for x,y,z in combinations_with_replacement(range(1, 100), 3):
    l = len(set([x,y,z]))
    num = calc(x,y,z)
    if l == 1:
        memo[num] = 1
    elif l == 2:
        memo[num] = 3
    else:
        memo[num] = 6

for i in range(1, N+1):
    print(memo.get(i, 0))

Submission status: Wrong Answer

Solution code:
N = int(input())

keys = [i for i in range(1, N+1)]
values = [0] * N
count_dict = dict(zip(keys, values))

for x in range(1, N//6+7):
    for y in range(x, N//6+7):
        for z in range(y, N//6+7):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n > N:
                break
            if x == y and y == z:
                count_dict[n] += 1
            else:
                count_dict[n] += 3

for v in count_dict.values():
    print(v)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(1, n + 1):
    cnt = 0
    for x in range(1, 42):
        for y in range(x, 42):
            for z in range(y, 42):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == i:
                    cnt += 1
                    if (x == y and y != z) or (x == z and x != y) or (y == z and x != y):
                        print(cnt * 3)
                        break
                    elif x != y and y != z and z != x:
                        print(cnt * 6)
                        break
                    else:
                        print(cnt)
                        break
    if cnt == 0:
        print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(1,n+1):
    ans = 0
    for x in range(37):
        for y in range(37):
            for z in range(37):
                if (x+y+z)**2 -(x*y+y*z+z*x) == i and x>=1 and y>=1 and z>=1:
                    ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
keys=[]
for i in range(10**4):
  keys.append(str(i+1))
values=[0]*(10**4)
d=dict(zip(keys, values))
for x in range(1, 150):
  for y in range(x,150):
    tmp=(x+y)**2
    for z in range(y, 150):
      if tmp+(y+z)**2+(x+z)**2>20000:
        break
      if (tmp+(y+z)**2+(x+z)**2)%2==1:
        continue
      s=(tmp+(y+z)**2+(x+z)**2)//2
      key=str(s)
      if x==y and y==z:
        v=1
      elif (x==y and y<z) or (x<y and y==z):
        v=3
      elif x<y and y<z:
        v=6
      d[key]=v

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

Submission status: Wrong Answer

Solution code:
n = int(input())
if n > 1000:
    nn = n//2
else:
    nn=2
l = [int(i) for i in range(1,n//nn)]
import itertools
p_list = list(itertools.combinations_with_replacement(l, 3))
p=[]
s=[0]*100000000
for i in p_list:
    x=i[0]
    y=i[1]
    z=i[2]
    p.append((x+y+z)**2-x*y-y*z-z*x)

    if x==y and y==z and z==x:
        s[p[-1]]=1
    elif x==y or y==z or z==x:
        s[p[-1]]=3
    else:
        s[p[-1]]=6

for i in range(1,n+1):
    if i in p:
      print(s[i])
    else:
      print(0)

Submission status: Wrong Answer

Solution code:
from itertools import combinations_with_replacement

n = int(input())
l = list(combinations_with_replacement(range(1, 33), 3))
ans = [0] * (n + 1)
for x, y, z in l:
    if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x < n:
        t = len(set([x, y, z]))
        if t == 1:
            t = 1
        elif t == 2:
            t = 3
        elif t == 3:
            t = 6
        ans[x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x] += t

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

Submission status: Wrong Answer

Solution code:
import math
 
n = 50
li = [0]*n
s = int(math.sqrt(2*n)) - 2
for i in range(1,s):
  for j in range(1,s):
    for k in range(1,s):
      if (i**2+j**2+k**2+i*j+i*k+j*k)<=n:
        if k == j and k == i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)-1] = 1
        elif k>j and j == i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)-1] = 3
        elif k>j and j>i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)-1] = 6
        elif k == j and j>i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)-1] = 3
for i in li:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
ls = [0]*10000


for i in range(1,41):
    for j in range(1,41):
        for k in range(1,41):
            t = i**2 + j**2 + k**2 + i*j + j*k + k*i 
            ls[t-1] = ls[t-1] + 1

for p in range(0,N):
    print(ls[p])

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(1,n+1):
    ans = 0
    for x in range(35):
        for y in range(35):
            for z in range(35):
                if (x+y+z)**2 -(x*y+y*z+z*x) == i and x>=1 and y>=1 and z>=1:
                    ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
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,51):
        for j in range(1,51):
            for m in range(1,51):
                h = i**2 + j**2 + m**2 + i*j + j*m + m*i
                if h >= len(ans):
                    break
                ans[h-1] += 1

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

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal


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

    l = []
    for i in range(1, math.floor(math.sqrt(n))):
        l.append(i)

    l_list = list(itertools.combinations_with_replacement(l, 3))

    ans_list = []
    for j in range(len(l_list)):
        x = l_list[j][0]
        y = l_list[j][1]
        z = l_list[j][2]
        ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
        ans_list.append((ans, [x, y, z]))

    for i in range(1, n+1):
        count = 0
        for j in range(len(ans_list)):
            if ans_list[j][0] == i and ans_list[j][1][0] == ans_list[j][1][1]and ans_list[j][1][2] == ans_list[j][1][1]:
                count += 1
            elif ans_list[j][0] == i:
                count += 3
            if ans_list[j][0] > i:
                break

        print(count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
if n > 500:
    nn = n//2
else:
    nn=2
l = [int(i) for i in range(1,n//nn)]
import itertools
p_list = list(itertools.combinations_with_replacement(l, 3))
p=[]
s=[0]*100000000
for i in p_list:
    x=i[0]
    y=i[1]
    z=i[2]
    p.append((x+y+z)**2-x*y-y*z-z*x)

    if x==y and y==z and z==x:
        s[p[-1]]=1
    elif x==y or y==z or z==x:
        s[p[-1]]=3
    else:
        s[p[-1]]=6

for i in range(1,n+1):
    if i in p:
      print(s[i])
    else:
      print(0)