Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n-2):
  a = l[i]
  for j in range(i + 1, n-1):
    ans += bisect.bisect_left(l, l[j]+a, lo = j + 1)-j-1
print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
  a = l[i]
  for j in range(i + 1, n):
    b = l[j]
    ans += bisect.bisect_left(l, b+a, lo = j + 1)-j-1
print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
  a = l[i]
  for j in range(i + 1, n):
    b = l[j]
    ans += (bisect.bisect_left(l, b+a, lo = j + 1)-j-1)
print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
)import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
import bisect
ans = 0
for i in range(n):
  a = l[i]
  for j in range(i + 1, n):
    b = l[j]
    bel = bisect.bisect_left(l, b+a, lo = j + 1)
    ans += (bel-j-1)
print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
ans = 0
for i in range(n):
  a = l[i]
  for j in range(i + 1, n):
    b = l[j]
    bel1 = j #OK
    up1 = n #OUT
    while up1- bel1 > 1:
      mid = (bel1 + up1)//2
      if a + b > l[mid]:
        bel1 = mid
      else:
        up1 = mid
    ans += (bel1-j)
print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split()))
l = sorted(l)
ans = 0
for i in range(n):
  a = l[i]
  for j in range(i + 1, n):
    b = l[j]
    bel1 = j #OK
    up1 = n #OUT
    while up1- bel1 > 1:
      mid = (bel1 + up1)//2
      if a + b > l[mid]:
        bel1 = mid
      else:
        up1 = mid
    ans += (bel1-j)
print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
ans = 0
for i in range(n):
  a = l[i]
  for j in range(i + 1, n):
    b = l[j]
    bel1 = 0 #OK
    up1 = n #OUT
    while up1- bel1 > 1:
      mid = (bel1 + up1)//2
      if a + b > l[mid]:
        bel1 = mid
      else:
        up1 = mid
    ans += (bel1-j)
print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
count = 0
for i in range(N):
  a = L[i]
  for j in range(i + 1, N):
    b = L[j]
    for k in range(j + 1, N):
      if a + b > L[k] and a + L[k] > b and b + L[k] > a:
        count += 1
print(count)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
 
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)