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 .

Solution (Python):
n=int(input())
d=dict({i:0 for i in range(1,n+1)})
for s in range(3,201):
    for x in range(1,s+1-2):
        for y in range(1,s+1-x-1):
            z=s-x-y
            v=x**2+y**2+z**2+x*y+y*z+z*x
            if not v in d:
                continue
            d[v]+=1
for k in d.keys():
    print(d[k])

Solution (Python):

N = int(input())
ans = [0] * (N + 1)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n <= N:
                ans[n] += 1
for i in range(1, N + 1):
    print(ans[i])

Solution (Python):
import collections
N = int(input())

lst = [0]*1000000
l = 0
res = 0

for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            lst[l] = i**2 + j**2 + k**2 + i*j + j*k + k*i
            l += 1

L = collections.Counter(lst)

for h in range(1,N+1):
    print(L[h])

Solution (Python):
N=int(input())
C=[0]*(2*N + 1)
l=10**2
for i in range(l):
    for j in range(l):
        for k in range(l):
            x=i+1
            y=j+1
            z=k+1
            s=(x+y)*(x+y)+(x+z)*(x+z)+(z+y)*(z+y)
            if(s<(2*N+1)):
                C[s]+=1
for i in range(N):
    print(C[2*(i+1)])

Solution (Python):
import sys
import math

def I(): 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 = I()
    f = [0]*(n+1)
    n_sqrt = int(math.sqrt(n))
    for x in range(1, n_sqrt):
        for y in range(x, n_sqrt):
            for z in range(y, n_sqrt):
                cnt = 0
                if x == y == z:
                    cnt = 1
                elif x != y != z:
                    cnt = 6
                else:
                    cnt = 3
                idx = x*x + y*y + z*z + x*y + y*z + z*x
                if idx <= n:
                    f[idx] += cnt
    ans = '\n'.join(str(v) for v in f[1:n+1])
    print(ans)

if __name__ == '__main__':
    main()

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

anslist = [0] * 10**4
for i in range(1, int(math.sqrt(int(10000/3)))+1):
    x = i
    for j in range(i, int(math.sqrt(int((10000-i**2)/2)))+1):
        y = j
        for k in range(j, int(math.sqrt(10000-i**2-j**2))+1):
            z = k
            uhen = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if uhen-1 >= 10**4:
                continue
            if x == y == z:
                anslist[uhen-1] += 1
            elif x != y and x != z and y != z:
                anslist[uhen-1] += 6
            else:
                anslist[uhen-1] += 3


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

Solution (Python):
N = int(open(0).read())
cache = {}
cnt = 0
c = int(N ** 0.5)
cs = range(1, c)
for x in cs:
    for y in cs:
        for z in cs:
            n = x*x + y*y + z*z + x*y + y*z + z*x
            if n in cache:
                cache[n] += 1
            else:
                cache[n] = 1
for i in range(1, N+1):
    if i in cache:
        print(cache[i])
    else:
        print(0)

Solution (Python):
N = int(input())

initial = (1,1,1)
queue = []
queue.append(initial)
pointer = 0
answers = [0] * (N + 1)
memo = {}
while pointer < len(queue):
    x, y, z = queue[pointer]
    
    q = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
    if q < N + 1:
        add = 1
        if x == y and y == z:
            add = 1
        elif x == y or y == z or z == x:
            add = 3
        else:
            add =6
        answers[q] += add

        if x+1>=y and y >=z and (x+1,y,z) not in memo:
            memo[(x+1,y,z)] = 0
            queue.append((x + 1, y, z))
        if x >= y +1 and y + 1 >= z and (x, y+1, z) not in memo:
            memo[(x,y+1,z)] = 0
            queue.append((x, y + 1, z))
        if x >= y and y >= z+1 and (x, y, z+1) not in memo:
            memo[(x,y,z+1)] = 0
            queue.append((x, y, z + 1))
    pointer += 1

        
for a in answers[1:N + 1]:
    print(a)

Solution (Python):
import sys
input = sys.stdin.readline
n = int(input())
anslist = []

