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:
"""
// Author : snape_here - Susanta Mukherjee
     
 """
 
from __future__ import division, print_function
 
import os,sys
from io import BytesIO, IOBase
 
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
 
def ii(): return int(input())
def fi(): return float(input())
def si(): return input()
def msi(): return map(str,input().split())
def mi(): return map(int,input().split())
def li(): return list(mi())
 
 
def read():
    sys.stdin = open('input.txt', 'r')  
    sys.stdout = open('output.txt', 'w') 
 
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

mod=1000000007

from math import log,sqrt,factorial,cos,tan,sin,radians,ceil,floor

import bisect

from decimal import *

getcontext().prec = 25

abc="abcdefghijklmnopqrstuvwxyz"

pi=3.141592653589793238


def main():

    n=ii()
    for i in range(1,n+1):
        a=int(ceil(sqrt(i)))
        b=a*a-i 
        f=0
        g=0
        #print(a,b)
        for j in range(1,a+1):
            for k in range(1,a+1):
                for l in range(1,a+1):
                    if j+k+l==a and j==k==l and j*k+k*l+j*l==b:
                        g=1
                        continue
                    if j+k+l==a and j*k+k*l+j*l==b:
                        f=1 
                        break 
        if f:
            print(3)
        else:
            if g:
                print(1)
            else:
                print(0)


# region fastio
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
 
 
if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
 
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
 
if __name__ == "__main__":
    #read()
    main()

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**0.5)):
        for y in range(1,N-x**2+1):
            if x**2+y**2+x*y>=i:break
            for z in range(1,N-(x**2+y**2+x*y)+1):
                if x**2+y**2+z**2+x*y+y*z+x*z==i:count+=1
                if x**2+y**2+z**2+x*y+y*z+x*z>i:break
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input(''))
for i in range(n):
    s=0
    p=0
    for a in range(100):
        x=a+1
        p=p+x**2
        if p<i+1:
            for b in range(100):
                y=b+1
                p=p+y**2+x*y
                if p<i+1:
                    for c in range(100):
                        z=c+1
                        p=p+z**2+y*z+x*z
                        if p==i+1:
                            s=s+1
                        elif p>i+1:
                            p=p-z**2-y*z-x*z
                            break    
                        p=p-z**2-y*z-x*z
                p=p-y**2-x*y
        p=p-x**2
    
    print(s)

Submission status: Time Limit Exceeded

Solution code:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

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

def solv_quadratic_equation(a, b, c):
    """ 2次方程式を解く  """
    D = (b**2 - 4*a*c)
    
    if D<0:
        return None,None
    D = D ** (1/2)
    x_1 = (-b + D) / (2 * a)
    x_2 = (-b - D) / (2 * a)

    return x_1, x_2

N=one_int()

def solve(n):
    ret = []
    X=int(n**(1/2) +0.5)+1
    Y=int(n**(1/2) +0.5)+1 
    Z=int(n**(1/2) +0.5)+1
    for x in range(1,X):
        for y in range(1,Y):
            ans1, ans2 = solv_quadratic_equation(1, y+x, x**2 + y**2 + x*y -n)
            if ans1 is None:
                continue
                
            if ans1>0:
                z=int(ans1+0.5)
                if (x**2 + y**2 + z**2 + y*z + x*y + z*x)==n:
                    ret.append((x,y,z))
            if ans2>0:
                z=int(ans2+0.5)
                if (x**2 + y**2 + z**2 + y*z + x*y + z*x)==n:
                    ret.append((x,y,z))
#             ret.append((x,y,ans2))
            
#             for z in range(1,Z):
#                 if (x**2 + y**2 + z**2 + y*z + x*y + z*x)==n:
#                     ret.append((x,y,z))
    return len(set(ret))

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

Submission status: Time Limit Exceeded

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

N = int(input())

