Problem:


Score : 300 points

Problem Statement

Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:

1 \leq x,y,z

x^2 + y^2 + z^2 + xy + yz + zx = n

Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).

Constraints

All values in input are integers.

1 \leq N \leq 10^4

Input

Input is given from Standard Input in the following format:

N

Output

Print N lines. The i-th line should contain the value f(i).

Sample Input 1

20

Sample Output 1

0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0

For n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.

For n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.

For n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.

For n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.



Sample input:
20


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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import math
import collections
import copy
from collections import deque 
from functools import reduce
from itertools import product

# input = sys.stdin.readline

def ff(N):
#     print("call ff{0}".format(N))
    if N > 100:
        n = int(np.sqrt(20))+5
    else:
        n = N
    tc = 0
    cnt = 0
    for x in range(1, n+1):
        x2 = x**2
        for y in range(1, n+1):
            y2 = y**2
            xy = x * y
            tt = x2 + y2 + xy
            if tt > N:
                break
            for z in range(1, n+1):
                tc += 1
                num = tt + z**2 + x*z + y*z
                if N == num:
                    cnt += 1
                elif N < num:
                    break
    if (N < (n**2) * 6):
        flg = True
    else:
        flg = False
    return(str(cnt), flg)    
        
N = int(input())    
pr = []
f = True
for i in range(1, N+1):
#     ff(i)
     if (f):
        c, f = ff(i)
     pr.append(c)
print("\n".join(pr))

Submission status: Wrong Answer

Solution code:
n=int(input())
y=[0 for _ in range(n)]
for j in range(1,41):
   for k in range(j,58):
      for u in range(k,101):
         a=j*j+k*k+u*u+j*k+k*u+u*j
         if a < n+1:
            if j==k and k==u:
               y[a-1]=1
            elif j==k or k==u:
               y[a-1]=3
            else:
               y[a-1]=6
for o in range(n):
   print(y[o])

Submission status: Wrong Answer

Solution code:
import math

n = int(input())

for i in range(1, n + 1):
    cnt = 0
    
    n = i
    x = 1
    y = 1

    ans = []

    while x < n:
        if x in ans:
            break
        if x ** 2 + x > i:
            break

        while y < n:
            if y in ans:
                break
            if y ** 2 + y > i:
                break

            try:
                z = (math.sqrt(4 * i - 3 * y ** 2 - 2 * x * y - 3 * x ** 2) - x - y) / 2
            
            except:
                y += 1
                continue

            if z > 0 and z.is_integer():
                if x == y:
                    if y == z:
                        cnt += 1
                    else:
                        cnt += 3
                elif x == z:
                    cnt += 3
                elif y == z:
                    cnt += 3
                else:
                    cnt += 6
                ans.append(x)
                ans.append(z)
                ans.append(y)
                n = max(z, x, y)           
                break

            y += 1
        x += 1

    print(cnt)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

ans = [0]*(10**5)
for i1 in range(1, 1000):
    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 n > 10**4:
            break
        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: Wrong Answer

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

for n in range(1, N+1):
    count = 0
    for x in range(1, int(sqrt(n / 3))):
        for y in range(x,int(sqrt(n * 2 / 3))):
            for z in range(y, int(sqrt(n))):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    if len(set([x, y, z])) == 3:
                        count += 6
                    elif len(set([x, y, z])) == 2:
                        count += 3
                    elif len(set([x, y, z])) == 1:
                        count += 1
    print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())

for a in range(n):
    ans = 0
    for i in range(1,100):
        for j in range(1,100):
            if i*2 + j*2 + i*j >= a:
                break
            for k in range(1,100):
                if i**2 + j**2 + k**2 +i*j + j*k + k*i == a:
                    ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = y = 1
index = {}
for x in range(1, 34):
    for y in range(x, 34):
        for k in range(3,100):
            z = k -x-y
            if z >= y:
                ans = (x + y + z) ** 2 - x*y -y*z -z*x
                if ans <= n:
                    if ans in index:
                        if x == y == z:
                            index[ans] += 1
                        else:
                            index[ans] += 3
                    else:
                        if x == y == z:
                            index[ans] = 1
                        else:
                            index[ans] = 3
