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:
import numpy as np
N = int(input())
for i in range(1, N+1):
    count = 0
    for j in range(1, int(np.sqrt(i)//6)+3):
        for k in range(j, int(np.sqrt(i)//6)+3):
            for l in range(k, int(np.sqrt(i)//6)+3):
                n = j*j + k*k + l*l + j*k + k*l + l*j
                if n == i:
                    if j == k == l:
                        count += 1
                    elif j==k or k==l or l==j:
                        count += 3
                    else:
                        count += 6
    print(count)

Submission status: Runtime Error

Solution code:
# vim: fileencoding=utf-8


def main():
    N = int(input())
    for n in range(1, N + 1):
        ans = 0
        if n <= 5:
            print(ans)
            continue

        zMax = int((N + 1) / 6) + 1
        print(f"{n}")
        for x in range(1, int((N + 1) / 6) + 1):
            tx = x ** 2
            if tx + x + 3 >= n or x >= zMax:
                break
            for y in range(x, int((N + 1) / 6) + 1):
                ty = tx + y ** 2 + x * y
                if ty + y + x + 1 >= n or y >= zMax:
                    break
                for z in range(y, int((N + 1) / 6) + 1):
                    print(f"x :{x} y :{y} z :{z}")
                    t = ty + z ** 2 + y * z + z * x
                    if t == n:
                        print(f"ans x :{x} y :{y} z :{z}")
                        if x == y and x == z:
                            ans += 1
                        elif x == y or y == z:
                            ans += 3
                        else:
                            ans += 6
                        if z <= zMax:
                            zMax = z
                        break
                    if t >= n:
                        break
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
num=[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]
n = int(input())
for i in range(n):
  print(num[i])

Submission status: Runtime Error

Solution code:
import math

n = int(input())
a = [0]*10001
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            ans = ((i + j) ** 2 + (j + k) ** 2 + (k + i) ** 2) //2
            a[ans] += 1

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

Submission status: Runtime Error

Solution code:
import numpy as np

def calc(n):
    if n < 2:
        return 0
    lim1 = int((n - 2) ** 0.5 - 1) + 1
    lim2 = int((-2 + (4 - 12 * (1 - n)) ** 0.5) / 6) + 1
    lim3 = int(n / 6) + 1

    result=np.zeros(n+1,dtype=int)
    for x in range(1, lim3):
        for y in range(1, lim2):
            if x > y:
                continue
            for z in range(1, lim1):
                if y > z:
                    continue
                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:
a = int(input())
b = math.floor(a**0.5) + 1

x = []
for i in range(1,b):
    for j in range(1,b):
        for k in range(1,b):
            l = i**2 + j**2 + k**2 + i*j + j*k + k*i
            x.append(l)

t = [0] * a
for i in range(0,len(x)):
    if x[i] <= a:
        t[x[i]] = t[x[i]] + 1

for i in t:
    print(i)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
a = [0]*10001
b = math.ceil(math.sqrt(n)) + 1
for i in range(1,b):
    for j in range(1,b):
        for k in range(1,b):
            ans = ((i + j) ** 2 + (j + k) ** 2 + (k + i) ** 2) //2
            a[ans] += 1

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

Submission status: Runtime Error

Solution code:
import sys
N = int(sys.stdin.readline())
x = int((N / 6)**0.5)
y = int((((N -1)/3) - 1/9)**0.5 - 1/3)
z = int((N - 5)**0.5 + 1)
for n in range(1,N+1):
  ans = 0
  for i in range(1,x+1):
    for j in range(i,y+1):
      if i % 2 == j % 2:
        d = 2
        if n % 2 == 0:
          c = 0
        else:
          c = 1
      else:
        d = 1
        if n % 2 == 0:
          c = 10000
        else:
          c = 0    
      for k in range(j + c, z+1, d):
        p = (i + j + k)**2 - i*(j + k) - j*k
        if n < p:
          break
        if n == p:
          if i == j:
            if j == k:
              ans += 1
            else:
              ans += 3
          else:
            if i == k:
              ans += 3
            else:
              if j == k:
                ans += 3
              else:
                ans += 6
  print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())

ans = np.zeros(int(N))

if N<10001 and N>0:
    maxa = int(np.sqrt(N-2))
    for x in range(1,maxa):
        for y in range(1,x):
            for z in range(1,y):
                p = x*x+y*y+z*z+x*y+y*z+z*x
                if p<N+1:
                    ans[p-1] += 6


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

    for x in range(1,maxa):
        p = x*x*6
        if p<N+1:
            ans[p-1] += 1

    for x in range(0,N):
        print(int(ans[x]))

Submission status: Runtime Error

Solution code:
N=int(input())
import math
ans=[0]*N
n=int(math.sqrt(N))+1
for i in range(1,n+1):
    if i*i +2*i >N:
        break
    for j in range(1,n+1):
        if i*i+j*j+i*j>N:
            break
        for k in range(1,n+1):
            if i*i+j*j+k*k+i*j+j*k+i*k>N:
                break
            else:
                #print(i*i+j*j+k*k+i*j+j*k+i*k,i,j,k)
                ans[i*i+j*j+k*k+i*j+j*k+i*k]+=1
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
a = [0]*10001
b = int(math.sqrt(n)) + 2
for i in range(1,b):
    for j in range(1,b):
        for k in range(1,b):
            ans = ((i + j) ** 2 + (j + k) ** 2 + (k + i) ** 2) //2
            a[ans] += 1

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

Submission status: Runtime Error

Solution code:
import math 

n=int(input())
a=int(math.sqrt(-2+n))
for i in range(1,n+1):
  count=0
  for y in range(1,a):
    d=-2*y**2+i
    if d<0:
      continue
    b=math.sqrt(d)
    c=b.is_integer() 
    if c==True and -y+b>=1:
      if -y+b==float(y):
        count+=1
      else:
        count+=3
  print(count)

Submission status: Runtime Error

Solution code:
from copy import deepcopy
import collections
n = int(input())

x = 1
y = 1
z = 1
l = [1,1,1]

ans = [0 for _ in range(10**4)]
ans[5] = 1
s = set()
t = set()
t.add((1,1,1))
i = 0
while True:
	for j in range(len(t)):
		l = list(t.pop())
		for k in range(3):
			l[k] += 1
			tmp = tuple(sorted(l))
			if tmp not in s:
				s.add(tmp)
			l[k] -= 1
		t = deepcopy(s)
		for k in range(len(s)):
			l = s.pop()
			count = len(collections.Counter(l))
			num = sum(l)**2 - l[0]*l[1] - l[1]*l[2] - l[2]*l[0] - 1
			print(l,count,num)
			if count == 3:
				ans[num] += 1
			else:
				ans[num] += 3
	if num > n:
		break

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

Submission status: Runtime Error

Solution code:
import sys


def solve(n):
  for s in range(1, n+1):
      ans = 0
      for i in range(1, 101):
          for j in range(1, 101):
              for k in range(1, 101):
                  if i*i + j*j + k*k + i*j + j*k + k*i == s:
                      if i == j == k:
                          ans += 1
                      elif i == j != k or j == k != i or k == i != j:
                          ans += 3
                      elif i != j != k:
                          ans += 6
                      break
              else:
                  continue
              break
          else:
              continue
          break
      print(ans)
      ans = 0


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


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8,i8)')(solve)
    cc.compile()

if __name__ == '__main__':
    try:
        from my_module import solve
    except:
        cc_export()
        exit(0)
    main()

Submission status: Runtime Error

Solution code:
input_number = input()
function = x*x+y*y+z*z+x*y+y*z+x*z
function_x = x*x+y*y+z*z+x*y+y*z+x*z
function_xy = x*x+y*y+z*z+x*y+y*z+x*z
for n in range(int(input_number)):
	n += 1
	count = 0
	for x in range(1,101):
		function_x > n:
			break
		for y in range(1,101):
			function_xy > n:
				break
			for z in range(1,101):
				if function > n:
					break
				if n == function:
					count += 1
	print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
z=0
N=[0]*10000
ans=0
ko=0
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            ko=x**2+y**2+z**2+x*y+y*z+z*x
            if ko<=n:
                N[ko]+=1
            else:
                break
for i in range(n):
    print(N[i])

Submission status: Runtime Error

Solution code:
n=int(input())
lst=[0]*10020
for i in range(1, 45):
  for j in range(1, i+1):
    for k in range(1, j+1):
      temp=i**2+j**2+k**2+i*j+j*k+k*i
      if i==j and j==k:
        lst[temp]+=1
      elif i==j and j!=k:
         lst[temp]+=3
      elif j==k and k!=i:
         lst[temp]+=3
      elif k==i and i!=j:
         lst[temp]+=3
      elif i!=j and j!=k:
         lst[temp]+=6
for p in range(1, n+1):
  print(lst[p])

Submission status: Runtime Error

Solution code:
from math import sqrt
import sys
input=sys.stdin.readline
n=int(input())
sq=[]
x=int(sqrt(n))+1
for i in range(2,x):
    sq.append(i*i)
x=len(sq)
for i in range(1,n+1):
    val=2*i
    for j in range(x):
        if(j>val):
            break
        left=val-sq[j]
        ii=j
        jj=x-1
        lol=0
        while ii<=jj:
            #print(ii,jj)
            if(sq[ii]+sq[jj]>left):
                jj-=1
            elif(sq[ii]+sq[jj]<left):
                ii+=1
            else:
                li=[ii,jj,j]
                li.sort()
                a,b,c=li
                va,vb,vc=int(sqrt(sq[a])),int(sqrt(sq[b])),int(sqrt(sq[c]))
                #print(va,vb,vc)
                xx=(vc+va-vb)//2
                yy=va-xx
                zz=vb-yy
                
                #print(xx,yy,zz)
                if((vc+va-vb)%2!=0):
                    lol=0
                elif(xx<=0 or yy<=0 or zz<=0 or xx+yy!=va or yy+zz!=vb or xx+zz!=vc):
                    lol=0    
                elif(a==b and a==c):
                    lol=1
                elif(a==b or b==c):
                    lol=3
                else:
                    lol=6
                break
        if(lol):
            #print(sq[ii],sq[jj],sq[j],2*i)
            break
    print(lol)

Submission status: Runtime Error

Solution code:
N = int(input())
L = [0 for _ in range(N)]
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)):
            a = i*i + j*j + k*k + i*j + j*k + k*i
            if a > N:
                break
            elif 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 l in L:
    print(l)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
 
for i in range (1,n+1):
  ans=0
  for x in range(1,int(i*2/3)):
   for y in range(1,int(i*2/3)):
    for z in range(1,int(i*2/3)):
     if x+y+z==math.sqrt(i+x*y+x*z+y*z):
       ans+=1
       if x=y=z
        break
  print(ans)

Submission status: Runtime Error

Solution code:
from itertools import combinations
N = int(input())
#L, R, d=map(int,input().split())
#C = []
# for i in range(N):
#    C.append((input().replace(".","0").replace("#","1")))
# S=list(map(int,input().split()))
# B=list(map(int,input().split()))
def calc1(x,y,z):
    return x*x+y*y+z*z+x*y+y*z+z*x
def calc2(x,y):
    return x*x+y*y+1*1+x*y+y*1+1*x
def calc3(x):
    return x*x+1*1+1*1+x*1+1*1+1*x

count = []
for n in range(1,N+1):
    count2 = 0
    l = []
    for i in range(1,int(n/2)):
        for j in range(i,,int(n/2)):
            for k in range(j,int(n/2)):
                h = calc1(i,j,k)
                o = [i,j,k].sort
                if h > n:
                    break
                elif o in l:
                    count2+=1
                elif h == n:
                    count2+=1
                    l.append(o)
    count.append(count2)

print('\n'.join(map(str, count)))

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())

"""
for i in range(1,int(N)+1):
    count = 0
    if i > 3:
        maxa = int(np.sqrt(i-2))
        for x in range(1,maxa):
            for y in range(1,maxa):
                for z in range(1,maxa):
                    if x*x+y*y+z*z+x*y+y*z+z*x > i:
                        break
                    if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count +=1

    print(count)

"""
ans = np.zeros(int(N))

maxa = int(np.sqrt(N-2))
for x in range(1,maxa):
    for y in range(1,x):
        for z in range(1,y):
            p = x*x+y*y+z*z+x*y+y*z+z*x
            if p<N+1:
                ans[p-1] += 6


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

for x in range(1,maxa):
    p = x*x*6
    if p<N+1:
        ans[p-1] += 1

for x in range(0,N):
    print(int(ans[x]))

Submission status: Runtime Error

Solution code:
L = [0 for _ in range(N)]
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)):
            a = i*i + j*j + k*k + i*j + j*k + k*i
            if a > N:
                break
            elif 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 l in L:
    print(l)

