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())

ans = [0]*60001

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

Submission status: Accepted

Solution code:
N = int(input())

def abc(a, b, c):
    return a**2 + b**2 + c**2 + a*b + b*c + c*a

for n in range(1, N+1):
    ans = 0
    for a in range(1, 101):
        if 6*a**2 < n:
          continue
        if abc(a, 1, 1) > n:
            break
        for b in range(1, a+1):
            if abc(a, b, 1) > n:
                break
            for c in range(1, b+1):
                if abc(a, b, c) == n:
                    if a == b and b == c:
                        ans += 1
                    elif a == b or b == c:
                        ans += 3
                    else:
                        ans += 6
                elif abc(a, b, c) > n:
                    break
    print(ans)

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    n = int(input())
    ans = [0 for _ in range(n)]
    for x in range(1,n):
        for y in range(1,n):
            for z in range(1,n):
                if x*x+y*y+z*z+x*y+y*z+x*z >= n+1:
                    break
                ans[x*x+y*y+z*z+x*y+y*z+x*z-1] += 1
    for i in range(n):
        print(ans[i])
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
l = [0] * 10002
for a in range(1, 100):
    for b in range(1, 100):
        for c in range(1, 1000):
            tmp = a * a + b * b + c * c + a * b + b * c + c * a
            if tmp <= 10000: l[tmp] -= -1
for i in range(1, n + 1): print(l[i])

Submission status: Accepted

Solution code:
import math
LI = lambda: list(map(int,input().split()) )
MI = lambda: map(int,input().split())
SI = lambda: input()
II = lambda: int(input())
n = II()
l = [0]*(10**4+1)
m = 10**4
lim = int(m**0.5)+1
for i in range(1,lim):
    for j in range(i,lim):
        for z in range(j,lim):
            s = i**2+j**2+z**2+i*j+i*z+j*z
            if s>m:
                continue
            if i == j == z:
                l[s] += 1
            elif i == j or j == z or i == z:
                l[s] += 3
            else:
                l[s] += 6
for i in range(1,n+1):
    print(l[i])

Submission status: Accepted

Solution code:
N = int(input())
#A = list(map(int, input().split()))

ans = [0 for _ in range(N)]
for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      k = (x+y)**2+(y+z)**2+(z+x)**2
      if k % 2 == 0 and k <= 2*N:
        ans[((x+y)**2+(y+z)**2+(z+x)**2)//2-1] += 1

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

Submission status: Accepted

Solution code:

import collections
from functools import lru_cache

from math import sqrt


def read():
    return input().strip()


def readInt():
    return int(input().strip())


def readList():
    return list(map(int, input().strip().split()))


def solve(n):
    f = [0 for _ in range(n+1)]

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

                if 0 <= s <= n:
                    f[s] += 1

    return "\n".join(map(str, f[1:]))


n = readInt()
print(solve(n))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
i = [0] * (10**5 + 1)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            i[x**2 + y**2 + z**2 + x * y + y * z + z * x] += 1

n = int(input())

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

Submission status: Accepted

Solution code:
from math import sqrt

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

def solve(N):
    ans = [0 for _ in range(N+1)]
    for x in range(1,int(sqrt(N))+1):
        for y in range(1,int(sqrt(N))+1):
            for z in range(1,int(sqrt(N))+1):
                tmp = cal(x,y,z)
                if tmp <= N:
                    ans[tmp] += 1
                else:
                    break

    return ans

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())

ch=[0]*10001

for i in range(1,100):
  for j in range(1,100):
    for k in range(1,100):
      x=i**2+j**2+k**2+i*j+j*k+k*i
      if x<=10000:
        ch[x]+=1
for i in range(n):
  print(ch[i+1])

Submission status: Accepted

Solution code:
n = int(input())

a = 2
res = dict()

for i in range(1, 142):
    for j in range(1, 142):
        for k in range(1, 142):
            tmp = int(((i + j) ** 2 + (j + k) ** 2 + (k + i) ** 2) / 2)
            res[tmp] = res.get(tmp, 0) + 1

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

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
l = list()
for i in range(1,101):
    l.append((i, i**2))
# print(l)
c = Counter()
for X in l:
    for Y in l:
        for Z in l:
            x = X[0]
            y = Y[0]
            z = Z[0]
            c[X[1]+Y[1]+Z[1]+x*y+y*z+x*z] += 1

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

Submission status: Accepted

Solution code:

n = int(input())
ans_lis = [0 for _ in range(n)]
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<=n:
                ans_lis[f-1]+=1
for ans in ans_lis:
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=[0]*n
m=n**0.5
for x in range(1,int(m)):
    for y in range(1,int(m)):
        for z in range(1,int(m)):
            num=x**2+y**2+z**2+x*y+y*z+z*x
            if num<=n:
                l[num-1] += 1
