Problem:


Score : 300 points

Problem Statement

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

1 \leq x,y,z

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

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

Constraints

All values in input are integers.

1 \leq N \leq 10^4

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

20

Sample Output 1

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

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

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

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

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



Sample input:
20


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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
for i in range(1,n+1):    
    c=0
    x=0
    y=0
    z=0
    for x in range(1,n):
        if x**2+y**2+z**2+x*y+y*z+z*x>i:
            break
        for y in range(1,n):
            if x**2+y**2+z**2+x*y+y*z+z*x>i:
                y=0
                break
            for z in range(1,n):
                if x**2+y**2+z**2+x*y+y*z+z*x>i:
                    z=0
                    break
                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

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

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

if __name__ == "__main__":
  resolve()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def calc(num):
    cnt = 0
    for i in range(1, n-1):
        if i*i + i >= num: break
        for j in range(1, n-i):
            if i*i + j*j + i + j >= num: break
            for k in range(1, n-i-j+1):
                res = i*i + j*j + k*k + i*j + j*k + k*i
                if res == num:
                    cnt += 1
    return cnt

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

Submission status: Time Limit Exceeded

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


def f(n):
    m = int(math.sqrt(n)+0.5)
    res = 0
    for x in range(1, m+1):
        for y in range(1, m+1):
            for z in range(1, m+1):
                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:
n = []
for z in range(1, 100, 1):
    for y in range(1, 100, 1):
        for x in range(1, 100, 1):
            tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if x ** 2 + y ** 2 + z ** 2 > 10 ** 4:
                break
            else:
                n.append(tmp)
N = int(input())
for i in range(1, N+1, 1):
    print(n.count(i))

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

max_num = int(n**0.5)+1

for i in range(1,n+1):
  cnt=0
  for x in range(1,max_num+1):
    for y in range(1,max_num+1):
      nokori = i-x**2-y**2-x*y
      if nokori<1:
        break
      for z in range(1,nokori+1):
        if (x+y+z)*z == nokori:
          cnt+=1
        if (x+y+z)*z > nokori:
          break
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for i in range(1,N+1):
    ans = 0
    L = int(i**0.5)
    for x in range(1,L+1):
        for y in range(x,L+1):
            if (x*x+y*y+x*y)>i:
                break
            for z in range(y,L+1):
                num = x*x+y*y+z*z+x*y+y*z+z*x
                if num == 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:
N = int(input())

dp = [0 for _ in range(N+1)]
for x in range(1,N):
    if x * x > N:
        continue
    for y in range(1,N):
        if x * x + y * y + x * x > N:
            continue
        for z in range(1,N):
            t = x * x + y * y + z * z + x * y + y * z + z * x
            if t <= N:
                dp[t] += 1

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

Submission status: Time Limit Exceeded

Solution code:
from itertools import combinations_with_replacement

n = int(input())

calc = lambda x,y,z: x**2+y**2+z**2+x*y+y*z+z*x

def pattern(x,y,z):
   if x == y and y == z:
      return 1
   elif x == y or y == z or z == x:
      return 3
   elif x != y and y != z and z != x:
      return 6
   else:
      raise RuntimeError

def f(a):
   ans = 0
   nums = [i for i in range(1, a+1)]
   for x,y,z in combinations_with_replacement(nums, 3):
      if calc(x,y,z) == a:
         ans += pattern(x,y,z)
   return ans

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

Submission status: Time Limit Exceeded

Solution code:
def INT():
    return int(input())

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

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

N = INT()
ans = [0] * N

for n in range(1, N + 1):
    for x in range(1, 35):
        for y in range(1, 35):
            for z in range(1, 35):
                f = x**2 + y**2 + z**2 + x * y + y * z + z * x
                if f == n and f <= N:
                    ans[f - 1] += 1

for a in ans:
    print(a)

Submission status: Time Limit Exceeded

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


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, n):
            for j in range(i, n):
                for k in range(j, n):
                    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())
for n in range(1, N + 1):
    ans = 0
    for x in range(1, int(pow(n, 0.5))):
        for y in range(1, int(pow(n, 0.5))):
            for z in range(1, int(pow(n, 0.5))):
                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
