Problem: Takahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.  He is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:    * a < b + c   * b < c + a   * c < a + b  How many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.

Submission attempts (in order):
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
 
for i in range(len(l)):
    for j in range(i+1,len(l)):
        if j >= l[i]+l[j]:
            a+=1
        
 
print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
print(l)
for i in range(n):
    for j in range(i+1,n):
        s = bisect.bisect_left(l,l[i]+l[j])-j-1
        a+=s


print(a)

n = int(input())

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

a = 0

for i in range(len(l)):
    for j in range(i+1,len(l)):
        a = a + int(len(for k in l if i > l[i]+l[j]))
        

print(a)

n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
 
for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        if j >= l[i]+l[j]:
            a+=1
        
 
print(a)

n = int(input())

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

a = 0

for i in range(len(l)):
    for j in range(i+1,len(l)):
        if j > l[i]+l[j]:
            a+=1
        

print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
 
for i in range(n-2):
    for j in range(i+1,n-1):
        s = bisect.bisect_left(l[i]+l[j])
        a += n-s-1 


print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
print(l)
for i in range(n-2):
    for j in range(i+1,n-1):
        s = bisect.bisect_left(l,l[i]+l[j])-j-1
        a +=s


print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
print(l)
for i in range(n-2):
    for j in range(i+1,n-1):
        s = bisect.bisect_left(l,l[i]+l[j])-j
        a +=s


print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
 
for i in range(n-2):
    for j in range(i+1,n-1):
        s = bisect.bisect_left(l,l[i]+l[j])
        a =a + n - s+1


print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
print(l)
for i in range(n-2):
    for j in range(i+1,n-1):
        s = bisect.bisect_left(l,l[i]+l[j])
        a =a + n - s-1


print(a)

n = int(input())
 
l = list(map(int, input().split()))
 
a = 0
 
for i in range(len(l)):
    for j in range(i+1,len(l)):
        if j > l[i]+l[j]:
            a+=1
        
 
print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
 
for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        s = bisect.bisect_left(l[i]+l[j])
        a += n-s-1 


print(a)

n = int(input())

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

a = 0

for i in range(len(l)):
    for j in range(i+1,len(l)):
        a = a + int(len([for k in l if i > l[i]+l[j]]))
        

print(a)

n = int(input())

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

a = 0

for i in range(len(l)):
    for j in range(i+1,len(l)):
        a = a + int(len([k for k in l if i > l[i]+l[j]]))
        

print(a)

n = int(input())

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

a = 0

for i in range(len(l)):
    for j in range(i+1,len(l)):
        if j > l[i]+l[j]]:
            a+=1
        

print(a)

n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
 
for i in range(len(l)):
    for j in range(i+1,len(l)):
        if j > l[i]+l[j]:
            a+=1
        
 
print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
 
for i in range(n-2):
    for j in range(i+1,n-1):
        s = bisect.bisect_left(l[i]+l[j])
        a =a + n - s+1


print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
 
for i in range(n-2):
    for j in range(i+1,n-1):
        s = bisect.bisect_left(l,l[i]+l[j])
        a =a + n - s


print(a)

import bisect
n = int(input())
 
l = list(map(int, input().split()))
l.sort()
a = 0
#print(l)
for i in range(n-2):
    for j in range(i+1,n-1):
        s = bisect.bisect_left(l,l[i]+l[j])-j-1
        a+=s


print(a)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted