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(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x

maxv=math.ceil(math.sqrt(N)) # 探索するのはせいぜいこの数まで

for n in range(1,N+1): # 入力の数
    count=0 # カウンタ

    for x in range(1,maxv): # x
        for y in range(1,maxv): # y
            for z in range(1,maxv): # z
                r=func(x,y,z) # 式を計算する
                # print("r = ",r)

                if r==n: # もし計算の結果が狙ったものだったら
                    count+=1 # カウンタをインクリメント

    print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
N=int(input())
for n in range(1,N+1):
    ans=0
    if n<=5:
        print(ans)
        continue
    X=math.floor(n**0.5)
    for x in range(1,X+1):
        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 + x*z==n:
                    if (x==y and y!=z and z!=x) or (x!=y and y==z and z!=x) or (x!=y and y!=z and z==x): 
                        ans+=3
                    elif x==y and y==z and z==x:
                        ans+=1
                    else:
                        ans+=6
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1,N+1):
    counter=0
    for x in range(1,n+1):
        if x * x+2*x+3 > N:
            break
        for y in range(1,n+1):
            if x * x + y * y + x * y+x+y+1 > N:
                break
            for z in range(1, n + 1):
                if x * x + y * y + z * z + x * y + y * z + z * x >= N:
                    break
                if x * x + y * y + z * z + x * y + y * z + z * x == n:
                    counter += 1
    print("{}".format(counter))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count =[0] * n

for f in range(1,n+1):
    for x in range(1, f//2):
        for y in range(1, f//2):
            for z in range(1, f//2):
                if(x*x+y*y+z*z+x*y+y*z+z*x == f):
                    count[f-1]+=1

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input().strip())

x, y, z = 1, 1, 1

f = []
for i in range(N+1):
    f.append(set())

# while x**2 + y**2 + z**2 + x*y + y*z + x*z <= N:
def calc(x, y, z, f):
    # print(x, y, z)
    n = x**2 + y**2 + z**2 + x*y + y*z + x*z
    if n <= N:
        f[n].add("%d-%d-%d" % (x, y, z))
        # print(n, x, y, z)
        f = calc(x+1, y, z, f)
        f = calc(x, y+1, z, f)
        f = calc(x, y, z+1, f)
        return f
    else:
        return f

f = calc(x, y, z, f)
# while True:
#     f = calc(x, y, z, f)
#     f = calc(x+1, y, z, f)
#     f = calc(x, y+1, z, f)
#     f = calc(x, y, z+1, f)
#     f = calc(x+1, y+1, z, f)
#     f = calc(x, y+1, z+1, f)
#     f = calc(x+1, y, z+1, f)
#
#     x += 1
#     y += 1
#     z += 1
#
#     if x**2 + y**2 + z**2 + x*y + y*z + x*z > N:
#         break

for i in range(1, N+1):
    print(f[i].__len__())

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):
    max = int(math.sqrt(i - x * x))
    for y in range(1,max+1):
      if i - x * x - y * y - x * y < 1:
        continue
      max = int(math.sqrt(i - x * x - y * y - x * y))
      for z in range(1,max+1):
        if x * x + y * y + z * z + x * y + y * z + x * z == i:
          result += 1
          break
  print(result)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=[]
for i in range(1000):
  l.append(i**2)
ans=[0]*n
for i in range(1,n+1):
  ct=0
  for j1 in range(1,int(n**0.5)+2):
    for j2 in range(1,int(n**0.5)+2):
      a=j1+j2
      b=i-j1**2-j2**2-j1*j2
      for k in range(len(l)):
        if l[k]==a**2+4*b:
          if (a+k)%2==0:
            j3=(-a+k)//2
            if j3>0:
              ct+=1
  print(ct)

Submission status: Time Limit Exceeded

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

  result = 0

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

Submission status: Time Limit Exceeded

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

for N in range(1,n+1):
    result = 0
    for x in range(1,int(math.sqrt(N))+1):
        for y in range(1, int(math.sqrt(N-x**2))+1):
            if N-x**2-y**2 >= 1:
                for z in range(1, int(math.sqrt(N-x**2-y**2))+1):
                    if x**2 + y**2 + z**2 + x*y + y*z + z*x == N:
                        result += 1
                    elif x**2 + y**2 + z**2 + x*y + y*z + z*x > N:
                        break
    print(result)

Submission status: Time Limit Exceeded

Solution code:
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    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-x)))+1):
                rema = i - x**2 - y**2 - x*y
                if rema > 0:
                    for z in range(1, rema):
                        if z**2 + (x+y)*z == rema:
                            cnt += 1
                            break
                else:
                    break
        print(cnt)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Time Limit Exceeded