from math import sqrt
for i in range(1,n+1):
    ans = 0
    for x in range(1,int(sqrt(i))+1):
        for y in range(x,int(sqrt(i))+1):
            if (x+y)**2-4*(x*y+x**2+y**2-i) < 0:
                continue
            z = (-(x+y)+sqrt((x+y)**2-4*(x*y+x**2+y**2-i)))/2
            zz = int((-(x+y)+sqrt((x+y)**2-4*(x*y+x**2+y**2-i)))/2)
            if z == zz and zz >= y:
                if x == y and y == z and x == z:
                    ans += 1
                    
                elif x == y:
                    ans += 3
                elif y == z:
                    ans += 3
                else:
                    ans += 6
    anslist.append(ans)

for ans in anslist:
    print(ans)

Solution (Python):
import sys












stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    N = int(stdin.readline().rstrip())
    
    
    
    
    
    
    ans = [0]*N
    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):
                a = x**2 + y**2 + z**2 +x*y + y*z + z*x
                if a > N:
                    break
                ans[a-1] += 1

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



if __name__ == '__main__':
    solve()

Solution (Python):
n = int(input())
ans = [0] * n
count = 0
for i in range(n):
    x = i + 1
    xx = x * x
    if  x * x >= n:
        break
    for j in range(n):
        y = j + 1
        yy = y * y
        if xx + yy + x * y>= n:
            break
        for k in range(n):
            z = k + 1
            zz = z * z
            kotae = xx + yy + zz + x * y + y * z + z * x
            if kotae > n:
                break
            ans[kotae-1] += 1
for i in range(n):
    print(ans[i])

Solution (Python):




def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



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



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


import collections
import math
def main():

    n = input_int()
    ans = collections.defaultdict(set)
    max_val = int(math.sqrt(n)) + 1
    for x in range(1, max_val):
        for y in range(1, max_val):
            for z in range(1, max_val):
                temp = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (x * z) + (y * z)
                if temp <= n:
                    ans[temp].add((x, y, z))

    for i in range(1, n + 1):
        print(len(ans[i]))


if __name__ == "__main__":
    main()

Solution (Python):

def binary_search(mn,mx,a,x,y):
    
    
    z = (mx+1)//2
    low = mn
    high = mx+1
    while low <= high:
        temp = rule2(x,y,z)
        if temp == a:
            if z <= 0:
                return None
            return z
        elif temp < a:
            low = z + 1
        elif temp > a:
            high = z - 1

        z = (low + high) // 2
    return None

def rule2(x,y,z):
    return x ** 2 + y ** 2 + z**2 + x * y + y * z + z*x
def main():
    n = int(input())
    x = []
    y = []
    for i in range(1,n+1):
        
        
        print(f(i))
    
    


def f(n):
    counter = 0
    for x in range(1,n):
        if x ** 2 > n:
            break
        for y in range(x,n-x**2):
            if y < x:
                continue
            if x ** 2 + y ** 2 > n:
                break
            z = binary_search(y,n-x**2-y**2-x*y,n,x,y)
            if z == None:
                continue
            else:
                if rule2(x,y,z) == n:
                    if x == y and y == z and z == x:
                        counter += 1
                    elif x != y and y != z and z != x:
                        counter += 6
                    else:
                        counter += 3

    return counter


if __name__ == '__main__':
    main()

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
ans = [0]*(10**4+1)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            res = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if res <= 10**4:
                ans[res] += 1


for i in range(n):
    print(ans[i+1])

Solution (Python):
import sys
import numpy as np
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())

ansLis = [0] * 10001
arr = np.array(ansLis)

for i in range(1, 100):
    for j in range(i, 100):
        for k in range(j, 100):
            tar = i*i + j*j + k*k + i*j + j*k + k*i
            if (tar > 10000):
                continue

            if (i == j and j == k):
                arr[tar] += 1
            elif (i != j) and (j != k):
                arr[tar] += 6
            else:
                arr[tar] += 3


for i in range(1, n + 1):
    print(arr[i])