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: Wrong Answer

Solution code:
n = int(input())
xyz = [[[0 for i in range(101)] for j in range(101)] for k in range(101)]
ans = [0 for i in range(n+1)]

def gen_n(x, y, z):
    return x*2 + y*2 + z*2 + x*y + y*z + z*x
for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            num = gen_n(i, j, k)
            if n >= num:
                ans[num] += 1
for i in range(1, n+1):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
N = int(input())

arr = [0 for _ in range(N+1)]
for x in range(1,N+1):
    F1 = True
    for y in range(x,N+1):
        F2 = True
        for z in range(y,N+1):
            n = (x**2)+(y**2)+(z**2)+(x*y)+(y*z)+(z*x)
            if n >= N:
                if y == z:
                    F2 = False
                break
            else:
                if x == y and y == z:
                    arr[n] += 1
                elif (x == y) or (y == z) or (z == x):
                    arr[n] += 3
                else:
                    arr[n] += 6
        if F2 == False:
            if x == y:
                F1 = False
            break
    if F1 == False:
        break

for i in arr[1:]:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
def ff(x,y,z):
    n = x**2+y**2+z**2+x*y+y*z+z*x
    return n
maxx=31

c=[]
ans = [0]*N
for i in range(1,maxx+1):
    for j in range(1,maxx+1):
        for k in range(1,maxx+1):
            r=ff(i,j,k)
            c.append(r)
cc = [i for i in c if i<=N]

for i in cc:
    ans[i-1] += 1

for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
def f(n):
    cnt = 0
    for x in range(1,6):
        for y in range(1, 6):
            for z in range(1,6):
                if (((x**2 )+(y**2) +(z**2) +x*y +y*z+ z*x)) == n:
                    cnt += 1

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
def main():
    n = int(input())
    ans = []
    for x in range(1, n):
        for y in range(1, n):
            for z in range(1, n):
                ans.append(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)
    counter = Counter(ans)
    for i in range(1, n+1):
        print(counter[i], i)
 
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import time
import itertools


N = int(input())
def function(x,y,z,n):
    n_tmp = pow(x+y+z,2) - (x*y) - (y*z) -(x*z)
    if n == n_tmp:
        return True
    else:
        return False


max = pow(10,4)
count = 0
start = time.time()

p = list(itertools.product(range(1,15), repeat=3))

for n in range(1,N):
    count = 0
    for p_in in p:
        if function(p_in[0],p_in[1],p_in[2],n) == True:
            count = count + 1

    print(count)



elapsed_time = time.time() - start
# print("elapsed_time:{0}".format(elapsed_time) + "[sec]")

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n = int(input())
    if n == 1:
        print(0)
        sys.exit()
    r = [0]*100000000
    for i1 in range(1,33):
        for i2 in range(1,33):
            for i3 in range(1,33):
                t = pow(i1, 2) + pow(i2, 2) + pow(i3, 2) + i1*i2 + i2*i3 + i1*i3
                t = int(t)
                r[t] += 1
    for i1 in range(1, n+1):
        print(r[i1])

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
from itertools import combinations_with_replacement

def calc(t):
    return t[0]*t[0] + t[1]*t[1] + t[2]*t[2] + t[0]*t[1] + t[1]*t[2] + t[2]*t[0]


n = int(input())
ans = [0]*n
n_root = math.floor(math.sqrt(n))+1

for pattern in combinations_with_replacement(range(1, n_root + 1), 3):
    pattern = list(pattern)
    buf = calc(pattern)
    #print(pattern)
    if buf < n:
        if pattern[0] == pattern[1] == pattern[2]:
            ans[buf-1] += 1
        elif pattern[0] == pattern[1] or pattern[1] == pattern[2] or pattern[0] == pattern[2]:
            ans[buf-1] += 3
        else:
            ans[buf-1] += 6

[print(a) for a in ans]
#print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
x,y,z = 1,1,1
for i in range(1,n+1):
    flag = True
    for j in range(0,10):
        if (x+j)**2+(y+j)**2+(z+j)**2+(x+j)*(y+j)+(y+j)*(z+j)+(z+j)*(x+j) == i:
            print(1)
            x += j
            y += j
            z += j
            flag = False
            break
        elif (x+j)**2+y**2+z**2+(x+j)*y+y*z+z*(x+j) == i:
            print(3)
            flag = False
            break
        elif (x+j)**2+(y+j)**2+z**2+(x+j)*(y+j)+(y+j)*z+z*(x+j) == i:
            print(3)
            flag = False
            break
    if flag:
        print(0)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [0]*10**4
