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())
nijo = []
for k in range(2, int((2*N)**0.5) + 1):
  nijo.append(k**2)
nijo = [1] + nijo
count = [0 for _ in range(N)]
for k in range(2, len(nijo) +1):
  for j in range(2, len(nijo)+ 1):
    if nijo[k-1] + nijo[j-1] > 2*N:
      break
    for l in range(2, len(nijo)+1):
      if nijo[k-1] + nijo[j-1] + nijo[l-1] > 2*N:
        break
      elif (nijo[k-1] + nijo[j-1] + nijo[l-1]) %2 == 0:
        if k + l -j > 1 and -k+j+l > 1 and k + j -l >1:
          count[(nijo[k-1] + nijo[j-1] + nijo[l-1])//2-1] += 1

for _ in range(N):        
  print(count[_])

Solution (Python):


n = int(input())

ans = {}
for x in range(1, 99):
  for y in range(1, 99):
    for z in range(1, 99):
      k = (x+y)**2+(y+z)**2+(z+x)**2
      if k > 20000:
        break
      if k % 2 == 0:
        if not k//2 in ans:
          ans[k//2] = 1
        else:
          ans[k//2] += 1

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

Solution (Python):
N = int(input())
f = [0] * (N+1)
for x in range(1, int(N ** 0.5)):
    for y in range(x, int(N ** 0.5)):
        for z in range(y, int(N ** 0.5)):
            num = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if num <= N:
                if x == y and y == z:
                    f[num] += 1
                elif x != y and y != z and z != x:
                    f[num] += 6
                else:
                    f[num] += 3
for i in range(len(f)):
    if i == 0:
        continue
    print(f[i])

Solution (Python):
import numpy as np
n = int(input())
A = np.zeros(n)

x, y, z = 1, 1, 1

while x**2 + y**2 + z**2 + x*y + y*z + z*x <= n:
    while x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x <= n:
        while x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x <= n:
            i = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            A[i - 1] += 1
            z += 1
        z = 1
        y += 1
    y, z = 1, 1
    x += 1
for i in range(n):
    print(int(A[i]))

Solution (Python):
N = int(input())
A = [0 for i in range(N)]
a = 1
X = 0
while 1:
  X += (a + a - 1)
  if X > N:
    break
  Y = X
  b = 1
  while 1:
    Y += (a + b + b - 1)
    if Y > N:
      break
    Z = Y
    c = 1
    while 1:
      Z += (a + b + c + c - 1)
      if Z <= N:
        A[Z-1] += 1
      else:
        break
      c += 1
    b += 1
  a += 1
for a in A:
  print(a)

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    dict={}
    for j in range(1,101):
        for k in range(1,101):
            for l in range(1,101):
                calc = j**2+k**2+l**2 +j*k+k*l+l*j
                if calc in dict:
                    dict[calc]+=1
                else:
                    dict[calc]=1
    for i in range(1,n+1):
        if i in dict:
            print(dict[i])
        else:
            print(0)

Solution (Python):
n = int(input())
memo = [0 for _ in range(n + 1)]
for x in range(1, int(n ** 0.5) + 1):
    for y in range(1, int(n ** 0.5) + 1):
        for z in range(1, int(n ** 0.5) + 1):
            num = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if num <= n:
                memo[num] += 1
            elif num > n:
                break
for i in range(1, n + 1):
    print(memo[i])

Solution (Python):
import math
N = int(input())
arr = [0]*N
rtN = int(math.sqrt(N))*2
for x in range(rtN)[1:]:
    for y in range(rtN)[x:]:
        for z in range(rtN)[y:]:
            r = x*x +y*y+z*z+x*y+y*z+z*x
            if r <= N:
                if (x==z):
                    arr[r-1] +=1
                elif(x==y or y==z):
                    arr[r-1] +=3
                else:
                    arr[r-1] +=6
for ar in arr:
	print(ar)

Solution (Python):
import collections

l=[]
n=int(input())
for x in range(1,10**2+1):
    if x**2>n:continue
    for y in range(1,10**2+1):
        if x**2+y**2>n:continue
        for z in range(1,10**2+1):
            if x**2+y**2+z**2>n:continue
            l.append(x**2+y**2+z**2+x*y+y*z+z*x)

c=collections.Counter(l)
for x in range(1,n+1):
    print(c[x])

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):
            n = x * x + y * y + z * z + x * y + y * z + z * x
            if n <= N:
                ans[n-1] += 1

for i in ans:
    print(i)

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

memo = {}
n = 0

while n < N:
    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                n = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if n > N :
                    break
                memo.setdefault(n, [])
                memo[n].append((x,y,z))

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

Solution (Python):
N=int(input())
ans=[0]*N
for x in range(1,int((N-1)/2)):
    for y in range(x,int((N-1)/2)):
        if x ** 2 + y ** 2 + 1 ** 2 + x * y + y * 1 + 1 * x > N:
            break
        for z in range(y,int((N-1)/2)):
            if x**2+y**2+z**2+x*y+y*z+z*x<=N:
                if x==y and y==z:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
                elif x==y or y==z or z==x:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=3
                else:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=6
            else:
                break

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

Solution (Python):
def main():
  n = int(input())
  ans = []
  flg = 1
  for i in range(1,n+1):
    flg = 1
    anstmp = 0
    for x in range(1,int(i**0.5+1)):
      if flg == 0:
        break
      for y in range(x,int(i**0.5+1)):
        if i-(x**2+y**2+x*y) > x+y:
          j = i-(x**2+y**2+x*y)
          z = int((j+(x+y)**2/4)**0.5-(x+y)/2+0.5)
          if (x+y+z)*z == j:
            if x < y:
              anstmp += 2
            else:
              anstmp += 1
        elif y == 1:
          flg = 0
          break
        else:
          break
    ans.append(anstmp)
  print(*ans,sep="\n")
main()

Solution (Python):
ar = [0 for a in range(10001)]
for a in range(1,100):
    for b in range(1,100):
        for c in range(1,100):
            if a*a + b*b + c*c +a*b + b*c + c*a <=10**4:
                ar[a*a + b*b + c*c +a*b + b*c + c*a]+=1

n = int(input())
for i in range(1,n+1):
    print(ar[i],end= " ")

Solution (Python):
N = int(input())
f = [0]*10000001

for i in range(1,101):
	for j in range(i,101):
		for k in range(j,101):
			n = i**2+j**2+k**2+i*j+j*k+k*i
			if i == j == k:
				f[n] += 1
			elif (i == j and j != k) or (i != j and j == k):
				f[n] += 3
			else:
				f[n] += 6

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

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

Solution (Python):
N = int(input())
t = 1
if N > 1:
    t = int((N-2)**0.5)
ans = [0]*(N+1)
for i in range(1,t):
    for j in range(1,i+1):
        for k in range(1,j+1):
            a = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if a > N:
                continue
            t = 1
            if (i == j and j > k) or (i>j and j==k):
                t = 3
            elif i > j and j > k:
                t = 6
            ans[a] += t
for i in range(1,N+1):
    print(ans[i])

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

Solution (Python):
import math
N = int(input())
A = [0 for _ in range(N)]
for x in range(1,math.floor(N**0.5)+1):
    for y in range(1,math.floor((N-x**2)**0.5)+1):
        for z in range(1,math.floor((N-x**2-y**2)**0.5)+1):
            c = x**2+y**2+z**2+x*y+y*z+z*x
            if c <= N:
                A[c-1] += 1
for i in range(N):
    print(A[i])

Solution (Python):
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter

from functools import lru_cache

sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


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


n = inp()
limit = int(math.sqrt(n)) + 1
ans = [0] * n
for i in range(1, limit):
    for j in range(i, limit):
        for k in range(j, limit):
            x = func(i, j, k) - 1
            if x < n:
                if len(set([i, j, k])) == 1:
                    ans[x] += 1
                elif len(set([i, j, k])) == 2:
                    ans[x] += 3
                elif len(set([i, j, k])) == 3:
                    ans[x] += 6
for i in ans:
    print(i)

Solution (Python):
import math

n = int(input())

ans = [0] * n

r = math.floor(math.sqrt(n))
for x in range(1,r+1):
  for y in range(x,r+1):
    for z in range(y,r+1):
      sum = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if sum <= n:
        if x == y and y == z:
          ans[sum-1] += 1
        elif x == y or y == z or z == x:
          ans[sum-1] += 3
        else:
          ans[sum-1] += 6

for p in ans:
  print(p)

Solution (Python):
import numpy as np
def resolve():
    N = int(input())
    Nlist = np.zeros(N + 1,dtype =  int)
    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*k + i*j + j*k
                if num > N :
                    break
                else:
                    Nlist[num] += 1
    for i in range(1,N+1):
        print(Nlist[i])
resolve()

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

    A = [0] * (10 ** 6)
    for x in range(1, 10 ** 2 + 1):
        for y in range(1, 10 ** 2 + 1):
            for z in range(1, 10 ** 2 + 1):
                i = x ** 2 + y ** 2 + z ** 2 + x*y + y*z + z*x
                A[i] += 1

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
def f(x, y, z):
    return x*x + y*y + z*z + x*y + y*z + z*x
    
N = int(input())

ans = {}
for x in range(1, 100):
    for y in range(1, x+1):
        for z in range(1, y+1):
            ret = f(x, y, z)
            delta = 0
            if ret <= N:
                if x == y and y == z:
                    delta = 1
                elif x != y and y != z and z != x:
                    delta = 6
                else:
                    delta = 3
            
                if ret not in ans:
                    ans[ret] = delta
                else:
                    ans[ret] += delta

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

Solution (Python):
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):
            k = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if k <= n:
                ans[k-1] += 1
for i in range(n):
    print(ans[i])