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):
    ans = 0
    for x in range(1, int((10**2)//(6**(1/2)))):
        for y in range(1, int((10**2)//(6**(1/2)))):
            for z in range(1, int((10**2)//(6**(1/2)))):
                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 = []
for z in range(1, 59, 1):
    for y in range(1, 59, 1):
        for x in range(1, 59, 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:
N = int(input().strip())
s=[]
for a in range (1,101):
    for b in range(1,101):
        for c in range(1,101):
            s.append(a*a+b*b+c*c+a*b+b*c+c*a)

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = []
m = n
n = 1
while n <= m:
    cnt = 0
    for i in range(1, n):
        for j in range(1, n):
            for k in range(1, n):
                if (i + j + k)**2 - (i*j + j*k + k*i) == n:
                    cnt += 1
    ans.append(cnt)
    n += 1

for i in range(len(ans)):
    print(ans[i])

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(x,int(n**(1/2))):
            for z in range(y,int(n**(1/2))):
                f=x*x + y*y + z*z + x*y + y*z + z*x
                if n==x*x + y*y + z*z + x*y + y*z + z*x:
                    e=0
                    if x==y:
                        e+=1
                    if y==z:
                        e+=1
                    if z==x:
                        e+=1
                    if e==0:
                        c+=6
                    elif e==1:
                        c+=3
                    else:
                        c+=1
                if f>n:
                    break
    print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

for n in range(1, n + 1):
    ans = 0
    for x in range(1, int(math.sqrt(n) + 1)):
        for y in range(1, int(math.sqrt(n - x ** 2) + 1)):
            for z in range(1, int(math.sqrt(n - x ** 2 - y ** 2) + 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:
n = int(input())

def calc(num):
    cnt = 0
    for i in range(1, n-1):
        if i*i + i + i + 3 > num: break
        for j in range(1, n-i):
            if i*i + j*j + i*j + i + j + 1 > 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
                elif res > num:
                    break
    return cnt

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

Submission status: Time Limit Exceeded

Solution code:

def solve():
    for n in range(1,N+1):
        cnt = 0
        for x in range(1,int(n**0.5)+1):
            for y in range(1,x+1):
                for z in range(1,x+1):
                    if x**2+y**2+z**2+x*y+y*z+z*x==n:
                        if x==y==z:
                            cnt += 1
                        else:
                            cnt += 3
                            x += 1
        print(cnt)

if __name__=="__main__":
    N = int(input())
    solve()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

for m in range(1,n+1):
    cnt =0
    for i in range(1,m+1):
        for j in range(1,m+1):
            for k in range(1,m+1):
                if i*i+j*j+k*k + i*j + j*k + k*i == m:
                    cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

for i in range(1,n+1):
    ans = 0
    for x in range(1,math.floor(math.sqrt(i))):
        for y in range(x,math.floor(math.sqrt(i))):
            for z in range(y, math.floor(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 or y==z or z==x:
                        ans += 3
                    else:
                        ans += 6
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
n=int(input())
for i in range(1,n+1):
  s=0
  p=math.floor(math.sqrt(i))
  for x in range(1,p):
    for y in range(1,x+1):
      for z in range(1,y+1):
        if x**2+y**2+z**2+x*y+y*z+z*x==i:
          if x==y==z: s+=1
          elif x==y or y==z: s+=3
          else: s+=6          
  print(s)

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))):
        x2 = x*x
        for y in range(1, int(math.sqrt(n))):
            y2 = y*y
            xy = x * y
            tmp = x2 + y2 + xy
            if tmp >= i:
                break
            for z in range(1, int(math.sqrt(n))):
                if tmp + z*z + y*z + z*x == i:
                    ans += 1
                    break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
from math import ceil
N = int(input())
s = ceil(sqrt(N))
for i in range(1, N+1):
  count = 0
  for x in range(1,s+1):
    for y in range(1,s+1):
      for z in range(1,s+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:
import math

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

for i in range(1, n+1, 1):
    maxn = math.ceil((i/2.0)**0.5)
    cnt = 0
    for x in range(1, maxn+1):
        if x**2 > i:
            break
        for y in range(x, maxn+1):
            if x**2 + y**2 + x* y > i:
                break
            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
                elif x**2 + y**2 + z**2 + x*y + y*z + z*x > i:
                    break
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
for i in range(1, 1 + int(input())):

  match_pattern = []

  for x in range(1, 1 + 32):
    for y in range(1, 1 + 32):
      for z in range(1, 1 + 32):

        if i == (x**2 + y ** 2 + z ** 2 + x * y + y * z + z * x):
          match_pattern.append([x, y, z])
  
  print(len(match_pattern))

Submission status: Time Limit Exceeded

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

# 入りうる整数
enter = int(math.sqrt(N))
value_array = []
for x in range(1, enter+1):
  for y in range(1, enter+1):
    for z in range(1, enter+1):
      value_array.append(x**2 + y **2 + z ** 2 + x*y + y*z + z*x)

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

Submission status: Time Limit Exceeded

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

N = int(input())
for n in range(1,N+1):
    count = 0
    for x in range(1,N+1):
        for y in range(1,N+1):
            for z in range(1,N+1):
                if func(x,y,z)==n:
                    count=count+1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
#c
N = int(input())
cou = 0

for i in range(1,N+1):
    cou = 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 == i:
                    cou += 1
    print(cou)

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:
                continue
            L[tmp] += 1

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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


def readstr():
    return input().strip()


def readint():
    return int(input())


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


def readstrs():
    return input().split()


def main():
    N = readint()
    for i in range(1, N + 1):
        s = math.ceil(math.sqrt(i))
        ans = 0
        for j in range(1, s):
            for k in range(1, s):
                l = s - j - k
                if l <= 0:
                    break
                else:
                    if j * k + k * l + j * l == s ** 2 - i:
                        ans += 1

        print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N=int(input())
for n in range(1, N+1):
    # count number of sets (x, y,x)
    #assume x<y<z
    ans=0
    z_low=int(np.sqrt(n/6))
    z_up=int(np.sqrt(n))
    for z in range(z_low, z_up):
        for y in range(1, z+1):
            for x in range(1, y+1):
                if n == x**2 + y**2 + z**2 + x*z + x*y + y*z:
                    # classify
                    if x==y and x==z:
                        #x=y=z
                        ans+=1
                    elif x==y and x!=z:
                        ans+=3
                    elif y==z and y != x:
                        ans+=3
                    elif z==x and z!=y:
                        ans+=3
                    else:
                        ans+=6
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

def f(N):
        lim = int(math.sqrt(N)+1)
        cnt = 0
        for x in range(lim):
                for y in range(lim):
                        for z in range(lim):
                                if x==0 or y==0 or z==0:
                                        continue
                                else:
                                        temp = x**2 + y**2 + z**2 + x*y + y*z + z*x
                                        if temp==N:
                                                cnt+=1
        return cnt


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

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

main()

Submission status: Time Limit Exceeded

Solution code:
import math  # noqa: F401
from collections import deque  # noqa: F401
from typing import Deque, Dict, List, Optional, Tuple, Union  # noqa: F401


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


def main(N: int):
    for n in range(1, N + 1):
        cnt = 0
        for x in range(1, int(math.sqrt(n))):
            for y in range(x, int(math.sqrt(n))):
                for z in range(y, int(math.sqrt(n))):
                    if f(x, y, z) == n:
                        if x == y == z:
                            cnt += 1
                        else:
                            cnt += 3
        print(cnt)


if __name__ == "__main__":
    N = int(input())
    main(N)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
ans=[0]*N
for i in range(1,N+1):
    for x in range(1,N+1):
        if x**2>i:
            break
        for y in range(x,N+1):
            if x**2+y**2>i:
                break
            for z in range(y,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:
                    ans[i-1]=3
if N>=6:
    ans[5]=1
for i in ans:
    print(i)

Submission status: Time Limit Exceeded

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

def func(n):
    if n == 1 or n == 2:
        return 0
    cnt = 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:
                    cnt += 1
    return cnt


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

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def det(x,y,n):
    return (x+y)**2 - 4*(x**2 + y**2 + x*y - n)
def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

n = int(input())

for i in range(1, n+1):
    ans = 0
    for x in range(1,int(pow(n,0.5))+2):
        for y in range(1,int(pow(n,0.5))+2):
            D = det(x,y,i)
            #if x == 1 and y == 1:
                #print(D)
            if D >= 0 and is_integer_num(pow(D,0.5)):
                if -(x+y) + pow(D,0.5) > 0:
                    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, 41):
        for y in range(1, 41):
            for z in range(1, 41):
                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:
N = int(input())

def solve(N):
    for i in range(1,N+1):
        ans = 0
        flag = 0
        for x in range(1,int(N**0.5)+1):
            for y in range(x,int(N**0.5)+1):
                for z in range(y,int(N**0.5)+1):
                    if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                        if x == y and y == z:
                            ans = 1
                            flag = 1
                            break
                        else:
                            ans = 3
                            flag = 1
                            break
                if flag == 1:
                    break
            if flag == 1:
                break
        if flag == 1:
            print(ans)
        else:
            print(0)
        
solve(N)

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**2))):
            for z in range(1,m.ceil(m.sqrt(i-x**2-y**2))):
                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:
from itertools import product
n = int(input())

nums = [0]*n
for i in product(range(1, n//6+1),repeat=3):
  t = i[0]**2 + i[1]**2 + i[2]**2 + i[0]*i[1] + i[1]*i[2] + i[0]*i[2]
  if t <= n: nums[t-1] += 1

print(*nums, sep="\n")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
import itertools
from math import floor,sqrt
def func(m):
  r=0
  for x in range(1,floor(sqrt(m))+1):
    for y in range(1,floor(sqrt(m))+1):
      for z in range(1,floor(sqrt(m))+1):
        if x**2+y**2+z**2+x*y+y*z+z*x==m:
          r+=1
  return r
for i in range(1,n+1):
  print(func(i))

Submission status: Time Limit Exceeded

Solution code:
import sys
import itertools
import math

if __name__ == "__main__":
    N = int(sys.stdin.readline())

    for i in range(1, N+1):
        ans = 0
        ls = list(range(1, int(math.sqrt(i))))
        # print(ls)
        for (x,y,z) in itertools.product(ls, repeat=3):
            if i == x**2+y**2+z**2+x*y+y*z+z*x:
                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, math.floor(math.sqrt(i))+1):
        for y in range(1, math.floor(math.sqrt(i-x*x))+1):
            for z in range(1, math.floor(math.sqrt(i-x*x-y*y))+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())

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:
                continue
            L[tmp] += 1

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

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

Submission status: Time Limit Exceeded

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

for p in range(1, n+1):
  right=math.floor(math.sqrt(p))+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:
          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 and k!=i:
            cnt+=6
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


def func(a, b, c):
    return a * a + b * b + c * c + a * b + b * c + c * a


n = inp()
limit = int(math.sqrt(n)) + 1
for x in range(1, n + 1):
    ans = 0
    for i in range(1, limit):
        for j in range(i, limit):
            for k in range(j, limit):
                if func(i, j, k) == x:
                    if len(set([i, j, k])) == 1:
                        ans += 1
                    elif len(set([i, j, k])) == 2:
                        ans += 3
                    elif len(set([i, j, k])) == 3:
                        ans += 6
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
def equal(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):
    cnt = 0
    for x in range(1,N+1):
        for y in range(1,N+1):
            for z in range(1,N+1):
                if equal(x,y,z) == i:
                    #print(x,y,z)
                    cnt+=1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math

def xyz(n):
    rng = math.floor(math.sqrt(2 * n))
    count = 0
    for x in range(1,rng):
        for y in range(1, rng):
            for z in range(1, rng):
                if (x+y) ** 2 + (y+z) ** 2 + (z+x) ** 2 == 2 * n:
                    count += 1
    return count



N = int(input())
for i in range(1,N+1):
    print(xyz(i))

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
from collections import deque


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

    cnt_all = deque([])
    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
        # ---------
        cnt_all.append(str(cnt))

    print("\n".join(cnt_all))

if __name__ == "__main__":
    main()

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**2))):
            for z in range(1,m.ceil(m.sqrt(i-x-y**2))):
                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:
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(x,int(n**(1/2))):
            for z in range(y,int(n**(1/2))):
                if n==x*x + y*y + z*z + x*y + y*z + z*x:
                    e=0
                    if x==y:
                        e+=1
                    if y==z:
                        e+=1
                    if z==x:
                        e+=1
                    if e==0:
                        c+=6
                    elif e==1:
                        c+=3
                    else:
                        c+=1
    print(c)

Submission status: Time Limit Exceeded

Solution code:
#偶数奇数は考えないことにする  xは１００以下の整数

N=int(input())
total=0

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

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:
          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 and k!=i:
            cnt+=6
  print(cnt)

Submission status: Time Limit Exceeded

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

for i in range(1,n+1):
    ans = 0
    for x in range(1,math.floor(math.sqrt(i))):
        for y in range(1,math.floor(math.sqrt(i))):
            for z in range(1, math.floor(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())
def f(n):
    count=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*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:
n = int(input())
dp = [0 for i in range(n+1)]
maxn = 201
for x in range(1,maxn):
    for y in range(1,maxn):
        for z in range(1,maxn):
            p = (x+y+z)**2
            p-=(x*y + y*z + z*x)
            if p<=n:
                dp[p]+=1
for i in dp[1::]:
    print(i)

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):
                tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if(tmp == n):
                    count += 1
                elif(tmp > n):
                    break
    
    print(count)

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

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())

for n in range(1, N + 1):
    count = 0
    ub = int(math.sqrt(n))
    for x in range(1, ub + 1):
        for y in range(x, ub + 1):
            for z in range(y, ub + 1):
                if x * x + y * y + z * z + x * y + y * z + z * x == n:
                    s = len(set([x, y, z]))
                    if s == 1:
                        count += 1
                    elif s == 2:
                        count += 3
                    else:
                        count += 6
                    break
    print(count)

Submission status: Time Limit Exceeded

Solution code:
def f(n):
    res = 0
    for x in range(1, 100):
        for y in range(x, 100):
            for z in range(y, 100):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n:
                    if x == y == z:
                        res += 1
                    elif x != y != z:
                        res += 6
                    else:
                        res += 3
    return res


N = int(input())
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(N):
  n = i+1
  pair = []
  mmax = int(math.sqrt(N)) + 1
  for x in range(1, mmax+2):
    for y in range(x, mmax+3-x**2):
      for z in range(y, mmax+4-x**2-y**2):
        if x**2+y**2+z**2+x*y+y*z+z*x == n:
          pair.append((x, y, z))
  ans = 0
  for x, y, z in pair:
    if x == z:
      ans += 1
    elif x == y:
      ans += 3
    elif y == z:
      ans += 3
    else:
      ans += 6
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
ans = 0
if N > 10**3:
    upper = int(math.sqrt(N/6)) + 1
else:
    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):
                v = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if  v == n:
                    ans += 1
                    #print((x, y, z))
                elif v > n:
                    break
    print(ans)

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def const(n):
  set_xyz=[]
  for x in range(1,n//2):
    for y in range(1,n//2):
      for z in range(1,n//2):
        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:
def main():
    n = int(input())
    for i in range(n):
        calc(i)
 
def calc(n):
    count = 0
    for x in range(1, n + 1):
        for y in range(1, n + 1):
            for z in range(1, n + 1):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n+1:
                     count += 1
    print(count)
    return
 
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:

import numpy as np
n=int(input())
for i in range(1,n+1,1):
    cnt=0
    for x in range(1,int(np.sqrt(n))+1,1):
        for y in range(1,int(np.sqrt(n))+1,1):
            for z in range(1,int(np.sqrt(n))+1,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:
n=int(input())
import itertools
for i in range(1,n+1):
    res=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 == i:
                    res+=1
    print(res)