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())
t = [0]*10001
for i in range(1,42):
    t[6*i**2] += 1
for i in range(1,59):
    for j in range(1,59):
        if(i != j):
            a = (i+j)**2 + 2*j**2
            if(a <= 10000):
                t[a] += 3
            else:
                break
for i in range(3,100):
    for j in range(2,i):
        for k in range(1,j):
            a = ((i+j)**2 + (j+k)**2 + (k+i)**2)//2
            if(a < 10000):
                t[a] += 6
            else:
                break
for i in range(1,n+1):
    print(t[i])

Submission status: Runtime Error

Solution code:
N = int(input())
A = []
for i in range(1,46):
  for j in range(1,46):
    for k in range(1,46):
      A.append(i**2+j**2+k**2+i*j+i*k+j*k)
A = sorted(A)
B = [0]*N
for i in range(N):
  if A[i] == A[i-1]:
    B[A[i]] += 1
  else:
    B[A[i]]=1
[print(i) for i in B]

Submission status: Runtime Error

Solution code:
#coding:utf-8
import itertools
def calculate(x,y,z):
    return x**2+y**2+z**2+x*y+y*z*x

n = int(input())
result_lst = [0] * n

for i,j,k in itertools.product(range(1,n+1),repeat=3):
    result = calculate(i,j,k)
    if result < n:
        result_lst[result] += 1

for i in result_lst:
    print(i + '\n')

Submission status: Runtime Error

Solution code:
def f(N):
    global table
    for x, y, z in combinations_with_replacement(range(1, 100), 3):
        n = x**2+y**2+z**2+x*y+y*z+z*x
        if n>N:
            continue
        if x==y==z:
            table[n] = 1
        elif x==y or y==z or z==x:
            table[n] = 3
        else:
            table[n] = 6
N = int(input())
table = [0 for _ in range(N+1)]
f(N)
for n in range(1, N+1):
    print(table[n])

Submission status: Runtime Error

Solution code:
N = int(input())
A = []
for i in range(1,46):
  for j in range(1,46):
    for k in range(1,46):
      A.append(i**2+j**2+k**2+i*j+i*k+j*k)
A = sorted(A)
B = [0]*N
for i in range(N):
  if A[i] == A[i-1]:
    B[A[i]] += 1
  else:
    B[A[i]]=1
[print(i) for i in B]

Submission status: Runtime Error

Solution code:
import math
n = int(input())
f = [0] * n
sqrt_n = int(math.sqrt(n)) +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,-1+sqrt_n/2) :
                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: Runtime Error

Solution code:
N = int(input())
cs = [0]*N
for i in range(1,130):
    for j in range(1,130):
        for k in range(1,130):
            temp = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if temp =< N and temp > 0:
                cs[temp-1] += 1
for i in range(N):
    print(cs[i])

Submission status: Runtime Error

Solution code:
from math import sqrt
N=int(input())
num=1
def checker(n):
    count=0
    x=1
    for a in range(int(sqrt(n-2))):
        y=1
        for b in range(int(sqrt(n-2))):
            z=1
            for c in range(int(sqrt(n-2))):
                ans=x*x+y*y+z*z+x*y+x*z+z*y
                if ans==n:
                    count=count+1
                z=z+1
            y=y+1
        x=x+1
    return count
for i in range(N):
    print(checker(num)) 
    num=num+1

Submission status: Runtime Error

Solution code:
#coding:utf-8
import itertools
def calculate(x,y,z):
    return x**2+y**2+z**2+x*y+y*z*x

n = int(input())
result_lst = [0] * n
print(result_lst)

for i,j,k in itertools.product(range(1,n+1),repeat=3):
    result = calculate(i,j,k)
    if result <= n:
        result_lst[result] += 1

for i in result_lst:
    print(i + '\n')

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
res = np.zeros(N)

th = int(np.sqrt(N))
for x in range(1, th):
    for y in range(1, x + 1):
        for z in range(1, y + 1):
            n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if n > N:
                continue
            if x == y and y == z:
                res[n] += 1
            elif x == y or y == z or z == x:
                res[n] += 3
            else:
                res[n] += 6
for i in range(1, N):
    print(int(res[i]))