for i in range(1, n+1):
    if i in index:
        print(index[i])
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
def f(n):
    pairs = set()
    for x in range(1, 45):
        for y in range(x, 45):
            temp = - 3 * (x + y) ** 2 + 4 * n + 4 * x * y
            if temp < 0:
                continue
            temp2 = int(temp ** .5)
            if temp2 * temp2 != temp:
                continue
            temp3 = - (x + y) + temp2
            temp4 = - (x + y) - temp2
            z1 = temp3 // 2
            z2 = temp4 // 2
            if z1 >= 1 and g(x, y, z1) == n:
                key = tuple(sorted((x, y, z1)))
                if key in pairs:
                    continue
                pairs.add(key)
            if z2 >= 1 and g(x, y, z2) == n:
                key = tuple(sorted((x, y, z2)))
                if key in pairs:
                    continue
                pairs.add(key)
    res = 0
    for x, y, z in pairs:
        if x == y == z:
            res += 1
        elif x == y or y == z or z == x:
            res += 3
        else:
            res += 6
    return res


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


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

Submission status: Wrong Answer

Solution code:
N = int(input())

for n in range(1,N+1):
    c=0
    for x in range(1,int(n**(1/2))):
        for y in range(x,int(n**(1/2))):
            for z in range(y,int(n**(1/2))):
                f=x*x + y*y + z*z + x*y + y*z + z*x
                if n==f:
                    e=0
                    if x==y:
                        e+=1
                    if y==z:
                        e+=1
                    if z==x:
                        e+=1
                    if e==0:
                        c+=6
                    elif e==1:
                        c+=3
                    else:
                        c+=1
                if f>n:
                    break
        if x*x+y*y>n:
            break
    print(c)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())

    ans = defaultdict(int)
    for x in range(1, 101):
        for y in range(1, 10):
            for z in range(1, 101):
                n = x * x + y * y + z * z + x * y + y * z + z * x
                ans[n] += 1

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


main()

Submission status: Wrong Answer

Solution code:
import sys
N = int(sys.stdin.readline())
for n in range(1,N+1):
  if n < 6:
    x,y,z = 0,0,0
  else:
    x = int((n / 6)**0.5)
    y = int((((n -1)/3) - 1/9)**0.5 - 1/3)
    z = int((n - 5)**0.5 + 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: Wrong Answer

Solution code:
N = int(input())

counts = [0] * 10001
for i in range(1, 31):
    for j in range(1, i + 1):
        for k in range(1, j + 1):
            result = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if result > 10000:
                continue
            if i == j and j == k:
                counts[result] += 1
            elif i == j or j == k:
                counts[result] += 3
            else:
                counts[result] += 6

for n in range(1, N + 1):
    print(counts[n])

Submission status: Wrong Answer

Solution code:
n=int(input())
comb=[]
ans=[]


for k in range(1, n+1):
    flag=False
    for x in range(1, 50):
        if 6*x**2 > k:
            break
        else:
            for y in range(x, 50):
                for z in range(y, 50):
                    if (x+y+z)**2 - x*y-y*z-z*x==k:
                        comb.append((x,y,z))
                        flag=True
                        break
    
    if flag:
        pass
    else:
        comb.append((0, 0, 0))


for s in range(n):
    if comb[s][0]==comb[s][1]==comb[s][2]==0:
        ans.append(0)
    elif comb[s][0]==comb[s][1]==comb[s][2]!=0:
        ans.append(1)
    elif comb[s][0]!=comb[s][1] and comb[s][1]!=comb[s][2] and comb[s][2]!=comb[s][0]:
        ans.append(6)
    else:
        ans.append(3)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(1,n+1):
	cnt = 0
	for x in range(1,20):
		for y in range(1,20):
			for z in range(1,20):
				if (x**2 + y**2 + z**2 + (x*(y+z)) + (y*z)) == i:
					cnt += 1
	print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())

result_list = [0] * n

half = int(n/2)

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



print(result_list)

Submission status: Wrong Answer

Solution code:
import math

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

    end = math.ceil(math.sqrt(N))

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