Solution code:
from numba import njit
N = int(input())

@njit
def func(n):
    if n <= 5:
        return 0
    else:
        cnt = 0
        max = int((2*n-8)**0.5)
        for x in range(1, max):
            if x**2 >= n:
                break
            for y in range(1, max):
                if x**2 + y**2 >= n:
                    break
                for z in range(1, max):
                    if x**2 + y**2 + z**2 >= n:
                        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())

dp = [[[0 for i in range(N)]for i in range(N)]for i in range(N)]
x = 1
y = 1
z = 1

    
a = 0
for i in range(1,N+1):
    while i >= x**2 + y**2 + z**2 + x*y + y*z + z*x:
        while i >= x**2 + y**2 + z**2 + x*y + y*z + z*x:
            while i >= x**2 + y**2 + z**2 + x*y + y*z + z*x:
                if dp[x][y][z] == 0:
                    dp[x][y][z] = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if dp[x][y][z] == 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:
import math
n=int(input())
for i in range(1,n+1):
  square=[j**2 for j in range(1,(int(math.sqrt(2*i))+1))]
  cnt=0
  for x in square:
    for y in square:
      for z in square:
        if x+y+z==2*i and x+y>z and y+z>x and z+x>y: 
          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,i-2):
    for y in range(1,i-x+1):
      for z in range(1,i-x-y+1):
        if i==x**2+y**2+z**2+x*y+y*z+z*x:
          cnt+=1
  print(cnt)

Submission status: Time Limit Exceeded

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

for i in range(1,N+1):
  n_max=math.ceil(math.sqrt(i))
  res=0
  for x in range(1,n_max+1):
    for y in range(1,n_max+1):
      for z in range(1,n_max+1):
        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:
from math import sqrt

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

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
for n in range(1, N+1):
    nn = int(n**0.5+1)
    ans = 0
    for x in range(1, nn):
        for y in range(1, nn):
            d = n-x*x-y*y-x*y
            if d < 0:
                break
            for z in range(1, nn):
                zz = z*z+z*(x+y)
                if d == zz:
                    ans += 1
                elif zz > d:
                    break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
