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
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit_1 = int(i ** 0.5)
    j = 0
    k = 0
    l = 0
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j != k and k != l:
                        xyz_count += 6
                    elif j == k and k > l or j > k and k == l:
                        xyz_count += 3
                    else:
                        xyz_count += 1
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit_1 = int(i ** 0.5)
    j = 0
    k = 0
    l = 0
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j == k and k == l:
                        xyz_count += 1
                    elif j == k and k > l or j > k and k == l:
                        xyz_count += 3
                    else:
                        xyz_count += 6
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit_1 = int(i ** 0.5)
    j = 0
    k = 0
    l = 0
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j == k and k == l:
                        xyz_count += 1
                    elif j == k and k > l or j > k and k == l:
                        xyz_count += 3
                    else:
                        xyz_count += 6
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit_1 = int(num_limit**0.5)
s_limit_2 = int((num_limit/2)**0.5)
s_limit_3 = int((num_limit/3)**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit_1 = int(i ** 0.5)
    j = 0
    k = 0
    l = 0
    for j in range(1,s_limit_1+1):
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j == k and k == l:
                        xyz_count += 1
                    elif j == k and k > l or j > k and k == l:
                        xyz_count += 3
                    else:
                        xyz_count += 6
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit_1 = int(num_limit**0.5)
s_limit_2 = int((num_limit/2)**0.5)
s_limit_3 = int((num_limit/3)**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit_1 = int(i ** 0.5)
    j = 0
    k = 0
    l = 0
    for j in range(1,s_limit_1+1):
        for k in range(1,j+1):
            for l in range(1,k+1):
                if i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j == k and k == l:
                        xyz_count += 1
                    elif j == k and k > l or j > k and k == l:
                        xyz_count += 3
                    else:
                        xyz_count += 6
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

def f_count(j):
    count=0
    rt=int(j**0.5)
    for x in range(1,rt):
        for y in range(1,rt):
            for z in range(1,rt):
                if x**2+y**2+z**2+x*y+y*z+z*x==j:
                    count+=1
    return count
    
for i in range(1,n+1):
    print(f_count(i))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

def f_count(j):
    count=0
    rt=int(j**0.5)+1
    for x in range(1,rt):
        for y in range(1,rt):
            for z in range(1,rt):
                if x**2+y**2+z**2+x*y+y*z+z*x==j:
                    count+=1
    return count
    
for i in range(1,n+1):
    print(f_count(i))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for x in range(1,N+1):
  cnt = 0
  for i in range(1,100):
    for j in range(1,100):
      for k in range(1,100):
        if (i+j+k)**2-(i*j+i*k+j*k) == x:
          cnt += 1
  
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit_1 = int(num_limit**0.5)
s_limit_2 = int((num_limit/2)**0.5)
s_limit_3 = int((num_limit/3)**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit_1 = int(i ** 0.5)
    for j in range(1,s_limit_1+1):
        for k in range(1,j+1):
            for l in range(1,k+1):
                if i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j == k and k == l:
                        xyz_count += 1
                    elif j == k and k > l or j > k and k == l:
                        xyz_count += 3
                    else:
                        xyz_count += 6
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
ans = [0 for _ in range(n+1)]
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v >n:
                break
            ans[v]+=1
for i in range(n):
    print(ans[i+1])

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))


N = int(input())

for n in range(1, N + 1):
    ans = 0
    n_range = int(math.sqrt(n))
    for z in range(1, n_range):
        y_range = int(math.sqrt(n - z ** 2))
        for y in range(1, min(n_range, y_range)):
            x_range = int(math.sqrt(n - y ** 2 - z ** 2))
            for x in range(1, min(x_range, n_range)):
                if x**2 + y**2 + z ** 2 + x*y + y*z + x*z == n:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))


