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 numpy as np
N = int(input())
result = np.zeros([100,100,100])

for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            result[i][j][k] = int(i*i+i*j+j*j+j*k+k*k+k*i )
for i in range(1,N+1):
    print(np.sum(result == i))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
ans=[0]*N
for x in range(1,int((N-1)/2)):
    for y in range(x,int((N-1)/2)):
        for z in range(y,int((N-1)/2)):
            if x**2+y**2+z**2+x*y+y*z+z*x<=N:
                if x==y and y==z:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
                elif x==y or y==z or z==x:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=3
                else:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=6
            else:
                continue
for n in range(N):
    print(ans[n])

Submission status: Time Limit Exceeded

Solution code:
def f(n):
  count = 0
  for i in range(1,n+1):
    for j in range(1,n+1):
      for l in range(1,n+1):
        if (i+j)**2 + (j+l)**2 + (l+i)**2 == 2*n:
          count += 1
  return (count)
n = int(input())
for i in range(1,n+1):
  print(f(i))

Submission status: Time Limit Exceeded

Solution code:
import itertools

N = int(input())

def f(n):
  count = 0
  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 + z*x) == 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

def func(n):
    cnt = 0
    n = min(n, 20)
    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 + z * x == n:
                    cnt += 1
    return cnt


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

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

num_m = (N-4)//2

for x in range(1, num_m):
    for y in range(1, num_m-x):
        for z in range(1, num_m-x-y):
            n = x**2+y**2+z**2+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:
# vim: fileencoding=utf-8


def main():
    N = int(input())
    for n in range(1, N + 1):
        ans = 0
        if n <= 5:
            print(ans)
            continue
        for x in range(1, int((N + 1) / 6) + 1):
            tx = x ** 2
            if tx >= n:
                break
            for y in range(1, int((N + 1) / 6) + 1):
                ty = tx + y ** 2 + x * y
                if ty >= n:
                    break
                for z in range(1, int((N + 1) / 6) + 1):
                    t = ty + z ** 2 + y * z + z * x
                    if t == n:
                        ans += 1
        print(ans)


if __name__ == "__main__": main()

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    for n in range(1, N + 1):
        res = 0
        for x in range(1, int(pow(n, 0.5)) + 1):
            for y in range(1, int(pow(n, 0.5)) + 1):
                t = n - pow(x, 2) - pow(y, 2) - x * y
                if t >= 1:
                    for z in range(1, int(pow(t, 0.5)) + 1):
                        if pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == n:
                            res += 1
        print(res)


if __name__ == '__main__':
    resolve()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import math

N=int(input())
count=[0]*(N+1)
for i in range(N):
  for x in range(1,int(math.sqrt(N+1))):
    for y in range(1,int(math.sqrt(N+1))):
      for z in range(1,int(math.sqrt(N+1))):
        if(x**2+y**2+z**2+x*y+y*z+z*x==i):
          count[i]+=1
for j in range(1,N+1):
  print(count[j])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()

    for i in range(1,N+1):
        if i < 3:
            print(0)
        else:
            ans = 0
            x_max = int(i**0.5)
            for x in range(1, x_max+1):
                for y in range(x, i-3):
                    for z in range(y, i-2):
                        if x*x+y*y+z*z+x*y+y*z+z*x == i:
                            setnum = len(set([x,y,z]))
                            if setnum == 1:
                                ans += 1
                            elif setnum == 2:
                                ans += 3
                            elif setnum == 3:
                                ans += 6
            
            print(ans)


if __name__ == "__main__":
	main()

