Problem p02608 (python)

Fixed submission:
import numpy as np


def calc(n):
    #     lim = int((n - 2) ** 0.5 - 1) + 1
    lim = 130

    result = np.zeros(n + 1, dtype=int)
    for x in range(1, lim):
        for y in range(1, lim):
            if x > y:
                continue
            for z in range(1, lim):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index > n:
                    continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]


for i in calc(int(input())):
    print(i)

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


def calc(n):
    lim = int((n - 2) ** 0.5 - 1) + 1
#     lim = 130

    result = np.zeros(n + 1, dtype=int)
    for x in range(1, lim):
        for y in range(x, lim):
            for z in range(y, lim):
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index > n:
                    continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]


for i in calc(int(input())):
    print(i)

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

def calc(n):
    if n < 2:
        return 0
#     lim = int((n - 2) ** 0.5 - 1) + 1
    lim=130

    result=np.zeros(n+1,dtype=int)
    for x in range(1, lim):
        for y in range(1, lim):
            if x > y:
                continue
            for z in range(1, lim):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index>n:continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]

for i in calc(int(input())):
    print(i)

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

def calc(n):
    if n < 2:
        return 0
    lim = int((n - 2) ** 0.5 - 1) + 1

    result=np.zeros(n+1,dtype=int)
    for x in range(1, lim):
        for y in range(1, lim):
            if x > y:
                continue
            for z in range(1, lim):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index>=n:continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]

for i in calc(int(input())):
    print(i)

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

def calc(n):
    if n < 2:
        return 0
    lim = int((n - 2) ** 0.5 - 1) + 1

    result=np.zeros(n+1,dtype=int)
    for x in range(1, lim):
        for y in range(1, lim):
            if x > y:
                continue
            for z in range(1, lim):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index>n:continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]

for i in calc(int(input())):
    print(i)

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

def calc(n):
    if n < 2:
        return 0
    lim1 = int((n - 2) ** 0.5 - 1) + 1
    lim2 = int((-2 + (4 - 12 * (1 - n)) ** 0.5) / 6) + 1
    lim3 = int(n / 6) + 1

    result=np.zeros(n+1,dtype=int)
    for x in range(1, lim3):
        for y in range(1, lim2):
            if x > y:
                continue
            for z in range(1, lim1):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index>n:continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]

for i in calc(int(input())):
    print(i)