Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N=int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    a=l[i]
    b=l[j]
    ans+=i-bisect.bisect_right(l[:i],b-a)
print(ans)

Fixed submission:
import bisect
N=int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m=bisect.bisect_right(l,l[j]-l[i])
    if i>m:
      ans+=i-m
print(ans)

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

Fixed submission:
import bisect
N=int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m=bisect.bisect_right(l,l[j]-l[i])
    if i>m:
      ans+=i-m
print(ans)

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

Fixed submission:
import bisect
N=int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m=bisect.bisect_right(l,l[j]-l[i])
    if i>m:
      ans+=i-m
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
import math
N=int(input())
l1=list(map(int,input().split()))
max_n=max(l1)
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans=comb(N,3)
for i,j in combinations(l1,2):
  for k in l1:
    if i+j<=k:
      ans-=1
print(ans)

Fixed submission:
import bisect
N=int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m=bisect.bisect_right(l,l[j]-l[i])
    if i>m:
      ans+=i-m
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
import math
N=int(input())
l1=list(map(int,input().split()))
max_n=max(l1)
l2=tuple(combinations(l1,2))
l3=[sum(i) for i in l2 if sum(i)<=max_n]
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans=comb(N,3)
for i in l3:
  for j in l1:
    if i<=j:
      ans-=1
print(ans)

Fixed submission:
import bisect
N=int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m=bisect.bisect_right(l,l[j]-l[i])
    if i>m:
      ans+=i-m
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
import math
N=int(input())
l1=list(map(int,input().split()))
max_n=max(l1)
l2=tuple(combinations(l1,2))
l3=[sum(i) for i in l2 if sum(i)<=max_n]
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans=comb(N,3)
for i in l3:
  for j in l1:
    if i<=j:
      ans-=1
print(ans)

Fixed submission:
import bisect
N=int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m=bisect.bisect_right(l,l[j]-l[i])
    if i>m:
      ans+=i-m
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N=int(input())
l1=list(map(int,input().split()))
l2=tuple(combinations(l1,2))
l3=[sum(i) for i in l2 if sum(i)<=max(l1)]
ans=len(tuple(combinations(l1,3)))
for i in l3:
  for j in l1:
    if i<=j:
      ans-=1
print(ans)

Fixed submission:
import bisect
N=int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m=bisect.bisect_right(l,l[j]-l[i])
    if i>m:
      ans+=i-m
print(ans)