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

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

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

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

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

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

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

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

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

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
length = list(map(int, input().split()))
length = sorted(length)
count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
               if length[k] < length[i]+length[j]:
                   count += 1
               else:
                   pass
print(count)

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

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

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