Submission status: Time Limit Exceeded

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

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 < z ** 2 or i < y ** 2 or i < x ** 2:
          break

        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(N):
    count = 0
    for x in range(1, 100):
        if 2 * ((x + 1) ** 2) + 4 > 2 * N:
            break
        for y in range(x, 100):
            if ((x + y) ** 2 + (y + 1) ** 2 + (1 + x) ** 2) > 2 * N:
                break
            for z in range(y, 100):
                # print(x, y, z)
                score = ((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2)
                if score == 2 * (i + 1):
                    if x == y == z:
                        count += 1
                    elif x == y or y == z:
                        count += 3
                    else:
                        count += 6
                if score > 2 * (i + 1):
                    break
    print(count)

Submission status: Time Limit Exceeded

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

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 (x+y)**2 > 2*n-8:
                    break
                for z in range(1, max):
                    if (y+z)**2 > 2*n-8 or (x+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())
n = int(N**(1/2))+1 
count = 0
for i in range(1,N+1):
    c = 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 == i:
                    c+=1
    print(c)

Submission status: Time Limit Exceeded

Solution code:
def function(N):
    for n in range(1, N+1):
        if n < 6:
            print(0)
        else:
            number = 0
            for x in range(1, n-4):
                for y in range(1, n-4):
                    for z in range(1, n-4):
                        if int((x+y)**2+(y+z)**2+(z+x)**2) == 2*n:
                            number += 1

            print(number)


if __name__ == '__main__':
    N = int(input())
    function(N)

Submission status: Time Limit Exceeded

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

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
A = [0 for _ in range(N)]
u = math.floor((2*N)**0.5)
for x in range(1,u+1):
    for y in range(1,u+1):
        for z in range(1,u+1):
            c = x**2+y**2+z**2+x*y+y*z+z*x
            if c <= N:
                A[c-1] += 1
for i in range(N):
    print(A[i])

Submission status: Time Limit Exceeded

Solution code:
n=int(input(''))
for i in range(n):
    s=0
    p=0
    for a in range(100):
        x=a+1
        p=p+x**2
        if p<i+1:
            for b in range(100):
                y=b+1
                p=p+y**2+x*y
                if p<i+1:
                    for c in range(100):
                        z=c+1
                        p=p+z**2+y*z+x*z
                        if p==i+1:
                            s=s+1
                        p=p-z**2-y*z-x*z
                p=p-y**2-x*y
        p=p-x**2
    
    print(s)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
ans=[0]*N
for x in range(1,int((N-1)/2)):
    for y in range(x,int((N-1)/2)):
        for z in range(y,int((N-1)/2)):
            if x**2+y**2+z**2+x*y+y*z+z*x<=N:
                if x==y and y==z:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
                elif x==y or y==z or z==x:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=3
                else:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=6
for n in range(N):
    print(ans[n])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

tmp_list = [0] * (N + 1)
X = N
Y = N
Z = N
flg = False
for x in range(1, X + 1):
    for y in range(1, Y + 1):
        for z in range(1, Z + 1):
            tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if(tmp <= N):
                tmp_list[tmp] += 1
            elif(tmp > N):
                break

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

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

def xyz(n):
    count = 0
    for i in range(1, int(math.sqrt(n))):
        for j in range(1, int(math.sqrt(n))):
            for k in range(1, int(math.sqrt(n))):
                zyx = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
                if zyx == n:
                    count += 1
    return count


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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

ans=0
for i in range(1,N+1):
    for j in range(1,N):
        for k in range(1,N):
            for l in range(1,N):
                if l**2+j**2+k**2+l*j+j*k+k*l==i:
                    ans+=1
    print(ans)
    ans=0

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1, N+1):
    result = 0
    limit = int(pow(n, 0.5)) + 1
    for x in range(1, limit):
        for y in range(1, x+1):
            for z in range(1, y+1):
                if pow(x+y, 2) + pow(y+z, 2) + pow(z+x, 2) == 2*n:
                    if x != y and y != z and z != x:
                        result += 6
                    elif x != y or y != z or z != x:
                        result += 3
                    else:
                        result += 1
    print(result)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
def fn(n):
  lis=[]
  i=1
  while i**2<=2*n:
    lis.append(i)
    i+=1
  rtn=0
  for i,a in enumerate(lis):
    for j in range(i,len(lis)):
      b=lis[j]
      for k in range(j,len(lis)):
        c=lis[k]
        if a**2+b**2+c**2==2*n:
          x,y,z=(a-b+c)/2,(a+b-c)/2,(b+c-a)/2
          if x%1==0 and y%1==0 and z%1==0: 
            if x>0 and y>0 and z>0:
              if x==y and y==z: rtn+=1
              elif x==y or y==z or z==x: rtn+=3
              else: rtn+=6
  return rtn

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

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

N = int(input())


def solv_quadratic_equation(a, b, c):
    if b**2 - 4*a*c<0:
        return 0.1, 0.1
    D = (b**2 - 4*a*c) ** (1/2)
    x_1 = (-b + D) / (2 * a)
    x_2 = (-b - D) / (2 * a)

    return x_1, x_2

for n in range(1,N+1):
    ans=0
    for x in range(1,int(sqrt(n))+1):
        for y in range(1,int(sqrt(n))+1):
            z1,z2=solv_quadratic_equation(1,x+y, x**2+y**2+x*y-n)
            if z1.is_integer() and z1>=1:
                ans+=1
            if z2.is_integer() and z2>=1:
                ans+=1

    print(ans)

Submission status: Time Limit Exceeded

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

n=math.floor(math.sqrt(N))

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

import math
for a in range(1, N+1):
    n = 0
    top = int(math.sqrt(N))+1
    for b in range(1, top):
        for c in range(1, top):
            for d in range(1, top):
                if (b**2) + (c**2) + (d**2) + (b*c) + (c*d) + (d*b) == a:
                    n += 1
    print(n)

Submission status: Time Limit Exceeded

