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:
def f(x,y,z,n):
    if x**2+y**2+z**2+x*y+y*z+z*x == n:
        return 1
    return 0

def z(x,y,n):
    a = (x+y)**2-4*(x**2+y**2+x*y-n)
    if a < 0:
        return 0
    b = (a**0.5) - (x+y)
    b = b/2
    if b.is_integer() and b>0:
        return 1
    return 0

N = int(input())
for i in range(1,N+1):
    ans = 0
    I = int(i**0.5)
    for x in range(1,I):
        for y in range(1,I):
            ans += z(x,y,i)
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for i in range(1,N+1):
  ans = 0
  if i < 6:
    print(ans)
  else:
    for a in range(2,int((2*i)**0.5+1)):
      for b in range(2,int((2*i-a**2)**0.5+1)):
        for c in range(2,int((2*i-a**2-b**2)**0.5+1)):
          #print(a,b,c)
          if a**2 + b**2 + c**2 == 2*i:
            if max(a,b,c) < a+b+c-max(a,b,c):
              ans += 1
              #print(a,b,c)
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
from itertools import product
N = int(input())
#L, R, d=map(int,input().split())
#C = []
# for i in range(N):
#    C.append((input().replace(".","0").replace("#","1")))
# S=list(map(int,input().split()))
# B=list(map(int,input().split()))
def calc1(x,y,z):
    return x*x+y*y+z*z+x*y+y*z+z*x
def calc2(x,y):
    return x*x+y*y+1*1+x*y+y*1+1*x
def calc3(x):
    return x*x+1*1+1*1+x*1+1*1+1*x

count = []
for n in range(1,N+1):
    count2 = 0
    #l = []
    for i in range(1,n):
        if calc3(i) > n:
            break
        for j in range(1,n):
            if calc2(i,j) > n:
                break
            for k in range(1,n):
                h = calc1(i,j,k)
                # o = [i,j,k].sort
                if h > n:
                    break
                #elif o in l:
                #    count2+=1
                elif h == n:
                    count2+=1
                    #l.append(o)
    count.append(count2)

