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

N=int(input())
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(N-2):
    for j in range(i+1,N-1):
        total+= bisect.bisect_left(D[j+1:],D[i]+D[j])

print(total)

Fixed submission:
import bisect

N=int(input())
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(N-2):
    for j in range(i+1,N-1):
        total+=bisect.bisect_left(D,D[i]+D[j])-j-1

print(total)

Buggy python submission (verdict: Runtime Error):
import bisect

N=[int(x)for x in input().split()]
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(N-2):
    for j in range(i+1,N-1):
        total+= bisect.bisect_left(D[j+1:],D[i]+D[j])

print(total)

Fixed submission:
import bisect

N=int(input())
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(N-2):
    for j in range(i+1,N-1):
        total+=bisect.bisect_left(D,D[i]+D[j])-j-1

print(total)

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

N=[int(x)for x in input().split()]
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(len(D)-2):
    for j in range(i+1,len(D)-1):
        total+= bisect.bisect_left(D[j+1:],D[i]+D[j])

print(total)

Fixed submission:
import bisect

N=int(input())
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(N-2):
    for j in range(i+1,N-1):
        total+=bisect.bisect_left(D,D[i]+D[j])-j-1

print(total)

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

N=[int(x)for x in input().split()]
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(len(D)-2):
    for j in range(i+1,len(D)-1):
        v=D[i]-D[j]
        total+= bisect.bisect_left(D[j+1:],D[i]+D[j])


print(total)


Fixed submission:
import bisect

N=int(input())
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(N-2):
    for j in range(i+1,N-1):
        total+=bisect.bisect_left(D,D[i]+D[j])-j-1

print(total)

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

N=[int(x)for x in input().split()]
D=[int(x) for x in input().split()]

D.sort(reverse=True)
total=0
# print(D)
def check(a,b,c): #3
    if(a<b+c):
        if(b<a+c):
            if(c<a+b):
                return True
    return False

for i in range(len(D)-1):
    for j in range(i+1,len(D)-1):
        #print("i="+str(i)+" j="+str(j))
        v=D[i]-D[j]
        # print(D[:j:-1])
        # print("v="+str(v))
        # print(len(D[:j:-1]) -bisect.bisect_left(D[:j:-1],v))
        total+=len(D[:j:-1]) - bisect.bisect_left(D[:j:-1],v+0.1)


        # for k in range(j + 1, len(D)):
        #     if(check(D[i],D[j],D[k])):
        #         total+=1
        #         print(str(i)+" "+str(j)+" "+str(k)+"   "+str(total))


print(total)

Fixed submission:
import bisect

N=int(input())
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(N-2):
    for j in range(i+1,N-1):
        total+=bisect.bisect_left(D,D[i]+D[j])-j-1

print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N=[int(x)for x in input().split()]
D=[int(x) for x in input().split()]

total=0

def check(a,b,c):
    if(a<b+c):
        if(b<a+c):
            if(c<a+b):
                return True
    return False

for i in range(len(D)):
    for j in range(i+1,len(D)):
        for k in range(j + 1, len(D)):
            if(check(D[i],D[j],D[k])):
                total+=1

print(total)


Fixed submission:
import bisect

N=int(input())
D=[int(x) for x in input().split()]

D.sort()
total=0

for i in range(N-2):
    for j in range(i+1,N-1):
        total+=bisect.bisect_left(D,D[i]+D[j])-j-1

print(total)