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: Runtime Error

Solution code:
n=int(input())
import numpy as np
import math
rn=(n-4+1/4)**0.5-1/2
rn=math.ceil(rn)

#a=[[[0]*rn for ii in range(rn)] for jj in range(rn)]
r=[0]*n

for xx in np.arange(1,rn+1):
  xx2=xx**2
  for yy in np.arange(1,xx+1):
    xx2yy2xxyy=xx2+yy**2+xx*yy
    xxpyy=xx+yy
    tempr=xx2yy2xxyy+1+xxpyy
    if tempr>n: 
      break
    for zz in np.arange(1,yy+1):
      tempr=xx2yy2xxyy+zz**2+xxpyy*zz
      if tempr>n: 
        break
      else:
        r[tempr-1]=len(set([xx,yy,zz]))
        #a[xx-1][yy-1][zz-1]=tempr
#print(r)
for ii in range(n):
  rr=0
  if r[ii-1]==3:
    rr=6            
  elif r[ii-1]==2:
    rr=3
  elif r[ii-1]==1:
    rr=1
  print(rr)

Submission status: Runtime Error

Solution code:
N = int(input())

list_N = [0,0,0,0,0,1,0,0,0,0,3,0,0,0,0,0,3,3,0,0,0,0,0,1,6,0,3,0,0,0,0,0,3,3,6,0,0,3,0,0,0,0,3,3,6,0,6,0,0,0,3,0,0,1,6,0,6,6,0,0,6,0,0,0,0,3,3,3,6,0,6,3,6,0,0,0,6,0,0,0,3,3,9,0,6,3,6,0,3,6,0,0,0,0,6,1,6,0,6,6,0,3,12,0,6,0,0,3,6,0,0,0,3,3,12,0,6,3,6,0,3,6,9,0,6,0,0,0,3,6,3,3,6,0,6,3,12,0,3,6,6,0,6,0,6,3,6,0,0,1,6,3,12,6,0,0,12,0,6,0,6,6,12,0,0,6,0,0,6,0,12,3,6,0,6,3,9,6,3,6,6,0,6,0,6,0,15,6,0,0,6,0,3,3,12,0,12,6,6,0,3,6,6,3,12,0,6,0,9,6,0,0,6,3,12,1,6,6,6,6,0,0,18,0,12,0,3,6,12,0,0,6,3,6,12,0,12,0,0,0,9,3,9,6,12,3,12,0,3,6,6,0,12,0,12,0,9,9,0,0,6,3,6,3,12,6,9,3,6,0,12,3,6,3,9,6,12,6,6,0,6,0,9,6,6,0,12,3,6,0,9,6,6,1,6,0,21,12,6,0,12,0,12,0,0,6,15,6,0,6,12,0,12,0,12,0,0,0,12,0,12,12,3,3,18,3,6,3,6,6,9,9,18,0,6,0,12,0,9,6,0,3,12,3,6,6,12,6,6,0,0,0,15,3,18,3,18,3,12,6,3,6,9,0,12,0,12,0,18,12,0,0,12,3,6,0,6,6,9,6,0,0,18,1,18,3,12,6,6,6,12,0,15,6,12,6,18,0,0,6,0,9,12,0,18,0,6,3,12,0,12,12,0,0,12,0,3,6,12,6,18,9,18,0,9,6,18,0,6,0,6,3,27,6,6,6,6,3,6,0,12,6,9,0,6,0,18,0,9,9,15,3,12,6,6,3,9,6,12,12,18,0,18,0,6,6,21,6,0,0,6,3,15,6,12,6,18,0,0,0,12,6,6,3,6,4,18,6,12,6,3,9,30,0,18,0,6,6,12,6,6,9,12,0,18,6,18,0,6,0,12,0,6,12,6,3,18,0,6,6,6,6,15,3,24,0,6,3,18,0,12,6,12,6,24,0,15,18,9,6,0,0,18,3,6,0,15,12,12,6,6,0,18,0,6,3,12,0,12,6,6,9,9,6,24,3,24,0,9,12,6,6,12,0,12,0,21,9,15,6,12,3,18,3,12,6,12,6,0,0,12,0,12,6,24,0,6,12,6,1,9,6,12,6,24,0,18,3,12,6,6,12,24,0,12,6,15,6,18,0,18,0,0,0,18,9,21,12,0,6,18,0,9,6,6,6,12,0,12,0,9,9,27,6,6,3,18,6,21,6,6,12,12,0,12,0,24,12,0,0,24,3,24,6,12,12,18,0,0,0,12,0,18,3,15,6,12,9,6,0,15,6,9,12,24,0,12,3,6,6,21,6,18,3,18,0,21,12,15,6,6,0,12,3,12,9,18,9,12,6,6,6,24,0,18,3,24,0,6,6,0,6,9,6,6,4,30,0,18,12,9,6,24,0,18,0,9,12,21,6,6,12,12,0,18,0,21,15,12,0,12,6,12,12,18,0,18,0,6,0,9,12,18,6,30,0,0,0,24,6,9,3,12,6,30,3,6,12,6,12,12,0,36,0,6,3,27,12,12,6,6,6,24,0,12,6,12,0,18,0,18,15,18,3,18,6,12,6,6,12,3,6,6,0,12,3,39,3,12,12,12,3,18,0,21,12,21,6,18,0,12,0,9,9,12,9,24,9,12,6,12,6,33,0,6,0,18,0,9,15,12,6,24,6,6,3,15,6,15,12,18,0,18,1,18,6,12,6,6,0,24,6,24,12,18,6,24,0,6,6,12,15,24,0,24,6,6,0,18,0,15,18,12,0,24,0,12,6,12,12,18,6,24,0,0,6,24,3,12,0,12,6,30,9,6,12,24,12,12,0,15,18,12,0,18,0,24,6,15,6,18,3,18,3,12,6,24,12,12,12,6,0,36,0,18,3,6,12,6,9,12,0,3,12,36,0,30,0,12,0,18,6,12,9,12,6,24,3,18,12,15,9,24,0,18,6,18,9,18,12,6,6,24,3,24,0,12,12,12,0,6,0,27,12,18,3,30,3,18,6,0,12,15,6,18,0,24,0,9,6,9,12,18,7,24,0,24,12,15,12,24,0,24,0,6,9,30,9,6,6,0,9,33,12,36,0,12,0,18,0,6,21,12,6,36,6,0,3,18,6,12,6,24,0,12,3,24,6,9,12,6,6,30,6,18,12,9,9,12,0,30,3,18,3,27,6,30,12,12,0,24,0,27,12,6,0,24,3,18,18,9,6,18,0,12,3,33,18,12,9,6,0,12,6,30,0,24,12,12,0,30,6,6,6,0,6,24,0,12,0,18,15,33,6,30,15,18,0,9,12,24,9,12,0,18,6,27,18,15,6,18,3,24,0,6,6,36,12,18,0,12,3,30,3,12,6,12,15,6,0,18,12,15,9,30,0,18,6,12,12,18,6,6,3,24,1,27,12,18,6,18,0,24,0,18,15,15,21,30,6,12,12,18,0,30,6,24,0,6,0,18,6,36,12,6,6,36,0,6,12,12,12,24,0,30,0,9,6,18,0,18,12,12,6,24,6,9,15,12,0,12,6,30,9,18,0,42,3,18,6,12,18,33,12,12,0,18,0,21,12,12,12,24,6,30,0,27,18,6,12,6,0,24,0,18,15,30,0,18,12,6,0,21,6,21,12,24,0,30,0,6,6,6,12,24,0,30,12,9,12,21,3,24,0,12,3,21,18,9,18,18,6,30,3,42,6,21,6,30,0,6,3,24,9,36,6,6,9,12,6,18,12,33,9,12,0,24,9,9,6,3,18,36,6,18,0,24,6,6,6,18,0,12,0,30,3,39,12,12,7,18,0,15,18,18,9,36,0,24,6,6,18,30,0,18,9,18,3,24,6,21,12,24,0,30,3,33,24,12,6,18,6,6,6,18,6,18,12,18,0,24,6,36,3,18,6,0,12,30,0,9,24,18,0,24,0,18,0,0,12,30,15,30,6,18,3,30,0,24,18,12,0,36,3,24,12,15,18,18,6,24,3,24,12,18,12,24,0,0,6,39,6,24,3,18,3,42,6,12,12,15,9,30,0,12,0,18,6,18,12,24,15,12,0,12,12,30,12,12,0,18,0,15,15,18,18,30,3,24,12,9,6,48,0,18,0,30,0,21,6,12,12,24,12,18,3,48,24,6,6,18,0,36,0,12,15,27,6,12,12,18,6,27,6,12,9,18,0,24,6,18,18,21,0,36,0,12,0,18,12,21,18,24,0,12,1,18,9,21,18,6,9,42,3,36,12,12,12,30,0,12,6,21,12,36,6,24,9,12,6,12,12,24,12,18,0,42,0,15,6,15,15,42,6,30,6,12,12,18,12,18,0,6,6,36,0,30,18,6,0,6,0,30,18,18,0,42,0,18,6,15,18,24,0,12,6,36,9,33,12,12,12,18,0,36,0,21,21,15,18,18,15,18,0,18,6,42,6,24,0,18,3,42,6,18,12,12,12,18,0,15,12,18,12,36,0,30,12,3,21,18,0,30,6,24,0,27,12,18,12,6,0,12,0,36,15,15,3,36,12,18,6,30,6,33,12,12,0,12,6,24,6,54,18,12,3,36,9,9,12,12,18,36,0,6,0,21,15,27,9,24,12,30,6,24,6,27,18,12,0,30,0,21,12,18,6,30,0,18,0,21,18,21,6,30,0,24,3,6,6,15,27,12,10,42,6,36,12,12,6,24,0,24,6,12,12,48,6,18,12,0,3,51,6,30,6,24,0,24,0,30,21,15,12,24,9,18,6,18,12,30,9,24,0,18,0,27,18,9,6,18,9,54,0,18,24,21,18,12,0,24,0,12,0,30,9,30,12,6,9,24,6,15,15,18,0,30,3,33,18,21,12,42,3,30,6,6,24,27,6,12,0,24,3,42,6,42,9,12,6,18,6,24,12,12,12,54,0,6,12,18,6,18,18,30,12,30,0,18,0,27,18,24,0,18,0,15,24,21,6,24,3,36,6,6,6,45,21,18,0,18,6,33,3,18,0,24,15,30,0,30,24,12,6,36,0,24,3,21,24,18,15,30,3,12,6,42,12,12,12,6,0,54,6,30,15,24,18,24,6,12,0,9,6,30,0,48,0,24,0,15,12,39,12,24,6,24,6,15,30,12,6,24,0,24,3,24,12,24,6,6,18,12,4,54,6,21,18,18,0,36,6,24,9,30,12,24,9,36,6,12,18,42,3,30,0,6,9,21,6,12,30,30,6,30,0,27,12,9,18,30,0,36,0,18,9,42,6,24,12,0,6,51,12,24,12,12,0,18,6,12,18,6,6,36,3,54,9,18,6,27,12,18,0,30,0,39,9,18,18,12,9,30,6,21,12,27,18,24,0,12,0,42,18,42,6,24,15,18,0,24,12,45,12,6,0,54,0,15,21,6,6,30,6,18,12,24,18,30,6,36,0,12,3,24,12,18,18,18,12,24,0,33,12,27,6,42,0,18,6,9,15,30,6,30,6,12,6,18,6,33,15,30,0,36,3,27,21,33,24,30,9,24,0,12,18,33,6,6,0,18,3,57,12,24,18,30,9,18,0,18,12,27,12,36,0,36,6,12,6,27,12,30,9,24,6,39,18,12,24,12,0,30,0,30,6,15,15,18,3,24,18,9,12,30,9,30,0,18,6,42,18,30,0,6,10,48,0,24,12,12,18,48,0,30,3,30,15,18,6,24,18,18,0,42,6,36,15,24,0,42,12,21,24,12,12,24,0,12,6,18,18,60,6,30,0,12,0,24,0,12,18,30,15,42,0,33,30,6,6,12,0,42,3,27,6,33,12,36,12,18,0,30,6,18,12,12,0,18,6,15,27,27,6,42,6,36,9,18,30,33,9,30,0,6,6,54,6,36,24,24,0,30,3,12,6,21,24,30,0,24,0,24,12,42,9,42,21,12,12,27,12,27,6,12,0,48,6,12,18,12,12,36,6,30,0,24,0,42,12,12,0,36,0,24,15,21,21,18,6,12,9,36,18,18,15,42,0,18,6,9,18,48,12,30,9,24,3,33,6,18,18,18,0,36,3,54,24,3,12,36,9,36,6,30,12,36,12,24,0,18,6,24,6,42,0,24,18,18,0,9,30,39,12,42,0,36,0,12,12,21,12,18,12,24,6,45,6,18,24,18,0,36,0,42,15,18,6,24,6,12,12,18,12,30,6,18,0,30,1,30,9,57,9,12,9,48,6,21,24,18,12,66,0,18,6,9,24,24,24,30,12,18,0,48,6,24,18,18,0,24,3,27,18,24,12,36,6,48,6,15,18,42,6,24,0,12,12,36,6,6,24,12,3,48,0,48,18,0,12,18,0,36,6,18,9,54,15,12,12,6,6,39,6,24,18,42,0,30,0,33,18,24,18,18,9,18,0,15,18,54,0,36,0,24,0,48,24,15,18,18,12,42,9,24,12,36,21,30,0,36,12,24,3,30,0,48,15,12,6,15,18,18,18,24,0,30,0,24,24,18,9,72,0,30,6,21,18,30,6,24,0,0,6,24,18,42,12,6,15,36,0,30,18,30,12,24,0,6,0,18,12,54,9,36,9,36,9,30,6,27,27,24,0,54,6,21,18,21,6,36,15,36,3,30,12,6,18,30,0,18,6,54,0,30,21,36,9,30,6,30,24,24,6,30,0,36,12,9,24,24,12,18,9,30,0,48,12,24,12,12,0,48,0,18,12,24,24,30,6,18,12,21,12,24,0,66,0,12,0,30,9,24,24,18,13,42,3,18,18,27,24,24,0,30,6,15,18,39,12,12,9,36,12,54,12,42,18,6,0,36,0,51,18,12,0,66,12,24,0,6,24,51,12,24,0,24,0,33,6,18,18,30,6,42,3,18,30,15,15,30,0,30,6,30,12,48,12,24,12,12,9,36,6,36,6,12,0,30,0,24,21,24,15,42,12,24,6,9,18,15,9,42,0,24,12,66,12,30,24,6,9,54,0,36,12,21,12,36,0,24,3,24,15,36,6,30,24,12,6,33,6,39,21,30,0,42,6,12,30,30,18,36,0,48,3,36,12,30,18,18,0,24,0,30,6,33,21,24,6,18,12,24,12,12,15,48,0,24,6,21,21,60,6,24,12,18,0,30,12,15,12,24,0,24,3,60,27,18,12,30,3,24,9,21,12,60,18,24,0,24,9,33,6,36,12,24,15,42,6,27,36,27,6,42,0,42,6,12,15,15,24,42,18,12,0,33,6,21,18,24,0,48,3,36,9,24,24,30,6,36,0,39,18,60,6,18,0,12,6,21,27,30,0,18,6,42,6,42,18,24,9,48,0,6,6,18,18,18,6,18,15,30,4,60,12,30,30,18,0,36,0,27,18,30,18,48,9,30,12,18,6,42,9,48,0,18,6,42,6,30,24,12,3,36,0,36,36,15,18,30,0,66,0,12,18,42,9,24,15,18,12,54,6,18,21,36,0,30,6,24,24,12,6,24,9,36,12,6,12,45,12,36,0,36,0,48,3,24,18,12,24,36,0,30,12,30,21,30,0,6,15,18,15,66,12,42,3,12,0,39,12,30,12,18,0,54,6,30,24,9,12,60,12,30,12,30,24,24,18,30,0,36,0,27,9,45,18,24,12,24,0,36,24,12,6,60,0,18,0,24,15,51,9,24,12,30,12,27,18,51,18,24,0,36,6,27,27,12,30,36,6,30,0,12,6,42,0,18,0,18,0,48,12,45,24,6,15,42,6,12,18,27,9,54,0,42,3,33,12,15,12,54,18,30,6,36,18,21,30,18,0,48,3,30,18,36,6,18,0,18,12,57,24,42,6,24,0,18,12,36,18,30,12,36,3,78,0,24,6,6,36,42,0,24,0,21,15,33,6,42,18,12,3,30,12,30,27,24,0,42,12,39,12,30,12,30,15,30,6,12,24,54,6,24,0,18,6,33,12,18,24,24,7,30,0,60,24,21,12,30,0,48,6,18,15,39,12,18,18,18,0,48,12,54,18,42,0,30,0,15,30,27,18,72,0,30,15,12,12,30,18,36,0,6,3,60,15,24,18]

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

