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:
n=int(input())
l=[0]*(10**5)
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**2+y**2+z**2+x*y+y*z+z*x
            l[a]+=1
for j in range(1,n+1):
    print(l[j])

Submission status: Accepted

Solution code:
def main():
    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):
                k = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                L[k] += 1 
    for i in range(1, n+1):
        print(L[i])
main()

Submission status: Accepted

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
data = [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):
            ans = x**2+y**2+z**2+x*y+y*z+z*x
            if ans<= N:
                data[ans]+=1
            else:
                break
for i in range(1,N+1):
    print(data[i])

Submission status: Accepted

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

N=int(input().rstrip('\n'))
n = math.floor(math.sqrt(N))
res_dict={i:0 for i in range(1,N+1)}
for x in range(1,n):
  for y in range(1,n):
    for z in range(1,n):
      ans = x**2 +y**2+z**2+x*y+y*z+x*z
      if ans in res_dict:
        res_dict[ans] += 1
      else:
        res_dict[ans] = 1
for i in range(1,N+1):
  print(res_dict[i])

Submission status: Accepted

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

ans = [0] * N

for i in range(1, int(math.sqrt(N))+1):
    for j in range(1, int(math.sqrt(N)+1)):
        for k in range(1, int(math.sqrt(N)+1)):
            tmp = (i+j+k)**2 - (i*j + j*k + k*i)
            if tmp <= N:
                ans[tmp-1] += 1

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

Submission status: Accepted

Solution code:
N = int(input())

from math import sqrt
from collections import defaultdict
ans = defaultdict(int)
k = int(sqrt(N)) + 5
for x in range(1, k):
    for y in range(1, k):
        for z in range(1, k):
            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:
FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()

    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]

N = rri()
# 
ans = [0 for i in range(N)]
for i in range(1, 105):
    for j in range(1, 105):
        for k in range(1, 105):
            if i*i + j*j+k*k+i*j+j*k+i*k<=N:
                ans[i*i + j*j+k*k+i*j+j*k+i*k-1]+=1
for i in ans:
    print i

Submission status: Accepted

Solution code:
def cin():
    return input().split()
n = int(input())
a = []
for i in range(10001):
    a.append(0)
for x  in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            res = x*x + y*y + z*z + x*y + y*z + z*x
            if res <= 10000:
                a[res] += 1
for i in range(1,n+1):
    print(a[i])

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    
    res = [0]*(n+1)

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



    for i in range(1,n+1):
        print(res[i])
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

cnt = [0] * 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):
            num = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if num <= n:
                cnt[num - 1] += 1
print(*cnt, sep="\n")

Submission status: Accepted

Solution code:
import numpy as np