def func(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: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

def calc(n):
    for i in range(1,int((n+1)**0.5)):
        for j in range(1,int((n+1)**0.5)):
            for k in range(1, int((n+1)**0.5)):
                if (i+j+k)**2 - i*j - j*k - k*i == n:
                    if i == j == k:
                        return 1
                    else:
                        return 3
    return 0    

def main():
    ans = 0
    n = int(input())
    for i in range(1,n+1):
        print(calc(i))

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

if n < 6:
	for i in range(n):
		print(0)
	sys.exit()

ans = [0 for _ in range(n)]
ans[5] = 1
s = set()
t = set()
t.add((1,1,1))
i = 0
flag = False
while i < 300:
	i += 1
	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
			if num >= n:
				continue
			#print(l,count,num)
			if count == 1:
				ans[num] += 1
			elif count == 2:
				ans[num] += 3
			else:
				ans[num] += 6
	if flag:
		break

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

Submission status: Wrong Answer

Solution code:
n = int(input())

lis = [0] * (10000+1)

for i in range(1, 65):
    for j in range(1, 65):
        for k in range(1, 65):
            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: Wrong Answer

Solution code:
#c
import numpy
N = int(input())
cou = 0

for i in range(1,N+1):
    cou = 0
    for x in range(1,i+1):
        for y in range(1,i+1):
            for z in range(1,i+1):
                if x**2+y**2+z**2+x*y+y*z+z*x == i:
                    if x == y == z:
                        print(1)
                        break
                    elif x ==y or y == z or z == x:
                        print(3)
                        break
                    else:
                        print(6)
        else:
            continue
        break
    else:
        print(0)
        continue
    break
    print(cou)

Submission status: Wrong Answer

Solution code:
N = int (input ())
z = 1
l = []
while True:
  l.append ((2+z)**2-(1+z+z))
  
  if N <= (2+z)**2-(1+z+z):
    break
  else:
    print (z)
    z += 1

Submission status: Wrong Answer

Solution code:
N = int(input())

answer = 0
for n in range(1, N+1):
  for x in range(1, 50):
    for z in range(1, 50):
      if 3* x**2 + z**2 + 2*x*z == n:
        num_pair = [x, z]
        if num_pair[0] == num_pair[1]:
          answer = 1
          break
        else:
          answer = 3
          break
    if answer != 0:
      break
    

  print(answer)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
Heihou_1 = np.array([(3*i)**2-(3*i) for i in range(1,40)])
#Heihou_3 = [i**2 for i in range(4,N+1) if i%3 != 0]
n_list = []
for i in range(1,50):
    for j in range(1,50):
        n_list.append(3*(i)**2 + 2*i*j + j**2)


#print(Heihou_1[-1])
#print(n_list)

for i in range(1,N+1):
    if np.any(Heihou_1 == i):
        print(1)
        Heihou_1 = Heihou_1[1:-1]
    elif i in n_list:
        print(3)
        n_list = n_list[1:-1]
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
comb=[]
ans=[]


for k in range(1, n+1):
    flag=False
    for x in range(1, 40):
        if 6*x**2 > k:
            break
        else:
            for y in range(x, 40):
                for z in range(y, 40):
                    if (x+y+z)**2 - x*y-y*z-z*x==k:
                        comb.append((x,y,z))
                        flag=True
                        break
    
    if flag:
        pass
    else:
        comb.append((0, 0, 0))


for s in range(n):
    if comb[s][0]==comb[s][1]==comb[s][2]==0:
        ans.append(0)
    elif comb[s][0]==comb[s][1]==comb[s][2]!=0:
        ans.append(1)
    elif comb[s][0]!=comb[s][1] and comb[s][1]!=comb[s][2] and comb[s][2]!=comb[s][0]:
        ans.append(6)
    else:
        ans.append(3)

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

Submission status: Wrong Answer

Solution code:
N = int(input())

def func(N_max):
#     print(f'N_max:{N_max}')
    cnt = 0
#     flag = False
    ans = []
    
    total = 0

    for x in range(1, N_max):
        x_total = x**2
        if N_max < x_total:
            break
        for y in range(x, N_max):
            y_total = x_total + y**2 + x*y
            if N_max < y_total:
                break

            for z in range(y, N_max):
                total = y_total + z**2+y*z+z*x
                if N_max < total:
                    break
                ans.append((total, change(len(set((x,y,z))))))

    return ans

def change(length):
    if length < 1:
        return 0
    elif length == 1:
        return 1
    elif length == 2:
        return 3
    elif length == 3:
        return 6

data = func(N)
ans_list = [0] * (N)
for d in data:
    ans_list[d[0]-1] = d[1]
for a in ans_list:
    print(a)

Submission status: Wrong Answer

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]*10000
for i in range(10000):
  if A[i] < 10000:
    B[A[i]] += 1
