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 math
import collections
import bisect
from collections import deque
from copy import copy, deepcopy


def main():
    N = int(input())
    ans = [0 for i in range(60001)]
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                ans[x * x + y * y + z * z + x * y + y * z + z * x] += 1

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

fn = dict([(i, 0) for i in range(1, N+1)])
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            n = pow(x,2)+pow(y,2)+pow(z,2) +x*y +y*z +z*x
            if n <= N:
                fn[n] += 1
for v in fn.values():
    print(v)

Submission status: Accepted

Solution code:
M = 10**2 + 1
N = int(input())
L = [0 for _ in range(M**2+10)]
for i in range(1,M):
    for j in range(1,M):
        for k in range(1,M):
            n = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if n>N:
                break
            L[n] += 1
for i in range(1,N+1):
    print(L[i])

Submission status: Accepted

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

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
      a[i] += 1

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

Submission status: Accepted

Solution code:
N = int(input())

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

anli = [0] * 10100


for x in range(1,150):
    if shiki(x,1,1) > N:
        break

    for y in range(1, x+1):
        if shiki(x,y,1) > N:
            break

        for z in range(1, y+1):
            
            if shiki(x,y,z) > N:
                break
            if x == y and y == z:
                anli[shiki(x,y,z)] += 1
            elif x==y or y==z or z==x:
                anli[shiki(x,y,z)] += 3
            else:
                anli[shiki(x,y,z)] += 6

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

Submission status: Accepted

Solution code:
N = int(input())

list = [0]*61206

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

for n in ans:
    print(n)

Submission status: Accepted

Solution code:
n = int(input())
num = [0] * (n+1)

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            res = x**2 + y**2 + z**2 + x*y + y*z + z*x 
            
            if res < n+1:
                num[res] += 1
                
            else:
                continue
                
for i in num[1:]:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
#A = list(map(int, input().split()))
#l, r, d = map(int, input().split())
A = [0]*70000

for x in range(1,100):
  for y in range(1,100):
    for z in range(1,100):
      t = x*x + y*y + z*z +x*y + y*z + z*x
      A[t] += 1

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

Submission status: Accepted

Solution code:
input =raw_input

N = int(input())

counts = [0] * (N+1)

# x< y < z
x = 1
while True:
    tmp1 = x ** 2
    y = x + 1

    ycount = 0
    while True:
        tmp2 = y ** 2 + x * y
        z = y + 1

        zcount = 0
        while True:
            tmp3 = z ** 2 + x * z + y * z
            n = tmp1 + tmp2 + tmp3
            if n > N:
                break
            else:
                counts[n] += 6
            z += 1
            zcount += 1
        if zcount == 0:
            break
        ycount += 1
        y += 1

    if ycount == 0:
        break
    x += 1

# x < y = z
x = 1
while True:
    tmp1 = x ** 2
    y = x+1
    ycount = 0
    while True:
        z = y
        tmp2 = y ** 2 + z ** 2 + x*y + y*z + z * x
        n = tmp1 + tmp2
        if n > N:
            break
        else:
            counts[n] += 3
        y += 1
        ycount += 1
    if ycount == 0:
        break
    else:
        x += 1
        
# x = y < z
if True:
    x = 1
    while True:
        y = x
        tmp1 = x ** 2 + y ** 2 + x*y

        zcount = 0
        z = y + 1
        while True:
            tmp2 = z ** 2 + y*z + z * x
            n = tmp1 + tmp2
            if n > N:
                break
            else:
                counts[n] += 3
            z += 1
            zcount += 1
        if zcount == 0:
            break
        else:
            x += 1
 
# x = y = z
if True:
    x = 1
    while True:
        n = 6 * (x ** 2)
        if n > N:
            break
        else:
            counts[n] += 1
        x += 1

for c in counts[1:]:
    print(c)

Submission status: Accepted

Solution code:
from itertools import combinations_with_replacement

