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: Accepted

Solution code:
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))

# ===CODE===

eps = 10 ** (-9)


def main():
    n = ni()

    ans = [0 for _ in range(n)]

    lim = int(n ** (1 / 2) + 1)
    for x in range(1, lim):
        for y in range(1, lim):
            for z in range(1, lim):
                tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if 0 < tmp <= n:
                    ans[tmp - 1] += 1

    for ai in ans:
        print(ai)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import itertools

N = int(input())
n = int(N ** (1/2))
C = itertools.combinations_with_replacement(range(1, n + 1), 3)
ans = [0 for i in range(N)] 

x, y, z = 1, 1, 1

def check(c):
  x, y, z = c
  global N
  t = x * x + y * y + z * z + x * y + y * z + z * x
  if t > N:
    return
  if x == y and y == z:
    ans[t - 1] += 1
  elif x == y and y != z or y == z and z != x or z == x and x != y:
    ans[t - 1] += 3
  else:
    ans[t - 1] += 6

for c in list(C):
  check(c)
for a in ans:
  print(a)

Submission status: Accepted

Solution code:
from numba import njit

@njit("i8(i8)")
def loop(i):
    ans = 0
    N = int((i*2)**(1/2))+1
    for j in range(1,N+1):
        for k in range(1,j+1):
            for l in range(1, k+1):
                if (j+k)**2 + (k+l)**2 + (l+j)**2 == 2*i:
                    if j==k==l:
                        ans += 1
                    elif j > k > l:
                        ans += 6
                    else:
                        ans += 3
                if (j+k)**2 + (k+l)**2 + (l+j)**2 >= 2*i:
                    break
            if (j+k)**2 > 2*i:
                break
    return(ans)

n = int(input())
for i in range(1,n+1):
    print(loop(i))

Submission status: Accepted

Solution code:
import math
N = int(input())
for n in range(1, N+1):
    nn = int(n**0.5+1)
    ans = 0
    for x in range(1, nn):
        for y in range(1, nn):
            d = n-x*x-y*y-x*y
            if d < 0:
                break
            l, r = 0, nn
            while (r-l) > 1:
                m = (r+l)//2
                z = m*m+m*(x+y)
                if z == d:
                    ans += 1
                    break
                elif z < d:
                    l = m
                else:
                    r = m
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())


ans = [0] * (10 ** 4 + 1)
for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            a = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + i * k
            if a <= 10 ** 4:
                ans[a] += 1

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

Submission status: Accepted

Solution code:
import sys
from itertools import product, combinations_with_replacement
import math
from collections import defaultdict
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
N = int(input())
d = defaultdict(int)

combs = list(combinations_with_replacement(range(1, int(math.sqrt(10001))), 3))
for c in combs:
    x, y, z = c
    calc = x**2 + y**2 + z**2 +x*y +z*y + x*z
    #print(calc, x, y, z)
    if  x == y and y == z:
        d[calc] += 1
    elif x== y or x == z or y == z:
        d[calc] += 3
    else:
        d[calc] += 6


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

Submission status: Accepted

Solution code:
import itertools

N=int(input())
L=[0]*(10**4+10)
X=[x for x in range(1,101)]
plus=[0,1,3,6]

for v in itertools.combinations_with_replacement(X,3):
  x,y,z=v[0],v[1],v[2]
  temp=len(set(v))
  try:
    L[x**2+y**2+z**2+x*y+y*z+z*x]+=plus[temp]
  except:
    continue

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

Submission status: Accepted

Solution code:
N = int(input())

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


for x in range(1,42):
    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 0 <= n <= 10000:
                #if n == 9803:
                #    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[-100:])


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

Submission status: Accepted

Solution code:
# 解答
def abc173_a(lines):
    N = int(lines[0])
    results = list()
    for i in range(10000):
        results.append(0)
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if tmp <= 10000:
                    results[tmp-1] += 1
    answers = list()
    for i in range(N):
        answers.append(results[i])
    return answers


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['20']
        lines_export = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 3, 0, 0]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = abc173_a(lines_input)

    for line_result in lines_result:
        print(line_result)

    if mode > 0:
        print(f'lines_input=[{lines_input}]')
        print(f'lines_export=[{lines_export}]')
        print(f'lines_result=[{lines_result}]')
        if lines_result == lines_export:
            print('OK')
        else:
            print('NG')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