C = B[1:N+1]
[print(i) for i in C]

Submission status: Wrong Answer

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

ans = [0]*(10**5)
for i1 in range(1, 1000):
    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 n > 10**5:
            break
        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: Wrong Answer

Solution code:
n = int(input())
for i in range(1,n+1):
	cnt = 0
	for x in range(1,14):
		for y in range(1,14):
			for z in range(1,14):
				if x**2 + y**2 + z**2 + (x*(y+z)) + (y*z) == i:
					cnt += 1
	print(cnt)

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

def calc(n):
    for i in range(1,int(n**0.5)):
        for j in range(1,int(n**0.5)):
            for k in range(1, int(n**0.5)):
                if (i+j+k)**2 - i*j - j*k - k*i == n:
                    if i == j == k:
                        return 1
                    else:
                        return 3
    return 0    

def main():
    ans = 0
    n = int(input())
    for i in range(1,n+1):
        print(calc(i))

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
a = int(input())
b = round(a**0.5) + 1
print(b)
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]-1] = t[x[i]-1] + 1

for i in t:
    print(i)

Submission status: Wrong Answer

Solution code:
import sys
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
if n<=5:
    for i in range(n):
        print(0)
    sys.exit()

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: Wrong Answer

Solution code:
import math
N = int(input())
def search(n):
    global N
    for x in range(1, int(math.sqrt(N)) + 1):
        xx = x*x
        if n - xx <= 0:
            return None
        for y in range(1, int(math.sqrt(N)) + 1):
            yy = y*y
            xy = x*y
            if n - xx - yy - xy <= 0:
                break
            z = binarySearch(n, x, y, xx + yy + xy)
            if z:
                return (x, y, z)


def binarySearch(n, x, y, t):
    global N
    right = -1
    left = N + 1
    while(abs(right - left) > 1):
        z = left + (right - left) // 2
        l = t + z*z + y*z + z*x
        if l == n:
            return z
        elif l < n:
            right = z
        else:
            left = z
        # print(right, left, z)
    return None

ans = list()
for n in range(1, N+1):
    xyz = search(n)
    if xyz == None:
        ans.append("0")
        continue
    t = len(set(xyz))
    if t == 1:
        ans.append("1")
    elif t == 2:
        ans.append("3")
    else:
        ans.append("6")

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

Submission status: Wrong Answer

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

for n in range(1, N + 1):
    sum = 0
    root = math.sqrt(2*n)
    min = int(math.sqrt(2*n/3))
    if n<4:
        print(sum)
        continue
    for u in range(min - 1, int(root)):
        for v in range(u, int(root)):
            if u*u + v*v >= 2*n:
                break
            for w in range(v, int(root)):
                if u*u + v*v + w*w > 2*n:
                    break
                if u*u + v*v + w*w == 2*n:
                    x = int((u - v + w)/2)
                    y = int((u + v - w)/2)
                    z = int((-u + v + w)/2)
                    if (x > 0 and y > 0 and z > 0):
                        if x == y and y == z:
                            sum += 1
                        elif x == y or y == z or z == x:
                            sum += 3
                        else:
                            sum += 6
                        
    print(sum)

Submission status: Wrong Answer

Solution code:
from math import sqrt
from math import floor
n = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

counts = [0] * 10000
for i in range(1, 31):
    for j in range(1, i + 1):
        for k in range(1, j + 1):
            result = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if result > 10000:
                continue
            if i == j and j == k:
                counts[result - 1] += 1
            elif i == j or j == k:
                counts[result - 1] += 3
            else:
                counts[result - 1] += 6

for n in range(1, N + 1):
    print(counts[n - 1])

Submission status: Wrong Answer

Solution code:
def fx(n):
  s = [0]*(n+1)
  for i in range(1,10000):
    if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
    for j in range(1, 10000):
      if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
      for k in range(1, 10000):
        if (1+1+k)**2 - 1*1 - 1*k - k*1 > n: break
        formula = (i+j+k)**2 - i*j - j*k - k*i
        if formula <= n and formula > 0:
          s[formula] += 1
        if formula >= n:
          break
  return s


n = int(input())
s = fx(n)
for i in range(1,n):
  print(s[i])

Submission status: Wrong Answer

Solution code:
import math 

n=int(input())
if n<2:
  for i in range(n):
    print(0)
  exit()
