Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
s = [si for si in s]
ans = 0
 
while True:
  st = ans
  for i in range(len(s) - 1):
    if s[i] == 'B' and s[i+1] == 'W':
      s[i] = 'W'
      s[i+1] = 'B'
      ans += 1
  if st == ans:
    print(ans)
    break

Fixed submission:
s = input()
w = 0
b = 0
wa = 0
ba = 0
l = len(s)
 
for i in range(l):
  if s[i] == 'W':
    wa += i - w
    w += 1
  if s[-1-i] == 'B':
    ba += i - b
    b += 1
    
print(min(ba, wa))

Buggy python submission (verdict: Runtime Error):
BWBWBW

Fixed submission:
s = input()
w = 0
b = 0
wa = 0
ba = 0
l = len(s)
 
for i in range(l):
  if s[i] == 'W':
    wa += i - w
    w += 1
  if s[-1-i] == 'B':
    ba += i - b
    b += 1
    
print(min(ba, wa))

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0

def reverse(s,i):
  if s[i] == 'B' and s[i+1] == 'W':
	s[i] = 'W'
	s[i+1] = 'B'
    ans += 1
  
while True:
  s = ans
  for i in range(len(s) - 1):
    reverse(s,i)
  if s == ans:
    print(ans)
    break


Fixed submission:
s = input()
w = 0
b = 0
wa = 0
ba = 0
l = len(s)
 
for i in range(l):
  if s[i] == 'W':
    wa += i - w
    w += 1
  if s[-1-i] == 'B':
    ba += i - b
    b += 1
    
print(min(ba, wa))

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0

def reverse(s,i):
  if s[i] == 'B' and s[i+1] == 'B':
	s[i] = 'W'
	s[i+1] = 'B'
    ans += 1
  
while True:
  s = ans
  for i in range(len(s) - 1):
    reverse(s,i)
  if s == ans:
    print(ans)
    break

Fixed submission:
s = input()
w = 0
b = 0
wa = 0
ba = 0
l = len(s)
 
for i in range(l):
  if s[i] == 'W':
    wa += i - w
    w += 1
  if s[-1-i] == 'B':
    ba += i - b
    b += 1
    
print(min(ba, wa))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

keihin = []
for i in range(N) :
  s = input()
  if s in keihin :
    continue
  keihin.append(s)
print(len(keihin))

Fixed submission:
N = int(input())

keihin = []
for i in range(N) :
  s = input()
  keihin.append(s)

print(len(set(keihin)))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
kake = 1
ret = 0
len_s = len(S)
for i in reversed(S) :
	p_amari = ( int(i) * kake + p_amari ) % 2019
	ret += ls[p_amari]
	ls[p_amari] += 1
	kake *= 10
print(int(ret))

Fixed submission:
S = input()

ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
ret = 0
len_s = len(S)
for i in range(len_s) :
	p_amari = ( int(S[len_s-1-i]) * pow(10, i, 2019) + p_amari ) % 2019
	ret += ls[p_amari]
	ls[p_amari] += 1
print(int(ret))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
kake = 1
ret = 0
len_s = len(S)
for i in range(len_s) :
	p_amari = ( int(S[len_s-1-i]) * kake + p_amari ) % 2019
	ret += ls[p_amari]
	ls[p_amari] += 1
	kake *= 10
print(int(ret))

Fixed submission:
S = input()

ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
ret = 0
len_s = len(S)
for i in range(len_s) :
	p_amari = ( int(S[len_s-1-i]) * pow(10, i, 2019) + p_amari ) % 2019
	ret += ls[p_amari]
	ls[p_amari] += 1
print(int(ret))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
kake = 1
ret = 0
len_s = len(S)
for i in range(len_s) :
	p_amari = ( int(S[len_s-1-i]) * kake + p_amari ) % 2019
	ret += ls[p_amari]
	ls[p_amari] += 1
	kake *= 10
print(int(ret))