Solution code:
from itertools import combinations_with_replacement
from math import sqrt


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

Submission status: Time Limit Exceeded

Solution code:
a=int(input())
b=a//2
for w in range(1,a+1):
    if w<5:
        print(0)
    else:
        total=0
        for i in range(1,b):
            for j in range(1,b):
                for k in range(1,b):
                    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:
import numpy as np
def f(n):
    count = 0
    x_max = int(np.sqrt(n-5)//1)
    for x in range(1,x_max+1):
        y_max = int(np.sqrt(n-x**2-4)//1)
        for y in range(1,y_max+1):
            z_max = int(np.sqrt(n-x**2-y**2-3)//1)
            for z in range(1,z_max+1):
                if x**2+y**2+z**2+x*y+y*z+z*x == n:
                    count += 1
    return count

N = int(input())
if N >=6:
    for i in range(5):
        print(0)
    for i in range(5,N):
        print(f(i+1))
else:
    for i in range(N):
        print(0)

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 < z ** 2 or i < y ** 2:
          break

        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:
#C
N = int(input())
for a in range(1,N+1):
    counter = 0
    for i in range(1,150):
        for j in range(1,150):
            for k in range(1,150):
                if (i+j)**2+(j+k)**2+(k+i)**2==2*a:
                    counter +=1
    print(counter)

Submission status: Time Limit Exceeded

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

def func_count(i):
    end = int(math.sqrt(i) + 1)
    ans = 0
    for x in range(1, end):
        for y in range(1, end):
            for z in range(1, end):
                if i == x*x + y*y + z*z + x*y + y*z + z*x:
                    ans += 1
    return ans

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

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):
      if (x+y)**2 > 2*i:
        break
      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:
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 = 41
        #print("n={}, upper={}".format(n, upper))
        for x in range(1, upper):
            for y in range(1, upper):
                val_y = x**2 + x*y + y**2
                for z in range(1, upper):
                    if val_y + z**2 + x*z + y*z == n:
                        ans += 1
        print(ans)



if __name__ == "__main__":
    main()

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 (x+y)**2 > 2*n-8:
                    break
                for z in range(1, max):
                    if (y+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())
res=0
for i in range(1,n+1):
    for x in range(1,int((((2*n)**0.5))/2)+1):
        for y in range(1,int((((2*n)**0.5))/2)+1):
            for z in range(1,int((((2*n)**0.5))/2)+1):
                if (x+y)**2+(y+z)**2+(z+x)**2==2*i:
                    res+=1
    print(res)
    res=0

Submission status: Time Limit Exceeded

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

for i in range(1,N+1):
  ans = 0
  n = math.ceil(math.sqrt(i))
  for j in range(1,n):
    n_sub_j = i - j*j
    if n_sub_j <= 0:
      break
    for k in range(1,n):
      n_sub = n_sub_j - k*k -j*k
      if n_sub <= 0:
        break
      b = j + k
      check = ((b**2 + 4*n_sub) ** (1/2) - b)
      if check % 2 == 0:
        ans +=1
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def culc(number):
    count = 0
    num = int(number ** 0.5)
    for i in range(1, num+1):
        for j in range(1, num+1):
            for k in range(1, num+1):
                tmp = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
                if tmp == number:
                    count += 1
    return count

for i in range(1, n+1):
    if i < 6:
        print(0)
    elif i == 6:
        print(1)
    else:
        print(culc(i))

Submission status: Time Limit Exceeded

Solution code:
import math

def f(x0,y0,z0):
  return x0**2 + y0**2 + z0**2 + x0*y0 + y0*z0 + z0*x0

n=int(input())

for i in range(1,n+1):
  c=0
  lim=int(math.sqrt(i))
  for x in range(1,lim+1):
    for y in range(1,lim+1):
      if x**2+y**2+x*y > n:
        break
      for z in range(1,lim+1):
        ans=f(x,y,z)
        if ans==i:
          c+=1
          break
        elif ans > n:
          break
  print(c)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

for i in range(1,N+1):
    ##print(str(i))
    count=0
    for x in range(1,i):
        for y in range(1,i):
            for z in range(1,i):
                if x*x+y*y+z*z+x*y+y*z+z*x==i and x>=1 and y>=1 and z>=1:
                    ##print(str(x)+" "+str(y)+" "+str(z))
                    count+=1
    print(str(count))

Submission status: Time Limit Exceeded

Solution code:
import math

N=int(input())
count=[0]*(N+1)
for i in range(N):
  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):
          count[i]+=1
for j in range(1,N+1):
  print(count[j])

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
            y += 1
        x += 1
    print(count)

Submission status: Time Limit Exceeded

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

for i in range(1,N+1):
    if i <= 10 and i != 6:
        print('0')
    elif i == 6:
        print('1')
    else:
        ans = 0
        limit = int(math.sqrt(i))
        for x in range(1,limit+1):
            for y in range(1,limit+1):
                for z in range(1,limit+1):
                    if x**2 + y ** 2 + z ** 2 + x*y + y*z + z*x == i:
                        ans += 1
        print(ans)
        # if ans != 0:
        #     print(i)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
n=math.sqrt(N)
n=int(n)
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*x+y*y+z*z+x*y+y*z+z*x==i:
                    cnt+=1
                if x*x+y*y>i:
                    break
    print(cnt)

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-x**2)**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())

