Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(0,n-2):
  for j in range(i+1,n-1):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)    
    

Fixed submission:
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(0,n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[k]<l[i]+l[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(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[map(int,input().split())]
l.sort()
ans=0
for i in range(0,n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[k]<l[i]+l[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(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[map(int,input().split)]
l.sort()
ans=0
for i in range(0,n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[k]<l[i]+l[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(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=int(input())
ans=0
for i in range(0,len(l)):
    for j in range(i+1,len(l)):
        for k in range(j+1,len(l)):
            if l[i]>=l[j] and l[i]>=l[k]:
                if l[i]>l[j]+l[k]:
                    ans+=1
                else:
                    ans+=0
            if l[j]>=l[i] and l[j]>=l[k]:
                if l[j]>l[i]+l[k]:
                    ans+=1
                else:
                    ans+=0
            if l[k]>=l[i] and l[k]>=l[j]:
                if l[k]>l[i]+l[j]:
                    ans+=1
                else:
                    ans+=0   
print(ans)       

Fixed submission:
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=int(input())
ans=0
for i in range(0,len(l)):
  for j in range(i+1,len(l)):
    for k in range(j+1,len(l)):
      if l[i]>=l[j] and l[i]>=l[k]:
        if l[i]>l[j]+l[k]:
          ans+=1
        else:
          ans+=0
      if l[j]>=l[i] and l[j]>=l[k]:
        if l[j]>l[i]+l[k]:
          ans+=1
        else:
          ans+=0
      if l[k]>=l[i] and l[k]>=l[j]:
        if l[k]>l[i]+l[j]:
          ans+=1
        else:
          ans+=0   
print(ans)          


Fixed submission:
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(int,input())
ans=0
for i in range(0,len(l)):
  for j in range(i+1,len(l)):
    for k in range(j+1,len(l)):
      if l[i]>=l[j] and l[i]>=l[k]:
        if l[i]>l[j]+l[k]:
          ans+=1
        else:
          ans+=0
      if l[j]>=l[i] and l[j]>=l[k]:
        if l[j]>l[i]+l[k]:
          ans+=1
        else:
          ans+=0
      if l[k]>=l[i] and l[k]>=l[j]:
        if l[k]>l[i]+l[j]:
          ans+=1
        else:
          ans+=0   
print(ans)          


Fixed submission:
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(int,input())
ans=0
for i in range(0,len(l)):
  for j in range(i+1,len(l)):
    for k in range(j+1,len(l)):
      if i>=j and i>=k:
        if i>j+k:
          ans+=1
        else:
          ans+=0
      if j>=i and j>=k:
        if j>i+k:
          ans+=1
        else:
          ans+=0
      if k>=i and k>=j:
        if k>i+j:
          ans+=1
        else:
          ans+=0   
print(ans)          

Fixed submission:
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)