Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0
for i in range(1, N):
  ans += i

print(ans)

Fixed submission:
N = int(input())
ans = (N*(N-1))//2
print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

n = int(input())
words = {}
ans = 0

for i in range(n):
  t = ''.join(sorted(input()))
  if t in words:
    ans += words[t]
    words[t] += 1
  else:
    words[t] += 1
    
print(ans)

Fixed submission:
# coding: utf-8

n = int(input())
words = {}
ans = 0

for i in range(n):
  t = ''.join(sorted(input()))
  if t in words:
    ans += words[t]
    words[t] += 1
  else:
    words[t] = 1
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n = int(input())
words = []
ans = 0

for i in range(n):
  sort = sorted(input())
  t = ''.join(sort)
  if t in words:
    ans += words.count(t)
    
  words.append(t)
  
print(ans)

Fixed submission:
# coding: utf-8

n = int(input())
words = {}
ans = 0

for i in range(n):
  t = ''.join(sorted(input()))
  if t in words:
    ans += words[t]
    words[t] += 1
  else:
    words[t] = 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

n = int(input())
d = len(str(n))
ans = 0

for i in range(1, d+1):
  if i % 2 == 0:
    continue
  
  if i == d:
    print(i)
    print((n % div) + 1)
    div = 10 if (i == 1) else 10**(i-1)
    ans += (n % div) + 1
    break;

  m = 0 if (i == 1) else (10**(i-1))
  mm = 1 if (i == 1) else 0
  ans += (10**(i)) - mm - m

print(ans)

Fixed submission:
# coding: utf-8

n = int(input())
d = len(str(n))
ans = 0

if d == 1:
  print(n)
else:
  for i in range(1, d+1):
    if i % 2 == 0:
      continue

    if i == d:
      ans += n - (10**(i-1)) + 1
      break;

    if i == 1:
      ans += 9
    else:
      ans += (10**i) - (10**(i-1))

  print(ans)
Buggy python submission (verdict: Runtime Error):

N = int(input())
H = map(int, input().split())

dp = [] * N
dp[0] = 0

for i in range(1, N):
  tmp1 = dp[i-1] + abs(H[i] - H[i-1])
  tmp2 = dp[i-2] + abs(H[i] - H[i-2]) if i > 1 else 2**64
  dp[i] = min(tmp1, tmp2)
  
print(dp[N-1])
  
    
             
  


Fixed submission:

N = int(input())
H = list(map(int, input().split()))

dp = [0] * N
dp[0] = 0

for i in range(1, N):
  tmp1 = dp[i-1] + abs(H[i] - H[i-1])
  tmp2 = dp[i-2] + abs(H[i] - H[i-2]) if i > 1 else 2**64
  dp[i] = min(tmp1, tmp2)
  
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(int(N / 2 + 0.5) / N

Fixed submission:
N = int(input())
if N % 2 == 0:
       print(0.5)
else:
       print((N-int(N/2))/N)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
i = 0
ans = 0
while i < n:
    if a[i] >= k:
        ans += 1
        i += 1
print(ans)


Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
i = 0
ans = 0
for i in range(n):
    if h[i] >= k:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
w = ["Sunny","Cloudy","Rainy"]
s = input()
print(w[(w.index(s)+1)%3]

Fixed submission:
w = ["Sunny","Cloudy","Rainy"]
s = input()
print(w[(w.index(s)+1)%3])
Buggy python submission (verdict: Runtime Error):

s = input()
i = 0
while i < 100 and i < len(s):
    if s[i] != "R" and s[i] != "U" and s[i] != "D":
        print(i)
        print(s[i])
        print("1No")
        sys.exit()
    i += 2
i = 1
while i < 100 and i < len(s):
    if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
        print(s[i])
        print("2No")
        sys.exit()
    i += 2

print("Yes")


Fixed submission:
import sys

s = input()
i = 0
while i < 100 and i < len(s):
    if s[i] != "R" and s[i] != "U" and s[i] != "D":
        print("No")
        sys.exit()
    i += 2
i = 1
while i < 100 and i < len(s):
    if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
        print("No")
        sys.exit()
    i += 2

print("Yes")
Buggy python submission (verdict: Runtime Error):
n=input()
print(n**3)

Fixed submission:
n=int(input())
print(n**3)

Buggy python submission (verdict: Runtime Error):
n=input()
print(n**3)

Fixed submission:
n=int(input())
print(n**3)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]-1]+c[a[i]-2]
  else:
    s=s+b[a[i]]
