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 .

Solution (Python):
N = int(input())

ans = [0] * (N+1)
for a in range(1, 105):
  if a*a > N :
    break
  for b in range(1, 105):
    if a*a + b*b > N:
      break      
    for c in range(1, 105):
      if a*a + b*b + c*c + a*b + b*c + c*a > N:
        break
      ans[a*a + b*b + c*c + a*b + b*c + c*a] += 1

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

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

Solution (Python):
def main():
    N = int(input())
    ans = [0]*(N)
    for x in range(1, 105):
        for y in range(1, 105):
            for z in range(1, 105):
                if N < x**2 + y**2 + z**2 + x*y + y*z + z*x:
                    break
                ans[x**2 + y**2 + z**2 + x*y + y*z + z*x - 1] += 1

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


if __name__ == '__main__':
    main()

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

for i in range(N+1):
    ans.append(0)

for x in range(1,105):
    for y in range(1,105):
        for z in range(1,105):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if tmp < 10050:
                ans[tmp] += 1
for i in range(N):
    print(ans[i+1])

Solution (Python):
n = int(input())

lst = [0]*100000

for i in range(1, 101):
  for j in range(1, 101):
    for k in range(1, 101):
      m = i**2 + j**2 + k**2 + i*j + j*k + k*i
      lst[m] += 1
      
for i in range(1, n+1):
  print(lst[i])

Solution (Python):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
	print(ans[i+1])

Solution (Python):
from collections import defaultdict
n=int(input())
MAX=10000

d = defaultdict(int)

def col(x,y,z):
    if x == y and x == z  :
        return 1
    if x == y or y == z or z == x :
        return 3
    return 6


for i in range(1,MAX):
    wkx = i**2
    if wkx > MAX:
        break
    for j in range(i,MAX):
        wky = wkx + j**2  + i * j
        if wky > MAX :
            break
        for k in range(j,MAX):
            wkz = wky + k**2 + i * k  + j * k
            if wkz > MAX :
                break
            d[wkz] = d[wkz] + col(i,j,k)
            
for i in range(n):
    k = i + 1
    print(d[k])

Solution (Python):
from collections import defaultdict
n=int(input())
MAX=10001
RMAX=102
d = defaultdict(int)
for i in range(1,RMAX):
    wkx = i * i
    if wkx > MAX:
        break
    for j in range(1,RMAX):
        wky = wkx + j * j  + i * j
        if wky > MAX :
            break
        for k in range(1,RMAX):
            wkz = wky + k * k + i * k  + j * k
            if wkz > MAX :
                break
            d[wkz] += 1
            
for i in range(n):
    k = i + 1
    print(d[k])

Solution (Python):
def cal(i,j,k):
    a = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i 
    return a

N = int(input())
ans = [0] * (N + 1)
m = int(N ** 0.5)
for i in range(1,m):
    for j in range(1,m):
        for k in range(1,m):
            if cal(i,j,k) <= N:
                ans[cal(i,j,k)] += 1

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

Solution (Python):
N = int(input())
ans = [0]*N
for x in range(1, int(N**0.5)+2):
  for y in range(1, int(N**0.5)+2):
    for z in range(1, int(N**0.5)+2):
      a = x**2 + y**2 + z**2 + x*y + y*z + z*x 
      if a <= N:
        ans[a-1] += 1
for i in range(N):
  print(ans[i])

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

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
            tmp+=x*y+y*z+z*x
            if tmp<=N:
                ans[tmp]+=1
                
for i in range(1,N+1):
    print(ans[i])

Solution (Python):
n = int(input())
A = [0]*(n+1)
 
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if a <= n:
                A[a] += 1
            else:
                break
            
                
for i in range(n):
    print(A[i+1])

Solution (Python):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for i in range(n):
  print(ans[i+1])

Solution (Python):
n = int(input())
A = [0]*(n+1)
 
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if a <= n:
                A[a] += 1
                
for i in range(n):
    print(A[i+1])

Solution (Python):
num_limit = int(input())
num_list = [0] * num_limit
j_limit = int(num_limit ** 0.5)
for j in range(1,j_limit+1):
    for k in range(1,j + 1):
        if num_limit < j**2 + k**2 + j*k:
            break
        for l in range(1,k+1):
            if num_limit < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                break
            elif num_limit >= j**2 + k**2 + l**2 + j*k + k*l + l*j:
                if j > k:
                    if k > l:
                        num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 6
                    else:
                        num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 3
                elif k > l:
                    num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 3
                else:
                    num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 1
