Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import bisect

n = int(input())
l = np.array(list(map(int, input().split())))

l.sort()

ans = 0
for a in range(n - 2):
    for b in range(a + 1, n - 1):
        ans += bisect.bisect_left(l, l[a] + l[b]) - (b + 1)
print(ans)


Fixed submission:
import numpy as np
import bisect

n = int(input())
l = np.array(list(map(int, input().split())))

# l.sort()

# ans = 0
# for a in range(n - 2):
#     for b in range(a + 1, n - 1):
#         ans += bisect.bisect_left(l, l[a] + l[b]) - (a + 1)
# print(ans)

res = 0
l = sorted(l)
for i in range(1, n - 1):
    b = l[i]
    for j in range(0, i):
        a = l[j]
        res += bisect.bisect_left(l, a + b) - (i + 1)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
l = np.array(list(map(int, input().split())))

l = np.sort(l)[::-1]

cnt = 0
for a in range(n):
    for b in range(a + 1, n):
        for c in range(b + 1, n):
            if l[a] < (l[b] + l[c]) and l[b] < (l[a] + l[c]) and l[c] < (l[a] + l[b]):
                cnt += 1
            else:
                break

print(cnt)


Fixed submission:
import numpy as np
import bisect

n = int(input())
l = np.array(list(map(int, input().split())))

# l.sort()

# ans = 0
# for a in range(n - 2):
#     for b in range(a + 1, n - 1):
#         ans += bisect.bisect_left(l, l[a] + l[b]) - (a + 1)
# print(ans)

res = 0
l = sorted(l)
for i in range(1, n - 1):
    b = l[i]
    for j in range(0, i):
        a = l[j]
        res += bisect.bisect_left(l, a + b) - (i + 1)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
l = np.array(list(map(int, input().split())))

l = np.sort(l)[::-1]

cnt = 0
for a in range(n):
    for b in range(a, n):
        for c in range(b, n):
            if l[c] <= l[a] - l[b]:
                break
            if a != b and b != c and c != a:
                if l[a] < (l[b] + l[c]) and l[b] < (l[a] + l[c]) and l[c] < (l[a] + l[b]):
                    cnt += 1

print(cnt)


Fixed submission:
import numpy as np
import bisect

n = int(input())
l = np.array(list(map(int, input().split())))

# l.sort()

# ans = 0
# for a in range(n - 2):
#     for b in range(a + 1, n - 1):
#         ans += bisect.bisect_left(l, l[a] + l[b]) - (a + 1)
# print(ans)

res = 0
l = sorted(l)
for i in range(1, n - 1):
    b = l[i]
    for j in range(0, i):
        a = l[j]
        res += bisect.bisect_left(l, a + b) - (i + 1)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
l = np.array(list(map(int, input().split())))

l = np.sort(l)[::-1]

cnt = 0
for a in range(n):
    for b in range(a, n):
        for c in range(b, n):
            if a != b and b != c and c != a:
                if l[a] > (l[b] + l[c]):
                    break
                if l[a] < (l[b] + l[c]) and l[b] < (l[a] + l[c]) and l[c] < (l[a] + l[b]):
                    cnt += 1

print(cnt)


Fixed submission:
import numpy as np
import bisect

n = int(input())
l = np.array(list(map(int, input().split())))

# l.sort()

# ans = 0
# for a in range(n - 2):
#     for b in range(a + 1, n - 1):
#         ans += bisect.bisect_left(l, l[a] + l[b]) - (a + 1)
# print(ans)

res = 0
l = sorted(l)
for i in range(1, n - 1):
    b = l[i]
    for j in range(0, i):
        a = l[j]
        res += bisect.bisect_left(l, a + b) - (i + 1)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
l = np.array(list(map(int, input().split())))

cnt = 0
for a in range(n):
    for b in range(a, n):
        for c in range(b, n):
            if a != b and b != c and c != a:
                if l[a] < (l[b] + l[c]) and l[b] < (l[a] + l[c]) and l[c] < (l[a] + l[b]):
                    cnt += 1

print(cnt)


Fixed submission:
import numpy as np
import bisect

n = int(input())
l = np.array(list(map(int, input().split())))

# l.sort()

# ans = 0
# for a in range(n - 2):
#     for b in range(a + 1, n - 1):
#         ans += bisect.bisect_left(l, l[a] + l[b]) - (a + 1)
# print(ans)

res = 0
l = sorted(l)
for i in range(1, n - 1):
    b = l[i]
    for j in range(0, i):
        a = l[j]
        res += bisect.bisect_left(l, a + b) - (i + 1)
print(res)