Problem: p02608
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
ans = [0] * N
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,22):
            if (x**2+y**2+z**2+x*y+y*z+z*x) <= N:
                n = int(0.5*((x+y)**2+(y+z)**2+(z+x)**2))
                if x == y and y == z and z == x:
                    ans[n-1] = 1
                elif x == y or y == z or z == x:
                    ans[n-1] = 3
                elif x != y and y != z and z != x:
                    ans[n-1] = 6
for output in ans:
    print(output)

Failing test case input:
743

Expected output:
0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0
0
0
0
1
6
0
3
0
0
0
0
0
3
3
6
0
0
3
0
0
0
0
3
3
6
0
6
0
0
0
3
0
0
1
6
0
6
6
0
0
6
0
0
0
0
3
3
3
6
0
6
3
6
0
0
0
6
0
0
0
3
3
9
0
6
3
6
0
3
6
0
0
0
0
6
1
6
0
6
6
0
3
12
0
6
0
0
3
6
0
0
0
3
3
12
0
6
3
6
0
3
6
9
0
6
0
0
0
3
6
3
3
6
0
6
3
12
0
3
6
6
0
6
0
6
3
6
0
0
1
6
3
12
6
0
0
12
0
6
0
6
6
12
0
0
6
0
0
6
0
12
3
6
0
6
3
9
6
3
6
6
0
6
0
6
0
15
6
0
0
6
0
3
3
12
0
12
6
6
0
3
6
6
3
12
0
6
0
9
6
0
0
6
3
12
1
6
6
6
6
0
0
18
0
12
0
3
6
12
0
0
6
3
6
12
0
12
0
0
0
9
3
9
6
12
3
12
0
3
6
6
0
12
0
12
0
9
9
0
0
6
3
6
3
12
6
9
3
6
0
12
3
6
3
9
6
12
6
6
0
6
0
9
6
6
0
12
3
6
0
9
6
6
1
6
0
21
12
6
0
12
0
12
0
0
6
15
6
0
6
12
0
12
0
12
0
0
0
12
0
12
12
3
3
18
3
6
3
6
6
9
9
18
0
6
0
12
0
9
6
0
3
12
3
6
6
12
6
6
0
0
0
15
3
18
3
18
3
12
6
3
6
9
0
12
0
12
0
18
12
0
0
12
3
6
0
6
6
9
6
0
0
18
1
18
3
12
6
6
6
12
0
15
6
12
6
18
0
0
6
0
9
12
0
18
0
6
3
12
0
12
12
0
0
12
0
3
6
12
6
18
9
18
0
9
6
18
0
6
0
6
3
27
6
6
6
6
3
6
0
12
6
9
0
6
0
18
0
9
9
15
3
12
6
6
3
9
6
12
12
18
0
18
0
6
6
21
6
0
0
6
3
15
6
12
6
18
0
0
0
12
6
6
3
6
4
18
6
12
6
3
9
30
0
18
0
6
6
12
6
6
9
12
0
18
6
18
0
6
0
12
0
6
12
6
3
18
0
6
6
6
6
15
3
24
0
6
3
18
0
12
6
12
6
24
0
15
18
9
6
0
0
18
3
6
0
15
12
12
6
6
0
18
0
6
3
12
0
12
6
6
9
9
6
24
3
24
0
9
12
6
6
12
0
12
0
21
9
15
6
12
3
18
3
12
6
12
6
0
0
12
0
12
6
24
0
6
12
6
1
9
6
12
6
24
0
18
3
12
6
6
12
24
0
12
6
15
6
18
0
18
0
0
0
18
9
21
12
0
6
18
0
9
6
6
6
12
0
12
0
9
9
27
6
6
3
18
6
21
6
6
12
12
0
12
0
24
12
0
0
24
3
24
6
12
12
18
0
0
0
12
0
18
3
15
6
12
9
6
0
15
6
9
12
24
0
12
3
6
6
21
6
18
3
18
0
21
12
15
6
6
0
12
3
12
9
18
9
12
6
6
6
24
0
18
3
24
0
6
6
0
6
9
6
6
4
30
0
18
12
9
6
24
0
18
0
9
12
21
6
6
12
12


Actual output:
0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0
0
0
0
1
6
0
3
0
0
0
0
0
3
3
6
0
0
3
0
0
0
0
3
3
6
0
6
0
0
0
3
0
0
1
6
0
3
6
0
0
6
0
0
0
0
3
3
3
6
0
6
3
6
0
0
0
6
0
0
0
3
3
3
0
6
3
6
0
3
6
0
0
0
0
6
1
6
0
3
6
0
3
6
0
6
0
0
3
6
0
0
0
3
3
6
0
6
3
6
0
3
6
3
0
6
0
0
0
3
6
3
3
6
0
6
3
6
0
3
6
6
0
6
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0
3
6
0
0
6
3
6
6
6
6
6
0
0
0
6
0
6
3
6
6
6
3
6
0
6
6
6
3
6
0
6
3
6
6
6
6
6
3
6
0
6
6
6
6
6
0
6
3
6
6
6
3
6
6
6
6
6
0
6
3
6
0
6
6
0
6
6
6
6
3
6
0
6
6
3
6
6
0
6
0
3
6
6
6
6
6
6


Fixed submission (verdict: Accepted):
N = int(input())
ans1 = [0] * N
ans2 = [0] * N
ans3 = [0] * N

for x in range(1,101):
    for y in range(1,71):
        for z in range(1,58):
            if (x**2+y**2+z**2+x*y+y*z+z*x) <= N:

                n = x**2+y**2+z**2+x*y+y*z+z*x
                if x == y and y == z and z == x:
                    ans1[n-1] = 1

                elif x == y and x > z:
                    ans2[n-1] += 3
                elif y == z and x > z:
                    ans2[n-1] += 3
                elif x != y and y != z and z != x:
                    if x > y and y > z:
                        ans3[n-1] += 6
for x,y,z in zip(ans1, ans2, ans3):
    print(x+y+z)