ans = 0
for i in range(1, 101):
  for j in range(1, min(i+1,50)):
    for k in range(1, min(j+1, 34)):
       if (i+j+k)**2-i*j-j*k-k*i <= 10**4:
          p = (i+j+k)**2-i*j-j*k-k*i
          if i==j==k:
             a[p-1] +=1
          else:
             a[p-1] +=3
for q in a[:n]:
  print(q)

Submission status: Wrong Answer

Solution code:
a = [0] * 100000

for i in range(1, 10):
    for j in range(i, 10):
        for k in range(j, 10):
            tmp = 0
            if i != j and j != k:
                tmp = 6
            elif i == j and j != k:
                tmp = 3
            elif i != j and j == k:
                tmp = 3
            elif i == k:
                tmp = 1
            ind = pow(i, 2) + pow(j, 2) + pow(k, 2) + i*j + j*k + k*i
            a[ind] += tmp
N = int(input())
for i in range(1, N+1):
    print(a[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
l = []
ls = [0]*(n+1)

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

for i in range(1,int(n**0.5)):
    for j in range(1,int(n**0.5)):
        for k in range(1,int(n**0.5)):
            a = cul(i,j,k)
            if a < n:
                ls[a] += 1
for i in ls[1::]:
    print(i)

Submission status: Wrong Answer

Solution code:
def f(n):
    cnt = 0
    for x in range(1,5):
        for y in range(1, 5):
            for z in range(1,5):
                if (((x**2 )+(y**2) +(z**2) +x*y +y*z+ z*x)) == n:
                    cnt += 1

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

Submission status: Wrong Answer

Solution code:
N = int(input())
k = 1
for i in range(1,N+1):
    if i == 6*k**2:
        print(1)
    elif i == (k+1)**2 + 3 * k**2 + 2*(k*(k+1)):
        print(3)
    elif i == 3*((k+1)**2) + 2*k*(k+1) + k**2:
        print(3)
    elif i == (k+2)**2 + 3*k**2 + 2*k*(k+2):
        print(3)
        k +=1
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
N = int(input().strip())

x, y, z = 1, 1, 1

f = []
for i in range(N+1):
    f.append(set())

# while x**2 + y**2 + z**2 + x*y + y*z + x*z <= N:
def calc(x, y, z, f, axis=""):
    print(x, y, z)
    # n = x**2 + y**2 + z**2 + x*y + y*z + x*z
    n = (x+y+z) ** 2 - (x*y + y*z + x*z)
    if n <= N:
        f[n].add("%d-%d-%d" % (x, y, z))
        # print(n, x, y, z)
        f = calc(x+1, y, z, f)
        f = calc(x, y+1, z, f)
        f = calc(x, y, z+1, f)
        return f
    else:
        return f

f = calc(x, y, z, f)
# while True:
#     f = calc(x, y, z, f)
#     f = calc(x+1, y, z, f)
#     f = calc(x, y+1, z, f)
#     f = calc(x, y, z+1, f)
#     f = calc(x+1, y+1, z, f)
#     f = calc(x, y+1, z+1, f)
#     f = calc(x+1, y, z+1, f)
#
#     x += 1
#     y += 1
#     z += 1
#
#     if x**2 + y**2 + z**2 + x*y + y*z + x*z > N:
#         break

for i in range(1, N+1):
    print(f[i].__len__())

Submission status: Wrong Answer

Solution code:
N = int(input())

def f(n):
    flag = False
    #total = 0
    ans = 0
    for x in range(1,100):
        for y in range(1,100-x):
            for z in range(1,100-(x+y)):
                if (x + y + z)**2 - (x*y + y*z + x*z) == n:
                    #total += 1
                    flag = True
                    break
            if flag:
                break
        if flag:
            break
    if x == 99:
        ans = 0
    elif x == y and  y== z:
        ans = 1
    elif x == y or y == z or x == z:
        ans = 3
    else:
        ans = 6
    return ans

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