Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
H,W=map(int,intput().split())
h,w=map(int,input().split())
print(W*H-h*W-H*w+h*w)

Fixed submission:
# -*- coding: utf-8 -*-


def main():
    alpha = [int(input()) for _ in range(5)]
    k = int(input())

    for a in alpha:
        for b in alpha:
            if abs(a - b) > k:
                print(':(')
                exit()

    print('Yay!')


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
 alpha=[int(intput()) for_in range(5)]
    k=int(intput())
    for a in alpha:
        for b in alpha:
            if abs(a-b)>k:
                print (':(')
                exit()
    print('Yay!')
             

Fixed submission:
# -*- coding: utf-8 -*-


def main():
    alpha = [int(input()) for _ in range(5)]
    k = int(input())

    for a in alpha:
        for b in alpha:
            if abs(a - b) > k:
                print(':(')
                exit()

    print('Yay!')


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    alpha=[int(intput()) for _in range(5)]
    k=int(intput())
    for a in alpha:
        for b in alpha:
            if abs(a-b)>k:
                print (':(')
                exit()
    print('Yay!')
                

Fixed submission:
# -*- coding: utf-8 -*-


def main():
    alpha = [int(input()) for _ in range(5)]
    k = int(input())

    for a in alpha:
        for b in alpha:
            if abs(a - b) > k:
                print(':(')
                exit()

    print('Yay!')


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    alpha=[int(intput()) for_in range(5)]
    k=int(intput())
    for a in alpha:
        for b in alpha:
            if abs(a-b)>k:
                print (':(')
                exit()
    print('Yay!')
                

Fixed submission:
# -*- coding: utf-8 -*-


def main():
    alpha = [int(input()) for _ in range(5)]
    k = int(input())

    for a in alpha:
        for b in alpha:
            if abs(a - b) > k:
                print(':(')
                exit()

    print('Yay!')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
l=input().split()
a=int(l[0])
b=int(l[1])
if a%b==0:
    print(a+b)
elif:
    print(b-a)

Fixed submission:
l=input().split()
a=int(l[0])
b=int(l[1])
if b%a==0:
    print(a+b)
else:
    print(b-a)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,intput().split())