# print(list_N[1000])

Submission status: Runtime Error

Solution code:
import math




N=int(input())

anslist=[0]*(N+1)
ma=int(math.sqrt(N/2))+1
for x in range(1,ma):
    for y in range(x,ma):
        for z in range(y,ma):
            n=x**2+y**2+z**2+x*y+y*z+z*x
            if n <=N:
                if x==y and y==z:
                    anslist[n+1]+=1
                elif x==y or y==z or z==x:
                    anslist[n+1]+=3
                else:
                    anslist[n+1]+=6

            

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

Submission status: Runtime Error

Solution code:
import math

N = int(input())

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

used = []

count = [0] * N


if N <= 5:
    for x in range(N):
        print(count(x))
else:
    for n in range(6,N):
        print(n)
        for x in range(1,rtn):
            #print(x)
            xx = x**2
            if xx <= n - 5:
                #print("xpath")
                for y in range(1,rtn):
                    #print(x,y)
                    xy = x*y
                    yy = y**2
                    ysum = xx+yy+xy
                    if ysum <= n-3:
                        #print("ypath")
                        for z in range(1,rtn):
                            #print(x,y,z)
                            zz = z**2
                            xz = x*z
                            yz = y*z
                            result = ysum+zz+xz+yz
                            if result > n:
                                break
                            if result == n:
                                count[n-1] += 1
                                #print("zpath")
    for x in range(N):
        print(count[x])

