Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def searchInsert(nums, target):
    l = 0
    r = len(nums) - 1
    while (l <= r):
        mid = (l + r) // 2
        if target == nums[mid]:
            return mid
        elif target > nums[mid]:
            l = mid + 1
        else:
            r = mid - 1
    return l
x,y=map(int,input().split())
a=set(list(map(int,input().split())))
if y==0:
    print(x)
else:
    b=[i for i in range(1,101)]
    b=set(b)
    c=list(b-a)
    t=searchInsert(c,x)

    print(min(c[t],c[t-1]))


Fixed submission:

x,y=map(int,input().split())
a=set(list(map(int,input().split())))
if y==0:
    print(x)
else:
    b=[i for i in range(-5,105)]
    b=set(b)
    c=list(b-a)
    c.append(x)
    c.sort()

    r=c.index(x)
    
    p=abs(c[r]-c[r-1])
    q=abs(c[r]-c[r+1])
    if p==q:
            print(min(c[r-1],c[r+1]))
    elif p>q:
            print(c[r+1])
    else:
            print(c[r-1])
Buggy python submission (verdict: Time Limit Exceeded):
import math

# for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
p = 1
if 0 in a:
    print(0)
else:
    for i in range(len(a)):
        p = p * a[i]

    if p > math.pow(10, 18):
        print(-1)
    else:
        print(p)

Fixed submission:
import math

# for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
p = 1
r=0
m=math.pow(10,18)
if 0 in a:
    print(0)
else:
    for i in range(n):

        p = p * a[i]
        if p>m:
            r+=1
            break

    if r>0:
        print(-1)
    else:
        print(p)

Buggy python submission (verdict: Time Limit Exceeded):
import math
#for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
p=1
for i in range(len(a)):
    p=p*a[i]

if p>math.pow(10,18):
    print(-1)
else:
    print(p)


Fixed submission:
import math

# for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
p = 1
r=0
m=math.pow(10,18)
if 0 in a:
    print(0)
else:
    for i in range(n):

        p = p * a[i]
        if p>m:
            r+=1
            break

    if r>0:
        print(-1)
    else:
        print(p)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
k=0
for i in range(n):
    for j in range(i+1,n):
        if abs(a[i]+a[j])==abs(j-i):
            k+=1
print(k)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
k=0
b={}
for i in range(n):
    if a[i]+i in b:
        b[a[i]+i]+=1
    else:
        b[a[i]+i]=1
    if i-a[i] in b:
        k+=b[i-a[i]]
print(k)
Buggy python submission (verdict: Runtime Error):
import math
print(2*math.pi()*int(input()))

Fixed submission:
print(2*(22/7)*int(input()))
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
s=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            s+=gcd(i,gcd(j,k))
print(s)

            


Fixed submission:
import math
n=int(input())
s=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            s+=math.gcd(i,math.gcd(j,k))
print(s)
Buggy python submission (verdict: Runtime Error):
a=list(input())
b=a.copy()
b.reverse()
n=len(a)
k=0
r=''
s=''
rr=''
t=''
if (n-1)//2>n:
    k+=1
