Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split
 
if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b//2))
else :
  print(b)

Fixed submission:
a,b = map(int,input().split())
 
if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b//2))
else :
  print(b)

Buggy python submission (verdict: Runtime Error):
a,b =map(int, input().split)

if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b/2))
else :
  print(b)


Fixed submission:
a,b = map(int,input().split())
 
if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b//2))
else :
  print(b)

Buggy python submission (verdict: Runtime Error):
a,b =map(int, input().split)

if a <= 5 :
  print(0)
elif 5 < a <= 12 :
  print(int(b/2))
else :
  print(b)


Fixed submission:
a,b = map(int,input().split())
 
if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b//2))
else :
  print(b)

Buggy python submission (verdict: Runtime Error):
a,b =map(int, input().split)

if a <= 5 :
  print(0)
elif 5 < a <= 12 :
  print(b//2)
else :
  print(b)


Fixed submission:
a,b = map(int,input().split())
 
if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b//2))
else :
  print(b)

Buggy python submission (verdict: Runtime Error):
a,b =map(int,input().split)

if a <= 5 :
  print(0)
elif 5 < a <= 12 :
  print(b/2)
else :
  print(b)


Fixed submission:
a,b = map(int,input().split())
 
if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b//2))
else :
  print(b)

Buggy python submission (verdict: Runtime Error):
a,b =map(int, input().split)

if a <= 5 :
  print(0)
elif 5 < a <= 12 :
  print(b/2)
else :
  print(b)

Fixed submission:
a,b = map(int,input().split())
 
if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b//2))
else :
  print(b)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = input()

print(S[:k-1]+S[k-1].lower()+S[k:])

Fixed submission:
N,K = map(int,input().split())
S = input()

print(S[:K-1]+S[K-1].lower()+S[K:])

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = input()

if S[K] = A :
	S[K] = a
elif S[K] = B :
	S[K] = b
elif S[K] = C :
	S[K] = c

print(S)

Fixed submission:
N,K = map(int,input().split())
S = input()

print(S[:K-1]+S[K-1].lower()+S[K:])
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

if abs(A-B) >= 2 :
	print(A*2-1)
elif abs(A-B) = 1 :
	print(max([A,B])+min([A,B]))
else :
	print(A*2)

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

if abs(A-B) >= 2 :
	print(max([A,B])*2-1)
elif abs(A-B) == 1 :
	print(A+B)
else :
	print(A*2)

Buggy python submission (verdict: Runtime Error):
A,B = [int(input()).split]

if abs(A-B) >= 2 :
	print(A*2-1)
elif abs(A-B) = 1 :
	print(max([A,B])+min([A,B]))
else :
	print(A*2)

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

if abs(A-B) >= 2 :
	print(max([A,B])*2-1)
elif abs(A-B) == 1 :
	print(A+B)
else :
	print(A*2)
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,k = [int(input) for i in range(6)]
print('Yay!' if e-a<=k else ':(')

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,k = [int(input) for i in range(6)]
print('Yay!' if e-a <= k else ':(')

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
a,b,c,d,e = [int(input) for i in range(6)]
print('Yay!' if e-a <= k else ':(')

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
I =[int(input())for i in range(5)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
I =[int(input())for i in range(5)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print(("Yay!"))

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
I = [int(input()) for _ in range(6)]

I[0] = a
I[4] = e
I[5] = k

if e-a <= k:
	print(":(")
else :
	print("Yay!")

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
I = [int(input()) for _ in range(6)]

I[0] = a
I[4] = e
I[5] = k

if e-a > k:
	print(":(")
else :
	print("Yay!")

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
I = [int(input()) for _ in range(6)]

I[0] = a
I[4] = e
I[5] = k

if e-a > k:
	print(':(')
else :
	print('Yay!')

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
I = [int(input()) for i in range(6)]

I[0] = a
I[4] = e
I[5] = k

if e-a > k:
	print(':(')
else :
	print('Yay!')

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
I = [int(input()) for i in range(6)]

I[0] = a
I[5] = e
I[6] = k

if e-a > k:
	print(':(')
else :
	print('Yay!')

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")

Buggy python submission (verdict: Runtime Error):
I = int(input()) for i in range(6):

I[0] = a
I[5] = e
I[6] = k

if e-a > k:
	print(':(')
else :
	print('Yay!')

Fixed submission:
I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")
Buggy python submission (verdict: Runtime Error):
b = input()

if b == A :
	print("T")
elif b == T :
	print("A")
elif b == C :
	print("G")
elif b == G :
	print("C")

Fixed submission:
b = str(input())

if b == "A" :
	print("T")
elif b == "T" :
	print("A")
elif b == "C" :
	print("G")
elif b == "G" :
	print("C")

Buggy python submission (verdict: Runtime Error):
b = input()

if b == A :
	print("T")
elif b == T :
	print("A")
if b == C :
	print("G")
elif b == G :
	print("C")

Fixed submission:
b = str(input())

if b == "A" :
	print("T")
elif b == "T" :
	print("A")
elif b == "C" :
	print("G")
elif b == "G" :
	print("C")

Buggy python submission (verdict: Runtime Error):
b = input()

if b = A :
	print("T")
elif b = T :
	print("A")
if b = C :
	print("G")
elif b = G :
	print("C")

Fixed submission:
b = str(input())

if b == "A" :
	print("T")
elif b == "T" :
	print("A")
elif b == "C" :
	print("G")
elif b == "G" :
	print("C")

Buggy python submission (verdict: Runtime Error):
b = str(input())

if b = A:
	print("T")
elif b = T:
	print("A")
if b = C:
	print("G")
elif b = G:
	print("C")

Fixed submission:
b = str(input())

if b == "A" :
	print("T")
elif b == "T" :
	print("A")
elif b == "C" :
	print("G")
elif b == "G" :
	print("C")
Buggy python submission (verdict: Runtime Error):
S = input().split("/")

if int(S[5]) < 5 :
	print('Heisei')
else :
	print('TBD')

Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = input().split("/")

if S[5] < 5 :
	print('Heisei')
else :
	print('TBD')

Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = input().split("/")
 
if int(S[5]) < 5 and int(S[4]) == 0 :
	print('Heisei')
else :
	print('TBD')

Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = input().split("/")
 
if int(S[5]) < 5 and int(s[4]) ==0 :
	print('Heisei')
else :
	print('TBD')

Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = input().split("/")

if int(S[5]) < 5 and s[4] ==0 :
	print('Heisei')
else :
	print('TBD')

Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = input().split("/")

if int(S[5]) < 5　and s[4] == 0 :
	print('Heisei')
else :
	print('TBD')

Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = input().sprint("/")

if int(S[5]) < 5 :
	print('Heisei')
else :
	print('TBD')

Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = input().split("/")

if int(S[5]) < 5 :
	print('Heisei')
else :
	print('TBD')

Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = int(input().split("/"))

if S[5] < 5 :
	print('Heisei')
else :
	print('TBD')

Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

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

S = input().datetime

if S <= 2019/04/30 :
	print("Heisei")
else :
	print("TBD")



Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = datetime(input())

if S <= 2019/04/30 :
	print("Heisei")
else :
	print("TBD")


Fixed submission:
s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

if B%A = 0 :
	print(int(A+B)
else :
	print(int(B-A))

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

if B%A == 0 :
	print(A+B)
else :
	print(B-A)

Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

if B%A = 0 :
	print(A+B)
else :
	print(B-A)

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

if B%A == 0 :
	print(A+B)
else :
	print(B-A)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = sorted(list(map(int, input().split())))

if sum(L[:-1]) > L[:-1] :
	print('Yes')
else:
	print('No')

print(L)

Fixed submission:
N = int(input())
L = sorted(list(map(int, input().split())))

if sum(L[:-1]) > L[-1] :
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
A,B = int(input().split())
print(A+B)

Fixed submission:
lst = input().split(" ")
A =int(lst[0])
B =int(lst[1])
print((A+B)%24)
Buggy python submission (verdict: Runtime Error):
N = input()
if(N%2=0):
    print('0.5000000000')
else:
    print((N/2)+1/N)

Fixed submission:
N = int(input())
if N%2==0:
    print((N/2)/N)
else:
    print(((N//2)+1)/N)
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = input()
if a=>3200:
  print(s)
elif a<3200:
  print('red')

Fixed submission:
a = int(input())
s = input()
if a>=3200:
  print(s)
elif a<3200:
  print('red')
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
test1 = A+B
test2 = A-B
test3 = A*B
if test1 >= test2 and test1 >= test3:
  print(test1)
  break
if test2 >= test1 and test2 >= test3:
  print(test2)
  break
if test3 >= test1 and test3 >= test2:
  print(test3)
  break
	

Fixed submission:
A,B = map(int,input().split())
test1 = A+B
test2 = A-B
test3 = A*B
if test1 >= test2 and test1 >= test3:
  print(test1)
elif test2 >= test1 and test2 >= test3:
  print(test2)
elif test3 >= test1 and test3 >= test2:
  print(test3)
Buggy python submission (verdict: Runtime Error):
k =int(input())
x = int(input())
for i in range(x-(k-1),k+x):
  print(i,end=" ")

Fixed submission:
k,x = map(int,input().split())
for i in range(x-(k-1),k+x):
  print(i,end=' ')
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

if n * a < b:
	print(n*a)
else:
	print(b)


Fixed submission:
N, A, B = map(int, input().split())

if N * A < B:
	print(N*A)
else:
	print(B)
Buggy python submission (verdict: Runtime Error):
S = input()
if len(set(S)) == 2:
  ans = 'Yes'  
else ans = 'No'
print(ans)


Fixed submission:
S = input()
if len(set(S)) == 2:
	ans = 'Yes'  
else:
	ans = 'No'
print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()
if len(set(S)) == 2:
	ans = 'Yes'  
else ans = 'No'
print(ans)

Fixed submission:
S = input()
if len(set(S)) == 2:
	ans = 'Yes'  
else:
	ans = 'No'
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
new_S= S.lower(K)
print(new_S)

Fixed submission:
N,K = list(map(int,input().split()))
S = input()
print(S[:K-1]+S[K-1].lower()+S[K:])
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
a.b=b-a
a.c=c-a
a.d=d-a
a.e=e-a
b.c=c-b
b.d=d-b
b.e=e-b
c.d=d-c
c.e=e-c
d.e=e-d
if a.b<=k and a.c<=k and a.d<=k and a.e<=k and b.c<=k and b.d<=k and b.e<=k and c.d<=k and c.e<=k and d.e<=k:
  print('Yay!')
else:
  print(':(')

Fixed submission:
a=int(input())
b=input()
c=input()
d=input()
e=int(input())
k=int(input())
print('Yay!' if (e-a)<=k else ':(')
Buggy python submission (verdict: Runtime Error):
n = input()
ans = ""
	for c in n:
		if c == "1":
            ans += "9"
        elif c == "9":
            ans += "1"
        else:
            ans += c
print(ans)

Fixed submission:
S = input()

ans = ""

for i in S:
  if i == "1":
    ans += "9"
  else:
    ans += "1"

print(ans)

Buggy python submission (verdict: Runtime Error):
    n = input()
    ans = ""
    for c in n:
        if c == "1":
            ans += "9"
        elif c == "9":
            ans += "1"
        else:
            ans += c
    print(ans)

Fixed submission:
S = input()

ans = ""

for i in S:
  if i == "1":
    ans += "9"
  else:
    ans += "1"

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
	target = max(a)	
	a[a.index(target)] = target // 2
print(sum(a))	

Fixed submission:
import heapq
n,m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)

for i in range(m):
	target = heapq.heappop(a)
	heapq.heappush(a, (-1)*(-target//2))
	
print(-sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**9)

n = int(input())
def num(n):
    if n == 1:
        return 1
    return n + num(n-1)
print(num(n-1))

Fixed submission:
n = int(input())
print((n*(n-1))//2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = []
count = 0
for i in range(n):
    sli = sorted(list(input()))
    s = "".join(sli)
    if s in li:
        count += li.count(s)
    li.append(s)
print(count)

Fixed submission:
n = int(input())
d = {}
count = 0
for i in range(n):
    sli = sorted(list(input()))
    s = "".join(sli)
    if s in d:
        count += d[s]
        d[s] += 1
    else:
        d[s] = 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for x in range(n)]
b = sorted(a,reverse=True)
for i in range(n):
    if max(a) == a[i]:
        print(b[1])
    else:
        print(b[0])

Fixed submission:
n = int(input())
a = [int(input()) for x in range(n)]
b = sorted(a,reverse=True)
for i in range(n):
    if b[0] == a[i]:
        print(b[1])
    else:
        print(b[0])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from sys import stdin
n = int(stdin.readline().rstrip())
a = [int(stdin.readline().rstrip()) for x in range(n)]

for i in range(len(a)):
    if a[:i] == []:
        print(max(a[i+1:]))
    elif a[i+1:] == []:
        print(max(a[:i]))
    else:
        print(max(max(a[i+1:]),max(a[:i])))

Fixed submission:
n = int(input())
a = [int(input()) for x in range(n)]
b = sorted(a,reverse=True)
for i in range(n):
    if b[0] == a[i]:
        print(b[1])
    else:
        print(b[0])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from sys import stdin
n = int(stdin.readline().rstrip())
a = [int(stdin.readline().rstrip()) for x in range(n)]
for i in range(len(a)):
    b = []
    b.append(a[:i])
    b.append(a[i+1:])
    b = [flatten for inner in b for flatten in inner]
    print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for x in range(n)]
b = sorted(a,reverse=True)
for i in range(n):
    if b[0] == a[i]:
        print(b[1])
    else:
        print(b[0])

Buggy python submission (verdict: Runtime Error):
n = int(stdin.readline().rstrip())
a = [int(stdin.readline().rstrip()) for x in range(n)]
for i in range(len(a)):
    b = []
    b.append(a[:i])
    b.append(a[i+1:])
    b = [flatten for inner in b for flatten in inner]
    print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for x in range(n)]
b = sorted(a,reverse=True)
for i in range(n):
    if b[0] == a[i]:
        print(b[1])
    else:
        print(b[0])

Buggy python submission (verdict: Runtime Error):
n = int(stdin.readline().rstrip())
a = [int(stdin.readline().rstrip()) for x in range(n)]
for i in range(len(a)):
    b = []
    b.append(a[:i])
    b.append(a[i+1:])
    b = [flatten for inner in b for flatten in inner]
    print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for x in range(n)]
b = sorted(a,reverse=True)
for i in range(n):
    if b[0] == a[i]:
        print(b[1])
    else:
        print(b[0])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for x in range(n)]
for i in range(len(a)):
    b = []
    b.append(a[:i])
    b.append(a[i+1:])
    b = [flatten for inner in b for flatten in inner]
    print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for x in range(n)]
b = sorted(a,reverse=True)
for i in range(n):
    if b[0] == a[i]:
        print(b[1])
    else:
        print(b[0])
Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())
r = min(r, l+4038)
ans = 2018
for i in range(l,r):
    for j in range(l+1,r+1):
        if ans > i*j%2019:
            ans = i*j%2019
print(ans)

Fixed submission:
l,r = map(int,input().split())
r = min(r, l+4038)
ans = 2018
for i in range(l,r):
    for j in range(l+1,r+1):
        if ans > i*j%2019:
            ans = i*j%2019
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
li = list(range(a,b+1))
start1 = 0
start2 = 0
start3 = 0
for i in li:
    if i%c == 0:
        start1 = li.index(i)
        break
for j in li:
    if j%d == 0:
        start2 = li.index(j)
        break
for k in li:
    if k%(c*d)==0:
        start3 = li.index(k)
        break

print(b+1-a+len(li[start3::c*d])-len(li[start2::d])-len(li[start1::c]))

Fixed submission:
import math
import fractions
a,b,c,d = map(int, input().split())
e = a-1
less_than_e = e - (e//c) - (e//d) + (e//(c*d//fractions.gcd(c,d)))
less_than_b = b - (b//c) - (b//d) + (b//(c*d//fractions.gcd(c,d)))
if less_than_e < 0:
    less_than_e = 0
print(less_than_b - less_than_e)
Buggy python submission (verdict: Runtime Error):
#炎の3段lambda
n = int(input())
li = [list(map(str, input().split())) for i in range(n)]
[li[i].append(str(i+1)) for i in range(n)]
li = sorted(li, key=lambda x:x[0])
rest = []
ans = []
for j in range(n-1):
    if li[j][0] == li[j+1][0]:
        rest.append(li[j])

    else:
        rest.append(li[j])
        ans.append(sorted(rest, key=lambda x:x[1], reverse = True))
        rest = []
rest.append(li[j+1])
ans.append(sorted(rest, key=lambda x:x[1], reverse = True))
ans = [flatten for inner in ans for flatten in inner]
for k in range(n):
    print(int(ans[k][2]))

Fixed submission:
n = int(input())
a = [input().split() +[i+1] for i in range(n)]
a = sorted(a ,key=lambda x:(x[0], -int(x[1])))
for i in range(len(a)):
    print(a[i][2])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
l1, r1 = map(int, input().split())
li = set(list(range(l1, r1+1)))

for i in range(m-1):
    l,r = map(int, input().split())
    li = li & set(list(range(l,r+1)))
print(len(li))

Fixed submission:
a,b= map(int,input().split())
x, y= zip(*[list(map(int,input().split())) for i in range(b)])
f=  min(y) - max(x) 
if f< 0 :
  print(0)
else :
  print(min(y) - max(x) +1)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
l1, r1 = map(int, input().split())
li = list(range(l1, r1+1))

for i in range(m-1):
    l,r = map(int, input().split())
    li = [i for i in li if l <= i <= r]
print(len(li))

Fixed submission:
a,b= map(int,input().split())
x, y= zip(*[list(map(int,input().split())) for i in range(b)])
f=  min(y) - max(x) 
if f< 0 :
  print(0)
else :
  print(min(y) - max(x) +1)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
    b, c = map(int, input().split())
    a += [c] * b
a.sort()
print(sum(a[-n:]))

Fixed submission:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
li = []
for i in range(m):
    b, c = map(int, input().split())
    li.append((c, b))
li = sorted(li, reverse = True)

count = 0 #li[num][1]
num = 0  #index

for i in range(n):
    if a[i] < li[num][0]:
        a[i] = li[num][0]
        count += 1
    if count == li[num][1] :
        num += 1
        count = 0
    if num == m:
        break

print(sum(a))
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
print(input().replace(s[k-1], s[k-1].lower()))

Fixed submission:
n, k = map(int, input().split())
s = input()
print(s[:k-1] + s[k-1].lower() + s[k:])
Buggy python submission (verdict: Runtime Error):
n = int(input())
# 隣接リスト
link = [[] for i in range(n)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    w %= 2
    link[u].append((v,w))
    link[v].append((u,w))

ans = [0]*n
visited = [False for i in range(n)]

def dfs(now, prev):

    for next,w in link[now]:
        if next != prev:
            if visited[next]:
                continue
            else:
                visited[next] = True
                ans[next] = ans[now] + w
                dfs(next, now)
dfs(0,-1)
for i in ans:
    print(i)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)

n = int(input())
# 隣接リスト
link = [[] for i in range(n)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    link[u].append((v,w))
    link[v].append((u,w))

ans = [-1]*n

def dfs(v, now):
    ans[v] = now

    for next_v ,w in link[v]:
        if ans[next_v] != -1:
            continue
        if w % 2:
            dfs(next_v, 1-now)
        else:
            dfs(next_v, now)

dfs(0,0)
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
def gcd(x,y):
    if y == 0:
        return x
    return gcd(x%y, y)

n = int(input())
a = list(map(int, input().split()))
L = [0]
R = [0]
now1 = 0
now2 = 0
ans = 0

for i in range(n-1):
    now1 = gcd(now1,a[i])
    L.append(now1)

    now2 = gcd(now2,a[-i-1])
    R.append(now2)

for i in range(n):
    ans = max(ans, gcd(L[i], R[n-i-1]))

print(ans)

Fixed submission:
import fractions
def gcd(x,y):
    if x < y:
        x, y = y, x
    if y == 0:
        return x

    return fractions.gcd(x%y, y)

n = int(input())
a = list(map(int, input().split()))
L = [0]
R = [0]
now1 = 0
now2 = 0
ans = 0

for i in range(n-1):
    now1 = gcd(now1,a[i])
    L.append(now1)

    now2 = gcd(now2,a[-i-1])
    R.append(now2)

for i in range(n):
    ans = max(ans, gcd(L[i], R[n-i-1]))

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
li = ["A", "T", "G", "C"]
count = 0
ans = []
for i in range(len(s)):
    if s[i] in li:
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))

Fixed submission:
s = input()
li = ["A", "T", "G", "C"]
count = 0
ans = []
for i in range(len(s)):
    if s[i] in li:
        count += 1
    else:
        ans.append(count)
        count = 0
ans.append(count)
print(max(ans))