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:
# vim: fileencoding=utf-8


def main():
    N = int(input())
    ans = [0] * N
    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 + y * z + z * x - 1
                if t >= len(ans):
                    break
                ans[t] += 1

    print(*ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# aising2020_c.py
N = int(input())
ans=[0]*(N+1)
for i in range(1,int(N**0.5)):
    for j in range(1,int(N**0.5)):
        for k in range(1,int(N**0.5)):
            num = i**2+j**2+k**2+i*j+j*k+k*i
            if num<=N:
                ans[num] += 1
for i in ans[1:]:
    print(i)

Submission status: Accepted

Solution code:
# 総当たりでしたか....

def main():
    n = int(input())
    ans = [0] * (n + 1)
     
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                val = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if val <= n:
                    ans[val] += 1
     
    print(*ans[1:], sep="\n")
main()

Submission status: Accepted

Solution code:
import math
n=int(input())
z=0
d=0
ans=0
for i in range(1,n+1):
  for x in range(1,int(math.sqrt(n)+1)):
    for y in range(1,int(math.sqrt(n)+1)):
      d=x*x+y*y+2*x*y-4*(x*x+y*y+x*y-i)
      if d<0:
        continue
      z=(math.sqrt(d)-(x+y))/2
      if z.is_integer() and z>=1:
        ans+=1
      else:
        continue
  print(ans)
  ans=0

Submission status: Accepted

Solution code:
import itertools
import math
import collections
def main():
    n = int(input())
    s = int(math.sqrt(n))
    a = list(itertools.product(range(1,s),repeat=3))
    ans = []
    for i in range(len(a)):
        t = a[i][0] ** 2 + a[i][1] ** 2 + a[i][2] ** 2 + a[i][0] * a[i][1] + a[i][1] * a[i][2] + a[i][2] * a[i][0]
        ans.append(t)
        # print(ans)
    c = collections.Counter(ans)
    for i in range(1,n+1):
        print(c[i])
        
        
main()

Submission status: Accepted

Solution code:
N = int(input())

fn = [0] * (N+1)
for x in range(1,101):
    for y in range(1,101):
        if x**2 + y**2 + x*y >= N:
            break
        for z in range(1,101):
            val = x**2 + y**2 + z**2 + x*y+y*z+z*x
            if val > N:
                break
            fn[val] += 1

for v in fn[1:]:
    print(v)

Submission status: Accepted

Solution code:
import math

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

    rn = math.ceil(math.sqrt(N))

    for x in range(1,rn):
        for y in range(1,rn):
            for z in range(1,rn):
                k = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if k <= N:
                    ans[k-1] += 1
    
    for i in range(len(ans) - 1):
        print(ans[i])
    
main()

Submission status: Accepted

Solution code:
import math




N=int(input())

anslist=[0]*(N+1)
ma=int(math.sqrt(N))+1
for x in range(1,ma):
    for y in range(x,ma):
        for z in range(y,ma):
            n=x**2+y**2+z**2+x*y+y*z+z*x
            if n <=N:
                if x==y and y==z:
                    anslist[n]+=1
                elif x==y or y==z or z==x:
                    anslist[n]+=3
                else:
                    anslist[n]+=6

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

Submission status: Accepted

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


x = 1
y = 1
z = 1

ans = 6
first_judge = 1
ans_out = 0
#print("ans 6")

if N <= 5:
    for i in range(N):
        print(l[i])
else:
    while ans <= N:
        # print("x,y,z=",x,y,z)
        ans = (x + y + z)**2 - (x*y+ y*z + z*x)
        # print("ans",ans)
        if first_judge == 1 and ans > N:
            if ans_out >= 2:
                # print("break!")
                break
            else:
                x += 1
                y = x
                z = x
                ans_out += 1
                first_judge = 1
                ans = 0
                # print("x_++ x,y,z=",x,y,z)
                # print("first_judge=1")
                # print("ans_out=",ans_out)
        elif ans <= N:
            ans_out = 0
            if x==y==z:
                # print("x=y=z!")
                # print("first_judge=0")
                l[ans-1] += 1
                first_judge = 0
            elif x==y or y==z or z==x:
                # print("list in")
                # print("first_judge=0")
                l[ans-1] += 3
                first_judge = 0
            else:
                l[ans-1] += 6
                first_judge = 0
            z += 1
        else:
            y += 1
            z = y
            first_judge = 1
            ans_out += 1
            ans = 0
            # print("kousin x,y,z=",x,y,z)
            # print("first_judge=1")
            # print("ans_out=",ans_out)
            
        # print("\n")
        
    for i in range(N):
        print(l[i])

Submission status: Accepted

Solution code:
n = int(input())

lis = [0] * (n+1)


for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            t = i**2 + j**2 + k**2 + i*j + j*k + i*k
            tmp = [i,j,k]
            
            if t <= n:
                lis[t] += 1

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

Submission status: Accepted

Solution code:
n=int(input())
N=10**4+1
lst=[0]*N
s=0
for i in range(1,10**2+1):
    for j in range(1,10**2+1):
        for k in range(1,10**2+1):
            s=i**2+j**2+k**2+i*j+j*k+k*i
            if s<10**4+1:
                lst[s]+=1
for i in range(1,n+1):
    print(lst[i])

Submission status: Accepted

Solution code:
import numpy as np
#import functools
#import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm
#import collections as C #most_common
#import math
#import sympy

N = int(input())
#N,K,d= map(int,input().split())
#A = list(map(int,input().split()))
#S = str(input())
#T = str(input())

num=np.zeros(10**4+1)
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if ans < 10**4+1:
                num[ans]+=1


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

ans_list = []

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 <= 10000:
                ans_list.append(tmp)

ans_list = sorted(ans_list)

N = int(input())

c = collections.Counter(ans_list)

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

Submission status: Accepted

Solution code:
import itertools
import math
 
a = int(input())
cnt = 0
ans = [0]*100000
l = list(range(1,int(math.sqrt(a))))
 
for x,y,z in itertools.product(l, repeat=3):
    ans[x*x+y*y+z*z+x*y+y*z+z*x]+=1

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

Submission status: Accepted

Solution code:
N = int(input())
ls = [0]*(N+2)
 
for i in range(1,151):
    for j in range(1,151):
        for k in range(1,151):
            t = i*i + j*j + k*k + i*j + j*k + k*i 
            if t <= N :
                ls[t] += 1
 
for p in range(1,N+1):
    print(ls[p])

Submission status: Accepted

Solution code:
n = int(input())
A = [0]*10**7

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            A[x**2+y**2+z**2+x*y+y*z+z*x] += 1
                
print(*A[1:n+1],sep='\n')

Submission status: Accepted

Solution code:
N = int(input())
ls = [0]*(N+2)

for i in range(1,151):
    for j in range(1,151):
        for k in range(1,151):
            t = i*i + j*j + k*k + i*j + j*k + k*i 
            if t <= N :
                ls[t] += 1

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

Submission status: Accepted

Solution code:
n = int(input())
ans = [0]*(6*10**4)
for x in range(1, 10**2+1):
    for y in range(x, 10**2+1):
        for z in range(y, 10**2+1):
            cal = x*x + y*y + z*z + x*y + y*z + z*x
            if x == y and y == z:
                ans[cal-1] += 1
            elif x == y or y == z:
                ans[cal-1] += 3
            else:
                ans[cal-1] += 6
for i in range(n):
    print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
def solve(n):
  l = [0]*(n**3)
  for x in range(1,n+1):
    for y in range(1,n+1):
      for z in range(1,n+1):
        l[x**2+y**2+z**2+x*y+y*z+z*x] += 1
  return l
l = solve(100)
print(*l[1:n+1])

Submission status: Accepted

Solution code:
n = int(input())
x = 1
y = 1
z = 1
a = [0]*(10**5)
for j in range(x,101):
    for k in range(y,101):
      for l in range(z,101):
        a[j**2+k**2+l**2+j*k+k*l+l*j]+=1
for i in range(1,n+1):
  print(a[i])

Submission status: Accepted

Solution code:
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):
            num = pow(x, 2) + pow(y, 2) + pow(z, 2) + \
                (x * y) + (y * z) + (z * x)
            if num <= N:
                ans[num] += 1