Fixed submission:
S = input()

ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
ret = 0
len_s = len(S)
for i in range(len_s) :
	p_amari = ( int(S[len_s-1-i]) * pow(10, i, 2019) + p_amari ) % 2019
	ret += ls[p_amari]
	ls[p_amari] += 1
print(int(ret))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
kake = 1
ret = 0
for i in range(len(S)) :
	p_amari = ( int(S[len(S)-1-i]) * kake + p_amari ) % 2019
	ret += ls[p_amari]
	ls[p_amari] += 1
	kake *= 10
print(int(ret))

Fixed submission:
S = input()

ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
ret = 0
len_s = len(S)
for i in range(len_s) :
	p_amari = ( int(S[len_s-1-i]) * pow(10, i, 2019) + p_amari ) % 2019
	ret += ls[p_amari]
	ls[p_amari] += 1
print(int(ret))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
kake = 1
for i in range(len(S)) :
	p_amari = ( int(S[len(S)-1-i]) * kake + p_amari ) % 2019
	ls[p_amari] += 1
	kake *= 10
ret = 0
for i in range(2019) :
	n = ls[i]
	if n == 0 :
		continue
	ret += n * (n -1 ) / 2
print(int(ret))

Fixed submission:
S = input()

ls =[0 for i in range(2019)]
ls[0] += 1
p_amari = 0
ret = 0
len_s = len(S)
for i in range(len_s) :
	p_amari = ( int(S[len_s-1-i]) * pow(10, i, 2019) + p_amari ) % 2019
	ret += ls[p_amari]
	ls[p_amari] += 1
print(int(ret))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

for i in range(N) :
	print(A.count(i+1))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
A_cnt = [0 for i in range(N)]

for i in range(N-1) :
	A_cnt[A[i]-1] += 1

for i in range(N) :
	print(A_cnt[i])
Buggy python submission (verdict: Runtime Error):
noWeight = [[0 for j in range(W+1)] for i in range(N)]
wv = [[] for i in range(N)]
for i in range(N) :
	wv = [int(i) for i in input().split()]
	for j in range(1,W+1) :
		if i != 0 :
			if j < wv[0]  :
				noWeight[i][j] = noWeight[i-1][j]
			else :
				noWeight[i][j] = max(noWeight[i-1][j - wv[0]] + wv[1], noWeight[i-1][j])
		else :
			if j >= wv[0] :
				noWeight[i][j] = wv[1]
			else :
				noWeight[i][j] = 0
	
print(noWeight[N-1][W])


Fixed submission:
N, W = [int(i) for i in input().split()]
noWeight = [[0 for j in range(W+1)] for i in range(N)]
wv = [[] for i in range(N)]
for i in range(N) :
	wv = [int(i) for i in input().split()]
	for j in range(1,W+1) :
		if i != 0 :
			if j < wv[0]  :
				noWeight[i][j] = noWeight[i-1][j]
			else :
				noWeight[i][j] = max(noWeight[i-1][j - wv[0]] + wv[1], noWeight[i-1][j])
		else :
			if j >= wv[0] :
				noWeight[i][j] = wv[1]
			else :
				noWeight[i][j] = 0
	
print(noWeight[N-1][W])
Buggy python submission (verdict: Runtime Error):
N, W = [int(i) for i in input().split()]
noValue = [[W+1 for j in range(10001)] for i in range(N)]
w,v = [int(i) for i in input().split()]
maxValue = v
noValue[0][v] = w

for i in range(1,N) :
	noValue[i][0] = 0
	w, v = [int(i) for i in input().split()]
	for j in range(1,maxValue+v+1) :
		if j < v  :
			noValue[i][j] = noValue[i-1][j]
		else :
			if noValue[i-1][j - v] == W + 1 :
				if j == v :
					noValue[i][j] = w
					maxValue = max(maxValue, j)
				else :
					noValue[i][j] = noValue[i-1][j]
			elif noValue[i-1][j-v] + w > W :
				noValue[i][j] = noValue[i-1][j]
			else :
				noValue[i][j] = min(noValue[i-1][j - v] + w, noValue[i-1][j])
				maxValue = max(maxValue, j)
