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: Time Limit Exceeded

Solution code:
import itertools

N = int(input())
for n in range(1,N+1):
    if n < 6:
        print(0)
    else:
        M =int((n-2)**0.5)
        count = 0
        for x in range(1,M+1):
            for y in range(1,x+1):
                for z in range(1,y+1):
                    if (x+y)*(x+z)+y**2+z**2 == n:
                        if x == y == z:
                            count = 1
                        elif x == y or y == z:
                            count = 3
                        else:
                            count = 6
                        #p=[x,y,z]
                        #q=[]
                        #for p in itertools.permutations(p):
                            #q.append(p)
                            #count = len(set(q))
                    else:
                        pass
        print(count)

Submission status: Time Limit Exceeded

Solution code:
import itertools

N = int(input())
for n in range(1,N+1):
    if n < 6:
        print(0)
    else:
        M =int((n-2)**0.5)
        count = 0
        for x in range(1,M+1):
            for y in range(1,x+1):
                for z in range(1,y+1):
                    if (x+y)*(x+z)+y**2+z**2 == n:
                        p=[x,y,z]
                        q=[]
                        for p in itertools.permutations(p):
                            q.append(p)
                            count = len(set(q))
                    else:
                        pass
        print(count)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    #s = x+ y+ z
    ret =[0]*(N+1)
    for n in range(1,N+1):
        for s in range(3,int(N**0.5)+3):
            for z in range(1,s+1):
                for y in range(1,s-z+1):
                    x = s - z - y
                    if s**2==n + x*y+y*z+z*x:
                        if x>=1 and y>=1 and z>=1:
                            ret[n]+=1
    for a in ret[1:]:
        print(a)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import itertools

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

n=int(input())

an=[]
for i, j,k in itertools.product(range(1,42), range(1,42), range(1,42)):
    an.append(ff(i,j,k))
#an=[ff(i,j,k) for i in range(1,42) for j in range(1,42) for k in range(1,42)]
list.sort(an, reverse=True)
for i in range(1,n+1):
    print(an.count(i))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

for i in range(1,n+1):
    cnt = 0
    for j in range(1, 10^2+5): #x
        for k in range(1, 10^2+5): #y
            for l in range(1, 10^2+5): #z
                if j*j+k*k+l*l+j*k+k*l+l*j == i:
                      cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for n in range(1,N+1):
    if n < 6:
        print(0)
    else:
        M =int((n-2)**0.5)
        count = 0
        for x in range(1,M+1):
            for y in range(1,M+1):
                for z in range(1,M+1):
                    if (x+y)*(x+z)+y**2+z**2 == n:
                        count = count + 1
                    else:
                        pass
        print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for n in range(1,N+1):
    if n < 6:
        print(0)
    else:
        M =int((n-2)**0.5)
        count = 0
        for x in range(1,M+1):
            for y in range(1,M+1):
                for z in range(1,M+1):
                    if x**2+y**2+z**2+x*y+y*z+z*x == n:
                        count = count + 1
                    else:
                        pass
        print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())



for n in range(1,N+1):
    if n < 6:
        print(0)
    else:
        M =int((n-2)**0.5)
        count = 0
        for x in range(1,M+1):
            #P=x**2+y**2+z**2+x*y+y*z+z*x
            for y in range(1,M+1):
                #Q=x**2+y**2+z**2+x*y+y*z+z*x
                for z in range(1,M+1):
                    #R = x**2+y**2+z**2+x*y+y*z+z*x
                    if x**2+y**2+z**2+x*y+y*z+z*x == n:
                        count = count + 1
                    else:
                        pass
        print(count)

Submission status: Time Limit Exceeded

Solution code:
import itertools

N = int(input())
for n in range(1,N+1):
    if n<6: 
        print(0)
        continue
    cnt = 0
    for x,y,z in itertools.product(list(range(1,n)),repeat=3):
        if n == x*x + y*y +z*z + x*y + y*z + z*x:
            cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


