Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l, l[i] + l[j])
        ans += k - j - 1
print(ans)


Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l[j:], l[i] + l[j]) + j
        ans += k - j - 1
print(ans)


Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left

n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(n):
    for j in range(i+1,n):
        k = bisect_left(l[j:], l[i] + l[j]) + j
        ans += k - j - 1
print(ans)

Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left

n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(len(l)):
    for j in range(len(l))[i + 1:]:
        k = bisect_left(l[j:], l[i] + l[j]) + j
        ans += k - j - 1
print(ans)


Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left

n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(len(l)):
    for j in range(len(l))[i + 1:]:
        k = bisect_left(l[j:], l[i] + l[j]) + j
        ans += len(l[j:k]) - 1
print(ans)


Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(len(l)):
    for j in range(len(l))[i + 1:]:
        k = bisect_left(l[j:], l[i] + l[j]) + j
        ans += len(l[j:k]) - 1
print(ans)


Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(len(l)):
    for j in range(len(l))[i + 1:]:
        k = bisect(l[j+1:], l[i] + l[j]) + j+1
        ans += len(l[j+1:k])
print(ans)

Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import collections as cl
n=int(input())
l=np.asarray(list(map(int,input().split())))
rng=np.arange(n)
i=np.tile(rng,(n**2,1)).T.ravel()
j=np.tile(np.tile(rng.copy(),(n,1)).ravel(),(n,1)).T.ravel()
k=np.tile(rng.copy(),(n**2,1)).ravel()
tmp=(l[i]<l[j]+l[k])*(l[j]<l[i]+l[k])*(l[k]<l[i]+l[j])*(i!=j)*(i!=k)*(j!=k)
tmp=np.asarray(np.where(tmp.reshape(n,n,n))).T.astype(str)
tmp.sort(axis=-1)
ans=[]
for t in tmp:
    ans.append(t[0]+t[1]+t[2])
print(len(cl.Counter(ans)))

Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import collections as cl
n=int(input())
l=np.asarray(list(map(int,input().split())))
i=np.tile(np.arange(len(l)),(n**2,1)).T.ravel()
j=np.tile(np.tile(np.arange(len(l)),(n,1)).ravel(),(n,1)).T.ravel()
k=np.tile(np.arange(n),(n**2,1)).ravel()
tmp=(l[i]<l[j]+l[k])*(l[j]<l[i]+l[k])*(l[k]<l[i]+l[j])*(i!=j)*(i!=k)*(j!=k)
tmp=np.asarray(np.where(tmp.reshape(n,n,n))).T.astype(str)
tmp.sort(axis=-1)
ans=[]
for t in tmp:
    ans.append(t[0]+t[1]+t[2])
print(len(cl.Counter(ans)))

Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import collections as cl
n=int(input())
l=np.asarray(list(map(int,input().split())))
i=np.tile(np.arange(len(l)),(n**2,1)).T.ravel()
j=np.tile(np.tile(np.arange(len(l)),(n,1)).ravel(),(n,1)).T.ravel()
k=np.tile(np.arange(n),(n**2,1)).ravel()
tmp=(l[i]<l[j]+l[k])*(l[j]<l[i]+l[k])*(l[k]<l[i]+l[j])*(i!=j)*(i!=k)*(j!=k)
tmp=np.asarray(np.where(tmp.reshape(n,n,n))).T.astype(str)
tmp.sort(axis=-1)
ans=[]
for t in tmp:
    ans.append(t[0]+t[1]+t[2])
print(len(cl.Counter(ans)))

Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

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

Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(len(l)):
    for j in range(i+1,len(l)):
        for k in range(j+1,len(l)):
            if l[i]<l[j]+l[k] and l[j]<l[i]+l[k] and l[k]<l[i]+l[j]:
                ans+=1
print(ans)

Fixed submission:
from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)