Problem:


Score : 300 points

Problem Statement

Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:

1 \leq x,y,z

x^2 + y^2 + z^2 + xy + yz + zx = n

Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).

Constraints

All values in input are integers.

1 \leq N \leq 10^4

Input

Input is given from Standard Input in the following format:

N

Output

Print N lines. The i-th line should contain the value f(i).

Sample Input 1

20

Sample Output 1

0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0

For n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.

For n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.

For n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.

For n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.



Sample input:
20


Sample output:
0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import itertools
# num = []
# for e in sys.stdin:
#     num.append(map(int, e.split()))

N = int(input())





for n in range(1, N+1):
    count = 0;
    max = min(int(math.sqrt(n)), int(n/2))
    l = []
    for i in range(1, max+1):
        l.append(i)
    h = itertools.combinations_with_replacement(l, 3)

    for i,j,k in h:
        if n == i**2 + j**2 + k**2 + i*j + j*k + k*i:
            if(i==j==k):
                count+=1
            elif(i==j or j==k or i == k):
                count+=3
            else:
                count+=6
    print(count)
    # for i in range(1, max+1):
    #     for j in range(1, max+1):
    #         for k in range(1, max+1):
    #             num = i**2 + j**2 + k**2 + i*j + j*k + k*i
    #             if n == num:
    #                 count+=1
    # print(count)


    # print(max)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
# num = []
# for e in sys.stdin:
#     num.append(map(int, e.split()))

N = int(input())


for n in range(1, N+1):
    count = 0;
    max = min(int(math.sqrt(n)), int(n/2))
    if n>3:
        max = int(math.sqrt(n-2)-1)

    for i in range(1, max+1):
        for j in range(1, max+1):
            for k in range(1, max+1):
                num = i**2 + j**2 + k**2 + i*j + j*k + k*i
                if n == num:
                    count+=1
    print(count)


    # print(max)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
# num = []
# for e in sys.stdin:
#     num.append(map(int, e.split()))

N = int(input())


for n in range(1, N+1):
    count = 0;
    max = min(int(math.sqrt(n)), int(n/2))
    for i in range(1, max+1):
        for j in range(1, max+1):
            for k in range(1, max+1):
                num = i**2 + j**2 + k**2 + i*j + j*k + k*i
                if n == num:
                    count+=1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys,math
#DEBUG=True
DEBUG=False
if DEBUG:
    f=open("202007_2nd/C_input.txt")
else:
    f=sys.stdin
# Find the number of triples of integers (x,y,z) such that
# (x+y)**2 + (y+z)**2 + (x+z)**2 = 2*N
N=int(f.readline().strip())
for _ in range(N):
    A=(_+1)*2
    I=int(math.sqrt(A/3))
    cnt=0
    for __ in range(I):
        for ___ in range(I-__):
            for ____ in range(I-__-___):
                if ((__+___+2)**2)+((___+____+2)**2)+((__+____+2)**2)==A:
                    cnt+=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys,math
#DEBUG=True
DEBUG=False
if DEBUG:
    f=open("202007_2nd/C_input.txt")
else:
    f=sys.stdin
# Find the number of triples of integers (x,y,z) such that
# (x+y)**2 + (y+z)**2 + (x+z)**2 = 2*N
N=int(f.readline().strip())
for _ in range(N):
    A=(_+1)*2
    I=int(math.sqrt(A/3))
    cnt=0
    for __ in range(I):
        for ___ in range(I):
            for ____ in range(I):
                if ((__+___+2)**2)+((___+____+2)**2)+((__+____+2)**2)==A:
                    cnt+=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys,math
#DEBUG=True
DEBUG=False
if DEBUG:
    f=open("202007_2nd/C_input.txt")
else:
    f=sys.stdin
# Find the number of triples of integers (x,y,z) such that
# (x+y)**2 + (y+z)**2 + (x+z)**2 = 2*N
N=int(f.readline().strip())
for _ in range(N):
    A=(_+1)*2
    I=int(math.sqrt(A))
    cnt=0
    for __ in range(I):
        for ___ in range(I):
            for ____ in range(I):
                if ((__+___+2)**2)+((___+____+2)**2)+((__+____+2)**2)==A:
                    cnt+=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

x,y,z = 1,1,1

def is_true(x,y,z,i):
    if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
        return True
    return False