def f(n):
    count = 0
    x_max = int(np.sqrt(n/6)//1)
    for x in range(1,x_max+1):
        y_max = int(np.sqrt((n-x**2-2*x)/3)//1)
        for y in range(x,y_max+1):
            z_max = int(np.sqrt(n-x**2-y**2-x*y-x-y)//1)
            for z in range(y,z_max+1):
                if x**2+y**2+z**2+x*y+y*z+z*x == n:
                    if x==y and y==z:
                        count += 1
                    elif x==y and y<z:
                        count += 3
                    elif x<y and y==z:
                        count += 3
                    elif x<y and y<z:
                        count += 6

    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:
N = int(input())
result = [0 for x in range(1000000)]

l = 0
p=0
q=0
t=0
for i in range(1,100):
    p = i*i
    if p>10000:
        break
    for j in range(1,100):
        q = p + j*j + j*i
        if q>10000:
            break
        for k in range(1,100):
            t  = q + i*k + j*k + k*k
            if t>10000:
                break
            result[l] = t
            l+=1
for i in range(1,N+1):
    print(result.count(i))

Submission status: Time Limit Exceeded

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


# if a * a + b * b + c * c + ab + bc + ac == i:
    
count = 0

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
import numpy as np
for i in range(1,n+1):
  cnt = 0
  for x in range(1,int(np.sqrt(i))):
    for y in range(1,int(np.sqrt(i))):
      for z in range(1,int(np.sqrt(i))):
        if (x+y+z)**2 == (i+x*y+y*z+z*x):
          cnt+=1
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

for p in range(1, n+1):
  right=int((p**(1/3)))+2
  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:
import math
N=int(input())
for n in range(1,N+1):
    ans=0
    if n<=5:
        print(ans)
        continue
    X=math.floor(n**0.5)
    for x in range(1,X+1):
        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 + x*z==n:
                    if (x==y and y!=z and z!=x) or (x!=y and y==z and z!=x) or (x!=y and y!=z and z==x): 
                        ans+=3
                    elif x==y and y==z and z==x:
                        ans+=1
                    else:
                        ans+=6
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


for i in range(1, N+1):
    ans = 0
    for x in range(1, 101):
        for y in range(1, x+1):
            for z in range(1, y+1):
                data = x**2+y**2+z**2+x*y+y*z+z*x
                if data == i:
                    if x==y and y==z:
                        ans += 1
                    elif (x==y) or (y==z) or (z==x):
                        ans += 3
                    else:
                        ans += 6
                elif data > i:
                    break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
from io import StringIO
import unittest
import numpy as np
import math

def func(i):
    j = math.ceil(math.sqrt(i))
    cache = np.zeros([j, j, j], dtype=int)
    for x in range(1, j + 1):
        for y in range(1, max(1, j - x + 1)):
            for z in range(1, max(1, j - x - y + 1)):
                cache[x, y, z] = calc(x, y, z)
    return cache


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

def resolve():
    N = int(input())
    cache = func(N)
    for i in range(1, N+1):
        print(np.count_nonzero(cache == i))

resolve()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
max_num = 1

for n in range(1,N+1):
  ans = 0
  check = False
  for x in range(1,max_num+1):
    for y in range(x,max_num+1):
      for z in range(y,max_num+1):
        if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == n:
          if x == y and y == x and z == x:
            ans += 1
          elif x == y  or z == x or y == z:
            ans += 3
          elif x != y and y != z and z != x:
            ans += 6
          check = True
          max_num = max(x,y,z)+1
          break
      if check:
        break
    if check:
      break
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
def f(n):
    cnt = 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:
                    cnt += 1

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for n in range(1,N+1):
  count = 0
  for x in range(1,int(n**.5)):
    for y in range(1,int(n**.5)):
      for z in range(1,int(n**.5)):
        if (x**2+y**2+z**2+x*y+y*z+z*x)/n == 1:
          count += 1
          #print("x,y,z:{0},{1},{2}".format(x,y,z))
  print(count)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import math
import itertools

# 標準入力を取得
N = int(input())

# 求解処理


def has_z(n: int, x: int, y: int) -> bool:
    d = 4 * n - 3 * x**2 - 3 * y**2 - 2 * x * y
    if d < 0:
        return False
    z = (-(x + y) + math.sqrt(d)) / 2
    return (z.is_integer()) and (z >= 1)


for n in range(1, N + 1):
    ans = 0
    max_v = int(math.sqrt(n))
    for x in range(1, max_v + 1):
        for y in range(x, max_v + 1):
            if has_z(n, x, y):
                ans += 1 + (x != y)
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
x=y=z=1

for i in range(1, N+1, 1):
    ans = [[x,y,z] for x in range(1,i+1,1) for y in range(1,i+1,1) for z in range(1,i+1,1) if x*x+y*y+z*z+x*y+y*z+z*x == i]
    print(len(ans))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import itertools
import math

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


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, int(math.sqrt(n)) + 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:
n = int(input())
for i in range(n):
    cnt = 0
    for x in range(1,n//2):
        for y in range(1,n//2):
            for z in range(1,n//2):
                # print(x,y,z)
                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())
import itertools
for i in range(1,n+1):
    p = int(i ** (1 / 2) + 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:
def resolve():
    import sys
    sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
    to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
    print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

    # 入力を整数に変換して受け取る
    def input_int():
        return int(input())

    def map_int_input():
        return map(int, input())

    MII = map_int_input

    def MII_split():
        return map(int, input().split())

    def MII_to_index():
        return map(to_index, input())

    def MII_split_to_index():
        return map(to_index, input().split())

    # 入力全てを整数に変換したものの配列を受け取る
    def list_int_inputs():
        return list(map(int, input()))

    LII = list_int_inputs

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

    # 2次元リスト化
    def LII_2D(rows_number):
        return [LII() for _ in range(rows_number)]

    def LII_split_2D(rows_number):
        return [LII_split() for _ in range(rows_number)]

    import math
    def L(x, y, z):
        return int(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)

    N = input_int()
    for n in range(1, N + 1):
        ans = 0
        for x in range(1, 50):
            for y in range(x, 50):
                for z in range(y, 50):
                    left = L(x, y, z)
                    if left > n:
                        break
                    elif left == n:
                        if x == y == z:
                            ans += 1
                            break
                        else:
                            ans += 3
                            break

        print(ans)
resolve()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
for p in range(1,n+1):
  ans = 0
  for i in range(1, 101):
    for j in range(1, min(i+1,50)):
      for k in range(1, min(j+1, 34)):
        if (i+j+k)**2-i*j-j*k-k*i == p:
          if i==j==k:
            ans += 1
          else:
            ans += 3
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt as r
from math import ceil
from itertools import combinations as C

N = int(input())

for c in range(1, N + 1, 1):
	ans = 0
	for x in range(1, 1+ceil(r(c/3))):
		for y in range(1, 1+ceil(r(c/3))):
			for z in range(1, 1+ceil(r(c/3))):
				if x**2 + y**2 + z**2 + x*y + y*z + z*x == c:
					ans += 1
	print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys


def resolve(in_):
    n = int(in_.readline())
    for i in range(1, n + 1):
        ans = 0
        for x in range(1, 33):
            for y in range(x, 33):
                if x ** 2 + y ** 2 > i:
                    break
                for z in range(y, 33):
                    n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                    if i == n:
                        a = len(set((x, y, z)))
                        if a == 1:
                            ans += 1
                        elif a == 2:
                            ans += 3
                        elif a == 3:
                            ans += 6
                        break
                    elif i < n:
                        break

        print(ans)



def main():
    resolve(sys.stdin.buffer)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

dp = [[[0 for i in range(N)]for i in range(N)]for i in range(N)]
x = 1
y = 1
z = 1
def g(x,y,z):
    if dp[x][y][z] == 0:
        dp[x][y][z] = x**2 + y**2 + z**2 + x*y + y*z + z*x
    return dp[x][y][z]
a = 0
for i in range(1,N+1):
    while i >= x**2 + y**2 + z**2 + x*y + y*z + z*x:
        while i >= x**2 + y**2 + z**2 + x*y + y*z + z*x:
            while i >= x**2 + y**2 + z**2 + x*y + y*z + z*x:
                if g(x,y,z) == 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:
N = int(input())
record = [0] * 1000000

for i in range(1,N+1):
    for j in range(1,N+1):
        for k in range(1,N+1):
            sum = i**2 + j**2 + k**2 + i*j + i*k +j*k
            if sum >= N: break
            # print("i,j,k:", i,j,k)
            # print(sum)
            # if i==j==k: record[sum] += 1
            # else: record[sum] += 3
            record[sum] += 1

for num in record[1:N+1]:
    print(num)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
for i in range(1,N+1):
    ans = 0
    cnt = 0
    for x in range(1,int(math.sqrt(i))+1):
        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) == i):
                    if(x*y*z == 1):
                        ans += 1
                    else:
                        cnt += 1
                    break
    ans += cnt*3
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count =[0] * n

for f in range(1,n+1):
    for x in range(1, n+1):
        for y in range(1, n+1):
            for z in range(1, n+1):
                if(x*x+y*y+z*z+x*y+y*z+z*x == f):
                    count[f-1]+=1

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

Submission status: Time Limit Exceeded

Solution code:
import collections
N = int(input())
list =[]
for n in range(1,N+1):
    for x in range(1,33):
        for y in range(1,33):
            for z in range(1,33):
              if  (x**2 + y**2 + z**2 + x*y + y*z + z*x) == n :
                  list.append(n)
c = collections.Counter(list)
for i in range(1,N+1):
    print(c[i])

Submission status: Time Limit Exceeded

Solution code:
import math
n=int(input())
z=0
ans=0
for N in range(1,n+1):
    ans=0
    z=0
    for x in range(1,100):
        for y in range(1,100):
            if x**2+y**2>=N:
                break
            if (x+y)**2+4*N-4*(x**2+y**2)-4*x*y>=0:
                z=((-x-y)+math.sqrt((x+y)**2+4*N-4*(x**2+y**2)-4*x*y))/2
                #print(x,y,z)
                if z>=1 and z%1==0:
                    ans+=1
                    #print(x,y,z)
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [0 for i in range(100000001)]
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            A[ (i**2 + j**2 + k**2 + i*j + j*k + i*k )] += 1
for l in range(N):
    print(A[l])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = [0] * 10000

for i in range(1, 200):
    for j in range(1, 200):
        for k in range(1, 200):
            z = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if z < 10000:
                ans[z] += 1

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

Submission status: Time Limit Exceeded

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

for p in range(1, n+1):
  right=math.floor(p**(3/8))+2
  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())

loop = int(n**(1/2))

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

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):
        if i <=j:
            continue
        for k in range(1,N):
            if i <=k or i<= k+j:
                continue
            for l in range(1,N):
                if i <=l or i < k+j+l:
                    continue
                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:
import math
n = int(input())
ans = 0
for z in range(1,n+1):
    ans = 0
    if z-5<0:
        print(0)
        continue
    ma = int(math.sqrt(z- 5))
    for i in range(1,ma+1):
        if z-i**2-2*i<0:
            
            break
        ma1 = int(math.sqrt(z-i**2-2*i))
        # if z ==6:
        #     print("koko")
        for j in range(1,ma1+1):
            # if z == 6:
                # print(i,j,"dayp")
            if z-i**2-j**2-i-j<0:
                break
            ma2 = int(math.sqrt(z-i**2-j**2-i-j))
            # if z == 6:
                # print("koko")
            for k in range(1,ma2+1):
                if i**2+j**2+k**2+i*j+j*k+k*i==z:
                    # print(i,j,k)
                    ans +=1
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

for i in range(1, n + 1):
    cnt = 0
    f = int(math.sqrt(n)) + 1
    for x in range(1, f):
        for y in range(1, f):
            for z in range(1, f):
#                 print(i, x, y, z)
                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:
import math

N = int(input())

for i in range(1,N+1):
  ans = 0
  for x in range(1,math.ceil(math.sqrt(i/3))):
    # if x**2 + x**2 + x**2 + x*x + x*x + x*x > i:
    #   break
    for y in range(x,math.ceil(math.sqrt(i/2))):
      # if x**2 + y**2 + y**2 + x*y + y*y + y*x > i:
      #   break
      for z in range(y,math.ceil(math.sqrt(i))):
        # print(x,y,z)
        if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
          if x == y == z:
            ans += 1
          elif x == y | x == z | y == z:
            ans += 2
          else:
            ans += 3
          break
        # elif x**2 + y**2 + z**2 + x*y + y*z + z*x > i:
        #   break
      
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


for i in range(2,N+2):
    count = 0
    for x in range(1,N-1):
        for y in range(x,N-x):
            for z in range(y,N-x-y+1):
                if x**2+y**2+z**2+x*y+y*z+z+x == i:
                    if x == y:
                        if y == z:
                            count += 1
                        else:
                            count += 3
                    elif y == z:
                        count += 3
                    else:
                        count += 6
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
for p in range(1,n+1):
  ans = 0
  for i in range(1, 101):
    for j in range(1, min(i+1,50)):
      for k in range(1, min(j+1, 34)):
        if (i+j+k)**2-i*j-j*k-k*i == p:
          if i==j==k:
            ans += 1
          else:
            ans += 3
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for i in range(1,N+1):
    ans = 0
    for x in range(1,101):
        if (x**2 > i):
            break
        for y in range(1,101):
            if (y**2 > i):
                break
            for z in range(1,101):
                if (z**2 > i):
                    break
                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 i in range(1, n + 1):
    ans = 0
    limit = int(i ** 0.5) + 1
    for x in range(1, limit):
        for y in range(x, limit):
            for z in range(y, limit):
                if (x + y + z) ** 2 == i + x * y + y * z + z * x:
                    if len(set([x, y, z])) == 1:
                        ans += 1
                    elif len(set([x, y, z])) == 2:
                        ans += 3
                    else:
                        ans += 6
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin


def readline_from_stdin() -> str:
    return stdin.readline().rstrip



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

def calc2(x, y, z):
    return x*x + y*y + z+z + x*y + x*z + y*z


def f(n):
    res = []
    for i in range(1, n+1):
        for j in range(1, n+1):
            for k in range(1, n+1):
                # res.append((i,j,k,calc(i, j, k)))
                res.append(calc(i, j, k))
    return res

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

    res = f(N)

    for i in range(1, N+1):
        print(res.count(i))