for i in ans[1:]:
    print(i)

Submission status: Accepted

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


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


N = int(input())

ans = [0 for _ in range(N)]
lim = 101
for x in range(1, lim):
    for y in range(1, lim):
        for z in range(1, lim):
            A = f(x, y, z)
            if A <= N:
                ans[A-1] += 1
for i in range(N):
    print(ans[i])

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

Submission status: Accepted

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

n=int(input())
ans = [0]*int(1e5+1)
for x in range(1,10**2+1):
    for y in range(1,10**2+1):
        for z in range(1,10**2+1):
            ans[x*x + y*y + z*z + x*y + y*z + z*x]+=1
print(*ans[1:n+1])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def checker():
    ans = [0] * 10001
    for a in range(1, 101):
        for b in range(1, 101):
            for c in range(1, 101):
                n = a * a + b * b + c * c + a * b + b * c + c * a
                if n > 10000:
                    continue
                else:
                    ans[n] += 1
    return ans


def main():
    N = int(input().strip())
    ans = checker()
    for n in range(1, N + 1):
        print(ans[n])
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

counter = [0] * 10001
for x in range(1, 100+1):
    n1 = x * x
    if n1 >= N:
        continue
    for y in range(x, 100+1):
        n2 = n1 + y * y + x * y
        if n2 >= N:
            continue
        for z in range(y, 100+1):
            n = n2 + z * z + y * z + z * x
            if 1 <= n <= 10000:
                if x == y and y == z:
                    counter[n] += 1
                elif x == y or y == z:
                    counter[n] += 3
                else:
                    counter[n] += 6
