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
from itertools import permutations
N = int(input())


for n in range(1, N+1):
    count = 0
    for i in range(1, 58):
        if i**2 > n:
            break
        for j in range(i, 58):
            t = (i+j)**2 - 4 * (i * j + i**2 + j**2 - n)
            if t < 0:
                continue
            k = 0.5 * (-(i + j) + np.sqrt(t))
            if k < j:
                break
            if i**2 + j**2 + k**2 + i * j + j * k + i * k > n:
                break
            if int(k) == k:
                count += len(set(permutations([i, j, int(k)])))
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
for i in range(1,N+1):
  count = 0
  aa = math.floor(i**0.5)
  for j in range(1,aa):
    for k in range(1,j+1):
      for l in range(1,k+1):
        if j**2+k**2+l**2+j*k+j*l+k*l == i:
          if j == k == l:
            count += 1
          elif j != k != l:
            count += 6
          else:
            count += 3
  print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
import numpy as np
#max=int(np.sqrt(N))

for n in range(1,N+1):
    j=0
    max = int(np.sqrt(abs(n-2)))
    #print(max)
    for x in range(1,max):
        for y in range(1, max):
            for z in range(1, max):
                if x**2+y**2+z**2+x*y+y*z+z*x==n:
                    if j==0:
                        max = z+1
                        #print(x, y, z)
                        #print(f'n:{n}')
                        j += 1
                    else:
                        j += 1
    print(j)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
s1 = input().split()
intN = int(s1[0])

i = 1
while i <= intN :
    cnt = 0
    wkX = 1
    while wkX <= i -5 :
        if (wkX * wkX > i -5) : 
            break
        wkY = 1
        while wkY <= i - 5 -wkX +1:
            if (wkY * wkY > i -5 -wkX +1) : 
                break
            if (wkX * wkY > i -5 -wkX +1) : 
               break
            wkZ = 1
            while wkZ <= i - 5 -wkX -wkY + 2 :
                if (wkZ * wkZ > i -5 -wkX -wkY + 2) : 
                   break
                if (wkY * wkZ > i -5 -wkX -wkY + 2) : 
                    break
                if (wkZ * wkX > i -5 -wkX -wkY + 2) : 
                    break
                intFn = wkX * wkX + wkY * wkY + wkZ * wkZ + wkX * wkY + wkY * wkZ + wkZ * wkX
                if (intFn == i) :
                    cnt += 1
                wkZ += 1
            wkY += 1
        wkX += 1
    print(cnt)
    i += 1

Submission status: Time Limit Exceeded

Solution code:
import math


def pattern(x, y, z):
    if x == y == z:
        return 1
    elif x != y and y != z and x != z:
        return 6
    else:
        return 3


def check(ans):
    cnt = 0
    for x in range(1, ans):
        if pow(x, 2) > ans:
            break
        for y in range(x, ans):
            if pow(x+y, 2) > ans:
                break
            for z in range(y, ans):
                tmp = x*(x+y+z) + y*(y+z) + z*z
                if tmp == ans:
                    cnt += pattern(x, y, z)
                elif tmp > ans:
                    break
    print(cnt)


N = int(input())
# x^2 + y^2 + z^2 + x*y + y*z + z*x = n

for i in range(1, N+1):
    #upper_value = int(math.sqrt(i))
    check(i)

Submission status: Time Limit Exceeded

Solution code:
import itertools

N = int(input())

def f(n):
  combs = list(itertools.product(range(1, n), repeat=3))
  ans = [ 1 for x,y,z in combs if (x*x + y*y + z*z + x*y + y*z + z*x) == n]
  return len(ans)

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

Submission status: Time Limit Exceeded