N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
from math import *
def f(n):
    ans = 0
    r = range(1, int(sqrt(n))+1)
    return sum(x**2 + y**2 + z**2 + x*y + y*z + z*x == n for x in r for y in r for z in r)

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for j in range(1,N+1):
  if 1 <= j < 6:
    print(0)
  else:
    count = 0
    X = int(-1+(j-2)**0.5)
    for x in range(1,X+1):
      Y = int((-x-1+(-2*(x**2)-2*x-3+4*j)**0.5)/2)
      for y in range(1, Y+1):
        Z = int((-x-y+(-3*(x**2)-3*(y**2)-2*x*y+4*j)**0.5)/2)
        for z in range(1, Z+1):
          if (x**2) + (y**2) + (z**2) + x*y +y*z + z*x == j:
            count += 1
    print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# C
N = int(input())
sqrt = int(N ** 0.5)
ans = 0

for n in range(1, N + 1):
    ans = 0
    for x in range(1, sqrt + 1):
            for y in range(1, sqrt + 1):
                if (x ** 2 + y ** 2 > n):
                    continue
                for z in range(1, sqrt + 1):
                    num = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                    if (num > n):
                        continue
                    if (num == n):
                        ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
# C
N = int(input())
sqrt = int(N ** 0.5)
ans = 0

for n in range(1, N + 1):
    ans = 0
    for x in range(1, sqrt + 1):
            for y in range(1, sqrt + 1):
                for z in range(1, sqrt + 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 n in range(1, N+1):
  count = 0
  for i in range (1, 101):
    if i*i > n:
      break
    for j in range(1, 101):
      if i*i+j*j > n:
        break
      for k in range(1, 101):
        if i*i+j*j+k*k >n:
          break
        if i*i+j*j+k*k+i*j+j*k+k*i == n:
          count += 1

  print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1, N+1):
  count = 0
  for i in range (1, 101):
    for j in range(1, 101):
      for k in range(1, 101):
        if i*i+j*j+k*k+i*j+j*k+k*i == n:
          count += 1

  print(count)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
counter = 0

for n in range(1,a+1):
    for xi in range(1,n):
        for yi in range(1,n):
            for zi in range(1,n):
                if xi**2 + yi**2 + zi**2 + xi*yi + yi*zi + zi*xi == n:
                    counter += 1
                    break
    print(counter)
    counter = 0

Submission status: Time Limit Exceeded