print(s)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]-1]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]-1]+c[a[i]-2]
  else:
    s=s+b[a[i]-1]
print(s)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]]+c[a[i-1]]
  else:
    s=s+b[a[i]]
print(s)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]-1]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]-1]+c[a[i]-2]
  else:
    s=s+b[a[i]-1]
print(s)
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
x=input()
ans=0
for i in range(a):
  for j in range(b):
    for k in range(c):
      if x==500*i+100*j+50*k:
        ans+=1
print(ans)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if x==500*i+100*j+50*k:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
input()
List=list(map(int,input().split()))
ans=0
while all(l%2==0 for l in List):
  List[l/2 for l in List]
  ans+=1
print(ans)

Fixed submission:
input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
    A=[a/2 for a in A]
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=input()
List=list(map(int,input().split()))
ans=0
while all(l%2==0 for l in List):
  List[l/2 for l in List]
  ans+=1
print(ans)

Fixed submission:
input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
    A=[a/2 for a in A]
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=input()
List=list(map(int,input().split()))
ans=0
while all(l%2==0 for l in List):
  List[l/2 for l in List]
  ans+=1
print(ans)

Fixed submission:
input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
    A=[a/2 for a in A]
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=input()
l=list(map(int,input().split()))
ans=0
while all(i%2==0 for i in l):
  l[i/2 for i in l]
  ans+=1
print(ans)

Fixed submission:
input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
    A=[a/2 for a in A]
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=input()
l=list(map(int,input().split()))
ans=0
while l%2==0 for i in l:
  l[i/2 for i in l]
  ans += 1
print(ans)

Fixed submission:
input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
    A=[a/2 for a in A]
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=input()
s=input()
c,m=0,0
for i in range(n-1):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
print(m)

Fixed submission:
input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)

Buggy python submission (verdict: Runtime Error):
n=input()
s=input()
c,m=0,0
for i in range(n):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
print(m)

Fixed submission:
input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)

Buggy python submission (verdict: Runtime Error):
n = input()
s = input()
x = 0
y = 0

for i in range(len(s)):
  if s[i] == "I":
    y += 1
    x = max(x,y)
  if s[i] == "D":
    y = y - 1
	x = max(x,y)
print(x)

Fixed submission:
input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)

Buggy python submission (verdict: Runtime Error):
n = input()
s = input()
x = 0
y = 0

for i in range(n):
  if s[i] == "I":
    y += 1
    x = max(x,y)
  if s[i] == "D":
    y = y - 1
	x = max(x,y)
print(x)

Fixed submission:
input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)

Buggy python submission (verdict: Runtime Error):
n = input()
s = input()
x = 0
y = 0

for i in range(n - 1):
  if s[i] == "I":
    y += 1
    x = max(x,y)
  if s[i] == "D":
    y = y - 1

print(x)

Fixed submission:
input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)

Buggy python submission (verdict: Runtime Error):
n = input()
s = input()
x = 0
y = 0

for i in range(n):
  if s[i] == "I":
    y += 1
    x = max(x,y)
  if s[i] == "D":
    y = y - 1

print(x)

Fixed submission:
input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)

Buggy python submission (verdict: Runtime Error):
n = input()
s = input()
x = 0
y = 0

for i in range(n):
  if i == "I":
    y += 1
    x = max(x,y)
  if i == "D":
    y = y - 1

print(x)

Fixed submission:
input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)
Buggy python submission (verdict: Runtime Error):
s = input()
ans=[]
for i in range(len(s)):
  if s[i]==0 or s[i]==1:
    ans.append(i)
  else:
    try;ans.pop()
    except:pass