def ff(n):
    ans = 0
    for x in range(1,int(-(-n**0.5//1))+1):
        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:
N = int(input())

ans = [0] * (N+1)

for a in range(1, N+1):
    for i in range(1, int(N**0.5)):
        for j in range(1, i+1):
            for k in range(1, j+1):
                tmp = i**2+j**2+k**2+i*j+j*k+k*i
                if tmp == a and (i==j and j==k and k==i):
                    ans[a] += 1
                elif tmp == a and (i != j and j != k and k != i):
                    ans[a] += 6
                elif tmp == a:
                    ans[a] += 3

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

Submission status: Time Limit Exceeded

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

for n in range(1, N+1):
    count = 0
    for x in range(1, int(sqrt(n))):
        for y in range(1,int(sqrt(n))):
            for z in range(1, int(sqrt(n))):
                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:
from math import sqrt

N = int(input())
for i in range(1, N+1):
    ans = 0
    if i <= 5:
        print(0)
        continue
    for j in range(1, int(sqrt(i-2))+1):
        for k in range(1, int(sqrt(i-2))+1):
            for l in range(1, int(sqrt(i-2))+1):
                if j**2+k**2+l**2+j*k+k*l+l*j==i:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
l=[]
n=int(input())
for x in range(1,10**2+1):
    for y in range(1,10**2+1):
        for z in range(1,10**2+1):
            l.append(x**2+y**2+z**2+x*y+y*z+z*x)

for x in range(1,n+1):
    print(l.count(x))

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
      z_max = int(nokori**0.5)+1
      for z in range(y,z_max):
        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:
import math

L=input()
L=int(L)
for b in range(1,L+1):
    i=0
    a=math.sqrt(b)
    a=int(a)
    for x in range(1,a+1):
        for y in range(1,a+1):
            for z in range(1,a+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==b:
                    i+=1
    print(i)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

arr = [0 for _ in range(N+1)]
def DFS(x,y,z):
    n = (x**2)+(y**2)+(z**2)+(x*y)+(y*z)+(z*x)
    if n <= N:
        if x == y and y == z:
            arr[n] += 1
        elif (x == y) or (y == z) or (z == x):
            arr[n] += 3
        else:
            arr[n] += 6
        if x+1<=y:
            DFS(x+1,y,z)
        if y+1<=z:
            DFS(x,y+1,z)
        DFS(x,y,z+1)
    return(0)

DFS(1,1,1)
for i in arr[1:]:
    print(i)

Submission status: Time Limit Exceeded

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

upper = int(math.sqrt(N/2)) + 1
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:
import numpy as np
N = int(input())
n = int(np.sqrt(N))+1 
count = 0
for i in range(1,N+1):
    c = 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 == i:
                    c+=1
    print(c)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=[0]*(n+1)
m=n
for x in range(1,m):
    for y in range(1,m-x):
        for z in range(1,m-x-y):
            value=x*x+y*y+z*z+x*y+y*z+z*x
            if value>n:
                m=x+y+z
                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:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

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

def solv_quadratic_equation(a, b, c):
    """ 2次方程式を解く  """
    D = (b**2 - 4*a*c)
    
    if D<0:
        return None,None
    D = D ** (1/2)
    x_1 = (-b + D) / (2 * a)
    x_2 = (-b - D) / (2 * a)

    return x_1, x_2

N=one_int()

def solve(n):
    ret = []
    X=int(n**(1/2) +0.5)+1
    Y=int(n**(1/2) +0.5)+1 
    Z=int(n**(1/2) +0.5)+1
    for x in range(1,X):
        for y in range(1,Y):
#             ans1, ans2 = solv_quadratic_equation(1, y+x, x**2 + y**2 + x*y -n)
#             if ans1 is None:
#                 continue
            for z in range(1,Z):
                if (x**2 + y**2 + z**2 + y*z + x*y + z*x)==n:
                    ret.append((x,y,z))
    return len(set(ret))

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

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//5):
        for y in range(1,N//5):
            for z in range(1,N//5):
                if (x**2 + y**2+ z**2+(x*y)+(y*z)+(z*x)) == k:
                    count +=1
    print(count)