n = int(input())
for i in range(1, n+1):
    ans = 0
    for x in range(1, int(math.sqrt(n+1))):
        x2 = x*x
        for y in range(1, int(math.sqrt(n+1))):
            y2 = y*y
            xy = x * y
            for z in range(1, int(math.sqrt(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 p in range(1, n+1):
  right=math.floor(p*0.5)+1
  cnt=0
  for i in range(1, right):
    for j in range(1, i+1):
      for k in range(1, 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())
ans=[0]*N
if N>=6:
    ans[5]=1
for i in range(1,N+1):
    for x in range(1,N+1):
        if x**2>i:
            break
        for y in range(1,N+1):
            if x**2+y**2>i:
                break
            for z in range(1,N+1):
                if x**2+y**2+z**2>i:
                    break
                if x**2+y**2+z**2+x*y+y*z+z*x==i and i!=6:
                    ans[i-1]=3
for i in ans:
    print(i)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import itertools
import math

N = int(input())
saidai = int(math.sqrt(N)) + 1

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

def f(n):
    count = 0
    for (x, y, z) in itertools.product("".join(map(str, (range(1, saidai + 1)))), repeat=3):
        if g(int(x), int(y), int(z)) == n:
            count += 1
    return count

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

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

Submission status: Time Limit Exceeded

Solution code:
from itertools import product
N = int(input())

list_N = list(range(1, int((N + 1)**0.5)))

list_xyz = list(product(list_N, repeat=3))

for n in range(1, N+1):
    ans = 0
    for x, y ,z in list_xyz:
        calc = x**2 + y**2 + z ** 2 + x*y + y*z + x * z
        if n == calc:
            ans += 1
    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, int(i**0.5)+1):
        for y in range(1,int(i**0.5)+1):
            if -2*x*y - (3 * x**2) - (3 * y**2) + 4*i >= 0:
                if (-(y + x) + (-2*x*y - (3 * x**2) - (3 * y**2) + 4*i)**0.5) % 2 == 0 and (-(y + x) + (-2*x*y - (3 * x**2) - (3 * y**2) + 4*i)**0.5) / 2 >= 1:
                    ans += 1
            else:
                break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return map(int, sys.stdin.readline().split())
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())


def FLIST(n):
    res = [1]
    for i in range(1, n+1):
        res.append(res[i-1]*i % DVSR)
    return res


N = II()

for i in range(1, N+1):
    cnt = 0
    current = i
    for x in range(1, math.floor(math.sqrt(i))+1):
        tmp1 = current - x*x
        if tmp1 > 0:
            for y in range(1, math.floor(math.sqrt(tmp1))+1):
                tmp2 = tmp1 - y*y - x*y
                if tmp2 > 0:
                    for z in range(1, math.floor(math.sqrt(tmp2))+1):
                        if tmp2 - z*z - y*z - z*x == 0:
                            # print(x, y, z)
                            cnt += 1
    print(cnt)

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**(1/2))+1):
        for y in range(1, int(n**(1/2))+1):
            c = x**2 + y**2 + x*y - n
            b = x+y
            if b**2 - 4*c >= 0:
                d = (-b+(b**2-4*c)**(1/2))/2
                if int(d) == d and d >= 1:
                    ans += 1
    print(ans)

Submission status: Time Limit Exceeded

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

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):
      if x+y > lim+1:
        break
      for z in range(1,lim+1):
        if x+y+z > lim+1:
          break
        if f(x,y,z)==i:
          c+=1
  print(c)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def calc(m):
    result = 0
    for i in range(1, 41):
        for j in range(1, 41):
            for k in range(1, 41):
                if i**2 + j**2 + k**2 + i*j + j*k + k*i == m:
                    result += 1

    print(result)

for p in range(1, n+1):
    calc(p)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())
ans = []
for x in range(1, math.ceil(n**(1/2))+1):
    for y in range(1, math.ceil(n**(1/2))+1):
        for z in range(1, math.ceil(n**(1/2))+1):
            ans.append(x**2 + y**2 + z**2 + x*y + y*z + z*x)
ans.sort()
for i in range(1, n+1):
    tmp = 0
    for x in ans:
        if x == i:
            tmp += 1
        elif x > i:
            print(tmp)
            break

Submission status: Time Limit Exceeded

Solution code:
import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

N = ii()
did = 1
while did != N+1:
    mark = math.ceil(sqrt(did))
    count = 0
    for x in range(1,mark):
        if x ** 2 >= N:
            break
        for y in range(1,mark):
            if x ** 2 + y ** 2 + x*y >= N:
                break
            for z in range(1,mark):
                if x ** 2 + y ** 2 + z ** 2 >= N:
                    break
                if x**2 + y ** 2 + z ** 2 + x*y + y*z + z*x == did:
                    count += 1
    print(count)
    did += 1

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def function (n):
    cnt = 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:
                    cnt += 1
    print(cnt)
