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

@numba.jit(nopython=True)
def main(ls):
    total = 0

    for i in range(len(ls) - 2):
        for j in range(i + 1, len(ls) - 1):
            a = ls[i]
            b = ls[j]
            ls2 = ls[j + 1:]
            if a + b == ls2[0]:
                 num = 0
            else:
                 num = np.searchsorted(ls2, a + b, side='right')
            total += num

    print(total)


_n = input()
ls = np.array(list(sorted(map(int, input().strip().split()))))

main(ls)


Fixed submission:
import bisect


def main(ls):
    total = 0

    for i in range(len(ls) - 2):
        for j in range(i + 1, len(ls) - 1):
            a = ls[i]
            b = ls[j]
            left = j + 1
            num = bisect.bisect_left(ls, a + b) - left
            total += num

    print(total)


_n = input()
ls = list(sorted(map(int, input().strip().split())))

main(ls)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import numpy as np
n = int(input())
ls = np.array(list(sorted(map(int, input().strip().split()))))

total = 0

for i in range(len(ls) - 2):
    for j in range(i + 1, len(ls) - 1):
        a = ls[i]
        b = ls[j]
        ls2 = ls[j + 1:]
        if a + b == ls2[0]:
            num = 0
        else:
            num = bisect.bisect_right(ls2, a + b)
        total += num

print(total)


Fixed submission:
import bisect


def main(ls):
    total = 0

    for i in range(len(ls) - 2):
        for j in range(i + 1, len(ls) - 1):
            a = ls[i]
            b = ls[j]
            left = j + 1
            num = bisect.bisect_left(ls, a + b) - left
            total += num

    print(total)


_n = input()
ls = list(sorted(map(int, input().strip().split())))

main(ls)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import numpy as np
n = int(input())
ls = np.array(list(sorted(map(int, input().strip().split()))))

total = 0

for i in range(len(ls) - 2):
    for j in range(i + 1, len(ls) - 1):
        a = ls[i]
        b = ls[j]
        ls2 = ls[j + 1:]
        if a + b == ls2[0]:
            num = 0
        else:
            num = bisect.bisect_right(ls2, a + b)
        total += num

print(total)


Fixed submission:
import bisect


def main(ls):
    total = 0

    for i in range(len(ls) - 2):
        for j in range(i + 1, len(ls) - 1):
            a = ls[i]
            b = ls[j]
            left = j + 1
            num = bisect.bisect_left(ls, a + b) - left
            total += num

    print(total)


_n = input()
ls = list(sorted(map(int, input().strip().split())))

main(ls)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(sorted(map(int, input().strip().split())))

possibles = set()

for i in range(len(ls)):
    for j in range(len(ls)):
        if i == j:
            continue
        for k in range(len(ls)):
            if i == k or j == k:
                continue
            a = ls[i]
            b = ls[j]
            c = ls[k]

            if a < b + c and b < c + a and c < a + b:
                possibles.add(tuple(sorted((a, b, c))))

print(len(possibles))


Fixed submission:
import bisect


def main(ls):
    total = 0

    for i in range(len(ls) - 2):
        for j in range(i + 1, len(ls) - 1):
            a = ls[i]
            b = ls[j]
            left = j + 1
            num = bisect.bisect_left(ls, a + b) - left
            total += num

    print(total)


_n = input()
ls = list(sorted(map(int, input().strip().split())))

main(ls)