n = int(input())
d = [0]*n
res = 0
for i in range(1, int(n**0.5)+1):
    for j in range(1, int(n**0.5)+1):
        for k in range(1, int(n**0.5)+1):
            res = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if res <= n:
                d[res-1] += 1

#print(d)
for i in range(n):
    print(d[i])

Submission status: Accepted

Solution code:
N = int(input())
ls = {i+1: 0 for i in range(N+1)}
flag = 0
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            tmp = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)
            if tmp > N:
                flag = 1
                break
            else:
                ls[tmp] += 1
        #if flag: break
    #if flag: break
            

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

Submission status: Accepted

Solution code:
from itertools import combinations_with_replacement
from collections import Counter

N = int(input())

c = Counter()

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

for x, y, z in combinations_with_replacement(range(1, 100), 3):
    v = s(x, y, z)
    if x == y == z:
        c[v] += 1
    elif x == y or y == z or z == x:
        c[v] += 3
    else:
        c[v] += 6
for i in range(1, N+1):
    print(c[i])

Submission status: Accepted

Solution code:
#C
N=int(input())
Ans=[0 for i in range(N+1)]
for x in range(1,10**2):
    for y in range(1,10**2):
        for z in range(1,10**2):
            k=(x+y)**2+(y+z)**2+(z+x)**2
            if k<=2*N and k%2==0:
                Ans[int(k/2)]+=1
for i in range(1,N+1):
    print(Ans[i])

Submission status: Accepted

Solution code:
import itertools

n = int(input())
max_list_size = (110 + 110 + 110) ** 2
results = [0] * max_list_size

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

Submission status: Accepted

Solution code:

import math, itertools

n = int(input())

result_dict = {}

for x in range(1, int(math.sqrt(10000) + 1)):
    for y in range(1, int(math.sqrt(10000) + 1)):
        for z in range(1, int(math.sqrt(10000) + 1)):
            result_dict[(x, y, z)] = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x

result = list(result_dict.values())

import collections

num_dict = dict(collections.Counter(result))

for i in range(1, n + 1):
    print(num_dict.get(i, default=0))

Submission status: Accepted

Solution code:
sq_dict = {}
for i in range(40001):
    sq_dict[i * i] = i

def func(n):
    cnt = 0
    for y in range(1, 13500):
        for z in range(1, 13500):
            D = (y + z) ** 2 - 4 * (y * y + z * z + y * z  - n)
            if D < 0:
                break
            if D in sq_dict:
                x = -(y + z) + sq_dict[D]
                if x % 2 == 0 and x > 0:
                    cnt += 1
                x = -(y + z) - sq_dict[D]
                if x % 2 == 0 and x > 0:
                    cnt += 1
    return cnt

def main():
    N = int(input())
    for n in range(1, N + 1):
        print(func(n))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