for i in range(n):
    print(l[i])

Submission status: Accepted

Solution code:
def calc(n):
    ret = 0
    for x in range(1, 10 ** 2 + 1):
        for y in range(x, 10 ** 2 + 1):
            rest = n - x * x - y * y - x * y  # z*(x+y+z)
            if rest < 0: break
            for z in range(y, 10 ** 2):
                t = z * (x + y + z)
                if t > rest: break
                if t == rest:
                    if x == y == z:
                        ret += 1
                    elif x == y or y == z or z == x:
                        ret += 3
                    else:
                        ret += 6
                    break
    return ret


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

    ans = []
    for n in range(1, N + 1):
        ans.append(calc(n))

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


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Submission status: Accepted

Solution code:
def resolve():
    n=int(input())
    a=[0]*(60000)
    nn=int(n**0.5)
    for x in range(1,nn):
        for y in range(1, nn):
            for z in range(1, nn):
                a[x**2+y**2+z**2+x*y+y*z+z*x]+=1
    for i in range(n):
        print(a[i+1])
resolve()

Submission status: Accepted

Solution code:
N = int(input())
A = [0]*(61206)
def calc(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):
            A[calc(x,y,z)] += 1
for i in range(1,N+1):
    print(A[i])

Submission status: Accepted

Solution code:
N=int(input())

for i in range(1,1+N):
    ans=0
    M=int(i**0.5)+1
    for x in range(1,M):
        if x**2<i:
            for y in range(1,x+1):
                if x**2+y**2+x*y<i:
                    for z in range(1,y+1):
                        if x**2+y**2+z**2+x*y+y*z+z*x==i:
                            if x==y==z:
                                ans+=1
                            elif x!=y and y!=z and z!=x:
                                ans+=6
                            else:
                                ans+=3
    print(ans)

Submission status: Accepted

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

def solve(N: int):
    ans = []
    for x in range(1, 101):
        x2 = x **2
        for y in range(1, 101):
            y2 = y **2
            for z in range(1, 101):
                z2 = z**2
                f = x2 + y2 + z2 + x*y + y*z + z*x

                if f > 10**4:
                    pass
                else:
                    ans.append(f)
    freq = collections.Counter(ans)

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

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
N = int(input())

#for n in range(1,N+1):
dict = {}
for i in range(1,N+1):
    dict[i] = 0
max_n =  int(math.sqrt(N))
#cnt = 0
for i in range(1,max_n+1):
    for j in range(1,max_n+1):
        for k in range(1,max_n+1):
            val =  i*i + j*j + k*k + i*j + i*k + j*k
            if val in dict:
                dict[val] += 1
                    #cnt += 1
for i in range(1,N+1):
    print(dict[i])

Submission status: Accepted

Solution code:

from math import sqrt

def main():
  n = int(input())
  if n < 5:
    for n in range(n):
      print(0)
    return

  n2 = int(sqrt(n)) + 1

  ans = [0] * (n + 1)

  for x in range(1, n2):
    for y in range(1, n2):
      if x**2 + y**2 + x*y > n:
        continue

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

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


main()

Submission status: Accepted

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


def solve(N: int):
    F = 110
    p = [0] * (F**3)
    for x in range(1,F):
        for y in range(1,F):
            for z in range(1,F):
                p[x*x+y*y+z*z+x*y+y*z+z*x] += 1

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


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

b = [str(i) for i in ans]
print('\n'.join(b))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.buffer.readline
n = int(input())
ans = [0] * (n + 1)


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


for i in range(1, int(n ** (1 / 2)) + 2):
    for j in range(i, int(n ** (1 / 2)) + 2):
        for k in range(j, int(n ** (1 / 2)) + 2):
            # print(i, j, k)
            temp = calc(i, j, k)
            if temp == 10:
                print(i, j, k)
            if temp > n:
                continue
            if i == j and j == k:
                ans[temp] += 1
            elif i == j:
                ans[temp] += 3
            elif j == k:
                ans[temp] += 3
            elif k == i:
                ans[temp] += 3
            else:
                ans[temp] += 6

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

Submission status: Accepted

Solution code:
import math
from collections import defaultdict

def check(x,y,z):
  return int(x*(x+y)+y*(y+z)+z*(z+x))

N = int(input())
# for n in range(1,N+1):
r = int(math.sqrt(N))+1
s = defaultdict(lambda:0)
for x in range(1,r):
  for y in range(1,r):
    for z in range(1,r):
      s[check(x,y,z)] += 1
for i in range(1,N+1):
  print(s[i])

Submission status: Accepted

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

#from collections import defaultdict
#from heapq import heappush, heappop
#import numpy as np
import sys

sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7

debug_indent = 0