loop = int(N ** (1/2))
for i in range(1,N+1):
    count = 0

    if i < 6:
        print(count)
        continue
    for a in range(loop):
        for b in range(loop):
            for c in range(loop):
                X = x+a
                Y = y+b
                Z = z+c
                if is_true(X,Y,Z,i):
                    count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import functools

N = int(input())


@functools.lru_cache()
def is_ok(x, y, z, n):
    return int(x * x + y * y + z * z + x * y + y * z + z * x == n)


for i in range(1, N + 1):
    count = 0
    for x in range(1, i + 1):
        for y in range(1, i + 1):
            for z in range(1, i + 1):
                count += is_ok(*sorted((x, y, z)), i)
    print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
l = [-1]*N
def triplets(n):
  counter = 0
  lower = 1
  upper = round(n**0.5-1)
  for x in range(1, upper+1):
    y_upper = round(0.5*((4*n-3*x**2)**0.5-x))
    for y in range(1, y_upper+1):
      root = (4*n-3*x**2-3*y**2-2*x*y)**0.5
      z = 0.5*(root-x-y)
      if z%1==0 and z>0:
        counter += 1
  return counter
for m in range(1, N+1):
  if l[m-1] == -1:
    tmp = triplets(m)
    l[m-1] = tmp
    if tmp != 0:
      for k in range(2,round((N/m)**0.5)):
        l[m*k**2-1] = tmp
for x in l:
  print(x)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def triplets(n):
  counter = 0
  lower = 1
  upper = round(n**0.5)
  for x in range(1, upper+1):
    y_upper = round(0.5*((4*n-3*x**2)**0.5-x))
    for y in range(1, y_upper+1):
      root = (4*n-3*x**2-3*y**2-2*x*y)**0.5
      z = 0.5*(root-x-y)
      if z%1==0 and z>0:
        counter += 1
  return counter
for m in range(1, N+1):
  print(triplets(m))

Submission status: Time Limit Exceeded