Submission status: Runtime Error

Solution code:
N=int(input())


ans = 0
for i in range(1,int(n**0.5)):
    for j in range(i,int(n**0.5)):
        for k in range(j,int(n**0.5)):
            if i**2+j**2+k**2+i*j+j*k+k*i < n:
                if i == j and j == k:
                    ans += 1
                else:
                    ans += 3
                print(i,j,k,n)

    print(ans)

Submission status: Runtime Error

Solution code:
import math




N=int(input())

anslist=[0]*(N+1)
ma=int(math.sqrt(N/2))+1
for x in range(1,ma):
    for y in range(x,ma):
        for z in range(y,ma):
            n=x**2+y**2+z**2+x*y+y*z+z*x
            if x==y and y==z:
                anslist[n+1]+=1
            elif x==y or y==z or z==x:
                anslist[n+1]+=3
            else:
                anslist[n+1]+=6

            

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

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def checker():
    ans = [0] * 10000
    for a in range(1, 101):
        for b in range(1, 101):
            for c in range(1, 101):
                n = a * a + b * b + c * c + a * b + b * c + c * a
                if n > 10000:
                    continue
                else:
                    ans[n] += 1
    return ans


def main():
    N = int(input().strip())
    ans = checker()
    for n in range(1, N + 1):
        print(ans[n])
    return


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