def debug(*x):
    global debug_indent
    x = list(x)
    indent = 0
    if x[0].startswith("enter") or x[0][0] == ">":
        indent = 1
    if x[0].startswith("leave") or x[0][0] == "<":
        debug_indent -= 1
    x[0] = "  " * debug_indent + x[0]
    print(*x, file=sys.stderr)
    debug_indent += indent


def solve(N):
    # blute
    from math import sqrt, floor
    ret = [0] * (N + 1)
    n = N
    for x in range(1, floor(sqrt(n))):
        v0 = x * x
        for y in range(1, floor(sqrt(n))):
            v1 = v0 + y * y + y * x
            if v1 >= n:
                break
            for z in range(1, floor(sqrt(n))):
                v = v1 + z * z + y * z + z * x
                if v > n:
                    break
                ret[v] += 1
    return ret[1:]


def main():
    # parse input
    N = int(input())
    print(*solve(N), sep="\n")


# tests
T1 = """
20
"""


def test_T1():
    """
    >>> as_input(T1)
    >>> main()
    0
    0
    0
    0
    0
    1
    0
    0
    0
    0
    3
    0
    0
    0
    0
    0
    3
    3
    0
    0
    """
# add tests above


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


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())

    def input():
        return bytes(f.readline(), "ascii")

    def read():
        return bytes(f.read(), "ascii")


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', solve.__doc__.strip().split()[0])(solve)
    cc.compile()
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        # -p: pure python mode
        # if not -p, import compiled module
        from my_module import solve  # pylint: disable=all
    elif sys.argv[-1] == "-t":
        print("testing")
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        # input given as file
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.read

    main()

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def era(n):
    ret = [1 for i in range(n + 2)]
    for i in range(2, int(math.sqrt(n) +3)):
        if ret[i] != 0:
            for j in range(2, n//i + 1):
                ret[i * j] = 0
    rret = []
    for i, r in enumerate(ret):
        if r == 1 and i != 0:
            rret.append(i)

    return rret


def houjyo(n, m, k, kaijyo):
    # kaburi ... k
    # all ... n
    if k == n:
        return 1
    else:
        # kasanarierabi nck * nokorierabi (m - k)p(n-k) - houjyo(+1)
        ret = nck(n,k,kaijyo) * npk(m-k, n-k, kaijyo) # - (k + 1) * houjyo(n, m, k+1, kaijyo)
        # print(nck(n,k,kaijyo) , npk(m-k, n-k, kaijyo))
        return ret % MOD


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret


def solve():
    n = getN()
    ans = [0 for i in range(10001)]
    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 <= n:
                    ans[x * x + y * y + z * z + x * y + y * z + z * x] += 1

    for i, an in enumerate(ans):
        if i >= 1 and i <= n:
            print(an)




def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
x = [0]*(n+1)
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            t = i*i + j*j + k*k + i*j + j*k + i*k
            if t <= n:
                x[t] += 1
            else:
                break
for i in range(1,n+1):
    print(x[i])

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    #l,r,d=map(int,input().split())
    n=int(input())
    aa=[0 for i in range(10**4+1)]
    for a, b, c in itertools.product(range(1,101), repeat=3):
        temp=a**2+b**2+c**2+a*b+b*c+c*a
        if temp<=10**4:
            aa[temp]+=1
    for i in range(1,n+1):
        print(aa[i])








if __name__ == "__main__":

    main()

Submission status: Accepted

Solution code:
N = int(input())
ans_lis = [0]*10001
for x in range(1, 41+1):
    for y in range(x, 58+1):
        for z in range(y, 99+1):
            tmp = x*(x+y+z)+y*(y+z) + z**2
            if tmp > 10000:
                continue
            if x == y and y == z:
                ans_lis[tmp] += 1
            elif x == y or x == z or y == z:
                ans_lis[tmp] += 3
            else:
                ans_lis[tmp] += 6
for i in range(1, N+1):
    print(ans_lis[i])

Submission status: Accepted

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

Submission status: Accepted

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

for x in range(1,100,1):
    for y in range(1,100,1):
        for z in range(1,100,1):
            i = x*x+y*y+z*z+x*y+y*z+z*x
            if i <=10000:
                a[i]=a[i]+1
for i in range(1,n+1,1):
    print(a[i])

Submission status: Accepted

Solution code:
N = int(input())
lis = [0] * (10 ** 6)
for x in range(1,200):
    for y in range(1,200):
        for z in range(1,200):
            val = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if val <= N:
                lis[val] += 1
for i in range(1,N+1):
    print(lis[i])

Submission status: Accepted

Solution code:
N = int(input())

res = [0] * (N + 1)
for i in range(1, int(N ** (1 / 2)) + 1):
    for j in range(1, int(N ** (1 / 2)) + 1):
        for k in range(1, int(N ** (1 / 2)) + 1):
            n = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if n > N:
                break
            else:
                res[n] += 1

for r in res[1:]:
    print(r)

Submission status: Accepted

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

Submission status: Accepted

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

def solve(amt):
    for x in range(1, amt):
        for y in range(1, amt):
            for z in range(1, amt):
                n = x*x + y*y + z*z + x*y + y*z + x*z
                if n <= N:
                    f[n] += 1
                else:
                    break

if N > 2:
    solve(int((N-2)**0.5)+1)

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

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

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

Submission status: Accepted

Solution code:
n = int(input())
cnt = [0] * (n*n+1000)
for a in range(1, int(n**0.5)+1):
    for b in range(1, int(n**0.5)+1):
        for c in range(1, int(n**0.5)+1):
            cnt[a*a + b*b + c*c + a*b + b*c + c*a] += 1

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

Submission status: Accepted

Solution code:
import collections
N = int(input())
ans = collections.defaultdict(lambda: 0)
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())
a=[0]*n
for x in range(1,120):
    for y in range(1,120):
        for z in range(1,120):
            i=(x+y+z)**2-x*y-y*z-z*x
            if i<=n:
                a[i-1]+=1