def main(N):
    f = [0]*(N+1)
    for x in range(100):
        for y in range(100):
            for z in range(100):
                if (x+y+2)**2+(x+z+2)**2+(z+y+2)**2 > 2*N:
                    break
                f[((x+y+2)**2+(x+z+2)**2+(z+y+2)**2)//2] += 1
    return f


N = int(input())
f = main(N)
for i in range(N):
    print(f[i+1])

Submission status: Accepted

Solution code:

N = int(input())

counter = [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
            try:
                counter[n - 1] += 1
            except:
                pass
            
for i in range(N):           
    print(counter[i])

Submission status: Accepted

Solution code:
N = int(input())

A = [0 for _ in range(N+1)]
n = int(N ** 0.5) + 1
for x in range(1, n):
    for y in range(1, n):
        for z in range(1, n):
            v = x*x + y*y + z*z + x*y + y*z + z*x
            if v <= N:
                A[v] += 1
for i in range(1, N+1):
    print(A[i])

Submission status: Accepted

Solution code:
results = [0 for i in range(10**5)]
for i in range(1, 10**2):
    for j in range(1, 10**2):
        for k in range(1, 10**2):
            n = i*i + j*j + k*k + i*j + j*k + k*i
            results[n] += 1

N = int(input())
for i in range(1, N+1):
    print(results[i])

Submission status: Accepted

Solution code:
N = int(input())

lst = [0] * 10001

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

Submission status: Accepted

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

N = ri()
f = [0] * N
for x in range(1,100+1):
    for y in range(1, 100+1):
        for z in range(1, 100+1):
            h = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if h > N:
                continue
            f[h - 1] += 1
for i in range(N):
    print(f[i])

Submission status: Accepted

Solution code:
N = int(input())

ans = [0]*(N+1)
for x in range(1, int(N**0.5)):
    for y in range(1, int(N**0.5)):
        for z in range(1, int(N**0.5)):
            S = x**2 + y**2 + z**2 + x*y + y*z + x*z
            if 1 <= S <= N:
                ans[S] += 1
            else:
                break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

A = [0] * (N + 1)

for x in range(1, int(math.sqrt(N))):
    for y in range(1, int(math.sqrt(N))):
        for z in range(1, int(math.sqrt(N))):
            ans = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if (ans > N):
                break
            else:
                A[ans] += 1


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

Submission status: Accepted

Solution code:
n=int(input())
k=int(n**0.5)+1
num=[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): 
      w=x**2+y**2+z**2+x*y+y*z+z*x
      if w<=n:
        num[w]+=1
for i in range(1,n+1):
  print(num[i])

Submission status: Accepted

Solution code:
n = int(input())
ans = [0 for i in range(10100)]
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            if x*x+y*y+z*z+x*y+y*z+z*x < 10001:
                ans[x*x+y*y+z*z+x*y+y*z+z*x-1] += 1

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

Submission status: Accepted

Solution code:
from collections import Counter
a_list = list(range(1,10**4+1))
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      a_list.append(i**2+j**2+k**2+i*j+j*k+k*i)
count = Counter(a_list)
N=int(input())
for i in range(N):
  print(count[i+1]-1)

Submission status: Accepted

Solution code:
n = int(input())

flist = [0]*(10**4+10)


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


for i in range(1, 101):
    for j in range(i, 101):
        for k in range(j, 101):
            s = cal(i, j, k)
            if s >= 10**4+5:
                break
            if i == j and j == k:
                flist[s] += 1
            elif i == j:
                flist[s] += 3
            elif j == k:
                flist[s] += 3
            else:
                flist[s] += 6
for i in range(1, n+1):
    print(flist[i])

Submission status: Accepted

Solution code:
n  = int(input())

c = {}
def f(x,y,z):
    return x**2+y**2+z**2+(x*y)+(y*z)+(z*x)

for i in range(1,n+1):
    t3 = f(i,1,1)
    if t3>n:
        break
    for j in range(i,n+1):
        t2 = f(i,j,1)
        if (t2>n):
            break
        for k in range(j,n+1):
            t = f(i,j,k)
            if t>n:
                break
            else:
                if t not in c:
                    c[t]=0
                if i==j and j==k:
                    c[t]+=1
                elif i==j or j==k or i==k:
                    c[t]+=3
                else:
                    c[t]+=6
for i in range(1,n+1):
    if i not in c:
        print(0)
    else:
        print(c[i])

Submission status: Accepted

Solution code:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
import numpy as np
# sympy as syp(素因数分解とか)
Mod = 1000000007
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1] 
for i in range(2, 10**5 + 1):
    fact.append((fact[-1] * i) % Mod)
    inv.append((-inv[Mod % i] * (Mod // i)) % Mod)
    factinv.append((factinv[-1] * inv[-1]) % Mod)
    
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p
    
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)
import string
def main():  #startline-------------------------------------------
    n = int(input())
    ans = [0 for i in range(n)]
    for i in range(1, int(np.sqrt(n + 1))):
        for j in range(1, int(np.sqrt(n + 1))):
            for k in range(1,int(np.sqrt(n + 1))):
                x = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
                if x <= n:
                    ans[x - 1] += 1
    for i in range(n):
        print(ans[i])
if __name__ == "__main__":
    main() #endline===============================================

Submission status: Accepted

Solution code:
n = int(input())

ans=[0]*(n+1)

def func():
    cnt=0
    for x in range(1,101):
        for y in range(x,101):
            for z in range(y,101):
                p=x**2+y**2+z**2+x*y+y*z+z*x
                if p<n+1:
                    if x==y and y==z:
                        ans[p]+=1
                    elif x==y or y==z:
                        ans[p]+=3
                    else:
                        ans[p]+=6
func()

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    cnt = [0] * 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<=10000:
                    cnt[v] += 1

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

main()

Submission status: Accepted

Solution code:
# coding: utf-8

def solve(*args: str) -> str:
    n = int(args[0])

    n_sqrt = -int(-pow(n, 0.5))
    A = [0]*(n+1)

    for x in range(1, n_sqrt):
        for y in range(1, n_sqrt):
            for z in range(1, n_sqrt):
                i = x*x+y*y+z*z+x*y+y*z+z*x
                if i <= n:
                    A[i] += 1

    return '\n'.join(map(str, A[1:]))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

th = 100
for x in range(1,th+1):
  for y in range(1,th+1):
    for z in range(1,th+1):
      val = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if val <= n:
        h[val-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
from itertools import combinations_with_replacement,product
li = list(product(range(1,101),repeat=3))
ans = [0]*10001

for k in li:
    if k[0]**2 + k[1]**2 + k[2]**2 + k[0]*k[1] + k[0]*k[2]+k[1]*k[2] < 10001:
        ans[k[0]**2 + k[1]**2 + k[2]**2 + k[0]*k[1] + k[0]*k[2]+k[1]*k[2]] += 1

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
ans=[0]*10**6
for i in range(1,int(N**0.5)+1):
    for j in range(1,int(N**0.5)+1):
        for k in range(1,int(N**0.5)+1):
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            ans[tmp]+=1
for i in range(1,N+1):
    print(ans[i])

Submission status: Accepted

Solution code:
n = int(input())

l = [0] * (n)

for i in range(1, 101):
  for j in range(1, 101):
    for k in range(1, 101):
      t = (i ** 2) + (j ** 2) + (k ** 2) + (i * j) + (j * k) + (i * k)
      if t > n:
        break
      l[t-1] += 1
for i in range(n):
  print(l[i])

Submission status: Accepted

Solution code:
N = int(input())

MAX = 100
from collections import defaultdict
d = defaultdict(int)
from itertools import product
for x, y, z in product(range(1, 1+MAX), repeat=3):
  t = x*x + y*y + z*z + x*y + y*z + z*x
  d[t] += 1

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

Submission status: Accepted

Solution code:
import math
n = int(input())
l =[0 for i in range(6*n+1)]

for i in range(1,int(math.sqrt(n))):
    for j in range(1,int(math.sqrt(n))):
        for q in range(1,int(math.sqrt(n))):
            
            l[i**2+j**2+q**2 +i*j +i*q+q*j]+=1
for i in range(1,n+1):
    print(l[i])

Submission status: Accepted

Solution code:
n = int(input())

ans=[0]*(n+100000)

import math
for x in range(1,int(math.sqrt(n+1)+1)):
    if x**2 > n:
        break
    for y in range(1,int(math.sqrt(n+1)+1)):
        if x**2 +y**2 + x*y> n:
            break
        for z in range(1,int(math.sqrt(n+1)+1)):
            calc = x**2+y**2+z**2+x*y+y*z+z*x
            ans[calc]+=1

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

Submission status: Accepted

Solution code:
N=int(input())

def func(x,y,z):
  return x*x+y*y+z*z+x*y+y*z+z*x

for i in range(1,N+1):
  answer_set=set()
  for x in range(int(i**0.5)+1):
    for y in range(1,x+1):      
      for z in range(1,y+1):
        if func(x,y,z)==i:
          answer_set.add((x,y,z))
          answer_set.add((x,z,y))
          answer_set.add((y,x,z))
          answer_set.add((y,z,x))
          answer_set.add((z,y,x))
          answer_set.add((z,x,y))
        elif func(x,y,z)>i:
          break
          
  print(len(answer_set))

Submission status: Accepted

Solution code:
N = int(input())
M = int(N**(1/2))+2

A = [0 for _ in range(N+1)]
for x in range(1, M):
    for y in range(1, M):
        for z in range(1, M):
            f = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if f <= N:
                A[f] += 1
for a in A[1:]:
    print(a)

Submission status: Accepted

Solution code:
N = int(input())
cap = 100
table = [0] * 10001

for x in range(1, cap):
    for y in range(1, cap):
        for z in range(1, cap):
            idx = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if idx <= 10000:
                table[idx] += 1

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

Submission status: Accepted

Solution code:
from math import sqrt
n = int(input())
X = [0] * (n+1)
for x in range(1, int(sqrt(n)) + 1):
    for y in range(1, int(sqrt(n)) + 1):
        if x**2 + y**2 + x*y + 3 > n:
            break
        t = x**2 + y**2 + x*y
        for z in range(1, int(sqrt(n)) + 1):
            s = t + z**2 + y*z + z*x
            if s <= n:
                X[s] += 1
            else:
                break
print(*X[1:], sep='\n')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

MAX = 10 ** 4 + 5


def main(input, print):
    N = int(input())
    ans = [0] * MAX
    for x in range(1, 99):
        for y in range(1, 99):
            for z in range(1, 99):
                a = x**2+y**2+z**2+x*y+y*z+z*x
                if a < MAX:
                    ans[a] += 1
    for i in range(1, N+1):
        print(ans[i])


if __name__ == '__main__':
    main(sys.stdin.readline, print)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

import math

ans = [0]*(n+1)
upper = math.ceil(math.sqrt(n))

for x in range(1,upper+1):
    for y in range(1,upper+1):
        for z in range(1,upper+1):
            tmp = pow((x+y),2)+pow((y+z),2)+pow((x+z),2)
            if tmp%2 == 0 and tmp//2 <= n:
                ans[tmp//2] += 1
                
print(*ans[1:])

Submission status: Accepted

Solution code:
n = int(input())

limit = 1
while limit * limit < n:
    limit += 1

results = [0] * n

for x in range(1, limit + 1):
    for y in range(1, limit + 1):
        for z in range(1, limit + 1):
            val = x * x + y * y + z * z + x * y + y * z + x * z
            if val <= n:
                results[val - 1] += 1

for v in results:
    print(v)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import math

n = int(input())
th = int(math.sqrt(n))
ans = [0 for _ in range(n)]
for x in range(1,th+1):
  for y in range(1,th+1):
    for z in range(1,th+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)

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

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
ctr = defaultdict(int)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            res = x**2 + y**2 + z**2 + x*y + y*z + z*x
            ctr[res] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
ans = defaultdict(int)

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
            if t > 10**4:
                break
            ans[t] += 1

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

Submission status: Accepted

Solution code:
import math
from collections import defaultdict

N = int(input())
D = defaultdict(int)

NN = math.floor(math.sqrt(N))
for x in range(1,NN+1):
    for y in range(1,NN+1):
        for z in range(1,NN+1):
            a = x * x + y * y + z * z + x * y + y * z + z * x
            if a <= N:
                D[a] += 1

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

Submission status: Accepted

Solution code:
N = int(input())


d={}


for a in range(100):
	for b in range(100):
		z=(a+1)**2+(b+1)**2+(a+1)*(b+1)
		for c in range(100):
			gokei=z+(c+a+3+b)*(c+1)
			if gokei in d:
				d[gokei]+=1
			else:
				d[gokei]=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
x = int(n**0.5)+1
cnt = [0]*(n+1)
for i in range(1,x):
    for j in range(1,x):
        for k in range(1,x):
            res = i**2+j**2+k**2+i*j+j*k+k*i
            if res <= n: cnt[res] += 1
for i in range(1,n+1): print(cnt[i])

Submission status: Accepted

Solution code:
def func_n(x,y,z):
    return ((x+y+z)**2+x**2+y**2+z**2)//2
N=int(input())
box=[0]*N
for x in range(1,100):
    for y in range(1,99):
        for z in range(1,99):
            a=func_n(x,y,z)
            if a>N:
                break
            box[a-1]+=1
for i in range(N):
    print(box[i])

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(1000000)


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

def p_solve(N):
    ans = [0 for _ in range(N)]
    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                k = f(x, y, z)
                k -= 1
                if 0 <= k < len(ans):
                    ans[k] += 1
    return ans

def solve(N):
    ans = p_solve(N)
    for a in ans:
        print(a)

if __name__ == "__main__":
    N = int(input())
    solve(N)

Submission status: Accepted

Solution code:
n=int(input())
m=int(n**0.5)
li=[0]*(10**4)
c=0
for i in range(1,m):
  for j in range(1,m):
    for k in range(1,m):
      if i*i+j*j+k*k+i*j+k*j+k*i<=n:
        li[i*i+j*j+k*k+i*j+k*j+k*i-1]+=1
for i in range(n):
  print(li[i])

Submission status: Accepted

Solution code:
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
#import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s, n, node):
    # 頂点が探索済みかどうかのチェック配列
    check = [False for _ in range(n)]
    check[s] = True
    # 次見る頂点を格納するキュー
    queue = deque([s])
    visited_num = 1

    # 問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color = [-1 for _ in range(n)]
    color[s] = 0

    while visited_num < n:
        # グラフが全連結ではない場合
        if len(queue) == 0:
            # 空配列を返す
            # 現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex = queue.popleft()
        # インデックスがない場合は
        for next_vertex in node[now_vertex]:

            if check[next_vertex] == True:
                continue

            queue.append(next_vertex)
            check[next_vertex] = True

            # 問題固有の計算
            color[next_vertex] = color[now_vertex]+1
            visited_num += 1

    return color


mod = 10**9+7
# n=int(input())
# n,m=list(map(int,input().split()))
# a=list(map(int,input().split()))
def ceil(x, y): return (x+y-1)//y
def input_list(): return list(map(int, input().split()))


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


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):
            tmp = cal(x, y, z)
            if tmp <= n:
                ans[tmp-1] += 1

for i in ans:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
a = [0]*((10**4)+1)
for i in range(1,101):
    for j in range(1,101):
        for  k in range(1,101):
            try:
                a[i*i+j*j+k*k+i*j+j*k+i*k]+=1
            except:
                continue
for i in range(1, n+1):
    print(a[i])

Submission status: Accepted

Solution code:
n = int(input())

ans = [0] * (10**5)

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

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

Submission status: Accepted

Solution code:
n = int(input())

ans = [0]*(10**7)
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):      
      tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
      ans[tmp] += 1
  
for i in range(1,n+1):
  print(ans[i])

Submission status: Accepted

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

N = int(input())

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


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


for i in range(1, 150):
    for j in range(1, 150):
        for k in range(1, 150):
            tmp = calc(i, j, k)
            if tmp <= 10 ** 4:
                ans[tmp] += 1


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

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
# A = [0]*(N+1)
counter = Counter()
until = int((N**0.5)+1)

for x in range(1, until):
    for y in range(1, until):
        for z in range(1, until):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            counter[tmp] += 1
for i in range(1, N+1):
    print(counter[i])

Submission status: Accepted

Solution code:
import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

# available on Google, not available on Codeforces
# import numpy as np
# import scipy


def solve(x):  # fix inputs here
    console("----- solving ------")

    res = defaultdict(set)
    for a in range(1, int(math.sqrt(x))):
        for b in range(1, int(math.sqrt(x - a*a))):
            for c in range(1, int(math.sqrt(x - a*a - b*b))):
                total = a**2 + b**2 + c**2 + a*b + b*c + a*c
                res[total].add(tuple(sorted([a,b,c])))

    for i in range(1,x+1):
        console(i, res[i])
        cnt = 0
        for a,b,c in res[i]:
            if a == b == c:
                cnt += 1
            elif a == b:
                cnt += 3
            elif b == c:
                cnt += 3
            else:
                cnt += 6
        print(cnt)
    return None


def console(*args):  # the judge will not read these print statement
    # print('\033[36m', *args, '\033[0m', file=sys.stderr)
    return


# for case_num in range(int(input())):
    # read line as a string
    # strr = input()

    # read line as an integer
k = int(input())
    
    # read one line and parse each word as a string
    # lst = input().split()

    # read one line and parse each word as an integer
    # lst = list(map(int,input().split()))

    # read matrix and parse as integers (after reading read nrows)
    # lst = list(map(int,input().split()))
    # nrows = lst[0]  # index containing information, please change
    # grid = []
    # for _ in range(nrows):
    #     grid.append(list(map(int,input().split())))

solve(k)
    
    # Google - case number required
    # print("Case #{}: {}".format(case_num+1, res))

    # Codeforces - no case number required
    # print(res)

Submission status: Accepted

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


N = int(input())
ans = solve(100)
[print(ans[i]) for i in range(1, N + 1)]

Submission status: Accepted

Solution code:
N = int(input())
N_list = [0]*(N+1)

for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
           if(i**2+j**2+k**2+i*j+j*k+k*i<=N):
               N_list[i**2+j**2+k**2+i*j+j*k+k*i]+=1
for i in N_list[1:]:
    print(i)

Submission status: Accepted

Solution code:
ans= [0]*(6*10**4+10)
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+k*i] += 1
n = int(input())
for i in range(1,n+1):
    print(ans[i])

Submission status: Accepted

Solution code:
n=int(input())
x,y,z=1,1,1
ans=[0]*(n+1)
while x>0:
    while y>0:
        while z>0:
            num=x*x+y*y+z*z+x*y+y*z+z*x
            if num>n:
                z=1
                break
            ans[num]+=1
            z+=1
        if x*x+y*y+1+x*y+y+x>n:
            y=1
            break
        y+=1
    if x*x+2+x+x+1>n:
        break
    x+=1
for i in range(1,n+1):
    print(ans[i])