for i in num_list:
    print(i)

Solution (Python):
num_limit = int(input())
num_list = [0] * num_limit
j_limit = int(num_limit ** 0.5)
for j in range(1,j_limit+1):
    for k in range(1,j + 1):
        for l in range(1,k+1):
            if num_limit >= j**2 + k**2 + l**2 + j*k + k*l + l*j:
                if j > k:
                    if k > l:
                        num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 6
                    else:
                        num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 3
                elif k > l:
                    num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 3
                else:
                    num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 1
for i in num_list:
    print(i)

Solution (Python):
N = int(input())

keys = [i for i in range(1, N+1)]
values = [0] * N
count_dict = dict(zip(keys, values))

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

for v in count_dict.values():
    print(v)

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

Solution (Python):
n = int(input())
A = [0]*10050
 
for x in range(1,105):
    for y in range(1,105):
        for z in range(1,105):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if a <10050:
                A[a] += 1
                
for i in range(n):
    print(A[i+1])

Solution (Python):
N = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for l in range(N):
  print(ans[l+1])

Solution (Python):
n =int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v<10050:
                ans[v]+=1

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

Solution (Python):


import math
import itertools


def get_input() -> int:
    """
    標準入力を取得する.

    Returns:\n
        int: 標準入力
    """
    N = int(input())

    return N




def g(x: int, y: int, z: int) -> int:
    """
    関数.

    Args:\n
        x (int): 整数（1 <= x）
        y (int): 整数（1 <= y）
        z (int): 整数（1 <= z）

    Returns:\n
        int: 関数値
    """
    return x**2 + y**2 + z**2 + x*y + y*z + z*x


def main(N: int) -> None:
    """
    メイン処理.

    Args:\n
        N (int): 整数
    """
    
    l = [0 for n in range(N)]
    ub = int(math.sqrt(N))
    for x, y, z in itertools.product(range(1, ub + 1), repeat=3):
        v = g(x, y, z)
        if v <= N:
            l[v - 1] += 1

    
    for ans in l:
        print(ans)


if __name__ == "__main__":
    
    N = get_input()

    
    main(N)

Solution (Python):


import math
import itertools


N = int(input())




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


l = [0 for n in range(N)]
for x, y, z in itertools.product(range(1, int(math.sqrt(N)) + 1), repeat=3):
    v = g(x, y, z)
    if v <= N:
        l[v - 1] += 1


for ans in l:
    print(ans)

Solution (Python):
N = int(input())
A = [0] * (N + 1)
for i in range(1, 102):
    for j in range(1, 102):
        for k in range(1, 102):
            t = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + i * k
            if t <= N:
                A[t] += 1
for n in range(1, N + 1):
    print(A[n])

Solution (Python):
N = int(input())

ans = [0] * (N+1)
for a in range(1, 105):
  if a*a > N :
    continue
  for b in range(1, 105):
    if a*a + b*b > N:
      continue      
    for c in range(1, 105):
      if a*a + b*b + c*c + a*b + b*c + c*a > N:
        continue
      ans[a*a + b*b + c*c + a*b + b*c + c*a] += 1

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

Solution (Python):
N = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i + j*j + k*k + k*j + i*k + i*j
            if v < 10050:
                ans[v] += 1

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

Solution (Python):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v<10050:
                ans[v]+=1
for i in range(n):
    print(ans[i+1])

Solution (Python):
import math
import numpy as np

def  XYZTriplets():

    num = int(input())
    
    list_num = []
    
    count = [0]*num
    
    for i in range(1, num+1):
        list_num.append(i)

    for x in range(1, int(math.sqrt(num))):
        for y in range(1, int(math.sqrt(num))):
            for z in range(1, int(math.sqrt(num))):
                
                function = x*x + y*y + z*z + x*y + y*z + z*x
                
                if function <= num and function > 0:
                    count[function-1] = count[function-1] + 1
 
    for i in range(0, num):
        print(count[i])
        

if __name__ == '__main__':
    XYZTriplets()

Solution (Python):
n = int(input())
ans = [0] * (10**4 + 1)

