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
N = int(input())
ans = [0]*(N+1)
owari = math.sqrt(N)
owari = math.ceil(owari)
for x in range(1, owari):
    a = x*x
    for y in range(1, owari):
        b = y*y
        c = x*y
        for z in range(1, owari):
            hantei = z*(z+x+y)+a+b+c
            if hantei > N:
                break
            ans[hantei] += 1

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

Submission status: Accepted

Solution code:
n = int(input())

table = [0] * 10001

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            k = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x)
            if k < 10001:
                table[k] += 1

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

Submission status: Accepted

Solution code:
n = int(input())
ans = [0 for i in range(20000)]
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])

Submission status: Accepted

Solution code:
n = int(input())
ans = [0] * n
if n >= 100: N = 100
else: N = n
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:
                ans[a-1] += 1
for i in ans: print(i)

Submission status: Accepted

Solution code:
#create date: 2020-08-07 07:31

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()

    ans = [0] * (10**8 + 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):
                k = x**2 + y**2 + z**2 + x*y + y*z + z*x
                ans[k] += 1
    for k in range(1, n+1):
        print(ans[k])

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
C = {i:0 for i in range(1,N+1)}
for x in range(1,142):
    for y in range(1,142):
        for z in range(1,142):
            k = (x+y)**2+(y+z)**2+(z+x)**2
            if k%2==0 and k//2<=N:
                C[k//2] += 1
for i in range(1,N+1):
    print(C[i])

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):
            n = x*x + y*y + z*z + x*y + y*z + z*x
            if n <= N:
                ans[n] += 1
print(*ans[1:], sep='\n')

Submission status: Accepted

Solution code:
n = int(input())
ansl = [0]*(n+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):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x 
            if v <= n:
                ansl[v] += 1

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

Submission status: Accepted

Solution code:
N = int(input())
ans = [0]*(1+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):
            v = x*x+y*y+z*z+x*y+y*z+z*x
            
            if v<=N:
                ans[v] += 1

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

Submission status: Accepted

Solution code:
N = int(input())
res=[0 for _ in range(10050)]
for x in range(1,105):
    for y in range(1,105):
        for z in range(1,105):
            k=x*x+y*y+z*z+x*y+y*z+z*x
            if k<10050:
                res[k]+=1
for i in range(N):
    print(res[i+1])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
ans = [0]*(N+1)
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 > N:
                continue
            ans[tmp]+=1
for i in range(1,N+1):
    print(ans[i])

Submission status: Accepted

Solution code:
N=int(input())
ans=[0 for a in range(11000)]
for i in range(1,101):
  for x in range(1,101):
    for y in range(1,101):
      v=x*x+y*y+i*i+x*y+y*i+i*x
      if v<=N:
        ans[v]+=1
for b in range(1,N+1):
  print(ans[b])

Submission status: Accepted

Solution code:
N = int(input())
n_list = []
count = 1
max_val = 1
res = 0
for x in range(1,100):
    for y in range(x,100):
        for z in range(y,100):
            res = x**2 +y**2 + z**2 + x*y + y*z + z*x
            for i in range(int(x!=y) + int(y!=z) + int(z!=x)-1):
                count *= 3-i
            if max_val < res:
                for i in range(max_val, res+1):
                    if i != res: n_list.append(0)
                    else: n_list.append(count)
                max_val = res+1
            else:
                n_list[res-1] += count
            count = 1

            

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

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())

d = defaultdict(int)

for x in range(1,100):
    for y in range(x,100):
        for z in range(y,100):
            n = x**2+y**2+z**2+x*y+y*z+z*x
            if x == y == z:
                d[n] += 1
            elif x == y or y == z or z == x:
                d[n] += 3
            else:
                d[n] += 6
            
            if n > N:
                break

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

Submission status: Accepted

Solution code:
n=int(input())
from collections import defaultdict
d=defaultdict(int)
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            d[i**2+j**2+k**2+i*j+j*k+k*i]+=1
for i in range(1,n+1):
    print(d[i])

Submission status: Accepted

Solution code:
n = int(input())
ans = [0] * 10050
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      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])

Submission status: Accepted

Solution code:
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+j*k+k*i
      if v<10050:
        ans[v]+=1
for i in range(n):
  print(ans[i+1])

Submission status: Accepted

Solution code:
n=int(input())
j=10501
l=[0 for i in range(j)]
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      v=x*x+y*y+z*z+y*x+x*z+z*y
      if(v<j):
        l[v]+=1
for i in range(n):
  print(l[i+1])

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

