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: Wrong Answer

Solution code:
n=int(input())

max_n=10**4+5
ans=[0]*(max_n)
for x in range(1,34):
    for y in range(1,34):
        for z in range(1,34):
            total=x**2+y**2+z**2+x*y+y*z+z*x
            if total<=max_n:
                ans[total]+=1

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

Submission status: Wrong Answer

Solution code:
n = int(input())

count = [0] * 10001

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            temp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if(1 <= temp and temp <= 10000):
                count[temp] += 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = [0]*1000
for i in range(1,10):
    for j in range(1,10):
        for k in range(1,10):
            ans[(i+j+k)**2-(i*j+j*k+k*i)] += 1
for i in ans[1:n+1]:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = [0] * (n+1)


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


for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            c = f(x, y, z)
            if c <= n:
                ans[c] += 1

for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
n=int(input())

ans_list = []
for i in range(n):
    ans=0
    N = i+1
    for x in range(1,11):
        for y in range(1,11):
            for z in range(1,11):
                if x**2+y**2+z**2+x*y+y*z+z*x == N:
                    ans+=1
    ans_list.append(ans)

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

Submission status: Wrong Answer

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  ans=[0]*(n+1)
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        a=x*x+y*y+z*z+x*y+y*z+z*x
        if a<=n:
          ans[a]+=1

  for x in ans[1:]:
    print(x)

# main()
print(main())

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = [0]*(N+1)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            tmp = x*x+y*y+z*z+x*y+y*z+z*x
            if 1 <= tmp <= N:
                ans[tmp] += 1
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())

for i in range(1,N+1):
    ans = 0

    for x in range(1,33):
        for y in range(1,33):
            for z in range(1,33):
                if x**2+y**2+z**2+x*y+y*z+z*x==i:
                    ans += 1
                
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
Ali = [0]*(N+1)

for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      i = x**2+y**2+z**2+x*y+y*z+z*x
      if i<N:
        Ali[i] += 1
        
for i in range(N):
  print(Ali[i+1])

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=[0]*(N+1)
to=int((N)**(1/2))+2
for x in range(1,to):
    for y in range(1,to):
        for z in range(1,to):
            temp=x*x+y*y+z*z+x*y+y*z+z*x
            if temp<N:
                ans[temp]+=1
for i in range(1,N+1):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
# coding: utf-8


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

    fs = [0] * N
    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                i = (x**2) + (y**2) + (z**2) + (x+y) + (y+z) + (z+x)
                if i <= N:
                    fs[i-1] += 1

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


main()
# print(main())

Submission status: Wrong Answer

Solution code:
import sys
from operator import itemgetter

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def iif(n): return [int(input()) for _ in range(n)]
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    mod = 1000000007
    
    N = ii()
    ans = [0] * N

    for x in range(1, 51):
        for y in range(1, 51):
            for z in range(1, 51):
                tmp = x*x + y*y + z*z + x*y + y*z + z*x
                if tmp < N:
                    ans[tmp-1] += 1
    
    print(*ans, sep="\n")

    return

main()

Submission status: Wrong Answer

Solution code:
n = int(input())
f = [0] * (n + 1)
t = int(n ** .5) + 3
for i in range(1, t):
    for j in range(1, t):
        for k in range(1, t):
            res = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if res <= n:
                f[res] += 1
