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:
import numpy as np

n = int(input())
ans = [0 for _ in range(n+1)]

tmp = int(np.sqrt(n)+1)
for i in range(1, tmp):
    for j in range(1, tmp):
        for k in range(1, tmp):
            v = i**2+j**2+k**2+i*j+i*k+j*k
            if v < n:
                ans[v]+=1
for a in ans[1:]:
    print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
r = range(1,101)
l = [0]*n

for x in r:
    for y in r:
        for z in r:
            t = x*x+y*y+z*z+y*z+z*x+x*y
            if t == n:
                l[t-1] +=1
for i in l:
    print(i)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
mylist = [int(math.sqrt(i)) for i in range(1,n+1)]
mylist = [0]+mylist
print(mylist)

def main():
    for N in range(1,n+1):
        result = 0
        for x in range(1,mylist[N//3]+1):
            tempx = x**2
            for y in range(x, mylist[(N-x**2)//2]+1, 2):
                tempy = y**2
                tempxy = x*y
                tempnum = int(N-tempx-tempy-tempxy + ((x+y)/2)**2)
                if tempnum <= 0:
                    break
                else:
                    if mylist[tempnum]**2 == tempnum:
                        z = mylist[tempnum]-(x+y)//2
                        if z < y:
                            break
                        elif x != y and y != z:
                            result += 6
                        elif x == y and y == z:
                            result += 1
                        else:
                            result += 3
        print(result)
main()

Submission status: Wrong Answer

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

def comb(x):
    fact = 1
    while x > 1:
        fact *= x
        x -= 1
    return fact

N = int(input())
res = [0] * (N + 1)
for i in range(1, 100):
    for j in range(i, 100):
        for k in range(j, 100):
            tmp = calc(i, j, k)
            if tmp > N:
                continue
            cnt = len(set([i, j, k]))
            res[tmp] += 6 // comb(4 - cnt)
print(*res, sep='\n')

Submission status: Wrong Answer

Solution code:
N = int(input())

def calculate_n(x, y, z):
  n = x**2 + y**2 + z**2 + x*y + y*z + z*x
  return n
l = []
for x in range(1, N):
  for y in range(1, N):
    for z in range(1, N):
      n = calculate_n(x,y,z)
      if n > N:
        break
      else:
        l.append(n)
    if n > N:
      break
  if n > N:
    break
    

numbers = sorted(set(l))
counts = [l.count(x) for x in numbers]
d = dict(zip(numbers, counts))

for i in range(1, N+1):
  if i in d:
  	print(d[i])
  else:
    print(0)

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())
    f = lambda x,y,z:x*x+y*y+z*z+x*y+y*z+z*x
    MAX = 10000

    ans = [0]*(MAX+1)
    for x in range(1, 101):
        if f(x,0,0)>MAX:
            break
        for y in range(1, 101):
            if f(x,y,0)>MAX:
                break
            for z in range(1, 101):
                if f(x,y,z)>MAX:
                    break
                ans[f(x,y,z)]+=1
    for i in ans[:N+1]:
        print(i)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
n = int(input())
f = [0]*48600
for x in range(1,90):
    for y in range(1,90):
        for z in range(1,90):
            f[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(f[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
f = [0]*38400
for x in range(1,80):
    for y in range(1,80):
        for z in range(1,80):
            f[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(f[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
f = [0]*21600
for x in range(1,60):
    for y in range(1,60):
        for z in range(1,60):
            f[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(f[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = [0] * 10050

for x in range(1, 105):
    for y in range(1, 105):
        for z in range(1, 105):

            f = x**2 + y**2 + z**2 + x*y + y*z + z*x

            if f < 10000:
                ans[f-1] = ans[f-1] + 1 


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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = [0 for i in range(10001)]

for i in range(105):
    for j in range(105):
        for m in range(105):
            v = i**2+j**2+m**2+i*j+j*m+m*i
            #print(v)
            if v<10001:
                ans[v]+=1
#print(count)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = [0] * 10050

for x in range(1, 1105):
    for y in range(1, 1105):
        for z in range(1, 1105):

            f = x**2 + y**2 + z**2 + x*y + y*z + z*x

            if f < 10000:
                ans[f-1] = ans[f-1] + 1 

            if f > N:
                break
    if f > N:
        break

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

Submission status: Wrong Answer

Solution code:
n = int(input())
f = [0]*15000
for x in range(1,50):
    for y in range(1,50):
        for z in range(1,50):
            f[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(f[i])

Submission status: Wrong Answer

Solution code:
N = int(input())

for n in range(N+1):
    cnt = 0
    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                check = x*x + y*y + z*z + x*y + y*z + z*x
                if check == n:
                    cnt += 1
                elif check > n:
                    break
    print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = [0] * 10000

for x in range(1, 1105):
    for y in range(1, 1105):
        for z in range(1, 1105):

            f = x**2 + y**2 + z**2 + x*y + y*z + z*x

            if f < 10000:
                ans[f-1] = ans[f-1] + 1 

            if f > N:
                break

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ANS =[0 for _ in range(n)]
for x in range(1, int((n/2)**0.5) + 1):
    for y in range(1, int((n/2)**0.5) + 1):
        for z in range(1, int((n/2)**0.5) + 1):
            if x**2 + y**2 + z**2 + x*y + y*z + z*x > n:
                continue
            ANS[(x**2 + y**2 + z**2 + x*y + y*z + z*x) - 1] += 1
for i in ANS:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())


ans = [0]*(10**4+1)

for x in range(1, 10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            n = x**2+y**2+z**2+x*y+y*z+z*x
            if n <10**4+1:
                ans[n] += 1

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

Submission status: Wrong Answer

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


for i in range(100):
  for j in range(100):
    for k in range(100):
      a = (i+1)*(i+1) +(j+1)*(j+1) + (k+1)*(k+1) + (i+1)*(j+1) +(j+1)*(k+1) + (k+1)*(i+1)
      if a < n:
        ans[a-1]+=1
for i in ans:
  print(i)

Submission status: Wrong Answer

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


for i in range(100):
  for j in range(100):
    for k in range(100):
      a = (i+1)*(i+1) +(j+1)*(j+1) + (k+1)*(k+1) + (i+1)*(j+1) +(j+1)*(k+1) + (k+1)*(i+1)
      if a < n:
        ans[a]+=1
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
mylist = [int(math.sqrt(i)) for i in range(1,n+1)]
print(mylist)

def main():
    for N in range(1,n+1):
        result = 0
        for x in range(1,mylist[N-1]+1):
            tempx = x**2
            for y in range(x, mylist[N-x**2]+1, 2):
                tempy = y**2
                tempxy = x*y
                if N-tempx-tempy-tempxy < 0:
                    break
                else:
                    if mylist[N-tempx-tempy-tempxy]**2 != N-tempx-tempy-tempxy:
                        pass
                    else:
                        z = mylist[N-tempx-tempy-tempxy]-(x+y)//2
                        if z < y:
                            break
                        elif x != y and y != z:
                            result += 6
                        elif x == y and y == z:
                            result += 1
                        else:
                            result += 3
        print(result)
main()

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = [0] * (n + 1)
loop = int((n/6) ** .5) + 1

def f(i, j, k):
    return i ** 2 + j ** 2 + k ** 2 + i*j + j*k + k*i

for i in range(1, loop+1):
    for j in range(1, loop+1):
        for k in range(1, loop+1):
            res = int(f(i, j, k))
            if res <= n:
                ans[res] += 1

for a in ans[1:]:
    print(a)