Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())

l = np.array([int(i) for i in input().split()])
l.sort()

c = np.bincount(l,minlength = 2100)

cum = list(c.cumsum())

ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += cum[min(l[i]+l[j]-1, 1000)] - (j+1)
print(ans)


Fixed submission:
import bisect
n = int(input())
l = sorted([int(i) for i in input().split()])

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

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())

l = np.array([int(i) for i in input().split()])
l.sort()

c = np.bincount(l,minlength = 2100)

cum = list(c.cumsum())

ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += cum[min(l[i]+l[j]-1, 1000)] - (j+1)
print(ans)


Fixed submission:
import bisect
n = int(input())
l = sorted([int(i) for i in input().split()])

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

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())

l = np.int32(input().split())
l.sort()

c = np.bincount(l,minlength = 2100)

cum = c.cumsum()

ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += cum[min(l[i]+l[j]-1, 1000)] - (j+1)
print(ans)


Fixed submission:
import bisect
n = int(input())
l = sorted([int(i) for i in input().split()])

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

Buggy python submission (verdict: Runtime Error):
import numpy as np
from numba import njit
 
@njit
def count(l,n):
  ct = 0
  for i in range(n):
    for j in range(i + 1, n):
      for k in range(j + 1, n):
        ct += (l[k] < l[i] + l[j])
  return ct

         
n = int(input())
l = np.int32(input().split())
l.sort()

ans = count(l,n)

print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted([int(i) for i in input().split()])

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

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = input()
l = [int(i) for i in input().split()]

p = list(itertools.combinations(l,3))

ans = 0
for i in p:
    if i[0] >= i[1] + i[2]:
        pass
    elif i[1] >= i[0] + i[2]:
        pass
    elif i[2] >= i[0] + i[1]:
        pass
    else:
        ans += 1

print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted([int(i) for i in input().split()])

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

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = input()
l = [int(i) for i in input().split()]

p = list(itertools.combinations(l,3))
        
ans = [1 for i in p if i[0] < i[1] + i[2] and  i[1] < i[0] + i[2] and i[2] < i[0] + i[1]]

print(len(ans))

Fixed submission:
import bisect
n = int(input())
l = sorted([int(i) for i in input().split()])

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