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:
n = int(input())

func = [0]*n

for x in range(1,100):
    for y in range(x, 100):
        for z in range(y,100):
            temp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if temp <= n:
                if x == y and y == z :
                    func[temp-1] += 1
                elif x == y or y == z:
                    func[temp-1] += 3
                else:
                    func[temp-1] += 6

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

Submission status: Accepted

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

def main():
    n = int(input())
    ans = [0]*(10**4+1)
    tmp = 0
    for i in range(1, int(n**.5)+1):
        for j in range(i, int(n**.5)+1):
            for k in range(j, int(n**.5)+1):
                tmp = f(i, j, k)
                if tmp > n:
                    break
                if i == j and j == k:
                    ans[tmp] += 1
                elif i != j and j != k and k != i:
                    ans[tmp] += 6
                else:
                    ans[tmp] += 3

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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


for x in range(1, 10**4):
    for y in range(x, 10**4):
        if x*y > 10**4:
            break

        for z in range(y, 10**4):
            n = x*x + y*y + z*z + x*y + y*z + z*x

            if n > 10**4:
                break

            if x == y and y == z:
                f_arr[n] += 1
            elif (x == y) or (y == z) or (z == x):
                f_arr[n] += 3
            else:
                f_arr[n] += 6

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

Submission status: Accepted

Solution code:
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化
def calc_0711(x, y, z):
    return x ** 2 + y ** 2 + z ** 2 + x*y + y*z + z*x

def main():
    ans_list = [0] * 10010
    for i in range(1,100):
        for j in range(i, 100):
            for k in range(j, 100):
                c = calc_0711(i,j,k)
                #print('({:},{:},{:}) => {:}'.format(i,j,k, c))
                if c < 10010:
                    if i == j:
                        if j == k:
                            ans_list[c] += 1
                        else:
                            ans_list[c] += 3
                    else:
                        if j == k:
                            ans_list[c] += 3
                        else:
                            ans_list[c] += 6
    
    n = int(input())
    for i in range(1, n + 1):
        print(ans_list[i])
    
    return 0

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from logging import *
basicConfig(level=DEBUG, format='%(levelname)s: %(message)s')
disable(CRITICAL)

n = int(input())

f = [0]*(n+1)
x = 1
while x*x < n:
    y = 1
    while y*y < n:
        if x*y >= n: continue
        z = 1
        while z*z < n:
            k = x*x + y*y + z*z + x*y + y*z + z*x
            if 1<=k<=n:
                debug('x {} y {} z {} k {}'.format(x,y,z,k))
                f[k] += 1
            z += 1
        y += 1
    x += 1
for i in range(1,n+1):
    debug('f[{}] {}'.format(i,f[i]))
    print(f[i])

Submission status: Accepted

Solution code:
n = int(input())
import math
lim = math.ceil(math.sqrt(n))
l = [0]*n
for x in range(1, lim):
    for y in range(1, lim):
        for z in range(1, lim):
            i = (x+y+z)**2 - (x*y + y*z + z*x)
            if (0<i) and (i<n+1):
                l[i-1] += 1
for i in l:
    print(i)

Submission status: Accepted

Solution code:
N = int(input())

def Main(N):
    B = 100
    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: Accepted

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

import math
m = int(math.sqrt(n)) + 1
for i in range(1, m):
    for j in range(1, m):
        for k in range(1, m):
            a = (i + j + k)**2 - i*j - j*k - k*i
            if a <= n:
                l[a - 1] += 1
for i in l:
    print(i)

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	dd=[0]*n
	for x in range(1,n):
		if x*x > n:
			break
		for y in range(1, n):
			if x*x + x*y + y*y >n:
				break
			for z in range(1, n):
				if x*x + y*y + z*z + x*y + y*z + z*x > n:
					break
				dd[x*x + y*y + z*z + x*y + y*z + z*x -1] += 1
		
	for v in dd:
		print(v)
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
n = int(input())

h = {}


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


for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            a = calc(x, y, z)
            if a not in h:
                h[a] = 1
            else:
                h[a] += 1

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