print(maxValue)

Fixed submission:
N, W = [int(i) for i in input().split()]
noValue = [[W+1 for j in range(100001)] for i in range(N)] # 重さ[番号][価値]
w,v = [int(i) for i in input().split()]
maxValue = v
noValue[0][v] = w

for i in range(1,N) :	
	noValue[i][0] = 0
	w, v = [int(i) for i in input().split()] # w, v = w_i, v_i
	for j in range(1,min(maxValue+v+1, 100001)) : # 現在の価値の最大+今の入力の価値 or 価値の最大値 の小さいほう
		if j < v  :
			noValue[i][j] = noValue[i-1][j]
		else :
			if noValue[i-1][j - v] == W + 1 :
				if j == v :
					noValue[i][j] = w
					maxValue = max(maxValue, j)
				else :
					noValue[i][j] = noValue[i-1][j]
			elif noValue[i-1][j-v] + w > W :
				noValue[i][j] = noValue[i-1][j]
			else :
				noValue[i][j] = min(noValue[i-1][j - v] + w, noValue[i-1][j])
				maxValue = max(maxValue, j)
print(maxValue)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

if (a % 2 == 0 ) or ( b % 2 == 0 ) :
	print('Even')
else :
	ptint('Odd')

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

if (a % 2 == 0 ) or ( b % 2 == 0 ) :
	print('Even')
else :
	print('Odd')
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().sprit())
if a<=b:print('unsafe')
else:print('safe')

Fixed submission:
a,b=map(int,input().split())
if a<=b: print('unsafe')
else: print('safe')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().sprit())
if a>b:print('unsafe')
else:print('safe')

Fixed submission:
a,b=map(int,input().split())
if a<=b: print('unsafe')
else: print('safe')
Buggy python submission (verdict: Runtime Error):
import numpy
print(input()*2*numpy.pi)

Fixed submission:
import numpy
print(int(input())*2*numpy.pi)

Buggy python submission (verdict: Runtime Error):
import numpy
print(input()*2*numpy.pi())

Fixed submission:
import numpy
print(int(input())*2*numpy.pi)
Buggy python submission (verdict: Runtime Error):
a=list(map(int, input().sprit()))
b=True
for i in a
	if i==7:
    	print('Yes')
        b=False
        break;
if b:
  print('No')


Fixed submission:
a=input()
ans='No'
for i in a:
  if i=='7':
    ans='Yes'
    break
print(ans)

Buggy python submission (verdict: Runtime Error):
a=input()
if a[0]='7':
	print('Yes')
elif a[1]='7'
	print('Yes')
elif a[2]='7'
	print('Yes')
else:
  print('No')

Fixed submission:
a=input()
ans='No'
for i in a:
  if i=='7':
    ans='Yes'
    break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [sorted(input()) for i in range(N)]
count = 0
li = []
for i in a:
    if i in li:
        count+=li.count(i)
    li.append(i)

print(count)

Fixed submission:
N = int(input())
S = [''.join(sorted(input().rstrip())) for _ in range(N)]