ans = [0]*(10**5)
for i1 in range(1, 10000):
    i2 = i1+1
    i3 = i1+2
    if i3 > N:
        break
    L = list(itertools.combinations_with_replacement((i1, i2, i3), 3))
    for i in L:
        i = list(i)
        x = i[0]
        y = i[1]
        z = i[2]
        n = (x**2)+(y**2)+(z**2)+(x*y)+(y*z)+(z*x)
        if len(list(set(i))) == 1:
            ans[n] += 1
        if len(list(set(i))) == 2:
            ans[n] += 3
        if len(list(set(i))) == 3:
            ans[n] += 6
        
for k in range(1, N+1):
    print(ans[k])

Submission status: Runtime Error

Solution code:
import math

N = int(input())

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

used = []

count = [0] * N


if N <= 5:
    for x in range(N):
        print(count(x))
else:
    for n in range(6,N):
        print(n)
        for x in range(1,rtn):
            xx = x**2
            if xx <= n - 5:
                for y in range(1,rtn):
                    xy = x*y
                    yy = y**2
                    ysum = xx+yy+xy
                    if ysum <= n-3:
                        for z in range(1,rtn):
                            zz = z**2
                            xz = x*z
                            yz = y*z
                            result = ysum+zz+xz+yz
                            if result > n:
                                break
                            if result == n:
                                count[n-1] += 1
    for x in range(N):
        print(count[x])