for n in range(1,N+1):
    if n < 3:
        print(0)
    else:
        M =int((n-2)**0.5)
        count = 0
        for x in range(1,M+1):
            #P=x**2+y**2+z**2+x*y+y*z+z*x
            for y in range(1,M+1):
                #Q=x**2+y**2+z**2+x*y+y*z+z*x
                for z in range(1,M+1):
                    #R = x**2+y**2+z**2+x*y+y*z+z*x
                    if x**2+y**2+z**2+x*y+y*z+z*x == n:
                        count = count + 1
                    else:
                        pass
        print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
#from tqdm import tqdm
for i in range(1, n+1):
    ans=0
    for x in range(1, 10):
        for y in range(1, 10):
            for z in range(1, 10):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    ans+=1
                    #print(i, x,y,z)
    if ans != 0:
        print(ans)
    else:
        print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for n in range(1,N+1):
    count = 0
    for x in range(1,n):
        if x*x >= n:
            break
        for y in range(1,n):
            if x*x + y*y + x*y >= n:
                break
            for z in range(1,n):
                if x*x + y*y + z*z + x*y + y*z + z*x > n:
                    break
                if x*x + y*y + z*z + x*y + y*z + z*x == n:
                    count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

counts = [0 for i in range(N+1)]

for i in range(1,150):
    for j in range(1,150):
        for k in range(1,150):
            now = i**2 + j**2 + k**2 + i*j + j*k + k*i
            try:
                counts[now] += 1
            except:
                pass
for i in range(1,N+1):
    print(counts[i])

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

for i in range(1, n+1):
    ans = 0
    for j in range(1, int(math.sqrt(i))):
        for k in range(1, int(math.sqrt(i))):
            temp = i-(3*((j*j)+(k*k))/4)-((j*k)/2)
            if temp > 0:
                z = math.sqrt(temp)-((j+k)/2)
                if z-int(z) == 0 and z > 0:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

for i in range(1, n+1):
    ans = 0
    for j in range(1, int(math.sqrt(i))):
        for k in range(1, int(math.sqrt(i))):
            if i-(3*((j**2)+(k**2))/4)-((j*k)/2) > 0:
                z = math.sqrt(i-(3*((j**2)+(k**2))/4)-((j*k)/2))-((j+k)/2)
                if z-int(z) == 0 and z > 0:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
#1≤x,y,z
#x2+y2+z2+xy+yz+zx=n

N = int(input())

#x = y = z = 1 のとき、上の式は　６
for i in range(1,N + 1):
    count = 0
    for x in range(N):
        for y in range(N):
            for z in range(N):
                f = x ** 2 + y ** 2 + z ** 2 + (x * y) + (y * z) + (z * x)
                if x == 0 or y == 0 or z == 0:
                    continue
                elif f == i:
                    count += 1
                elif f > i:
                    break
    print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
 
N=int(input())
count=[0]*(N+1)
for x in range(1,N+1):
  for y in range(1,N+1):
    for z in range(1,N+1):
      n=x**2+y**2+z**2+x*y+y*z+z*x
      if(n<=N):
        count[n]+=1
for j in range(1,N+1):
  print(count[j])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

import math

for i in range(1, n+1):
  ans = 0
  if i>=6:
    for x in range(1, int(math.sqrt(i))):
      for y in range(1, int(math.sqrt(i))):
        for z in range(1, int(math.sqrt(i))):
          if x*x+y*y+z*z+x*y+y*z+z*x == i:
            ans += 1
  print(ans)

Submission status: Time Limit Exceeded

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

N=int(input())
for i in range(1,N+1):
  cnt=0
  listx=list(range(1,101-2))
  for x in listx:
    for y in range(1,101-x+1):
      for z in range(1,101-x-y+1):
        if i==x**2+y**2+z**2+x*y+y*z+z*x:
          cnt+=1
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

M = N//6 #x,y,zがとりうる最大の値を計測
#print(M)

for n in range(1,N+1):
	count = 0
	for x in range(1,M+1):
		#P=x**2+y**2+z**2+x*y+y*z+z*x
		for y in range(1,M+1):
			#Q=x**2+y**2+z**2+x*y+y*z+z*x
			for z in range(1,M+1):
				#R = x**2+y**2+z**2+x*y+y*z+z*x
				if x**2+y**2+z**2+x*y+y*z+z*x == n:
					count = count + 1
				else:
					pass

	print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int (input ())