Submission status: Runtime Error

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

m = math.floor(math.sqrt(N-4))

cnt = [0] * N
for i in range(1, m+1):
    for j in range(1, m+1):
        for k in range(1, m+1):
            l = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if (l > N):
                break
            cnt[l-1] += 1

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

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,i*2/3):
   for y in range(1,i*2/3):
    for z in range(1,i*2/3):
     if x+y+z==math.sqrt(i+x*y+x*z+y*z):
       ans+=1
  print(ans)

Submission status: Runtime Error

Solution code:
from itertools import combinations_with_replacement
from math import floor

def f(N):
    global table
    for x, y, z in combinations_with_replacement(range(1, 100), 3):
        n = x**2+y**2+z**2+x*y+y*z+z*x
        if n>N+1:
            continue
        if x==y==z:
            table[n] = 1
        elif x==y or y==z or z==x:
            table[n] = 3
        else:
            table[n] = 6
N = int(input())
table = [0 for _ in range(N+1)]
f(N)
for n in range(1, N+1):
    print(table[n])

Submission status: Runtime Error

Solution code:
N = input()
 
res = {i+1: 0 for i in range(N)}
 
for i in range(int(sqrt(N))):
  for j in range(int(sqrt(N))):
    for k in range(int(sqrt(N))):
      n = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if n in res:
        res[n] += 1
for r in res.values():
  print(r)

Submission status: Runtime Error

Solution code:
import math
s = int(input())
ans = [0] * 10000
a = 0
b = 0
c = 0

for i in range(3, 3 * math.floor(math.sqrt(s))):
    for j in range(1, i):
        a = j
        for k in range(1, i - j):
            b = k
            c = i - a - b
            d = a*a + b*b + c*c + a*b + b*c + c*a
            ans[d - 1] += 1

for i in range(s):
    print(str(ans[i]))

Submission status: Runtime Error

Solution code:
for n in range(1, N+1):
    if n < 6:
        print(0)
    else:
        cnt = 0
        for x in range(1, 32):
            for y in range(1, 32 - x):
                for z in range(1, 32-x-y):
                    if f2(x,y,z) == n:
                        cnt += 1
                        # print(x,y,z)
        print(cnt)

Submission status: Runtime Error

Solution code:
import numpy as np


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

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

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

Submission status: Runtime Error

Solution code:
#import numpy as np
#import math
#from decimal import *
#from numba import njit

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

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


main()

Submission status: Runtime Error

Solution code:
N = input()

res = {i+1: 0 for i in range(N)}

for i in range(int(sqrt(N))):
  for j in range(int(sqrt(N))):
    for k in range(int(sqrt(N))):
      res[i**2 + j**2 + k**2 + i*j + j*k + k*i] += 1
print(res)

Submission status: Runtime Error

Solution code:
import itertools

def calc(x, y, z):
  return (x*x + y*y + z*z + x*y + y*z + z*x)
  
N = input()

for _ in range(N):
  output = []
  for x in range(1,N):
    for y in range(1,N):
      for z in range(1,N):
        tmp = calc(x,y,z)
        if tmp==N:
          output.append(tmp)
  print(len(output))

Submission status: Runtime Error

Solution code:
N = int(input())

n = N ** (1/2)
n = int(n)


for nn in range(N):
    nn += 1
    ans = 0
    for x in range(1, n + 1):
        for y in range(1, n + 1):
            a = x + y
            b = x*x + y*y + x*y - nn
            if a > n:
                continue
            if a*a > nn:
                c = ((a*a-4*b)**(1/2)-a)/2
                if c.is_integer() and c > 0:
                    ans += 1

    print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
import math
input = sys.stdin.readline


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


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


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


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


def main():
    N = readint()

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


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N = int(input())

n = N ** (1/2)
n = int(n)


for nn in range(N):
    nn += 1
    ans = 0
    for x in range(1, n + 1):
        for y in range(1, n + 1):
            a = x + y
            b = x*x + y*y + x*y - nn
            if a > n or b < 0:
                continue
            if a*a > nn:
                c = ((a*a-4*b)**(1/2)-a)/2
                if c.is_integer() and c > 0:
                    ans += 1

    print(ans)

