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:
N = int(input())
count = 0
M = N//5
LiST = []
for k in range(1,N+1):
    count= 0
    for x in range(1,M):
        for y in range(1,M):
            for z in range(1,M):
                if ((x*(x+y))+(y*(y+z))+(z*(z+x))) == k:
                    count +=1
    LiST.append(count)
for i in LiST:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
x = 1
y = 1
z = 1
import math
listN = []
while x<=98:
    y =1
    z =1
    while y<=-x+math.sqrt(-8*(x**2)+120000):
        z = 1
        while z <= -x/2-y/2+math.sqrt(-3*(x**2+y**2)-2*x*y+360000)/2:
            ans = x**2+y**2+z**2+x*y+y*z+z*x
            if ans<=10000:
                listN.append(ans)
                z = z+1
            else:
                break
        y = y+1
    x = x+1
n = 1
while n<=a:
    print(listN.count(n))
    n = n+1

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

for n in range(1,N+1):
    ans = 0
    for i in range(1,int(n**0.5)):
        for j in range(i,int(n**0.5)):
            for k in range(j,int(n**0.5)):
                if i**2+j**2+k**2+i*j+j*k+k*i==n:
                    if i == j and j == k:
                        ans += 1
                    else:
                        ans += 3
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
for f in range(1,n+1):
	try:
		l = int(-1+math.sqrt(-2+f)+0.999)
	except:
		print(0)
		continue
	e = 0
	for x in range(1,l+1):
		for y in range(1,l+1):
			try:
				q = (-(x+y)+math.sqrt((x+y)**2-4*(x**2+y**2+x*y-f)))/2
				if q==int(q) and q >= 1:
					e += 1
			except:
				pass
	print(e)

Submission status: Time Limit Exceeded

Solution code:
input_number = input()
for n in range(int(input_number)):
	n += 1
	count = 0
	for x in range(1,101):
		for y in range(1,101):
			for z in range(1,101):
				function = x*x+y*y+z*z+x*y+y*z+x*z
				if function > n:
					break
				if n == function:
					count += 1
	print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
for i in range(1,n+1):
  cnt = 0
  for x in range(1,int(i**(1/2))):
    for y in range(x,int(i**(1/2))):
      for z in range(y,int(i**(1/2))):
        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:
import itertools
def F(n):
    ans = 0
    if n < 6:
        return 0
    else:
        xy = list(itertools.product(map(str,range(1,int((n-3)**0.5)+1)),repeat=2))
        for x,y in xy: 
            x = int(x)
            y = int(y)
            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:
import math
N = int(input())
x = math.ceil(N)
ans = [0]*N

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

for i in range(1,x):
    for j in range(i,x):
        for k in range(j,x):
            s = f(i,j,k)
            t = len(set([i,j,k]))
            if N < s:
                pass
            else:
                if t == 3:
                    ans[s-1] += 6
                elif t == 2:
                    ans[s-1] += 3
                elif t ==1:
                    ans[s-1] += 1
for i in range(len(ans)):
    print(ans[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))
        for x in range(1, li):
            xx = x * x
            for y in range(1, li):
                yy = y * y
                xy = x * y
                x_y = 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):
                    ans += 1
                if (1
                        and 1 <= z2
                        and z2 % 1 == 0):
                    ans += 1
        print(ans)


resolve()

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,int(i*2/3)):
   for y in range(1,int(i*2/3)):
    for z in range(1,int(i*2/3)):
     if x+y+z==math.sqrt(i+x*y+x*z+y*z):
       ans+=1
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
"""エイシング プログラミング コンテスト 2020: C - XYZ Triplets
https://atcoder.jp/contests/aising2020/tasks/aising2020_c
"""

cache = {}


def calc(x, y, z):
    # print('    =({},{},{})'.format(x, y, z))
    key = '{}-{}-{}'.format(x, y, z)
    # print(key)
    if key not in cache:
        cache[key] = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x)
    return cache[key]


def f(n):
    # print('n:{}'.format(n))
    ans = 0

    max_value = 1
    for x in range(1, n + 1):
        v = calc(x, 1, 1)
        if n < v:
            max_value = x
            break

    # print('max:{}'.format(max_value))
    for x in range(1, max_value + 1):
        for y in range(1, max_value + 1):
            for z in range(1, max_value + 1):
                v = calc(x, y, z)
                # print('v:{}'.format(v))
                if n < v:
                    break
                if v == n:
                    ans += 1
                    break

    return ans


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

    for n in range(1, N + 1):
        if n < 6:
            print(0)
        else:
            print(f(n))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:

import math




N=int(input())

anslist=[]
for i in range(1,N+1):
    ans=0
    if i<=5:
        anslist.append(ans)
    else:
        ma=int(math.sqrt(i))
        mi=max(1,int(math.sqrt(i)/6))
        for x in range(mi,ma):
            for y in range(x,ma):
                for z in range(y,ma):
                    if x**2+y**2+z**2+x*y+y*z+z*x>i:
                        continue
                    if x**2+y**2+z**2+x*y+y*z+z*x==i:
                        if x==y and y==z:
                            ans+=1
                        elif x==y or y==z or z==x:
                            ans+=3
                        else:
                            ans+=6
        anslist.append(ans)
            

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

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
count = [0]*n
for i in range(1,n+1):
    for x in range(1,int(n**0.5)+1):
        for y in range(1,int(n**0.5)+1):
            b = x + y
            c = x*x + y*y + x*y - i
            if b**2 >= 4*c:
                d = (-b + math.sqrt(b**2-4*c))/2
                if d.is_integer() == True and d >= 1:
                    count[i-1] += 1
                elif d.is_integer() == True and d >= 1:
                    count[i-1] += 1
for i in range(n):
    print(count[i])

Submission status: Time Limit Exceeded

Solution code:
import math

def f(n):
    counter = 0
    #print("n=",n)
    for x in range(1,math.floor(math.sqrt(n))+1):
        a = x**2
        if a > n:
            break
        #print("x=",x)
        for y in range(1,math.floor(math.sqrt(n))+1):
            b = a + y**2+x*y
            if b > n:
                break
            #print("y=",y)
            for z in range(1,math.floor(math.sqrt(n))+1):
                #print("z=",z)
                c = b + z**2+y*z+x*z
                if c > n:
                    break
                elif c == n:
                    counter += 1
    print(counter)

N = int(input())

for n in range(1,N+1):
    f(n)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

for i in range(n):
    s = 0
    for x in range(1, n+1):
        if x**2 + 2*x + 3 > i+1:
            print(s)
            break
        else:
            for y in range(1, x+1):
                if f(x,y,1) > i+1:
                    break
                else:
                    for z in range(1, y+1):
                        
                        if f(x,y,z) == i+1:
                            if x == y and y == z:
                                s += 1
                            elif x == y or y == z:
                                s += 3
                            else:
                                s += 6

Submission status: Time Limit Exceeded

Solution code:
# aising2020_c.py
def f(n):
    cnt = 0
    for i in range(1,int(n**0.5)+1):
        for j in range(i,int(n**0.5)+1):
            for k in range(j,int(n**0.5)+1):
                if i**2+j**2+k**2+i*j+j*k+k*i == n:
                    if i==j and i==k and j==k:
                        cnt+=1
                    else:
                        cnt+=3
    return cnt


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

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    x , y , z = 1,1,1
    anwlist = []
    for i in range(N):
        n = i+1

        while True: # X
            
            while True: # Y

                while True: # Z
                    calc = x**2 +  y**2 + z**2 + x*y + y*z + z*x

                    if calc > n:
                        break
                    elif calc == n:
                        anwlist.append([x,y,z])
                        break
                    elif calc < n:
                        z += 1

                y += 1
                z = 1
                calc = x**2 +  y**2 + z**2 + x*y + y*z + z*x
                if calc > n:
                    break 

            x += 1
            y,z = 1, 1
            calc = x**2 +  y**2 + z**2 + x*y + y*z + z*x
            if calc > n:
                print(len(anwlist))
                x, y, z = 1,1,1
                anwlist = []
                break
        
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
#from matplotlib import pyplot as plt

def rule2(x,y,z):
    return x ** 2 + y ** 2 + z**2 + x * y + y * z + z*x
def main():
    n = int(input())
    x = []
    y = []
    for i in range(1,n+1):
        x.append(i)
        y.append(f(i))
        print(f(i))
    #plt.scatter(x,y)
    #plt.show()


