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

import itertools
C = list(itertools.combinations(L,3))
l = len(C)

for i in range(l):
    s = sorted(C[i])
    if s[0] + s[1] <= s[2]:
        pass
    else:
        count = count + 1

print(count)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
C = sorted(L)
count = 0

import bisect
for i in range(N - 2):
    for  j in range(N - i - 2):
        s = C[i] + C[j + i + 1]
        t = bisect.bisect_left(C,s)
        u = t - (j + i + 1) - 1
        if u <= 0:
            pass
        else:
            count = count + u

print(count)

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

import itertools
C = list(itertools.combinations(L,3))
l = len(C)

for i in range(l):
    if C[i][0] + C[i][1] <= C[i][2]:
        pass
    elif C[i][1] + C[i][2] <= C[i][0]:
        pass
    elif C[i][2] + C[i][0] <= C[i][1]:
        pass
    else:
        count = count + 1

print(count)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
C = sorted(L)
count = 0

import bisect
for i in range(N - 2):
    for  j in range(N - i - 2):
        s = C[i] + C[j + i + 1]
        t = bisect.bisect_left(C,s)
        u = t - (j + i + 1) - 1
        if u <= 0:
            pass
        else:
            count = count + u

print(count)

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

for i in range(N - 2):
    for j in range(N - i - 2):
        for k in range(N - i - j - 2):
            if L[i] + L[i + j + 1] <= L[i + j + k + 2]:
                pass
            elif L[i + j + 1] + L[i + j + k + 2] <= L[i]:
                pass
            elif L[i + j + k + 2] + L[i] <= L[i + j + 1]:
                pass
            else:
                count = count + 1

print(count)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
C = sorted(L)
count = 0

import bisect
for i in range(N - 2):
    for  j in range(N - i - 2):
        s = C[i] + C[j + i + 1]
        t = bisect.bisect_left(C,s)
        u = t - (j + i + 1) - 1
        if u <= 0:
            pass
        else:
            count = count + u

print(count)

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

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

print(count)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
C = sorted(L)
count = 0

import bisect
for i in range(N - 2):
    for  j in range(N - i - 2):
        s = C[i] + C[j + i + 1]
        t = bisect.bisect_left(C,s)
        u = t - (j + i + 1) - 1
        if u <= 0:
            pass
        else:
            count = count + u

print(count)

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

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

print(count)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
C = sorted(L)
count = 0

import bisect
for i in range(N - 2):
    for  j in range(N - i - 2):
        s = C[i] + C[j + i + 1]
        t = bisect.bisect_left(C,s)
        u = t - (j + i + 1) - 1
        if u <= 0:
            pass
        else:
            count = count + u

print(count)