Solution code:
# 幅優先探索（行きがけ）
import collections
import sys
import math


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    if N <= 5:
        for i in range(N):
            print(0)
        return

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

    for i in range(5):
        print(0)

    for i in range(6, N+1):
        cn = 0
        for j in range(1, math.floor(math.sqrt(i)+1)):
            if j**2 >= i:
                break
            for k in range(1, j+1):
                if j**2+k**2+j*k >= i:
                    break
                for l in range(1, k+1):
                    y = yy(j, k, l)
                    if y > i:
                        break
                    if y == i:
                        if j == k == l:
                            cn += 1
                        elif j != k != l:
                            cn += 6
                        else:
                            cn += 3
        print(cn)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = [0 for i in range(n)]
for i in range(6,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:
import math
n=int(input())
r=int(math.sqrt(n))
z=0
ans=0
for N in range(1,n+1):
    ans=0
    z=0
    for x in range(1,r):
        if x**2+x+x>=N:
            break
        for y in range(1,r):
            if x**2+y**2+x*y+x+y>=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())

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
if n > 1000:
    nn = n//100
else:
    nn=2
l = [int(i) for i in range(1,n//nn)]
import itertools
p_list = list(itertools.combinations_with_replacement(l, 3))
p=[]
s=[0]*100000000
for i in p_list:
    x=i[0]
    y=i[1]
    z=i[2]
    p.append((x+y+z)**2-x*y-y*z-z*x)

    if x==y and y==z and z==x:
        s[p[-1]]=1
    elif x==y or y==z or z==x:
        s[p[-1]]=3
    else:
        s[p[-1]]=6

for i in range(1,n+1):
    if i in p:
      print(s[i])
    else:
      print(0)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

if n < 6:
    for _ in range(n):
        print(0)
else:
    for _ in range(5):
        print(0)
    for i in range(6, 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:
def main():
    a=int(input())
    for w in range(1,a+1):
        total=0
        for i in range(1,w):
            for j in range(1,w):
                for k in range(1,w):
                    if (i**2)+(j**2)+(k**2)+i*k+i*j+k*j==w:
                        total+=1
        print(total)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

j, k, l, wk = 0,0,0,0
for i in range(1, N+1):
    sum = 0
    while True:
        j += 1
        if j >= math.sqrt(i) and j != 1:
            break
        k = 0
        while True:
            k += 1
            if k >= math.sqrt(i) and k != 1:
                break
            l = 0
            while True:
                l += 1
                if l >= math.sqrt(i) and l != 1:
                    break
                elif (j+k+l) >= math.sqrt(i) and j != 1 and k != 1 and l != 1:
                    break
                if (j**2 + k**2 + l**2 + j*k +k*l + l*j) == i:
                    sum += 1
    j = 0
    wk = 0
    print(sum)

Submission status: Time Limit Exceeded

Solution code:
def tri(n):
    ans = 0
    maxi = 2000
    for i in range(1,int(n**0.5)+1):
        if i > maxi:
            continue
        for j in range(1,int(n**0.5)+1):
            if i > j:
                continue
            for k in range(1,int(n**0.5)+1):
                if j > k:
                    continue
                if i*i + k*k + j*j + i*k + i*j + j*k == n:
                    if i==k and k==j:
                        ans +=1
                        break
                    else:
                        ans += 3
                        maxi = max(i,j,k)
                        break
    return ans

N = int(input())

for i in range(1,N+1):
    if i < 6:
        print(0)
        continue
    print(tri(i))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

def number(i):
   for j in range(1,41):
      for k in range(1,58):
         for u in range(1,101):
            if i==j*j+k*k+u*u+j*k+k*u+u*j:
               if j==k and k==u:
                  print(1)
                  return
               elif j==k or k==u:
                  print(3)
                  return
               else:
                  print(6)
                  return

   print(0)
   return

for h in range(1,n+1):
   number(h)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = int(n**(0.4))
for a in range(n):
  s=0
  for i in range(0,l):
    if((3*i+3)**2-(3*(i**2)+6*i+3)==a+1):
      s+=1
      continue
    for j in range(i,l-i):
      for k in range(i+j,l-i-j):
        if((i+j+k+3)**2-(i*j+j*k+k*i+2*i+2*j+2*k+3)==a+1):
          s+=3
  print(s)

Submission status: Time Limit Exceeded

Solution code:
# from pprint import pprint
# import math
# import collections
from numba import jit

N = int(input())

loops = 0

# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

@jit(cache=True)
def calc(x, y, z):
    return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x


p = []
p_equal = []
for x in range(1, 100):
    for y in range(x, 100 - x):
        if x + y > 100:
            break
        for z in range(y, 100 - (x + y)):
            loops += 1
            if x + y + z > 100:
                break
            p.append((x, y, z))

p_set = set(p)

p_equal = []
p_nonequal = []
for _p in p_set:
    loops += 1
    x, y, z = _p[0], _p[1], _p[2]

    if x == y == z:
        p_equal.append(calc(x, y, z))
    else:
        p_nonequal.append(calc(x, y, z))

# print(p_equal)
# print(p_nonequal)

for i in range(1, N + 1):
    loops += 1
    if i in p_equal:
        print(1)
    elif i in p_nonequal:
        print(3)
    else:
        print(0)

# print('lp',loops)

Submission status: Time Limit Exceeded

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

for i in range(N):
    flg = False
    count = 0
    if i < 5:
        print(count)
    else:
        x_min = 1
        x_max = int(math.sqrt(i + 1))
        for x in range(x_min, x_max + 1):
            x_count = 0
            for y in range(x, x_max + 1):
                y_count = 0
                for z in range(y, x_max + 1):
                    #print(i, x, y, z)
                    if x * x + y * y + z * z + x * y + y * z + z * x == i + 1:
                        x_count += 1
                        y_count += 1
                        numbers = Counter([x, y, z]).values()
                        count += math.factorial(3)
                        for number in numbers:
                            count /= math.factorial(number)
                    elif x * x + y * y + z * z + x * y + y * z + z * x > i + 1:
                        break
                    else:
                        x_count += 1
                        y_count += 1
                if y_count == 0:
                    flg = True
                    break
            if x_count == 0:
                break
            
        print(int(count))

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
N=int(input())
num=1
def checker(n):
    count=0
    x=1
    for a in range(int(sqrt(n))):
        y=1
        for b in range(int(sqrt(n))):
            z=1
            for c in range(int(sqrt(n))):
                ans=x*x+y*y+z*z+x*y+x*z+z*y
                if ans==n:
                    count=count+1
                z=z+1
            y=y+1
        x=x+1
    return count
for i in range(N):
    print(checker(num)) 
    num=num+1

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    import sys
    import math

    readline = sys.stdin.readline

    N = int(readline())

    for i in range(1, N + 1):
        ans = 0
        li = int(math.sqrt(i) // 1)
        for x in range(1, li):
            for y in range(1, li):
                xx = x * x
                yy = y * y
                xy = x * y
                value = (x + y) ** 2 - 4 * (xx + yy + xy - i)
                if value <= 0:
                    continue
                cal = math.sqrt(value)
                z1 = (-(x + y) + cal) / 2
                z2 = (-(x + y) - cal) / 2
                if (1
                        and 1 <= z1
                        and z1 % 1 == 0
                        and xx + yy + z1 * z1 + xy + y * z1 + z1 * x == i):
                    ans += 1
                if (1
                        and 1 <= z2
                        and z2 % 1 == 0
                        and xx + yy + z2 * z2 + xy + y * z2 + z2 * x == i):
                    ans += 1
        print(ans)


resolve()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

def calc2(n):
  if n == 1:
    return 6
  return calc2(n-1) + 2*n + 1

def check_max(N):
  i = 1
  while True:
    if calc2(i) > N:
      return i-1
    i += 1

for n in range(1, N+1):
  total_num = 0
  max_value = check_max(n)+1
  if max_value == 1:
    print(0)
    continue
  for x in range(1, max_value):
    for y in range(1, max_value):
      for z in range(1, max_value):
        if calc(x, y, z) == n:
          total_num += 1
  print(total_num)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for n in range (1,N+1):
    cnt = 0
    for x in range (1,n+1):
        for y in range(1,n+1):
            for z in range(1,n+1):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n:
                    cnt += 1
                else:
                    cnt += 0
    print(str(cnt))

Submission status: Time Limit Exceeded

Solution code:
import math
from itertools import product

N=int(input()) # 入力の整数

def func(xyz): # x,y,zが与えられたときの式の値を計算
    # x,y,z=xyz[0],xyz[1],xyz[2] # x,y,z
    x,y,z=xyz # x,y,z

    return x**2+y**2+z**2+x*y+y*z+z*x



for n in range(1,N+1): # 入力の数
    maxv=math.ceil(math.sqrt(n)) # 探索するのはせいぜいこの数まで
    xyzl=list(product(range(1,maxv),range(1,maxv),range(1,maxv))) # x,y,zの値のリスト
    xyzlc=xyzl.copy() # xyzlのコピー

    

    count=0 # カウンタ

    for xyz in xyzl: # 各x,y,zの組み合わせについて
        # print("xyz = ",xyz)
        r=func(xyz)

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



    # 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 # カウンタをインクリメント

    # for x,y,z in product(range(1,maxv),range(1,maxv),range(1,maxv)): # x,y,zの組み合わせ
    #     # print(x,y,z)
    #     r=func(x,y,z) # 式を計算する

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


    print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
import itertools

n = int(input())
for i in range(n):
  high_lim = int(math.sqrt(i+1)//1) + 1

  l1 = [i for i in range(1, high_lim)]
  l2 = [i for i in range(1, high_lim)]
  l3 = [i for i in range(1, high_lim)]

  p = itertools.product(l1, l2, l3)

  result = 0
  for pair in sorted(set([tuple(sorted(pair)) for pair in p])):
    if (pair[0] + pair[1] + pair[2])**2 - pair[0]*pair[1] - pair[1]*pair[2] - pair[0]*pair[2] == i + 1:
      if len(set([pair[0],pair[1],pair[2]])) == 1:
        result += 1
      elif len(set([pair[0],pair[1],pair[2]])) == 2:
        result += 3
      else:
        result += 6

  print(result)

Submission status: Time Limit Exceeded

Solution code:
"""
x, y, z: 正数
x^2+y^2+z^2+xy+yz+zx = n
f(n): 以上の2つの条件を満たす正数の組（x, y, z）の個数
"""

import itertools
import math

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

N  = int(input())

X = range(1, int(math.sqrt(N)))

for i in range(1, N+1):
    count = 0
    for v in itertools.product(X, repeat=3):
        if(g(v[0], v[1], v[2]) > i):
            continue
        elif(g(v[0], v[1], v[2]) == i):
            count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
f = [0] * n
sqrt_n = int(math.sqrt(n/2)) +1
for i in range(n) :
    for x in range(1,sqrt_n) :
        for y in range(1,sqrt_n) :
            for z in range(1,sqrt_n) :
                if x*x+y*y+z*z+x*y+y*z+z*x == i+1 :
                    f[i] += 1
for _ in range(n) :
    print(f[_])

Submission status: Time Limit Exceeded

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

def calc(x,y,z,n):
  if(n==x*x+y*y+z*z+x*y+y*z+z*x):
    return True

for i in range(1,a+1):
  l = list(range(1,int(math.sqrt(a))))
  cnt = 0;
  for x,y,z in itertools.product(l, repeat=3):
    if(calc(x,y,z,i)):
      cnt+=1;
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math

n=int(input())

for x in range(1,n+1):
  ans=0
  b=int(math.sqrt(x))
  for q in range(1,b+1):
    c=int(math.sqrt(n-q*q))
    for r in range(1,c+1):
      d=x-q*q-r*r-q*r
      if d>0:
        
        e=int(math.sqrt(d))
        for s in range(1,e+1):
          if q*q+r*r+s*s+q*r+r*s+s*q==x:
            ans+=1
      
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0
for n 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**2+y**2+z**2+x*y+y*z+z*x == n:
          count = count + 1
        
  print(count)
  count = 0

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N=int(input())
for n in range(1,N+1):
  if n<6:
    print(0)
  else:
    la=np.arange(2,(n)**0.5)
    l=la*la
    c=0
    for x in range(len(l)):
      if l[x]*3>2*n:
        break
      else:
        for y in range(x,len(l)):
          if l[x]+2*l[y]>2*n:
            break
          else:
            for z in range(y,len(l)):
              if l[x]+l[y]+l[z]>2*n:
                break
              else:
                
                if l[x]+l[y]+l[z]==2*n:
                  
                  if (x+y+z)%2==0 and x+y+2>z:
                      if l[x]==l[y] and l[y]==l[z]:
                        c+=1
                      elif l[x]==l[y] or l[y]==l[z]:
                        c+=3
                      else:
                        c+=6
                   
    print(c)

Submission status: Time Limit Exceeded

Solution code:
# C

from math import floor
N=int(input())

for i in range(1,N+1):
    ans=0
    p=floor(i**0.5)
    for x in range(1,p+1):
        #print(i,p,x)
        for y in range(1,floor( (i-x**2)**0.5)+1):
            s = x**2+y**2+x*y
            t = x+y
            if t**2-4*(s-i)>0:
                k=(t**2-4*(s-i))**0.5
                #print(x,y,k)
                if k-t >0 and (k-t)%2==0:
                    ans +=1
                    #print(x,y,k,(k-t)//2)
    print(ans)

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

for num in range(n):
    count = 0
    checked_num = num+1
    half = int(num/2)

    for x in range(1, half):
        for y in range(x, half):
            for z in range(y, half):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == checked_num:
                    if x == y and y == z:
                        count += 1
                    elif x == y or y == z or z == x:
                        count += 3
                    else:
                        count += 6


    print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

for i in range(1,n+1):
    ans=0
    for x in range(1,int((i+1)**0.5)):
        if x>=i:
            break
        for y in range(1,int((i+1)**0.5)):
            if x*y >= i:
                break
            else:
                for z in range(1,int((i+1)**0.5)):
                    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:
import itertools

N = int(input())

ans = {}
for v in itertools.combinations_with_replacement(range(1,(N//6)+1), 3):
    x,y,z = v
    fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
    # if fn > N:
    #     break
    if fn in ans.keys():
        ans[fn].append([x,y,z])
    else:
        ans[fn] = [[x,y,z]]


for i in range(1,N+1):
    if i in ans.keys():
        count = 0
        for j in ans[i]:
            x,y,z = j
            if x == y == z:
                count += 1
            else:
                count += 3
        # print(i, count, ans[i])
        print(count)
    else:
        # print(i, 0)
        print(0)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
def sq(n):
    c=0
    A=[0 for j in range(n+1)]
    for i in range(n//2):
        p=(i+1)**2
        if p>n:
            for j in range(i**2,n+1):
                A[j]=i
            break
        else:
            for j in range(i**2,p):
                A[j]=i
    return A
A=sq(N)
for n in range(1,N+1):
    c=0
    for x in range(1,A[n]):
        p=n-x**2
        if p<0:
            break
        else:
            for y in range(1,A[p]+1):
                q=p-y**2-x*y
                if q<0:
                    break
                else:
                    for z in range(1,A[q]+1):
                        if q==z**2+y*z+z*x:
                            c=c+1
    print(c)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
for i in range(1, n+1):
    x = 1
    count = 0
    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:
                    if x == y and y == z and z == x:
                        count += 1
                    elif x == y or y == z or z == 1:
                        count += 3
                    else:
                        count += 6
                    break
                else:
                    z += 1
            else:
                y += 1
                continue
            break
        else:
            x += 1
            continue
        break
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
if n<=5:
  for i in range(n):
    print(0)
else:
  for i in range(5):
    print(0)
for i in range(6, n+1):
  count=0
  for x in range(1, int(i/2)):
    for y in range(1, int(i/2)):
      for z in range(1, int(i/2)):
        """print(x,y,z)
        print(x*x + y*y + z*z+ x*y + y*z + z*x)
        print(i)"""
        if x*x + y*y + z*z + x*y + y*z + z*x == i:
          count+=1
  print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

x,y,z = 1,1,1

ans = [0] * n

for z in range(1,n+1):
    pp = 0
    for i in range(1,n+1):
        for j in range(1,n+1):
            if (i+j)<z:
                for k in range(1,n+1):
                    if (i+j+k)<=z:
                        if ((i**2)+(j**2)+(k**2)+(i*j)+(j*k)+(k*i)) == z:
                            pp += 1
                            pass
                    pass
            pass
    ans[z-1] = pp         
    
print(*ans, sep = "\n")

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
import math
for i in range(1,N+1):
    ans=0
    for x in range(1,35):
        for y in range(1,35):
            a=-(3*(x*x)+3*(y*y)+2*x*y)/4+i
            if a>0:
                b=(math.sqrt(a)-(x+y)/2)
                if b>0 and b%1==0.0:
                    ans+=1

    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

x, y, z = 1,1,1
ans_list = []

for x in range(1,100):
    for y in range(1,100-x):
        for z in range(1,100-x-y):
            ans = (x + y)**2 + (y + z)**2 + (z + x)**2
            ans_list.append(ans)

for n in range(1, N+1):
    count = 0
    if 2*n in ans_list:
        ans = 2*n
        for i in ans_list:
            if i == ans:
                count += 1
            else:
                pass

    print(count)

Submission status: Time Limit Exceeded

Solution code:
d = input("")
N = int(d)

x = 1
y = 1
z = 1
i= 1
count = 0
while i <= N:
    x = 1
    while x < 100:
        y = 1
        while y < 100:
            z = 1
            while z < 100:
                shi = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if shi  == i:
                    count += 1
                z += 1
            y += 1
        x += 1
    i += 1
    print(count)
    count = 0

Submission status: Time Limit Exceeded

Solution code:
import math
N=int(input())
for n in range(1,N+1):
  tmp=0
  for x in range(1,100):
    for y in range(1,100):
      if 4*n-3*x**2-2*x*y-3*y**2<0:continue
      z=0.5*(math.sqrt(4*n-3*x**2-2*x*y-3*y**2)-x-y)
      if z.is_integer() and z>=1:
        tmp+=1
      z=0.5*(math.sqrt(4*n-3*x**2-2*x*y-3*y**2)*(-1)-x-y)
      if z.is_integer() and z>=1:
        tmp+=1
  print(tmp)

Submission status: Time Limit Exceeded

Solution code:
import itertools

N=int(input())

for n in range(1,N+1):#O(N^2)
    ans=0#ansを初期化
    l=[i for i in range(1,n+1)]
    for c  in itertools.combinations_with_replacement(l, 3):#l配列の中から3つを選ぶ　c ⇒(a,b,c)
        #print(c)
        if  c[0]**2 + c[1]**2 + c[2]**2 + c[0]*c[1] + c[1]*c[2] + c[2]*c[0] == n:
            if c[0] == c[1] == c[2]:
                ans+=1
            elif c[0] != c[1] & c[1] != c[2] & c[2] != c[0]:
                ans+=6
            else:
                ans+=3
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1, N+1):
    s = n//5
    cnt = 0
    flag = 0
    for x in range(1, s+1):
        for y in range(x, s+1):
            for z in range(y, s+1):
                siki = x**2 + y**2 + z**2 + x*y + y*z + z*x

                if siki == n:
                    # print('ans = ', siki)
                    if (x==y)and(y==z):
                        cnt += 1
                    elif (x!=y)and(y!=z):
                        cnt += 6
                    else:
                        cnt += 3
                # elif siki > n:
                    flag = 1
                    break
                elif siki > n:
                    break

            if flag:
                break
        if flag:
            break
    print(cnt)