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())

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

ans = [0] * (N+1)
for x in range(1, int(N**0.5+1)):
    for y in range(x, int(N**0.5+1)):
        for z in range(y, int(N**0.5+1)):
            k = f(x,y,z)
            if k < N:
                if x == y == z:
                    ans[k] += 1
                elif x == y or y == z or z == x:
                    ans[k] += 3
                else:
                    ans[k] += 6
for i in range(1, N+1):
    print(ans[i])

Submission status: Wrong Answer

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

for i in range(n):
  cnt = 0
  for x in range(1, 100):
    for y in range(1, 100):
      for z in range(1, 100):
        if (x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2 == i * 2:
          cnt += 1
  ans.append(cnt)
for i in range(n):
  print(ans[i])

Submission status: Wrong Answer

Solution code:
N = int(input())

answers = [0 for i in range(10**4+1)]


for x in range(1,50):
    for y in range(x,50):
        for z in range(y,50):
            n = x**2+y**2+z**2+x*y+y*z+z*x
            if 0 <= n <= 10000:
                #print(x,y,z,n)
                c = len(set([x,y,z]))
                if c == 1:
                    answers[n] += 1
                elif c == 2:
                    answers[n] += 3
                else:
                    answers[n] += 6
                

#print(answers[:30])

for ans in answers[1:]:
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

# あらかじめf(n)を計算しておく
f_arr = [0 for i in range(10**4 + 3)]


for x in range(1, 37):
    for y in range(1, 37):
        for z in range(1, 37):
            n = x*x + y*y + z*z + x*y + y*z + z*x

            if n <= 10**4:
                f_arr[n] += 1

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 0
if N > 10**3:
    upper = int(math.sqrt(N/6)) + 1
else:
    upper = int(math.sqrt(N))
for n in range(1, N+1):
    ans = 0
    for x in range(1, upper):
        for y  in range(1, upper):
            z = 0
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v > n:
                break
            for z in range(1, upper):
                v = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if  v == n:
                    ans += 1
                    #print((x, y, z))
                elif v > n:
                    break
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import bisect
from functools import lru_cache
from collections import defaultdict
inf = float('inf')
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline().rstrip()
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
N=read()
M=33
for n in range(1,N+1):
  count=0
  for i in range(1,M):
    for j in range(1,M):
      for k in range(1,M):
        if i**2+j**2+k**2+i*j+j*k+i*k==n:
          count+=1
  print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = [0] * 10010

# x = y = z
x = 1
while True:
  if 6*x*x > n:
    break
  a[6*x*x] += 1
  x += 1

# x = y, z
for x in range(1, n+1):
  for z in range(1, n+1):
    if x == z:
      continue
    if 3*x*x + z*z + 2*x*z > n:
      break
    a[3*x*x + z*z + 2*x*z] += 3
  if x * x > n:
    break

# x,y,z
for x in range(1, n+1):
  if x*x > n:
    break
  for y in range(x+1, n+1):
    if x*x + y*y + x*y > n:
      break
    for z in range(y+1, n+1):
      if x*x + y*y + z*z + x*y + y*z + z*x > n:
        break
      a[x*x + y*y + z*z + x*y + y*z + z*x] += 6

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

Submission status: Wrong Answer

Solution code:
n = int(input())


# 10000 ということはxが100 or yが100 or zが100で超える
# 正確にはルートn以下まで実施すれば良い

l = [0] * 10001
for i in range(1,n+1):
    tmp = 0
    for x in range(1,n):
        if x*x > 100:
            break
        for y in range(1,n):
            if y*y > 100:
                break
            for z in range(1,n):
                if z*z > 100:
                    break
                if x*x+y*y+z*z+x*y+y*z+z*x == i:
                    tmp += 1
    l[i] = tmp

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

Submission status: Wrong Answer

Solution code:
import itertools
import pprint

n = int(input())

result = [0]*20000
xlist, ylist, zlist = range(1, 45), range(1, 45), range(1, 45)
p = itertools.product(xlist, ylist, zlist)
for each in p:
    x, y, z = each
    result[x*x+y*y+z*z+x*y+y*z+z*x] += 1

print('\n'.join(str(each) for each in result[1:n+1]))

Submission status: Wrong Answer

Solution code:
N = int(input())

def Main(N):
    B = 50
    ans = [0]*(6*B*B+1)
    for i in range(1, B+1):
        for j in range(1, B+1):
            for k in range(1, B+1):
                a = i*i+j*j+k*k+i*j+j*k+k*i
                ans[a] += 1
    return ans

            
        
                    
out = Main(N)
for i in range(1, N+1):
    print(out[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
dp=[0]*(10**4+1)
for i in range(1,100+1):
  for j in range(1,100+1):
    for k in range(1,100+1):
      a=(i+j)**2+(k+j)**2+(i+k)**2
      if 10**4<a:
        break
      dp[a//2]+=1
for l in range(1,N+1):
  print(dp[l])

Submission status: Wrong Answer

Solution code:
N=int(input())
A={}

for i in range(1,41):
    for j in range(1,41):
        for k in range(1,41):
            ans=(i**2+j**2+k**2+i*j+j*k+k*i)
            
            if i==j==k:
                A[ans]=1
            elif i==j or j==k or i==k:
                A[ans]=3
            else:
                A[ans]=6


for a in range(1,N+1):
    if a in A.keys():
        print(A[a])
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
def const(n):
  set_xyz=[]
  ans=0
  for x in range(1,n//2):
    for y in range(1,n//2):
      for z in range(1,n//2):
        if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
          set_xyz.append([x,y,z])
          if x==y==z:
            ans=len(set_xyz)
            break
          else:
            ans=len(set_xyz)*3
            break
  return ans
          
  return len(set_xyz)

N = int(input())
cnt=0
for i in range(1,N+1):
  cnt=const(i)
  print(cnt)

Submission status: Wrong Answer

Solution code:
from itertools import product

N = int(input())

cnt = [0]*1000000

for x in range(1,21):
    for y in range(1,21):
        for z in range(1,21):
            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: Wrong Answer

Solution code:
n = int(input())

ans = [0 for i in range(n)]
for x in range(1,41):
    for y in range(1,41):
        for z in range(1,41):
            n_2 = x ** 2 + y ** 2 + z ** 2 + x*y + x*z + y*z
            if n_2 > int(len(ans)):
                continue
            ans[n_2-1] += 1

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,32):
        for y in range(1,32):
            for z in range(1,32):
                if x**2 + y**2 + z**2 +x*y + y*z + z*x == i:
                    cnt += 1
    print(cnt)

Submission status: Wrong Answer

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

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())

f_ = {}
for x in range(1, 50):
    for y in range(x, 50):
        for z in range(y, 50):
            acc = x * x + y * y + z * z + x * y + y * z + x * z
            if x == y == z:
                f_[acc] = 1
            elif (x != y) & (y != z) & (x != z):
                f_[acc] = 6
            else:
                f_[acc] = 3

for i in range(1, N + 1):
    if i in f_:
        print(f_[i])
    else:
        print(0)

Submission status: Wrong Answer

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

a=[0]*n
b=[]
for i in range(1,45):
    b.append(i)
lst=list(itertools.product(b,repeat=3))

for i in range(len(lst)):
    x,y,z=lst[i][0],lst[i][1],lst[i][2]
    c=(x+y+z)**2-(x*y+y*z+z*x)
    if c<=n:
        a[c-1]+=1
    
for i in range(n):
    print(a[i])

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())
max_list_size = (25 + 25 + 25) ** 3
results = [0] * max_list_size

combinations = list(itertools.product(range(1, 26), repeat=3))
for x, y, z in combinations:
    calc_result = (x + y + z) ** 2 - (x * y + y * z + z * x)
    results[calc_result] += 1
for i in range(1, n + 1):
    print(results[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

def main():
    N = int(input())
    ans = [0]*(N+1)
    n = int(math.sqrt(N))
    for x in range(1, n+1):
        for y in range(1, n+1):
            for z in range(1, n+1):
                s =x**2 + y**2 + z**2 + x*y + y*z + z*x
                if s < N+1:
                    ans[s] += 1
    for i in ans:
        print(i)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def func(a, b, c):
    return a**2 + b**2 + c**2 + a*b + b*c + c*a

n = int(input())
ans = [0]*(n+1)
x, y, z = (1, 1, 1)
flag = 0
while flag == 0:
    for y in range(1, x+1):
        for z in range(1, y+1):
            num = func(x, y, z)
            if num <= n and x == y == z:
                ans[num] += 1
            elif num <= n:
                ans[num] += 3
    if func(x-1, 1, 1) > n:
        flag = 1
    x += 1

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

Submission status: Wrong Answer

Solution code:
import math

def f(x0,y0,z0):
  return x0**2 + y0**2 + z0**2 + x0*y0 + y0*z0 + z0*x0

n=int(input())

for i in range(1,n+1):
  c=0
  lim=int(math.sqrt(i))
  for x in range(1,lim+1):
    for y in range(1,lim+1):
      if x**2+y**2+x*y > lim+1:
        break
      for z in range(1,lim+1):
        if x**2+y**2+z**2+x*y+y*z+z*x > lim+1:
          break
        if f(x,y,z)==i:
          c+=1
  print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = [0] * 10010

# x = y = z
x = 1
while True:
  if 6 * x * x > n:
    break
  a[6 * x * x] += 1
  x += 1

# x = y, z
for x in range(1, n+1):
  for z in range(1, n+1):
    if x == z:
      continue
    if 3*x*x + z*z + 2*x*z > n:
      break
    a[3*x*x + z*z + 2*x*z] += 1
  if x * x > n:
    break

# x,y,z
for x in range(1, n+1):
  if x*x > n:
    break
  for y in range(x+1, n+1):
    if x*x + y*y + x*y > n:
      break
    for z in range(y+1, n+1):
      if x*x + y*y + z*z + x*y + y*z + z*x > n:
        break
      a[x*x + y*y + z*z + x*y + y*z + z*x] += 6

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
dict=defaultdict(lambda:0)
n=int(input())

for x in range(1,100):
    for y in range(1, 100):
        for z in range(1,100):
            p=(x+y+z)**2-(x*y+y*z+z*x)
            dict[p]+=1

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

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
for n in range(1,N+1):
    a=(n)/6
    saidai=int(a**0.5)
    answer=0
    for z in range(1,saidai):
        if 3+z**2+2*z>n:
            break
        for y in range(1,z+1):
            if y**2+z**2+1+y+z+y*z>n:
                break
            for x in range(1,y+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==n:
                    if x==y==z:
                        answer+=1
                        break
                    elif x==y or y==z or z==x:
                        answer+=3
                        break
                    else:
                        answer+=6
                        break
    print(answer)

Submission status: Wrong Answer

Solution code:
import collections
import sys
A = []
n = int(input())
for i in range(1,35):
    for j in range(1,35):
        for k in range(1,35):
            A.append(i**2+j**2+k**2+i*j+j*k+k*i)
c = collections.Counter(A)


for x in range(1,n+1):
    print(c[x])
sys.exit()

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

count = 0
for n in range(1, N):
    sqrt_n = int(math.sqrt(n))
    for i in range(1, sqrt_n):
        for p in range(1, sqrt_n):
            for q in range(1, sqrt_n):
                if i ** 2 + p ** 2 + q ** 2 + i * p + p * q + i * q > n:
                    break
                elif i ** 2 + p ** 2 + q ** 2 + i * p + p * q + i * q == n:
                    count += 1
    print(count)
    count = 0

Submission status: Wrong Answer

Solution code:
N = int(input())
Pls = [0]*(10**4+1)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            k = x**2+y**2+z**2+x*y+y*z+z*x
            if k <= 10**4:
                Pls[k] = Pls[k] + 1
for i in range(N+1):
    print(Pls[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}
for x in range(1,int(n**0.5)+1):
    for y in range(1,int(n**0.5)+1):
        for z in range(1,int(n**0.5)+1):
            ans = x**2 + y **2 + z**2 +x*y+y*z+z*x
            if ans in dic:
                dic[ans] +=1
            else:
                dic[ans] = 1

print(dic)

for i in range(n):
    if i+1 in dic:
        print(dic[i+1])
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())

cnts = [0] * (n + 1)
for s in range(int(math.sqrt(n)) + 10):
  for x in range(1, s + 1):
    for y in range(1, s - x + 1):
      z = s - x - y
      if 1 <= z:
        f = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
        if 1 <= f <= n:
          cnts[f] += 1

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

Submission status: Wrong Answer

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

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())

f_ = {}
for x in range(1, 50):
    for y in range(x, 50):
        for z in range(y, 50):
            acc = x * x + y * y + z * z + x * y + y * z + x * z
            if x == y == z:
                f_[acc] = 1
            elif (x != y) & (y != z):
                f_[acc] = 6
            else:
                f_[acc] = 3

for i in range(1, N + 1):
    if i in f_:
        print(f_[i])
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = {i: 0 for i in range(1, n + 1)}
for x in range(1, 80):
    for y in range(1, 80):
        for z in range(1, 80):
            result = (x + y + z) ** 2 - x * y - y * z - z * x
            if result in ans:
                ans[result] += 1

for i in ans.values():
    print(i)

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
d=int(math.sqrt(2*N)+1)
bucket=[0 for i in range(N)]
for i in range(0,d+1):
  for j in range(i,d+1):
    for k in range(j,d+1):
      if(i**2+j**2+k**2<=2*N and (i**2+j**2+k**2)%2==0 and i+j-k>=2 and j+k-i>=2 and k+i-j>=2):
        x=i+j-k
        y=j+k-i
        z=k+i-j
        if((x==z and z<y) or (x<z and z==y)):
          bucket[(i**2+j**2+k**2)//2-1]+=3
        elif(y==x and x==z):
          bucket[(i**2+j**2+k**2)//2-1]+=1
        else:
          print(x,y,z)
          bucket[(i**2+j**2+k**2)//2-1]+=6
for i in range(N):
  print(bucket[i])

Submission status: Wrong Answer

Solution code:
n = int( input() )

n_list = [ 0 for _ in range( 10 ** 4 + 1 ) ]

def g( x, y, z ):
    return min( x * x + y * y + z * z + x * y + y * z + z * x, 10 ** 4 )

for x in range( 1, 101 ):
    for y in range( 1, 101 ):
        for z in range( 1, 101 ):
            n_list[ g( x, y, z ) - 1 ] += 1

for k in range( n ):
    print( n_list[ k ] )

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
for i in range(1, n+1):
    ans = 0
    for x in range(1, 34):
        for y in range(1, 34):
            for z in range(1, 34):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n = int(input())
    if n == 1:
        print(0)
        sys.exit()
    r = [0]*100000
    for i1 in range(1,20):
        for i2 in range(1,20):
            for i3 in range(1,20):
                t = i1**2 + i2**2 + i3**2 + i1*i2 + i2*i3 + i1*i3
                r[t] += 1
    print(*r[1:n+1],sep='\n')
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from math import sqrt
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    for n in range(1, N + 1):
        ans = 0
        upper = round(sqrt(n / 6)) + 2
        #print("n={}, upper={}".format(n, upper))
        for x in range(1, upper):
            for y in range(1, upper):
                for z in range(1, upper):
                    if (x + y + z)**2 - (x*y + y*z + z*x) == n:
                        ans += 1
        print(ans)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

for i in range(1,N+1):
    ans1 = 0
    ans2 = 0
    ans3 = 0
    
    for x in range(1,101):
        if x**2>i:
            break
        for y in range(1,x):
            if x**2+y**2+2*x*y>i:
                break
            for z in range(1,y):
                if x**2+y**2+z**2+x*y+y*z+z*x==i:
                    ans1 += 1
                if x**2+y**2+z**2+x*y+y*z+z*x>i:
                    break

    for x in range(1,101):
        if x**2>i:
            break
        for y in range(1,x):
            if x**2+y**2>i:
                break
            if x**2+3*y**2+2*x*y==i:
                ans2 += 1
    
    for x in range(1,101):
        if x**2>i:
            break
        for y in range(1,x):
            if x**2+y**2>i:
                break
            if 3*x**2+y**2+2*x*y==i:
                ans2 += 1
                
    for x in range(1,101):
        if 6*x**2==i:
            ans3+=1
    
    print(ans1*6+ans2*3+ans3)

Submission status: Wrong Answer

Solution code:
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
count = 0
ans = 0

N = i()

L = [0]*N

for x in range(1,100):
    for y in range(x,100):
        for z in range(y,100):
            n = x**2 + y**2 + z**2 +x*y + y*z + z*x
            if n > N:
                break
            if x == y and y == z:
                L[n-1] = 1
            elif x ==y or y == z or x == z:
                L[n-1] = 3
            else:
                L[n-1] = 6
for i in L:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = [0] * 10010

# x = y = z
x = 1
while True:
  if 6 * x * x > n:
    break
  a[6 * x * x] += 1
  x += 1

# x = y, z
for x in range(1, n+1):
  for z in range(1, n+1):
    if x == z:
      continue
    if 3 * x*x + z*z + 2*x*z > n:
      break
    a[3 * x * x + z * z + 2 * x * z] += 2
  if x * x > n:
    break

# x,y,z
for x in range(1, n+1):
  if x*x > n:
    break
  for y in range(x+1, n+1):
    if x*x + y*y + x*y > n:
      break
    for z in range(y+1, n+1):
      if x*x + y*y + z*z + x*y + y*z + z*x > n:
        break
      a[x*x + y*y + z*z + x*y + y*z + z*x] += 6

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

Submission status: Wrong Answer

Solution code:
N = int(input())

results = [0] * N

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

for x in range(1,32):
  for y in range(1, 32):
    for z in range(1, 32):
      w = g(x,y,z)
      if w > N: break
      results[w - 1] += 1

for result in results:
  print(result)

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
d=int(math.sqrt(N)+1)
bucket=[0 for i in range(N)]
for i in range(0,d+1):
  for j in range(i,d+1):
    for k in range(j,d+1):
      if(i**2+j**2+k**2<=2*N and (i**2+j**2+k**2)%2==0 and i+j-k>=2 and j+k-i>=2 and k+i-j>=2):
        x=i+j-k
        y=j+k-i
        z=k+i-j
        if((x==z and z<y) or (x<z and z==y)):
          bucket[(i**2+j**2+k**2)//2-1]+=3
        elif(y==x and x==z):
          bucket[(i**2+j**2+k**2)//2-1]+=1
        else:
          print(x,y,z)
          bucket[(i**2+j**2+k**2)//2-1]+=6
for i in range(N):
  print(bucket[i])

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())

cnt = [0] * (10 ** 4 + 1)

for x, y, z in itertools.product(range(1, 10 ** 2), repeat=3):
    idx = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
    if idx <= 10 ** 4:
        cnt[idx] += 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [0] * 20000

for x in range(1, 20):
  for y in range(1, 20):
    for z in range(1, 20):
      i = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
      a[i] += 1

print('\n'.join(map(str, a[1:n + 1])))

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(5):
    print(0)
count = [0] * (10**6)
s = 0

for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            s = i * i + j * j + k * k + i * j + j * k + k * i 
            count[s - 1] += 1
for i in range(n):
    print(count[i])

Submission status: Wrong Answer

Solution code:
N = int(input().strip())
s=[]
for a in range (1,101):
    for b in range(1,101):
        for c in range(1,101):
            s.append(a*a+b*b+c*c+a*b+b*c+c*a)

for l in range(N):
    print(s.count(l))

Submission status: Wrong Answer

Solution code:
nn = int(input())

for n in range(nn):
    ans=0
    mx= int((n/6)**0.5)
    for x in range(1,mx+1):
        my= int((n/3 - x*x)**0.5)
        for y in range(x,my+1):
            mz=int((n- x*x- 2*y*y- 2*x*y)**0.5)
            for z in range(y,mz+1):
                if x**2+ y**2 + z**2 +x*y + y*z + z*x ==n:
                    if x==y and y==z:
                        ans+=1
                    elif x==y or y==z or z==x:
                        ans+=3
                    else:
                        ans+=6
                    break
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

def Main(N):
    B = 41
    ans = [0]*(6*B*B+1)
    for i in range(1, B+1):
        for j in range(1, B+1):
            for k in range(1, B+1):
                a = i*i+j*j+k*k+i*j+j*k+k*i
                ans[a] += 1
    return ans

            
        
                    
out = Main(N)
for i in range(1, N+1):
    print(out[i])

Submission status: Wrong Answer

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

highest = int(math.sqrt(n))
l = [0]*n
cal = 0

for x in range(1, highest+1):
  for y in range(1, highest+1):
    for z in range(1, highest+1):
      cal = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if cal > n-1:
        continue
      else:
        l[cal-1] += 1
        
for i in range(len(l)):
  print(l[i])

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))


def solve(n):
    result = [0] * n
    seen = set()
    for i in range(1, n+1):
        i2 = pow(i, 2)
        prev_j = 1
        for j in range(1, n+1):
            j2 = pow(j, 2)
            prev_k = 1
            for k in range(1, n+1):
                triplet = [i, j, k]
                triplet.sort()
                triplet = (triplet[0], triplet[1], triplet[2])
                if triplet in seen:
                    continue
                seen.add(triplet)
                k2 = pow(k, 2)
                curr = i2 + j2 + k2 + i*j + i*k + j*k
                if curr > n:
                    prev_k = k
                    break
                count = 1 if i == j and i == k else 3
                result[curr-1] += count
            if prev_k == 1:
                prev_j = j
                break
        if prev_j == 1:
            break
    return result


if __name__ == "__main__":
    n = int_in()
    result = solve(n)
    for item in result:
        out(item)

Submission status: Wrong Answer

Solution code:
import math



N=int(input())

for i in range(1,N+1):
    ans=0
    if i<=5:
        print(0)
    else:
        ma=int(math.sqrt(i)/6)
        for x in range(1,ma):
            for y in range(x,ma):
                for z in range(y,ma):
                    if x**2+y**2+z**2+x*y+y*z+z*x==i:
                        if x==y and y==z:
                            ans+=1
                        elif x==y or y==z or z==x:
                            ans+=3
                        else:
                            ans+=6
            
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = [0] * 10010

# x = y = z
x = 1
while True:
  if 6 * x * x > n:
    break
  a[6 * x * x] += 1
  x += 1

# x = y, z
for x in range(1, n+1):
  for z in range(1, n+1):
    if x == z:
      continue
    if 3 * x*x + z*z + 2*x*z > n:
      break
    a[3 * x * x + z * z + 2 * x * z] += 1
  if x * x > n:
    break

# x,y,z
for x in range(1, n+1):
  if x*x > n:
    break
  for y in range(x+1, n+1):
    if x*x + y*y + x*y > n:
      break
    for z in range(y+1, n+1):
      if x*x + y*y + z*z + x*y + y*z + z*x > n:
        break
      a[x*x + y*y + z*z + x*y + y*z + z*x] += 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def func(a, b, c):
    return a**2 + b**2 + c**2 + a*b + b*c + c*a

n = int(input())
ans = [0]*(n+1)
x, y, z = (1, 1, 1)
flag = 0
while flag == 0:
    for y in range(1, x+1):
        for z in range(1, y+1):
            num = func(x, y, z)
            if num <= n and x == y == z:
                ans[num] += 1
            elif num <= n:
                ans[num] += 3
    if func(x, 1, 1) > n:
        flag = 1
    x += 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
li = [0]*n
for i in range(1,32):
    for j in range(1,32):
        for k in range(1,32): 
            if i**2 + j**2 + k**2 + i*j + j*k + k*i <= n:
                li[i**2 + j**2 + k**2 + i*j + j*k + k*i -1] += 1
for i in range(n):
    print(li[i])

Submission status: Wrong Answer

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N = getN()

num = [0] * (10 ** 4 + 10)

for x in range(1, 103):
    for y in range(1, 103):
        for z in range(1, 103):
            opt = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)
            if opt < 10 ** 2 + 9:
                num[opt] += 1

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