Problem p02608 (python)

Fixed submission:
import numpy as np

N = int(input())

ans = np.zeros(int(N))

if N<10001 and N>3:
    maxa = int(np.sqrt(N-2))
    for x in range(1,maxa):
        for y in range(1,x):
            for z in range(1,y):
                p = x*x+y*y+z*z+x*y+y*z+z*x
                if p<N+1:
                    ans[p-1] += 6


    for x in range(1,maxa):
        for y in range(1,x):
            p = x*x*3+y*y+x*y*2
            if p<N+1:
                ans[p-1] += 3
            p = y*y*3+x*x+x*y*2
            if p<N+1:
                ans[p-1] += 3

    for x in range(1,maxa):
        p = x*x*6
        if p<N+1:
            ans[p-1] += 1

for x in range(0,N):
    print(int(ans[x]))

Buggy submission (verdict: Runtime Error):
import numpy as np

N = int(input())

ans = np.zeros(int(N))

if N<10001 and N>0:
    maxa = int(np.sqrt(N-2))
    for x in range(1,maxa):
        for y in range(1,x):
            for z in range(1,y):
                p = x*x+y*y+z*z+x*y+y*z+z*x
                if p<N+1:
                    ans[p-1] += 6


    for x in range(1,maxa):
        for y in range(1,x):
            p = x*x*3+y*y+x*y*2
            if p<N+1:
                ans[p-1] += 3
            p = y*y*3+x*x+x*y*2
            if p<N+1:
                ans[p-1] += 3

    for x in range(1,maxa):
        p = x*x*6
        if p<N+1:
            ans[p-1] += 1

    for x in range(0,N):
        print(int(ans[x]))

Buggy submission (verdict: Runtime Error):
import numpy as np

N = int(input())

"""
for i in range(1,int(N)+1):
    count = 0
    if i > 3:
        maxa = int(np.sqrt(i-2))
        for x in range(1,maxa):
            for y in range(1,maxa):
                for z in range(1,maxa):
                    if x*x+y*y+z*z+x*y+y*z+z*x > i:
                        break
                    if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count +=1

    print(count)

"""
ans = np.zeros(int(N))

maxa = int(np.sqrt(N-2))
for x in range(1,maxa):
    for y in range(1,x):
        for z in range(1,y):
            p = x*x+y*y+z*z+x*y+y*z+z*x
            if p<N+1:
                ans[p-1] += 6


for x in range(1,maxa):
    for y in range(1,x):
        p = x*x*3+y*y+x*y*2
        if p<N+1:
            ans[p-1] += 3
        p = y*y*3+x*x+x*y*2
        if p<N+1:
            ans[p-1] += 3

for x in range(1,maxa):
    p = x*x*6
    if p<N+1:
        ans[p-1] += 1

for x in range(0,N):
    print(int(ans[x]))

Buggy submission (verdict: Runtime Error):
import numpy as np

N = int(input())

"""
for i in range(1,int(N)+1):
    count = 0
    if i > 3:
        maxa = int(np.sqrt(i-2))
        for x in range(1,maxa):
            for y in range(1,maxa):
                for z in range(1,maxa):
                    if x*x+y*y+z*z+x*y+y*z+z*x > i:
                        break
                    if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count +=1

    print(count)

"""
ans = np.zeros(int(N))

maxa = int(np.sqrt(N-2))
for x in range(0,maxa):
    for y in range(0,x):
        for z in range(0,y):
            p = x*x+y*y+z*z+x*y+y*z+z*x
            if p<N+1:
                ans[p-1] += 6


for x in range(0,maxa):
    for y in range(0,x):
        p = x*x*3+y*y+x*y*2
        if p<N:
            ans[p-1] += 3


for x in range(0,maxa):
    p = x*x*6
    if p<N:
        ans[p-1] += 1

for x in range(0,N):
    print(int(ans[x]))