y = [0 for i in range(10000)]
for i in range(1,100):
    for k in range(1,100):
        for x in range(1,100):
            ans = i**2 + k**2 + x**2 + i*k + k*x + i*x
            if n<ans:
                continue
            y[ans-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

lst = [0] * 10 ** 5
combs = list(itertools.combinations_with_replacement([_ for _ in range(1, 100)], 3))

st = {1:1, 2:3, 3:6}
for _ in combs:
    x, y, z = _[0], _[1], _[2]
    num = x ** 2 + y ** 2 + z ** 2 + (x * y) + (y * z) + (z * x)
    lst[num-1] += st[len(set(_))]

for _ in range(n):
  print(lst[_])

Submission status: Accepted

Solution code:
N = int(input())
L = [0]*N    
for X in range(1,100):
    for Y in range(1,100):
        for Z in range(1,100):
            Num = X*X+Y*Y+Z*Z+X*Y+X*Z+Y*Z
            if Num>N: break
            else: L[Num-1] += 1
print('\n'.join(str(X) for X in L))

Submission status: Accepted

Solution code:
n = int(input())
arr = [0 for x in range(n)]
sq = int(n ** 0.5)
for i in range(1, sq+1):
    for j in range(1, sq+1):
        for k in range(1, sq+1):
            ans = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if ans <= n:
                arr[ans-1] += 1
for i in arr:
    print(i)

Submission status: Accepted

Solution code:
import math

def resolve():
  N = int(input())

  result = [0] * (N + 1)
  max_range = int(math.sqrt(N)) + 1
  for x in range(1, max_range):
    for y in range(1, max_range):
      for z in range(1, max_range):
        index = x**2 + y**2 + z**2 + x*y + y*z + z*x
        if index <= N:
          # if index == 8:
          #   print("x: {0}, y: {1},z: {2},".format(x, y, z))
          result[index] += 1

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

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
L=[]
i=0
while i <100001:
    L.append(0)
    i+=1
for x0 in range(1,100):
    for y0 in range(1,100):
        for z0 in range(1,100):
            p=x0**2+y0**2+z0**2+x0*y0+y0*z0+z0*x0
            if p<10001:
                L[p]+=1
N=int(input())
for i in range(1,N+1):
    print(L[i])

Submission status: Accepted

Solution code:
import math
import collections

n=int(input()) 
c = []
m = int(math.sqrt(n))

for x in range(1,m+1):
    for y in range(1,m+1):
        for z in range(1,m+1):
            tmp = x*x + y*y + z*z + x*y + y*z + z*x
            c.append(tmp)

cc = collections.Counter(c)
#print(cc)

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

Submission status: Accepted

Solution code:
import sys 
import numpy as np

readline = sys.stdin.readline 

N = int(input())

index = [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:
                index[n - 1] += 1


for i in index:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
ans = [0 for i in range(n+1)]
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            #print(x, y, z, tmp)
            if 1 <= tmp and tmp <= n:
                ans[tmp] += 1
for i in range(1, n+1):
    print(ans[i])

Submission status: Accepted

Solution code:
N = int(input())

A = {i:0 for i in range(N)}

x = 0
while (x+1)**2+8 <= 2*N:
    x += 1
    y = 0
    while (x+1)**2 + (y+1)**2 + (x+y)**2 <= 2*N:
        y += 1
        z = 0
        while (x+y)**2 + (y+z)**2 + (z+x)**2 <= 2*N:
            z += 1
            if (x+y)**2 + (y+z)**2 + (z+x)**2 <= 2*N:
                A[x**2 + y**2 + z**2 + x*y + y*z + z*x-1] += 1

for i in range(N):
    print(A[i])

Submission status: Accepted

Solution code:
import math
n=int(input())
ansl=[0]*(n+1)  
c=0
x=0
y=0
z=0
rn=int(float(math.sqrt(n)))
for x in range(1,rn+1):
    for y in range(1,rn+1):
        for z in range(1,rn+1):
            if x**2+y**2+z**2+x*y+y*z+z*x<=n:
                ansl[x**2+y**2+z**2+x*y+y*z+z*x]+=1
for i in range(n):                
    print(ansl[i+1])

Submission status: Accepted

Solution code:
from collections import Counter
N=int(input())
A=[]

for i in range(1,150):
    for j in range(1,150):
        for k in range(1,150):
            ans=(i**2+j**2+k**2+i*j+j*k+k*i)
            if ans<=N:
                A.append(ans)
B=Counter(A)


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

Submission status: Accepted

Solution code:
N = int(input())

ans = [0 for i in range(N)]  # f(i) = ans[i-1] とする

for x in range(1, int(N**0.5)+1):
    if N-x**2 >= 0:
        for y in range(1, int((N-x**2)**0.5)+1):
            if N-x**2-y**2-x*y >= 0:
                for z in range(1, int((N-x**2-y**2-x*y)**0.5)+1):
                    tar = x**2 + y**2 + z**2 + x*y + y*z + z*x
                    if 1 <= tar <= N:
                        ans[tar-1] += 1

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

Submission status: Accepted

Solution code:
n=int(input())
dic={i:0 for i in range(1,n+1)}
for x in range(1,100):
  for y in range(1,x+1):
    for z in range(1,y+1):
      k=x**2+y**2+z**2+x*y+y*z+z*x
      if k<=n:
        if x==y==z: dic[k]+=1
        elif x==y or y==z: dic[k]+=3
        else: dic[k]+=6
for l in range(n):
  print(dic[l+1])

Submission status: Accepted

Solution code:
import math
def main():

    N  = int(input())

    xyz = []
    for x in range(1, int(math.sqrt(N))+1):
        for y in range(1, int(math.sqrt(N))+1):
            for z in range(1, int(math.sqrt(N))+1):
                xyz.append([x, y, z])

    d = dict()
    for x, y, z in xyz:
        v = x*x + y*y + z*z + x*y + y*z + z*x
        d[v] = d.get(v, 0) + 1

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())
count =[0 for _ in range(10**4)]
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            ans =0
            ans = x **2 +y**2+z**2 +x*y+y*z +x*z
            if ans <= n:
                count[ans-1] += 1
for o in count[:n]:
    print(o)

Submission status: Accepted

Solution code:
N = int(input())
#N = 20

ret = [0 for i in range(N)]
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            a = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if a <= N:
                ret[a-1] += 1

for i in ret:
    print(i)

Submission status: Accepted

Solution code:
N = int(input())
anslist = [0] * (N + 1)
for x in range(1,100 + 1):
  for y in range(1,100 + 1):
    for z in range(1,100 + 1):
      temp = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if temp <= N:
        anslist[temp] += 1

anslist.pop(0)

for i in anslist:
  print(i)

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
ans = [0]*n
for i in range(1,int(n**(1/2))+1):
    for j in range(1,int(n**(1/2))+1):
        for k in range(1,int(n**(1/2))+1):
            if (i**2 + j**2 + k**2 + i*j + j*k + k*i)%1 == 0 and i**2 + j**2 + k**2 + i*j + j*k + k*i <= n:
                ans[i**2 + j**2 + k**2 + i*j + j*k + k*i - 1] += 1
for i in range(n):
    print(ans[i])

Submission status: Accepted

Solution code:
from collections import defaultdict
def solve(x, y, z):
    return x*x + y*y + z*z + x*y + y*z + z*x
d = defaultdict(int)
ans = 0
n = int(input())
for i in range(1, n + 1):
    if solve(i, i, i) > n:
        break
    for j in range(i, n + 1):
        if solve(i, j, j) > n:
            break
        for k in range(j, n + 1):
            if solve(i, j, k) > n:
                break
            
            l = len({i,j,k})
            if l==3:
                res = 6
            elif l==2:
                res = 3
            else:
                res = 1
            d[solve(i, j, k)]+=res
ans = [d[i] for i in range(1,n+1)]
print(*ans, sep='\n')

Submission status: Accepted

Solution code:
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    N =  int(input())

    def fn(n):
        ans = 0
        a, b = divmod(n, 6)
        if b == 0:
            if int(a**.5)**2 == a:
                ans += 1

        n2 = n//2
        for i in range(n2):
            x = 3 * i**2

    ans = dp = [0] * (N+1)
    r1 = range(1, N)

    for i in r1:
        x = 6 * i**2
        if x > N: break
        dp[x] += 1

    for i in r1:
        x = 3* i**2

        if x > N: break

        for j in r1:
            if i == j: continue
            y = x + j * (j+2*i)
            if y > N: break
            dp[y] += 3

    for i in r1:
        x = i**2

        if x > N: break

        for j in range(i+1, N):
            y = x + j**2 + i * j

            if y > N: break

            for k in range(j+1, N):
                z = y + k*(k + i + j)

                if z > N: break

                dp[z] += 6

    print(*dp[1:], sep="\n")

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
n = int(input())

ans = [0 for _ in range(n)]



for y in range(1, int(n**.5)+2):
    for z in range(1, int(n**.5)+2):
      for x in range(1, int(n**.5)+2):
        param = (x**2 + y**2 + z**2 + x*y + y*z + z*x)
        if 1 <= param <= n:
          ans[param-1] += 1

for i in ans:
  print(i)

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    D = defaultdict(int)
    for i in range(1, 200):
        for j in range(1, 200):
            for k in range(1, 200):
                D[i**2+j**2+k**2+i*j+j*k+k*i] += 1
    for i in range(1, N+1):
        print(D[i])


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for x in range(1,int(N**0.5)):
  for y in range(1,int(N**0.5)):
    for z in range(1,int(N**0.5)):
      n = (x+y+z)**2-(x*y+y*z+z*x)
      if n<=N:
        ans[n-1]+=1

print(*ans,sep="\n")

Submission status: Accepted

Solution code:
N = int(input())
f = [0] * (10**4 + 1)
for x in range(1, 10**2):
    for y in range(1, x+1):
        for z  in range(1, y+1):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            s = set()
            s.add(x)
            s.add(y)
            s.add(z)
            if tmp <= 10**4:
                if len(s) == 3:
                    f[tmp] += 6
                elif len(s) == 2:
                    f[tmp] += 3
                else:
                    f[tmp] += 1
for i in range(1, N+1):
    print(f[i])

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
ans_list = [0]*(10**6)
for i in range(1, 100):
  for j in range(1, 100):
    for k in range(1, 100):
      ans = i**2 + j**2 + k**2 + i*j + j*k + k*i
      ans_list[ans-1] += 1
for i in ans_list[:n]:
  print(i)

Submission status: Accepted

Solution code:
N=int(input())
ans=[0]*N
x=1
while 6*(x**2)<=N:
    y=x
    while (x**2)+3*(y**2)+(2*x*y)<=N:
        z=y
        while x**2+y**2+z**2+x*y+y*z+z*x<=N:
            a=x**2+y**2+z**2+x*y+y*z+z*x
            if x<y<z:
                ans[a-1]+=6
            elif x==y==z:
                ans[a-1]+=1
            else:
                ans[a-1]+=3
            z+=1
        y+=1
    x+=1
for i in range(N):
    print(ans[i])

Submission status: Accepted

Solution code:
n = int(input())

rng = [0] * (n+1)

for i in range(1,99):
    for j in range(1,99):
        for k in range(1,99):
            buf = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if buf > n:
                break
            else:
                rng[buf] += 1

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

Submission status: Accepted

Solution code:
import math
import itertools
n = int(input())
max = math.floor(n**(1/2))
L = [0 for i in range(n)]
l = []
for i in range(1, max+1):
    l.append(i)


for v in itertools.combinations_with_replacement(l, 3):
    x = v[0]
    y = v[1]
    z = v[2]
    t = x**2 + y**2 + z**2 + x*y + y*z + z*x
    if t <= n:
        if x == y and y == z:
            L[t-1] += 1
        elif x == y or y == z:
            L[t-1] += 3
        else:
            L[t-1] += 6
for j in L:
    print(j)

Submission status: Accepted

Solution code:
n=int(input())
l=[0]*10**7
s=int(n**0.65)+1
for x in range(1,s):
    for y in range(1,s-x):
        for z in range(1,s-x-y):
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 0
num = {i:0 for i in range(1, N+1)}
upper = int(math.sqrt(N)) + 1
for x in range(1, upper):
    for y  in range(1, upper):
        z = 1
        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 in num.keys():
                num[v] += 1
            if v > N:
                break
for n in range(1, N+1):
    print(num[n])

Submission status: Accepted

Solution code:
N = int(input())
ans = [0]*N
for i in range(1,100):
    for j in range(i,100):
        for k in range(j,100):
            x = i**2+j**2+k**2+i*j+j*k+k*i
            if x <= N:
                if i == j:
                    if j == k:
                        ans[x-1] += 1
                    else:
                        ans[x-1] += 3
                else:
                    if j == k:
                        ans[x-1] += 3
                    else:
                        ans[x-1] += 6
            else:
                break
            
                

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
from collections import deque
from copy import copy

N = int(input())
result = [0]*N

if N < 6:
    for i in range(N):
        print(0)
    exit()

result[5] += 1

coord = deque()
coord.append([[1, 1, 1], 6, 0])

while len(coord):
    sol, ans, level = coord.popleft()
    for i in range(level, 3):
        new_sol = copy(sol)
        new_sol[i] += 1
        new_ans = ans + sum(sol) + sol[i] + 1
        if new_ans <= N:
            coord.append([new_sol, new_ans, i])
            result[new_ans-1] += 1

print(*result, sep='\n', end='')

Submission status: Accepted

Solution code:
N = int(input())

ans = [0] * (N+1)

for x in range(1, 10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            try:
                ans[(x+y+z)**2 - (x*y+y*z+z*x)] += 1
            except:
                pass

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
N = int(input())
import math
eps = 10**(-6)
for n in range(1,N+1):
    ans = 0
    nn = int(math.sqrt(n))+1
    for x in range(1,nn):
        for y in range(1,nn):
            D = 4*n-3*x*x-3*y*y-2*x*y
            if D<=0:continue
            z = (-x-y+math.sqrt(D))
            if z<0:continue
            zr = round(z)
            if abs(z-zr)>eps or zr%2==1 or zr<1:
                continue
            z = zr//2
            if x*x+y*y+z*z+x*y+y*z+z*x==n:
                ans += 1
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=[0]*10**7
s=int(n**0.7)+10
for x in range(1,s):
    for y in range(1,s-x):
        for z in range(1,s-x-y):
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])