for i in range(1,N+1):
    function(i)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
for i in range(1,n+1):
    count=0
    for x in range(1,i):
        for y in range(1,i-x):
            for z in range(1,i-x-y):
                if x*x+y*y+z*z+x*y+y*z+z*x==i:
                    count+=1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())
maxn = math.ceil(n**0.5)

for i in range(1, n+1, 1):
    maxn = math.ceil(i**0.5)
    cnt = 0
    for x in range(1, maxn+1):
        for y in range(x, maxn+1):
            for z in range(y, maxn+1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    if x == y and y == z:
                        cnt += 1
                    elif x != y and y != z:
                        cnt += 6
                    else:
                        cnt += 3
                else:
                    cnt += 0
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

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
                if x**2 + y**2 + z**2 + x*y + y*z + z*x > i:
                    break
    print(tmp)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
for i in range(1,n+1):
    cnt=0
    for x in range(1,10**2+1):
        for y in range(1,10**2+1):
            for z in range(1,10**2+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==i:cnt+=1
                elif x**2+y**2+z**2+x*y+y*z+z*x>i:break
    print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n =int(input())
for q in range(1,n+1):
    ans=0
    for x in range(1,int(n**0.5)+1):
        for y in range(1,int((n-x**2)**0.5)+1):
            for z in range(1,int((n-x**2-y**2)**0.5)+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==q:
                    ans+=1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def f(n):
    count=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:
                    count +=1
    print(count)
    
for i in range(1,N+1):
    f(i)

Submission status: Time Limit Exceeded

Solution code:
import math


def solve(n):
    cap = math.ceil(n**0.5) - 2
    return sum([((x + y + z)**2 - x * y - x * z - y * z) == n for x in range(1, cap + 1) for y in range(1, cap + 1) for z in range(1, cap + 1)])


n = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

dp = [0 for _ in range(N+1)]
for x in range(1,N):
    for y in range(1,N):
        for z in range(1,N):
            t = x * x + y * y + z * z + x * y + y * z + z * x
            if t <= N:
                dp[t] += 1

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

Submission status: Time Limit Exceeded

Solution code:
import math

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


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


    for i in range(1, n + 1):
        count = 0
        if not i < 6:
            limit = int(math.sqrt(i))
            for x in range(1, limit+1):
                for y in range(1, limit+1):
                    for z in range(1, limit+1):
                        if i == f(x, y, z):
                            count += 1
        print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


for n in range(1, N + 1):
    count = 0
    X = n
    Y = n
    Z = n
    flg = False
    for x in range(1, X + 1):
        for y in range(1, Y + 1):
            for z in range(1, Z + 1):
                if(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n):
                    count += 1
    
    print(count)

Submission status: Time Limit Exceeded

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

    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

for n in range(1,N+1):
    cnt = 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):
                a = i**2 + j**2 + k**2 + i*j + j*k + k*i
                if a == n:
                    cnt += 1
    
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
def const(n):
  set_xyz=[]
  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:
          
          set_xyz.append([x,y,z])
          
  return len(set_xyz)

N = int(input())
cnt=0
for i in range(1,N+1):
  cnt=const(i)
  print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
data = int(stdin.readline().rstrip())

list = []
for x in range(1,10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            list.append(x**2+y**2+z**2+x*y+y*z+z*x)

for i in range(1,data+1):
    print(list.count(i))

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, i + 1):
        for y in range(1, i + 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:
#<C>
import math
N = int(input())
for n in range(1, N + 1):
    ans = 0
    x = math.ceil(n ** (1/2))
    for i in range(1, x):
        for j in range(1, x):
            for k in range(1, x):
                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())

NUM_MAX = int(math.sqrt(n))+1

def my_func(k):
    ans = 0
    for x in range(1, NUM_MAX):
        for y in range(1, NUM_MAX):
            for z in range(1, NUM_MAX):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == k:
                        ans += 1
    print(ans)

    
for i in range(1, n+1):
    my_func(i)

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(i))+1):
        for y in range(x,int(math.sqrt(i))+1):
            for z in range(y,int(math.sqrt(i))+1):
                if x**2+y**2+z**2+x*y+y*z+z*x != i:
                    continue
                if x == y and x == z:
                    count += 1
                elif x == y or x == z or y == z:
                    count += 3
                else:
                    count += 6
    print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
