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: Runtime Error

Solution code:
N = int(input())

ans = [0 for _ in range(10050)]
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)):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            ans[n] += 1

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

Submission status: Runtime Error

Solution code:
N = int(input())

ans = [0 for _ in range(10050)]
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**2 + y**2 + z**2 + x*y + y*z + z*x
            ans[n] += 1

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

Submission status: Runtime Error

Solution code:
import math
N = int(input())
ans = [0]*N
l = int(math.sqrt(N-2))

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

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

Submission status: Runtime Error

Solution code:
# # import math
N = int(input())
# # count = 0
# # flag = False
# # # n = int(math.sqrt(N))
n = 100

# # for i in range(1, N + 1):
    
# #     for j in range(1, n):
# #         for l in range(1, n):
# #             for r in range(1, n):
# #                 if j + l + r > N // 2:
# #                     continue
# #                 if j ** 2 + l ** 2 + r ** 2 + j * l + j * r + l * r == i:
# #                     if j == l == r:
# #                         flag = True
# #                         count = 1
# #                         break
# #                     else:
# #                         flag = True
# #                         count = 3
# #                         break
# #             if flag:
# #                 break
# #         if flag:
# #             break            
# #     print(count)
# #     count = 0
# #     flag = False
ans = [0] * 10000
for j in range(1, n):
    for l in range(1, n):
        for r in range(1, n):
            value = j * j  + l * l + r * r + j * l + j * r + l * r
            if value < 10000:
                ans[value] += 1

for i in range(N):
    print(ans[i + 1])
# 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: Runtime Error

Solution code:
N=int(input())
def sq(n):
    c=0
    A=[0 for j in range(n+1)]
    for i in range(n//2):
        p=(i+1)**2
        if p>n:
            for j in range(i**2,n+1):
                A[j]=i
            break
        else:
            for j in range(i**2,p):
                A[j]=i
    return A
A=sq(N)
L=[0 for j in range(N+1)]
for x in range(1,a+1):
    for y in range(1,a+1):
        for z in range(a+1):
            p=x**2+y**2+z**2+x*y+y*z+z*x
            if p<=N:
                L[p]=L[p]+1
            else:
                break
for l in L:
    print(l)

Submission status: Runtime Error

Solution code:
N=int(input())

a=[0]*N

x=1
while x*x<=N:
    y=1
    while x*x+y*y+x*y<=N:
        z=1
        while z*z+x*x+y*y+x*y+z*y+z*x<=N:
            a[z*z+x*x+y*y+x*y+z*y+z*x]+=1
            z+=1
        y+=1
    x+=1

for n in a:
    print(n)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
# import math
N = int(input())
# count = 0
# flag = False
# # n = int(math.sqrt(N))
# n = 10000

# for i in range(1, N + 1):
    
#     for j in range(1, n):
#         for l in range(1, n):
#             for r in range(1, n):
#                 if j + l + r > N // 2:
#                     continue
#                 if j ** 2 + l ** 2 + r ** 2 + j * l + j * r + l * r == i:
#                     if j == l == r:
#                         flag = True
#                         count = 1
#                         break
#                     else:
#                         flag = True
#                         count = 3
#                         break
#             if flag:
#                 break
#         if flag:
#             break            
#     print(count)
#     count = 0
#     flag = False
ans = [0] * 10000
for j in range(1, n):
    for l in range(1, n):
        for r in range(1, n):
            value = j * j  + l * l + r * r + j * l + j * r + l * r
            if value < 10000:
                ans[value] += 1

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

Submission status: Runtime Error

Solution code:
import math
N = int(input())
for i in range(1, N+1):
    if N > 3:
        ra = math.sqrt(i - 2) - 1
        ran = math.floor(ra)
        ans = 0
        for x in range(1, ran+1):
            for y in range(1, ran+1):
                for z in range(1, ran+1):
                    f = x**2 + y**2 + z**2 + x*y + y*z + z*x
                    if i == f:
                        ans += 1
        print(ans)
    else:
        print(0)

Submission status: Runtime Error

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: Runtime Error

Solution code:
n=int(input())
a = [0]*(10000)
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 >= n:
                break
            a[i**2+j**2+k**2+i*j+j*k+i*k]+=1
for i in range(1,n+1):
    print(a[i])

Submission status: Runtime Error

Solution code:
import math
n = int(input())
ans=[0]*n
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))):
            a = x * x + y * y + z * z + x * y + y * z + z * x
            if n >= a >= 1:
                ans[a] += 1