Submission status: Accepted

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

count = 0
# 複数パターンを考慮しているか？
for an in ans:
    if an == []:
        print(0)
    else:
        count = 0
        for a in an:
            if a[0] == a[1] and a[1] == a[2]:
                count += 1
            elif not a[0] == a[1] and not a[1] == a[2] and not a[2] == a[0]:
                count += 6
            else:
                count += 3
        print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
rN = int(np.sqrt(N))

A = np.zeros(N)



for i in range(rN):
   for j in range(rN):
       for k in range(rN):
           x = i + 1
           y = j + 1
           z = k + 1
           n = x**2 + y**2 + z**2 + x*y + y*z + z*x
           if N < n :
               break
           else:
               A[n-1] += 1



for a in A:
    print(int(a))

Submission status: Accepted

Solution code:
from math import sqrt
from itertools import combinations_with_replacement
n = int(input())
m = int(sqrt(n)) + 1
cnt = 0
list_N = [0]*n
list_A = []
for i in range(1, m+1):
    list_A.append(i)

list_P = list(combinations_with_replacement(list_A, 3))

for x, y, z in list_P:
    l = [x, y, z]
    cnt = len(set(l))
    d = pow(x, 2) + pow(y, 2) + pow(z, 2) + x*y + y*z + z*x
    if d <= n:
        if cnt == 1:
            list_N[d-1] += 1
        elif cnt == 2:
            list_N[d-1] += 3
        elif cnt == 3:
            list_N[d-1] += 6