Submission status: Runtime Error

Solution code:
# from pprint import pprint
# import math
# import collections
from numba import jit

N = int(input())

loops = 0


# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

@jit('i8(i8,i8,i8)', cache=True)
def calc(x, y, z):
    return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x


# 全数字が等しい場合
p_eq = [0] * 100
for xyz in range(1, 100 + 1):
    p_eq[xyz] = calc(xyz, xyz, xyz)

p_ne = []
for x in range(1, 100):
    for y in range(1, 100):
        if x + y > 100:
            break
        for z in range(1, 100):
            if x + y + z > 100:
                break
            res = calc(x, y, z)
            p_ne.append(res)

# p_set = p

# p_equal = []
# p_nonequal = []
# for _p in p_set:
#     loops += 1
#     x, y, z = _p[0], _p[1], _p[2]
#
#     if x == y == z:
#         p_equal.append(calc(x, y, z))
#     else:
#         p_nonequal.append(calc(x, y, z))

# print(p_equal)
# print(p_nonequal)

res = [None] * N
for i in range(1, N + 1):
    if i in p_eq:
        res[i] = 1
    elif i in p_ne:
        res[i] = 3
    else:
        res[i] = 0

for s in res:
    print(s)
# print('lp', loops)

Submission status: Runtime Error

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

ans = [0]*(10**5)
for i1 in range(1, 10000):
    i2 = i1+1
    i3 = i1+2
    L = list(itertools.combinations_with_replacement((i1, i2, i3), 3))
    for i in L:
        i = list(i)
        x = i[0]
        y = i[1]
        z = i[2]
        n = (x**2)+(y**2)+(z**2)+(x*y)+(y*z)+(z*x)
        if len(list(set(i))) == 1:
            ans[n] += 1
        if len(list(set(i))) == 2:
            ans[n] += 3
        if len(list(set(i))) == 3:
            ans[n] += 6
        
for k in range(1, N+1):
    print(ans[k])

Submission status: Runtime Error

Solution code:
n = int(input())

lis = [0] * (10000+1)

s  = n**0.5

