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 math
n=int(input())

for p in range(1, n+1):
  right=math.floor(p*0.5)
  cnt=0
  for i in range(right):
    for j in range(i+1):
      for k in range(j+1):
        if i**2+j**2+k**2+i*j+j*k+k*i==p and i>0 and j>0 and k>0:
          if i==j and j==k:
            cnt+=1
          elif i==j and j!=k:
            cnt+=3
          elif j==k and k!=i:
            cnt+=3
          elif k==i and i!=j:
            cnt+=3
          elif i!=j and j!=k:
            cnt+=6
  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, i + 1):
        if x ** 2 >= i:
            break
        for y in range(1, i + 1):
            if y ** 2 >= i:
                break
        
            for z in range(1, i + 1):
                if z ** 2 == i:
                    break

                ans = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if ans > i:
                    break
                elif  ans == i:
                    cnt += 1

    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

L = [0] * (n + 1)
for x in range(1, n + 1):
    for y in range(1, n - x):
        for z in range(1, n - x - y):
            tmp = x * x + y * y + z * z + x * y + y * z + z * x
            if tmp <= n:
                L[tmp] += 1
            # print(x, y , z)

for l in L[1:]:
    print(l)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
count=[0]*N
for n in range(1,N+1):
  for x in range(1,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[n-1]+=1
for ans in count:
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

def f(x0,y0,z0):
  return x0**2 + y0**2 + z0**2 + x0*y0 + y0*z0 + z0*x0

n=int(input())

for i in range(1,n+1):
  c=0
  lim=int(math.sqrt(i))
  for x in range(1,lim+1):
    for y in range(1,lim+1):
      for z in range(1,lim+1):
        if f(x,y,z)==i:
          c+=1
  print(c)

Submission status: Time Limit Exceeded

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


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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
import itertools
for i in range(1,n+1):
    a=range(1,n)
    b=range(1,n)
    c=range(1,n)
    res=0
    for x,y,z in itertools.product(a,b,c):
        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 math as m
n = int(input())


for i in range(1,n+1):
    c = 0
    for x in range(1,m.ceil(m.sqrt(i))):
        for y in range(1,m.ceil(m.sqrt(i-x))):
            for z in range(1,m.ceil(m.sqrt(i-x-y))):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    c +=1 
    print(c)

Submission status: Time Limit Exceeded

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

for i in range(n):
    top = int(math.sqrt(i))
    count = 0
    for x in range(top-1):
        for y in range(x+1):
            for z in range(y+1):
                if (x+1)**2 + (y+1)**2 + (z+1)**2 + (x+1)*(y+1) + (y+1)*(z+1) + (z+1)*(x+1) == i+1:
                    if x+1 == y+1 and y+1 == z+1:
                        count += 1
                    elif x+1 != y+1 and y+1 != z+1 and z+1 != x+1:
                        count += 6
                    else:
                        count += 3
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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


if __name__ == '__main__':
    resolve()

Submission status: Time Limit Exceeded

Solution code:
import itertools

def f(n):
  m = int(n**0.5)
  out = sum([True for x, y, z in itertools.product(range(1, m+1), repeat=3) if x**2+y**2+z**2+x*y+y*z+z*x==n])
  return out

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

Submission status: Time Limit Exceeded

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

# In[2]:


import math


# In[19]:


N = int(input())


# In[20]:


for i in range(1,N+1):
#     print("f(%s)"%i)
    ans = 0
    for x in range(1,int(math.sqrt(i))+1):
        if i - x**2 - x > 0:
            for y in range(1,int(math.sqrt(i-x**2-x))+1):
                if i - x**2 - x - y**2 - y - x*y > 0:
                    for z in range(1,int(math.sqrt(i-x**2-x-y**2-y-x*y)+1)):
                        if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
#                             print(x,y,z)
                            ans += 1
    print(ans)


# In[ ]:

Submission status: Time Limit Exceeded

Solution code:
import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
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 ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N = INT()

C = Counter()
for x in range(1, N+1):
    y = z = x
    n = x**2 + y**2 + z**2 + x*y + y*z + z*x
    C[n] += 1
for x in range(1, N+1):
    for y in range(1, N+1):
        if x == y:
            continue
        z = y
        n = x**2 + y**2 + z**2 + x*y + y*z + z*x
        C[n] += 3

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

Submission status: Time Limit Exceeded

Solution code:
import itertools

def f(n):
  m = int(n**0.5)
  out = sum([True for x, y, z in itertools.product(range(1, n+1), repeat=3) if x**2+y**2+z**2+x*y+y*z+z*x==n])
  return out

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

for b in range(1,n+1):
    count = 0
    for x in range(1,n-1):
        for y in range(x,n-1):
            for z in range(y,n-1):
                a = x**2+y**2+z**2+x*y+y*z+z*x
                if a == b:
                    if x == y and y ==z:
                        count+=1
                    else:
                        count+=3

    print(count)

Submission status: Time Limit Exceeded

Solution code:
import math

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 + 1):
            if x * x + y * y + x * y >= i:
                continue
            a = i - (x * x + y * y + x * y)
            # z^2+z(x+y) - a = 0
            z = (-(x + y) + math.sqrt((x + y) ** 2 + 4 * a)) / 2
            if 1 <= z and z <= N and z.is_integer():
                cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())