print("".join(ans))


Fixed submission:
s=input()
ans=[]
for i in range(len(s)):
  if s[i]=="0" or s[i]=="1":
    ans.append(s[i])
  else:
    try:ans.pop()
    except:pass
print("".join(ans))
Buggy python submission (verdict: Runtime Error):
n,l = map(int,input().split())

s = sorted([input() for i in range(n)])

print(*s,sep)

Fixed submission:
n,l = map(int,input().split())

s = sorted([input() for i in range(n)])

print(*s,sep="")
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import heapq
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
f = [int(i) for i in input().split()]
a.sort()
f.sort(reverse=True)

if sum(a) <= k:
    print(0)
else:
    heap = []
    for i in range(n):
        heapq.heappush(heap, (-a[i]*f[i], a[i], f[i]))
    for i in range(k):
        cur,x,y = heapq.heappop(heap)
        x -= 1
        cur = x*y
        heapq.heappush(heap,(-cur,x,y))
    ans = -float('inf')
    for i in range(len(heap)):
        ans = max(-heap[i][0], ans)
    print(ans)

Fixed submission:
a, b = [int(i) for i in input().split()]
if a <= 9 and b <= 9:
    print(a*b)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
a = input()
a = int(a)

if a == 7 || a == 5 || a == 3:
    print('YES')
else:
    print('NO')


Fixed submission:
a = input()
a = int(a)

if a == 7 or a == 5 or a == 3:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())

if B < A:
    A, B = B, A

if C < A:
    A ,C = C, A

if C < B:
    B, C = C, B

if A != 5 or B != 5 or C != 7:
    print("NO")
else:
    print("YES")

Fixed submission:
A, B, C = map(int, input().split())
if B < A:
    A, B = B, A

if C < A:
    A ,C = C, A

if C < B:
    B, C = C, B

if A != 5 or B != 5 or C != 7:
    print("NO")
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
import sys
from itertools import count, accumulate
from operator import mul
from functools import reduce
lines = sys.stdin.readlines()

positions = [int(i) for i in lines[1].split(' ')]

distances = [ j - i for i, j in zip(positions, positions[1:])]

n = len(distances)
factorials = [1] + list(accumulate(range(1,n + 1), mul))

combinations = dict()
def combination(i, j):
    if (i, j) in combinations:
        return combinations((i, j))
    else:
        return factorials[i] // (factorials [j] * factorials[i - j])

permutations = dict()
def permutation(i, j):
    if (i, j) in permutations:
        return permutations((i, j))
    else:
        return reduce(mul, range(j, i+1))

s = 0
result = 0
for d, i in zip(distances, count(1)):
    lt = i - 1
    gt = n - i
    t = factorials[lt] * combination(n, gt) * factorials[gt]
    s += t
    result += d * s

print(int(result % (pow(10,9) + 7)))

Fixed submission:
import sys
lines = sys.stdin.readlines()
n = lines.pop(0)
e = lines.pop(-1).strip()
r = 0
s = False
for l in lines:
    l = l.strip()
    n, t = l.split(' ')
    if s:
        r += int(t)
    elif n == e:
        s = True
print(r)
Buggy python submission (verdict: Runtime Error):
import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
while True:
    try:
        input()
    except EOFError:
        break
print(ans)


Fixed submission:
import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
print(ans)

Buggy python submission (verdict: Runtime Error):
import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
print(ans)


Fixed submission:
import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
print(ans)

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    if b > a:
        a, b = b, a
    while b > 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
print(ans)


Fixed submission:
import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
print(ans)

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
print(ans)


Fixed submission:
import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input().rstrip()
d = ['dream', 'dreamer']
e = ['erase', 'eraser']
ch = d + e

def search_(s, ch):
    if len(s) == 0:
        return True
    if len(s) < len(ch):
        return False
    else:
        if s[:len(ch)] == ch:
            return search(s[len(ch):])
    return False