Submission status: Runtime Error

Solution code:
# C

from math import floor
N=int(input())

for i in range(1,N+1):
    ans=0
    p=floor(i**0.5)
    for x in range(1,p+1):
        #print(i,p,x)
        for y in range(1,ceil( (i-x**2)**0.5)+1):
            s = x**2+y**2+x*y
            t = x+y
            if t**2-4*(s-i)>0:
                k=(t**2-4*(s-i))**0.5
                #print(x,y,k)
                if k-t >0 and (k-t)%2==0:
                    ans +=1
                    #print(x,y,k,(k-t)//2)
    print(ans)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
for i in range(1,n+1):
    c = 0
    total = n
    while 1:
        for x in range(1,math.sqrt(i)):
            for y in range(x,math.sqrt(i)):
                for z in range(y,math.sqrt(i)):
                    total = ((x+y)**2 + (z+y)**2 + (x+z)**2) / 2
                    if total == i:
                        if x==y==z:
                            c += 1
                        elif x ==y or y == z:
                            c += 3
                        else:
                            c += 6
                        break
                    elif total>i:
                        break
                if total==i:
                    break
            if total==i:
                break
        if total>i:
            break
    print(c)

Submission status: Runtime Error

Solution code:
for n in range(1,N+1):#O(N^2)
    ans=0#ansを初期化
    l=[i for i in range(1,n+1)]
    for c  in itertools.combinations_with_replacement(l, 3):#l配列の中から3つを選ぶ　c ⇒(a,b,c)
        #print(c)
        if  c[0]**2 + c[1]**2 + c[2]**2 + c[0]*c[1] + c[1]*c[2] + c[2]*c[0] == n:
            if c[0] == c[1] == c[2]:
                ans+=1
            elif c[0] != c[1] & c[1] != c[2] & c[2] != c[0]:
                ans+=6
            else:
                ans+=3
    print(ans)

Submission status: Runtime Error

Solution code:
#import numpy as np
#import math
#from decimal import *
#from numba import njit

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

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


main()

Submission status: Runtime Error

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

def judge(n, x=1, y=1, z=1):
    num = 0
    x_th = int(math.sqrt(n))+1
    for x_i in range(x, x_th+1):
        #print('x_i: ', x_i)
        for y_i in range(x_i, x_th+1):
            y_th = n - x_i**2 + y_i**2 + x_i*y_i
            #print('y_i: ', y_i)
            #print('y_th: ', y_th)
            if y_th < 0:
                break
            for z_i in range(y_i, x_th):
                #print('z_i: ', z_i)
                result = x_i**2 + y_i**2 + z_i**2 + x_i*y_i + y_i*z_i + z_i*x_i
                #print('result: ', result)
                if result > n:
                    break
                elif result == n:
                    if x_i != y_i != z_i:
                        num += 6
                    elif x_i == y_i != z_i or x_i != y_i == z_i:
                        num += 3
                    elif x_i == y_i == z_i:
                        num += 1
    return num

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

Submission status: Runtime Error

Solution code:
def g(x, y, z):
  return x * x + y * y + z * z + x * y + y * z + z * x
  
def f(n):
  if(n < 6):
    return 0
  
  sum = 0
  lim = math.floor(math.sqrt(n)) + 1
  for x in range(1, lim, 1):
    for y in range(1, lim, 1):
      for z in range(1, lim, 1):
        a = g(x, y, z)
        if a > n:
          break
        if a == n:
          sum += 1
  return sum

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

Submission status: Runtime Error

Solution code:
import sys
import math
import statistics
import itertools
from collections import deque
n=int(input())
#n,m=map(int,input().split()))
#lis=list(map(int,input().split()))
#side=[]
#for _ in range(m):
    #side.append(tuple(map(int,input().split())))
ans_lis =[0]*1000000
 
#per_lis=itertools.permutations(list(range(1,4)))
 
for i in range(1,11):
    for j in range(1,11):
        for k in range(1,11):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            ans_lis[tmp-1]+=1
for i in range(n):
    print(ans_lis[i])
            
 
 
 