Solution code:
import math
n=int(input())
def form(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x

for l in range(1,n+1):
    ans=0
    m=int(math.sqrt(l))+1
    for i in range(1,m):
        for j in range(1,i+1):
            for k in range(1,j+1):
                if form(i,j,k)==l:
                    if i==j and j==k:
                        ans+=1
                        continue
                    if i==j and k!=i:
                        ans+=3
                        continue
                    if j==k and i!=k:
                        ans+=3
                        continue
                    if k==i and j!=k:
                        ans+=3
                        continue
                    else:
                        ans+=3
                        continue
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
n=int(input())
def form(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x

for l in range(1,n+1):
    ans=0
    m=int(math.sqrt(l))+1
    for i in range(1,m+1):
        for j in range(1,i+1):
            for k in range(1,j+1):
                if form(i,j,k)==l:
                    if i==j and j==k:
                        ans+=1
                        continue
                    if i==j and k!=i:
                        ans+=3
                        continue
                    if j==k and i!=k:
                        ans+=3
                        continue
                    if k==i and j!=k:
                        ans+=3
                        continue
                    else:
                        ans+=3
                        continue
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

for i in range(1, n+1):
  if i <= 5:
    print(0)
  else:
    cnt = 0
    for x in range(1, math.floor(math.sqrt(i-5))+1):
      for y in range(1, math.floor(math.sqrt(i-x**2-4))+1):
        for z in range(1, math.floor(math.sqrt(i-x**2-y**2-3))+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):
    cnt = 0
    for x in range(1,101):
        if x*x<= i:
            for y in range(1,101):
                if x*x + y*y + x*y <= i:
                    for z in range(1,101):
                        if x*x + y*y + z*z + x*y + x*z + y*z == i:
                            cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

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

import math


def g(nx, ny, nz):
    return nx ** 2 + ny ** 2 + nz ** 2 + nx * ny + ny * nz + nz * nx


def solve(n):
    
    counter = [0 for _ in range(n + 1)]
    
    for z in range(1, n):
        for y in range(1, z + 1):
            for x in range(1, y + 1):
                gn = g(x, y, z)
                if gn <= n:
                    counter[gn] += 3
    
    for x in range(int(math.sqrt(n) + 1)):
        nx = 6 * x ** 2
        if nx <= n:
            counter[nx] -= 2
    
    for i in range(1, n + 1):
        print(counter[i])


N = int(input())

solve(N)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

for i in range(1, n+1):
  if i <= 5:
    print(0)
  else:
    max = math.floor(math.sqrt(i-5))
    cnt = 0
    for x in range(1, max+1):
      for y in range(1, max+1):
        for z in range(1, max+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())

def f(n):
    flag = False
    #total = 0
    ans = 0
    i = 100
    for x in range(1,i):
        for y in range(1,i):
            for z in range(1,i):
                if (x + y + z)**2 - (x*y + y*z + x*z) == n:
                    #total += 1
                    flag = True
                    break
            if flag:
                break
        if flag:
            break
    if x == i-1:
        ans = 0
    elif x == y and  y== z:
        ans = 1
    elif x == y or y == z or x == z:
        ans = 3
    else:
        ans = 6
    return ans

for i in range(1,N+1):
    print(f(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,99):
    for y in range(1,99):
      for z in range(1,99):
        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:
# -*- coding: utf-8 -*-

import math


def g(nx, ny, nz):
    return nx ** 2 + ny ** 2 + nz ** 2 + nx * ny + ny * nz + nz * nx


def is_int(fn):
    return float(int(fn)) == float(fn)


def solve(n):
    min_z = max(1, int(math.sqrt(n) / 3))
    max_z = max(1, int(math.sqrt(n - 2) - 1) if n > 2 else 1)
    max_x = max(1, int(math.sqrt(n / 3) + 1))
    
    counter = 0
    
    for z in range(max(1, min_z), max_z + 1):
        for y in range(1, z + 1):
            for x in range(1, min(y + 1, max_x)):
                if g(x, y, z) == n:
                    counter += 1
    
    counter *= 3
    
    if is_int(math.sqrt(n / 6)):
        counter -= 2
    
    print(counter, flush=True)


N = int(input())

for ni in range(1, N + 1):
    solve(ni)

Submission status: Time Limit Exceeded

Solution code:
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
for i in range(1, n+1):
    cnt = 0
    for x in range(1, int(math.sqrt(i+1))):
        for y in range(1, int(math.sqrt(i+1))):
            d = (x+y)**2 -4*(x*x + y*y + x*y - i)
            if d < 0:
                pass
            else:
                z = (-(x+y)+math.sqrt(d))/2
                if z == int(z) and z >= 1:
                    cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())
arr = [0] * n

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

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

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())
arr = [0] * n

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

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

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+1):
        for y in range(1, N-x+1):
            for z in range(1, N-x-y+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())

lst = [0]*n
a = int(n ** 0.5)

for x in range(1, a):
    for y in range(1, a):
        for z in range(1, a):
            b = x**2 + y**2 + z**2 + x*y + y*z + z*x
            while b <= n:
                lst[b - 1] += 1