Submission status: Accepted

Solution code:
import math

N = int(input())

NList = [0 for i in range(N)]
count = 0
tmp = 0

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
            else:
                NList[i ** 2 + p ** 2 + q ** 2 + i * p + p * q + i * q - 1] += 1
                
for n_count in NList:
    print(n_count)

Submission status: Accepted

Solution code:
n=int(input())
ans=[0]*n
t=3
import math
while t**2-((math.ceil(t/3))**2)*3<=n:
  for i in range(1,t-1):
    for j in range(1,t-i):
      k=t-i-j
      if t**2-i*j-j*k-k*i-1<n:
        ans[t**2-i*j-j*k-k*i-1]=ans[t**2-i*j-j*k-k*i-1]+1
  t=t+1
for i in range(n):
  print(ans[i])

Submission status: Accepted

Solution code:
from collections import defaultdict
N = int(input())
d=defaultdict(set)
for i in range(1, 101):
    for j in range(1,101):
        for k in range(1,101):
            cur = i * i + j * j + k * k + i * k + i * j + j * k
            d[cur].add(tuple(sorted([i, j, k])))


resd = {}
resl = []
for i in range(1, N+1):
    if i < 6:
        resl.append(0)
        continue
    if i not in d:
        resl.append(0)
    else:
        count = 0
        for i, j, k in d[i]:
            if i == j and j == k:
                count += 1
            elif i == j or j == k or i == k:
                count += 3
            else:
                count += 6
        resl.append(count)
                


for i in resl:
    print(i)

Submission status: Accepted

Solution code:
import math
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, math.ceil(N**0.5)):
    for y in range(x, math.ceil(N**0.5)):
        for z in range(y, math.ceil(N**0.5)):
            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: Accepted

Solution code:
from itertools import combinations_with_replacement
N = int(input())
box = []
for i in range(1, 101):
    box.append(i)

temp = []

for cr in combinations_with_replacement(box, 3):
    st = set()
    x, y, z = cr
    st.add(x)
    st.add(y)
    st.add(z)
    if len(st) == 2:
        temp.append([x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x, 3])
    elif len(st) == 3:
        temp.append([x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x, 6])
    else:
        temp.append([x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x, 1])
temp = sorted(temp, reverse=True)

for i in range(1, N+1):
    ans = 0
    while temp[-1][0] == i:
        ans += temp[-1][1]
        temp.pop()
    print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