print(*a,sep="\n")

Submission status: Accepted

Solution code:
N = int(input())

ans = [0]*(N+1)

for i in range(1, N+1):
    n_i = i**2
    if n_i > N:
        break
    for j in range(i, N+1):
        n_j = n_i + j**2 + i*j
        if n_j > N:
            break
        for k in range(j, N+1):
            n_k = n_j + k**2 + j*k + k*i
            if n_k > N:
                break
            else:
                if i == j and j == k:
                    ans[n_k] += 1
                elif i != j and j != k and k != i:
                    ans[n_k] += 6
                else:
                    ans[n_k] += 3

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

Submission status: Accepted

Solution code:
"""
NTC here
"""


#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase

profile = 0
pypy = 1


def iin(): return int(input())


def lin(): return list(map(int, input().split()))



def main():
    T = 1
    while T:
        T -= 1
        n = iin()
        mx = 10**4+1
        ans = [0]*(mx)
        for i in range(1, 100):
            for j in range(1, 100):
                for k in range(1, 100):
                    sm = i*i + j*j + k*k + i*j + j*k + k*i
                    if sm<mx:
                        ans[sm] += 1
        print(*ans[1:n+1], sep='\n')



    
        










    




                

        

 
 
 
 
 
 
# region fastio
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
if pypy:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
    input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
if __name__ == "__main__":
    if profile:
        import cProfile
        cProfile.run('main()')
    else:
        main()

Submission status: Accepted

Solution code:
import itertools

N=int(input())

ans=[0 for i in range(11000)]
T=[i+1 for i in range(110)]
CMB=list(itertools.combinations_with_replacement(T,3))

def f(l):
    x,y,z=l[0],l[1],l[2]
    return x*x+y*y+z*z+x*y+y*z+z*x


for i in range(len(CMB)):
    cmb=CMB[i]
    J=len(set(cmb))
    F=f(cmb)
    if F<11000:
        if J==1:
            ans[F]+=1
        elif J==2:
            ans[F]+=3
        else:
            ans[F]+=6

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

Submission status: Accepted

Solution code:
def main():
  N=int(input())
  #N=10000
  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
        else:break
  for i in range(1,N+1):
    print(ans[i])
  #print(ans)
  pass
if __name__=='__main__':
  main()

Submission status: Accepted

Solution code:
n = int(input())

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

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

for a in ans:
    print(a)

Submission status: Accepted

Solution code:
from math import sqrt, floor
n = int(input())
f = [0] * n
sn = floor(sqrt(n))
for x in range(1, sn+1):
    for y in range(x, sn+1):
        for z in range(y, sn+1):
            t = x * x + y * y + z * z + x * y + y * z + z * x
            if t <= n:
                s = set([x,y,z])
                if len(s) == 3:
                    f[t-1] += 6
                elif len(s) == 2:
                    f[t-1] += 3
                else: f[t-1] += 1
for i in f:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def f(a,b,c):
	return a*a+b*b+c*c+a*b+b*c+c*a
n=int(input())
ans=[0]*n
r=int(n**0.5)+1
for i in range(1,r+1):
	for j in range(1,r+1):
		for k in range(1,r+1):
			if f(i,j,k)<=n:
				ans[f(i,j,k)-1]+=1
			else:
				break
for x in ans:
	print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import defaultdict


def main():
    n_in = int(input().strip())

    n_to_xyz = defaultdict(set)
    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                n = x * x + y * y + z * z + x * y + y * z + z * x
                n_to_xyz[n].add((x, y, z))

    for i in range(1, n_in + 1):
        print(len(n_to_xyz[i]))


if __name__ == '__main__':
    main()