print((a*b)//2)


Fixed submission:
a,b,c=map(int,input().split())
print((a*b)//2)

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,intput().split())
z=(a*b)/2
print(int(z))

Fixed submission:
a,b,c=map(int,input().split())
print((a*b)//2)
Buggy python submission (verdict: Runtime Error):
x=int(input())
y=int(input())
print(x+(y/2))

Fixed submission:
x,y=map(int,input().split())
print(x+(y//2))
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=int(input())
b=int(input())
if(N==1):
    print("Hello World")
else :
    print(a+b)

Fixed submission:
N=int(input())
if(N==1):
    print("Hello World")
else :
    a=int(input())
    b=int(input())
    print(a+b)
Buggy python submission (verdict: Runtime Error):
a,b = input().split()

if b % a == 0:
	print(a+b)
else:
	print(b-a)


Fixed submission:
a,b = input().split()
a = int(a)
b = int(b)

if b % a == 0:
	print(a+b)
else:
	print(b-a)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import math
from collections import defaultdict

n,m = input().split()
n = int(n)
m = int(m)
P,Y = [],[]
for _ in range(m):
	p,y = input().split()
	P.append(p)
	Y.append(y)

P = [int(p) for p in P]
Y = [int(y) for y in Y]

sorted = defaultdict(list)

for i in range(m):
	sorted[P[i]].append(Y[i])

for k in sorted.keys():
	sorted[k].sort()

for i in range(m):
	print("{0:06}{1:06}".format(P[i], sorted[P[i]].index(Y[i])+1))

Fixed submission:
import numpy as np
import math
from collections import defaultdict

n,m = input().split()
n = int(n)
m = int(m)
P,Y = [],[]
for _ in range(m):
	p,y = input().split()
	P.append(p)
	Y.append(y)

P = [int(p) for p in P]
Y = [int(y) for y in Y]

sorted = defaultdict(list)

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

for i,(p,y) in enumerate(zip(P,Y)):
	sorted[p-1].append((y,i))

ans = [None]*m
for i, d in enumerate(sorted):
	d.sort()
	for k, (y, j) in enumerate(d):
		ans[j] = "%06d%06d" % (i+1,k+1)
print(*ans, sep='\n')
Buggy python submission (verdict: Runtime Error):
n = int ( input())
ans = 0
test = (3,5,7,11,13)
for i in range ( 105,n+1,2) :
  div = 0
  for d in test :
    if i % d == 0 :
      div += 1
  if div == 3 and i % 9 != 0:
    ans += 1
  elif i %= 27:
    ans += 1
print (ans)

Fixed submission:
n = int ( input())
ans = 0
test = (3,5,7,11,13)
for i in range ( 105,n+1,2) :
  div = 0
  for d in test :
    if i % d == 0 :
      div += 1
  if div == 3 and i % 9 != 0:
    ans += 1
  elif i % 27 == 0:
    ans += 1
print (ans)
Buggy python submission (verdict: Runtime Error):
# coding: UTF-8


N, _ = input().split()
dislike_nums = set(map(int, input().split()))

nums = set(range(10))
nums -= dislike_nums

for i in range(len(N)):
    Ni = int(N[i])
    larger_num = [n for n in nums if n >= Ni]
    print(min(larger_num), end="")

print()



Fixed submission:
# coding: UTF-8


N, _ = input().split()
N = int(N)

dislike_nums = input().split()

def contains_dislike_number(num):
    for n in dislike_nums:
        if n in str(i):
            return True
    return False

for i in range(N, 10*N+1):
    if not contains_dislike_number(i):
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A >= 13:
  print(B)
elif A >= 6:
  half_b = B/2
  print(half_b)
else:
  print(int(0))

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

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()

if A >= 13:
  print(B)
elif A >= 6:
  print(B/2)
else:
  print(0)

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

Buggy python submission (verdict: Runtime Error):
#年齢
A = input()
#料金
B = input()

if A >= 13:
  return B
elif 13> A >=6:
  return B/2
else:
  return 0

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

if __name__ == '__main__':
    N, M, C = map(int, input().split())
    B = np.array(list(map(int, input().split())))
    A = np.array(list(map(lambda _: list(map(int, input().split())), range(N))))

    scores = np.matmul(A, B)
    print(np.sum(scores > -C))


Fixed submission:
import numpy as np

if __name__ == '__main__':
    N, M, C = map(int, input().split())
    B = np.array(list(map(int, input().split())))
    A = np.array(list(map(lambda _: list(map(int, input().split())), range(N))))

    scores = A.dot(B)
    print(np.sum(scores > -C))
Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == '__main__':
    N = int(input())
    # A, B = [], []
    score = []
    for n in range(N):
        a, b = map(int, input().split())
        # A.append([n, a])
        # B.append([n, b])
        score.append([n, a-b, a, b])

    score.sort(key=lambda x: x[1])
    closed = [False for _ in range(N)]

    tak_p, ao_p = 0, 0
    while True:
        if len(score) == 0:
            break
        tak_p += score[0][2]
        score = score[1:]

        if len(score) == 0:
            break
        ao_p += score[0][3]
        score = score[1:]

    print(tak_p - ao_p)


Fixed submission:
if __name__ == '__main__':
    N = int(input())
    B, AandB = [], []
    for n in range(N):
        a, b = map(int, input().split())
        B.append(b)
        AandB.append(a+b)

    AandB.sort(reverse=True)
    ans = -sum(B)

    for i in range(0, N, 2):
        ans += AandB[i]

    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
dic = {}
P = []; Y = []
for i in range(M):
    p, y = map(int,input().split())
    P.append(p)
    Y.append(y)
    if p not in dic:
        dic[p] = [y]
    else:
        dic[p].append(y)

for p in dic.values():
    p.sort()

for i in range(M):
    print("{:06d}{:06d}".format(P[i], dic[P[i]].index(Y[i])+1))


Fixed submission:
N, M = map(int,input().split())
dic = {}
P = []; Y = []
ans = ["" for i in range(M)]
for i in range(M):
    p, y = map(int,input().split())
    P.append(p)
    Y.append(y)
    if p not in dic:
        dic[p] = [[y,i]]
    else:
        dic[p].append([y,i])

for k,p in dic.items():
    p.sort()
    for pi in range(len(p)):
        ans[p[pi][1]] = "{:06d}{:06d}".format(k,pi+1)

for i in range(M):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
print(int(input())+int(input())if input()=='1'else"Hello World")

Fixed submission:
print(int(input())+int(input())if input()=='2' else "Hello World")
Buggy python submission (verdict: Runtime Error):
a = [[], []]
[a[i%2].append(t) for i, t in enumerate(map(int, input().split()))]
print(sum([(lambda x: len(x) -max([x.count(xi) for xi in x]))(ai) for ai in a]))

Fixed submission:
N = int(input())
a = [[],[]]
[a[i%2].append(t) for i, t in enumerate(map(int, input().split()))]

a_cnt = [{},{}]
for i in range(2):
    for j in range(len(a[i])):
        if a[i][j] in a_cnt[i]:
            a_cnt[i][a[i][j]] += 1
        else:
            a_cnt[i][a[i][j]] = 1

for i in range(2):
    # print(list(a_cnt[i].items()))
    a_cnt[i] = list(sorted(list(a_cnt[i].items()),\
        key=(lambda x:x[1]), reverse=True))[:2]

# print(a_cnt)
if a_cnt[0][0][0] != a_cnt[1][0][0]:
    print(N -a_cnt[0][0][1] -a_cnt[1][0][1])
else:
    if len(a_cnt[0])==1 and len(a_cnt[1])==1:
        print(N//2)
    else:
        ans1 = N -a_cnt[0][0][1] -a_cnt[1][1][1]
        ans2 = N -a_cnt[0][1][1] -a_cnt[1][0][1]
        print(min(ans1, ans2))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
a, b = input().split("-")
if len(a)==A and len(b)==B:
    print("Yes")
    exit()
print("No")


Fixed submission:
A, B = map(int, input().split())
s = input()
for i in range(len(s)):
    if i<A and s[i]=='-':
        print("No")
        exit()
    elif i==A and s[i]!='-':
        print("No")
        exit()
    elif A<i<=A+B and s[i]=='-':
        print("No")
        exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print(B*2-A))


Fixed submission:
A = int(input())
B = int(input())
print(B*2-A)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(len(S)-len(T)+1):
    ok = False
    for j in range(len(T)):
        if S[i+j]!=T[j] and S[i+j]!='?':
            break
    else:
        S = S[:i] + T + S[i+len(T):]
        ok = True
        break

if ok:
    print(S.replace('?', 'a'))
else:
    print("UNRESTORABLE")


Fixed submission:
S = input()
T = input()

if len(T) > len(S):
    print("UNRESTORABLE")
    exit()

ans = []

for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[i+j]!=T[j] and S[i+j]!='?':
            break
    else:
        ans.append((S[:i] + T + S[i+len(T):]).replace('?', 'a'))

if len(ans) == 0:
    print("UNRESTORABLE")
else:
    ans.sort()
    print(ans[0])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = {}
a = [int(i) for i in input().split()]
for i in range(N):
    if a[i] in A:
        A[a[i]] += 1
    else:
        A[a[i]] = 1

ans = []
A = list(sorted(list(A.items()), reverse=True))
for i in range(N):
    if A[i][1] >= 2:
        ans.append(A[i][0])
    if A[i][1] >= 4:
        ans.append(A[i][0])

    if len(ans) == 2:
        print(ans[0]*ans[1])
        break
else:
    print(0)


Fixed submission:
N = int(input())
A = {}
a = [int(i) for i in input().split()]
for i in range(N):
    if a[i] in A:
        A[a[i]] += 1
    else:
        A[a[i]] = 1

ans = []
A = list(sorted(list(A.items()), reverse=True))
for i in range(N):
    if A[i][1] >= 2:
        ans.append(A[i][0])
    if A[i][1] >= 4:
        ans.append(A[i][0])

    if len(ans) >= 2:
        print(ans[0]*ans[1])
        break
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
def insertion(S):
    Sc = S
    Scc = Sc.replace("()", "")
    while Scc != Sc:
        Sc = Scc
        Scc = Scc.replace("()", "")

    # Sc は ((((... or ))))... or ...))))((((...
    # print(Sc)
    if Sc[0] != Sc[-1]:
        pos = Sc.find(")(")
        S = insertion(S[:pos+1]) + insertion(S[pos+1:])
    elif Sc[0] == '(':
        S += ')' * len(Sc)
    else:
        S = '(' * len(Sc) + S

    return S

N = int(input())
print(insertion(input()))


Fixed submission:
def insertion(S):
    Sc = S
    Scc = Sc.replace("()", "")
    while Scc != Sc:
        Sc = Scc
        Scc = Scc.replace("()", "")

    # Sc は ((((... or ))))... or ...))))((((...
    # print(Sc)
    if len(Sc) == 0:
        Sl, Sr = "", ""
    elif Sc[0] != Sc[-1]:
        pos = Sc.find(")(")
        Sl = insertion(Sc[:pos+1])[0]
        Sr = insertion(Sc[pos+1:])[2]
    elif Sc[0] == '(':
        Sl = ""
        Sr = ')' * len(Sc)
    else:
        Sl = '(' * len(Sc)
        Sr = ""

    return Sl, S, Sr

N = int(input())
s = insertion(input())
print(s[0]+s[1]+s[2])
Buggy python submission (verdict: Runtime Error):
print(" ".join(input().split(,)))

Fixed submission:
print(" ".join(input().split(",")))
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    for m in range(k+1):
      if i+j+m == s:
        ans += 1
print(ans)

Fixed submission:
K, S = map(int, input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        if 0 <= (S-x-y) <= K:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
W=["dream", "dreamer", "erase", "eraser" ]
def srch(word):
    if word=="":
        print("YES")
        exit()

    for w in W:
        if word[:len(w)] == w:
            srch(word[len(w):])

srch(input())
print("NO")


Fixed submission:
W=["dream", "dreamer", "erase", "eraser"]
word=input()
while True:
    if word=="":
        print("YES")
        exit()

    ok = False
    for w in W:
        if word[-len(w):] == w:
            word = word[:-len(w)]
            ok = True
            break

    if not ok:
        print("NO")
        exit()
Buggy python submission (verdict: Runtime Error):
x = [int(i) for i input().split()]
x.sort()
print("Yes" if x[0]+x[1]==x[2] else "No")

Fixed submission:
x = [int(i) for i in input().split()]
x.sort()
print("Yes" if x[0]+x[1]==x[2] else "No")
Buggy python submission (verdict: Runtime Error):
print((int(input())+int(input())*int(input())//2)

Fixed submission:
print((int(input())+int(input()))*int(input())//2)

Buggy python submission (verdict: Runtime Error):
print((int(input()+int(input())*int(input()//2)

Fixed submission:
print((int(input())+int(input()))*int(input())//2)
Buggy python submission (verdict: Runtime Error):
g=lambda:map(int,input().split())
_,m=g()
ml,mr=0,10**5
for _ in range(m):
    l,r=g()
    ml=max(ml,l)
    mr=min(mr,r)
print([0,mr-ml+1][mr>=ml])


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

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())
 
if a <= 5:
	print("0")
        
elif 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())
 
if a <= 5:
	print(0)
        
elif 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())

if a <= 5:
  print("0"
        
elif 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())

if a <= 5:
	print(0)
  
elif 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 >= 13:
	print(B)
elif 6<=A<=12
	print(B//2)
else:
    print(0)
A,B=map(int, input().split())
if A >= 13:
	print(B)
elif 6<=A<=12:
	print(B//2)
else:
    print(0)

Fixed submission:
A,B=map(int, input().split())
if A >= 13:
	print(B)
elif 6<=A<=12:
	print(B//2)
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
A,B=map(int, input().split())
if A >= 13:
	print(B)
elif 6<=A<=12
	print(B//2)
else:
    print(0)

Fixed submission:
A,B=map(int, input().split())
if A >= 13:
	print(B)
elif 6<=A<=12:
	print(B//2)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if (e - a <= f):
    print("Yay!")
else:
    print(":(")

Fixed submission:
a = int(input())
for _ in range(3):
    input()
e = int(input())
k = int(input())
if e-a > k:
    print(':(')
else:
    print('Yay!')
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input())
print(X+(Y/2))

Fixed submission:
X, Y = map(int, input().split())
print(int(X+(Y/2)))
Buggy python submission (verdict: Runtime Error):
N = input()
if N % 2 == 0:
  print(N)
else:
  print(2*N)

Fixed submission:
N = int(input())
if N % 2 == 0:
  print(N)
else:
  print(2*N)
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
L = A + B
R = C + D
if L > R:
  print("Left")
elif L = R:
  print("Left")
else:
  print("Left")

Fixed submission:
A, B, C, D = map(int, input().split())
L = A + B
R = C + D
if L > R:
  print("Left")
elif L == R:
  print("Balanced")
else:
  print("Right")
Buggy python submission (verdict: Runtime Error):
N = int(input())
print("Yes" if N[0]==N[2] else "No")

Fixed submission:
N = input()
print("Yes" if N[0]==N[2] else "No")
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
if a == b == "H":
  print("H")
elif a == D and b == "H":
  print("D")
elif a == H and b == "D":
  print("H")
else:
  print("H")

Fixed submission:
a, b = input().split()
print("H" if a==b else "D")

Buggy python submission (verdict: Runtime Error):
a, b = input().split()
if a == b == "H":
  print("H")
elif a == D and b == "H":
  print("D")
elif a == H and b == "D":
  print("H")
else:
  print("H")

Fixed submission:
a, b = input().split()
print("H" if a==b else "D")

Buggy python submission (verdict: Runtime Error):
a, b = map(input().split())
if a == b == H:
  print("H")
elif a == D and b == H:
  print("D")
elif a == H and b == D:
  print("H")
else:
  print("H")

Fixed submission:
a, b = input().split()
print("H" if a==b else "D")
Buggy python submission (verdict: Runtime Error):
A=input()
s = input()
C=input()
x = s[0].upper()
print("A"+x+"C")

Fixed submission:
s=input()
print("A"+s[8]+"C")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a == b + c or b = c + a or c = b + a:
  print("YES")
else:
  print("NO")
  

Fixed submission:
a,b,c=map(int,input().split())
if a == b + c or b == c + a or c == b + a:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a == b + c or b = c + a c = b + a:
  print("YES")
else:
  print("NO")
  

Fixed submission:
a,b,c=map(int,input().split())
if a == b + c or b == c + a or c == b + a:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c = int(input())
if a == b == c:
  print(1)
elif a == b or b == c or c == a:
  print(2)
else:
  print(3)

Fixed submission:
a,b,c=map(int,input().split())
if a == b == c:
  print(1)
elif a == b or b == c or c == a:
  print(2)
else:
  print(3)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split.())

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

Fixed submission:
a, b = map(int, input().split())

if 13 <= a :
  print(b)
elif 6 <= a <= 12 :
  print(int(b/2))
else :
  print(0)
Buggy python submission (verdict: Runtime Error):
r, D, x = map(int, input().split())

for i in range(10) :
  x = rx + D
  print(x)

Fixed submission:
r, D, x = map(int, input().split())

for i in range(10) :
  x = r*x - D
  print(x)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
if s[k-1] == 'A' :
  print(s[:k-2] + 'a' + s[k:n])
elif s[k-1] == 'B' :
  print(s[:k-2] + 'b' + s[k:n])
else s[k-1] == 'C' :
  print(s[:k-2] + 'c' + s[k:n])


Fixed submission:
n, k = map(int, input().split())
s = input()
if s[k-1] == 'A':
  print(s[:k-1] + 'a' + s[k:])
elif s[k-1] == 'B':
  print(s[:k-1] + 'b' + s[k:])
else :
  print(s[:k-1] + 'c' + s[k:])

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = list(input())
if s[k-1] == 'A' :
  print(s[:k-2] + 'a' + s[k:n])
elif s[k-1] == 'B' :
  print(s[:k-2] + 'b' + s[k:n])
else s[k-1] == 'C' :
  print(s[:k-2] + 'c' + s[k:n])

Fixed submission:
n, k = map(int, input().split())
s = input()
if s[k-1] == 'A':
  print(s[:k-1] + 'a' + s[k:])
elif s[k-1] == 'B':
  print(s[:k-1] + 'b' + s[k:])
else :
  print(s[:k-1] + 'c' + s[k:])
Buggy python submission (verdict: Runtime Error):
A, B = int(input())
if ( A < 6 ):
  result = 0
elif ( A < 13):
  result = B/2
else:
  result = B
  
print(result)

Fixed submission:
A, B = map( int, input().split() )
if ( A < 6 ):
  result = 0
elif ( A < 13 ):
  result = B/2
else:
  result = B
  
print( int(result) )
Buggy python submission (verdict: Runtime Error):
from math import gcd

def cR(A, i):
    if i == len(A):
        return 0
    else:
        g = 0
        for i in range(i, len(A)):
            g = gcd(g, A[i])
        return g

def cL(A, i):
    if i == 1:
        return 0
    else:
        g = 0
        for i in range(i+1):
            g = gcd(g, A[i])
        return g


n = int(input())
A = list(map(int, input().split()))
A.append(0)
R = [0] * (n+2)
L = [0] * (n+2)
M = [0] * (n+2)

g = A[n-1]
for i in range(n-1, -1, -1):
    R[i] = gcd(g, A[i])

g = A[0]
for i in range(1,n+1):
    L[i] = gcd(g, A[i-1])

for i in range(n):
    M[i] = gcd(L[i], R[i+1])

# print(L, R, M)
print(max(M))

Fixed submission:
# from math import gcd

def gcd(x, y): 
    while(y): 
        x, y = y, x % y 
    return x 

n = int(input())
A = list(map(int, input().split()))

R = [0] + list(A) + [0]
L = [0] + list(A) + [0]
M = [0] * (n+2)


for i in range(n, 0, -1):
    R[i] = gcd(R[i], R[i+1])


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

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

# print("A   ", A, " ")
# print("L", L)
# print("R", R)
# print("M", M)
print(max(M))
Buggy python submission (verdict: Runtime Error):
import collections

def int_cards(N, cards, operations):
    col_cards = collections.deque(sorted(cards), N)
    operations.sort(reverse=True)
    for c, b in operations:
        for _ in range(b):
            if col_cards[0] >= c:
                break
            col_cards.popleft()
            col_cards.append(c)
            
    print(sum(col_cards))
    
N, M = map(int, input().split())
A = list(map(int,input().split()))
operations = []
for i in range(M):
    B, C = map(int, input().split())
    operations.append([C, B])
    
int_cards(N, A, operations)

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