ans = []

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

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            s = x*x + y*y + z*z
            s += x*y + y*z + z*x
            if (s > n) : continue
            ans[s] += 1

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

Submission status: Accepted

Solution code:
nn=int(input())
nc = [0] * (nn + 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 + x * z + y * z
      if a > nn:
        break
      nc[a] += 1
for i in range(1, nn + 1):
  print(nc[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = [0 for i in range(10100)]

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

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    d = [0 for _ in range(N)]
    r = 100
    ii = 0
    for i in range(1, r):
        ii += 2* i - 1
        for j in range(1, i + 1):
            s = i + j
            c = ii + s * j
            l = 6
            if i == j:
                l = 3
            if c + 1 + s > N:
                break
            for k in range(1, j + 1):
                c += 2* k - 1 + s
                if c <= N:
                    if j == k:
                        l = 3
                        if i == k:
                            l = 1
                    d[c - 1] += l
                else:
                    break
                    
    print("\n".join(map(str,d)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    dp = [0] * N
    rt = int(pow(N, 0.5)) + 1
    for i in range(1, rt):
        ii = i * i
        for j in range(1, i + 1):
            iji = ii + j * j + i * j
            if iji + 1 + i + j > N:
                break
            for k in range(1, j + 1):
                c = iji + k * k + (i + j) * k
                if c <= N:
                    if i == j or j == k:
                        l = 3
                        if i == k:
                            l = 1
                    else:
                        l = 6
                    dp[c - 1] += l
                else:
                    break
    print("\n".join(map(str,dp)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#! python3
# coding:utf-8
 
def main():
    n = int(input())
    ans = [0 for _ in range(n)]
    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if eq < n+1:
                    ans[eq-1]+=1
    for i in ans:   
        print(i)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
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**2 + j**2 + k**2 + i*j + j*k + k*i
      if v<10050:
        ans[v] += 1
for i in range(N):
  print(ans[i+1])

Submission status: Accepted

Solution code:
N = int(input())
n = round(N**0.5)
counter = [0]*N
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      f = i**2+j**2+k**2+i*j+j*k+k*i
      if f <= N:
        counter[f-1] += 1
for i in range(N):
  print(counter[i])

Submission status: Accepted

Solution code:
n = int(input())

li_ans = [0] * n

for a in range(1, 110):
    for b in range(1, 110):
        for c in range(1, 110):
            val = (a ** 2) + (b ** 2) + (c ** 2) + (a * b) + (b * c) + (c * a)
            if val <= n:
                li_ans[val - 1] += 1
for an in li_ans:
    print(an)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    X = 1
    Y = 1
    Z = 1

    a = [0]*(N+1)

    for x in range(1,101,1):
        if x**2 + Y**2 + Z**2 + x*Y + Y*Z + Z*x > N:
            break
        for y in range(1,101,1):
            if x**2 + y**2 + Z**2 + x*y + y*Z + Z*x > N:
                break
            for z in range(1,101,1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x <= N:
                    a[x**2 + y**2 + z**2 + x*y + y*z + z*x] += 1
                elif x**2 + y**2 + z**2 + x*y + y*z + z*x > N:
                    break
    for i in range(1,N+1,1):
        print(a[i])

main()

Submission status: Accepted

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

ans = [0] * N
n = int(math.sqrt(N)) 

for x in range(1, n+1):
    for y in range(1, x+1):
        for z in range(1, y+1):
            i = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if i <= N:
                if x == y == z:
                    ans[i-1] += 1
                elif x == y or y == z:
                    ans[i-1] += 3
                else:
                    ans[i-1] += 6

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

Submission status: Accepted

Solution code:
N = int(input())
arr = [0]*(N)
lim = int(N**0.5 + 1)
for i in range(1,lim):
    for j in range(1,lim):
        for k in range(1,lim):
            num = i**2 + j**2 + k**2 + i*j + j*k + k*i - 1
            if num <= N-1:
                arr[num] += 1

print(*arr, sep='\n')

Submission status: Accepted

Solution code:
N = int(input())

ans = [0]*80100
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+z*x] += 1

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

Submission status: Accepted

Solution code:
n = int(input())
ans = [0 for x in range(10001)]

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

Submission status: Accepted

Solution code:
n = int(input())
ans = [0 for _ in range(n+1)]

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

for i in range(1, math.ceil(math.sqrt(n))):
  for j in range(i, math.ceil(math.sqrt(n))):
    for k in range(j, math.ceil(math.sqrt(n))):
      tmp = f(i, j, k)
      if tmp > n:
        break
      else:
        if i == j and j == k:
          ans[tmp] += 1
        elif i == j or j == k:
          ans[tmp] += 3
        else:
          ans[tmp] += 6
        
for i in range(1, n+1):
  print(ans[i])

Submission status: Accepted

Solution code:
N = int(input())

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

for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            val = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if val <= 10**4:
                ans[val] += 1

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

Submission status: Accepted

Solution code:
n = int(input())

f = [0] * (n+1)

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

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

Submission status: Accepted

Solution code:
ans = [0] * 10000
for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      k = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
      if k > 10000:
        break
      ans[k - 1] += 1

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
NUM = [0] * 500000
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            nya = x**2 + y**2 + z**2 + x*y + y*z + z*x
            NUM[nya] += 1
n = I()
for i in range(1,n+1):
    print(NUM[i])

Submission status: Accepted

Solution code:
def solve():
  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):
        left = x*x+y*y+z*z+x*y+y*z+z*x
        if left<=N:
          ans[left] += 1
  return ans[1:]
print(*solve(),sep='\n')

Submission status: Accepted

Solution code:
# 2020/07/27
# エイシング プログラミング コンテスト 2020 - C

# Input
n = int(input())
alist = [0] * (n + 1)

# Calc
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            calc_n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if calc_n <= n:
                alist[calc_n] = alist[calc_n] + 1
            else:
                break

# Output
for i in range(1, n+1):
    print(alist[i])

Submission status: Accepted

Solution code:
N = int(input())
from collections import Counter
c = Counter()
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
            c[n] += 1
for i in range(1,N+1):
    print(c[i])

Submission status: Accepted

Solution code:
N = int(input())
L = [0]*10001
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 <= 10000:
                L[x**2 + y**2 + z**2 + x*y + y*z +z*x] += 1
for k in range(1,N+1):
    print(L[k])

Submission status: Accepted

Solution code:
N = int(input())
C = {i:0 for i in range(1,N+1)}
for x in range(1,142):
    for y in range(1,142):
        for z in range(1,142):
            a = (x+y)**2+(y+z)**2+(z+x)**2
            if a%2==0 and a//2<=N:
                C[a//2] += 1
for i in range(1,N+1):
    print(C[i])

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

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

Submission status: Accepted

Solution code:
import itertools
n = int(input())

ans = [0] * n
for v in itertools.product(list(range(1,101)), repeat=3):
    x,y,z = v[0], v[1], v[2]
    a = x*x + y*y + z*z + x*y + y*z + z*x
    if a <= n:ans[a-1] += 1
    else: continue
for i in ans: print(i)

Submission status: Accepted

Solution code:
n = int(input().rstrip())

ans = [0 for x in range(10000)]
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      f = ((x+y)**2 + (y+z)**2 + (z+x)**2)//2
      if f <= 10000:
        ans[f-1] += 1

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

Submission status: Accepted

Solution code:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            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])

Submission status: Accepted

Solution code:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

def get_ans(n):
  cnt = 0
  for x in range(1, 101):
    for y in range(1, 101):
      for z in range(1, 101):
        k = x**2 + y**2 + z**2 + x*y + y*z + z*x
        if(k <= 10000):
          ans[k] += 1        
  return ans

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
import itertools

N = int(input())

ans = [0] * (100**2)
for x, y, z in itertools.product(range(1, 101), repeat=3):
    n = x**2 + y**2 + z**2 + x * y + y * z + z * x
    if  n <= 100**2:
        ans[n - 1] += 1

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

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = [0]*(N+1)
Nruto = math.sqrt(N)
Nruto = math.floor(Nruto)+1
for x in range(1, Nruto):
    for y in range(1, Nruto):
        for z in range(1, Nruto):
            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])

Submission status: Accepted

Solution code:
n=int(input())
k=int(n**0.5)+1
a=[0 for i in range(n+1)]
for x in range(1,k):
    for y in range(1,k):
        for z in range(1,k):
            g=x*x+y*y+z*z+x*y+y*z+x*z
            if g<=n:
                a[g]+=1
print(*a[1:],sep='\n')

Submission status: Accepted

Solution code:
n = int(input())

res = [0] * (n+1)
x = 1
while x*x <= n:
  y = 1
  while y*y <= n:
    z = 1
    while z*z <= n:
      w = x*x+y*y+z*z+x*y+y*z+z*x
      if w <= n:
        res[w] += 1
      z += 1
    y += 1
  x+= 1
  
for i in range(1,n+1):
  print(res[i])

Submission status: Accepted

Solution code:
N = int(input())

#長さN, Mまでの数字を用いてtmpから始まる短調増加数字列（1123,1234など）を全て出力
from collections import deque
from collections import defaultdict
d = defaultdict(int)
n,m=3,100
y = [[x] for x in range(1,50+1)]
tmp=deque(y)
out=0
while tmp:
    T=tmp.pop()
    if len(T) < n:
        for i in range(int(T[-1]),m+1):
            tmp.append(T+[i]) 
    else:
        ans = int((sum(T))**2-(T[0]*T[1]+T[1]*T[2]+T[2]*T[0]))
        if ans <= 10000:
            if T[0] == T[1] and T[1] == T[2]:
                plus = 1
            elif T[0] == T[1] or T[1] == T[2]:
                plus = 3
            else:
                plus = 6
            d[ans] += plus
            
for i in range(N):
    print(d[i+1])

Submission status: Accepted

Solution code:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    a = [0] * 10100
    for i in range(1, 105):
        for j in range(1, 105):
            for k in range(1, 105):
                m = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i - 1
                if m < 10050:
                    a[m] += + 1
    for s in range(n):
        print(a[s])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ans = [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):
                s = x**2 + y**2 + z**2 + x*y + y*z + z*x

                if 1 <= s <= N:
                    ans[s] += 1

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ans = [0 for i in range(N + 1)]

    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                s = x**2 + y**2 + z**2 + x*y + y*z + z*x

                if 1 <= s <= N:
                    ans[s] += 1

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
ans=0
cnt=[0]*500000
#print(2*10**2)
for i in range(1,2*10**2+1):
    for j in range(1,2*10**2+1):
        for k in range(1,2*10**2+1):
            cnt[((i+j)**2+(j+k)**2+(k+i)**2)//2-1]+=1
for i in range(n):
    print(cnt[i])

Submission status: Accepted

Solution code:
N=int(input())
ans=[0 for _ in range(10001)]
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            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])

Submission status: Accepted

Solution code:
n = int(input())

A = [0]*12000

for i in range(1,101):
    for j in range(1, 101):
        for k in range(1, 101):
            val = i**2 + j**2 + k**2 + i*j + i*k + j*k
            if val < 12000:
                A[i**2 + j**2 + k**2 + i*j + i*k + j*k] += 1

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

Submission status: Accepted

Solution code:
import math

N = int(input())
ans = [0] *(N+1)
a = int(math.sqrt(N)) + 1

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

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
from collections import defaultdict
N = int(input())
d = 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
            d[n]+=1
for i in range(1,N+1):
    print(d[i])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from itertools import accumulate
import copy


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()


def C(line):
    return [sys.stdin.readline()[:-1] for _ in range(line)]


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

Submission status: Accepted

Solution code:
N = int(input())

f = [0 for i in range(N)]

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

Submission status: Accepted

Solution code:
N = int(input())

# f(n)を事前に計算
f = {}

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
            f[n] = f.get(n, 0) + 1

for i in range(1, N+1):
    print(f.get(i, 0))

Submission status: Accepted

Solution code:
N = int(input())

f = [0 for i in range(N)]

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

Submission status: Accepted

Solution code:
def f(x, y, z):
    return x**2+y**2+z**2+x*y+y*z+z*x
n = int(input())
ans = {}
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            tmp = f(x, y, z)
            if tmp > n:
                break
            else:
                if tmp not in ans:
                    ans[tmp] = 1
                else:
                    ans[tmp] += 1

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

Submission status: Accepted

Solution code:
n = int(input())

ans = [0 for _ in range(10001)]

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

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

Submission status: Accepted

Solution code:
# coding:utf-8
n = int(input())
ans = [0] * n

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

for item in ans:
    print(item)

Submission status: Accepted

Solution code:
def main():
    import math

    N = int(input())
    
    ans_list = [0 for i in range(N)]
    
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):

                left_eq = x * x + y * y + z * z + x * y + y * z + z * x
                if (left_eq <= N):
                    ans_list[left_eq - 1] += 1
    
    for i in range(N):
        print(ans_list[i])

if __name__ == '__main__':
    main()

Submission status: Accepted

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

import math
from collections import defaultdict,deque
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""
n=ii()
d=defaultdict(int)
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            w=i*i+j*j+k*k+i*j+i*k+j*k
            d[w]+=1
for i in range(1,n+1):
    print(d[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

ans = [0 for _ in range(10050)]

for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
           v = (i+j+k)**2 - (i*j + j*k + k*i)
           if v < 10050:
            ans[v] += 1

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