Solution code:
def triplets_brute(n):
    counter = 0
    upper = round(n**0.5)
    for x in range(1, upper+1):
        for y in range(1, upper+1):
            for z in range(1, upper+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==n:
                    counter += 1
    return counter
for m in range(1, int(input())+1):
	print(triplets_brute(m))

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
 
ans = [0]*(n+1)
for i in range(1,n+1):
	for x in range(1,100):
		for y in range(1,100):
			if pow(x+y,2) - 4*(pow(x,2) + x*y +pow(y,2) - i) >= 0:
				p = (1/2)*(-(x+y) + math.sqrt(pow(x+y,2) - 4*(pow(x,2) +x*y +pow(y,2) - i)))
				q = (1/2)*(-(x+y) - math.sqrt(pow(x+y,2) - 4*(pow(x,2) +x*y +pow(y,2) - i)))
				if (p%1 == 0 and p >= 1) or (q%1 == 0 and q >= 1):
					ans[i] += 1
for i in range(1,n+1):
	print(ans[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [0] * N
for i in range(1, N):
    for j in range (1, N):
        for k in range (1, N):
            n = i**2 + j**2 + k**2 + (i*j) + (j*k) + (k*i)
            if n <= N:
                A[n - 1] = A[n - 1] + 1

for a in A:
    print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [0] * N
for i in range(1, N+1):
    for j in range (1, N+1):
        for k in range (1, N+1):
            n = i**2 + j**2 + k**2 + (i*j) + (j*k) + (k*i)
            if n <= N:
                A[n - 1] = A[n - 1] + 1

for a in A:
    print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [0] * (N)
for i in range(1, N+1):
    for j in range (1, N+1):
        for k in range (1, N+1):
            n = i**2 + j**2 + k**2 + (i*j) + (j*k) + (k*i)
            if n <= N:
                A[n - 1] = A[n - 1] + 1

for a in A:
    print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

for n in range(1,N+1):
    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+z*x==n:
                    count=count+1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
max_number = int(input())
list_numbers = [i+1 for i in range(max_number)]
count = 0
for i in list_numbers:
  count = 0
  for x in range(1,100):
    for y in range(1,100):
      for z in range(1,100):
        tot = x**2 + y**2 + z**2 + x * y + y * z + z * x
        if (tot == i):
          count += 1
  print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(1, n + 1):
    ans = 0
    lim = int(math.sqrt(i))
    for x in range(1, lim):
        for y in range(x, lim):
            for z in range(y, lim):
                zzz = (x + y + z) ** 2 - x * y - y * z - x * z
                if zzz == i and i == 6:
                    ans += 1
                elif zzz == i:
                    ans += 3
    if 1 <= i <= 20:
        print(ans)

Submission status: Time Limit Exceeded

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

n=math.floor(math.sqrt(N))

for n in range(1,N+1):
    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
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=list(0 for i 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 n < i*i+j*j+k*k+i*j+j*k+i*k:
        break;
      l[(i*i+j*j+k*k+i*j+j*k+i*k)-1]+=1
      #print(i*i+j*j+k*k+i*j+j*k+i*k)

for i in l:
  print(i)

Submission status: Time Limit Exceeded

Solution code:
"""
    Satwik_Tiwari ;) .
    12th july , 2020  - Sunday
"""

#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function

from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase

from itertools import *
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter  # Counter(list)  return a dict with {key: count}
from itertools import combinations as comb # if a = [1,2,3] then print(list(comb(a,2))) -----> [(1, 2), (1, 3), (2, 3)]
from itertools import permutations as permutate
from bisect import bisect_left as bl
#If the element is already present in the list,
# the left most position where element has to be inserted is returned.
from bisect import bisect_right as br
from bisect import bisect
#If the element is already present in the list,
# the right most position where element has to be inserted is returned

#==============================================================================================

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)

# inp = lambda: sys.stdin.readline().rstrip("\r\n")

#===============================================================================================
#some shortcuts

mod = 1000000007
def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input
def out(var): sys.stdout.write(str(var))  #for fast output, always take string
def lis(): return list(map(int, inp().split()))
def stringlis(): return list(map(str, inp().split()))
def sep(): return map(int, inp().split())
def strsep(): return map(str, inp().split())
# def graph(vertex): return [[] for i in range(0,vertex+1)]
def zerolist(n): return [0]*n
def nextline(): out("\n")  #as stdout.write always print sring.
def testcase(t):
    for p in range(t):
        solve()
def printlist(a) :
    for p in range(0,len(a)):
        out(str(a[p]) + ' ')
def lcm(a,b): return (a*b)//gcd(a,b)
def power(a,b):
    ans = 1
    while(b>0):
        if(b%2==1):
            ans*=a
        a*=a
        b//=2
    return ans
def ncr(n,r): return factorial(n)//(factorial(r)*factorial(max(n-r,1)))
def isPrime(n) : # Check Prime Number or not
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True

#===============================================================================================
# code here ;))
def f(x,y,z):
    return ((x**2)+(y**2)+(z**2)+(x*y)+(x*z)+(y*z))

def solve():
    n = int(inp())
    # print(arr[1:21])

    arr = [0]*(n+1+1)
    for i in range(1,n+1):
        for j in range(1,n+1):
            for k in range(1,n+1):
                # print(f(i,j,k))
                if(f(i,j,k) <= n):
                    arr[f(i,j,k)] +=1
                else:
                    break
    for i in range(n):
        print(arr[i+1])

testcase(1)
# testcase(int(inp()))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
import math
import numpy as np

def  XYZTriplets():

    num = int(input())
    
    list_num = []
    
    count = [0]*num
    
    for i in range(1, num+1):
        list_num.append(i)

    for x in range(1, int(math.sqrt(num))):
        for y in range(1, int(math.sqrt(num))):
            for z in range(1, int(math.sqrt(num))):
                
                function = list(np.array([0.5*( (x+y)*(x+y) + (y+z)*(y+z) + (z+x)*(z+x) )]*len(list_num)) - np.array(list_num))
                
                for i in range(1, num+1):
                    if function[i-1] == 0:
                        count[i-1] = count[i-1] + 1
 
    for i in range(0, num):
        print(count[i])
        

if __name__ == '__main__':
    XYZTriplets()

Submission status: Time Limit Exceeded

Solution code:
import math

def  XYZTriplets():

    num = int(input())
    
    for i in range(1, num+1):
        count = 0

        x = 1
        y = 1
        z = 1

        for x in range(1, 105):
            for y in range(1, 105):
                for z in range(1, 105):
            
                    function = 0.5*( (x+y)*(x+y) + (y+z)*(y+z) + (z+x)*(z+x) ) - i
                                
                    if function == 0:
                        count = count + 1
                        
                    
        print(count)
        

if __name__ == '__main__':
    XYZTriplets()

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
if N <= 5:
    for i in range(N):
        print(0)
else:
    for i in range(5):
        print(0)
    for n in range(6,N+1):
        ans = 0
        for q in range(2,int(math.sqrt(n-2))+1):
            for r in range(2,q+1):
                if (q+r)%2 ==0:
                    for p in range(-(-q//2),(q+r)//2):
                        if (2*p)**2+q**2+r**2==2*n:
                            if 2*p==r:
                                ans += 1
                            elif 2*p==q or q==r:
                                ans += 3
                            else:
                                ans += 6
                            break
                else:
                    for p in range(-((-q+1)//2),(q+r-3)//2+1):
                        if (2*p+1)**2+q**2+r**2==2*n:
                            if 2*p+1==r:
                                ans += 1
                            elif 2*p+1==q or q==r:
                                ans += 3
                            else:
                                ans += 6
                            break
        print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
if N <= 5:
    for i in range(N):
        print(0)
else:
    for i in range(5):
        print(0)
    for n in range(6,N+1):
        ans = 0
        for q in range(2,int(math.sqrt(n-2))+1):
            for r in range(2,q+1):
                for p in range(q,q+r-1):
                    if p**2+q**2+r**2==2*n:
                        if p==r:
                            ans += 1
                        elif p==q or q==r:
                            ans += 3
                        else:
                            ans += 6
                        break
        print(ans)

Submission status: Time Limit Exceeded

Solution code:
num_limit = int(input())
for i in range(1,num_limit+1):
    xyz_count = 0
    j_limit = int(i ** 0.5)
    for j in range(1,j_limit+1):
        for k in range(1,j + 1):
            if i <= j**2 + k**2 + j*k + j + k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k > l:
                        xyz_count += 3
                    else:
                        xyz_count += 1
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = int(n**0.5+1)
for i in range(1, n+1):
    ans = 0
    for x in range(1, a):
        for y in range(x, a):
            for z in range(y, a):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i and x == y == z:
                    ans += 1
                elif x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    ans += 3
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
num_limit = int(input())
for i in range(1,num_limit+1):
    xyz_count = 0
    j_limit = int(i ** 0.5)
    for j in range(1,j_limit+1):
        for k in range(1,j + 1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k > l:
                        xyz_count += 3
                    else:
                        xyz_count += 1
    print(xyz_count)

Submission status: Time Limit Exceeded

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


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


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

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
num_limit = int(input())
for i in range(1,num_limit+1):
    xyz_count = 0
    j_limit = int(i ** 0.5)
    for j in range(1,j_limit+1):
        if i <= j**2:
            break
        for k in range(1,j + 1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k > l:
                        xyz_count += 3
                    else:
                        xyz_count += 1
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_count = 0
    s_limit = int(i ** 0.5)
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k > l:
                        xyz_count += 3
                    else:
                        xyz_count += 1
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_count = 0
    s_limit = int(i ** 0.5)
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k == l:
                        xyz_count += 1
                    else:
                        xyz_count += 3
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_count = 0
    s_limit = int(i ** 0.5)
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k == l:
                        xyz_count += 1
                    else:
                        xyz_count += 3
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit = int(i ** 0.5)
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k == l:
                        xyz_count += 1
                    else:
                        xyz_count += 3
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    n = int(input().rstrip())
    ans = [0 for _ in range(n)]
    for x in range(1, n):
        for y in range(x, n):
            for z in range(y, n):
                tmp = pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x
                log(tmp)
                if tmp > n:
                    break
                if x == y == z:
                    ans[tmp - 1] = 1
                elif x == y or y == z or z == x:
                    ans[tmp - 1] = 3
                else:
                    ans[tmp - 1] = 6
    for v in ans:
        print(v)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit_1 = int(i ** 0.5)
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k == l:
                        xyz_count += 1
                    else:
                        xyz_count += 3
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit_1 = int(i ** 0.5)
    j = 0
    k = 0
    l = 0
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k == l:
                        xyz_count += 1
                    else:
                        xyz_count += 3
    print(xyz_count)

Submission status: Time Limit Exceeded

Solution code:
import math
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit_1 = int(i ** 0.5)
    j = 0
    k = 0
    l = 0
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif j == k:
                        if k == l:
                            xyz_count += 1
                        else:
                            xyz_count += 3
    print(xyz_count)