import sys
import math
import statistics
import itertools
from collections import deque
N=int(input())
#n,m=map(int,input().split()))
#lis=list(map(int,input().split()))
#side=[]
#for _ in range(m):
    #side.append(tuple(map(int,input().split())))
ans_lis =[0]*1000000

#per_lis=itertools.permutations(list(range(1,4)))
n=int(math.sqrt(N))
for i in range(1,11):
    for j in range(1,11):
        for k in range(1,11):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            ans_lis[tmp-1]+=1
for i in range(n):
    print(ans_lis[i])
            



import sys
import math
import statistics
import itertools
from collections import deque
n=int(input())
#n,m=map(int,input().split()))
#lis=list(map(int,input().split()))
#side=[]
#for _ in range(m):
    #side.append(tuple(map(int,input().split())))
ans_lis =[0]*1000000
 
#per_lis=itertools.permutations(list(range(1,4)))
 
for i in range(1,11):
    for j in range(1,11):
        for k in range(1,11):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            ans_lis[tmp-1]+=1
for i in range(n):
    print(ans_lis[i])
            
 
 
 
import sys
import math
import statistics
import itertools
from collections import deque
N=int(input())
#n,m=map(int,input().split()))
#lis=list(map(int,input().split()))
#side=[]
#for _ in range(m):
    #side.append(tuple(map(int,input().split())))
ans_lis =[0]*1000000

#per_lis=itertools.permutations(list(range(1,4)))
n=int(math.sqrt(N))
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            ans_lis[tmp-1]+=1
for g in range(n):
    print(ans_lis[g])

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
m = np.sqrt(N)
m = int(m)
for i in range(1, N+1):
    count = 0
    for j in range(1, m+1):
        for k in range(j,m+1):
            for l in range(k,m+1):
                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:
N = int(input())
ls = [0]*10000


for i in range(1,42):
    for j in range(1,42):
        for k in range(1,42):
            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: Runtime Error

Solution code:
n = int(input())

ans = [0] * 10010
for x in range(1,n//2):
    for y in range(1,n//2):
        for z in range(1,n//2):
            tmp = x*x + y*y + z*z + x*y + y*z + z*x
            ans[tmp] = ans[tmp] + 1

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

Submission status: Runtime Error

Solution code:
x,y,z = 1,1,1
import math
import itertools

lar_num = int(input())
answer = 0
linum = 0
for i in range(1,lar_num + 1):
    if i < 6:
        answer = 0
        print(answer)
    else:
        maxnum = math.ceil(-1+(i-2)**0.5)
        for x in range(1,maxnum+1):
            for y in range(1,x+1):
                for z in range(1,y+1):
                    if (x + y + z) % 2 == 0 and i % 2 == 1:
                        break
                    elif x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                        if x == y:
                            if x == z:
                                linum = 1
                            else:
                                linum = 3
                        elif y == z:
                            linum = 3
                        elif z == x:
                            linum = 3
                        else:
                            linum = 6
                        answer += linum
        linum = 0
        print(answer)
        answer = 0

after = time.time()
print(after-before)

Submission status: Runtime Error

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect


if __name__ == "__main__":
    n = int(input())
    ans = [0]*(n**2)
    for i in range(1,int(n**0.5)+1):
        for j in range(1,int(n**0.5)+1):
            for k in range(1,int(n**0.5)+1):
                ans[i**2 + j**2 + k**2 + i*j + j*k + i*k]+=1
    for i in range(1,n+1):
        print(ans[i])

Submission status: Runtime Error

Solution code:
N = int(input())
A = [0] * 10000
for x in range(1, int(pow(N, 0.5))):
    for y in range(1, int(pow(N, 0.5))):
        for z in range(1, int(pow(N, 0.5))):
            value = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if value > 10000:
                break
            A[value] += 1
for a in A[:N]:
    print(a)

Submission status: Runtime Error

Solution code:
n = int(input())

ans = [0] * 10010
for x in range(1,n):
    for y in range(1,n):
        for z in range(1,n):
            tmp = x*x + y*y + z*z + x*y + y*z + z*x
            ans[tmp] = ans[tmp] + 1

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

Submission status: Runtime Error

Solution code:
from itertools import product

N = int(input())

cnt = [0]*1000000000

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

Solution code:
import sys
import math
import statistics
import itertools
from collections import deque
n=int(input())
#n,m=map(int,input().split()))
#lis=list(map(int,input().split()))
#side=[]
#for _ in range(m):
    #side.append(tuple(map(int,input().split())))
ans_lis =[0]*1000000
 
#per_lis=itertools.permutations(list(range(1,4)))
 
for i in range(1,11):
    for j in range(1,11):
        for k in range(1,11):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            ans_lis[tmp-1]+=1
for i in range(n):
    print(ans_lis[i])
            
 
 
 
import sys
import math
import statistics
import itertools
from collections import deque
N=int(input())
#n,m=map(int,input().split()))
#lis=list(map(int,input().split()))
#side=[]
#for _ in range(m):
    #side.append(tuple(map(int,input().split())))
ans_lis =[0]*1000000

#per_lis=itertools.permutations(list(range(1,4)))
n=int(math.sqrt(N))
for i in range(1,11):
    for j in range(1,11):
        for k in range(1,11):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            ans_lis[tmp-1]+=1
for i in range(n):
    print(ans_lis[i])

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
import math

n = int(input())
m = int(math.sqrt(n))+1
x = y = z = 0 

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

anss = [0 for _ in range(n)]
visited = []

def dfs(x, y, z): 
    if x+y+z > m or (x, y, z) in visited:
        return
    anss[p(x, y, z)-1] += 1
    visited.append((x, y, z)) 
    dfs(x+1, y, z)
    dfs(x, y+1, z)
    dfs(x, y, z+1)

# output
dfs(1,1,1)
for i in range(n):
    print(anss[i])

Submission status: Runtime Error

Solution code:
import math

n = int(input())
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
        elif k>j and j == i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)] = 3
        elif k>j and j>i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)] = 6
        elif k = j and j>i:
          li[(i**2+j**2+k**2+i*j+i*k+j*k)] = 3