def solve(n):
    ans = 0
    for x in range(1, 100 + 1):
        rest = n - x ** 2
        if rest < x + x + 2:
            break
        for y in range(1, 100 + 1):
            rest2 = rest - y ** 2 - x * y
            if rest2 < y + 1:
                break
            for z in range(1, 100 + 1):
                rest3 = rest2 - z ** 2 - y * z - z * x
                if rest3 < 0:
                    break
                if rest3 == 0:
                    ans += 1
    return ans


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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [0]*(10**5)
for i in range(1,1000):
    for j in range(1,1000):
        for  k in range(1,101):
            try:
                a[i*i+j*j+k*k+i*j+j*k+i*k]+=1
            except:
                continue
for i in range(1, n+1):
    print(a[i])

Submission status: Time Limit Exceeded

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


def main():
    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):
                    ans = x ** 2 + y ** 2 + z ** 2 + x*y + y*z + z*x
                    if ans == n:
                        cnt += 1
                    elif ans > n:
                        break
        # ---------
        print(cnt)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import collections
n = int(raw_input())
h = collections.Counter()
for x in range(1,n+1):
	for y in range(1,n+1):
		for z in range(1,n+1):
			q = x ** 2 + y ** 2 + z ** 2
			q += x*y + y*z + z * x
			if q > n:
				break
			h[q] +=1 
for i in range(1,n+1):
	print h[i]

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys
import math
sys.setrecursionlimit(500005)


def solve(N: int):
    for i in range(1,N+1):
        ri = math.ceil(math.sqrt(i))
        counter = 0
        for x in range(1,ri+1):
            for y in range(1,ri+1):
                for z in range(1,ri+1):
                    if (x*x+y*y+z*z+x*y+y*z+z*x == i):
                        counter += 1
        print(counter)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