z = 1
while True:
  if N < (2+z)**2-(1+z+z):
    break
  else:
    z += 1
z -= 1
n = 1
while n < N+1:
  p = 0
  for X in range (z):
    for Y in range (z):
      for Z in range (z):
        if n == (X+Y+Z+3)**2-((X+1)*(Y+1)+(Y+1)*(Z+1)+(Z+1)*(X+1)):
          if X >= 0 and Y >= 0 and Z >= 0:
            p += 1
  print (p)
  n += 1

Submission status: Time Limit Exceeded

Solution code:
N = int (input ())
z = 1
while True:
  if N < (2+z)**2-(1+z+z):
    break
  else:
    z += 1
z -= 1
n = 1
while n < N+1:
  p = 0
  for X in range (z+1):
    for Y in range (z+1):
      for Z in range (z+1):
        if n == (X+Y+Z)**2-(X*Y+Y*Z+Z*X):
          if X > 0 and Y > 0 and Z > 0:
            p += 1
  print (p)
  n += 1

Submission status: Time Limit Exceeded

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

n=int(input())

an=[ff(i,j,k) for i in range(1,42) for j in range(1,42) for k in range(1,42)]

for i in range(1,n+1):
    print(an.count(i))

Submission status: Time Limit Exceeded

Solution code:

def func(n):
    ans = 0
    for x in range(1, n):
        if x**2 >= n:
            continue
        for y in range(1, n):
            if x**2 + y**2 >= n:
                continue
            for z in range(1, n):
                if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == n:
                    ans += 1
    return ans


n = int(input())

for i in range(1, n+1):
    print(func(i))

Submission status: Time Limit Exceeded

Solution code:

def func(n):
    ans = 0
    for x in range(1, n):
        for y in range(1, n):
            for z in range(1, n):
                if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == n:
                    ans += 1
    return ans


n = int(input())

for i in range(1, n+1):
    print(func(i))

Submission status: Time Limit Exceeded

Solution code:
# C - XYZ Triplets
def get_f(n):
	count = 0
	
	for x in range(1, n):
		is_break = False
		
		if x ** 2 > n:
			return count
		else:
			for y in range(1, n):
				if is_break:
					break
				else:
					if x ** 2 + y ** 2 < n:
						for z in range(1, n):
							if is_break:
								break
							else:
								calc = x ** 2 + y ** 2 + x * y
						
								if calc < n:
									if z ** 2 + y * z + z * x == n - calc:
										count += 1
								else:
									is_break = True
		
	return count


N = int(input())

for n in range(1, N + 1):
	print(get_f(n))

Submission status: Time Limit Exceeded

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

# C - XYZ Triplets
def get_f(n):
	count = 0
	
	for x in range(1, n):
		if x ** 2 > n:
			return count
		else:
			for y in range(1, n):
				if x ** 2 + y ** 2 < n:
					for z in range(1, n):
						calc = x ** 2 + y ** 2 + x * y
						
						if calc < n:
							if z ** 2 + y * z + z * x == n - calc:
								count += 1
						else:
							break
		
	return count


N = int(input())

for n in range(1, N + 1):
	print(get_f(n))

Submission status: Time Limit Exceeded

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

# C - XYZ Triplets
def get_f(n):
	count = 0
	
	for x in range(1, n):
		if x ** 2 > n:
			return count
		else:
			for y in range(1, n):
				if x ** 2 + y ** 2 < n:
					for z in range(1, n):
						calc = x ** 2 + y ** 2 + x * y
						
						if calc < n:
							if z ** 2 + y * z + z * x == n - calc:
								count += 1
		
	return count


N = int(input())