n = int(input())
res = [0] * n
for x, y, z in combinations_with_replacement(range(1, int(n**0.5)), 3):
    if (val := x**2 + y**2 + z**2 + x*y + y*z + z*x) > n:
        continue
    if (l := len(set([x, y, z]))) == 1:
        res[val-1] += 1
    elif l == 2:
        res[val-1] += 3
    else:
        res[val-1] += 6
print('\n'.join(map(str, res)))

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

N = int(input())
x = 0
ans = [0 for _ in range(N)]
maxv = ceil(sqrt(N)) + 1
for x in range(1, maxv):
    for y in range(1, maxv):
        for z in range(1, maxv):
            f = x*x + y*y + z*z + x*y + y*z + z*x - 1
            if f > N-1: continue
            ans[f] += 1
for i in range(N):
    print(ans[i])

Submission status: Accepted

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [-int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))
    eps = 10**(-10)

    N = NI()

    for n in range(1,N+1):
        ans = 0
        m = int(math.sqrt(n)) + 1
        for x in range(1,m):
            for y in range(1,m):
                a0 = x*x + y*y + x*y - n
                a1 = x + y
                if a1*a1 - 4*a0 >= 0:
                    z = (-a1 + math.sqrt(a1*a1 - 4*a0)) / 2
                    if z - int(z+eps) == 0.0 and z > 0:
                        ans += 1
        print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

a = []
for i in range(10001):
    a.append(0)
for i in range(1,99):
    for j in range(1,99):
        if i*i + i*j + j*j > 10000:
            break
        for k in range(1,99):
            l = i*i + j*j + k*k + i*j + i*k + j*k
            if l > 10000:
                break
            a[l]+= 1
N = int(input())
for i in range(1,N+1):
    print(a[i])

Submission status: Accepted

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

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

Submission status: Accepted

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

import itertools
import math


def compute(n):
    res = [0 for _ in range(n + 1)]
    n_ub = math.ceil(math.sqrt(n) + 1.0)
    for x, y, z in itertools.product(range(1, n_ub + 1), repeat=3):
        m = x * x + y * y + z * z + x * y + y * z + z * x
        if 0 <= m <= n:
            res[m] += 1
    return res



def main():
    n = int(input())
    res = compute(n)
    print(*res[1:], sep="\n")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections

ans=[]
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            if tmp<=10000:
                ans.append(tmp)
                
c = collections.Counter(ans)

n=int(input())
for i in range(1,n+1):
    if i in c:
        print(c[i])
    else:
        print(0)

Submission status: Accepted

Solution code:
n = int(open(0).read())
from math import ceil
m = ceil((2*n)**0.5)

from collections import defaultdict

c = defaultdict(int)

for k in range(m):
    for i in range(1,k):
        for j in range(1,k-i):
            x,y,z=i,j,k-i-j
            if z>0:
                val = x**2+y**2+z**2+x*y+y*z+z*x
#                 print(x,y,z,val)
                c[val] += 1

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

Submission status: Accepted

Solution code:
import math
import itertools

n = int(input())
def f(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x
lim = 0
while lim**2+lim+4 <= n:
    lim += 1
tmp = list(range(1,lim+1))
# print(lim)
combList = list(itertools.combinations_with_replacement(tmp,3))
ansLis = [0] * (n+1)
for item in combList:
    tmp = f(item[0],item[1],item[2])
    if tmp > n:
        pass
    else:
        if item[0] == item[1] and item[1] == item[2]:
            ansLis[tmp] += 1
        elif item[0] == item[1] or item[1] == item[2] or item[2] == item[0]:
            ansLis[tmp] += 3
        else:
            ansLis[tmp] += 6
# print(ansLis)
for i in range(1,n+1):
    print(ansLis[i])

Submission status: Accepted

Solution code:
import itertools

n = int(input())

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

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


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

Submission status: Accepted

Solution code:
n = int(input())

ans = dict()
for x in range(1,10**2 + 1):
    for y in range(1,10**2 + 1):
        for z in range(1,10**2 + 1):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x

            current = ans.get(v, 0)
            ans.update({v: current+1})

for i in range(n):
    print(ans.get(i+1, 0))

Submission status: Accepted

Solution code:
from math import sqrt
l = [-1]+[0]*10**4
n = int(input())
for i in range(1,int(sqrt(n))+2):
    for j in range(1,int(sqrt(n))+2):
        for k in range(1,int(sqrt(n))+2):
            ans = i**2+j**2+k**2+i*j+j*k+k*i
            if ans <= 10**4:
                l[ans] += 1
for i in range(1,n+1):
    print(l[i])

Submission status: Accepted

Solution code:
n = int( input() )

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

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
lst = [0] * 10000
def kake(a, b, c):
    return a ** 2 + b ** 2 + c ** 2 + a * b + b * c + c * a
for i in range(1,50):
  for j in range(i, 60):
    for k in range(j, 110):
      m = kake(i, j, k)
      if m <= 10000:
        if i != j and j != k:
          lst[m - 1] += 6
        elif i == j and j == k:
          lst[m - 1] += 1
        else:
          lst[m - 1] += 3
for i in range(n):
  print(lst[i])

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())