for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v < 10001:
                ans[v]+=1

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

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

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

current = [1,1,1]
ans = 0
p = [0 for _ in range(n+1)]
m = math.ceil(math.sqrt(n))+1
for i in range(1, m):
  f_ = f(i, 1, 1)
  if f_ > n:
    break
  for j in range(1, m):
    f_ = f(i,j,1)
    if f_ > n:
      break
    for k in range(1, m):
      f_ = f(i,j,k)
      if f_ > n:
        break
      p[f_] += 1
for i in range(1, n+1):
  print(p[i])

Solution (Python):
n = int(input())
rootn = int(n**0.5) +1
ans = [0] * (n+1)
for x in range(1, rootn):
  for y in range(1, rootn):
    for z in range(1, rootn):
      cur = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if cur <= n:
        ans[cur] += 1
print('\n'.join(map(str, ans[1:])))

Solution (Python):
n=int(input())
MAX=(10**4)
cntl=[0]*(MAX+1)

for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      if x**2+y**2+z**2+x*y+y*z+x*z>MAX:
        break
      cntl[x**2+y**2+z**2+x*y+y*z+x*z]+=1
for i in range(1,n+1):
  print(cntl[i])

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

ans = [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,int(math.sqrt(N))+10):
    for y in range(1,int(math.sqrt(N))+10):
        for z in range(1,int(math.sqrt(N))+10):
            if g(x,y,z) <= N:
                ans[g(x,y,z)-1] += 1

for p in range(N):
    print(ans[p])

Solution (Python):
import math

n = int(input())
max = int(math.sqrt(n) + 1)
L = [0] * (n + 1)
for x in range(1, max):
    for y in range(1, max):
        for z in range(1, max):
            tmp = x * x + y * y + z * z + x * y + y * z + z * x
            if tmp > n:
                continue
            L[tmp] += 1

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

Solution (Python):
n=int(input())
l=[0]*n
q=int(n**0.5)
for i in range(1,q+1):
  for j in range(1,q+1):
    for k in range(1,q+1):
      t=((i+j)**2+(j+k)**2+(i+k)**2)//2
      if t<=n:
        l[t-1]+=1
print(*l)

Solution (Python):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):	
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
	print(ans[i+1])

Solution (Python):
n = int(input())
ans = [0]*n
for i in range(1,100):
  for j in range(1,100):
    for k in range(1,100):
      num = i*i+j*j+k*k+i*j+i*k+j*k
      if num <= n:
        ans[num-1] += 1
for i in range(n):
  print(ans[i])

Solution (Python):
n=int(input())
ans = [0]*10050
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i + j*j + k*k + i*j + i*k + j*k
            if v<10050:
                ans[v]+=1
for i in range(1,n+1):
    print(ans[i])

Solution (Python):
n=(int)(input())
a=[0 for i in range(10001)]
for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      temp = (x * x) + (x * y) + (x * z) + (y * y) + (y * z) + (z * z)
      if temp <= 10000:
        a[temp] += 1

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

Solution (Python):
n = int(input())
ans = [0 for _ in range(10**4+1)]
for x in range(1, 101): 
    for y in range(1, 101): 
        for z in range(1,101): 
            if (m:=x*x+y*y+z*z+x*y+y*z+z*x) <= n:
                
                ans[m] += 1

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

Solution (Python):
import sys
sys.setrecursionlimit(300000)
from math import sqrt, ceil
from collections import defaultdict

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()

n = ceil(sqrt(N))
d = defaultdict(int)
for x in range(1, n + 1):
    for y in range(1, n + 1):
        for z in range(1, n + 1):
            a = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if a <= N:
                d[a] += 1
for i in range(1, N + 1):
    print(d[i])

Solution (Python):
n = int(input())
f = [0]*100000005
for i in range(1, 105):
    for j in range(1, 105):
        for k in range(1, 105):
            x = i**2 + j**2 + k**2 + i*j + j*k+ k*i
            f[x] += 1

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

Solution (Python):




def main():
    N = int(input())
    ans = [0] * (6 * 10**4 + 10)

    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                ans[x**2 + y**2 + z**2 + x * y + y * z + x * z - 1] += 1

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