def search(s):
    if len(s) == 0:
        return True
    if s[0] == 'd' or s[0] == 'e':
        for ci in ch:
            if search_(s, ci):
                return True
    return False

if search(s):
    print('YES')
else:
    print('NO')


Fixed submission:
s = input().rstrip()
d = ['dream', 'dreamer']
e = ['erase', 'eraser']
ch = d + e

st = [s]

def search_(s, st, ch):
    if len(s) == 0:
        return
    if len(s) < len(ch):
        return
    else:
        if s[:len(ch)] == ch:
            st.append(s[len(ch):])

def search(s):
    if len(s) == 0:
        return True
    if s[0] == 'd' or s[0] == 'e':
        for ci in ch:
            if search_(s, ci):
                return True
    return False

while st:
    s = st.pop(0)
    if len(s) == 0:
        print('YES')
        exit()
    if s[0] == 'd' or s[0] == 'e':
        for ci in ch:
            search_(s, st, ci)
print('NO')

Buggy python submission (verdict: Runtime Error):
s = input().rstrip()
d = ['dream', 'dreamer']
e = ['erase', 'eraser']
ch = d + e

def search_(s, ch):
    if len(s) == 0:
        return True
    if len(s) < len(ch):
        return False
    else:
        if s[:len(ch)] == ch:
            return search(s[len(ch):])

def search(s):
    if len(s) == 0:
        return True
    if s[0] == 'd' or s[0] == 'e':
        for ci in ch:
            if search_(s, ci):
                return True
    return False

if search(s):
    print('YES')
else:
    print('NO')


Fixed submission:
s = input().rstrip()
d = ['dream', 'dreamer']
e = ['erase', 'eraser']
ch = d + e

st = [s]

def search_(s, st, ch):
    if len(s) == 0:
        return
    if len(s) < len(ch):
        return
    else:
        if s[:len(ch)] == ch:
            st.append(s[len(ch):])

def search(s):
    if len(s) == 0:
        return True
    if s[0] == 'd' or s[0] == 'e':
        for ci in ch:
            if search_(s, ci):
                return True
    return False

while st:
    s = st.pop(0)
    if len(s) == 0:
        print('YES')
        exit()
    if s[0] == 'd' or s[0] == 'e':
        for ci in ch:
            search_(s, st, ci)
print('NO')
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[input() for i in range(n)]
target_song = input()

total = 0

ff = False

for i in l:
    s, t = i.split(" ")

    if s == target_song:
        f = True
        continue
        
    if f == True:
        total +=  int(t)

print(total)

Fixed submission:
n=int(input())
l=[input() for i in range(n)]
target_song = input()

total = 0

ff = False

for i in l:
    s, t = i.split(" ")

    if s == target_song:
        ff = True
        continue
        
    if ff == True:
        total +=  int(t)

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
a = [''.join(str(bin(x)).replace('0b', '')).zfill(60) for x in a]

ans = 0
for i in range(60):
    n0 = 0
    n1 = 0
    for j in a:
        if j[i] == '0':
            n0+=1
        else:
            n1+=1
    ans+=((2**(60-i-1)) * n0 * n1)
    
print(ans%(10**9 + 7))

Fixed submission:
N = int(input())
A = [str(bin(a)).lstrip('0b').zfill(60) for a in map(int,input().split())]
A_rev = list(zip(*A))

ans = 0
for i, a in enumerate(A_rev):
	k = a.count('1')
	ans+=(k*(N-k)*2**(59-i))
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
a = [''.join(str(bin(x)).replace('0b', '')).zfill(60) for x in a]

ans = 0
for i in range(60):
    n0 = 0
    n1 = 0
    for j in a:
        if j[i] == '0':
            n0+=1
        else:
            n1+=1
    ans+=((2**(60-i-1)) * n0 * n1)
    
print(ans%(10**9 + 7))

Fixed submission:
N = int(input())
A = [str(bin(a)).lstrip('0b').zfill(60) for a in map(int,input().split())]
A_rev = list(zip(*A))

ans = 0
for i, a in enumerate(A_rev):
	k = a.count('1')
	ans+=(k*(N-k)*2**(59-i))