c = Counter(x * x + y * y + z * z + x * y + y * z + z * x
        for x in range(1, 100) for y in range(1, 100) for z in range(1, 100))

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

Submission status: Accepted

Solution code:
import sys, math

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

def calcf(N):
    f_values = [0] * (N+1)
    root = math.floor(math.sqrt(N) )
    for x in range(1, root+1, 1):

        for y in range(x, root+1, 1):
            sum = x**2+y**2+x*y
            if(sum > N):
                break
            for z in range(y, root+1, 1):
                sum2 = z**2+y*z+z*x+ sum
                if(sum2 > N):
                    break
                else:
                    f_values[sum2] += calcN(x, y, z)
    return f_values

if(__name__ == "__main__"):

    N = int(input().strip())

    f_values = calcf(N)
    for i in range(1, N+1):
        print(f_values[i])

Submission status: Accepted

Solution code:
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time,itertools
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################
a = [0] * 10000
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            if (i ** 2) + (j ** 2) + (k ** 2) + (i * j) + (j * k) + (k * i) <= 10000:
                a[(i ** 2) + (j ** 2) + (k ** 2) + (i * j) + (j * k) + (k * i) - 1] += 1
    
def solve():
    global a
    n = inp()
    for i in range(n):
        print(a[i])
    
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)

def counter_elements(a):
    q = dict()
    for i in range(len(a)):
        if a[i] not in q:
            q[a[i]] = 0
        q[a[i]] = q[a[i]] + 1
    return(q)

def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q)
 
def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q)))))
 
def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

def transpose(a):
    n,m = len(a),len(a[0])
    b = [[0] * n for i in range(m)]
    for i in range(m): 
        for j in range(n): 
            b[i][j] = a[j][i]
    return(b)

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
    
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = {i:0 for i in range(100000)}
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            i = x**2 + y**2 + z**2 + x*y + y*z + z*x
            ans[i] += 1
for i in range(1, N+1):
    print(ans[i])

Submission status: Accepted

Solution code:
n=int(input())

lst=[0 for i in range(n+1)]

for x in range(1,int(n**0.5)):
    for y in range(1,x+1):
        if x**2+y**2+(x+y+1)**2+1>2*n : break
        for z in range(1,y+1):
            work=(x**2+y**2+z**2+(x+y+z)**2)//2
            if work>n: break
            if x==y and y==z : lst[work]+=1
            elif x==y or y==z or x==z : lst[work]+=3
            else : lst[work]+=6

for w in lst[1:]:
    print(w)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
N = int(input())

import numpy as np
import math as m
M = m.ceil(m.sqrt(N))
numbers = np.zeros(N)
for i in range(M):
    for j in range(M):
        for k in range(M):
            x = i + 1
            y = j + 1
            z = k + 1
            fn = x*x + y*y + z*z + x*y + y*z + z*x
            if fn >= 1 and fn <= N:
                numbers[fn - 1] += 1
for i in range(N):
    print(int(numbers[i]))

Submission status: Accepted

Solution code:
from itertools import permutations
from functools import reduce

n = int(input())

rn = int(n **.5) + 1

ptn = permutations([i for i in range(1, rn + 1)], 3)