count=[0]*N
for n in range(1,N+1):
  for x in range(1,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[n-1]+=1
for ans in count:
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')


def main():
    n = ri()
    for nn in range(1, n+1):
        s = int(nn**0.5) + 2
        cnt = 0
        for x in range(1, s):
            for y in range(1, s):
                r1 = x*x + y*y + x*y
                if r1 > nn:
                    break
                for z in range(1, s):
                    r = x*x + y*y + z*z + x*y + y*z + z*x
                    if r > nn:
                        break
                    if r == nn:
                        cnt += 1
        wi(cnt)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def ff(n):
    ans = 0
    for x in range(1,n):
        for y in range(1,n):
            for z in range(1,n):
                if x*x + y*y + z*z + x*y + y*z + z*x == n:
                    ans +=1
    return ans
for i in range(1, N+1):
    print(ff(i))

Submission status: Time Limit Exceeded

Solution code:
import math
import itertools
N = int(input())
A = list(itertools.product(range(1, int(math.sqrt(N)) + 1), repeat=3))

for i in range(1, N + 1):
    ans = 0
    for j in A:
        x, y, z = j
        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:
N=int(input())
for n in range(1,N+1):
    ans = 0
    for i in range(1,int((N**0.5)+1)):
        for j in range(i,int((N**0.5)+1)):
            for k in range(j,int((N**0.5)+1)):
                if i**2+j**2+k**2+i*j+j*k+k*i==n:
                    if i == j and j == k:
                        ans += 1
                    else:
                        ans += 3

    print(ans)

Submission status: Time Limit Exceeded

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

N = int(input())

for i in range(1,N+1):
    F = [(a,b,c) for a in range(1,N//6+1) for b in range(1,N//6+1) for c in range(1,N//6+1) if foo(a,b,c)==i]
    print(len(F))

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())

for i in range(N):
  n = i+1
  ans = 0
  mmax = int(math.sqrt(N)) + 1
  for x in range(1, mmax+1):
    for y in range(1, mmax+1):
      for z in range(1, mmax+1):
        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:
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


def f(m):
    ans = 0
    r_m = math.sqrt(m)
    for i in range(1, int(r_m) + 1):
        for j in range(1, int(r_m) + 1):
            for k in range(1, int(r_m) + 1):
                # print(
                # f'{(i, j, k)=}, {i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i}')
                if i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i == m:
                    ans += 1
    return ans


n = I()
for i in range(1, n + 1):
    # print(f'{i=}')
    print(f(i))

Submission status: Time Limit Exceeded

Solution code:
def f(x0,y0,z0):
  return x0**2 + y0**2 + z0**2 + x0*y0 + y0*z0 + z0*x0

n=int(input())

for i in range(1,n+1):
  c=0
  for x in range(1,i+1):
    for y in range(1,i+1):
      for z in range(1,i+1):
        if f(x,y,z)==i:
          c+=1
  print(c)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
for i in range(1,N+1):
    ans = 0
    for x in range(1,40):
        for y in range(1,40):
            for z in range(1,40):
                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:
n = int(input())

for i in range(1, n + 1):
    cnt = 0
    
    for x in range(1, i + 1):
        
        for y in range(1, i + 1):
        
            for z in range(1, i + 1):

                ans = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if ans > i:
                    break
                elif  ans == i:
                    cnt += 1

    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
M=int(N**0.5)+1

for i in range(1,1+N):
    ans=0
    for x in range(1,M):
        for y in range(1,x+1):
            if x**2+y**2+x*y<N:
                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 and y!=z and z!=x:
                            ans+=6
                        else:
                            ans+=3
    print(ans)

Submission status: Time Limit Exceeded

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


def solve():
    N = int(readline())

    anses = [0] * N

    for x in range(1, N):
        for y in range(1, N):
            for z in range(1, N):
                a = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if a > N:
                    break
                anses[a - 1] += 1
    
    for a in anses:
        print(a)

solve()

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import (
    accumulate, combinations, combinations_with_replacement, groupby,
    permutations, product)
from math import (
    acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians,
    sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits


def inp():
    return(int(input()))


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


def instr():
    s = input()
    return(list(s[:len(s)]))


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


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


def main():
    N = inp()
    for n in range(1, N+1):
        limit = int(sqrt(n)) + 1
        res = 0
        for x in range(1, limit+1):
            for y in range(1, limit+1):
                for z in range(1, limit+1):
                    if f(x, y, z) == n:
                        res += 1
        print(res)

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


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")

# endregion


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

    for x in range(1,101):
        if x**2>i:
            break
        for y in range(1,101):
            if x**2+y**2>i:
                break
            for z in range(1,101):
                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:
import math
from itertools import product

N = int(input())

for n in range(1, N + 1):
    count = 0
    for x, y, z in product(range(1, int(math.sqrt(N)) + 1), repeat=3):
        if x * x + y * y + z * z + x * y + y * z + z * x == n:
            count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
for i in range(1, n+1):
    ans = 0
    for x in range(1, n+1):
        x2 = x*x
        for y in range(1, n+1):
            y2 = y*y
            xy = x * y
            for z in range(1, n+1):
                if x2 + y2 + z*z + xy + y*z + z*x == i:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

for i in range(1, n + 1):
  cnt = 0
  for s in range(int(math.sqrt(n)) + 1 + 1):
    for x in range(1, s + 1):
      for y in range(1, s - x + 1):
        z = s - x - y
        if 1 <= z:
          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

N = int(input())

A = [0]*10001
for i in range(10001):
    A[i] = math.floor(math.sqrt(i))

n,nn,nnn,nnnn = 0,0,0,0
for n in range(1,N+1):
    ans = 0
    for x in range(1,A[n]+1):
        nn = n - x * x
        for y in range(1,A[nn]+1):
            nnn = nn - y * y - y * x
            if nnn <= 0:
                break
            for z in range(1,A[nnn]+1):
                nnnn = nnn - z * z - z * x - z * y
                if nnnn < 0:
                    break
                elif nnnn == 0:
                    ans += 1
                    break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import itertools

def f(n):
  out = sum([True for x, y, z in itertools.product(range(1, n+1), repeat=3) if x**2+y**2+z**2+x*y+y*z+z*x==n])
  return out

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

Submission status: Time Limit Exceeded

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
for i in range(1, N+1):
    heihoukon = math.floor(math.sqrt(i))
    tmp = 0
    for x in range(1, heihoukon):
        for y in range(1, heihoukon):
            for z in range(1, heihoukon):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    tmp += 1
    print(tmp)

Submission status: Time Limit Exceeded

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')


def main():
    n = ri()
    for nn in range(1, n+1):
        s = int(nn**0.5) + 2
        cnt = 0
        for x in range(1, s):
            for y in range(1, s):
                if x*x + y*y + x*y > nn:
                    continue
                for z in range(1, s):
                    r = x*x + y*y + z*z + x*y + y*z + z*x
                    if r > nn:
                        break
                    if r == nn:
                        cnt += 1
        wi(cnt)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for n in range(1, N+1):
    ans = 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):
                v = x**2+y**2+z**2+x*y+y*z+z*x
                if v>n:
                    continue
                elif v==n:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
for i in range(n):
    ans = 0
    for x in range(1,int(math.sqrt(n))):
        for y in range(1,int(math.sqrt(n))):
            for z in range(1,int(math.sqrt(n))):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i+1:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())
for i in range(1,N+1):
  ans = 0
  for x in range(1,int(math.sqrt(i))):
    for y in range(1,int(math.sqrt(i))):
      for z in range(1,int(math.sqrt(i))):
        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:
import math
n=int(input())
for i in range(1,n+1):
    p=int(math.sqrt(i))
    k=0
    for x in range(1,p+1):
        for y in range(x,p+1):
            for z in range(y,p+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==i:
                    s=len(set([x,y,z]))
                    if s==1:
                        k+=1
                    if s==2:
                        k+=3
                    if s==3:
                        k+=6
    print(k)

Submission status: Time Limit Exceeded

Solution code:
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
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:
N = int(input())


def f(n):
    res = 0
    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 tmp == n:
                    res += 1
                elif tmp > n:
                    break
    return res


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

Submission status: Time Limit Exceeded

Solution code:
# C

from math import ceil
N=int(input())

for i in range(1,N+1):
    ans=0
    p=ceil(i**0.5+1)
    for x in range(1,p+1):
        for y in range(1,p+1):
            for z in range(1,p+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==i:
                    ans +=1
                    #print(x,y,z)
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
n=int(input())
for i in range(1,n+1):
    p=int(math.sqrt(i))
    k=0
    for x in range(1,p+1):
        for y in range(1,p+1):
            for z in range(1,p+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==i:
                    k+=1
    print(k)

Submission status: Time Limit Exceeded

Solution code:
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
    # combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
# mod = 998244353
INF = 1<<50

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

def main():
    n = int(input())
    for i in range(1,n+1):
        ans = 0
        for j in range(1,int(i**0.5+1)):
            for k in range(1,int(i**0.5+1)):
                for l in range(1,int(i**0.5+1)):
                    if j**2+k**2+l**2+j*k+k*l+j*l==i:
                        ans += 1
        print(ans)
    return

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
for i in range(1,N+1):
  ans = 0
  for x in range(1,i):
    for y in range(1,i):
      for z in range(1,i):
        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 ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
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(1, m):
            for k in range(1, m):
                if i**2 + j**2 + k**2 + i*j + j*k + k*i == x:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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