print(*ans,sep="\n")

Submission status: Runtime Error

Solution code:
n = int(input())
X = input()
n = len(X)
ans = 0
numX = X.count("1")
N = 2*(10**5)
table = []

def solve(numX,X):
    global ans
    y = int(X,2)%numX
    if y == 0:
        ans = 1
        return 0
    else:
        ans = 1 + table[y-1]

def make_table(numX,X):
    global ans
    ans += 1
    y = int(X,2)%numX
    if y == 0:
        return 0
    else:
        z = bin(y)[2:]
        make_table(z.count("1"),z)

for i in range(1,N+1):
    ans = 0
    aaa = bin(i)[2:]
    bbb = aaa.count("1")
    make_table(bbb,aaa)
    table.append(ans)

for i in range(n):
    ans = 0
    tmpX = ""
    tmp = ""
    if X[i] == "0":
        tmpnumX = numX + 1
        tmp = "1"
    else:
        tmpnumX = numX - 1
        tmp = "0"
    if i == 0:
        tmpX = tmp + X[1:]
    elif i == n-1:
        tmpX = X[:i] + tmp
    else:
        tmpX = X[:i] + tmp + X[i+1:]
    solve(tmpnumX,tmpX)
    print(ans)

Submission status: Runtime Error

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: Runtime Error

Solution code:
N=int(input())
a=[0]*N
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            n=i*i+j*j+k*k+i*j+i*k+j*k
            if(n>N):
               continue
            a[n-1]+=1
for i in range(1,N+1):
    print(a[i])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit((), cache=True)
def main(n):
    for s in range(1, n+1):
        ans = 0
        for i in range(1, 101):
            for j in range(1, 101):
                for k in range(1, 101):
                    if i*i + j*j + k*k + i*j + j*k + k*i == s:
                        ans += 1
        print(ans)
        ans = 0


n = int(read())
main(n)

Submission status: Runtime Error

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: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
cnt = [0] * 10001
for x in range(1, r_n):
    for y in range(1, r_n):
        for z in range(1, r_n):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v <= n:
                cnt[v] += 1

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

Submission status: Runtime Error

Solution code:
n=int(input())
a=[0]*10000
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            if(i*i+j*j+k*k+i*j+i*k+j*k==n):
                  a[n-1]+=1
            else:
                continue
for i in range(1,n+1):
    print(a[i])

Submission status: Runtime Error

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
cnt = [0] * 10001
r_n = int(math.sqrt(n)) + 1
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v <= n:
                cnt[v] += 1

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

Submission status: Runtime Error

Solution code:
n=int(input())
import numpy as np
import math
rn=(n-4+1/4)**0.5-1/2
rn=math.ceil(rn)

r=[0]*n

for xx in np.arange(1,rn+1):
  xx2=xx**2
  for yy in np.arange(1,xx+1):
    xx2yy2xxyy=xx2+yy**2+xx*yy
    xxpyy=xx+yy
    tempr=xx2yy2xxyy+1+xxpyy
    if tempr>n:
      break
    for zz in np.arange(1,yy+1):
      tempr=xx2yy2xxyy+zz**2+xxpyy*zz
      if tempr>n: 
        break
      else:
        lx=len(set([xx,yy,zz]))
        if lx==3:
          rr=6            
        elif lx==2:
          rr=3
        elif lx==1:
          rr=1
        r[tempr-1]+=rr
        
for ii in range(n):
  print(r[ii])

Submission status: Runtime Error

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
cnt = [0] * 10001
r_n = int(math.sqrt(n)) + 1
for x in range(1, r_n):
    for y in range(1, r_n):
        for z in range(1, r_n):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v <= n:
                cnt[v] += 1

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

Submission status: Runtime Error

Solution code:
n = int(input())
count = 0
a = [0]*(10**4)
for i in range(1, 41):
  for j in range(1, 41):
    for k in range(1, 41):
      a[(i+j+k)**2-(i*j+j*k+i*k)] += 1


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

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 0
tmp = [0]*(N+2)
for i in range(1,40):
    for j in range(1,57):
        for h in range(1,99):
            num = i*i + j*j + h*h + i*j + j*h +h*i
            # if num > N:
            #     continue
            # tmp.append(num)
            # num = 0
            tmp[num] += 1


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

Submission status: Runtime Error

Solution code:
import math
n = int(input())
ans=[0]*n
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
print(ans,sep="\n")