Submission status: Runtime Error

Solution code:
def ff(x,y,z):
    return(x**2+y**2+z**2+x*y+y*z+z*x)
 
n=int(input())
an = []
for i in range(1,50):
    for j in range(1,50):
        for k in range(1,50):
            wk=ff(i,j,k)
            if wk<n:
                an.append(wk)
            else:
                break
ann=set(an)
annn=sorted(ann)
wk =0
for i in range(1,n+1):
    if i ==annn[wk]:
        print(3)
        if wk+1>=len(annn):
            pass
        else:
            wk+=1
    else:
        print(0)

Submission status: Runtime Error

Solution code:
N=int(input())
la=list(range(2,10**2+1))
l=[]
for i in range(len(la)):
  l.append(la[i]**2)
for n in range(1,N+1):
  if n<6:
    print(0)
  else:
    c=0
    for x in range(len(l)):
      if l[x]*3>2*n:
        break
      else:
        for y in range(x,len(l)):
          if l[x]+2*l[y]>2*n:
            break
          else:
            for z in range(y,x+y+2):
              if l[x]+l[y]+l[z]>2*n:
                break
              else:
                
                if l[x]+l[y]+l[z]==2*n:
                  
                  if (x+y+z)%2==0: 
                      if l[x]==l[y] and l[y]==l[z]:
                        c+=1
                      elif l[x]==l[y] or l[y]==l[z]:
                        c+=3
                      else:
                        c+=6
                   
    print(c)

