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 math
N = int(input())

def func(n):
    if n <= 5:
        return 0
    else:
        cnt = 0
        max = int(math.sqrt(2*n-8))
        for x in range(1, max):
            if x**2 >= 2*n-8:
                break
            for y in range(1, max):
                if y**2 > 2*n-8:
                    break
                for z in range(1, max):
                    if z**2 > 2*n-8:
                        break
                    elif (x+y)**2 + (y+z)**2 + (z+x)**2 == 2*n:
                        cnt += 1
        return cnt
                        
for i in range(1, N+1):
    print(func(i))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def count_n(n):
    ans = 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:
                    ans += 1
    return ans

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

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:
N = int(input())

x = 1
y = 1
z = 1
a = 0
for i in range(1,N+1):
    while i > x:
        while i > y:
            while i > z:
                if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == i:
                    a += 1
                z += 1
            z = 1
            y += 1
        y = 1
        x += 1
    x = 1
    print(a)
    a = 0

Submission status: Time Limit Exceeded

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

from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


N = int(input())


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


for n in range(1, N+1):
    num_dict = {}
    res = 0
    for x in range(1, 30):
        for y in range(1, 30):
            for z in range(1, 30):
                num = g(x, y, z)
                if num > 10 ** 4:
                    continue
                if num == n:
                    # print(f'{x}+{y}+{z}={num}')
                    if (x, y, z) in num_dict:
                        continue
                    # print('doesnt exist')
                    num_dict[(x, y, z)] = 1
                    res += 1
    print(res)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for i in range(1, N+1):
    C = 0
    for x in range(1, i):
        if 6 * x**2 > i:
            break
        for y in range(x, i):
            if x**2 + 3 * y**2 + 2*x*y > i:
                break
            for z in range(y, i):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    if x == y == z:
                        C += 1
                    elif x == y < z:
                        C += 3
                    elif x < y == z:
                        C += 3
                    else:
                        C += 6
                elif x**2 + y**2 + z**2 > i:
                    break
    print(C)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
output = []

for n in range(1,N+1):
    cnt = 0
    for x in range(1,100):
        if x**2 > n: break
        for y in range(1,100):
            if x**2+y**2+x*y > n: break
            for z in range(1,100):
                tmp = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)
                if tmp > n: break
                if tmp == n: cnt += 1
    output.append(cnt)

print(*output, sep = "\n")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

for i in range(1,n+1):
  count = 0
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        fn = (x+y)**2 + (y+z)**2 + (z+x)**2
        if fn > 2*i:
          break
        if fn == 2*i:
          count += 1
  print(count)

Submission status: Time Limit Exceeded

Solution code:
for i in range(1, 1 + int(input())):

  match_pattern = []

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

        if i == (x**2 + y ** 2 + z ** 2 + x * y + y * z + z * x):
          match_pattern.append([x, y, z])
  
  print(len(match_pattern))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

for i in range(1,n+1):
    ans=0
    for x in range(1,i):
        for y in range(1,i):
            for z in range(1,i):
                if x**2 + y**2 + z**2 +x*y +y*z+z*x==i:
                    ans+=1
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))    

def do():
    n=INT()
    for i in range(1,n+1):
        ct=0
        ans=i*2
        r=int(ans**0.5)+1
        for k in range(2,r):
            for j in range(2,int((ans-k**2)**0.5)+2):
                re=ans-k**2-j**2
                if re<=0:
                    continue
                #print(2*i,k,j,(int(re**0.5))**2)
                if (int(re**0.5))**2==re:
                    xy=k
                    yz=j
                    zx=int(re**0.5)
                    #print(i)
                    
                    s=(xy+yz+zx)//2
                    #print(2*i,s,s-xy,s-yz,s-zx)
                    if s*2 !=xy+yz+zx:
                        pass
                    else:
                        if s-xy>=1 and s-yz>=1 and s-zx>=1:
                            ct+=1
        print(ct)
                    
        
if __name__ == '__main__':
    do()

Submission status: Time Limit Exceeded

Solution code:
a=int(input())
for w in range(1,a+1):
    if w<5:
        print(0)
    else:
        total=0
        for i in range(1,a):
            for j in range(1,a):
                for k in range(1,a):
                    if (i**2)+(j**2)+(k**2)+i*k+i*j+k*j==w:
                        total+=1
        print(total)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

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