def f(n):
    counter = 0
    for x in range(1,n):
        if x ** 2 > n:
            break
        for y in range(1,n-x**2):
            if y < x:
                continue
            if x ** 2 + y ** 2 > n:
                break
            for z in range(1,n-x**2-y**2):
                if z < y:
                    continue
                if x ** 2 + y ** 2 + z **2 > n:
                    break
                if rule2(x,y,z) == n:
                    if x == y and y == z and z == x:
                        counter += 1
                    elif x != y and y != z and z != x:
                        counter += 6
                    else:
                        counter += 3

    return counter


if __name__ == '__main__':
    main()

#6 24 54 96
#1  4  9 16
#18

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:
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):
                f2 = 0
                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:
                    f2 += 1
                    # print('x,y,z= ',x,y,z)
                    break

            if flag or f2==2:
                break
        if flag:
            break
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
def fx(n):
  cnt = 0

  for i in range(1,10000):
    if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
    for j in range(1, 10000):
      if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
      for k in range(1, 10000):
        if (1+1+k)**2 - 1*1 - 1*k - k*1 > n: break
        formula = (i+j+k)**2 - i*j - j*k - k*i
        if formula == n:
          cnt+=1
        if formula >= n:
          break
  
  return cnt


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

Submission status: Time Limit Exceeded

Solution code:
import math
#=input()
N=int(input())
#=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

for n in range(1,N+1):
    x = 1
    cnt = 0
    while True:
        y = 1
        while True:
            root = - 3 * (x ** 2) - 3 * (y ** 2) - 2 * x * y + 4 * n
            if root < 0:
                break
            zz = 1
            if math.sqrt(root) % 1 == 0:
                zz = (- y - x + int(math.sqrt(root)))
                #print(n,x,y,zz)
                if (zz % 2 == 0) and (zz > 0):
                    cnt += 1
                    #print("tsuuka!",n,x,y)
            if (zz < 0) or (root < 0):
                break
            y += 1
        if x ** 2 > n:
            break
        x += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 0
for l in range(1, n+1):
  for i in range(1, l):
    for j in range(1, l):
      for k in range(1, l):
        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:
# -*- coding: utf-8 -*-
n=int(input())
for val in range(1,n+1):
  ans=0
  if val<100:
    x=val
  else:
    x=100
  for i in range(1,x+1):
    for j in range(1,i+1):
      for k in range(1,j+1):
        sumg=(i+j)**2+(j+k)**2+(k+i)**2
        if sumg==2*val:
          if i==j and j==k:
            ans+=1
          elif i!=j and j!=k and k!=i:
            ans+=6
          else:
            ans+=3
  print(ans)

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 // 2 + 1):
        for y in range(x,n // 2 + 1):
            for z in range(y,n // 2 + 1):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n:
                    cnt += 1
                    if x == y == z:
                        cnt += 0
                    elif x == y != z:
                        cnt += 2
                    elif x != y == z:
                        cnt += 2
                    else:
                        cnt += 5
                else:
                    cnt += 0
    print(str(cnt))

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    b = []
    for i in range(1,N+1):
        if (i<6):
            print(0)
        else:
            for x in range(1,i):
                for y in range(1,i):
                    for z in range(1,i):
                        aa = (x+y+z)**2 -(x*y+y*z+z*x)
                        if aa == i:
                            b.append(i)
            print(len(b))
            b.clear()
main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def f(n):
    a = 0
    b = 0
    c = 0
    d = 0
    ###
    x = 1
    while 6 * (x**2) < n:
        x += 1
    if 6 * (x**2) == n:
        a += 1
    ###
    x = 1
    z = 1
    while 6 * (x**2) < n:
        z = x+1
        while 3 * (x**2) + 2 * x * z + (z**2) < n:
            z += 1
        if 3 * (x**2) + 2 * x * z + (z**2) == n:
            b += 1
        x += 1
    ###
    x = 1
    y = 1
    while 6 * (x**2) < n:
        y = x+1
        while (x**2) + 2 * x * y + 3 * (y**2) < n:
            y += 1
        if (x**2) + 2 * x * y + 3 * (y**2) == n:
            c += 1
        x += 1
    x = 1
    y = 1
    z = 1
    while 6 * (x**2) + 3 * x + 1 < n:
        y = x+1
        while (x**2) + 2 * x * y + 3 * (y**2)< n:
            z = y+1
            while (x**2) + (y**2) + (z**2) + x * y + y * z + x * z < n:
                z += 1
            if (x**2) + (y**2) + (z**2) + x * y + y * z + x * z == n:
                d += 1
            y += 1
        x += 1
    return a + 3 * (b + c) + 6 * d

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1, N+1):
  ans = 0
  check = False
  for x in range(1, min(41, N+1)):
    for y in range(1, min(41, N+1)):
      for z in range(1, min(41, N+1)):
        ret = x**2 + y**2 + z**2 + x*y + y*z + z*x
        if ret > n:
          break
        if ret == n:
          ans+=1
      
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3

def func(n):
    cnt = 0
    for x in range(1, 100):
        if x * x > n:
            break
        for y in range(1, 100):
            if y * y > n:
                break
            for z in range(1, 100):
                if z * z > n:
                    break
                if x * x + y * y + z * z + x * y + y * z + z * x == n:
                    cnt += 1
                    break
    return cnt


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

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

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

Submission status: Time Limit Exceeded

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

for n in range(1,N+1):
    j=0
    min = 1
    max = int(np.sqrt(abs(n-2)))
    #print(max)
    for x in range(min,max):
        #print(f'max:{max}')
        for y in range(min, max):
            for z in range(min, 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
                        min = x
                        #print(x, y, z)
                        #print(f'n:{n}')
                        j += 1
                    else:
                        j += 1
    print(j)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
x = 1
for m in range(1,N+1):
  count =0
  y =1
  z =1
  for i in range(m):
    x = i+1
    if 6*x**2>=m:
      if x**2>=m:
        break
      if 9*x*x >= m:
        for k in range(x):
          y = k+1
          nn = x*x+y*y+x*y
          if nn > m:
            break
          xy = (x+2*y)**2-x*y
          if xy >= m:
            for j in range(y):
              z = j+1
              n = nn+z*z+y*z+z*x
              if n>m:
                break
              if n==m:
                if  x==y or y==z or z==x:
                  if x==y and y == z:
                    count =count+1
                  else:
                    count = count+3
                else:
                  count =count+6
  print(count)

Submission status: Time Limit Exceeded

Solution code:
#!python3

LI = lambda: list(map(int, input().split()))

# input
N = int(input())


def main():
    for i in range(1, N + 1):
        ans = 0
        xn = int(i ** 0.5) + 1
        for x in range(1, xn):
            s = i - x * x
            if s < 0:
                break
            yn = int(s ** 0.5) + 1
            for y in range(x, yn):
                t = s - (y * y + x * y)
                if t < 0:
                    break
                zn = int(t ** 0.5) + 1
                for z in range(y, zn):
                    v = z * (x + y + z)
                    if v == t:
                        n = len({x, y, z})                            
                        if n == 3:
                            ans += 6
                        elif n == 2:
                            ans += 3
                        else:
                            ans += 1
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

for i in range(n):
    s = 0
    for x in range(1, n+1, 1):
        if x**2 + 2*x + 3 > i+1:
            print(s)
            break
        else:
            for y in range(1, x+1, 1):
                if f(x,y,1) > i+1:
                    break
                else:
                    for z in range(1, y+1, 1):
                        
                        if f(x,y,z) == i+1:
                            if x == y and y == z:
                                s += 1
                            elif x == y or y == z:
                                s += 3
                            else:
                                s += 6

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(i))+1):
        for y in range(1,math.ceil(math.sqrt(i))+1):
            for z in range(1,math.ceil(math.sqrt(i))+1):
                if equal(x,y,z) == i:
                    #print(x,y,z)
                    cnt+=1
                elif equal(x,y,z) > i:
                    continue
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
for n in range(1,N+1):
    r_n = math.floor(math.sqrt(n))
    count = 0
    if(n >= 6):
        for x in range(1,r_n):
            y_n = min(r_n,math.floor(math.sqrt(n-x*x)))
            for y in range(1,y_n):
                z_n = min(y_n,math.floor(math.sqrt(n-(x*x+y*y))))
                for z in range(1,z_n):
                    if (x*x + y*y + z*z + x*y + y*z + z*x) == n:
                        count+=1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
flag = 1
for i in range(1, n+1):
    count = 0
    for x in range(1, 11000):
        if x > (2*i) ** 0.5:
            break
        for y in range(1, 11000):
            if (x+y) > (2*i)**0.5:
                break
            for z in range(1, 11000):
                if ((x+y)**2 + (y+z)**2 + (z+x)**2) / 2 == i:
                    count += 1
                if ((x+y)**2 + (y+z)**2 + (z+x)**2) / 2 > i:
                    break
                    
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
mylist = [int(math.sqrt(i)) for i in range(1,n+1)]