ans = [0] * (n + 1)
for i in range(1, rn + 1):
  for j in range(1, rn + 1):
    for k in range(1, rn + 1):
      idx = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if idx <= n: 
        ans[i**2 + j**2 + k**2 + i*j + j*k + k*i] += 1

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

Submission status: Accepted

Solution code:
import math

N = int(input())
MAX = min(math.ceil(math.sqrt(N)),101)

d = {}
for i in range(10001):
    d[i] = 0

for x in range(1,MAX):
    for y in range(1,MAX):
        for z in range(1,MAX):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if tmp in d.keys():
                d[tmp] += 1
            else:
                d[tmp] = 1

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()

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

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
def main():

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

    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):
                n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if n > N:
                    continue

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
limit = 100
memo = {}

for a in range(1, limit):
  for b in range(1, limit):
    for c in range(1, limit):
      t = a**2 + b**2 + c**2 + a*b + b*c + c*a
      if not t in memo:
        memo[t] = 1
      else:
        memo[t] += 1
        
for i in range(1, N+1):
  if not i in memo:
    print(0)
  else:
    print(memo[i])

Submission status: Accepted

Solution code:
import sys
import numpy as np

# 実行環境(0:vscode, 1:atcoder)
MODE = 1

# 入力の次元
DIMENSION = 0

# int型に変換
INT_TYPE = 1

if not (MODE):
    with open("input.txt", "r") as f:
        s = f.read()
else:
    s = sys.stdin.read()

if DIMENSION == 0:
    if INT_TYPE == 1:
        s = int(s)
elif DIMENSION == 1:
    if INT_TYPE == 0:
        s = s.split()
    elif INT_TYPE == 1:
        s = [int(x) for x in s.split()]
elif DIMENSION == 2:
    if INT_TYPE == 0:
        s = [x.split() for x in s.splitlines()]
    elif INT_TYPE == 1:
        s = [[int(y) for y in x.split()] for x in s.splitlines()]

N = s
cnt = [0 for _ in range(N)]
for x in range(1, 100):
    xx = x*x
    for y in range(x, 100):
        yy = y * y
        xy = x*y
        for z in range(y, 100):
            zz = z * z
            yz = y * z
            zx = z*x
            n = xx + yy + zz + xy + yz + zx
            if n > N:
                break
            else:
                # print(f"({x}, {y}, {z}), n = {n}")
                if x == y and y == z:
                    cnt[n-1] += 1
                elif x == y or y == z:
                    cnt[n-1] += 3
                else:
                    cnt[n-1] += 6
for i in range(N):
    print(cnt[i])

Submission status: Accepted

Solution code:
import itertools
import decimal
import math
import collections
import sys
#input = sys.stdin.readline
import copy

# S=(input())
# N=int(input())
# N,K=map(int,input().split())
# ListA=list(map(int,input().split()))
# ListA.sort()#reverse=True)

def resolve():
    
    N=int(input())
    ans=[0]*(N+1)
    cnt=0
    for x in range(1,110):
        for y in range(1,110):
            for z in range(1,110):
                tmp=x**2+y**2+z**2+x*y+y*z+z*x
                if(tmp<=N):
                    ans[tmp]+=1


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



resolve()

Submission status: Accepted

Solution code:
from itertools import combinations_with_replacement

n = int(input())
res = [0] * n
for x, y, z in combinations_with_replacement(range(1, int(n**0.5)), 3):
    val = x**2 + y**2 + z**2 + x*y + y*z + z*x
    if val > n:
        continue
    if (l := len(set([x, y, z]))) == 1:
        res[val-1] += 1
    elif l == 2:
        res[val-1] += 3
    else:
        res[val-1] += 6
print('\n'.join(map(str, res)))

Submission status: Accepted

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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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


def read():
    N = int(input().strip())
    return N,


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


def solve(N):
    T = [0 for i in range(N+1)]
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                n = f(x, y, z)
                if n <= N:
                    T[n] += 1
    for i in range(1, N+1):
        print(T[i])


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
ans_list = [0 for i in range(N + 1)]
for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            now_num = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if now_num > N:
                break
            ans_list[now_num] += 1

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