a=int(math.sqrt(-2+n))
for i in range(1,n+1):
  count=0
  for y in range(1,a+1):
    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: Wrong Answer

Solution code:
n=int(input())
d={}
sm=3
a=1
brk=0
ll=[]

while 1:  
  we=sm-a
  for i in range(1,we):
    c=we-i
    b=i
    temp=pow((a+b+c),2)-(a*b+a*c+b*c)
    if temp not in d:
      d[temp]=1
      ll.append(temp)
    else:
      d[temp]+=1
    brk=max(brk,temp)
  if temp>n and a>=sm-2:
    break
  if we==2:
    sm+=1
    a=1
  else:
    a+=1
  
l=[0]*n
ll.sort()
for i in ll:
  if i>n:
    break
  else:
    l[i-1]=d[i]

for i in l:
  print(i)

Submission status: Wrong Answer

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

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

if n < 6:
	for i in range(n):
		print(0)
	sys.exit()

ans = [0 for _ in range(n)]
ans[5] = 1
s = set()
t = set()
t.add((1,1,1))
i = 0
flag = False
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
			if num >= n:
				flag = True
				continue
			#print(l,count,num)
			if count == 1:
				ans[num] += 1
			elif count == 2:
				ans[num] += 3
			else:
				ans[num] += 6
	if flag:
		break

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

Submission status: Wrong Answer

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

for n in range(1, N+1):
    count = 0
    for x in range(1, int(sqrt(n) / 3) + 2):
        for y in range(x,int(sqrt(n) * 2 / 3) + 2):
            for z in range(y, int(sqrt(n))):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    if len(set([x, y, z])) == 3:
                        count += 6
                    elif len(set([x, y, z])) == 2:
                        count += 3
                    elif len(set([x, y, z])) == 1:
                        count += 1
    print(count)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
for i in range(1, N+1):
    count = 0
    for j in range(1, int(math.sqrt(i)//6)+10):
        for k in range(j, int(math.sqrt(i)//6)+10):
            for l in range(k, int(math.sqrt(i)//6)+10):
                n = j*j + k*k + l*l + j*k + k*l + l*j
                #print(i, j, k, l)
                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: Wrong Answer

Solution code:
a = int(input())
b = round(a**0.5) + 1
print(b)
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)
print(x)

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

Submission status: Wrong Answer

Solution code:
N = int(input())

def func(N_max):
#     print(f'N_max:{N_max}')
    cnt = 0
#     flag = False
    ans = []
    
    total = 0

    for x in range(1, N_max):
        x_total = x**2
        if N_max < x_total:
            break
        for y in range(x, N_max):
            y_total = x_total + y**2 + x*y
            if N_max < y_total:
                break

            for z in range(y, N_max):
                total = y_total + z**2+y*z+z*x
                if N_max < total:
                    break
                ans.append((total, change(len(set((x,y,z))))))

    return ans

def change(length):
    if length < 1:
        return 0
    elif length == 1:
        return 1
    elif length == 2:
        return 3
    elif length == 3:
        return 6

data = func(N)
ans_list = [0] * (N+1)
for d in data:
    ans_list[d[0]] = d[1]
for a in ans_list:
    print(a)

Submission status: Wrong Answer

Solution code:

import numpy as np
N = int(input())
Heihou_1 = np.array([(3*i)**2-(3*i) for i in range(1,40)])
#Heihou_3 = [i**2 for i in range(4,N+1) if i%3 != 0]
n_list = []
for i in range(1,50):
    for j in range(1,50):
        n_list.append(3*(i)**2 + 2*i*j + j**2)


print(Heihou_1[-1])
print(n_list[-1])

for i in range(1,N+1):
    if np.any(Heihou_1 == i):
        print(1)
        Heihou_1 = Heihou_1[1:-1]
    elif i in n_list:
        print(3)
        n_list = n_list[1:-1]
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())

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

def Main():
    n = I()
    c = [0]*n
    fa = True
    for i in range(1,n+1):
        for j in range(1,n+1):
            tmp = f(i,i,j)
            if n<tmp:
                if j==1:
                    fa = False
                break
            if j==i:
                d = 1
            else:
                d = 3
            c[tmp-1] += d
        
        if not fa:
            break

    for rep in c:
        print(rep)
    return

if __name__=='__main__':
    Main()