NUM_MAX = int(math.sqrt(n))+1

def my_func(k):
    ans = 0
    for x in range(1, NUM_MAX):
        for y in range(1, x+1):
            for z in range(1, y+1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == k:
                    if (x==y==z):
                        ans += 1
                    elif x==y or y==z or z==x:
                        ans += 3
                    else:
                        ans += 6
    print(ans)

    
for i in range(1, n+1):
    my_func(i)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
ans = 0
upper = int(math.sqrt(N))
for n in range(1, N+1):
    ans = 0
    for x in range(1, upper):
        for y  in range(1, upper):
            z = 0
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v > n:
                break
            for z in range(1, upper):
                v = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if  v == n:
                    ans += 1
                    #print((x, y, z))
                elif v > n:
                    break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
def calc_func(n):
    result = 0
    for ix in range(1,n+1):
        for iy in range(1,n+1):
            for iz in range(1,n+1):
                if ix ** 2 + iy **2 + iz ** 2 + ix * iy + iy* iz + iz * ix == n:
                    result += 1
    return(result)







N = int(input()) #1行目のNを取得する


for i in range(N):
    print(calc_func(i+1))

Submission status: Time Limit Exceeded

Solution code:
ans=[]
n=int(input())
for nn in range(1,n+1):
  aa=0
  for i in range(1,101):
    for j in range(i,101):
      for k in range(j,101):
        if (i+j+k)**2-(i*j+j*k+k*i)==nn:
          ll=len(set([i,j,k]))
          if ll==1:
            aa+=1
          elif ll==2:
            aa+=3
          else:
            aa+=6
          break
  ans.append(aa)
for aa in ans:
  print(aa)

Submission status: Time Limit Exceeded

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

for p in range(1, n+1):
  right=math.floor(math.sqrt(p))+1
  cnt=0
  for i in range(1, right):
    for j in range(1, i+1):
      for k in range(1, j+1):
        if (i+j+k)**2-i*j-j*k-k*i==p:
          if i==j and j==k:
            cnt+=1
          elif i==j and j!=k:
            cnt+=3
          elif j==k and k!=i:
            cnt+=3
          elif k==i and i!=j:
            cnt+=3
          elif i!=j and j!=k and k!=i:
            cnt+=6
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def f(x, y, z):
  return (x + y + z) ** 2 - (x * y + y * z + z * x)
cnts = []

for i in range(1, N+1):
  cnt = 0
  for j in range(1, int(i ** (1/2)) + 1):
    for k in range(1, int(i ** (1/2)) + 1):
      for l in range(1, int(i ** (1/2)) + 1):
        if f(j, k, l) == i:
          # print(j, k, l, " ", i)
          cnt += 1
  cnts.append(cnt)

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

for nn in range(1,n+1):
  ul = int(nn**0.5)+1
  cnt=0
  for i in range(1,ul):
    for j in range(1,ul):
      for k in range(1,ul):
        if i**2+j**2+k**2+i*j+j*k+k*i==nn:
          cnt+=1
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

for a in range(n):
  s=0
  for i in range(n):
    for j in range(n):
      for k in range(n):
        if((i+j+k+3)**2-(i*j+j*k+k*i+2*i+2*j+2*k+3)==a+1):
          s+=1
  print(s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

for i in range(1,n+1):
    ans = 0
    for x in range(1,int(n**0.5+1)):
        for y in range(1,int(n**0.5+1)):
            if (x+y)**2 - 4*(x**2 + y**2 + x*y - i) >= 0:
                z1 = (((x+y)**2 - 4*(x**2 + y**2 + x*y - i))**0.5) -(x+y)
                z2 = -(((x+y)**2 - 4*(x**2 + y**2 + x*y - i))**0.5) -(x+y)
                if z1//1 == z1 and z1 > 0:
                    ans += 1
                elif z2//1 == z2 and z2 > 0:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
for x in range(1,(n+1)):
         ans = 0
         for i in range(1,int((n ** (1/2)))):
                  for j in range(1,int((n ** (1/2)))):
                           for k in range(1,int((n ** (1/2)))):
                                    if (i*i) + (j*j) + (k*k) + (i*j) + (j*k) + (k*i) == x:
                                             ans += 1
         print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

for m in range(1,n+1):
    cnt =0
    for i in range(1,int(pow(m,1/2))+1):
        for j in range(1,int(pow(m,1/2))+1):
            for k in range(1,int(pow(m,1/2))+1):
                if i*i+j*j+k*k + i*j + j*k + k*i == m:
                    cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys
from math import sqrt
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    for n in range(1, N + 1):
        ans = 0
        upper = 42
        #print("n={}, upper={}".format(n, upper))
        for x in range(1, upper):
            for y in range(1, upper):
                for z in range(1, upper):
                    if (x + y + z)**2 - (x*y + y*z + z*x) == n:
                        ans += 1
        print(ans)



if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

count = 0
aset = [0]*(n+1)
for x in range(1,n-1):
    for y in range(x,n-1):
        for z in range(y,n-1):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if a <= n:
                if x == y and y ==z:
                    aset[a] +=1
                else:
                    aset[a] +=3

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

Submission status: Time Limit Exceeded

Solution code:
from itertools import product
N = int(input())

list_N = list(range(1, int((N + 1)**0.5)))

list_xyz = list(product(list_N, repeat=3))

ans_list = [x**2 + y**2 + z ** 2 + x*y + y*z + x * z for x, y ,z in list_xyz]
for n in range(1, N+1):
    print(ans_list.count(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input().strip())
s=[]
for a in range (1,N):
    for b in range(1,N):
        for c in range(1,N):
            s.append(a*a+b*b+c*c+a*b+b*c+c*a)

for l in range(1,N+1):
    print(s.count(l))

Submission status: Time Limit Exceeded

Solution code:
def f(x, y, z, n):
    if (x+y+z)**2 - x*y - y*z - z*x == n:
        return True
    return False


N = int(input())
for i in range(1, N+1):
    ans = 0
    for x in range(1, int(i**0.5)+2):
        for y in range(x, int(i**0.5)+2):
            for z in range(y, int(i**0.5)+2):
                if f(x, y, z, i):
                    if x == y == z:
                        ans += 1
                    elif x == y or y == z or z == x:
                        ans += 3
                    else:
                        ans += 6
    print(ans)

Submission status: Time Limit Exceeded

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

max_num = int(n**0.5)+1

for i in range(1,n+1):
  cnt=0
  for x in range(1,max_num+1):
    for y in range(x,max_num+1):
      nokori = i-x**2-y**2-x*y
      if nokori<1:
        break
      for z in range(y,nokori+1):
        if (x+y+z)*z == nokori:
          cnt+=len(set(permutations([x,y,z],3)))
        if (x+y+z)*z > nokori:
          break
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
#-*-coding:utf-8-*-

import sys

def main():
    n = int(input())
    ans=[0]*n
    count=0

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

for n in range(1,N+1):
    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
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
from collections import defaultdict
d = defaultdict(int)

for i in range(1,n):
	for j in range(1,n):
		for k in range(1,n):
			if i+j+k <= 150:
				p = (i+j+k)**2-(i*j)-(j*k)-(i*k)
				d[p]+=1

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
for m in range(1, n+1):
    cnt = 0
    for x in range(1, m):
        for y in range(1, m):
            for z in range(1, m):
                p = x**2+y**2+z**2+x*y+y*z+z*x
                if p == m:
                    cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    for i in range(1,N+1):
        j = math.ceil(i**0.5)
        ans = 0
        for x in range(1,j+1):
            for y in range(1,j+1):
                A=x**2+y**2+x*y
                B=x+y
                D = B**2-4*(A-i)
                if D < 0: continue

                d = D**0.5
                if d.is_integer():
                    for z in [(-B+d)/2,(-B-d)/2]:
                        # print(i,d,z)
                        if z.is_integer() and 1<=z:
                            ans += 1
                
        
        print(ans)
                


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for k 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 (x**2 + y**2+ z**2+(x*y)+(y*z)+(z*x)) == k:
                    count +=1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
a=int(input())
for w in range(1,a+1):
    if w<3:
        print(0)
    else:
        total=0
        for i in range(1,a):
            for j in range(1,a):
                for k in range(1,a):
                    if (i**2)+(j**2)+(k**2)+i*k+i*j+k*j==w:
                        total+=1
        print(total)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def ff(n):
    ans = 0
    for x in range(1,n):
        for y in range(1,x+1):
            for z in range(1, y+1):
                if x*x + y*y + z*z + x*y + y*z + z*x == n:
                    if x == y and y == z and z == x:
                        ans +=1
                    elif x == y or y == z or z == x:
                        ans += 3
                    else:
                        ans += 6
    return ans
for i in range(1, N+1):                                      
    print(ff(i))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

n=int(input())

# start=time.time()
for i in range(1,n+1,1):
    cnt=0
    for x in range(1,int(np.sqrt(n))+1,1):
        for y in range(1,int(np.sqrt(n))+1,1):
            for z in range(1,int(np.sqrt(n))+1,1):
                if x**2+y**2+z**2+x*y+y*z+z*x==i:
                    cnt+=1
                elif x**2+y**2+z**2+x*y+y*z+z*x>i:
                    break
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import itertools

def f(n):
  m = int(n**0.5)
  count = 0
  for x, y, z in itertools.combinations_with_replacement(range(1, m+1), 3):
    if x**2+y**2+z**2+x*y+y*z+z*x==n:
      k = len(set({x, y, z}))
      if k == 1:
        count += 1
      elif k == 2:
        count += 3
      else:
        count += 6
  return count

N = int(input())
for n in range(1, N+1):
  print(f(n))

Submission status: Time Limit Exceeded

Solution code:

def solve():
    for n in range(1,N+1):
        cnt = 0
        for x in range(1,int(n**0.5)):
            for y in range(1,x+1):
                for z in range(1,x+1):
                    if x**2+y**2+z**2+x*y+y*z+z*x==n:
                        if x==y==z:
                            cnt += 1
                        else:
                            cnt += 3
                            x += 1
        print(cnt)

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

Submission status: Time Limit Exceeded

Solution code:
import math
def func(x,y,z):
    ans = x**2 + y**2 + z**2+ x*y + y*z + z*x
    #print("x={},y={},z={},ans={}".format(x,y,z,ans))
    return ans

N = int(input())
root_n = round(math.sqrt(N+1))
for n in range(1,N+1):
    count = 0
    for x in range(1,root_n):
        for y in range(1,root_n):
            for z in range(1,root_n):
                if func(x,y,z)==n:
                    count=count+1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys
from math import sqrt
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    for n in range(1, N + 1):
        ans = 0
        upper = 50
        #print("n={}, upper={}".format(n, upper))
        for x in range(1, upper):
            for y in range(1, upper):
                for z in range(1, upper):
                    if (x + y + z)**2 - (x*y + y*z + z*x) == n:
                        ans += 1
        print(ans)



if __name__ == "__main__":
    main()

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

Submission status: Time Limit Exceeded

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
for i in range(1, n+1):
    ans = 0
    for x in range(1, 40):
        for y in range(1, 40):
            for z in range(1, 40):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=[0]*(n+1)
for x in range(1,n):
    for y in range(1,n-x):
        for z in range(1,n-x-y):
            value=x*x+y*y+z*z+x*y+y*z+z*x
            if value>n:
                continue
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input()) + 1
for n in range(1,N):
    count = 0
    if n >= 6:
        for x in range(1, int(math.sqrt(N))):
            for y in range(1,x+1):
                for z in range(1,y+1):
#                    print((x + y + z)**2 - (x*y + y*z + z*x), n,x,y,z)
                    if (x + y + z)**2 - (x*y + y*z + z*x) == n:
                        if x == y and y == z:
                            count += 1
                        else:
                            count += 3
        print(count)            
    else:
        print("0")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
for i in range(1, n+1):
    cnt = 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 == i:
                    cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


for i in range(1, N+1):
    num = 0
    sqi = int(float(i)**0.5)
    for j in range(1,sqi+1):
        sqj = int(float(i-j**2)**0.5)
        for k in range(1, sqj+1):
            sqk = int(float(i-j**2-k**2)**0.5)
            for l in range(1, sqk+1):
                if j**2+k**2+l**2+j*k+k*l+l*j == i:
                    num +=1
    print(num)

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())

count = 0
for n in range(1, N + 1):
    sqrt_n = int(math.sqrt(n))
    for i in range(1, sqrt_n):
        for p in range(1, sqrt_n):
            for q in range(1, sqrt_n):
                if i ** 2 + p ** 2 + q ** 2 + i * p + p * q + i * q > n:
                    break
                elif i ** 2 + p ** 2 + q ** 2 + i * p + p * q + i * q == n:
                    count += 1
    print(count)
    count = 0

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
### Problem C
import math

N = int(input())

for x in range(1,N+1):
    cnt = 0
    up = int(math.sqrt(x))+1
    for i in range(1,up):
        for j in range(1,up):
            for k in range(1,up):
                if (i + j + k)**2 == x + (i*j + j*k + k*i):
                    cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1, N + 1):
    max_xyz = 1
    for k in range(1, N + 1):
        if k * k > n:
            break
        max_xyz = k
    c = 0
    for x in range(1, k + 1):
        for y in range(1, k - x + 1):
            for z in range(1, k - x - y + 1):
                p = x * x + y * y + z * z + x * y + y * z + z * x
                if p == n:
                    c += 1
    print(c)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