for i in range(1, s):
    for j in range(1, s):
        for k in range(1, s):
            t = i**2 + j**2 + k**2 + i*j + j*k + i*k
            tmp = [i,j,k]
            
            if t <= 10001:
                if len(set(tmp)) == 1:
                    lis[t-1] = 1
                elif len(set(tmp)) == 2:
                    lis[t-1] = 3
                else:
                    lis[t-1] = 6

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

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    
    n = int(input())

    for o in range(1, n+1):
        for x in range(int(n**0.5), 100):
            isFound = False
            isOver = False
            for y in range(1, x+1):
                for z in range(1, y+1):
                    m = x**2+y**2+z**2+x*y+y*z+z*x
                    if m == o:
                        isFound = True
                        if x==y and y==z: print(1)
                        elif x==y or y==z or z==x: print(3)
                        else: print(6)
                        break
                    elif m > o:
                        isOver = True
                        break
                if isFound or isOver: break
            if isFound: break
        if not isFound: print(0)

Submission status: Runtime Error

Solution code:
N = int(input())

list_N = [0,0,0,0,0,1,0,0,0,0,3,0,0,0,0,0,3,3,0,0,0,0,0,1,6,0,3,0,0,0,0,0,3,3,6,0,0,3,0,0,0,0,3,3,6,0,6,0,0,0,3,0,0,1,6,0,6,6,0,0,6,0,0,0,0,3,3,3,6,0,6,3,6,0,0,0,6,0,0,0,3,3,9,0,6,3,6,0,3,6,0,0,0,0,6,1,6,0,6,6,0,3,12,0,6,0,0,3,6,0,0,0,3,3,12,0,6,3,6,0,3,6,9,0,6,0,0,0,3,6,3,3,6,0,6,3,12,0,3,6,6,0,6,0,6,3,6,0,0,1,6,3,12,6,0,0,12,0,6,0,6,6,12,0,0,6,0,0,6,0,12,3,6,0,6,3,9,6,3,6,6,0,6,0,6,0,15,6,0,0,6,0,3,3,12,0,12,6,6,0,3,6,6,3,12,0,6,0,9,6,0,0,6,3,12,1,6,6,6,6,0,0,18,0,12,0,3,6,12,0,0,6,3,6,12,0,12,0,0,0,9,3,9,6,12,3,12,0,3,6,6,0,12,0,12,0,9,9,0,0,6,3,6,3,12,6,9,3,6,0,12,3,6,3,9,6,12,6,6,0,6,0,9,6,6,0,12,3,6,0,9,6,6,1,6,0,21,12,6,0,12,0,12,0,0,6,15,6,0,6,12,0,12,0,12,0,0,0,12,0,12,12,3,3,18,3,6,3,6,6,9,9,18,0,6,0,12,0,9,6,0,3,12,3,6,6,12,6,6,0,0,0,15,3,18,3,18,3,12,6,3,6,9,0,12,0,12,0,18,12,0,0,12,3,6,0,6,6,9,6,0,0,18,1,18,3,12,6,6,6,12,0,15,6,12,6,18,0,0,6,0,9,12,0,18,0,6,3,12,0,12,12,0,0,12,0,3,6,12,6,18,9,18,0,9,6,18,0,6,0,6,3,27,6,6,6,6,3,6,0,12,6,9,0,6,0,18,0,9,9,15,3,12,6,6,3,9,6,12,12,18,0,18,0,6,6,21,6,0,0,6,3,15,6,12,6,18,0,0,0,12,6,6,3,6,4,18,6,12,6,3,9,30,0,18,0,6,6,12,6,6,9,12,0,18,6,18,0,6,0,12,0,6,12,6,3,18,0,6,6,6,6,15,3,24,0,6,3,18,0,12,6,12,6,24,0,15,18,9,6,0,0,18,3,6,0,15,12,12,6,6,0,18,0,6,3,12,0,12,6,6,9,9,6,24,3,24,0,9,12,6,6,12,0,12,0,21,9,15,6,12,3,18,3,12,6,12,6,0,0,12,0,12,6,24,0,6,12,6,1,9,6,12,6,24,0,18,3,12,6,6,12,24,0,12,6,15,6,18,0,18,0,0,0,18,9,21,12,0,6,18,0,9,6,6,6,12,0,12,0,9,9,27,6,6,3,18,6,21,6,6,12,12,0,12,0,24,12,0,0,24,3,24,6,12,12,18,0,0,0,12,0,18,3,15,6,12,9,6,0,15,6,9,12,24,0,12,3,6,6,21,6,18,3,18,0,21,12,15,6,6,0,12,3,12,9,18,9,12,6,6,6,24,0,18,3,24,0,6,6,0,6,9,6,6,4,30,0,18,12,9,6,24,0,18,0,9,12,21,6,6,12,12,0,18,0,21,15,12,0,12,6,12,12,18,0,18,0,6,0,9,12,18,6,30,0,0,0,24,6,9,3,12,6,30,3,6,12,6,12,12,0,36,0,6,3,27,12,12,6,6,6,24,0,12,6,12,0,18,0,18,15,18,3,18,6,12,6,6,12,3,6,6,0,12,3,39,3,12,12,12,3,18,0,21,12,21,6,18,0,12,0,9,9,12,9,24,9,12,6,12,6,33,0,6,0,18,0,9,15,12,6,24,6,6,3,15,6,15,12,18,0,18,1,18,6,12,6,6,0,24,6,24,12,18,6,24,0,6,6,12,15,24,0,24,6,6,0,18,0,15,18,12,0,24,0,12,6,12,12,18,6,24,0,0,6,24,3,12,0,12,6,30,9,6,12,24,12,12,0,15,18,12,0,18,0,24,6,15,6,18,3,18,3,12,6,24,12,12,12,6,0,36,0,18,3,6,12,6,9,12,0,3,12,36,0,30,0,12,0,18,6,12,9,12,6,24,3,18,12,15,9,24,0,18,6,18,9,18,12,6,6,24,3,24,0,12,12,12,0,6,0,27,12,18,3,30,3,18,6]

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