print('\n'.join(map(str, f)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    N = int(input())
    ans = [0]*10**4
    for x in range(1,10**2+1):
        for y in range(1,10**2+1):
            for z in range(1,10**2+1):
                tmp = (x+y+z)**2-x*y-y*z-z*x
                if tmp < 10**4:
                    ans[tmp-1] += 1
    for i in range(N):
        print(ans[i])

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

cnt = [0] * N

for x in range(1, 50):
    for y in range(1, 50):
        for z in range(1, 50):
            tmp = x * x + y * y + z * z + x * y + y * z + z * x
            if tmp <= N:
                cnt[tmp-1] += 1

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

Submission status: Wrong Answer

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

for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      a = x**2+y**2+z**2+x*y+y*z+z*x
      if a <= n:
        ans[a] += 1
for i in range(n+1):
  print(ans[i])

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
for i in range(1,n+1):
    e=0
    for j in range(1,51):
        if(j*j>=n):
            break
        for k in range(1,51):
            if(k*k>=n):
                break
            for l in range(1,51):
                if(l*l>=n):
                    break
                if((j*j)+(k*k)+(l*l)+(j*k)+(k*l)+(l*j)==i):
                    e=e+1
    print(e)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
for i in range(1,n+1):
    e=0
    for j in range(1,101):
        if(j*j>=n):
            break
        for k in range(1,101):
            if(k*k>=n):
                break
            for l in range(1,101):
                if(l*l>=n):
                    break
                if((j*j)+(k*k)+(l*l)+(j*k)+(k*l)+(l*j)==i):
                    e=e+1
    print(e)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
for i in range(1,n+1):
    e=0
    for j in range(1,101):
        for k in range(1,101):
            for l in range(1,101):
                if((j*j)+(k*k)+(l*l)+(j*k)+(k*l)+(l*j)==i):
                    e=e+1
    print(e)

Submission status: Time Limit Exceeded

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

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

ans = [0]*(N+1)

# upper = math.ceil(math.sqrt(N/6)) + 1
upper = N
for x in range(1, upper+1):
    for y in range(1, upper + 1):
        for z in range(1, upper + 1):
            v = f(x,y,z)
            if v <= N:
                ans[v] += 1
            else:
                break

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
m = int(n ** 0.5) + 1
for i in range(1,n+1):
  cnt = 0
  for x in range(1, m):
    for y in range(1, m):
      if (x+y)**2-4*(x**2+y**2+x*y-i) >0:
        z = (-(x+y)+((x+y)**2-4*(x**2+y**2+x*y-i))**0.5)/2       
        if z%1 == 0 and z>0:            
          cnt += 1
      else:
        break
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

def f(n):
  if n<6:
    return 0
  count=0
  for x in range(1, int(N**(0.5))+1):
    for y in range(1, int(N**(0.5))+1):
      for z in range(1, int(N**(0.5))+1):
        if poly(x, y, z)==n:
          count=count+1
  return count
    

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
def triples(N):
  _ = 0
  if N < 2:
    pass
  else:
    limit = (N - 2) ** (1 / 2)
    for x in range(1,int(limit) + 1):
      for y in range(1,int(limit) + 1):
        for z in range(1,int(limit) + 1):
          if (x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2 == 2 * N:
            _ += 1
  return _

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

Submission status: Time Limit Exceeded

Solution code:
from typing import List


def main():
    n = int(input())
    m = xyz(n)
    for i in m:
        print(i)


def xyz(n: int) -> List[int]:
    rs = []
    for i in range(1, n + 1):
        r = 0
        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 > i:
                        break
                    elif x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == i:
                        r += 1
        rs.append(r)

    return rs


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from typing import List


def main():
    n = int(input())
    m = xyz(n)
    for i in m:
        print(i)


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


def xyz(n: int) -> List[int]:
    rs = []
    for i in range(1, n + 1):
        r = 0
        for x in range(1, i - 4):
            for y in range(x, i - 4):
                for z in range(y, i - 4):
                    if f(x, y, z) > i:
                        break
                    elif f(x, y, z) == i:
                        if x == y == z:
                            r += 1
                        elif x == y or y == z or z == x:
                            r += 3
                        else:
                            r += 6
        rs.append(r)

    return rs


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from typing import List


def main():
    n = int(input())
    m = xyz(n)
    for i in m:
        print(i)


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


def xyz(n: int) -> List[int]:
    rs = []
    for i in range(1, n + 1):
        r = 0
        for x in range(1, 100):
            for y in range(x, 100):
                for z in range(y, 100):
                    if f(x, y, z) > i:
                        break
                    elif f(x, y, z) == i:
                        if x == y == z:
                            r += 1
                        elif x == y or y == z or z == x:
                            r += 3
                        else:
                            r += 6
        rs.append(r)

    return rs


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
from typing import List


def main():
    n = int(input())
    m = xyz(n)
    for i in m:
        print(i)


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


def xyz(n: int) -> List[int]:
    rs = []
    for i in range(1, n + 1):
        r = 0
        for x in range(1, i - 4):
            for y in range(1, i - 4):
                for z in range(1, i - 4):
                    if f(x, y, z) > i:
                        break
                    elif f(x, y, z) == i:
                        r += 1
        rs.append(r)

    return rs


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from typing import List


def main():
    n = int(input())
    m = xyz(n)
    for i in m:
        print(i)


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


def xyz(n: int) -> List[int]:
    rs = []
    for i in range(1, n + 1):
        r = 0
        for x in range(1, 100):
            for y in range(1, 100):
                for z in range(1, 100):
                    if f(x, y, z) > i:
                        break
                    elif f(x, y, z) == i:
                        r += 1
        rs.append(r)

    return rs


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
for n in range(1, N+1):
  counter = 0
  if n < 6:
    print(0)
    continue
  x = y = z = 0
  x_max = math.ceil(1/3*(2 * math.sqrt(3*n-2)-1))
  while x <= x_max:
    y = 1
    while x >= y:
      y += 1
    x += 1
    while 4*n-3*x**2-2*x*y-3*y**2 >= 0:
      s = math.sqrt(4*n-3*x**2-2*x*y-3*y**2)
      if float(s).is_integer():
        s = int(s)
        if (s-x-y) >= 2 and (s-x-y) % 2 == 0 and x == y == int((s-x-y)/2):
          counter += 1
        elif (s-x-y) >= 2 and (s-x-y) % 2 == 0 and x <= y <= (s-x-y)/2:
          z = int((s-x-y)/2)
          #print("n:" + str(n) + "(" + str(x) + "," + str(y) + "," + str(z) + ")")
          counter += 3
      y += 1
  print(counter)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
for n in range(1, N+1):
  counter = 0
  if n < 6:
    print(0)
    continue
  x = 0
  x_max = math.ceil(1/3*(2 * math.sqrt(3*n-2)-1))
  while x <= x_max:
    y = 1
    x += 1
    while 4*n-3*x**2-2*x*y-3*y**2 >= 0:
      s = math.sqrt(4*n-3*x**2-2*x*y-3*y**2)
      if float(s).is_integer():
        s = int(s)
        if (s-x-y) >= 2 and (s-x-y) % 2 == 0:
          z = int((s-x-y)/2)
          #print("n:" + str(n) + "(" + str(x) + "," + str(y) + "," + str(z) + ")")
          counter += 1
      y += 1
  print(counter)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())


def calc(c):
    g = 0
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                if (x * x) + (y * y) + (z * z) + x * y + y * z + x * z == c:
                    g += 1
    return g


for i in range(n):
    print(calc(i))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


def func(n):
    result = 0
    for x in range(1, n+1):
        for y in range(1, n+1):
            for z in range(1, n+1):
                check = x**2 + y**2 + z**2 + x * y + y * z + z * x
                if check == n:
                    #print("n :{} ({},{},{})".format(n, x, y, z))
                    result += 1

                if check > n:
                    break

    return result


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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def calc(n):
    ans = 0
    for x in range(1,n+1):
        a = x**2
        if a>=n:
            break
        for y in range(1,1+n):
            b = y**2
            if b>=n:
                break
            for z in range(1,1+n):
                c = z**2
                if c>=n:
                    break
                f = a+b+c+x*y+y*z+z*x
                if f>n:
                    break
                if f==n:
                    ans += 1
    return ans

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

Submission status: Time Limit Exceeded

Solution code:
def CalculateEq(x,y,z):
    return x*x + y*y + z*z + x*y + y*z + z*x


def main():
    
    n = int(input())
    NumTriples = [0] * n

    for x in range(1,n):
        for y in range(1,n):
            for z in range(1,n):
                res = CalculateEq(x,y,z)
                if res < n:
                    NumTriples[res - 1] += 1
                else:
                    break
      
    for item in NumTriples:
        print(item)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
import math
N =int(input())
for i in range(N):
  count = 0
  M = int(math.sqrt(i+1))
  for j in range(M):
    for k in range(M):
      for l in range(M):
        if((j+1)**2 + (k+1)**2 + (l+1)**2 + (j+1)*(k+1) + (k+1)*(l+1) + (l+1)*(j+1) == i+1):
          count+=1
        if ((j+1)**2 + (k+1)**2 + (l+1)**2 + (j+1)*(k+1) + (k+1)*(l+1) + (l+1)*(j+1) > i+1):
          break
  print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
N =int(input())
for i in range(N):
  count = 0
  M = int(math.sqrt(i+1))
  for j in range(M):
    for k in range(M):
      for l in range(M):
        if((j+1)**2 + (k+1)**2 + (l+1)**2 + (j+1)*(k+1) + (k+1)*(l+1) + (l+1)*(j+1) == i+1):
          count+=1
  print(count)

Submission status: Time Limit Exceeded

Solution code:
def f(n):
    ans = 0
    for x in range(1, n):
        x2 = x**2
        if x2 > n-2:
            break
        for y in range(1, n):
            y2 = y**2
            if x2 + y2 + x*y > n-1:
                break
            for z in range(1, n):
                judge = x2 + y2 + z**2 + x*y + y*z + z*x
                if judge == n:
                    ans += 1
                elif judge > n:
                    break
    return ans


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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
#! python3
# coding:utf-8
 
def main():
    n = int(input())
    for i in range(1,n+1):
        cnt=0
        for x in range(1,100):
            for y in range(1,100):
                for z in range(1,100):
                    if (x+y+z)>=i:
                        continue
                    eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                    if eq == i:
                        cnt+=1
        print(cnt)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import math
if __name__ == '__main__':
    N = int(input())
    """
    因数分解を試みると
    x**2+y**2+z**2+x*y+y*z+z*x = (x+y+z)**2-(x*y+y*z+z*x)
    となり、多項式となり計算で解を得るのは難
    総当りを試みる
    """
    for n in range(1,N+1):
        f=0
        #full_search = math.ceil(2.0/3.0*math.sqrt(n))
        full_search = math.ceil(math.sqrt(n))
        for x in range(1,full_search):
            for y in range(1,full_search):
                for z in range(1,full_search):
                    val = x**2 + y**2 + z**2 + x*y + y*z + z*x
                    if val == n:
                        f+=1
        print(f)

Submission status: Time Limit Exceeded

Solution code:
import math
def main():
    N = int(input())
    if N<1 or N>10**4:
        return 0
    
    """
    因数分解を試みると
    x**2+y**2+z**2+x*y+y*z+z*x = (x+y+z)**2-(x*y+y*z+z*x)
    となり、多項式となり計算で解を得るのは難
    総当りを試みる
    """
    for n in range(1,N+1):
        f=0
        #full_search = math.ceil(2.0/3.0*math.sqrt(n))
        full_search = math.ceil(math.sqrt(n))
        for x in range(1,full_search):
            for y in range(1,full_search):
                for z in range(1,full_search):
                    val = x**2 + y**2 + z**2 + x*y + y*z + z*x
                    if val == n:
                        f+=1
        print(f)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
#! python3
# coding:utf-8
 
def main():
    n = int(input())
    for i in range(1,n+1):
        cnt=0
    
        for x in range(1,100):
            for y in range(1,100):
                for z in range(1,100):
                    eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                    
                    if eq == i:
                        cnt+=1
        print(cnt)
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
#! python3
# coding:utf-8
 
def main():
    n = int(input())
    for i in range(1,n+1):
        cnt=0
    
        for x in range(1,n+1):
            for y in range(1,n-x+1):
                for z in range(1,n-x-y+1):
                    eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                    
                    if eq == i:
                        cnt+=1
        print(cnt)
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
#! python3
# coding:utf-8

n = int(input())
for i in range(1,n+1):
    cnt=0

    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                
                tmp2 = x*y + y*z + z*x
                if (tmp2>i):
                    continue
                tmp1 = x**2 + y**2 + z**2   
                if (tmp1 + tmp2) == i:
                    cnt+=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
n = round(N**0.5)
counter = 0
for g in range(1,N+1):
  for i in range(1,n+1):
    for j in range(1,n+1):
      for k in range(1,n+1):
        if i**2+j**2+k**2+i*j+j*k+k*i == g:
          counter += 1
  print(counter)
  counter = 0

Submission status: Time Limit Exceeded

Solution code:
#! python3
# coding:utf-8

n = int(input())
for i in range(1,n+1):
    cnt=0

    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                   
                if eq == i:
                    cnt+=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
#! python3
# coding:utf-8

n = int(input())
for i in range(1,n+1):
    cnt=0

    for x in range(1,n+1):
        if x > i:
            continue
        for y in range(1,n-x+1):
            for z in range(1,n-x-y+1):
                eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                   
                if eq == i:
                    cnt+=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:

n = int(input())
for i in range(1,n+1):
    cnt=0

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

Submission status: Time Limit Exceeded

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

for i in range(1, N+1):
    ans = 0
    n = int(math.sqrt(i))+1
    for x in range(1, n+1):
        for y in range(1, x+1):
            for z in range(1, y+1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    if x == y == z:
                        ans += 1
                    elif x == y or y == z:
                        ans += 3
                    else:
                        ans += 6
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    X = 1
    Y = 1
    Z = 1

    for n in range(1,N+1,1):
        ans = 0
        for x in range(1,101,1):
            if x**2 + Y**2 + Z**2 + x*Y + Y*Z + Z*x > n:
                break
            for y in range(1,101,1):
                if x**2 + y**2 + Z**2 + x*y + y*Z + Z*x > n:
                    break
                for z in range(1,101,1):
                    if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                        ans += 1
                    elif x**2 + y**2 + z**2 + x*y + y*z + z*x > n:
                        break
        print(ans)



main()

Submission status: Time Limit Exceeded

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

for i in range(1, N+1):
    ans = 0
    n = int(math.sqrt(i))+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 == i:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def f(n):
    ans = 0
    for x in range(1, n):
        for y in range(1, n):
            for z in range(1, n):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    ans += 1
    return ans
for n in range(1, N+1):
    print(f(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ct = 0
L = list()


def kansu(i):
    global ct
    if i >= 100:
        L.append(ct)
        ct -= ct
    else:
        for x in range(1, i):
            for y in range(1, i):
                for z in range(1, i):
                    if i == x**2+y**2+z**2+x*y+y*z+z*x:
                        ct += 1
        L.append(ct)
        ct -= ct

for i in range(1, N+1):
    kansu(i)
[print(j) for j in L]

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ct = 0
L = list()


def kansu(i):
    for x in range(1, i):
        for y in range(1, i):
            for z in range(1, i):
                if i == x**2+y**2+z**2+x*y+y*z+z*x:
                    global ct
                    ct += 1
    L.append(ct)
    ct -= ct


for i in range(1, N+1):
    kansu(i)
[print(j) for j in L]

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for x in range(1, N+1):
  count = 0
  for i in range(1, 100):
    if (i**2 > x):
      break

    for j in range(1, 100):
      if (i**2 + j**2 > x):
        break
      
      for k in range(1, 100):
        if ((i**2 + j**2 + k**2) > x):
          break
        
        if ((i**2 + j**2 + k**2 + i*j + j*k + k*i) == x):
          count += 1
          break

  print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for x in range(1, N+1):
  count = 0
  for i in range(1, 100):
    if (i**2 + i + i > x):
      continue

    for j in range(1, 100):
      if (i**2 + j**2 + i*j + j + i > x):
        continue
      
      for k in range(1, 100):
        if ((i**2 + j**2 + k**2 + i*j + j*k + k*i) == x):
          count += 1
          break

        if ((i**2 + j**2 + k**2 + i*j + j*k + k*i) > x):
          break

  print(count)

Submission status: Time Limit Exceeded

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

ans = [0] * n
for v in itertools.product(list(range(1,n+1)), repeat=3):
    x,y,z = v[0], v[1], v[2]
    a = x*x + y*y + z*z + x*y + y*z + z*x
    if a <= n:ans[a-1] += 1
    else: continue
for i in ans: print(i)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

res = [0] * (n+1)
x = 1
while x*x <= n:
  y = 1
  while y*y <= n:
    z = 1
    while z <= n:
      w = x*x+y*y+z*z+x*y+y*z+z*x
      if w <= n:
        res[w] += 1
      z += 1
    y += 1
  x+= 1
  
for i in range(1,n+1):
  print(res[i])

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
for i in range(1,n+1):
    k=int(i**0.5)+1
    a=0
    for x in range(1,k):
        for y in range(1,k):
            for z in range(1,k):
                if (x+y)**2+(y+z)**2+(z+x)**2==2*i:
                    #print(i,x,y,z,end=' ')
                    a+=1
                if (x+y)**2+(y+z)**2+(z+x)**2>2*i:
                    break
    print(a)

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
count = 0

for i in range(1, num+1):
    for x in range(1, i):
        for y in range(1, i):
            for z in range(1, i):
                n = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if i == n:
                    count = count + 1
                elif i < n:
                    break
    print(count)
    count = 0

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
count = 0

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