Problem p02888 (python)

Fixed submission:
import bisect
n = int(input())

li = list(map(int, input().split()))
li.sort()

count = 0

for i in range(n - 2):
  for j in range(i + 1, n - 1):
    bi = bisect.bisect_left(li, li[i] + li[j])
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
ls = list(map(int, input().split()))
ls.sort()

count = 0

for i in range(n - 2):
  a = ls[i]
  for j in range(i + 1, n - 1):
    b = ls[j]
    index = bisect.bisect_left(ls, a + b):
    count += index - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
n = int(input())
ls = list(map(int, input().split())).sort()
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    bi = bisect_left(ls, ls[i] + ls[j])
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())

li = list(map(int, input().split()))
li.sort()

count = 0

for i in range(n-2):
	for j in range(i+1, n-1):
    	bi = bisect.bisect_left(li, li[i] + li[j])
    	count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())

li = list(map(int, input().split()))
li.sort()

count = 0

for i in range(n - 2):
	for j in range(i + 1, n - 1):
    	bi = bisect.bisect_left(li, li[i] + li[j])
    	count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())

li = list(map(int, input().split())).sort()

count = 0

for i in range(n - 2):
  for j in range(i + 1, n - 1):
    bi = bisect.bisect_left(li, li[i] + li[j])
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())
ls = list(map(int, input().split())).sort()
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i] + ls[j]
    bi = bisect.bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

n = int(input())
ls = list(map(int, input().split())).sort()
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i] + ls[j]
    bi = bisect_left(ls, two_sides_sum)
    count += bi-j-1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

n = int(input())
ls = list(map(int, input().split())).sort()
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i] + ls[j]
    bi = bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

n = int(input())
ls = list(map(int, input().split())).sort()
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i]+ ls[j]
    bi = bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

n = input()
ls = list(map(int, input().split())).sort()
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i]+ ls[j]
    bi = bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

n = input()
ls = list(map(int, input().split())).sort
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i]+ ls[j]
    bi = bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

n = input()
ls = list(map(int, input().split()))
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i]+ ls[j]
    bi = bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

n = input()
ls = list(map(int, input().split()))
count = 0
for i in range(0, n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i]+ ls[j]
    bi = bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

n = input()
ls = list(map(int, input().split()))
count = 0
for i in range(0, n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i]+ ls[j]
    for k in range(j + 1, n):
      if two_sides_sum <= ls[k]:
        count += k - j - 1
        break
print(count)

Buggy submission (verdict: Runtime Error):
n = input()
ls = list(map(int, input().split()))
count = 0
for i in range(0, n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = i + j
    for k in range(j + 1, n):
      if two_sides_sum <= ls[k]:
        count += k - j - 1
        break
print(count)