import math
n1=int(math.sqrt(N))
for i in range(1,N+1) :
  count=0
  n1 = int(math.sqrt(i))
  for x in range(1,n1+1) :
    n2 = int(math.sqrt(N-x*x))
    for y in range(1,n2+1) :
      n3 = int(math.sqrt(N - y * y))
      for z in range(1,n3) :
        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:
import  math
n = int(input())

for x in range(1,n+1):
    m = int(math.sqrt(x))
    cnt = 0
    for i in range(1,m+1):
        for j in range(i,m+1):
            for l in range(j,m+1):
                if i*i + j*j + l*l +i*j + j*l+l*i == x:
                    if i != j and j != l and l != i:
                        cnt += 6
                    elif (i == j and j!= l) or (i == l and j!= l) or (l == j and i!= l):
                        cnt  += 3
                    else:
                        cnt +=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
N_ = int(N**0.5)+2
for i in range(1,N+1):
    ans = 0
    for x in range(1,N_):
        for y in range(1,N_):
            if N <= x*y:
                break
            for z in range(1,N_):
                tmp = x**2+y**2+z**2+x*y+y*z+z*x
                if N <= tmp:
                    break
                if tmp == i:
                    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 x in range(1, math.floor(math.sqrt(i))+1):
        for y in range(1, math.floor(math.sqrt(i-x*x))+1):
            for z in range(1, math.floor(math.sqrt(abs(i-x*x-y*y-x*y)))+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:
# coding: utf-8
import itertools
import math

N = int(input())
saidai = int(math.sqrt(N))

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

def f(n):
    count = 0
    for (x, y, z) in itertools.product("".join(map(str, (range(1, saidai + 1)))), repeat=3):
        if g(int(x), int(y), int(z)) == n:
            count += 1
    return count

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

Submission status: Time Limit Exceeded

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
for i in range(1, n+1):
    ans = 0
    for x in range(1, 50):
        for y in range(1, 50):
            for z in range(1, 50):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for k in range(1,N+1):
    count= 0
    for x in range(1,N//2):
        for y in range(1,N//2):
            for z in range(1,N//2):
                if (x**2 + y**2+ z**2+(x*y)+(y*z)+(z*x)) == k:
                    count +=1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

N = ii()
did = 1
while did != N+1:
    mark = math.ceil(sqrt(did))
    count = 0
    for x in range(1,mark):
        if x ** 2 >= N:
            break
        for y in range(1,mark):
            if x ** 2 + y ** 2 + x*y >= N:
                break
            for z in range(1,mark):
                if x ** 2 + y ** 2 + z ** 2 + x*y + y*z + z*x >= N:
                    break
                if x**2 + y ** 2 + z ** 2 + x*y + y*z + z*x == did:
                    count += 1
    print(count)
    did += 1

Submission status: Time Limit Exceeded

Solution code:
#C
import math

N = int(input())


for i in range(1, N+1):
    count = 0
    for j in range(1, int(math.sqrt(i))):
        for k in range(1, int(math.sqrt(i))):
            for l in range(1, int(math.sqrt(i))):
                if i == (j+k+l) ** 2 - (j*k + k*l + l*j):
                    count += 1

    print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=int(n**(1/2)+1)
import itertools
for i in range(1,n+1):
    res=0
    for x in range(1,p):
        for y in range(1,p):
            for z in range(1,p):
                if x*x+y*y+z*z+x*y+y*z+z*x == i:
                    res+=1
    print(res)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

ans_list = []
for i in range(n):
    ans=0
    N = i+1
    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:
                    ans+=1
    ans_list.append(ans)

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

Submission status: Time Limit Exceeded

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