Submission status: Runtime Error

Solution code:
N = int(input())

list_N = [0,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])

Submission status: Runtime Error

Solution code:
N = int(input())

def count(n):
    ans=0
    for x in range(1, n):
        if 6*(x**2)>n:
            break
        for y in range(y, n):
            if 3*((x+y)**2)>2*n:
                break
            for z in range(z, n):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x > n:
                    break
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    if x==y and y==z:
                        ans+=1
                    elif x!=y and y!=z and z!=x:
                        ans+=6
                    else:
                        ans+=3
    return ans

for i in range(N):
    print(count(i+1))

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;

int main(){
	int N,x,y,z,count,k,m;
	cin>>N;
	m=N/5;
	for(k=1;k<=N;k++)
	{
		count = 0;
		for(x=1;x<=m;x++){
			for(y=1;y<=m;y++){
				for(z=1;z<=m;z++){
					if(((x*(x+y))+(y*(y+z))+(z*(z+x))) == k){
						count++;
					}
				}
			}
		}
		cout<<count<<endl;
	}
	
}

Submission status: Runtime Error

Solution code:
import math
N = int(input())
x = math.ceil(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:
                pass
            else:
                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])

Submission status: Runtime Error

Solution code:
def ff(x,y,z):
    return(x**2+y**2+z**2+x*y+y*z+z*x)