# print(list_N[1000])

Submission status: Runtime Error

Solution code:
import numpy as np


def calc(n):
    lim = int((n - 2) ** 0.5 - 1) + 1
#     lim = 130

    result = np.zeros(n + 1, dtype=int)
    for x in range(1, lim):
        for y in range(x, lim):
            for z in range(y, lim):
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index > n:
                    continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]


for i in calc(int(input())):
    print(i)

Submission status: Runtime Error

Solution code:
N = int(input())
for n in range(1,N+1):
    count = 0
    for x in range(1,N//2):
        for y in range(1,N//2):
            for z in range(1,N//2):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n and not (a == x and b == y and c == z):
                    a,b,c = x,y,z
                    count += 1
    print(count)

Submission status: Runtime Error

Solution code:
n = int(input())

c = []
for i in range(1,42):
    for j in range(1,42):
        for k in range(1,42):
            c.append([i,j,k,g(i,j,k)])

m = len(c)

a = [0 for i in range(n)]
for i in range(m):
    for j in range(n):
        if c[i][3] == j + 1:
            a[j] += 1

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

Submission status: Runtime Error

Solution code:
import math
N = int(input())
fn = {i+1:0 for i in range(N)}
rtN = int(math.sqrt(N))+1

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

for x in range(1, rtN):
    for y in range(1, rtN):
        for z in range(1, rtN):
            n_ = n(x,y,z)
            try:
                f[n_] += 1
            except KeyError:
                pass

for k in fn.values():
    print(k)

Submission status: Runtime Error

Solution code:
N = int(input())
L = [0 for _ in range(N)]
for i in range(1,int(N**0.5)+1):
    for j in range(i, int(N ** 0.5)+1):
        for k in range(j, int(N ** 0.5)+1):
            a = i*i + j*j + k*k + i*j + j*k + k*i
            if a > N:
                break
            if a >= 0 and a == int(a):
                if i == j == k:
                    L[a] = 1
                elif i == j or j == k:
                    L[a] = 3
                else:
                    L[a] = 6
for i in range(1,N):
    print(L[i])
print(0)

Submission status: Runtime Error

Solution code:
from sympy import exp, Symbol, sqrt


x = Symbol('x')
y = Symbol('y')
z = Symbol('z')

n = int(input())

ans = 0
for x in range(1, n+1):
    y = -x/2 - z/2 - sqrt(-3*(x**2) - 2*x*z - 3*(z**2) + x*4)/2
    z = -y/2 - x/2 - sqrt(-3*(y**2) - 2*y*x - 3*(x**2) + x*4)/2
        
    if (x**2 + y**2 + z**2 + x*y + y*z + z*x - x*4 == 0):
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))    

def do():
    n=INT()
    a=0
    for i in range(1,n+1):
        ct=0
        ans=i*2    
        
        r=int(ans**0.5)+1
        print(r)
        for k in range(2,r):
            if k%2==1:
                break
            #print(2,int((ans-k**2)**0.5)+2)
            for j in range(2,int((ans-k**2)**0.5)+2):
                re=ans-k**2-j**2
                if re<=0:
                    break
                l=int(re**0.5)
                #print(2*i,k,j,(int(re**0.5))**2)
                if k+l<j:
                    break
                if l**2!=re or :
                    continue
                else:
                    xy=k
                    yz=j
                    zx=l
                    #print(i)
                    s=(xy+yz+zx)//2
                    #print(2*i,s,s-xy,s-yz,s-zx)
                    if s-xy>=1 and s-yz>=1 and s-zx>=1:
                        ct+=1
        print(ct)

        
if __name__ == '__main__':
    do()

Submission status: Runtime Error

Solution code:
N = int(input())
for n in range (1, N + 1):
    print(sum((((y + z)**2 - 4((y + z)**2 - y * z - n)) ** (1 / 2) - y - z)) / 2 >= 1  for y in range(1, n) for z in range(1, n)))