for n in range(1, N + 1):
	print(get_f(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for n in range(1,N+1):
    count =0
    for i in range(1,N+1):
        for j in range(i,N+1):
            for k in range(j,N+1):
                ans = i*i + j*j + k*k + i*j + j*k + k*i
                if ans == n:
                    if i==j==k:
                        count = 1
                    elif i==j or j==k or i==k:
                        count = 3
                    else:
                        count = 6
    print(count)

Submission status: Time Limit Exceeded

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

for i in range(1, N + 1):
  max_num = math.ceil(math.sqrt(i)) + 1
  count = 0
  for x in range(1, max_num):
    for y in range(1, max_num):
      for z in range(1, max_num):
        val = x * x + y * y + z * z + x * y + y * z + z * x
        if val == i:
          count += 1
        if val > i:
          break
  print(count)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
n = int(input())

n_cnt = [0]*n

for x in range(1, int(sqrt(2*n))+1):
    for y in range(1, int(sqrt(2*n))+1):
        for z in range(1, int(sqrt(2*n))+1):
            t = (x+y)**2 + (y+z)**2 + (z+x)**2
            if t % 2 == 0 and t // 2 - 1 < n:
                n_cnt[t // 2 - 1] += 1


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

Submission status: Time Limit Exceeded

Solution code:

import math
N = int(input())

for n in range(1,N+1):
    cnt = 0
    sqrtn = int(math.sqrt(n))
    for x in range(1,sqrtn):
        for y in range(1,sqrtn):
            for z in range(1,sqrtn):
                cnt += x**2 + y**2 + z**2 +x*y + y*z + z*x == n
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math
 
def func(n):
    cnt = 0
    sqrtn = int(math.sqrt(n))
    for x in range(1,sqrtn+1):
        for y in range(1,sqrtn+1):
            for z in range(1,sqrtn+1):
                if x**2 + y**2 + z**2 +x*y + y*z + z*x == n:
                    cnt += 1
    return cnt
N = int(input())
 
for n in range(1,N+1):
    print(func(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = [0 for _ in range(1,N+1)]

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

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

Submission status: Time Limit Exceeded

Solution code:

N = int(input())

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


for n in range(1,N+1):
  count = 0
  
  for X in range(1,N):
    for Y in range(1,N):
      for Z in range(1,N):
        t = f(X,Y,Z)
        if t== n:
          count += 1
          break 
  
  print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1,N+1):
  count = 0
  
  for X in range(1,N+1):
    for Y in range(1,N+1):
      for Z in range(1,N+1):
        if X**2 + Y**2 + Z**2 + X*Y + Y*Z + Z*X  == n:
          count += 1
  
  print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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


for n in range(1,N+1):
  count = 0
  
  for X in range(1,N-4):
    for Y in range(1,N-4):
      for Z in range(1,N-4):
        if f(X,Y,Z) == n:
          count += 1
  
  print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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


for n in range(1,N+1):
  count = 0
  
  for X in range(1,N+1):
    for Y in range(1,N+1):
      for Z in range(1,N+1):
        if f(X,Y,Z) == n:
          count += 1
  
  print(count)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
n = int(input())

for i in range(1, n+1):
    cnt = 0
    for x in range(1, int(sqrt(2*i))+1):
        for y in range(1, x+1):
            for z in range(1, y+1):
                if (x+y)**2 + (y+z)**2 + (z+x)**2 == 2*i:
                    if x == y == z:
                        cnt += 1
                    else:
                        cnt += 3
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import itertools
N = int(input())
count = 0
triples = []
for n in range(1,N+1):
    count =0
    for i in range(1,N+1):
        for j in range(i,N+1):
            for k in range(j,N+1):
                ans = i*i + j*j + k*k + i*j + j*k + k*i
                if ans == n:
                    perm = itertools.permutations([i,j,k])
                    if len((i,j,k))==1:
                        count=1
                    else:
                        for x in list(perm):
                            if x not in triples:
                                count = count+1
                                triples.append(x)

    print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
for i in range(1,n+1):
  ans=0
  for x in range(1,round(i**0.5)+1):
    for y in range(1,round(i**0.5)+1):
      for z in range(1,round(i**0.5)+1):
        if x*x+y*y+z*z+x*y+y*z+z*x==i:
          ans+=1
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

n=1
while n<=N:
  ans=0
  x=1
  while x*x<n:
    y=1
    while x*x+y*y+x*y<=n:
      z=1
      while x*x+y*y+z*z+x*y+y*z+z*x<=n:
        if x*x+y*y+z*z+x*y+y*z+z*x==n:
          ans+=1
        z+=1
      y+=1
    x+=1
  print(ans)
  n+=1

Submission status: Time Limit Exceeded

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

for n in range(N):
    U = math.ceil(math.sqrt(n+1))
    c = 0
    for x in range(1,U+1):
        for y in range(1,U+1):
            for z in range(1,U+1):
                if x**2+y**2+z**2+x*y+y*z+z*x == n+1 :
                    c = c + 1 
    
    print(c)

Submission status: Time Limit Exceeded

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

for n in range(N):
    U = math.floor(math.sqrt(n+1))
    c = 0
    for x in range(1,U+1):
        for y in range(1,U+1):
            for z in range(1,U+1):
                if x**2+y**2+z**2+x*y+y*z+z*x == n+1 :
                    c = c + 1 
    
    print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
 
def calculate_n(x, y, z):
  n = x**2 + y**2 + z**2 + x*y + y*z + z*x
  return n
l = []
for x in range(1, N):
  for y in range(1, N):
    for z in range(1, N):
      n = calculate_n(x,y,z)
      if n > N:
        break
      else:
        l.append(n)
    if calculate_n(x, y+1, 1) > N:
      break
  if calculate_n(x+1, 1, 1) > N:
    break
    
numbers = sorted(set(l))
counts = [l.count(x) for x in numbers]
d = dict(zip(numbers, counts))
 
for i in range(1, N+1):
  if i in d:
  	print(d[i])
  else:
    print(0)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
xx = 2
square = [i**2 for i in range(2, int(3**(2*N)**0.5+1))]
match = []

for i in range(int((2*N)**0.5+1)):
  for j in range(i,int((2*N)**0.5+1)):
    for k in range(i+j, j-1, -2):
      matched = (square[i]+square[j]+square[k])//2
      if int(matched) == matched:
        if i==j==k:
          count = 1
        elif i==j or j==k:
          count = 3
        else:
          count = 6
        for l in range(count):
          match.append(int(matched))
match.sort()

for i in range(1,N+1):
  num = 0
  while i == match[0]:
    match = match[1:]
    num += 1
  print(num)

Submission status: Time Limit Exceeded

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


def xyz():
    count = 0
    for i in range(1, 101):
        for j in range(1, 101):
            for k in range(1, 101):
                zyx = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
                ans.append(zyx)


xyz()
for i in range(n):
    print(ans.count(i + 1))

Submission status: Time Limit Exceeded

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


def xyz():
    count = 0
    for i in range(1, 110):
        for j in range(1, 110):
            for k in range(1, 110):
                zyx = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
                ans.append(zyx)


xyz()
for i in range(n):
    print(ans.count(i + 1))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
import math
s=int(math.sqrt(n))
for i in range(1,n+1):
    count = 0
    for x in range(1,s):
        for y in range(1,min(s,n-x*x)):
            for z in range(1,min(s,n-x*x)):
                if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt as s
n=int(input())
for x in range(1,n+1):
    for i in range(1,int(s(x))+1):
        q=0
        for j in range(1,(int(s(x-(i*i)))+1)):
            f=0
            for k in range(1,(int(s(x-(i*i)-(j*j)))+1)):
                if i*i+j*j+k*k+i*j+j*k+k*i==x:
                    if i==1 and j==1 and k==1:
                        print(1)
                    else:
                        print(3)
                    f=1
                    break
                elif i*i+j*j+k*k+i*j+j*k+k*i>n:
                    break
            if f==1:
                q=1
                break
        if q==1:
            break
    if q==0:
        print(0)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
import math
s=int(math.sqrt(n))
for i in range(1,n+1):
    count = 0
    for x in range(1,s):
        for y in range(1,max(s,n-x*x)):
            for z in range(1,max(s,n-x*x)):
                if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
import math
s=int(math.sqrt(n))
for i in range(1,n+1):
    count = 0
    for x in range(1,s):
        for y in range(1,n-x*x):
            for z in range(1,n-x*x):
                if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
import math
s=int(math.sqrt(n))
for i in range(1,n+1):
    count = 0
    for x in range(1,s):
        for y in range(1,s):
            for z in range(1,n-x*x):
                if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
x = {i for i in range(1,int((n/6)**0.5)+1)}
y = []
z = []
for i in range(1,n):
  if (i**2)+2*i > n-3:
    break
  else:
    y.append(i)
    z.append(i)
one = set()
three = set()
six = set()
for xi in x:
  for yi in y:
    for zi in z:
      k = ((xi+yi+zi)**2 +(xi**2)+(yi**2)+(zi**2))//2
      if xi==yi==zi:
        one.add(k)
      elif xi==yi or yi==zi or zi==xi:
        three.add(k)
      else:
        six.add(k)
for i in range(1,n+1):
  if i in set(one):
    print(1)
  elif i in set(three):
    print(3)
  elif i in set(six):
    print(6)
  else:
    print(0)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
import math
s=int(math.sqrt(n))
for i in range(1,n+1):
    count = 0
    for x in range(1,s):
        for y in range(1,s):
            for z in range(1,s):
                if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = [0] * (N + 1)
for x in range(1, N + 1):
    for y in range(1, N + 1):
        for z in range(1, N + 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: Time Limit Exceeded

Solution code:
def f(n):
  count = 0
  for i in range(1,n+1):
    for j in range(i,n+1):
      for l in range(j,n+1):
        if (j + l) >= 100 or (j + i) >= 100 or (i+l) >= 100:
          break
        if (i+j)**2 + (j+l)**2 + (l+i)**2 == 2*n:
          if i == j == l:
            count += 1
          elif i == j or j == l or l == i:
            count += 3
          else:
            count += 6
  return (count)
n = int(input())
for i in range(1,n+1):
  print(f(i))

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
l = [0 for i in range(n)]
for x in range(1, math.ceil(n)+1):
    for y in range(1, math.ceil(n)+1):
        for z in range(1, math.ceil(n)+1):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if s <= n:
                l[s-1] += 1
for i in range(n):
    print(l[i])

Submission status: Time Limit Exceeded

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

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

for i in range(n):
    cnt = 0
    for x,y,z in itertools.product(range(1,int(math.sqrt(n))),repeat=3):
        if x**2 + y**2 + z**2 + x*y + y*z + z*x == i+1:
            cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

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

for i in range(n):
    cnt = 0
    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))):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i+1:
                    cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def f(n):
    cnt = 0
    for x in range(1, int(n ** 0.5) + 1):
        for y in range(1, int((n-x**2) ** 0.5) + 1):
            for z in range(1, int((n-x**2-y**2) ** 0.5) + 1):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n:
                    cnt += 1

    return cnt

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def f(n):
    cnt = 0
    e = int(n ** 0.5) + 1
    for x in range(1, e):
        for y in range(1, e):
            for z in range(1, e):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n:
                    cnt += 1

    return cnt

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def f(n):
    cnt = 0
    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):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n:
                    cnt += 1

    return cnt

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

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n=int(input())

for i in range(1,n+1):
    cnt=0
    for j in range(1,42):
        for k in range(1,42):
            for l in range(1,42):
                if j**2+k**2+l**2+j*k+k*l+l*j==i:
                    cnt+=1
                    break
                elif j**2+k**2+l**2+j*k+k*l+l*j>i:
                    break
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def calculate_n(x, y, z):
  n = x**2 + y**2 + z**2 + x*y + y*z + z*x
  return n
l = []
for x in range(1, N):
  for y in range(1, N):
    for z in range(1, N):
      n = calculate_n(x,y,z)
      if n > N:
      	break
      else:
        l.append(n)

numbers = sorted(set(l))
counts = [l.count(x) for x in numbers]
d = dict(zip(numbers, counts))

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

Submission status: Time Limit Exceeded

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

for x in range(1, 500):
    for y in range(1, 500):
        for z in range(1, 500):

            f = x**2 + y**2 + z**2 + x*y + y*z + z*x

            if f < 10000:
                ans[f-1] = ans[f-1] + 1 


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

Submission status: Time Limit Exceeded

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

for x in range(1, 1105):
    for y in range(1, 1105):
        for z in range(1, 1105):

            f = x**2 + y**2 + z**2 + x*y + y*z + z*x

            if f < 10000:
                ans[f-1] = ans[f-1] + 1 


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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1,N+1):
    cnt = 0
    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                check = x*x + y*y + z*z + x*y + y*z + z*x
                if check == n:
                    cnt += 1
                elif check > n:
                    break
    print(cnt)