Buggy python submission (verdict: Time Limit Exceeded):
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
count=0
L.sort()
for i in range(0,N-1):
  for j in range(i+1,N):
    index=bisect.bisect_left(L[j+1:],L[i]+L[j])
    count+=index
print(count)

Fixed submission:
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
count=0
for i in range(N):
  for j in range(i+1,N):
    c=L[i]+L[j]
    index=bisect.bisect_left(L,c)
    count+=max(0,index-j-1)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
count=0
L.sort()
for i in range(0,N-1):
  for j in range(i+1,N):
    index=bisect.bisect_left(L[j+1:],L[i]+L[j])
    count+=index
print(count)

Fixed submission:
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
count=0
for i in range(N):
  for j in range(i+1,N):
    c=L[i]+L[j]
    index=bisect.bisect_left(L,c)
    count+=max(0,index-j-1)
print(count)

Buggy python submission (verdict: Runtime Error):
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
for i in range(0,N):
  for j in range(i+1,N):
    index=bisect.bisect_left(L,L[i]+L[j])
    count+=index-j-i
print(count)

Fixed submission:
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
count=0
for i in range(N):
  for j in range(i+1,N):
    c=L[i]+L[j]
    index=bisect.bisect_left(L,c)
    count+=max(0,index-j-1)
print(count)

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

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

count=0
L=sorted(L)
for i in range(0,N-1):
  for j in range(i+1,N):
    index=bisect.bisect_left(L[j+1:],L[i]+L[j])
    count+=index
print(count)

Fixed submission:
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
count=0
for i in range(N):
  for j in range(i+1,N):
    c=L[i]+L[j]
    index=bisect.bisect_left(L,c)
    count+=max(0,index-j-1)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
count=0
while len(L)>=3:
  a=L.pop()
  for i in range(len(L)-1):
    for j in range(i+1,len(L)):
      if a<L[i]+L[j]:
        count+=1
print(count)

Fixed submission:
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
count=0
for i in range(N):
  for j in range(i+1,N):
    c=L[i]+L[j]
    index=bisect.bisect_left(L,c)
    count+=max(0,index-j-1)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
L=sorted(L,reverse=True)
count=0
for i in range(0,N-2):
  for j in range(i+1,N-1):
    for k in range(j+1,N):
      if L[k]+L[j]<=L[i]:
        break
      if L[i]+L[k]<=L[j]:
        break
      if L[j]+L[i]>L[k]:
        count+=1
      
print(count)

Fixed submission:
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
count=0
for i in range(N):
  for j in range(i+1,N):
    c=L[i]+L[j]
    index=bisect.bisect_left(L,c)
    count+=max(0,index-j-1)
print(count)

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

Fixed submission:
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
count=0
for i in range(N):
  for j in range(i+1,N):
    c=L[i]+L[j]
    index=bisect.bisect_left(L,c)
    count+=max(0,index-j-1)
print(count)