from collections import Counter
counter = Counter(S)
answer = sum(x * (x - 1) // 2 for x in counter.values())
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [sorted(input()) for i in range(N)]
count = 0
for i in range(N):
    for k in range(1+i,N):
        if a[i] == a[k]:
            count += 1
print(count)

Fixed submission:
N = int(input())
S = [''.join(sorted(input().rstrip())) for _ in range(N)]


from collections import Counter
counter = Counter(S)
answer = sum(x * (x - 1) // 2 for x in counter.values())
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [input() for i in range(N)]
li = []
count = 0
for i in range(N):
    li.append(sorted(a[i]))
for i in range(N):
    for k in range(1+i,N):
        if li[i] == li[k]:
            count += 1
print(count)

Fixed submission:
N = int(input())
S = [''.join(sorted(input().rstrip())) for _ in range(N)]


from collections import Counter
counter = Counter(S)
answer = sum(x * (x - 1) // 2 for x in counter.values())
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
a = [input() for i in range(N)]
li = []
count = 0
for i in a:
    li.append(collections.Counter(i))
for i in range(N):
    for k in range(1+i,N):
        if li[i] == li[k]:
            count += 1
print(count)

Fixed submission:
N = int(input())
S = [''.join(sorted(input().rstrip())) for _ in range(N)]


from collections import Counter
counter = Counter(S)
answer = sum(x * (x - 1) // 2 for x in counter.values())
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
l = []
for i in range(N-1):
    l.append(a[i+1]-a[i])
# print(l)
if any(i<=-2 for i in l):
    print("No")
    exit()
while 0 in l:
    l.remove(0)
# print(l)
for i in range(len(l)-1):
    if l[i] == -1 and l[i+1] == -1:
        print("No")
        exit()
print("Yes")

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
l = []
for i in range(N-1):
    if a[i+1]-a[i] != 0:
        l.append(a[i+1]-a[i])
# print(l)
if any(i<=-2 for i in l):
    print("No")
    exit()
# while 0 in l:
#     l.remove(0)
# # print(l)
for i in range(len(l)-1):
    if l[i] == -1 and l[i+1] == -1:
        print("No")
        exit()
print("Yes")

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

N = int(input())
a = list(map(int,input().split()))
l = []
for i in range(N-1):
    l.append(a[i+1]-a[i])
if any(i<=-2 for i in l):
    print("No")
if 0 in l:
    l.remove(0)
for i in range(len(l)):
    if l[i] == -1 and l[i+1]==-1:
        print("No")
        sys.exit()
print("Yes")

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
l = []
for i in range(N-1):
    if a[i+1]-a[i] != 0:
        l.append(a[i+1]-a[i])
# print(l)
if any(i<=-2 for i in l):
    print("No")
    exit()
# while 0 in l:
#     l.remove(0)
# # print(l)
for i in range(len(l)-1):
    if l[i] == -1 and l[i+1] == -1:
        print("No")
        exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
l = []

import sys
for i in range(N-1):
    l.append(a[i+1]-a[i])
if any(i<=-2 for i in l):
    print("No")
for i in range(N-1):
    total = l[i]
    for k in range(1,N-1):
        if total <　0:
            total += l[k]
            if k == N-2:
                print("No")
                sys.exit()
        else:
            break
print("Yes")


Fixed submission:
N = int(input())
a = list(map(int,input().split()))
l = []
for i in range(N-1):
    if a[i+1]-a[i] != 0:
        l.append(a[i+1]-a[i])
# print(l)
if any(i<=-2 for i in l):
    print("No")
    exit()
# while 0 in l:
#     l.remove(0)
# # print(l)
for i in range(len(l)-1):
    if l[i] == -1 and l[i+1] == -1:
        print("No")
        exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
import sys
for i in range(N-1):
    l.append(a[i+1]-a[i])
if any(i<=-2 for i in l):
    print("No")
for i in range(N-1):
    total = l[i]
    for k in range(1,N-1):
        if total <=0:
            total += l[k]
            if k == N-2:
                print("No")
                sys.exit()
        else:
            break
print("Yes")

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
l = []
for i in range(N-1):
    if a[i+1]-a[i] != 0:
        l.append(a[i+1]-a[i])
# print(l)
if any(i<=-2 for i in l):
    print("No")
    exit()
# while 0 in l:
#     l.remove(0)
# # print(l)
for i in range(len(l)-1):
    if l[i] == -1 and l[i+1] == -1:
        print("No")
        exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
a = int(input("a"))
b = int(input("b"))
c = (a+b)/2
if c % 1 == 0:
    print(c)
else:
    print("IMPOSSIBLE")


Fixed submission:
a,b = (int(x) for x in input().split())
c = (a+b)/2
if c % 1 == 0:
    print(round(c))
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
N = input()
l = list(map(int, input().split()))
t = sorted(l)
count = 0
for i in l:
    if l[i] == t[i]:
        count += 1

if count == 3:
    print("YES")
else:
    print("NO")

Fixed submission:
N = int(input())
l = [list(map(int, input().split())) for _ in range(1)][0]
t = sorted(l)
count = 0
for i in range(len(l)):
    if l[i] == t[i]:
        count += 1

if count == N - 2 or count == N:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
a = [input() for i in range(N)]
b = copy.deepcopy(a)
for i in b:
    del b[i]
    print(max(b))
    b = copy.deepcopy(a)

Fixed submission:
hankei = int(input())
ans = 3*(hankei*hankei)
print(ans)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
l = []
L = L%2019
R = R%2019
for i in range(R-L):
    for j in range(R-L):
        l.append((L+i)*(L+1+j)%2019)
print(min(l))

Fixed submission:
L, R = map(int, input().split())
l = []
if R - L >= 672:
    print(0)
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            l.append(i*j%2019)
    print(min(l))

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
l = []
for i in range(R-L):
    for j in range(R-L):
        l.append((L+i)*(L+1+j)%2019)
print(min(l))

Fixed submission:
L, R = map(int, input().split())
l = []
if R - L >= 672:
    print(0)
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            l.append(i*j%2019)
    print(min(l))
Buggy python submission (verdict: Runtime Error):
import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))

Fixed submission:
num = input()
l = [i for i in num]
count = 0
for k in range(0,len(l)-1):
    if l[k] == l[k+1]:
        count+=1
if count > 0:
    print("Bad")
else:
    print("Good")

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)

A, B, C, D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)