Submission status: Runtime Error

Solution code:
n=int(input())
c=0
from itertools import combinations 
def rSubset(arr, r): 
  
    # return list of all subsets of length r 
    # to deal with duplicate subsets use  
    # set(list(combinations(arr, r))) 
    return list(combinations(arr, r)) 
for y in range(1,n+1):
    for i in range(1,int(y**0.5)):
        for j in range(1,int(y**0.5)):
            if(3*i*i+j*j+2*i*j==y):
                if(i==j):
                  c=c+1
                else:
                   c=c+3
    print(c)
if(c==0): 
  for i in range(1,int(y**0.5)):
        t.append(y)
  x=rSubset(t,3)
  for i in range(len(x)):
        if(x[i][0]**2+x[i][1]**2+x[i][2]**2+x[i][0]*x[i][1]+x[i][0]*x[i][2]+x[i][1]*x[i][2]==n):
           c=c+6
  print(c)

Submission status: Runtime Error

Solution code:
n = int(input())
cnt = 0
for i in range(1, n + 1):
    cnt = 0
    for x in range(1, 42):
        for y in range(1, 42):
            for z in range(1, 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):
                    	cnt += 1
	print(cnt)

Submission status: Runtime Error

Solution code:
import sys, re
import math
import numpy as np
from decimal import Decimal
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul	# 
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd	# 最大公約数
from heapq import heappush, heappop

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()))
sys.maxsize = 10 ** 15
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

# -*- coding: utf-8 -*-

n = INT()
ans = [0] * 15000

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

def A(x,y,z):
    out = check(x,y,z)
    if out > 15000:
        a = x + 1
        b = x
        c = x + 1
        if check(a,b,c) <= 15000:
            match = check(a,a,a)
            if match <= 15000:
                ans[match] += 1
            A(a,b,c)
    else:
        ans[out] += 3
        A(x,y,z+1)

ans[6] += 1
A(1, 1, 2)

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

Submission status: Runtime Error

Solution code:
import math

n = int(input())

result_list = [0] * n

half = int(math.sqrt(n))

for x in range(1, half):
    for y in range(1, half):
        for z in range(1, half):
            calculated_n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if calculated_n <= n+1:
                result_list[calculated_n-1] += 1

for n in result_list:
    print(n)

Submission status: Runtime Error

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))    

def do():
    n=INT()
    a=0
    for i in range(1,n+1):
        ct=0
        ans=i*2    
        
        r=int(ans**0.5)+1
        print(r)
        for k in range(2,r):
            if k%2==1:
                pass
            #print(2,int((ans-k**2)**0.5)+2)
            for j in range(2,int((ans-k**2)**0.5)+2):
                re=ans-k**2-j**2
                if re<=0:
                    break
                l=int(re**0.5)
                #print(2*i,k,j,(int(re**0.5))**2)
                if k+l<j:
                    break
                if l**2!=re or :
                    continue
                else:
                    xy=k
                    yz=j
                    zx=l
                    #print(i)
                    s=(xy+yz+zx)//2
                    #print(2*i,s,s-xy,s-yz,s-zx)
                    if s-xy>=1 and s-yz>=1 and s-zx>=1:
                        ct+=1
        print(ct)

        
if __name__ == '__main__':
    do()

Submission status: Runtime Error

Solution code:
N = int(input())
ans = [0]**N
for x in range(1, N+1):
    for y in range(y, N+1):
        for z in range(y, n+1):
            if x**2 + y**2 + z**2 + x*y + y*z + z*x > n:
                break
            sum = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if x==y and y==z:
                ans[sum-1]+=1
            elif x!=y and y!=z and z!=x:
                ans[sum-1]+=6
            else:
                ans[sum-1]+=3

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

Submission status: Runtime Error

Solution code:
n = INT()
ans = [0] * 15000

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

def A(x,y,z):
    out = check(x,y,z)
    if out > 15000:
        a = x + 1
        b = x
        c = x + 1
        if check(a,b,c) <= 15000:
            match = check(a,a,a)
            if match <= 15000:
                ans[match] += 1
            A(a,b,c)
    else:
        ans[out] += 3
        A(x,y,z+1)

ans[6] += 1
A(1, 1, 2)

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

Submission status: Runtime Error

Solution code:
N = int(input())
n = 1
while True:
    if n > N:
        break
    elif n < 6:
        print(0)
        n += 1
    else:
        count = 0
        for z in range(1, math.ceil(math.sqrt(n - 3))):
            for y in range(1, math.ceil(math.sqrt(n - 3))):
                for x in range(1, math.ceil(math.sqrt(n - 3))):
                    if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n:
                        count += 1
        print(count)
        n += 1