Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N=int(input())
L=np.array(list(map(int, input().split())))
S=0
L.sort()
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i]+L[j]>L[k]:
                S+=1
            else:
                break
print(S)

Fixed submission:
import bisect

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

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

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
L=np.array(list(map(int, input().split())))
S=0
L.sort()
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i]+L[j]>L[k]:
                S+=1
            else:
                break
print(S)

Fixed submission:
import bisect

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

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

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

Fixed submission:
import bisect

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

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

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
L=list(map(int, input().split()))
S=0
L.sort()
C=list(itertools.combinations(L,3))
for i in range(len(C)):
    if C[i][0]+C[i][1]>C[i][2]:
        S+=1
print(S)

Fixed submission:
import bisect

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

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

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N=int(input())
L=np.array(list(map(int, input().split())))
S=0
L.sort()
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i]+L[j]>L[k]: 
                S+=1
            else:
                break
print(S)

Fixed submission:
import bisect

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

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

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
L=list(map(int, input().split()))
S=0
C=list(itertools.combinations(L,3))
for i in range(len(C)):
    if max(C[i])*2<sum(C[i]):
        S+=1
print(S)

Fixed submission:
import bisect

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

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

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
L=list(map(int, input().split()))
S=0
C=list(itertools.combinations(L,3))
for i in range(len(C)):
    if C[i][0]+C[i][1]>C[i][2] and C[i][1]+C[i][2]>C[i][0] and C[i][2]+C[i][0]>C[i][1]:
        S+=1
print(S)

Fixed submission:
import bisect

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

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

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

Fixed submission:
import bisect

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

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