print((B-A+1) -(b_num - a_num))

Fixed submission:
num = input()
l = [i for i in num]
count = 0
for k in range(0,len(l)-1):
    if l[k] == l[k+1]:
        count+=1
if count > 0:
    print("Bad")
else:
    print("Good")
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
k = B - A + 1
A -= 1
count = round((B//C + B//D - B//((C*D)/math.gcd(C, D)))-(A//C + A//D - A//((C*D)/math.gcd(C, D))))
print(k-count)

Fixed submission:
import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
k = B - A +1
A -=1
count = round((B//C + B//D - B//((C*D)/math.gcd(C, D)))-(A//C + A//D - A//((C*D)/math.gcd(C, D))))

print(k-count)

Fixed submission:
import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
k = B - A
count = round(k//C + k//D - k//((C*D)/math.gcd(C,D)))
print(k-count)

Fixed submission:
import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))

Buggy python submission (verdict: Runtime Error):
from math import gcd
A, B, C, D = map(int, input().split())
k = B - A
count = round(k//C + k//D - k//((C*D)/gcd(C,D)))
print(k-count)


Fixed submission:
import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))

Buggy python submission (verdict: Runtime Error):
from math import gcd
A, B, C, D = map(int, input().split())
k = B - A
count = round(k//C + k//D - k//((C*D)/gcd(C,D)))
print(k-count)


Fixed submission:
import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))
Buggy python submission (verdict: Runtime Error):
N, X =map(int,input().split())
a = list(map(int,input().split()))
x = 0
count = 0
while x <= X:
    x += a[count]
    count += 1
print(count)

Fixed submission:
N, X =map(int,input().split())
a = list(map(int,input().split()))
x = 0
count = 0
for i in range(len(a)+1):
    count += 1
    if not i == len(a):
        x += a[i]
    else:
        break
    if x > X:
        break
print(count)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
S = [i for i in input()]
S[K-1] = S[K].lower()
print("".join(S))

Fixed submission:
N, K = map(int,input().split())
S = [i for i in input()]
S[K-1] = S[K-1].lower()
print("".join(S))

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
S = [i for i in input()]
S[K] = S[K].lower()
print("".join(S))

Fixed submission:
N, K = map(int,input().split())
S = [i for i in input()]
S[K-1] = S[K-1].lower()
print("".join(S))
Buggy python submission (verdict: Runtime Error):
from math import gcd
N = int(input())
A = list(map(int,input().split()))
top = [0]*(N+1)
bot = [0]*(N+1)
for i in range(N):
    top[i+1] = gcd(top[i],A[i])
    bot[N-i-1]= gcd(bot[N-i],A[N-i-1])
# print(top,bot)
ans = 0
for i in range(N):
    # print(gcd(top[i], bot[i + 1]))
    ans = max(ans,gcd(top[i],bot[i+1]))
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
top = [0]*(N+1)
bot = [0]*(N+1)
for i in range(N):
    top[i+1] = gcd(top[i],A[i])
    bot[N-i-1]= gcd(bot[N-i],A[N-i-1])
# print(top,bot)
ans = 0
for i in range(N):
    # print(gcd(top[i], bot[i + 1]))
    ans = max(ans,gcd(top[i],bot[i+1]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import  copy
N = int(input())
A = list(map(int,input().split()))
B = copy.deepcopy(A)
gcdlist = []
for i in range(N):
    del B[i]
    ans = B[0]
    for k in range(1,len(B)):
        ans = gcd(ans,B[k])
    gcdlist.append(ans)
    B = copy.deepcopy(A)
print(max(gcdlist))

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
top = [0]*(N+1)
bot = [0]*(N+1)
for i in range(N):
    top[i+1] = gcd(top[i],A[i])
    bot[N-i-1]= gcd(bot[N-i],A[N-i-1])
# print(top,bot)
ans = 0
for i in range(N):
    # print(gcd(top[i], bot[i + 1]))
    ans = max(ans,gcd(top[i],bot[i+1]))
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import ceil
N = int(input())
a = [int(input()) for i in range(5)]
i = a.index(min(a))
ans = i-1 + ceil(N/min(a)) + 5 -i
print(ans)

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):
import math
N = int(input())
A = list(map(int, input().split()))
x = A[0]
for i in range(len(A)-1):
    x= math.gcd(x,A[i+1])
print(x)

Fixed submission:
import fractions
N = int(input())
A = list(map(int, input().split()))
x = A[0]
for i in range(len(A)-1):
    x= fractions.gcd(x,A[i+1])
print(x)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = sorted(list(map(int,input().split())))
if M >1:
    l = [X[i+1]-X[i] for i in range(M-1)]
else:
    print(0)
    exit()
ll = sorted(l,reverse=True)
z = 0
for i in range(N-1):
    z += ll[i]
print(sum(l)-z)

Fixed submission:
N, M = map(int,input().split())
X = sorted(list(map(int,input().split())))
if M > 1:
    l = [X[i+1]-X[i] for i in range(M-1)]
else:
    print(0)
    exit()
ll = sorted(l, reverse=True)
z = sum(ll[:N-1])
print(sum(l)-z)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = sorted(list(map(int,input().split())))
if len(X) >1:
    l = [X[i+1]-X[i] for i in range(M-1)]
else:
    print(0)
    exit()
ll = sorted(l,reverse=True)
for i in range(N-1):
    ma = l.index(ll[i])
    l[ma] = 0
print(sum(l))

Fixed submission:
N, M = map(int,input().split())
X = sorted(list(map(int,input().split())))
if M > 1:
    l = [X[i+1]-X[i] for i in range(M-1)]
else:
    print(0)
    exit()
ll = sorted(l, reverse=True)
z = sum(ll[:N-1])
print(sum(l)-z)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
X = sorted(list(map(int,input().split())))
if len(X) >1:
    l = [X[i+1]-X[i] for i in range(M-1)]
else:
    print(0)
    exit()
for i in range(N-1):
    ma = l.index(max(l))
    l[ma] = 0
print(sum(l))

Fixed submission:
N, M = map(int,input().split())
X = sorted(list(map(int,input().split())))
if M > 1:
    l = [X[i+1]-X[i] for i in range(M-1)]
else:
    print(0)
    exit()
ll = sorted(l, reverse=True)
z = sum(ll[:N-1])
print(sum(l)-z)