print('\n'.join(map(str, 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:
                    break
                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 i in range(1, n+1):
    cnt = 0
    j = int(i**0.5)

    for x in reversed(range(1, j+1)):
        for y in reversed(range(1, x+1)):
            for z in reversed(range(1, y+1)):
                if i == x**2 + y**2 + z**2 + x*y + y*z + z*x:
                    if x==y==z:
                        cnt += 1
                    elif x==y or y==z or z==x:
                        cnt += 3
                    else:
                        cnt += 6

    print(cnt)

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

        for j in range(i,ma1+1):
            if 4*z-2*i*j-3*i**2-3*j**2<=0:
                break

            p = (-i-j+math.sqrt(4*z-2*i*j-3*i**2-3*j**2))/2
            # print(p,z)
            if p <j:
                break
            if p.is_integer():
                if i==j==p:
                    ans +=1
                elif  (i==j and j!=p) or (i!=j and j==p):
                    ans +=3
                elif  (i!=j) and (j!=p):
                    ans +=6
            

            # if z-i**2-j**2-i-j<0:
            #     break
            # ma2 = int(math.sqrt(z-i**2-j**2-i-j))

            # for k in range(j,ma2+1):
                # if i**2+j**2+k**2+i*j+j*k+k*i==z:
                #     if i==j==k:
                #         ans +=1
                #     elif  (i==j and j!=k) or (i!=j and j==k):
                #         ans +=3
                #     elif  (i!=j) and (j!=k):
                #         ans +=6
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
def F(n):
    ans = 0
    if n < 6:
        return 0
    else:
        for x in range(1,int((n-3)**0.5)+1):
            k = int((n-3/4*x**2-1/2*x-3/4)**0.5 - (x+1)/2)
            for y in range(1,k+1):
                z = (n - 3/4*(x**2+y**2) - 1/2*x*y)**0.5 - (x+y)/2
                if isinstance(z,complex):
                    continue
                if z.is_integer() and z>=1:
                    ans += 1
    return ans
for i in range(1,int(input())+1):
    print(F(i))

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,33):
        for y in range(1,33):
            if x^2+y^2<1000:
                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())
for i in range(1,n+1):
    cnt=0
    for x in range(1,101):
        if x**2>i:
            break
        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:
                    cnt+=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
def f(i):
  co=0
  for z in range(1,10):
    if z**2+z+z>i:
      continue
    for y in range(1,10):
      if y**2+z**2+z*y+z+y>i:
          continue
      for x in range(1,10):
        if x**2+y**2+z**2+z*y+z*x+y*x==i:
          co+=1
        if x**2+y**2+z**2+z*y+z*x+y*x>i:
          break
  return co
for i in range(1,n+1):
  print(f(i))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
if n > 5000:
    nn = 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:
n = int(input())

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

Submission status: Time Limit Exceeded

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

def search(n):
    global N
    for x in range(1, int(math.sqrt(n)) + 1):
        if n - x*x <= 0:
            return None
        for y in range(1, int(math.sqrt(n)) + 1):
            if n - x*x - y*y - x*y <= 0:
                break
            z = binarySearch(n, x, y)
            if z:
                return (x, y, z)


def binarySearch(n, x, y):
    global N
    right = -1
    left = N + 1
    while(abs(right - left) > 1):
        z = left + (right - left) // 2
        l = x*x + y*y + z*z + x*y + y*z + z*x
        if l == n:
            return z
        elif l < n:
            right = z
        else:
            left = z
        # print(right, left, z)
    return None

for n in range(1, N+1):
    ans = search(n)
    if ans == None:
        print(0)
        continue
    ans = len(set(ans))
    if ans == 1:
        print(1)
    elif ans == 2:
        print(3)
    else:
        print(6)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
for i in range(1,N+1):
  count=0
  k=i//5+1
  for x in range(k):
    if(x==0):
      continue
    if(x>=22):
      break
    for y in range(x,k):
      if(y==0):
        continue
      if(y>=22):
        break
      for z in range(y,k):
        if(z==0):
          continue
        if(z>=22):
          break
        if((x+y)**2+(y+z)**2+(z+x)**2)//2==i:
          #print(x,y,z)
          #print(i)
          if (x==y and y==z and z==x):
            count+=1
          elif (x!=y and y!=z and z!=x):
            count+=6
          else:
            count+=3
  print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys
import numpy as np
import math
import collections
import copy
from collections import deque 
from functools import reduce
from itertools import product

# input = sys.stdin.readline

def ff(N):
#     print("call ff{0}".format(N))
    if N > 100:
        n = int(np.sqrt(20))+5
    else:
        n = N
    cnt = 0
    for x in range(1, n+1):
        x2 = x**2
        for y in range(1, n+1):
            y2 = y**2
            xy = x * y
            tt = x2 + y2 + xy
            if tt > N:
                break
            for z in range(1, n+1):
                num = tt + z**2 + x*z + y*z
                if N == num:
                    cnt += 1
#                elif N < num:
#                    break
    return(cnt)    
    
N = int(input())    
n = int(np.sqrt(20))+1
for i in range(1, N+1):
#     ff(i)
     print(ff(i))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from numba import jit
nn = int(input())


@jit
def aa(nn):
    max_num = 75
    ans_L = []
    for n in range(1,nn+1):
        ans = 0
        for x in range(1,max_num):
            for y in range(1,max_num):
                for z in range(1,max_num):
                    if x**2 + y**2 + z**2 + x*y + y*z + x*z == n:
                        ans += 1

        ans_L.append(ans)
    return ans_L

ans_L = aa(nn)
for i in ans_L:
    print(i)

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.combinations_with_replacement(X, 3):
        if(g(v[0], v[1], v[2]) > i):
            continue
        elif(g(v[0], v[1], v[2]) == i):
            if(v[0] == v[1] == v[2]):
                count += 1
            elif(v[0] == v[1] or v[1] == v[2] or v[2] == v[0]):
                count += 3
            else:
                count += 6

    print(count)

Submission status: Time Limit Exceeded

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

    for i in range(1,n+1):
        print(sum(i == j for j in l))
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def count(n):
    ans=0
    for x in range(1, n):
        for y in range(x, n):
            for z in range(y, n):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x>n:
                    break
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    if x==y and y==z:
                        ans+=1
                    elif x!=y and y!=z and z!=x:
                        ans+=6
                    else:
                        ans+=3
    return ans

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for n in range(1, N + 1):
    sum = 0
    if n<4:
        print(sum)
        continue
    for u in range(2, int(math.sqrt(2*n))):
        for v in range(u, int(math.sqrt(2*n))):
            for w in range(v, int(math.sqrt(2*n))):
                if u*u + v*v + w*w == 2*n:
                    x = int((u - v + w)/2)
                    y = int((u + v - w)/2)
                    z = int((-u + v + w)/2)
                    if (x > 0 and y > 0 and z > 0):
                        if x == y and y == z:
                            sum += 1
                        elif x == y or y == z or z == x:
                            sum += 3
                        else:
                            sum += 6
                        
    print(sum)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
f = [0] * N
n = math.ceil(math.sqrt(N))

for i in range(1,N+1):
    for x in range(1,n):
        for y in range(x,n):
            for z in range(y,n):
                if(x*x+y*y+z*z+x*y+y*z+z*x == i):
                    if(x == y and y == z) :
                        f[i-1] += 1
                    elif(x == y and y < z):
                        f[i-1] += 3
                    elif(x < y and y == z):
                        f[i-1] += 3
                    else:
                        f[i-1] += 6


[print(a) for a in f]

Submission status: Time Limit Exceeded

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

for i in range(1,n+1):
    for j in range(1,int(n**0.5//6)+2):
        for k in range(j,int(n**0.5//6)+3):
            for l in range(k,int(n**0.5//6)+4):
                if j**2 + k **2 + l**2 + j*k + k*l + l*j == i:
                    if j == k == l:
                        L[i-1] += 1
                        break
                    if j != k and j!=l and k!=l:
                        L[i-1] += 6
                        break
                    else:
                        L[i-1] += 3
for m in range(n):
    print(L[m])

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
    sqrt = int(math.sqrt(i))
    for x in range(1, sqrt + 1):
        if x**2 > i:
            break
        for y in range(1, sqrt + 1):
            if x * x + y*y + x*y > i:
                break
            for z in range(1, sqrt + 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:
from numba import jit
nn = int(input())


@jit
def aa(nn):
    max_num = 100
    ans_L = []
    for n in range(1,nn+1):
        ans = 0
        for x in range(1,max_num):
            for y in range(1,max_num):
                for z in range(1,max_num):
                    if x**2 + y**2 + z**2 + x*y + y*z + x*z == n:
                        ans += 1

        ans_L.append(ans)
    return ans_L

ans_L = aa(nn)
for i in ans_L:
    print(i)

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())
for m in range(N):
  n=m+1
  f=0
  for x in range(1,n+1):
    if x*x>=n:
      break
    for y in range(1,n+1):
      if x*x+y*y>=n:
        break
      for z in range(1,n+1):
        if x*x + y*y + z*z >=n:
          break
        t=x**2 + y**2 + z**2 + x*y + y*z + z*x
        if t==n:
          f += 1
  print(f)

Submission status: Time Limit Exceeded

Solution code:
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    s_limit = int(i ** 0.5)
    for j in range(1,s_limit+1):
        for k in range(1,s_limit+1):
            for l in range(1,s_limit+1):
                if i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    xyz_list.append([i,j,k])
    print(len(xyz_list))

Submission status: Time Limit Exceeded

Solution code:
import itertools

N = int(input())

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

list_ans = []

# list_1 = []
list_g_xyz = []
list_f_n = []
N2 = int(N ** (1 /2) / 2) + 1
for x in range(1, N2 + 1):
    for y in range(x, N2 + 1):
        for z in range(y, N2 + 1):
        #   list_1.append([x, y, z])
          list_g_xyz.append(g(x, y, z))
          list_f_n.append(len(set(["".join(map(str, v)) for v in itertools.permutations([x, y, z])])))

# print(list_g_xyz)
# print(list_f_n)

list_ans = []
for target in range(1, N + 1):
    list_index = [i for i, x in enumerate(list_g_xyz) if x == target]
    ans = sum([list_f_n[i] for i in list_index])
    list_ans.append(ans)
    
for i in list_ans:
    print(i)

Submission status: Time Limit Exceeded

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

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,33):
        for y in range(1,33):
            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())

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

for n in range(1, N+1):
    if n < 6:
        print(0)
    else:
        cnt = 0
        for x in range(1, 32):
            for y in range(1, 32 - x):
                for z in range(1, 32-x-y):
                    if f2(x,y,z) == n:
                        cnt += 1
                        # print(x,y,z)
        print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
num=1
while True:
    if (num*num)*6>n:
        break
    num=num+1
num=num*num
d={}
for i in range(1,n+1):
    d[i]=0
for i in range(1,num+1):
    for j in range(1,num+1):
        for k in range(1,num+1):
            val=(i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(k*i)
            if val>n:
                continue
            # print(i,end=" ")
            # print(j,end=" ")
            # print(k)
            d[val]=d[val]+1
for i in range(1,n+1):
    print(d[i])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

nums = [0]*n
m = n//6
for i in range(1,m+1):
  for j in range(i, m+1):
    if i**2 + j**2 + i*j >= n//2: break
    for k in range(j, m+1):
      t = i**2 + j**2 + k**2 + i*j + j*k + i*k
      if t <= n:
        if i == j and i == k: nums[t-1] += 1
        else: nums[t-1] += 3
        
print(*nums, sep="\n")

Submission status: Time Limit Exceeded

Solution code:
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal


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

    l = []
    for i in range(1, math.floor(math.sqrt(n))):
        l.append(i)

    l_list = list(itertools.combinations_with_replacement(l, 3))

    ans_list = []
    for j in range(len(l_list)):
        x = l_list[j][0]
        y = l_list[j][1]
        z = l_list[j][2]
        ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
        ans_list.append((ans, [x, y, z]))
    
    # print(ans_list)

    for i in range(1, n+1):
        count = 0
        for j in range(len(ans_list)):
            if ans_list[j][0] == i and ans_list[j][1][0] == ans_list[j][1][1]and ans_list[j][1][2] == ans_list[j][1][1]:
                count += 1
            elif ans_list[j][0] == i:
                count += 3
            if ans_list[j][0] > i**2:
                break

        print(count)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
def sqe(a, b, c):
    """ 2次方程式を解く  """
    D = (b**2 - 4*a*c) ** (1/2)
    x_1 = (-b + D) / (2 * a)
    x_2 = (-b - D) / (2 * a)

    return x_1, x_2
  
for i in range(1,n+1):
  cnt = 0
  for x in range(1,100):
    for y in range(1,100):
      if x**2+y**2+x*y>i:
        break
      x_1,x_2 = sqe(1,x+y,x**2+y**2+x*y-i)
      if x_1.is_integer() and x_1>=1:
        cnt += 1
      elif x_2.is_integer() and x_2>=1:
        cnt += 1
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
#C
N = int(input())
for a in range(1,N+1):
    counter = 0
    for i in range(1,142):
        for j in range(1,142):
            if i**2 + j**2 <=a:
                #zについて解いたときの判別式
                k = -3*i**2-3*j**2-2*i*j+4*a
                if k>=0:
                    kai = (-1*(i+j)+ k**0.5)/2
                    if kai.is_integer() and 1<=kai<=150:
                        counter += 1
    print(counter)

Submission status: Time Limit Exceeded

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

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(x,int(np.sqrt(i))):
      for z in range(y,int(np.sqrt(i))):
        if (x+y+z)**2 == (i+x*y+y*z+z*x):
          p = len(set([x,y,z]))
          if p == 1:
            cnt+=1
          elif p == 2:
            cnt+=3
          elif p == 3:
            cnt+=6
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[94]:


n = int(input())


# In[95]:


import math
import numpy
import itertools


# In[96]:


count = 0


# In[97]:


li=[]


# In[98]:


for num in range(1,n+1):
    nnew = math.sqrt(num)
    nnew = math.floor(nnew)+1
    for x,y,z in itertools.product(range(1,nnew), range(1,nnew), range(1,nnew)):
        if (x*x + y*y + z*z + x*y + y*z + z*x) == num:
            count+=1
    
    li.append(count)
    count = 0


# In[99]:


for i in li:
    print(i)


# In[ ]:





# In[ ]:

Submission status: Time Limit Exceeded

Solution code:
def func(n):
    cnt = 0
    for x in range(1, 33):
        for y in range(x, 33):
            for z in range(y, 33):
                if(x**2+y**2+z**2+x*y+y*z+z*x == n):
                    if(x == y == z):
                        cnt += 1
                    elif(x != y and y != z and z != x):
                        cnt += 6
                    else:
                        cnt += 3
                    break
                elif(x**2+y**2+z**2+x*y+y*z+z*x > n):
                    break
        
    return cnt

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

Submission status: Time Limit Exceeded

Solution code:
def main():
        
    import math

    N = int(input())

    for n in range(1, N + 1):
        max_itr = min(45, int(math.sqrt(n)) + 1)
        
        ans_list = []
        ans = 0
        
        for x in range(1, max_itr):
            # for y in range(1, x+1):
            for y in range(1, max_itr):

                # for z in range(1, x+1):
                for z in range(1, max_itr):

                    left_eq = x * x + y * y + z * z + x * y + y * z + z * x
                    if (left_eq == n):
                        ans_list = [x, y, z]
                        ans_len = len(set(ans_list))
                        


                        ans += 1
                        
                        # if (ans_len==3):
                        #     ans += 6
                        # elif (ans_len == 2):
                        #     ans += 3
                        # else:
                        #     ans += 1

        
        
        print(ans)


if __name__ == '__main__':
    main()

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)):
                for z in range(1,int((i+1)**0.5)):
                    if x*y>=i:
                        break
                    elif 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 m in range(n):
    count = 0
    for i in range(n):
        x = i + 1
        xx = x * x
        if  x * x >= n:
            break
        for j in range(n):
            y = j + 1
            yy = y * y
            if xx + yy + x * y>= n:
                break
            for k in range(n):
                z = k + 1
                zz = z * z
                if xx + yy + zz + x * y + y * z + z * x > m+1:
                    break
                elif xx + yy + zz + x * y + y * z + z * x == m+1:
                    count += 1
                    break
    print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def func(N):
    count = 0
    for x in range(1, int(N**0.5)+1):
      for y in range(1, int(N**0.5)+1):
          D = (x+y)**2 -4*(x**2 + y**2+ x*y - N)
          if D > 0:
              z = -(x+y)/2 + D**0.5 / 2
              if z.is_integer() and z >= 1:
                  count += 1
    return count
                
for n in range(1,N+1):
  print(func(n))

Submission status: Time Limit Exceeded

Solution code:
import math
def equal(x,y,z):
    return x**2 + y**2 + z**2 +x*y+y*z+z*x

N = int(input())

for i in range(1,N+1):
    cnt = 0
    for x in range(1,math.ceil(math.sqrt(N))+1):
        for y in range(1,math.ceil(math.sqrt(N))+1):
            for z in range(1,math.ceil(math.sqrt(N))+1):
                if equal(x,y,z) == i:
                    #print(x,y,z)
                    cnt+=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def count_n(n):
    ans = 0
    for x in range(1,int(N**0.5)):
        if 6*x**2 == n:
            ans = 1
            return ans
        else:
            for y in range(1,int(N**0.5)):
                    if (3*x**2 + y**2 + 2*x*y)  == n:
                        ans = 3
                        return ans
    return ans

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

Submission status: Time Limit Exceeded

Solution code:
from itertools import product
N = int(input())
#L, R, d=map(int,input().split())
#C = []
# for i in range(N):
#    C.append((input().replace(".","0").replace("#","1")))
# S=list(map(int,input().split()))
# B=list(map(int,input().split()))
def calc1(x,y,z):
    return x*x+y*y+z*z+x*y+y*z+z*x
def calc2(x,y):
    return x*x+y*y+1*1+x*y+y*1+1*x
def calc3(x):
    return x*x+1*1+1*1+x*1+1*1+1*x

count = []
for n in range(1,N+1):
    count2 = 0
    l = []
    for i in range(1,n):
        if calc3(i) > n:
            break
        for j in range(1,n):
            if calc2(i,j) > n:
                break
            for k in range(1,n):
                h = calc1(i,j,k)
                o = [i,j,k].sort
                if h > n:
                    break
                elif o in l:
                    count2+=1
                elif h == n:
                    count2+=1
                    l.append(o)
    count.append(count2)

print('\n'.join(map(str, 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/3)):
    for y in range(1, int(i/3)):
      for z in range(1, int(i/3)):
        """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())
n = [0 for _ in range(N)]

def cob(m):
    if m <= 0:
        return m
    return m + cob(m-1)

# x > y > z
test = 0
for x in range(1,N+1):
    for y in range(1,x+1):
        for z in range(1,y+1):
            ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if len(set([x,y,z])) == 3:
                cnt = 6
            elif len(set([x,y,z])) == 2:
                cnt = 3
            else:
                cnt = 1
            if ans > N:
                break
            n[ans-1] += cnt

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