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

Solution code:
from collections import defaultdict
import math
n=int(input())
d=defaultdict(int)

if n>2:
    m=int(math.sqrt(n))
    for l in range(3,m+2):
        for i in range(1,l-1):
            for j in range(1,l-i):
                k=l-i-j
                N=i*i+j*j+k*k+i*j+j*k+k*i
                d[N]+=1
for i in range(1,n+1):
    print(d[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
                elif len(set(tmp)) == 3:
                    lis[t-1] = 6

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

Submission status: Wrong Answer

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

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.maxsize = 10 ** 15
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

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

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

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

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

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

x, y, z = 1,1,1
ans_dict = {}

for x in range(1,100):
    for y in range(1,100-x):
        for z in range(1,100-x):
            ans = (x + y)**2 + (y + z)**2 + (z + x)**2
            if ans in ans_dict:
                ans_dict[ans] += 1
            else:
                ans_dict[ans] = 1

for n in range(1, N+1):
    if 2*n in ans_dict:
        print(ans_dict[2*n])
    else:
        print(0)

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)+3):
        for k in range(j, int(math.sqrt(i)//6)+3):
            for l in range(k, int(math.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:
N = int(input())

def f(x, y, z):
  return (x + y + z) ** 2 - (x * y + y * z + z * x)
cnts = []

for i in range(5):
  print(0)
for i in range(6, N+1):
  cnt = 0
  for j in range(1, int((i-2) ** (1/2))):
    if f(j, j, j) == i:
     
      cnt += 1
      break
    for k in range(1, int((i-2) ** (1/2))):
      if f(j, j, k) == i:
        cnt += 3
       
        break
      elif f(j, k, j) == i:
        cnt += 3
        break
      elif f(k, j, j) == i:
        cnt += 3
        break
    else:
      continue
      for l in range(1, int((i-2) ** (1/2))):
        if f(j, k, l) == i:
          cnt += 6
  print(cnt)

Submission status: Wrong Answer

Solution code:
from itertools import product

n = int(input())
def calc(i):
    xs = [a for a in range(1,int(i**0.5))]
    ys = [a for a in range(1,int(i**0.5))]
    zs = [a for a in range(1,int(i**0.5))]
    #print(xs,ys,zs)
    cnt = 0
    for x,y,z in list(product(xs,ys,zs)):
        if x**2+y**2+z**2+x*y+y*z+z*x == i:
            cnt += 1
            #print(x,y,z)
    return cnt

Submission status: Wrong Answer

Solution code:
N=int(input())
for h in range(1,N+1):
    num=0
    for i in range(1,h-3):
        for j in range(i+1,h-3):
            for k in range(j+1,h-3):
                if i**2+j**2+k**2+i*j+j*k+k*i==h:
                    num+=1
    print(num)

Submission status: Wrong Answer

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
    lol=0
    for j in range(x):
        if(j>val):
            break
        left=val-sq[j]
        ii=j
        jj=x-1
        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):
                    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
                ii+=1
                jj-=1
    print(lol)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = [0 for _ in range(10**4 + 100)]
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            p = x**2 + y**2 + z**2 + x * y + y * z + z * x
            if p <= 10**4:
                ans[p] += 1
for i in range(n + 1):
    print(ans[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
				break
			#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())
lst=[0]*10100
for i in range(1, 42):
  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]+=1
      elif i==j and j!=k:
         lst[temp+1]+=3
      elif j==k and k!=i:
         lst[temp+1]+=3
      elif k==i and i!=j:
         lst[temp+1]+=3
      elif i!=j and j!=k and k!=i:
         lst[temp+1]+=6
for p in range(1, n+1):
  print(lst[p+1])

Submission status: Wrong Answer

Solution code:
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main(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
 
if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i8 = numba.int64
    cc = CC('my_module')
 
    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)
 
    main = cc_export(main, (i8, ))
    cc.compile()
 
from my_module import main
 
N = int(read())
main(N)

Submission status: Wrong Answer

Solution code:
import math
import sys
N = int(sys.stdin.readline())
for i in range(1,N+1):
  ans = 0
  n = math.ceil(math.sqrt(i))
  for j in range(1,n):
    wan = n - j
    for k in range(1,wan):
      n_sub = i -j*j - k*(j + k)
      if n_sub <= 0:
        break
      b = j + k
      check = ((b**2 + 4*n_sub) ** (1/2) - b)/2
      if check == j == k:
        ans = 1
      elif check != j != k:
        ans = 6
      else:
        ans = 3
    break 
  print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
def f(n):
    for x in range(1,int(N**0.5)+1):
        for y in range(x,int(N**0.5)+1):
            if n - (3/4)*(x*x + y*y) - 0.5*x*y >= 0:
                d = (n - (3/4)*(x*x + y*y) - 0.5*x*y)**0.5
                zp = (x+y)*(-0.5) + d
                zm = (x+y)*(-0.5) - d
                if zp == int(zp) and zp >= 1:
                    z = zp
                    if x == y and y == z and z == x:
                        return 1
                    elif x == y or y == z or z == x:
                        return 3
                    else:
                        return 6
                elif zm == int(zm) and zm >= 1:
                    z = zm
                    if x == y and y == z and z == x:
                        return 1
                    elif x == y or y == z or z == x:
                        return 3
                    else:
                        return 6
for i in range(1,N+1):
    ans = f(i)
    if ans == None:
        print(0)
    else:
        print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    n = int(input())
    if n == 1:
        print(0)
        sys.exit()
    r = defaultdict(int)
    for i1 in range(1,33):
        for i2 in range(1,33):
            for i3 in range(1,33):
                t = pow(i1, 2) + pow(i2, 2) + pow(i3, 2) + i1*i2 + i2*i3 + i1*i3
                t = int(t)
                r[t] += 1
    for i1 in range(1, n+1):
        print(int(r[i1]))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
def search(n):
    for x in range(1, int(math.sqrt(n)) + 1):
        xx = x*x
        if n - xx <= 0:
            return None
        for y in range(x, 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):
    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:
from math import sqrt

n = int(input())
lim_n = int(sqrt(n*2))
result = [0] * n

for i in range(2, lim_n+1):
    for j in range(2, i+1):
        for k in range(2, j+1):
            p = i**2+j**2+k**2
            if p > 2*n:
                break
            if p % 2 == 1:
                continue
            if (j + k) - i < 2:
                continue
            if i == j and j == k:
                if i  % 2 ==1:
                    continue
                result[p//2-1] = 1
            elif i != j and j != k:
                result[p//2-1] = 6
            else:
                result[p//2-1] = 3

for item in result:
    print(item)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	triplets
# CreatedDate:  2020-07-11 22:09:08 +0900
# LastModified: 2020-07-11 22:30:08 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd
from itertools import combinations_with_replacement as nCr
from collections import Counter


def main():
    S = list(map(list, nCr(range(1, 70), 3)))
    sum_list = []
    cnt = 0
    for s in S:
#        print(s)
        total = s[0]**2+s[1]**2+s[2]**2+s[0]*s[1]+s[1]*s[2]+s[2]*s[0]
        loop_cnt = 1
        if s[0]!=s[1] and s[1]!=s[2] and s[2]!=s[0]:
            loop_cnt = 6
        elif (s[0] == s[1] and s[1] != s[2]) or (s[1] == s[2] and s[2] != s[0]) or (s[2] == s[0] and s[0] != s[1]):
            loop_cnt = 3
        if total < 10001:
            for _ in range(loop_cnt):
                sum_list.append(total)
        cnt+=1
#        print(sum_list)
    #    if cnt==20:
    #        return
    
    c = Counter(sum_list)
    key = c.keys()
    n = int(input())
    for i in range(1, n+1):
        if not i in key:
            print(0)
        else:
            print(c[i])

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
for h in range(1,N+1):
    num=0
    for i in range(1,h-6):
        for j in range(1,h-6):
            for k in range(1,h-6):
                if i**2+j**2+k**2+i*j+j*k+k*i==h:
                    num+=1
    print(num)

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):
    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:
import math

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

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

    for i in range(3,end+1):
        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):
    # print(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:
N=int(input())

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

Submission status: Wrong Answer

Solution code:
from math import sqrt

n = int(input())
lim_n = int(sqrt(n))
result = [0] * n

for i in range(2, lim_n+1):
    for j in range(2, i+1):
        for k in range(2, j+1):
            p = i**2+j**2+k**2
            if p > 2*n:
                break
            if p % 2 == 1:
                continue
            if (j + k) - i < 2:
                continue
            if i == j and j == k:
                if i  % 2 ==1:
                    continue
                result[p//2-1] = 1
            elif i != j and j != k:
                result[p//2-1] = 6
            else:
                result[p//2-1] = 3

for item in result:
    print(item)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

import math

n = int(input())

result = [0] * (n + 1)
border = int(math.sqrt(n) / 2) + 1 + 1
for x in range(1, border):
    for y in range(1, border):
        for z in range(1, border):
            r = ((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2) // 2
            if r > n:
                break
            else:
                result[r] += 1

for num in result[1::]:
    print(num)

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
				break
			#print(l,count,num)
			if count == 3:
				ans[num] += 1
			else:
				ans[num] += 3
	if flag:
		break

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

Submission status: Wrong Answer

Solution code:
n=int(input())
import math
for i in range(1,n+1):
    a=math.floor(math.sqrt(i/6))+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):
            B=(x+y)
            C=x**2+y**2+x*y-i
            r=(B**2-4*C)**0.5
            z1=(-B+r)/2
            z2=(-B-r)/2
            if z1.is_integer() and z1>0:
                if x==y and y==z1:
                    t+=1
                elif x!=y and y!=z1 and z1!=x:
                    t+=6
                else:
                    t+=3
            if z2.is_integer() and z2>0:
                if x==y and y==z2:
                    t+=1
                elif x!=y and y!=z2 and z2!=x:
                    t+=6
                else:
                    t+=3
    print(t)

Submission status: Wrong Answer

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

for i in range(n):
    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:
import math

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

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

    for i in range(3,end+1):
        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):
    # print(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 itertools
n = int(input())
N = int(n**0.5)
ans = [0] * n
for x,y,z in itertools.combinations_with_replacement(list(range(1,N+1)),3):
    a = x**2 + y**2 + z**2 + x*y + y*z + z*x
    if a > n: continue
    if z==y==z: b = 1
    elif x==y or x==z or y==z: b = 3
    else: b = 6
    ans[a-1] = b
for i in ans: print(i)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[0]*10100
for x in range(1,42):
  for y in range(1,42):
    for z in range(1,42):
      key=x**2+y**2+z**2+x*y+y*z+z*x
      A[key-1]+=1
for i in range(N):
  print(A[i])

Submission status: Wrong Answer

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
    lol=0
    for j in range(x):
        if(j>val):
            break
        left=val-sq[j]
        ii=j
        jj=x-1
        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
                ii+=1
                jj-=1
        if(lol):
            #print(sq[ii],sq[jj],sq[j],2*i)
            break
    print(lol)

Submission status: Wrong Answer

Solution code:
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main(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
      return ans
      ans = 0
 
if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i8 = numba.int64
    cc = CC('my_module')
 
    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)
 
    main = cc_export(main, (i8, ))
    cc.compile()
 
from my_module import main
 
N = int(read())
print(main(N))

Submission status: Wrong Answer

Solution code:
N = int(input())
 
for n in range(1,N+1):
  ans = 0
  check = False
  for x in range(1,42):
    for y in range(x,42):
      for z in range(y,42):
        if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == n:
          if x == y and y == x and z == x:
            ans += 1
          elif x == y  or z == x or y == z:
            ans += 3
          elif x != y and y != z and z != x:
            ans += 6
  print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import combinations_with_replacement

n = int(input())

for i in range(1, n+1):
    ans = 0
    for v in combinations_with_replacement(range(1, 35), 3):        
        x, y, z = v

        if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
            if x == y == z:
                ans += 1
            elif x == y or y == z or z == x:
                ans += 3
            else:
                ans += 6
            break

    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
c = [0]*10001

for x in range(1,101):
    if(x > n):
        break
    for y in range(x,101):
        for z in range(y,101):
            p = int(((x+y)*(x+y) + (y+z)*(y+z) + (z+x)*(z+x))/2)
            if(n >= p):
                c[p] += 1

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

Submission status: Wrong Answer

Solution code:
import itertools
import math
import numpy as np

N = int(input())

n_max = int(math.sqrt(N))
l = [i for i in range(1, 91)]
score = np.zeros([10000]).astype(np.uint8)
for c in itertools.combinations_with_replacement(l, 3):
  sum = c[0]**2 + c[1]**2 + c[2]**2 + c[0]*c[1] + c[0]*c[2] + c[1]*c[2]
  if sum <= 10000:
    if len(set(c)) == 3:
      score[sum-1] += 6
    elif len(set(c)) == 2:
      score[sum-1] += 3
    else:
      score[sum-1] += 1
    
for n in range(1, N+1):
  ans = 0
  print(score[n-1])

Submission status: Wrong Answer

Solution code:
N = int(input())

for n in range(1, N+1):
    s = n//5
    cnt = 0
    flag = 0
    f2 = 0
    for x in range(1, s+1):
        for y in range(x, s+1):
            for z in range(y, s+1):
                siki = x**2 + y**2 + z**2 + x*y + y*z + z*x

                if siki == n:
                    # print('ans = ', siki)
                    if (x==y)and(y==z):
                        cnt += 1
                    elif (x!=y)and(y!=z):
                        cnt += 6
                    else:
                        cnt += 3
                # elif siki > n:
                    flag = 1
                    break
                elif siki > n:
                    f2 += 1
                    # print('f2= ', f2)
                    # print('x,y,z= ',x,y,z)
                    break

            if flag or f2>=2:
                break
        if flag or f2>=3:
            break
    print(cnt)

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 temp3 % 2 == 0:
                key = tuple(sorted((x, y, z1)))
                if key in pairs:
                    continue
                pairs.add(key)
            if z2 >= 1 and temp4 % 2 == 0:
                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


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