for i in lst:
    print(i)

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+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:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [0]*n
cnt = 0
for i in range(1,int((n-3)**1/2 //1)):
  for j in range(1,int((n-i**2)**1/2 //1)):
    for k in range(1,int((n-i**2-j**2)**1/2 //1)):
      b = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if b <= n:
        a[b-1] += 1

for i in a:
  print(i)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [0]*n
cnt = 0
for i in range(1,int((n-3)**1/2 //1)):
  for j in range(1,int((n-i**2)**1/2 //1)):
    for k in range(1,int((n-i**2-j**2)**1/2 //1)):
      b = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if b <= n:
        a[b-1] += 1

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

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
#for i in range(1,N+1):
    #print(sum(1 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+z)+y*(y+z)+z*z==i))
for i in range(1,N+1):
    count=0
    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+z)+y*(y+z)+z*z>i:
                    break
                    
                if x*(x+y+z)+y*(y+z)+z*z==i:
                    count+=1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
t = [0] * (n + 1)
for x in range(1,n + 1):
    for y in range(1,n - x):
        for z in range(1,n - x - y):
            k = x * x + y * y + z * z + x * y + y * z + x * z
            if k <= n:
                t[k] += 1

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

Submission status: Time Limit Exceeded

Solution code:
kosuu = int(input())

x=[x for x in range(1,101)]
y=[x for x in range(1,101)]
z=[x for x in range(1,101)]
lis=[]

for i in range(99):
    for j in range(99):
        for k in range(99):
            nijyou=x[i]+y[j]+z[k]
            hiki=x[i]*y[j]+y[j]*z[k]+x[i]*z[k]
            kekka=nijyou*nijyou-hiki
            if kekka<10000:
                lis.append(kekka)
            else:
                break

for i in range(1,kosuu+1):
    print(lis.count(i))

Submission status: Time Limit Exceeded

Solution code:
kosuu = int(input())

x=[x for x in range(1,101)]
y=[x for x in range(1,101)]
z=[x for x in range(1,101)]
lis=[]

for i in range(99):
    for j in range(99):
        for k in range(99):
            nijyou=x[i]+y[j]+z[k]
            hiki=x[i]*y[j]+y[j]*z[k]+x[i]*z[k]
            kekka=nijyou*nijyou-hiki
            if kekka<10000:
                lis.append(kekka)

for i in range(1,kosuu+1):
    print(lis.count(i))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
kosuu = int(input())

x=[x for x in range(1,101)]
y=[x for x in range(1,101)]
z=[x for x in range(1,101)]
lis=[]

for i in range(99):
    for j in range(99):
        for k in range(99):
            nijyou=x[i]+y[j]+z[k]
            hiki=x[i]*y[j]+y[j]*z[k]+x[i]*z[k]
            kekka=nijyou*nijyou-hiki
            lis.append(kekka)

for i in range(1,kosuu+1):
    print(lis.count(i))

Submission status: Time Limit Exceeded

Solution code:
kosuu = int(input())

x=[x for x in range(1,101)]
y=[x for x in range(1,101)]
z=[x for x in range(1,101)]
lis=[]

for i in range(100):
    for j in range(100):
        for k in range(100):
            nijyou=x[i]+y[j]+z[k]
            hiki=x[i]*y[j]+y[j]*z[k]+x[i]*z[k]
            kekka=nijyou*nijyou-hiki
            lis.append(kekka)

for i in range(1,kosuu+1):
    print(lis.count(i))

Submission status: Time Limit Exceeded

Solution code:
import math
def cnt_nCnd(n):
    upper = math.ceil(math.sqrt(n))
    count = 0
    for x in range(1, upper):
        x_double = pow(x,2)
        for y in range(x, upper):
            y_double = pow(y,2)
            for z in range(y, upper):
                if x_double + y_double + pow(z,2) + x*y + y*z + z*x == n:
                    n_uniq = len(set([x, y, z]))
                    if n_uniq == 1:
                        count += 1
                    elif n_uniq == 2:
                        count += 3
                    elif n_uniq == 3:
                        count += 6
    return count


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

Submission status: Time Limit Exceeded

Solution code:
import math
def cnt_nCnd(n):
    upper = math.ceil(math.sqrt(n))
    count = 0
    for x in range(1, upper):
        x_double = x**2
        for y in range(x, upper):
            y_double = y**2
            for z in range(y, upper):
                if x_double + y_double + z**2 + x*y + y*z + z*x == n:
                    n_uniq = len(set([x, y, z]))
                    if n_uniq == 1:
                        count += 1
                    elif n_uniq == 2:
                        count += 3
                    elif n_uniq == 3:
                        count += 6
    return count


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

Submission status: Time Limit Exceeded

Solution code:
import math
def cnt_nCnd(n):
    upper = math.ceil(math.sqrt(n))
    count = 0
    for x in range(1, upper):
        for y in range(x, upper):
            for z in range(y, upper):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    if len(set([x, y ,z])) == 1:
                        count += 1
                    elif len(set([x, y ,z])) == 2:
                        count += 3
                    elif len(set([x, y ,z])) == 3:
                        count += 6
    return count


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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
f=[0]*10005
for x in range(1,n+1):
  for j in range(1,n+1):
    for z in range(1,n+1):
      c=x**2+j**2+z**2+x*j+j*z+z*x
      if c<=n:
        f[c]+=1
for i in range(1,n+1):
  print(f[i])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0
ans1 = [0] * n
for i in range(1,100):
  for j in range(1,100):
    for k in range(1,100):
      ans = i**2 + j**2 +k**2 + i*j + j*k + k*i
      for l in range(n-1):
        if(l+1 == ans):
          ans1[l] += 1
for i in range(n):
  print(ans1[i])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0
ans1 = [0] * n
for i in range(1,n):
  for j in range(1,n):
    for k in range(1,n):
      ans = i**2 + j**2 +k**2 + i*j + j*k + k*i
      for l in range(n-1):
        if(l+1 == ans):
          ans1[l] += 1
for i in range(n):
  print(ans1[i])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())
answer_list = []
for x in range(1, int(math.sqrt(n+1)), 1):
    for y in range(1, int(math.sqrt(n+1)), 1):
        for z in range(1, int(math.sqrt(n+1)), 1):
            formula = (x+y+z)**2 - (x*y + y*z + z*x)
            if formula <= n:
                answer_list.append(formula)
            else:
                break
for i in range(1, n+1, 1):
    print(answer_list.count(i))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
answer_list = []
for x in range(1, 99, 1):
    for y in range(1, 99, 1):
        for z in range(1, 99, 1):
            formula = (x+y+z)**2 - (x*y + y*z + z*x)
            if formula <= n:
                answer_list.append(formula)
            else:
                break
for i in range(1, n+1, 1):
    print(answer_list.count(i))

Submission status: Time Limit Exceeded

Solution code:
def const(n):
  set_xyz=[]
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
          
          set_xyz.append([x,y,z])
          
  return len(set_xyz)

N = int(input())
cnt=0
for i in range(1,N+1):
  cnt=const(i)
  print(cnt)

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 in itertools.product(list(range(1,int(n**0.5))),repeat=2):
        zz = n - x*x - y*y
        if zz < 1: continue
        for z in range(1,int(zz**0.5)):
            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:
from collections import deque 
import math
def calculate(x,y,z):
    n = x**2 + y**2 + z**2 + x*y + y*z + z*x
    return n


def dfs(n,x,y,z):
    queue = deque([[x,y,z]])
    count = 0
    while queue:
        x,y,z = queue.popleft()
        for dx, dy, dz in ([1,0,0],[0,1,0],[0,0,1]):
            newx, newy, newz = x + dx, y + dy, z + dz
            ans = calculate(newx,newy,newz)
            if ans == n and [newx,newy,newz] not in queue:
                count+= 1
            if x > math.sqrt(n) or y > math.sqrt(n) or z > math.sqrt(n):
                queue = []
                break
            else:
                queue.append([newx,newy,newz])
    return count

N = int(input())
list_xyz = (1,1,1)
n = list_xyz[0]**2 + list_xyz[1]**2 + list_xyz[2]**2 + list_xyz[0]*list_xyz[1] + list_xyz[1]*list_xyz[2] + list_xyz[2]*list_xyz[0] 

for i in range(1,N+1):
  count = 0
  n = calculate(list_xyz[0], list_xyz[1], list_xyz[2])
  if n == i:
      count +=1
  # count += bfs(i, list_xyz[0], list_xyz[1], list_xyz[2])
  count += dfs(i, list_xyz[0], list_xyz[1], list_xyz[2])
  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,101):
            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)