N=int(input())
ans=[0 for i in range(N)]

for n in range(N):
    nax=int(math.sqrt(n))
    for x in range(1,nax):
        for y in range(1,x+1):
            for z in range(1,y+1):
                temp=x**2+y**2+z**2+x*y+y*z+z*x
                if temp==n+1:
                    ans[n]+=1
                    if x==y and y!=z:
                        ans[n]+=2
                    if y==z and x!=y:
                        ans[n]+=2
                    if x==z and y!=x:
                        ans[n]+=2
                    if x!=y and y!=z and z!=x:
                        ans[n]+=5

for anss in ans:
    print(anss)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return map(int, sys.stdin.readline().split())
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())


def FLIST(n):
    res = [1]
    for i in range(1, n+1):
        res.append(res[i-1]*i % DVSR)
    return res


N = II()

for i in range(1, N+1):
    cnt = 0
    current = i
    for x in range(1, math.floor(math.sqrt(i))+1):
        tmp1 = current - x*x
        if tmp1 > 0:
            for y in range(1, math.floor(math.sqrt(tmp1))+1):
                tmp2 = tmp1 - y*y
                if tmp2 > 0:
                    for z in range(1, math.floor(math.sqrt(tmp2))+1):
                        if tmp2 - z*z - x*y - y*z - z*x == 0:
                            # print(x, y, z)
                            cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
for n in range(1,N+1):
  n2 = int(n**0.5)+1
  cnt = 0
  for x in range(1,n2):
    for y in range(x,n2):
      for z in range(y,n2):
        #if n == 18:
          #print(x,y,z,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 != n:
          continue
        if x==y and y==z:
          cnt += 1
        elif x==y or y==z or z==x:
          cnt += 3
        else:
          cnt += 6
  print(cnt)

Submission status: Time Limit Exceeded

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

#from collections import defaultdict
#from heapq import heappush, heappop
#import numpy as np
import sys

sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7

debug_indent = 0


def debug(*x):
    global debug_indent
    x = list(x)
    indent = 0
    if x[0].startswith("enter") or x[0][0] == ">":
        indent = 1
    if x[0].startswith("leave") or x[0][0] == "<":
        debug_indent -= 1
    x[0] = "  " * debug_indent + x[0]
    print(*x, file=sys.stderr)
    debug_indent += indent


def solve(N):
    # blute
    from math import sqrt, floor
    for n in range(1, N + 1):
        ret = 0
        for x in range(1, floor(sqrt(n))):
            v0 = x * x
            for y in range(1, floor(sqrt(n))):
                v1 = v0 + y * y + y * x
                if v1 >= n:
                    break
                for z in range(1, floor(sqrt(n))):
                    v = v1 + z * z + y * z + z * x
                    if v == n:
                        ret += 1
                    elif v > n:
                        break
        print(ret)


def main():
    # parse input
    N = int(input())
    solve(N)


# tests
T1 = """
20
"""


def test_T1():
    """
    >>> as_input(T1)
    >>> main()
    0
    0
    0
    0
    0
    1
    0
    0
    0
    0
    3
    0
    0
    0
    0
    0
    3
    3
    0
    0
    """
# add tests above


def _test():
    import doctest
    doctest.testmod()


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())

    def input():
        return bytes(f.readline(), "ascii")

    def read():
        return bytes(f.read(), "ascii")


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', solve.__doc__.strip().split()[0])(solve)
    cc.compile()
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        # -p: pure python mode
        # if not -p, import compiled module
        from my_module import solve  # pylint: disable=all
    elif sys.argv[-1] == "-t":
        print("testing")
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        # input given as file
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.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,int(i**0.5)):
      for z in range(1,int(i**0.5)):
        if x**2+y**2+z**2+x*y+y*z+z*x == i:
          count = count+1
  print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

N = ii()
did = 1
while did != N+1:
    mark = math.ceil(sqrt(did))
    count = 0
    for x in range(1,mark):
        if x ** 2 >= N:
            break
        for y in range(1,mark):
            if x ** 2 + y ** 2 >= N:
                break
            for z in range(1,mark):
                if x ** 2 + y ** 2 + z ** 2 >= N:
                    break
                if x**2 + y ** 2 + z ** 2 + x*y + y*z + z*x == did:
                    count += 1
    print(count)
    did += 1