for i in range(1, N+1):
    print(counter[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = [0 for _ in range(N+1)]
for x in range(1,101):
  for y in range(x, 101):
    for z in range(y , 101):
      f = x**2 + y**2 + z**2 +x*y + y*z + z*x
      if f > N:
        break
      if x==0 or y==0 or z==0:
        continue
      if x==y and y==z:
        
        ans[f] += 1
      elif x==y or y==z or z==x:
        
        ans[f] += 3
      else:
        
        ans[f] += 6
for a in ans[1:]:
  print(a)

Submission status: Accepted

Solution code:
#!python3

LI = lambda: list(map(int, input().split()))

# input
N = int(input())

MAX = 10 ** 2


def main():
    l = [0] * (N + 1)
    for x in range(1, MAX + 1):
        for y in range(1, MAX + 1):
            for z in range(1, MAX + 1):
                v = (x + y + z) ** 2 - (x * y + y * z + z * x)
                if v <= N:
                    l[v] += 1
    for ans in l[1:]:
        print(ans)
        

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
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 print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True

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

def main():
    N = I()
    ans = defaultdict(int)

    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[f(x, y, z)] += 1

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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 - 1
            if a <= 9999:
                num[a] += 1

num = num[:n]

for i in num:
    print(i)

Submission status: Accepted

Solution code:
import itertools
import math

a = int(input())
cnt = 0
ans = [0]*100000
l = list(range(1,int(math.sqrt(a))))

for x,y,z in itertools.product(l, repeat=3):
	ans[x*x+y*y+z*z+x*y+y*z+z*x]+=1

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

Submission status: Accepted

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

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):
            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
for i in range(n):
    print(ans[i])

Submission status: Accepted

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


N = int(input())
count = [0] * (N + 1)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            cur = g(x, y, z)
            if cur <= N:
                count[cur] += 1
for i in range(1, N + 1):
    print(count[i])

Submission status: Accepted

Solution code:
n = int(input())
fn = [0] * (n+1)
def f(x, y, z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x 

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            idx = f(x, y, z)
            if idx <= n:
                fn[idx] += 1
for i in range(1, n+1):
    print(fn[i])

Submission status: Accepted

Solution code:
n = int(input())
cnt = [0] * (1 + n)
for a in range(1, 100):
    for b in range(1, 100):
        for c in range(1, 100):
            k = a ** 2 + b ** 2 + c ** 2 + a * b + b * c + c * a
            if k > n:
                continue
            else:
                cnt[k] += 1
for i in range(1, n + 1):
    print(cnt[i])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from collections import deque
from decimal import *
import queue

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

def main():
	N = inputInt()

	ans = [0 for i in range(N)]
	for x in range(1,100+1):
		for y in range(1,100+1):
			for z in range(1,100+1):
				tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x

				if tmp <= N:
					ans[tmp-1] += 1

	for i in ans:
		print(i)
		
if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            index = x * x + y * y + z * z + x * y + y * z + z * x - 1
            if index > N:
                break
            answer[index] += 1
            

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

Submission status: Accepted

Solution code:
from collections import defaultdict
import math
n=int(input())
d=defaultdict(int)

if n>2:
    m=int(math.sqrt(n))
    for k in range(1,m):
        for i in range(1,m):
            for j in range(1,m):
                N=i*i+j*j+k*k+i*j+j*k+k*i
                d[N]+=1
for i in range(1,n+1):
    print(d[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np


def calc(n):
#     lim = int((n - 2) ** 0.5 - 1) + 1
    lim = 130

    result = np.zeros(n + 1, dtype=int)
    for x in range(1, lim):
        for y in range(x, lim):
            for z in range(y, lim):
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index > n:
                    continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]


for i in calc(int(input())):
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
 
ans = [0] * (n+1)
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 ans[1:]:
    print(i)

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
            Ret[r] += 1

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

Submission status: Accepted

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

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            val = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if val <= n:
                ans[val] += 1

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

Submission status: Accepted

Solution code:
import math
N = int(input())
fn = {i+1:0 for i in range(N)}
rtN = int(math.sqrt(N))+1

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

for x in range(1, rtN):
    for y in range(1, rtN):
        for z in range(1, rtN):
            n_ = n(x,y,z)
            try:
                fn[n_] += 1
            except KeyError:
                pass

for k in fn.values():
    print(k)

Submission status: Accepted

Solution code:
N = int(input())

import collections

count = collections.defaultdict(int)


for x in range(1, 10000):
    for y in range(1, 10000):
        if x*x + y*y + 1 + x*y + y + x > 10000:
            break
        for z in range(1, 100000):
            n = x*x + y*y + z*z + x*y + y*z + z*x
            if n > 10000:
                break
            else:
                count[n] += 1
# print(count)

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

Submission status: Accepted

Solution code:
import numpy as np


def calc(n):
    #     lim = int((n - 2) ** 0.5 - 1) + 1
    lim = 130

    result = np.zeros(n + 1, dtype=int)
    for x in range(1, lim):
        for y in range(1, lim):
            if x > y:
                continue
            for z in range(1, lim):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index > n:
                    continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]


for i in calc(int(input())):
    print(i)

Submission status: Accepted

Solution code:
N=int(input())
cnt=[0]*(N+1)
li=[]
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            li.append(x**2+y**2+z**2+x*y+y*z+z*x)
for i in li:
    if i<=N:
        cnt[i]+=1
for i in range(1,N+1):
    print(cnt[i])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
cnt = [0] * (1 + n)
for a in range(1, 100):
    for b in range(1, 100):
        for c in range(1, 100):
            k = a ** 2 + b ** 2 + c ** 2 + a * b + b * c + c * a
            if k > n:
                continue
            else:
                cnt[k] += 1
for i in range(1, n + 1):
    print(cnt[i])

Submission status: Accepted

Solution code:
import math

n=int(input())

def culc(i,j,k):
    return i**2+j**2+k**2+i*j+j*k+k*i


ans=[0]*(n+1)

limit=math.ceil(n**0.5)
for x in range(1,limit+1):
    for y in range(1,limit+1):
        for z in range(1,limit+1):
            temp=culc(x,y,z)
            if temp<=n:
                ans[temp]+=1

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

Submission status: Accepted

Solution code:
n = int(input())

ans = [0] * (n+1)
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 ans[1:]:
    print(i)

Submission status: Accepted

Solution code:
import itertools
N = int(input())
rng = int(-(-N**0.5//1))
pat_list = list(itertools.product(range(1,rng),repeat=3))
cnt_list = [0 for i in range(rng**2*6)]
for X, Y, Z in pat_list:
    cnt_list[X**2+Y**2+Z**2+X*Y+Y*Z+Z*X] += 1

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

Submission status: Accepted

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

def main():
    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):
                f = x * x + y * y + z * z + x * y + y * z + z * x
                if f < N + 1:
                    ans[f] += 1
    ans.remove(0)
    print('\n'.join(map(str, ans)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

l = [0]*N
for i in range(int(N**(1/2))):
    for j in range(int(N**(1/2))):
        for k in range(int(N**(1/2))):
            a = (i+1)**2 + (j+1)**2 + (k+1)**2 + (i+1)*(j+1) + (j+1)*(k+1) + (k+1)*(i+1)
            if a > N:
                break
            l[a-1] = l[a-1] + 1

for c in range(N):
    print(l[c])

Submission status: Accepted

Solution code:
N=int(input())

ans=[0]*N

for i in range(1,int(N**0.5)):
    if i**2 >=N:
        break
    for j in range(1,int(N**0.5)):
            if i**2+j**2+i*j>=N:
                break
            for k in range(1,int(N**0.5)):
                    if i**2+j**2+k**2+i*j+j*k+k*i <=N:
                        ans[i**2+j**2+k**2+i*j+j*k+k*i-1] +=1

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

Submission status: Accepted

Solution code:
from collections import defaultdict
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())

    ans = defaultdict(int)
    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
                ans[n] += 1

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


main()

Submission status: Accepted

Solution code:
from math import sqrt

n = int(input())
lim_n = int(sqrt(n*2))
result = [0] * n

for i in range(2, lim_n+1):
    for j in range(2, i+1):
        for k in range(2, j+1):
            p = i**2+j**2+k**2
            if p > 2*n:
                break
            if p % 2 == 1:
                continue
            if (j + k) - i < 2:
                continue
            if i == j and j == k:
                if i  % 2 ==1:
                    continue
                result[p//2-1] += 1
            elif i != j and j != k:
                result[p//2-1] += 6
            else:
                result[p//2-1] += 3

for item in result:
    print(item)

Submission status: Accepted

Solution code:
n=int(input())
lst=[0]*10000000
for i in range(1, 101):
  for j in range(1, i+1):
    for k in range(1, j+1):
      temp=i**2+j**2+k**2+i*j+j*k+k*i
      if i==j and j==k:
        lst[temp+1]+=1
      elif i==j and j!=k:
         lst[temp+1]+=3
      elif j==k and k!=i:
         lst[temp+1]+=3
      elif k==i and i!=j:
         lst[temp+1]+=3
      elif i!=j and j!=k and k!=i:
         lst[temp+1]+=6
for p in range(1, n+1):
  print(lst[p+1])

Submission status: Accepted

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

import math

n = int(input())

result = [0] * (n + 1)
border = 0
if n>=3:
    border = int(math.sqrt(n - 2))
for x in range(1, border):
    for y in range(1, border):
        for z in range(1, border):
            r = ((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2) // 2
            if r > n:
                break
            else:
                result[r] += 1

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

Submission status: Accepted

Solution code:
N=int(input())
import math
ans=[0]*(N+1)
n=int(math.sqrt(N))+1
for i in range(1,n+1):
    if i*i +2*i >N:
        break
    for j in range(1,n+1):
        if i*i+j*j+i*j>N:
            break
        for k in range(1,n+1):
            if i*i+j*j+k*k+i*j+j*k+i*k>N:
                break
            else:
                #print(i*i+j*j+k*k+i*j+j*k+i*k,i,j,k)
                ans[i*i+j*j+k*k+i*j+j*k+i*k]+=1
for i in range(len(ans)):
    if i!= 0:
        print(ans[i])

Submission status: Accepted

Solution code:
N = int(input())
L=[0]*N
for x in range(1,200):
    for y in range(x,200):
        for z in range(y,200):
            f=x**2+y**2+z**2+x*y+y*z+z*x
            if f<=N:
                #print(f,x,y,z)
                if x==y==z:
                    L[f-1]+=1
                    #print(f,x,y,z)
                elif x!=y and y!=z and y!=z:
                    L[f-1]+=6
                else:
                    L[f-1]+=3
                    #print(f,x,y,z)
for i in range(N):
    print(L[i])

Submission status: Accepted

Solution code:
a = int(input())
b = round(a**0.5) + 1
x = []
for i in range(1,b):
    for j in range(1,b):
        for k in range(1,b):
            l = i**2 + j**2 + k**2 + i*j + j*k + k*i
            x.append(l)

t = [0] * a
for i in range(0,len(x)):
    if x[i] <= a:
        t[x[i]-1] = t[x[i]-1] + 1

for i in t:
    print(i)

Submission status: Accepted

Solution code:
def fx(n):
  s = [0]*(n+1)
  for i in range(1,10000):
    if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
    for j in range(1, 10000):
      if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
      for k in range(1, 10000):
        if (1+1+k)**2 - 1*1 - 1*k - k*1 > n: break
        formula = (i+j+k)**2 - i*j - j*k - k*i
        if formula <= n and formula > 0:
          s[formula] += 1
        if formula >= n:
          break
  return s


n = int(input())
s = fx(n)
for i in range(1,n+1):
  print(s[i])