Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split(" ")))
L.sort() #小さい順
counter = 0

for i in range(N):
  for j in range(i+1, N):
    for k in range(j+1, N):
      if L[i] + L[j] <= L[k]:
        break
      else:
        counter += 1
       
print(counter)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split(" ")))
L.sort() #小さい順
counter = 0

for i in range(N-2):
  for j in range(i+1, N-1):
    index = bisect.bisect_left(L, L[i]+L[j], 0, N)
    counter = counter + index - j - 1
       
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split(" ")))
L.sort() #小さい順
counter = 0

for num_1, i in enumerate(L):
  for num_2, j in enumerate(L):
    if num_1 <= num_2:
      break
    else:
      for num_3, k in enumerate(L):
        if num_2 <= num_3:
          break
        else:
          if j + k <= i:
            continue
          else:
            counter += 1
print(counter)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split(" ")))
L.sort() #小さい順
counter = 0

for i in range(N-2):
  for j in range(i+1, N-1):
    index = bisect.bisect_left(L, L[i]+L[j], 0, N)
    counter = counter + index - j - 1
       
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split(" ")))
L.sort() #小さい順
counter = 0

for num_1, i in enumerate(L):
  for num_2, j in enumerate(L):
    if num_1 >= num_2:
      continue
    else:
      for num_3, k in enumerate(L):
        if num_2 >= num_3:
          continue
        else:
          if i + j <= k:
            break
          else:
            counter += 1
print(counter)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split(" ")))
L.sort() #小さい順
counter = 0

for i in range(N-2):
  for j in range(i+1, N-1):
    index = bisect.bisect_left(L, L[i]+L[j], 0, N)
    counter = counter + index - j - 1
       
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split(" ")))
 
counter = 0
 
for num_1, i in enumerate(L):
  for num_2, j in enumerate(L):
    if num_1 <= num_2:
      break
    else:
      for num_3, k in enumerate(L):
        if num_2 <= num_3:
          break
        else:
          if i+j >k and j+k>i and k+i>j:
            counter += 1
print(counter)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split(" ")))
L.sort() #小さい順
counter = 0

for i in range(N-2):
  for j in range(i+1, N-1):
    index = bisect.bisect_left(L, L[i]+L[j], 0, N)
    counter = counter + index - j - 1
       
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split(" ")))

counter = 0

for num_1, i in enumerate(L):
  for num_2, j in enumerate(L):
    if num_1 <= num_2:
      continue
    else:
      for num_3, k in enumerate(L):
        if num_2 <= num_3:
          continue
        else:
          if i+j >k and j+k>i and k+i>j:
            counter += 1
print(counter)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split(" ")))
L.sort() #小さい順
counter = 0

for i in range(N-2):
  for j in range(i+1, N-1):
    index = bisect.bisect_left(L, L[i]+L[j], 0, N)
    counter = counter + index - j - 1
       
print(counter)