n=int(input())
an = []
for i in range(1,50):
    for j in range(1,50):
        for k in range(1,50):
            wk=ff(i,j,k)
            if wk<n:
                an.append(wk)
            else:
                break
ann=set(an)
annn=sorted(ann)
wk =0
for i in range(1,n+1):
    if i ==annn[wk]:
        print(3)
        if wk+1>=len(annn):
            pass
        else:
            wk+=1
    else:
        print(0)

Submission status: Runtime Error

Solution code:
import sys
import itertools
import math
from tqdm import tqdm

if __name__ == "__main__":
    N = int(sys.stdin.readline())

    for i in tqdm(range(1, N+1)):
        ans = 0
        ls = range(1, int(math.sqrt(i)))
        # ls = range(1, int(math.sqrt(i))-2*i)
        # print(ls)
        for (x,y,z) in itertools.combinations_with_replacement(ls, 3):
            tmp = x**2+y**2+z**2+x*y+y*z+z*x
            if tmp > i:
                break
            elif i == tmp:
                ans += 1
                if x == y and y == z:
                    continue
                elif x == y or y == z or z == x:
                    ans += 3-1
                else:
                    ans += 6-1
        print(ans)

Submission status: Runtime Error

Solution code:

import sympy
n = int(input())
ans = 0
for z in range(1,n+1):
    ans = 0
    if z-5<=0:
        print(0)
        continue
    ma = int(sympy.sqrt(z- 5))
    for i in range(1,ma+1):
        if z-i**2-2*i<0:
            
            break
        ma1 = int(sympy.sqrt(z-i**2-2*i))

        for j in range(i,ma1+1):
            if 4*z-2*i*j-3*i**2-3*j**2<=0:
                break

            p = (-i-j+sympy.sqrt(4*z-2*i*j-3*i**2-3*j**2))/2
            # print(p,z)
            if p <j:
                break
            
            if float(p).is_integer():
                if i==j==p:
                    ans +=1
                elif  (i==j and j!=p) or (i!=j and j==p):
                    ans +=3
                elif  (i!=j) and (j!=p):
                    ans +=6
            

            # if z-i**2-j**2-i-j<0:
            #     break
            # ma2 = int(math.sqrt(z-i**2-j**2-i-j))

            # for k in range(j,ma2+1):
                # if i**2+j**2+k**2+i*j+j*k+k*i==z:
                #     if i==j==k:
                #         ans +=1
                #     elif  (i==j and j!=k) or (i!=j and j==k):
                #         ans +=3
                #     elif  (i!=j) and (j!=k):
                #         ans +=6
    print(ans)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