Submission status: Accepted

Solution code:
n = int(input())
cnt = [0] * 10**5

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

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

Submission status: Accepted

Solution code:
N=int(input())
ans=[0]*(10**5)
L=list(i for i in range(1,100))

from itertools import*
P=list(product(L,repeat=3))
for x,y,z in P:
    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1

for a in ans[:N]:
    print(a)

Submission status: Accepted

Solution code:
n = int(input())

ans = [0 for i in range(n+1)]

for i in range(1,100):
  for j in range(1,100):
    for k in range(1,100):
      x = i**2+j**2+k**2 + i*j + j*k + k*i
      if x > n:
        continue
      ans[x] += 1
      # print (i,j,k)

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

Submission status: Accepted

Solution code:
import math

n = int(input())
lst = [0]*n
const = int(math.sqrt(n))

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

for x in range(1, const):
  for y in range(1, const):
    for z in range(1, const):
      s = x*x + y*y + z*z + x*y + y*z + z*x
      if s > n:
        continue
      else:
        lst[s-1] += 1

for i in lst:
  print(i)

Submission status: Accepted

Solution code:
n = int(input())
table = [0]*n
for x in range(1, 10**2+1):
    for y in range(1, 10**2+1):
        for z in range(1, 10**2+1):
            a = (x+y+z)**2 - x*y - y*z - z*x
            if a <= n:
                table[a-1] += 1
for a in table:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

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

for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            r = i**2 + j**2 + k**2 + i*j + j*k + i*k
            if r > len(Ret): print(r)
            Ret[r] += 1

for r in Ret[1:N+1]:
    print(r)

Submission status: Accepted

Solution code:
N=int(input())
A = [0 for _ in range(10001)]
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            h=x**2+y**2+z**2+x*y+y*z+z*x #2乗は**
            if h <= 10000:
                A[h]+=1;
                #print(x,y,z,h)
for i in range(1,N+1):
    print(A[i])

Submission status: Accepted

Solution code:
import math
n = int(input())
max = int(math.sqrt(n))

a = [0] * (n + 1)

for x in range(1,max+1):
    for y in range(1,max+1):
        for z in range(1,max+1):
            f = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if f <= n:
                a[f] += 1


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

Submission status: Accepted

Solution code:
N = int(input())
# = str(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]

counter = [0]*100001

for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            check = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if check > 0 and check % 1 == 0:
                counter[check-1] += 1

answer = counter[:N]

for i in answer:
    print(i)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
def func(x, y, z):
    ret = x**2 + y**2 + z**2 + x*y + y*z + z*x
    return ret

def main():
    n = int(input())
    cnt = [0 for _ in range(n+1)]

    for x in range(1, n):
        if func(x, x, x) > n:
            break
        for y in range(x, n):
            if func(x, y, y) > n:
                break
            for z in range(y, n):
                f = func(x, y, z)
                if f <= n:
                    if len({x, y, z}) == 1:
                        cnt[f] += 1
                    elif len({x, y, z}) == 2:
                        cnt[f] += 3
                    elif len({x, y, z}) == 3:
                        cnt[f] += 6
                else:
                    break

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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


def solve(N: int):
    from itertools import product
    from collections import defaultdict, Counter
    ans = defaultdict(int)
    def f(x_y_z):
        x, y, z = x_y_z
        return x * x + y * y + z * z + x * y + y * z + z * x
    c = Counter(map(f, product(range(1, 101), repeat=3)))    
    return [c[i] for i in range(1, N+1)]

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(*solve(N), sep="\n")

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Accepted

Solution code:
N=int(input())
ans_dist={}
for n in range(1,N+1):
    ans_dist[n]=0

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 + x*z
            if a <= N:
                ans_dist[a]+=1
            
for k in ans_dist.keys():
    print(ans_dist[k])

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

Submission status: Accepted

Solution code:
n=int(input())
ans=[0]*(10**7)
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      ans[(i**2+j**2+k**2+i*j+j*k+i*k)-1]+=1
for l in range(n):
  print(ans[l])