for i in li:
  print(i)

Submission status: Runtime Error

Solution code:
from itertools import product

N = int(input())

cnt = [0]*10000000

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

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect


if __name__ == "__main__":
    n = int(input())
    ans = [0]*(n**5)
    for i in range(1,int(n**0.5)+1):
        for j in range(1,int(n**0.5)+1):
            for k in range(1,int(n**0.5)+1):
                ans[i**2 + j**2 + k**2 + i*j + j*k + i*k]+=1
    for i in range(1,n+1):
        print(ans[i])

Submission status: Runtime Error

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)
    h = 0

    for i in range(1,51):
        for j in range(1,51):
            for m in range(1,51):
                h = i*(i+j) + j*(j+m) + m*(m+i)
                if h >= len(ans):
                    break
                ans[h] += 1

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

if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
if N <= 10**3:
    for i in range(1, N+1):
        ans = 0
        for x in range(1, 13):
            for y in range(1, 13):
                for z in range(1, 13):
                    if (x+y+z)**2-x*y-y*z-z*x == i:
                        ans += 1
        print(ans)
    exit()
else:
    table = [0] * N
    for i in range(1, 10**3):
        ans = 0
        for x in range(1, 14):
            for y in range(1, 14):
                for z in range(1, 14):
                    if (x+y+z)**2-x*y-y*z-z*x == i:
                        ans += 1
        table[i-1] += ans
    print(*table, sep="\n")
    for j in range(10**3, N+1):
        print(0)

Submission status: Runtime Error

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect


if __name__ == "__main__":
    n = int(input())
    ans = [0]*(n**3+3)
    for i in range(1,int(n**0.5)+1):
        for j in range(1,int(n**0.5)+1):
            for k in range(1,int(n**0.5)+1):
                ans[i**2 + j**2 + k**2 + i*j + j*k + i*k]+=1
    for i in range(1,n+1):
        print(ans[i])

Submission status: Runtime Error

Solution code:
for i in range(1, N+1):
    count = 0
    for x in range (1, i):
        for y in range(1, i):
            for z in range(1, i):
                if int(x**2) + int(y**2) + int(z**2) +int(x*y) + int(y*z) + int(z*x) == i:
                    count += 1
    print(count)

