Buggy python submission (verdict: Time Limit Exceeded):
import bisect as bi
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)
#print(l)
for i in range(N-2):
    for j in range(i+1,N-1):
        count+=bi.bisect_right(l[j+1:],l[i]+l[j]-1)
         
print(count)

Fixed submission:
import bisect as bi
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)
#print(l)
for i in range(N-2):
    for j in range(i+1,N-1):
        count+=bi.bisect_left(l,l[i]+l[j],j+1)-j-1
         
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect as bi
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)
#print(l)
for i in range(N-2):
    for j in range(i+1,N-1):
        index=bi.bisect_right(l[j+1:],l[i]+l[j]-1)
        count+=index
        
print(count)

Fixed submission:
import bisect as bi
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)
#print(l)
for i in range(N-2):
    for j in range(i+1,N-1):
        count+=bi.bisect_left(l,l[i]+l[j],j+1)-j-1
         
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)
#print(l)
for i in range(N-2):
    for j in range(i+1,N-1):
        a=j
        b=N
        while a+1!=b and a!=b:
            if l[(a+b)//2]<l[i]+l[j]:
                a=(a+b)//2
            else:
                b=(a+b)//2
        #print(a,b)
        if a!=b:
            count+=a-j
        else:
            if a==b:
                if l[a]<l[i]+l[j]:
                    count+=b-j
                elif l[a]>l[i]+l[j]:
                    pass
            else:
                if l[a]<l[i]+l[j]:
                    count+=a-j



print(count)

Fixed submission:
import bisect as bi
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)
#print(l)
for i in range(N-2):
    for j in range(i+1,N-1):
        count+=bi.bisect_left(l,l[i]+l[j],j+1)-j-1
         
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(1,N-j):
            if l[i]+l[j]>l[N-k]:
                count+=N-k-j
                break



print(count)

Fixed submission:
import bisect as bi
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)
#print(l)
for i in range(N-2):
    for j in range(i+1,N-1):
        count+=bi.bisect_left(l,l[i]+l[j],j+1)-j-1
         
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L,reverse=True)

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if l[i]<l[j]+l[k]:
                count+=1



print(count)

Fixed submission:
import bisect as bi
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)
#print(l)
for i in range(N-2):
    for j in range(i+1,N-1):
        count+=bi.bisect_left(l,l[i]+l[j],j+1)-j-1
         
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it
N=int(input())
L=list(map(int,input().split()))

count=0
L.sort()
A=list(it.combinations(L,3))

for a in A:
    if a[2]<a[0]+a[1]:
        count+=1

print(count)

Fixed submission:
import bisect as bi
N=int(input())
L=list(map(int,input().split()))

count=0
l=sorted(L)
#print(l)
for i in range(N-2):
    for j in range(i+1,N-1):
        count+=bi.bisect_left(l,l[i]+l[j],j+1)-j-1
         
print(count)