Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split()))


def combinations(d, tmp_out, i, j):
    if (j >= N):
        i += 1
        j = i + 1
        if (i >= N):
            return tmp_out
        elif (j >= N):
            return tmp_out
    if (j >= N) or (i >= N):
        return tmp_out
    else:
        tmp_out += d[i] * d[j]
        return combinations(d, tmp_out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))

out = 0
for i in range(N):
    for j in range(i + 1, N):
        out += d[i] * d[j]

print(out)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split()))


def combinations(d, tmp_out, i, j):
    if (i >= N):
        return tmp_out
    elif (j >= N):
        i += 1
        j = i + 1
        if (i >= N):
            return tmp_out
        elif (j >= N):
            return tmp_out
    tmp_out += d[i] * d[j]

    return combinations(d, tmp_out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))

out = 0
for i in range(N):
    for j in range(i + 1, N):
        out += d[i] * d[j]

print(out)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split()))


def combinations(d, tmp_out, i, j):
    if (j >= N):
        i += 1
        j = i + 1
        if (i >= N):
            return tmp_out
        elif (j >= N):
            return tmp_out
    tmp_out += d[i] * d[j]

    return combinations(d, tmp_out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))

out = 0
for i in range(N):
    for j in range(i + 1, N):
        out += d[i] * d[j]

print(out)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split()))


def combinations(d, out, i, j):
    if (j >= N):
        i += 1
        j = i + 1
        if (i >= N):
            return out
        else:
            if (j >= N):
                return out
    out += d[i] * d[j]

    return combinations(d, out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))

out = 0
for i in range(N):
    for j in range(i + 1, N):
        out += d[i] * d[j]

print(out)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split()))


def combinations(d, out, i, j):
    if (j >= N):
        i += 1
        if (i >= N):
            return out
        else:
            j = i + 1
            if (j >= N):
                return out
    out += d[i] * d[j]

    return combinations(d, out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))

out = 0
for i in range(N):
    for j in range(i + 1, N):
        out += d[i] * d[j]

print(out)

Buggy python submission (verdict: Runtime Error):
import itertools

N = int(input())
d = list(map(int, input().split()))

print(sum([d[i - 1] * d[j - 1] for i, j in list(itertools.combinations(d, 2))]))

Fixed submission:
N = int(input())
d = list(map(int, input().split()))

out = 0
for i in range(N):
    for j in range(i + 1, N):
        out += d[i] * d[j]

print(out)