def main():
    for N in range(1,n+1):
        result = 0
        for x in range(1,mylist[N-1]+1):
            tempx = x**2
            for y in range(1, mylist[N-x**2]+1):
                tempy = y**2
                tempxy = x*y
                if N-tempx-tempy-tempxy < 0:
                    break
                else:
                    for z in range(1, mylist[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:
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):
            xx = x * x
            for y in range(1, li):
                yy = y * y
                xy = x * y
                x_y = 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):
                    ans += 1
                if (1
                        and 1 <= z2
                        and z2 % 1 == 0):
                    ans += 1
        print(ans)


resolve()

Submission status: Time Limit Exceeded

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

def judge(n, x=1, y=1, z=1, l=[]):
    num = 0
    x_th = math.ceil(math.sqrt(n) / 3) + 1
    #print('x_th: ', x_th+1)
    for x_i in range(x**2, x_th+1):
        #print('x_i: ', x_i)
        for y_i in range(x_i, x_th+1):
            y_th = n - x_i**2 + y_i**2 + x_i*y_i
            #print('y_i: ', y_i)
            #print('y_th: ', y_th)
            if y_th < 0:
                break
            for z_i in range(y_i, x_th+1):
                #print('z_i: ', z_i)
                result = x_i**2 + y_i**2 + z_i**2 + x_i*y_i + y_i*z_i + z_i*x_i
                #print('result: ', result)
                if result > n:
                    break
                elif result == n:
                    if x_i != y_i != z_i:
                        num += 6
                    elif x_i == y_i != z_i or x_i != y_i == z_i:
                        num += 3
                    elif x_i == y_i == z_i:
                        num += 1
                    #print('num: ', num)
    return num

#fn = judge(18, l=[])
#print(fn)
for i in range(1, n+1):
    fn = judge(i, l=[])
    print(fn)

Submission status: Time Limit Exceeded

Solution code:
from numpy import sqrt
N=int(input())
num=1
def checker(n):
    hoge=n
    if hoge>2:
        hoge=n-2
    count=0
    x=1
    for a in range(int(sqrt(hoge))):
        y=1
        for b in range(int(sqrt(hoge))):
            z=1
            for c in range(int(sqrt(hoge))):
                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:
N = int(input())
ans = [0 for i in range(N)]
_trigger = []

def dfs(x, y, z):
  f = x**2 + y**2 + z**2 + x * y + y * z + z * x
  tmp = [x, y, z]
  if f > N or tmp in _trigger:
    return
  if f <= N:
    ans[f - 1] += 1
  _trigger.append(tmp)
  dfs(x + 1, y, z)
  dfs(x, y + 1, z)
  dfs(x, y, z + 1)

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

Submission status: Time Limit Exceeded

Solution code:
def fx(n):
  cnt = 0

  for i in range(1,10000):
    if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
    for j in range(1, 10000):
      if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
      for k in range(1, 10000):
        formula = (i+j+k)**2 - i*j - j*k - k*i
        if formula == n:
          cnt+=1
        if formula >= n:
          break
  
  return cnt


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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
count=[0]*N
for n in range(1,N+1):
  for x in range(1,100):
    for y in range(1,100):
      for z in range(1,100):
        if x**2 + y**2 + z**2 + x*y + y*z + z*x ==n:
          count[n-1]+=1
for ans in count:
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
def f(n):
    count=0
    for x in range(1,int(math.sqrt(n))):
        for y in range(1,x+1):
            for z in range(1,x+1):
                if x*x+y*y+z*z+x*y+y*z+z*x==n:
                    if x==y and y==z:
                        count+=1
                    else:
                        count=3
    print(count)

for i in range(1,N+1):
    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>=y:
                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:
                            if x==y:
                                ans+=1
                            else:
                                ans+=2

    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1, N+1):
  ans = 0
  check = False
  for x in range(1, min(101, N+1)):
    for y in range(1, min(101, N+1)):
      for z in range(1, min(101, N+1)):
        ret = x**2 + y**2 + z**2 + x*y + y*z + z*x
        if ret > n:
          break
        if ret == n:
          ans+=1
      
  print(ans)