def main(N):
    lst = []
    for x in range(1, 142):
        for y in range(1, 142):
            for z in range(1, 142):
                r = (x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2
                if r <= 2 * 10 ** 4:
                    if r % 2 == 1:
                        print('奇数')
                    lst.append(r // 2)
                else:
                    break
    c = Counter(lst)
    st = set(lst)

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


if __name__ == '__main__':
    N = int(input())
    main(N)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import math

import heapq

def input():
    return sys.stdin.readline().rstrip()


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



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

    dp = [0]*(N+1)
    rt = int(N **0.5) +2
    for i in range(1,rt):
        for j in range(1,rt):
            for k in range(1,rt):
                case =int( i**2 + j **2 + k **2 + i*j + i*k + j*k )
                if case <=N:
                    dp[case] +=1


    for l in range(1,N+1):
        print(dp[l])










if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
from itertools import combinations_with_replacement as comb_rplc
from itertools import permutations 
adj=[0]*10**5
for x,y,z in comb_rplc(range(1, 100), 3):
  a=x**2+y**2+z**2+x*y+z*x+y*z
  if x==y and x==z:
    adj[a]+=1
  elif x==y or y==z or x==z:
    adj[a]+=3
  else:
    adj[a]+=6
for i in range(1,n+1):
  print(adj[i])

Submission status: Accepted

Solution code:
n=int(input())

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

li=[0]*(n+5)
for x in range(1,200):
  for y in range(1,200):
    for z in range(1,200):
      num=f_xyz(x,y,z)
      if num<=n:
        li[f_xyz(x,y,z)+1]+=1
      else:
        break
        
for i in li[2:n+2]:
  print(i)

Submission status: Accepted

Solution code:
import math

if __name__ == "__main__":
    N = int(input())
    n = 100
    f =[0]*10000000
    for x in range(1,n):
        for y in range(1,n):
            for z in range(1,n):
                f[x*x + y*y + z*z + x*y + y*z + z*x-1] += 1

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

Submission status: Accepted

Solution code:
n = int(input())
num = [0] * 10001
for i in range(1, 142):
    for j in range(1, 142):
        for k in range(1, 142):
            temp = i + j + k
            if temp % 2 == 0:
                if i + j > k and j + k > i and k + i > j:
                    temp2 = (i ** 2 + j ** 2 + k ** 2) // 2
                    if 0 <= temp2 <= 10000:
                        num[temp2] += 1
for i in range(1, n + 1):
    print(num[i])

Submission status: Accepted

Solution code:
N = int(input())

res = [0] * N


for x in range(1, 102):
    for y in range(1, 102):
        for z in range(1, 102):
            t1 = (x + y + z) ** 2

            if t1 > 15000:
                break

            n = t1 - x * y - y * z - z * x - 1
            
            if n >= N or n < 0:
                break
            res[n] += 1

for o in res:
    print(o)

Submission status: Accepted

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

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

Submission status: Accepted

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

for x in range(1,10000):
    if 6*x*x > N:
        break
    for y in range(x,10000):
        if x*x + 3*y*y + 2*x*y > N:
            break
        for z in range(y,10000):
            v = x*x + y*y + z*z + x*y + y*z + x*z
            if v > N:
                break
            if x == y and y == z:
                ans[v] += 1
            elif x != y and y != z:
                ans[v] += 6
            else:
                ans[v] += 3

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
def f(x, y, z):
    return x**2 + y**2 + z **2 + x * y + y * z + z * x

L = [0] * (N + 1)
thre =  ceil(sqrt(N)) + 1
# print(thre)
for x in range(1, thre+1):
    for y in range(1, thre + 1):
        for z in range(1, thre + 1):
            if f(x,y,z) <= N:
                L[f(x, y, z)] += 1
print(*L[1:], sep="\n")

Submission status: Accepted

Solution code:
n = [0 for i in range(10001)]
for z in range(1, 100, 1):
    for y in range(1, 100, 1):
        for x in range(1, 100, 1):
            tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if tmp > 10 ** 4:
                break
            else:
                n[tmp] += 1
N = int(input())
for i in range(1, N+1, 1):
    print(n[i])

Submission status: Accepted

Solution code:
from itertools import product
import heapq

N = int(input())

list_N = list(range(1, int((N + 1)**0.5)))

list_xyz = list(product(list_N, repeat=3))

ans_list = [x**2 + y**2 + z ** 2 + x*y + y*z + x * z for x, y ,z in list_xyz]
heapq.heapify(ans_list)
for n in range(1, N+1):
    ans = 0
    while True:
        if len(ans_list) < 1:
            break
        tmp = heapq.heappop(ans_list)
        if tmp == n:
            ans += 1
        elif tmp > n:
            heapq.heappush(ans_list, tmp)
            break
        
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import collections



N = int(input())
count = [0]*N*100
m = int(N**0.5)
for x, y, z in itertools.combinations_with_replacement(range(1, m+1), 3):
  n = x**2+y**2+z**2+x*y+y*z+z*x
  k = len(set({x, y, z}))
  if k == 1:
    count[n] += 1
  elif k == 2:
    count[n] += 3
  else:
    count[n] += 6

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

Submission status: Accepted

Solution code:
n = int(input())

ans = [0 for i in range(n)]
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            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: Accepted

Solution code:
import math

N=int(input())
sqN=int(math.sqrt(N))+1

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

dp=[0 for n in range(N)]
for x in range(1,sqN):
    for y in range(x,sqN):
        for z in range(y,sqN):
            tmp=f(x,y,z)
            c=len(set([x,y,z]))
            if tmp<=N:
                if c==1:
                    dp[tmp-1]+=1
                elif c==2:
                    dp[tmp-1]+=3
                else:
                    dp[tmp-1]+=6
            else:
                break
for n in range(len(dp)):
    print(dp[n])

Submission status: Accepted

Solution code:
n = int(input())
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: Accepted

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

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

n = int(input())
# ans = []
# for u in range(1, n+1):
#     cnt = 0
#     for i in range(1, int(n/(u**2))+2):
#         for j in range(1,int(u/(i**2))+2):
#             for k in range(1,int(u/(j**2))+2):
#                 if i**2+j**2+k**2+i*j+j*k+k*i == u:
#                     if i == j == k:
#                         cnt += 1
#                     elif i != j and j != k and k != j:
#                         cnt += 6
#                     else:
#                         cnt += 3
#
#     ans.append(cnt)
# print(ans)
ans = [0] * (n+1)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            cal = i**2+j**2+k**2+i*j+j*k+k*i
            if cal <= n:
                ans[cal] += 1
for i in range(1, n+1):
    print(ans[i])

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

Submission status: Accepted

Solution code:
import itertools
ln = itertools.product(range(1,100),repeat = 3)
#print(ln)
line = [0 for i in range(10000)]
#print(len(line))
for i in ln:
    x,y,z = i
    n = x**2 +y**2 + z**2 +x*y + y*z + z*x
    if n <=10000:
        line[n-1]+=1
N = int(input())
for i in range(N):
    print(line[i])

Submission status: Accepted

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

cnt = [0] * pow(10, 5)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            acc = x * x + y * y + z * z + x * y + y * z + x * z
            if acc > 10000:
                continue
            cnt[acc] += 1

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

Submission status: Accepted

Solution code:
'''     J A I ~ S H R E E ~ R A M     '''

# Title: aising2020_c.py
# dated: 11-07-2020 17:43:44
# Creator & Template by : Udit Gupta @luctivud


import math; from collections import *
import sys; from functools import reduce

# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())
def get_string(): return list(input().strip().split())
def printxsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

DIRECTIONS = [[0, 1], [0, -1], [1, 0], [1, -1]] #up, down, right, left
NEIGHBOURS = [(i, j) for i in range(-1, 2) for j in range(-1, 2) if (i!=0 or j!=0)]

OrdUnicode_a = ord('a'); OrdUnicode_A = ord('A')
CAPS_ALPHABETS = {chr(i+OrdUnicode_A) : i for i in range(26)}
SMOL_ALPHABETS = {chr(i+OrdUnicode_a) : i for i in range(26)}

MOD_JOHAN = int(1e9)+7; MOD_LIGHT = 998244353; INFINITY = float('inf')
MAXN_EYEPATCH = int(1e5)+1; MAXN_FULLMETAL = 501

# sys.stdin=open("input.txt","r");sys.stdout=open("output.txt","w")

# for _testcases_ in range(int(input())): 
n = int(input())
ans = [0] * (n+1)
i = 1
while i * i < n:
    i += 1
n0001 = i+1
for i in range(1, n0001):
    for j in range(1, n0001):
        for k in range(1, n0001):
            e = (i**2) + (j**2) + (i*j) + (k**2) + (j*k) + (i*k)
            if e <= n:
                # print(i, j, k, e)
                ans[e] += 1

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




'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
'''

Submission status: Accepted

Solution code:
from itertools import product 
from collections import Counter
def main():
    N = int(input())
    pattern = list(product(list(range(1, 100)),repeat=3))
    l = list()
    for i in pattern:
        x, y, z = i
        n = x**2 + y**2 + z**2 + x*y + y*z + z*x
        l.append(n)
    ans = Counter(l)
    for i in range(1, N+1):
        if ans.get(i) == None:
            print(0)
        else:
            print(ans.get(i))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
#import time
#t1=time.time()
def f(x, y, z):
    return x**2+y**2+z**2+x*y+y*z+z*x

n=int(input())
l=[0 for i in range(n)]
root = math.floor(math.sqrt(n))

for x in range(1,root+1):
    for y in range(1,root+1):
        for z in range(1,root+1):
            num=f(x,y,z)
            if num<=n:
                l[num-1]+=1
            if num>n:
                break

for s in l:
    print(s)
#print(t2-t1)
#print(l)

Submission status: Accepted

Solution code:
from math import sqrt
count = [0] * 10001
p = 100
for x in range(1,p+1):
    for y in range(1,p+1):
        for z in range(1,p+1):
            if x*x + y*y + z*z + x*y + y*z + z*x <= 10000:
                count[x*x + y*y + z*z + x*y + y*z + z*x] += 1
N = int(input())
for i in range(1,N+1):
    print(count[i])

Submission status: Accepted

Solution code:
n = int(input())
nn = n+4
anslist = [0]*nn

big = 0

def goukei(x,y,z):
  h =x**2 + y**2 + z**2 + x*y + y*z + z*x
  return h

for x in range(1,101):
  for y in range(1,x+1):
    for z in range(1,y+1):
      temp = goukei(x,y,z)
      if temp < n+2:
        if x == y == z:
          anslist[temp] += 1
          break
        if x == y or y == z:
          anslist[temp] += 3
        else:
          anslist[temp] += 6

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

Submission status: Accepted

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

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

    for i in range(1, 100):
        for j in range(1, 100):
            for k in range(1, 100):
                tmp = i ** 2 + j ** 2 + k ** 2 + i*j + j*k + k*i
                ans[tmp] += 1
    for i in range(N):
        print(ans[i+1])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import combinations_with_replacement
N = int(input())
ans = list(0 for _ in range(N))
for L in combinations_with_replacement(range(1, 100), 3):
  x = L[0]
  y = L[1]
  z = L[2]
  A = x**2 + y**2 + z**2 + x*y + y*z + z*x
  if A <= N:
    if x == y and y == z:
      ans[A - 1] += 1
    elif x == y or y == z or z == x:
      ans[A - 1] += 3
    else:
      ans[A - 1] += 6

for a in ans:
  print(a)

Submission status: Accepted

Solution code:
# ####################################################################
# import io
# import sys

# _INPUT = """\
# 10000

# 20

# """
# sys.stdin = io.StringIO(_INPUT)
# ####################################################################
# import sys
# def _p(*_a):
#   #return
#   _s=" ".join(map(str,_a))
#   #print(_s)
#   sys.stderr.write(_s+"\n")
# ####################################################################
# def _pa(_aa):
#   #return
#   for _a in _aa: _p(_a)
# ####################################################################
N = int(input())

A = [0]*(N+1)

X=Y=Z= int(pow(N, 1/2)) + 2
# _p(A)

for x in range(1,X):
  if pow(x,2) >= 10000: break

  for y in range(1,Y):
    if (pow(x,2)+pow(y,2)) >= 10000: break

    for z in range(1,Z):
      # n = pow((x+y),2) + pow((y+z),2) + pow((z+x),2) + x*y + y*z + z*x
      # if n > N: continue
      i = pow((x+y),2) + pow((y+z),2) + pow((z+x),2)
      if i % 2 == 1: continue
      n = i//2
      if n > N: continue
      A[n] = A[n]+1

for a in A[1:]:
  print(a)

Submission status: Accepted

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

for x in range(1,10**2+10):
    for y in range(1,10**2+10):
        for z in range(1,10**2+10):
            i=(x+y+z)**2-(x*y+y*z+x*z)
            if i<=n:
                l[i-1]+=1
print(*l,sep="\n")

Submission status: Accepted

Solution code:
n=int(input())
ans=[0]*n
for j in range(101):
	for k in range(101):
		for l in range(101):
			x=(j+1)**2+(k+1)**2+(l+1)**2+(j+1)*(k+1)+(k+1)*(l+1)+(l+1)*(j+1)
			if x<=n:
				ans[x-1]+=1
for s in ans:
	print(s)