print(ans%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect

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

ans = 0
for i in range(n):
	for j in range(i+1, n):
		for k in range(j+1, bisect(L, L[i]+L[j]-1)):
			ans+=1
print(ans)

Fixed submission:
from bisect import bisect

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

ans = 0
for i in range(n):
	for j in range(i+1, n):
		ans+=bisect(L, L[i]+L[j]-1)-j-1
print(ans)

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

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

ans = 0
for i in range(n):
	for j in range(i+1, n):
		for k in range(j+1, bisect(L, L[i]+L[j]-1)):
			if k != i and k != j:
				ans+=1
print(ans)

Fixed submission:
from bisect import bisect

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

ans = 0
for i in range(n):
	for j in range(i+1, n):
		ans+=bisect(L, L[i]+L[j]-1)-j-1
print(ans)

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

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

ans = 0
for i in range(n):
	for j in range(i+1, n):
		for k in range(j+1, bisect(L, L[i]+L[j]-1)):
			if k != i and k != j:
				ans+=1
print(ans)

Fixed submission:
from bisect import bisect

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

ans = 0
for i in range(n):
	for j in range(i+1, n):
		ans+=bisect(L, L[i]+L[j]-1)-j-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
#a = [x for x in range(1, n+1)]
#print(sum(a) - n)

wa = 0
a = n+1
for i in range(n//2):
    wa+=(n+1)
if n % 2 == 1:
    wa+=(n+1)/2

print(int(wa-n))

Fixed submission:
n = int(input())

wa = (n+1)*(n//2)
if n % 2 == 1:
    wa+=(n+1)//2

print(wa-n)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
#a = [x for x in range(1, n+1)]
#print(sum(a) - n)

wa = 0
for i in range(1, n):
    wa+=i

print(wa)

Fixed submission:
n = int(input())

wa = (n+1)*(n//2)
if n % 2 == 1:
    wa+=(n+1)//2

print(wa-n)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [x for x in range(1, n+1)]
print(sum(a) - n)

Fixed submission:
n = int(input())

wa = (n+1)*(n//2)
if n % 2 == 1:
    wa+=(n+1)//2

print(wa-n)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [x for x in range(1, n+1)]
print(sum(a) - n)

Fixed submission:
n = int(input())

wa = (n+1)*(n//2)
if n % 2 == 1:
    wa+=(n+1)//2

print(wa-n)
Buggy python submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
cxd = (c * d) // math.gcd(c, d)
sa = b - a

ans = (b - b//c - b//d + b//cxd) - ((a-1) - (a-1)//c - (a-1)//d + (a-1)//cxd)

print(ans)

Fixed submission:
import fractions

a, b, c, d = map(int, input().split())

cxd = (c * d) // fractions.gcd(c, d)
sa = b - a
ans = (b - b//c - b//d + b//cxd) - ((a-1) - (a-1)//c - (a-1)//d + (a-1)//cxd)

print(ans)

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

a, b, c, d = map(int, input().split())
cxd = (c * d) // math.gcd(c, d)
sa = b - a

print(sa - ((sa//c + sa//d) - sa//cxd))

Fixed submission:
import fractions

a, b, c, d = map(int, input().split())

cxd = (c * d) // fractions.gcd(c, d)
sa = b - a
ans = (b - b//c - b//d + b//cxd) - ((a-1) - (a-1)//c - (a-1)//d + (a-1)//cxd)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [0]*(n+1)
dp[0] = 1
dp[1] = 1 if (1 not in a) else 0

for i in range(2, n+1):
    if i in a:
        pass
    else:
        dp[i] = dp[i-1] + dp[i-2]
    
print(dp[n]%(10**9+7))

Fixed submission:
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [-1]*(n+1)
dp[0] = 1
dp[1] = 1
for i in a:
    dp[i] = 0

for i in range(2, n+1):
    if dp[i] == 0:
        pass
    else:
        dp[i] = dp[i-1] + dp[i-2]
    
print(dp[n]%(10**9+7))