if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    n = int(input().rstrip())
    ans = [0 for _ in range(n)]
    for x in range(1, 101):
        for y in range(x, 101):
            for z in range(y, 101):
                tmp = pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x
                if tmp > n:
                    break
                if x == y == z:
                    ans[tmp - 1] += 1
                elif x == y or y == z or z == x:
                    ans[tmp - 1] += 3
                else:
                    ans[tmp - 1] += 6
    for v in ans:
        print(v)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
l = [0] * 10 ** 5
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            n = (pow(x + y,2) + pow(y + z,2) + pow(z + x,2)) // 2
            l[n] += 1
for n in range(1,N + 1):
    print(l[n])

Solution (Python):
import collections
import sys
A = []
n = int(input())
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            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()

Solution (Python):
import sys
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    n = int(input().rstrip())
    ans = [0 for _ in range(n)]
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                tmp = pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x
                if tmp > n:
                    break
                
                
                
                
                
                
                ans[tmp - 1] += 1
    for v in ans:
        print(v)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ans = [0 for _ in range(10050)]

for i in range(1, 105):
    for j in range(1, 105):
        for k in range(1, 105):
            v = i * i + j * j + k * k + i * j + j * k + k * i
            if v < 10050:
                ans[v] += 1
for i in range(n):
    print(ans[i + 1])

Solution (Python):
N = int(input())

ans = [0 for _ in range(N+1)]
for x in range(1, 101):
    for y in range(x, 101):
        for z in range(y, 101):
            v = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if v < N+1:
                if x == y == z:
                    ans[v] += 1
                elif x == y or x == z or z == y:
                    ans[v] += 3
                else:
                    ans[v] += 6
for i in range(1,N+1):
    print(ans[i])

Solution (Python):
N = int(input())

ans = [0 for _ in range(10010)]
for x in range(1, 101):
    for y in range(x, 101):
        for z in range(y, 101):
            v = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if v < 10001:
                if x == y == z:
                    ans[v] += 1
                elif x == y or x == z or z == y:
                    ans[v] += 3
                else:
                    ans[v] += 6
for i in range(1,N+1):
    print(ans[i])

Solution (Python):
N = int(input())

ans = [0]*10050

for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = (i+j+k)**2-(i*j+i*k+j*k)
      if v < len(ans):
        ans[v] += 1
  
for x in range(1,N+1):
  print(ans[x])

Solution (Python):
L = 10**2+10
n = int(input())
ans = [0] * n
for i in range(1, L):
    for j in range(1, L):
        for k in range(1, L):
            x = i**2+j**2+k**2+i*j+j*k+i*k
            if x <= n:
                ans[x-1] += 1
print(*ans, sep="\n")

Solution (Python):
n=int(input())
ans = [0 for _ in range(n+1)]
for i in range(1,int((n+1)**0.5)):
    for j in range(1,n+1):
        for k in range(1,n+1):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v > n:
                break
            ans[v]+=1
for i in range(n):
    print(ans[i+1])

Solution (Python):

N = int(input())
answer = [0]*N
for k in range(1, int(N**(1/2))):
    for l in range(1, int(N**(1/2))):
        for m in range(1, int(N**(1/2))):
            v = k**2 + l**2 + m**2 + k*l + l*m + m*k
            if v-1 < N:
                answer[v-1] += 1
for i in range(N):
    print(answer[i])

Solution (Python):


import copy
import random
import bisect 
import fractions 
import math
import sys
import collections
from decimal import Decimal 

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

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))


N = int(input())

anss = [0 for i in range(N + 1)]
for x in range(1, int(math.sqrt(N))):
    for y in range(1, int(math.sqrt(N))):
        for z in range(1, int(math.sqrt(N))):
            tmp = x ** 2 + y ** 2 + z ** 2 + x*y + x*z + y*z
            if tmp <= N:
                anss[tmp] += 1 

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

Solution (Python):
from collections import Counter
N = int(input())
MAX_INT = 10**4+1
cumsum = [0] * (MAX_INT)


for i in range(3, 150):
  seen = []
  for n in range(1, i+1):
    for m in range(n, i+1):
      k = i - n - m
      if k <= 0: continue
      tmp = [n,m,k]
      tmp.sort()
      if tmp in seen: continue
      seen.append(tmp)

      p = i*i - (n*m + m*k + k*n)
      if p >= MAX_INT: break
      l = len(list(set(tmp)))
  
      if l==3:
        add = 6
      elif l==2:
        add = 3
      else:
        add = 1

      cumsum[p] += add
      