count = 0

for i in range (1,n):
    for x in range (1,math.sqrt(n)):
        for y in range (1,math.sqrt(n)):
            for z in range (1,math.sqrt(n)):
                if x*x + y*y + z*z + x*y + y*z + z*x == i:
                    count = count + 1
                    count = 0
    print(count)

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())

"""
for i in range(1,int(N)+1):
    count = 0
    if i > 3:
        maxa = int(np.sqrt(i-2))
        for x in range(1,maxa):
            for y in range(1,maxa):
                for z in range(1,maxa):
                    if x*x+y*y+z*z+x*y+y*z+z*x > i:
                        break
                    if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count +=1

    print(count)

"""
ans = np.zeros(int(N))

maxa = int(np.sqrt(N-2))
for x in range(0,maxa):
    for y in range(0,x):
        for z in range(0,y):
            p = x*x+y*y+z*z+x*y+y*z+z*x
            if p<N+1:
                ans[p-1] += 6


for x in range(0,maxa):
    for y in range(0,x):
        p = x*x*3+y*y+x*y*2
        if p<N:
            ans[p-1] += 3


for x in range(0,maxa):
    p = x*x*6
    if p<N:
        ans[p-1] += 1

for x in range(0,N):
    print(int(ans[x]))

Submission status: Runtime Error

Solution code:
import numpy as np

n = int(input())
max_n = int(n ** 0.5)
memo = np.zeros((max_n, max_n, max_n))

ans = [0]*(n+1)

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


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

Submission status: Runtime Error

Solution code:
N = int(input())
ans = [0]*(N+1)
RANGE = 333
for i in range(1, RANGE):
  if i**2 <= N+1:
    for j in range(1, RANGE):
      if i**2 + j**2 + i*j <= N+1:
        for k in range(1, RANGE):
          wd = i**2 + j**2 + k**2 + i*j + j*k + k*i
          if wd <= N+1:
            #print(wd)
            #print(i, j, k)
            ans[wd] += 1
          else:
            break
      else:
        break
  else:
    break
    
for i in range(1,N+1):
  print(ans[i])

Submission status: Runtime Error

Solution code:
import numpy as np

n = int(input())
max_n = int(n ** 0.5)
memo = np.zeros((max_n, max_n, max_n))

ans = [0]*(n+1)

for x in range(1, max_n):
    for y in range(1, max_n):
        for z in range(1, max_n):
            s = x**2+y**2+z**2+x*y+y*z+z*x
            if s <= 1000:
                ans[s] += 1


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

Submission status: Runtime Error

Solution code:
import math

def main():
    N = int(input())
    ans = [0]*(N+1)

    end = N

    for i in range(3,end+1):
        sn = i
        x = 1
        y = 1
        z = sn - 2
        ans[cal(x,y,z)] += func(i,x,y,z)
        while z >= math.ceil(sn / 2):
            y += 1
            z -= 1
            if x > z or y > z:
                break
            ans[cal(x,y,z)] += func(i,x,y,z)
            for j in range(y):
                x += 1
                z -= 1
                if x > z or y > z:
                    break
                ans[cal(x,y,z)] += func(i,x,y,z)
    
    for i in range(1,N+1):
        print(ans[i])
        

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

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

main()

Submission status: Runtime Error

Solution code:
from itertools import combinations_with_replacement

N = int(input())

a = [0] * N


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


for i in combinations_with_replacement(range(1, N), 3):
    tmp = f(*i)
    if tmp >= N:
        continue
    plus = 1 if len(set(i)) == 1 else 3
    a[tmp - 1] += plus

print("\n".join(a))