F = []
for i in range(1,N//6+1):
    for j in range(1,N//6+1):
        for k in range(1,N//6+1):
            X = foo(i,j,k)
            F.append(X)

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def ff(n):
    ans = 0
    for x in range(1,int(-(-n**0.5//1))+1):
        for y in range(1,x+1):
            for z in range(1, y+1):
                if x*x + y*y + z*z + x*y + y*z + z*x == n:
                    if x == y and y == z and z == x:
                        ans +=1
                    elif x == y or y == z or z == x:
                        ans += 3
                    else:
                        ans += 6
    return ans
for i in range(1, N+1):
    if i <6:
        print(0)
    else:
        print(ff(i))

Submission status: Time Limit Exceeded

Solution code:
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):
            for z in range(1,int(n**0.5)+1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    count[i-1] += 1
for i in range(n):
    print(count[i])

Submission status: Time Limit Exceeded

Solution code:
#-*-coding:utf-8-*-

import sys

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

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

def get_score(x, y, z):
  if x == y and y == z:
    score = 1
  elif x == y or y == z or  z == x:
    score = 3
  else:
    score = 6
  return score

for n in range(1, N+1):
  ans = 0
  for i in range(1, int(n/2)):
    if i**2 <= n:
      for j in range(i, int(n/2)):
        for k in range(j, int(n/2)):
          if eq(i, j, k) == n:
            ans += get_score(i, j, k)
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
for i in range(1, n + 1):
    ans = 0
    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                p = x**2 + y**2 + z**2 + x * y + y * z + z * x
                if p > n:
                    break
                if p == i:
                    ans += 1
    print(ans, flush=False)

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())

limit = int(math.sqrt(N))+1

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    n=int(input())
    for i in range(n):
        i+=1
        cnt=0
        x=1
        y=1
        z=1
        while x<=i:
            while y<=i:
                while z<=i:
                    v=x**2+y**2+z**2+x*y+y*z+x*z
                    if v < i:
                        z+=1
                        continue
                    elif v == i:
                        cnt+=1
                        break
                    else:
                        break
                y+=1
                z=1
            x+=1
            y=1
            z=1
        print(cnt)
    return

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
A = 10
for n in range(1, N+1):
    num = 0
    for i in range(1, A):
        for j in range(1, A):
            for k in range(1, A):
                if math.pow(i + j + k, 2) == (i * j + j * k + k * i) + n:
                    num += 1
    print(num)

Submission status: Time Limit Exceeded

Solution code:
from math import *
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
for x in range(1,n+1):
    ans = 0
    m = ceil(sqrt(x))+1
    for i in range(1, m):
        for j in range(i, m):
            for k in range(j, m):
                if i**2 + j**2 + k**2 + i*j + j*k + k*i == x:
                    if i == j == k:
                        ans += 1
                    elif i == j or j == k or k == i:
                        ans += 3
                    else:
                        ans += 6
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
#C - XYZ Triplets
N = int(input())
ans = 0
for l in range(N):
    ans = 0
    for i in range(int((l+1)**0.5)):
        for j in range(int((l+1)**0.5)):
            for k in range(int((l+1)**0.5)):
                if (i+1)**2 + (j+1)**2 + (k+1)**2 +(i+1)*(j+1)+(j+1)*(k+1)+(k+1)*(i+1)== l+1:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


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

    range_x = int((i-5)**0.5)+1 if i-5 >0 else 0
    for x in range(1, range_x):
        range_y = int((i-x**2-x-3)**0.5)+1 if i-x**2-x-3 > 0 else 0
        for y in range(1, range_y):
            range_z = int((i-x**2-y**2-x*y-x-y)**0.5)+1 if i-x**2-y**2-x*y-x-y > 0 else 0
            for z in range(1, range_z):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    sum += 1
    print(sum)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def F(n):
    ans = 0
    if n < 6:
        return 0
    else:
        for x in range(1,int((n-2)**0.5)+1):
            for y in range(1,int((n-2)**0.5)+1):
                for z in range(1,int((n-2)**0.5)+1):
                    if (x+y+z)**2-(x*y+y*z+z*x) == n:
                        ans +=1
        return ans

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def f(n):
    total = 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 == n:
                    total += 1
    return total

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

Submission status: Time Limit Exceeded

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

from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


N = int(input())


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


# for x in range(1, 20):
#     for y in range(1, 20):
#         for z in range(1, 20):
#             print(g(x, y, z))

for n in range(1, N+1):
    num_dict = {}
    res = 0
    flag = False
    for x in range(1, 30):
        for y in range(1, 30):
            for z in range(1, 30):
                num = g(x, y, z)
                if num > n:
                    # print('break')
                    break
                if num == n:
                    # print(f'{x}+{y}+{z}={num}')
                    if (x, y, z) in num_dict:
                        continue
                    # print('doesnt exist')
                    num_dict[(x, y, z)] = 1
                    res += 1
    print(res)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
def f(n):
  cnt = 0
  for i in range(int(n**1/2 // 1)):
    for j in range(int(n**1/2 // 1)):
      for k in range(int(n**1/2 // 1)):
        if (i+1)**2 + (j+1)**2 + (k+1)**2 + (i+1)*(j+1) + (j+1)*(k+1) + (k+1)*(i+1) == n:
          cnt += 1
  return cnt
      
  
N = int(input())
for i in range(N):
  print(f(i+1))

Submission status: Time Limit Exceeded

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

N = int(input())

def f(n):
	ans = 0
	for x in range(1, 1+ceil(r(c))):
		for y in range(1, 1+ceil(r(c))):
			for z in range(1, 1+ceil(r(c))):
				if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
					ans += 1
	print(ans)

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

Submission status: Time Limit Exceeded

Solution code:
import math



N=int(input())

for i in range(1,N+1):
    ans=0
    if i<=5:
        print(0)
    else:
        ma=int(math.sqrt(i))
        for x in range(1,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:
                        if x==y and y==z:
                            ans+=1
                        elif x==y or y==z or z==x:
                            ans+=3
                        else:
                            ans+=6
            
        print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())

for i in range(1, N+1):
    count = 0
    for x in range(1, int(math.sqrt(N))+1):
        for y in range(1, int(math.sqrt(N))+1):
            tmp = 4*i - 3*x*x - 3*y*y - 2*x*y
            if tmp > 0:
                z = (math.sqrt(tmp) - x - y)
                if z >= 2 and z%2==0 and z.is_integer() == True:
                    count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True

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

def main():
    N = I()
    ans = 1

    for n in range(1, N+1):
        flag = False
        for x in range(1, int(n ** 0.5)):
            for y in range(1, int(n ** 0.5)):
                for z in range(1, int(n ** 0.5)):
                    if f(x, y, z) == n:
                        flag = True
                        c = len(set([x, y, z]))
                        if c == 1:
                            print(1)
                        elif c == 2:
                            print(3)
                        else:
                            print(6)
                        # print(n, x, y, z, c)
                if flag:
                    break
            if flag:
                break
        if flag == False:
            print(0)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys
import math


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    ans = 0

    for n in range(1, N+1):
        ans = 0
        for i in range(1, math.floor(n**(1/2))+1):
            for j in range(i,  math.floor(n**(1/2))+1):
                for k in range(j,  math.floor(n**(1/2))+1):
                    if (i**2 + j ** 2 + k ** 2 + i*j+j*k+k*i == n):
                        tmp = set([i, j, k])
                        if len(tmp) == 3:
                            ans += 6
                        if len(tmp) == 2:
                            ans += 3
                        if len(tmp) == 1:
                            ans += 1
        print(ans)


        # oj t -c "pypy3 main.py"
        # acc s main.py -- --guess-python-interpreter pypy
main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

t = 1001

for i in range(1, N+1):
    cnt = 0
    for x in range(1, t):
        if N < (x**2 + x) : break 
        for y in range(1, t):
            if N < (x**2 + y**2 + x*y + y + x ) : break
            for z in range(1, t):
                if N < (x**2 + y**2 + z**2 + x*y + y*z + z*x ) : break    
                
                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:
n=int(input())
k=int((2*n)**0.5)+1
for i in range(1,n+1):
  l=2*i
  ans=0
  for x in range(1,k+1):
    for y in range(1,k-x+1):
      o=min(k-x,k-y)
      for z in range(1,o+1):
        f=(x+y)**2+(y+z)**2+(z+x)**2
        if f==l:
          ans+=1
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

a = [0]*n

for x in range(1, n):
    for y in range(1, x+1):
        for z in range(1, y+1):
            t = x**2+y**2+z**2+x*y+y*z+z*x-1
            if t >= n:
                break
            if ((x==y)and(y!=z))or((x==z)and(y!=x))or((y==z)and(x!=z)):
                a[t] = 3
            elif (x!=y)and(y!=z)and(x!=z):
                a[t] = 6
            else:
                a[t] = 1

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

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

Submission status: Time Limit Exceeded

Solution code:
import math

if __name__ == '__main__':
    n = int(input().strip())


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


    counts = [len([0 for x in range(1, int(math.sqrt(i)) + 1) for y in
              range(1, int(math.sqrt(i)) + 1) for z in range(1, int(math.sqrt(i)) + 1) if f(x, y, z) == i])
              for i in range(1, n + 1)]
    print("\n".join(map(str, counts)))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()

    for i in range(1,N+1):
        if i < 3:
            print(0)
        else:
            ans = 0
            x_max = int(i**0.5)
            for x in range(1, x_max+1):
                for y in range(x, i-3):
                    for z in range(y, x_max+2):
                        if x*x+y*y+z*z+x*y+y*z+z*x == i:
                            setnum = len(set([x,y,z]))
                            if setnum == 1:
                                ans += 1
                            elif setnum == 2:
                                ans += 3
                            elif setnum == 3:
                                ans += 6
            
            print(ans)


if __name__ == "__main__":
	main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
M = N//5
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
    print(count)

Submission status: Time Limit Exceeded

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

N = I()
# combs = list(itertools.combinations_with_replacement(range(1,int(N**0.5)), 3))
combs = list(itertools.product(range(1,int(N**0.5)), repeat=3))

sum = []
for comb in combs:
    temp = comb[0]**2 + comb[1]**2 + comb[2]**2+ comb[0]*comb[1]+ comb[1]*comb[2] + comb[2]*comb[0]
    sum.append(temp)

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

Submission status: Time Limit Exceeded

Solution code:
#coding: UTF-8
import math
N = int(input())
#print(N)

for i in range(1,N+1):
  if i <=5:
    print(0)
    continue
  cnt = 0
  m = int(math.sqrt(i))
  #平方根までやればよい
  for x in range(1,m):
    for y in range(1,m):
      for z in range(1,m):
        a = (x+y+z)**2 -x*y -y*z - z*x
        if a == i:
          cnt += 1
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
for i in range(1, n+1):
    a = 0
    for x in range(1, 100):
        for y in range(x, int((10000-x**2)**(1/2))):
            for z in range(y, int((10000-x**2-y**2)**(1/2))):
                if x**2+y**2+z**2+x*y+y*z+z*x == i:
                    if x == y and y == z and z == y:
                        a += 1
                    elif x ==y or y == z or z == y:
                        a += 3
                    else:
                        a += 6
    print(a)

Submission status: Time Limit Exceeded

Solution code:
import math
def func(x,y,z):
    ans = x**2 + y**2 + z**2+ x*y + y*z + z*x
    #print("x={},y={},z={},ans={}".format(x,y,z,ans))
    return ans

N = int(input())
for n in range(1,N+1):
    root_n = round(math.sqrt(n+1))
    count = 0
    #dp = [[0] * root_n for i in root_n]
    for x in range(1,root_n):
        for y in range(1,root_n):
            for z in range(1,root_n):
                if func(x,y,z)==n:
                    count=count+1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

x = 1
y = 1
z = 1
a = 0
for i in range(1,N+1):
    while i >= x**2 + y**2 + z**2 + x*y + y*z + z*x:
        while i >= x**2 + y**2 + z**2 + x*y + y*z + z*x:
            while i >= x**2 + y**2 + z**2 + x*y + y*z + z*x:
                if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == i:
                    a += 1
                z += 1
            z = 1
            y += 1
        y = 1
        x += 1
    x = 1
    print(a)
    a = 0

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())

A = np.zeros(N)



for i in range(N):
   for j in range(N):
       for k in range(N):
           x = i + 1
           y = j + 1
           z = k + 1
           n = x**2 + y**2 + z**2 + x*y + y*z + z*x
           if N < n :
               continue
           else:
               A[n-1] += 1



for a in A:
    print(int(a))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

for i in range(n):
    j = i + 1
    x, y, z = 1, 1, 1
    out = 0
    while x**2 + y**2 + z**2 + x*y + y*z + z*x <= j:
        while x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x <= j:
            while x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x <= j:
                out += 1 if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == j else 0
                z += 1
            z = 1
            y += 1
        y, z = 1, 1
        x += 1
    print(out)

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    import sys
    sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
    to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
    print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

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

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

    MII = map_int_input

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

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

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

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

    LII = list_int_inputs

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

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

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

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

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

                # c = (n - (x * x + y * y + x * y)) / (x + y)
                # b = x + y
                # D = b ** 2 - 4 * c
                # if D >= 0:
                #     z1 = (-b + math.sqrt(D)) / 2
                #     z2 = (-b - math.sqrt(D)) / 2
                #     if z1.is_integer() and z1 >= 1:
                #         ans += 1
                #     if z2.is_integer() and z2 >= 1:
                #         ans += 1

        print(ans)
resolve()

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

for l in range(1, n + 1):
	end = int(math.sqrt(l)) + 1
	cnt = 0
	for i in range(1, end + 1):
		for j in range(1, end + 1):
			for k in range(1, end + 1):
				if (i + j + k) ** 2 == l + (i*j + j*k + k*i):
					cnt += 1
	print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

def get_score(x, y, z):
  if x == y and y == z:
    score = 1
  elif x == y or y == z or  z == x:
    score = 3
  else:
    score = 6
  return score

for n in range(1, N+1):
  ans = 0
  for i in range(1, int(n/2)):
    for j in range(i, int(n/2)):
      for k in range(j, int(n/2)):
        if eq(i, j, k) == n:
          ans += get_score(i, j, k)
  print(ans)