else:
    t=a[:(n-1)//2]
    s=t.copy()
    s.reverse()
if (n+3)//2-1>n:
    k+=1
else:

    r=a[(n+3)//2-1:n]
    rr=r.copy()
    rr.reverse()
if k>0:
    print('No')
else:
    if a==b and r==rr and t==s:
        print('Yes')
    else:
        print('No')


Fixed submission:
def reverse(s):
    return s[::-1]
a=str(input())
b=reverse(a)
n=len(a)
c=a[:(n-1)//2]
d=reverse(c)
e=a[(n+3)//2-1:n]
f=reverse(e)

if a==b and c==d and e==f:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a=list(input())
b=a.copy()
b.reverse()
n=len(a)
t=a[:(n-1)//2]
s=t.copy()
s.reverse()
r=a[(n+3)//2-1:n]
rr=r.copy()
rr.reverse()

if a==b and r==rr and t==s:
    print('Yes')
else:
    print('No')

Fixed submission:
def reverse(s):
    return s[::-1]
a=str(input())
b=reverse(a)
n=len(a)
c=a[:(n-1)//2]
d=reverse(c)
e=a[(n+3)//2-1:n]
f=reverse(e)

if a==b and c==d and e==f:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b={}
for i in range(n):
    if a[i] in b:
        b[a[i]]+=1
    else:
        b[a[i]]=1

for i in range(n):
    s = 0
    b[a[i]]-=1
    for key,val in b.items():
        if val>1:
            s+=val*(val-1)//2
    b[a[i]]+=1
    print(s)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b={}
p=0
for i in range(n):
    if a[i] in b :
        b[a[i]]+=1
    else:
        b[a[i]]=1
for key,val in b.items():
    p+=val*(val-1)//2



for i in range(n):
    t=b[a[i]]
    s=t*(t-1)//2
    r=(t-1)*(t-2)//2

    print(p-s+r)
Buggy python submission (verdict: Runtime Error):
import math
n,k=map(int,input().split())
t=math.log(n,k)
if t==int(t):
    print(int(t))
else:
    print(int(t)+1)


Fixed submission:
n,k=map(int,input().split())
if n<10:
    print(k+100*(10-n))
else:
    print(k)

Buggy python submission (verdict: Runtime Error):
import math
n,k=map(int,input().split())
t=math.log(n,k)
if t==int(t):
    print(int(t))
else:
    print(int(t)+1)


Fixed submission:
n,k=map(int,input().split())
if n<10:
    print(k+100*(10-n))
else:
    print(k)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
b=[]
c=[]
for i in range(n):
    b=str(input())
    if b in a:
        c[a.index(b)]+=1
    else:
        a.append(b)
        c.append(1)
t=max(c)
e=[]
for i in range(len(c)):
    if c[i]==t:
        e.append(a[i])
e.sort()
for i in range(len(e)):
    print(e[i])



Fixed submission:
n=int(input())
a=[]
b=[]
c=[]
for i in range(n):
    b=str(input())
    a.append(b)
freq = {}
for item in a:
        if (item in freq):
            freq[item] += 1
        else:
            freq[item] = 1

t=0
b=[]
for items in freq.values():
    if items>t:
        t=items

for key,val in freq.items():
    if val==t:
        b.append(key)
b.sort()
for i in range(len(b)):
    print(b[i])
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
max1=0
s=0
c=[]
p=0
for i in range(n):
    s+=a[i]
    c.append(s)

    if i-k>-1:
        b.append(s-c[i-k])


t=max(b)
r=b.index(t)

for i in range(r+1,r+k+1):
    p+=(1/a[i])*(a[i]*(a[i]+1)/2)
print(p)


Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
max1=0
s=0
c=[]
p=0
if n==k:
    for i in range(n):
        p += (1 / a[i]) * (a[i] * (a[i] + 1) / 2)
else:
    for i in range(n):
        s+=a[i]
        c.append(s)

        if i-k>-1:
            b.append(s-c[i-k])


    t=max(b)
    r=b.index(t)

    for i in range(r+1,r+k+1):
        p+=(1/a[i])*(a[i]*(a[i]+1)/2)
print(p)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
    if a>0:
        a-=1
    else:
        if b>0:
            b-=1
        else:
            break
print(a,b)

Fixed submission:
a,b,k=map(int,input().split())
if k>a and k<a+b:
    k=k-a
    a=0
    b=b-k
elif k<=a:
    a=a-k
else:
    a=0
    b=0
print(a,b)
Buggy python submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
print(int(n*m/math.gcd(n,m)))


Fixed submission:
def gcd(a,b):
    if a<b:
        t=a
        a=b
        b=t
    while b!=0:
            a,b=b,a%b
    return a

n,m=map(int,input().split())
print(int(n*m/gcd(n,m)))

Buggy python submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
print(n*m//math.gcd(n,m))


Fixed submission:
def gcd(a,b):
    if a<b:
        t=a
        a=b
        b=t
    while b!=0:
            a,b=b,a%b
    return a

n,m=map(int,input().split())
print(int(n*m/gcd(n,m)))
Buggy python submission (verdict: Runtime Error):
s = input()
if s == "SSS":
    print(0)
if s == 'SSR' or s == 'SRS' or s == 'RSS'or s == 'RSR':
    print(1)
if s == 'RRS'or s == 'SRR':
    print(2)
if s == 'RRR' print(3)


Fixed submission:
s = input()
if s == "SSS":
    print(0)
if s == 'SSR' or s == 'SRS' or s == 'RSS'or s == 'RSR':
    print(1)
if s == 'RRS'or s == 'SRR':
    print(2)
if s == 'RRR':
    print(3)
Buggy python submission (verdict: Runtime Error):
n=int(input(n))
print(n//2+n%2)

Fixed submission:
n = int(input())
print(n//2+n % 2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 0

for i in range(1,N):
    ans += A[i-1] * sum(A[i:])
    ans = ans % 1000000007

print(ans)


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

ans = 0
sum = sum(A)

for i in range(1,N):
    sum -= A[i-1]
    ans += A[i-1] * sum
    ans = ans % 1000000007

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

L = 9*K
ans = 0

if (L % 2 == 0) or (L % 5 == 0):
    ans = -1
else:
    a = 0
    for i in range(1,L):
        a = 7*(10**i -1)
        if a % L == 0:
            ans = i
            break
print(ans)


Fixed submission:
K = int(input())
ref = 0
ans = 0

for i in range(K):
    ref = (10*ref + 7) % K
    if ref == 0:
        ans = i + 1
        break
    elif i == K - 1:
        ans = -1
        break

print(ans)

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

L = 9*K
ans = 0

if (L % 2 == 0) or (L % 5 == 0):
    ans = -1
else:
    a = 0
    for i in range(1,L):
        a = 7*(10**i -1)
        if a % L == 0:
            ans = i
            break
print(ans)

Fixed submission:
K = int(input())
ref = 0
ans = 0

for i in range(K):
    ref = (10*ref + 7) % K
    if ref == 0:
        ans = i + 1
        break
    elif i == K - 1:
        ans = -1
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

lst = [0]*(N-K+1)

lst[0] = 1
for i in range(K):
    lst[0] = lst[0] * A[i]

for i in range(1,N-K+1):
    lst[i] = lst[i-1] / A[i-1]
    lst[i] = lst[i] * A[K-1+i]
    if lst[i] > lst[i-1]:
        print("Yes")
    else:
        print("No")


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

for i in range(1,N-K+1):
    if (A[K-1+i] / A[i-1]) > 1:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(map(int, input().split())))

ans = A[N]
cnt = 1
i = 1

while cnt <= N:
    ans += 2*A[N-i]
    i += 1
    cnt += 2

if N != cnt:
    ans -= A[N-i]

print(ans) 

Fixed submission:
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

ans = -A[0]
for i in range(N):
    ans += A[i//2]
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

# A机から0〜N冊読んで、残り時間でB机から何冊読めるかを考える
lst = [0]*(N+1)

for i in range(N+1):
    time = 0
    time = sum(A[0:i])　# A机からi冊読んだときの所要時間
    if time > K:
        break # この時点で制限時間Kを超えていたらB机は無視する
    else:
        for j in range(M):
            # 
            if time + B[j] <= K:
                time = time + B[j]
            else:
                lst[i] = i + j
                break

res = max(lst)
print(res)

"""
3 4 240
60 90 120
80 150 80 150

3 4 730
60 90 120
80 150 80 150
"""

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

a, b = [0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

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

res = 0
time = 0

while time <= K:
    if A[0] <= B[0]:
        time = time + A.pop(0)
    else:
        time = time + B.pop(0)
    res += 1

print(res)

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

a, b = [0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lst = [0]*N

for i in range(1,N+1):
    for j in range(1,i+1):
        if i % j == 0:
            lst[i-1] += i

print(sum(lst))

Fixed submission:
# ABC172_D
N = int(input())
ans = 0

for i in range(1,N+1):
	ans += ((N//i)*(i+(N//i)*i))/2

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
def num_divisors(n):
    num = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            num += 1
            if i != n // i:
                num += 1
    return num

N = int(input())

S = 0
for i in range(1,N+1):
    S += i * num_divisors(i)
print(S)

Fixed submission:
# ABC172_D
N = int(input())
ans = 0

for i in range(1,N+1):
	ans += ((N//i)*(i+(N//i)*i))/2

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
def num_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return len(divisors)

N = int(input())

S = 0
for i in range(1,N+1):
    S += i * num_divisors(i)
print(S)

Fixed submission:
# ABC172_D
N = int(input())
ans = 0

for i in range(1,N+1):
	ans += ((N//i)*(i+(N//i)*i))/2

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
def num_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return len(divisors)

N = int(input())

S = 0
for i in range(1,N+1):
    S += i * num_divisors(i)
print(S)

Fixed submission:
# ABC172_D
N = int(input())
ans = 0

for i in range(1,N+1):
	ans += ((N//i)*(i+(N//i)*i))/2

print(int(ans))

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

N = int(input())

S = 0
for i in range(1,N+1):
    S += i * len(sympy.divisors(i))
print(S)

Fixed submission:
# ABC172_D
N = int(input())
ans = 0

for i in range(1,N+1):
	ans += ((N//i)*(i+(N//i)*i))/2

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lst = list(map(int, input().split()))

res = 1
for a in lst:
    res = res*a

if res > 1000000000000000000:
    print("-1")
else:
    print(res)

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

if 0 in lst:
    print("0")
    quit()

res = 1
for a in lst:
    res = res*a
    if res > 1000000000000000000:
        print("-1")
        quit()
    else:
        pass

print(res)
Buggy python submission (verdict: Runtime Error):
S = str(input())
if S = "ABC":
    print("ARC")
else:
    print("ABC")

Fixed submission:
S = str(input())
if S == "ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
X, Y, Z = str(input())
print(Z + " " + X + " " + Y)

Fixed submission:
X, Y, Z = map(str, input().split())
print(Z + " " + X + " " + Y)
Buggy python submission (verdict: Runtime Error):
lst = []

for i in range(10):
    for j in range(10):
        for k in range(10):
            lst.append(str(i)+str(j)+str(k))

N, M = map(int, input().split())
S = []
C = []
for l in range(M):
    S.append(0)
    C.append(0)
    S[l], C[l] = map(int, input().split())
    C[l] = str(C[l])

for n in range(1000):
    for m in range(M):
        if lst[n][S[m]-1] != C[m]:
            lst[n] = "1000"
    lst[n] = int(lst[n])

if min(list) == 1000:
    print(-1)
else:
    print(min(lst))

Fixed submission:
# C - Guess The Number
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

ans = [0,0,0]

# 条件だけで不適がわかるものは弾く
for i in range(M):
    for j in range(i+1,M):
        if (SC[i][0] == SC[j][0]) and (SC[i][1] != SC[j][1]):
            print(-1)
            quit()

# 各桁を指定をする
for k in range(M):
    ans[SC[k][0]-(N-2)] = str(SC[k][1])

# 頭の桁が0で指定されると不適(str型かどうかで判定する)
if (ans[3-N] == "0") and (N == 1):
    print(0)
    quit()
elif ans[3-N] == "0":
    print(-1)
    quit()

# N桁の文字列にする
ans = [str(ans[i]) for i in range(3)]
res = "".join(ans)
res = res[(3-N):4]

# 頭の桁が指定無しの0だったら1に変える
if (res[0] == "0") and (N == 1):
    res = "0"
elif res[0] == "0":
    ref = list(res)
    ref[0] = "1"
    res = "".join(ref)

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# ABC155_C
N = int(input())
S = [str(input()) for _ in range(N)]

SS = list(set(S))
M = len(SS)

lst = [0]*M
for i in range(M):
    lst[i] = S.count(SS[i])

ans = []
for j in range(M):
    if lst[j] == max(lst):
        ans.append(SS[j])

ans = sorted(list(set(ans)))
for a in ans:
    print(a)

Fixed submission:
# -*- coding: utf-8 -*-
# ABC155_C
import collections

N = int(input())
s = [str(input()) for _ in range(N)]

S = collections.Counter(s)
M = S.most_common()[0][1]
S = sorted(S.most_common())

for i in range(len(S)):
    if S[i][1] == M:
        print(S[i][0])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

# Input
s = [input() for i in range(3)]
ST = list(s[0].split())
S = str(ST[0])
T = str(ST[1])

AB = list(s[1].split())
A = int(AB[0])
B = int(AB[1])

U = str(s[3])


# Proccess
If U == S:
	A -= 1
else:
	B -= 1

# Output							
print(str(A)+" "+str(B))

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

# Input
s = [input() for i in range(3)]
ST = list(s[0].split())
S = str(ST[0])
T = str(ST[1])

AB = list(s[1].split())
A = int(AB[0])
B = int(AB[1])

U = str(s[2])


# Proccess
if U == S:
	A -= 1
else:
	B -= 1

# Output							
print(str(A)+" "+str(B))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

# Input
s = [input() for i in range(2)]
N = int(s[0])
As = sorted(list(s[1].split()))

# Proccess
for i in range(0,N):
	if As[i] == As[i+1]:
		Anser = "No"
		break
	else:
		Anser = "Yes"
		
# Output							
print(Anser)

Fixed submission:
# C - Distinct or Not
N = int(input())
A = list(map(int, input().split()))

M = len(set(A))

if N == M:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

# Input
s = [input() for i in range(2)]
N = int(s[0])
As = sorted(list(s[1].split()))

# Proccess
for i in range(N):
	if As[i] == As[i+1]:
		Anser = "No"
		break
	else:
		Anser = "Yes"
		
# Output							
print(Anser)

Fixed submission:
# C - Distinct or Not
N = int(input())
A = list(map(int, input().split()))

M = len(set(A))

if N == M:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
A = int(str(a)**b)
B = int(str(b)**a)

if A >= B:
    print(A)
else:
    print(B)

Fixed submission:
a, b = map(int, input().split())
A = int(str(a)*b)
B = int(str(b)*a)

if A >= B:
    print(A)
else:
    print(B)
Buggy python submission (verdict: Time Limit Exceeded):
s = [input() for _ in range(2)]
N = int(s[0])
P = s[1].split()
for i in range(N):
    P[i] = int(P[i])
P = [N+1] + P

count = -1

for i in range(N+1):
    if P[i] <= min(P[0:i+1]):
        count += 1
            
print(count)


Fixed submission:
s = [input() for _ in range(2)]
N = int(s[0])
P = s[1].split()
for i in range(N):
    P[i] = int(P[i])
P = [N+1] + P

count = 0
min_p = N+1

for i in range(N+1):
    if min_p > P[i]:
        count += 1
        min_p = P[i]
            
print(count)
Buggy python submission (verdict: Runtime Error):
i = input(map(int, input().split()))
A = i[0]
B = i[1]

if A-B*2>0;
	print(A-B*2)
  else;
	print(0)
    

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

# Input
i = list(map(int, input().split()))

# Process
X = i[0] - i[1]*2

# Output
if X > 0:
    print(X)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
    if A[i] >= K:
        cnt += 1

print(ans)

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

ans = 0
for i in range(N):
    if A[i] >= K:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

# Input
s = [input() for i in range(2)]

N = int(s[0].split()[0])
M = int(s[0].split()[1])
A = list(map(int, s[1].split()))

A.sort(reverse=True)

# 2で割って小数点切り下げする操作を大きい金額から順次M回繰り返す
for i in range(M):
    A[A.index(max(A))] = max(A) // 2

P = sum(A)

# Output
print(P)


Fixed submission:
s = input()
 
if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')

Buggy python submission (verdict: Runtime Error):
s = input()
 
if s == 'Sunny':
  pirnt('Cloudy')
elif s == 'Cloudy':
  pirnt('Rainy')
elif s == 'Rainy':
  print('Sunny')
else:
  break
  

Fixed submission:
s = input()
 
if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')

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

if s == 'Sunny':
  pirnt('Cloudy')
elif s == 'Cloudy':
  pirnt('Rainy')
else:
  print('Sunny')

Fixed submission:
s = input()
 
if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())
S[K-1] = S[K-1].lower()
print(sum(S))

Fixed submission:
N, K = map(int, input().split())
S = list(input())
S[K-1] = S[K-1].lower()
print("".join(S))
Buggy python submission (verdict: Runtime Error):
S = input()
f = int(S[0]+S[1])
b = int(S[2]+S[3])

def judge(int):
    if 1 <= int <= 12
        return 0
    else:
        return 1
ref = [judge(f), judge(b)]

if ref == [1, 1]:
    print("NA")
elif ref == [0, 1]:
    print("MMYY")
elif ref == [1, 0]:
    print("YYMM")
else:
    print("AMBIGUOUS")


Fixed submission:
S = input()
f = int(S[0]+S[1])
b = int(S[2]+S[3])

def judge(int):
    if 1 <= int <= 12:
        return 0
    else:
        return 1
ref = [judge(f), judge(b)]

if ref == [1, 1]:
    print("NA")
elif ref == [0, 1]:
    print("MMYY")
elif ref == [1, 0]:
    print("YYMM")
else:
    print("AMBIGUOUS")
Buggy python submission (verdict: Runtime Error):
A, B = map(input().split())

ans = 0
for i in range(2):
    if A >= B:
        ans += A
        A -= 1
    else:
        ans += B
        B -= 1
print(ans)

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

ans = 0
for i in range(2):
    if A >= B:
        ans += A
        A -= 1
    else:
        ans += B
        B -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(input())
N = len(s)

ref = ["A","C","G","T"]
lst = []

for i in range(N):
    ans = ""
    if s[i] in ref:
        while s[i] in ref:
            ans = ans + s[i]
            i += 1
    lst.append(ans)

ans = -float("inf")
for i in range(N):
    ans = max(ans, len(lst[i]))

print(ans)

Fixed submission:
s = list(input())
N = len(s)

ref = ["A","C","G","T"]
lst = []

for i in range(N):
    ans = ""
    if s[i] in ref:
        while s[i] in ref:
            ans = ans + s[i]
            i += 1
            if i >= N:
                break
    lst.append(ans)

ans = -float("inf")
for i in range(N):
    ans = max(ans, len(lst[i]))

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

lst = [1]
for i in range(2,max(A,B)):
    if A % i == 0 and B % i == 0:
        lst.append(i)

print(lst[-K])


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

lst = []
for i in range(1,min(A,B)+1):
    if A % i == 0 and B % i == 0:
        lst.append(i)

print(lst[-K])

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

lst = []
for i in range(1,max(A,B)):
    if A % i == 0 and B % i == 0:
        lst.append(i)

print(lst[K-1])


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

lst = []
for i in range(1,min(A,B)+1):
    if A % i == 0 and B % i == 0:
        lst.append(i)

print(lst[-K])