for ans in list_N:
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
cnt = [0] * (10 ** 4 + 1)
for x in range(1, 3333):
    for y in range(1, 3333):
        for z in range(1, 3333):
            check = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if check > 10000:
                break
            else:
                cnt[check - 1] += 1
for i in range(N):
    print(cnt[i])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N=int(input())
s= [0 for i in range(10002)]
for x in range(1,100):
    for y in range(1,100):
        if x*x + y*y>10000:break
        for z in range(1,100):
            a = x*x + y*y + z*z +x*y + y*z + z*x
            if a >10000:break
            s[a] +=1

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

Submission status: Accepted

Solution code:
# x = 1
# y = 1
# z = 1

# n = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)
# print(n)

val_list = [0] * 100000
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            val = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)
            # print(n)
            # n_list.append(n)
            val_list[val] += 1
            
n = int(input())
for i in range(1, n + 1):
    print(val_list[i])

Submission status: Accepted

Solution code:
import math
import sys

n = int(input())
l = [0] * n
if n < 6:
    for i in range(n):
        print(0)
    sys.exit()
y = int(math.sqrt(n-3))
if n <= 5:
    for i in range(n):
        print(0)
for i in range(1,y):
    for j in range(1, y):
        for k in range(1, y):
            x = i ** 2 + j ** 2 + k ** 2 + i*j + i*k + j*k
            if x % 1 == 0 and x <= n:
                l[x-1] += 1
for i in l:
    print(i)

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
f = [0]*(1+n)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            val = x**2 + y**2 + z**2 + x*y + x*z + y*z
            if 1 <= val <= n:
                f[val] += 1
write("\n".join(map(str, f[1:])))

Submission status: Accepted

Solution code:
import itertools
n = int(input())
l = [int(x) for x in range(1, 99)]
c = list(itertools.combinations_with_replacement(l, 3))

ans = [0]*(10**4)

for x, y, z in c:
    a = x**2 + y**2 + z**2 + x*y + y*z + z*x
    if a <= 10**4:
        s = {x, y, z}
        if len(s) == 1:
            ans[a-1] += 1
        elif len(s) == 2:
            ans[a-1] += 3
        elif len(s) == 3:
            ans[a-1] += 6
for i in range(n):
    print(ans[i])