for i in range(1, N+1):
  print(cumsum[i])

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

Solution (Python):
n = int(input())
lst = [0] * 10**6
for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      t = (x**2 + y**2 + z**2 + (x+y+z)**2) // 2
      lst[t] += 1
for i in range(1, n+1):
  print(lst[i])

Solution (Python):
N = int(input())
chk = [0] * (10 ** 4 + 2)
for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            a = i**2 + j**2 + k**2 + i*j + j*k + i*k
            if a > 10001:
                break
            chk[a] += 1
for i in range(N):
    print(chk[i+1])

Solution (Python):



import math
import sys


def calc_p(a, b, c):
    u = {a, b, c}
    if len(u) == 3:
        return 6
    if len(u) == 2:
        return 3
    if len(u) == 1:
        return 1
    else:
        raise


def std_in():
    return sys.stdin.readline().strip()


def _main():
    N = int(std_in())
    fn = [0] * N
    if N == 1:
        x_max = 1
    else:
        x_max = int(math.sqrt(N - 2)) - 1

    n2 = [i**2 for i in range(1, x_max + 1)]

    ij = [[0 for _ in range(1, x_max + 1)] for _ in range(1, x_max + 1)]
    for i in range(x_max):
        for j in range(i, x_max):
            ij[i][j] = (i+1) * (j+1)

    for x in range(1, x_max + 1):
        y_min = x
        x2 = n2[x-1]
        for y in range(y_min, x_max + 1):
            z_min = y
            y2 = n2[y-1]
            xy = ij[x-1][y-1]
            tmp_n = x2 + xy + y2
            if tmp_n > N:
                break
            for z in range(z_min, x_max + 1):
                z2 = n2[z-1]
                yz = ij[y-1][z-1]
                zx = ij[x-1][z-1]
                n = tmp_n + z2 + yz + zx
                if n > N:
                    break
                fn[n-1] += calc_p(x, y, z)

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


if __name__ == "__main__":
    _main()

Solution (Python):



import sys


def calc_p(a, b, c):
    u = {a, b, c}
    if len(u) == 3:
        return 6
    if len(u) == 2:
        return 3
    if len(u) == 1:
        return 1
    else:
        raise


def std_in():
    return sys.stdin.readline().strip()


def _main():
    N = int(std_in())
    fn = [0] * (N + 1)
    if N == 1:
        x_max = 1
    else:
        x_max = int(pow(N, 0.5)) - 1

    n2 = [i**2 for i in range(1, x_max + 1)]

    ij = [[0 for _ in range(1, x_max + 1)] for _ in range(1, x_max + 1)]
    for i in range(x_max):
        for j in range(i, x_max):
            ij[i][j] = (i+1) * (j+1)

    for x in range(1, x_max + 1):
        y_min = x
        x2 = n2[x-1]
        for y in range(y_min, x_max + 1):
            z_min = y
            y2 = n2[y-1]
            xy = ij[x-1][y-1]
            tmp_n = x2 + xy + y2
            if tmp_n > N:
                break
            for z in range(z_min, x_max + 1):
                z2 = n2[z-1]
                yz = ij[y-1][z-1]
                zx = ij[x-1][z-1]
                n = tmp_n + z2 + yz + zx
                if n > N:
                    break
                fn[n] += calc_p(x, y, z)

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


if __name__ == "__main__":
    _main()

Solution (Python):

n = int(input())

f = [0 for _ in range(10**5)]

for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            f[i**2 + j**2 + k**2 + i*j + j*k + k*i] += 1

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

Solution (Python):



import math
import sys


def calc_p(a, b, c):
    u = {a, b, c}
    if len(u) == 3:
        return 6
    if len(u) == 2:
        return 3
    if len(u) == 1:
        return 1
    else:
        raise


def std_in():
    return sys.stdin.readline().strip()