Submission status: Runtime Error

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect


if __name__ == "__main__":
    n = int(input())
    ans = [0]*(n**3+1)
    for i in range(1,int(n**0.5)+1):
        for j in range(1,int(n**0.5)+1):
            for k in range(1,int(n**0.5)+1):
                ans[i**2 + j**2 + k**2 + i*j + j*k + i*k]+=1
    for i in range(1,n+1):
        print(ans[i])

Submission status: Runtime Error

Solution code:
import itertools as it
n = int(input())
t = []
ans = [0]*10**4
def calc(x, y, z):
    return x**2+y**2+z**2 + x*y + y*z + z*x

for x in range(1, 10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            t.append(calc(x,y,z))

for i in t:
    if i < 10**4:
        ans[i] += 1
for i in range(1,n+1):
    print(ans[i])

Submission status: Runtime Error

Solution code:
#coding: UTF-8
import math
N = int(input())
#print(N)

ans = [0]*N

for i in range(1,N+1):
  if i <=5:
    ans[i] = 0
    continue
  cnt = 0
  m = int(math.sqrt(i))
  #平方根までやればよい
  for x in range(1,m):
    if i - x**2 <= 4:
      continue
    for y in range(x,m):
      if i - x**2 -y**2 <= 3:
        continue
      for z in range(y,m):
        a = (x+y+z)**2 -x*y -y*z - z*x
        if a == i:
          if x==y==z:
            cnt += 1
          elif x==y or y==z:
            cnt += 3
          else:
            cnt += 6
  ans[i-1] = cnt
print('\n'.join(map(str, ans)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from math import sqrt

n = int(input())
 
def calc(n):
    if n < 6:
        return 0
    if n == 6:
        return 1
    if 6 < n < 11:
        return 0
    if n == 11:
        return 3
    if 11 < n < 17:
        return 0
    if n == 17:
        return 3
    if n == 18:
        return 3
    ans = 0
    for x in range(1, sqrt(n)//1):
        for y in range(1, sqrt(n)//1):
            for z in range(1, sqrt(n)//1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    ans += 1
 
    return ans
 
for i in range(1, n+1):
    print(calc(i))

Submission status: Runtime Error

Solution code:
N = int(input())
for i in range(1,N+1):
  count = 0
  if i>5:
    for x in range(1,int((i-2)**0.5-1)+1):
      for y in range(1,int((i-2)**0.5-1)+1):
        z = (-(x+y)+((x+y)**2-4*(x**2+y**2+x*y-i))**0.5)
        if z == int(z) and z>0:
            count = count+1
  print(count)

Submission status: Runtime Error

Solution code:
import math
import numpy as np
from collections import Counter

N = int(input())

xyz_lim = int(math.sqrt(N-2)) - 1

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

cnt = Counter()
for _x in range(xyz_lim):
    for _y in range(xyz_lim):
        x, y = _x+1, _y+1
        cnt.update([f(x, y, _z+1) for _z in range(xyz_lim)])

for _n in range(N):
    n = _n + 1
    print(cnt[n])

Submission status: Runtime Error

Solution code:
import numpy as np

def fib(x,y,z,m):
    ret=0
    if np.square(x)+np.square(y)+np.square(z)+x*y+y*z+z*x==m:
      ret=1
    return ret

N=int(input())

for i in range(1,N+1):
   count=0
    m=i
    for x in range(1,m):
        for y in range(1,m):
            for z in range(1,m):
                if fib(x,y,z,m):
                     count=1+count
    print(str(count))

Submission status: Runtime Error

Solution code:
n=int(input())
import math
a=math.floor(math.sqrt(n/6))+1
for i in range(1,n+1):
    t=0
    for x in range(1,a):
        b=math.floor(math.sqrt((i-x**2)/3))+1
        for y in range(x,b):
            c=math.floor(math.sqrt(i-x**2-y**2-x*y))+1
            for z in range(y,c):
                if x**2+y**2+z**2+x*y+y*z+z*x==i:
                    if x==y and y==z:
                        t+=1
                    elif x!=y and y!=z and z!=x:
                        t+=6
                    else:
                        t+=3
    print(t)