def _main():
    N = int(std_in())
    fn = [0] * (N + 1)
    if N == 1:
        x_max = 1
    else:
        x_max = int(math.sqrt(N - 2)) - 1

    n2 = [i**2 for i in range(1, x_max + 1)]

    ij = [[0 for _ in range(1, x_max + 1)] for _ in range(1, x_max + 1)]
    for i in range(x_max):
        for j in range(i, x_max):
            ij[i][j] = (i+1) * (j+1)

    for x in range(1, x_max + 1):
        y_min = x
        x2 = n2[x-1]
        for y in range(y_min, x_max + 1):
            z_min = y
            y2 = n2[y-1]
            xy = ij[x-1][y-1]
            tmp_n = x2 + xy + y2
            if tmp_n > N:
                break
            for z in range(z_min, x_max + 1):
                z2 = n2[z-1]
                yz = ij[y-1][z-1]
                zx = ij[x-1][z-1]
                n = tmp_n + z2 + yz + zx
                if n > N:
                    break
                fn[n] += calc_p(x, y, z)

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


if __name__ == "__main__":
    _main()

Solution (Python):
N = int(input())

ans = [0 for _ in range(10**4+50)]

for x in range(1, 105):
    for y in range(1, 105):
        for z in range(1, 105):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if tmp < 10**4+50:
                ans[tmp] += 1

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

Solution (Python):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v < 10050:
        ans[v] += 1
        
for i in range(n):
  print(ans[i+1])

Solution (Python):
from math import sqrt, ceil

N = int(input())

result = [0] * (N + 1)
t = ceil(sqrt(N))
for x in range(1, t + 1):
    for y in range(1, t + 1):
        for z in range(1, t + 1):
            n = x * x + y * y + z * z + x * y + y * z + z * x
            if n > N:
                break
            result[n] += 1

print(*result[1:], sep='\n')

Solution (Python):
n = int(input())
sqn = int(n**0.5)+1
f = [0] * (n+1)
for x in range(1,sqn):
    for y in range(1, sqn):
        for z in range(1, sqn):
            nn = x*x + y*y + z*z + x*y + y*z + z*x
            if nn <= n : f[nn]+=1
for i in range(1,n+1):
    print(f[i])

Solution (Python):
n = int(input())
ans = [0] * n

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:
                ans[tmp-1] += 1

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

Solution (Python):
N = int(input())

ans = [0] * (N+1)   

for x in range(1,100):      
    for y in range(1,100):
        for z in range(1,100):
            a = x * x + y * y + z * z + x * y + y * z + z * x
            if a <= N:      
                n = a       
                ans[n] += 1 
      
for n in range(1,N+1):
    print(ans[n])

Solution (Python):
import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N = INT()

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

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

Solution (Python):
import math
N = int(input())
X = math.ceil(math.sqrt(N))
li = [0]*N
xyz = []
for i in range(X):
    for j in range(X-i):
        for k in range(X-i-j):
            xyz1 = [i+1,j+i+1,k+j+i+1]
            xyz1.sort()
            if i+1 == j+i+1 == k+j+i+1:xyz1.append(1)
            elif i+1 != j+i+1 and i+1 != k+j+i+1 and j+i+1 != k+j+i+1:xyz1.append(6)
            else:xyz1.append(3)
            xyz.append(xyz1)
xyz.sort()
for l in xyz:
    n = l[0]**2 + l[1]**2 + l[2]**2 + l[0]*l[1] + l[1]*l[2] + l[2]*l[0]
    try:
        li[n-1] += l[3]
    except:pass
for n in li[0:N:]:
    print(n)

Solution (Python):
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):
      n = i*i+j*j+k*k+i*j+j*k+k*i
      if n <= N:
        ans[n] += 1

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

Solution (Python):
import itertools
from collections import defaultdict

def main():
    N = int(input())
    A = defaultdict(int)
    for x in range(1,N+1):
        breakflag = False
        for y in range(1,N+1):
            for z in range(1,N+1):
                a = x**2 + y**2 + z**2 + x*y + y*z + z*x
                
                if a <= N:
                    A[a] += 1
                else:
                    break
    for i in range(N):
        print(A[i+1])

if __name__ == '__main__':
    main()

Solution (Python):
a = int(input())

x = [0] * (a+1)
for xi in range(1,101):
    for yi in range(1,101):
        for zi in range(1,101):
            result = xi**2 + yi**2 + zi**2 + xi*yi + yi*zi + zi*xi
            if result <= a:
                x[result] += 1 
for i in range(1, a+1):
    print(x[i])