Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
lst_a = [int(input()) for _ in range(M)]
MOD = 10**9 + 7

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in lst_a else 1
for i in range(2, N+1):
    dp[i] = 0 if i in lst_a else dp[i-1] + dp[i-2]
    dp[i] %= MOD
ans = dp[N] % MOD

print(ans)

Fixed submission:
N, M = map(int, input().split())
set_a = set([int(input()) for _ in range(M)])
MOD = 10**9 + 7

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in set_a else 1
for i in range(2, N+1):
    dp[i] = 0 if i in set_a else dp[i-1] + dp[i-2]
ans = dp[N] % MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
lst_a = [int(input()) for _ in range(M)]
MOD = 10**9 + 7

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in lst_a else 1
for i in range(2, N+1):
    dp[i] = 0 if i in lst_a else dp[i-1] + dp[i-2]
ans = dp[N] % MOD

print(ans)

Fixed submission:
N, M = map(int, input().split())
set_a = set([int(input()) for _ in range(M)])
MOD = 10**9 + 7

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in set_a else 1
for i in range(2, N+1):
    dp[i] = 0 if i in set_a else dp[i-1] + dp[i-2]
ans = dp[N] % MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
lst_a = [int(input()) for _ in range(M)]
MOD = 10**9 + 7

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in lst_a else 1
for i in range(2, N+1):
    dp[i] = 0 if i in lst_a else dp[i-1] + dp[i-2]
ans = dp[N] % MOD

print(ans)

Fixed submission:
N, M = map(int, input().split())
set_a = set([int(input()) for _ in range(M)])
MOD = 10**9 + 7

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in set_a else 1
for i in range(2, N+1):
    dp[i] = 0 if i in set_a else dp[i-1] + dp[i-2]
ans = dp[N] % MOD

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heapify, heappush, heappop


N, M = map(int, input().split())
lst_A = list(map(int, input().split()))


numbers = []
heapify(numbers)
for a in lst_A:
    heappush(numbers, -a)
for _ in range(M):
    b, c = map(int, input().split())
    for _ in range(b):
        heappush(numbers, -c)


ans = -sum(heappop(numbers) for _ in range(N))
print(ans)


Fixed submission:
N, M = map(int, input().split())
lst_A = list(map(int, input().split()))
lst_BC = [list(map(int, input().split())) for _ in range(M)]


lst_A.sort()
lst_BC.sort(key=lambda x:-x[1])


lst_D = []
add_num = N
for b, c in lst_BC:
    lst_D += [c] * min(b, N - len(lst_D))
lst_D = lst_D + [0] * (N - len(lst_D))


for i in range(N):
    if lst_A[i] >= lst_D[i]:
        break
    lst_A[i] = lst_D[i]


print(sum(lst_A))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
lst_A = list(map(int, input().split()))
lst_BC = [tuple(map(int, input().split())) for _ in range(M)]


lst_A.sort()
lst_BC.sort(key=lambda x:x[1], reverse=True)


lst_D = []
add_num = N
for tpl in lst_BC:
    b, c = tpl[0], tpl[1]
    if add_num >= b:
        lst_D = lst_D + [c] * b
        add_num -= b
    else:
        lst_D = lst_D + [c] * add_num
lst_D = lst_D + [0] * (N - len(lst_D))


for i in range(N):
    if lst_A[i] >= lst_D[i]:
        break
    lst_A[i] = lst_D[i]


print(sum(lst_A))

Fixed submission:
N, M = map(int, input().split())
lst_A = list(map(int, input().split()))
lst_BC = [list(map(int, input().split())) for _ in range(M)]


lst_A.sort()
lst_BC.sort(key=lambda x:-x[1])


lst_D = []
add_num = N
for b, c in lst_BC:
    lst_D += [c] * min(b, N - len(lst_D))
lst_D = lst_D + [0] * (N - len(lst_D))


for i in range(N):
    if lst_A[i] >= lst_D[i]:
        break
    lst_A[i] = lst_D[i]


print(sum(lst_A))
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0 and ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Fixed submission:
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0:
                if ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0 and ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Fixed submission:
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0:
                if ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0 and ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Fixed submission:
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0:
                if ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0 and ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Fixed submission:
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0:
                if ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
cnt = 0

for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0:
                if ball2 % B == 0:
                    cnt += 1

print(cnt)

Fixed submission:
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0:
                if ball2 % B == 0:
                    cnt += 1
 
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from fractions import gcd


def gcd4args(args):
    return reduce(gcd, args)


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

ans = 0
for i in range(N):
    # lstTmp = lstA[0:i] + lstA[i+1:]
    tmp = lstA[i]
    if i < N-1:
        lstA[i] = lstA[i+1]
        # print(lstA)
        ans = max(ans, gcd4args(lstA))
    else:
        lstA[i] = lstA[i-1]
        # print(lstA)
        ans = max(ans, gcd4args(lstA))
    lstA[i] = tmp
    # print(lstA)
print(ans)

Fixed submission:
from fractions import gcd


N = int(input())
lstA = list(map(int, input().split()))
lstL = [0] * N
lstR = [0] * N


for i in range(1, N):
    lstL[i] = gcd(lstL[i-1], lstA[i-1])
for i in range(N-1)[::-1]:
    lstR[i] = gcd(lstR[i+1], lstA[i+1])
lstGcd = [gcd(lstL[i], lstR[i]) for i in range(N)]
ans = max(lstGcd)


print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from fractions import gcd


def gcd4args(args):
    return reduce(gcd, args)


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

ans = 0
for i in range(N):
    lstTmp = lstA[0:i] + lstA[i+1:]
    ans = max(ans, gcd4args(lstTmp))
print(ans)

Fixed submission:
from fractions import gcd


N = int(input())
lstA = list(map(int, input().split()))
lstL = [0] * N
lstR = [0] * N


for i in range(1, N):
    lstL[i] = gcd(lstL[i-1], lstA[i-1])
for i in range(N-1)[::-1]:
    lstR[i] = gcd(lstR[i+1], lstA[i+1])
lstGcd = [gcd(lstL[i], lstR[i]) for i in range(N)]
ans = max(lstGcd)


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = float("INF")

for i in range(N+1):
    left = S[0:i]
    right = S[i::]
    cnt_left = left.count("#")
    cnt_right = right.count(".")
    change_stone = cnt_left + cnt_right
    ans = min(ans, change_stone)
print(ans)

Fixed submission:
N = int(input())
S = input()
left = 0
right = S.count(".")
ans = left + right

for c in S:
    if c == "#":
        left += 1
    else:
        right -= 1
    ans = min(ans, left + right)

print(ans)
Buggy python submission (verdict: Runtime Error):
lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]

sum_lst = sum(lst_int)

lst_diff = []
for i in lst_str:
    val = int(i[-1])
    if val != 0:
        lst_diff.append(10 - val)

diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)

Fixed submission:
lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]

sum_lst = sum(lst_int)

lst_diff = []
for i in lst_str:
    val = int(i[-1])
    if val != 0:
        lst_diff.append(10 - val)

if lst_diff == []:
    lst_diff = [0]
diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)

Buggy python submission (verdict: Runtime Error):
lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]

sum_lst = sum(lst_int)

lst_diff = []
for i in lst_str:
    val = 10 - int(i[-1])
    if val != 10:
        lst_diff.append(val)

diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)

Fixed submission:
lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]

sum_lst = sum(lst_int)

lst_diff = []
for i in lst_str:
    val = int(i[-1])
    if val != 0:
        lst_diff.append(10 - val)

if lst_diff == []:
    lst_diff = [0]
diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)

Buggy python submission (verdict: Runtime Error):
lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]
lst_diff = []

sum_lst = sum(lst_int)
for i in lst_str:
    val = 10 - int(i[-1])#一の位
    if val != 10:
        lst_diff.append(val)
# print(lst_diff)

diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)

Fixed submission:
lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]

sum_lst = sum(lst_int)

lst_diff = []
for i in lst_str:
    val = int(i[-1])
    if val != 0:
        lst_diff.append(10 - val)

if lst_diff == []:
    lst_diff = [0]
diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()

for _ in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    char = S[l:r+1]
    ans = char.count("AC")
    print(ans)


Fixed submission:
N, Q = map(int, input().split())
S = input()
len_S = len(S)

char = ""
ac = [0] * len_S
val = 0
for i in range(N):
    char += S[i]
    # print(char)
    # print(char[len(char)-2:len(char)+1])
    if char[len(char)-2:len(char)+1] == "AC":
        val += 1
    ac[i] = val
# print(ac)

for _ in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    ans = ac[r] - ac[l]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N = int(input())
S = input()

ans = 0
for i in range(1, N+1):
    tmp = 0
    lst = list(combinations(S, i))
    for l in lst:
        if len(set(l)) == len(l):
            tmp += 1
    ans += tmp
print(ans)

Fixed submission:
N = int(input())
S = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"

ans = 1
for char in alphabet:
    count_char = S.count(char) + 1
    ans *= count_char
ans -= 1
ans %= (10**9+7)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lst_a = list(map(int, input().split()))

def gcd(a, b):
    if b==0:
        return a
    else:
        gcd(b, a%b)

ans = lst_a[0]
for a in lst_a:
    # 配列の最初からひとつずつ最大公約数を取っていけばよい。
    ans = gcd(ans, a)

print(ans)

Fixed submission:
# import math
import fractions
from functools import reduce

def gcd_list(lst):
    # return reduce(math.gcd, lst)
    return reduce(fractions.gcd, lst)

N = int(input())
lst_monsters = map(int, input().split())
print(gcd_list(lst_monsters))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd_list(lst):
    return reduce(math.gcd, lst)

N = int(input())
lst_monsters = map(int, input().split())
print(gcd_list(lst_monsters))


Fixed submission:
# import math
import fractions
from functools import reduce

def gcd_list(lst):
    # return reduce(math.gcd, lst)
    return reduce(fractions.gcd, lst)

N = int(input())
lst_monsters = map(int, input().split())
print(gcd_list(lst_monsters))

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

import math
from functools import reduce
# def gcd(*lst):
#     return reduce(math.gcd, lst)

def gcd_list(lst):
    return reduce(math.gcd, lst)

ans = gcd_list(lst_monsters)
print(ans)

Fixed submission:
# import math
import fractions
from functools import reduce

def gcd_list(lst):
    # return reduce(math.gcd, lst)
    return reduce(fractions.gcd, lst)

N = int(input())
lst_monsters = map(int, input().split())
print(gcd_list(lst_monsters))

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

import math
from functools import reduce

def gcd_list(lst):
    return reduce(math.gcd, lst)

ans = gcd_list(lst_monsters)
print(ans)

Fixed submission:
# import math
import fractions
from functools import reduce

def gcd_list(lst):
    # return reduce(math.gcd, lst)
    return reduce(fractions.gcd, lst)

N = int(input())
lst_monsters = map(int, input().split())
print(gcd_list(lst_monsters))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

ans="NO"
if n%2==0:
    if k<=n//2:
        ans="YES"
else:
    if K<=(n+1)//2:
        ans="YES"
print(ans)

Fixed submission:
n, k = map(int, input().split())
ans = "NO"
if (n+1)//2 >= k:
    ans = "YES"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# 参考: https://cinnamo-coder.hatenablog.com/entry/2019/05/11/191130


n, k = map(int, input().split())
lst_h = list(map(int, input().split()))


# 1. DP[i] は、足場 i に到達するための最小コストと定義する
# 2. 状態遷移は min を使う
# 3. DPの初期化は、最小値を求めるので INF とする（足場1は例外）。
dp = [float("INF")] * n
dp[0] = 0
for i in range(n):
    for j in range(1, k + 1):
        # n 番目の足場を跳び越したら、次の足場を調べる
        if i + j > n - 1:
            break
        # 既存の dp[i + j] と、新たに計算する dp[i + j] の大小比較
        dp[i + j] = min(dp[i + j], dp[i] + abs(lst_h[i] - lst_h[i + j]))


# 計算量 O(nk)
ans = dp[n - 1]
print(ans)

Fixed submission:
n, k = map(int, input().split())
lst_h = list(map(int, input().split()))


dp = [float("INF")] * n
dp[0] = 0
for i in range(n):
    for j in range(1, k + 1):
        if i + j > n - 1:
            break
        dp[i + j] = min(dp[i + j], dp[i] + abs(lst_h[i] - lst_h[i + j]))


ans = dp[n - 1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
# 各 B の左にある B の数の和が答え
ans = 0
for i in range(1, n):
    if s[i] == "W":
        ans += s[:i].count("B")
print(ans)

Fixed submission:
# coding: utf-8
S = input()

cnt = 0
ans = 0
for i in range(len(S)):
    if S[i]=="B":
        cnt+=1
    else:
        ans += cnt
        cnt += 0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
S = input()
cnt = sum(S[0:i].count("B") for i in range(len(S)) if S[i]=="W")
print(cnt)


Fixed submission:
# coding: utf-8
S = input()

cnt = 0
ans = 0
for i in range(len(S)):
    if S[i]=="B":
        cnt+=1
    else:
        ans += cnt
        cnt += 0
print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import itertools
import sys

N, K = map(int, input().split())
# lst = [int(input()) for _ in range(N)]
lst = [int(i) for i in sys.stdin]
# lst2 = list(itertools.combinations(lst, K))
# print(lst2)

lst3 = []
# for l in lst2:
for l in itertools.combinations(lst, K):
    print(l)
    diff = max(l)-min(l)
    lst3.append(diff)

print(min(lst3))

Fixed submission:
# coding: utf-8
import itertools

N, K = map(int, input().split())
lst = sorted([int(input()) for _ in range(N)], reverse=True)

ans = 10000000000
for i in range(N-K+1):
    l = lst[i]-lst[i+K-1]
    if l < ans:
        ans = l
print(ans)

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

N, K = map(int, input().split())
lst = [int(input()) for _ in range(N)]
lst2 = list(itertools.combinations(lst, K))

lst3 = []
for l in lst2:
    diff = max(l)-min(l)
    lst3.append(diff)

print(min(lst3))

Fixed submission:
# coding: utf-8
import itertools

N, K = map(int, input().split())
lst = sorted([int(input()) for _ in range(N)], reverse=True)

ans = 10000000000
for i in range(N-K+1):
    l = lst[i]-lst[i+K-1]
    if l < ans:
        ans = l
print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import itertools
N = input()
ans = 0

for i in range(3, len(N)+1):
    for ptn in itertools.product((3,5,7), repeat=i):
        if (3 not in ptn) or (5 not in ptn) or (7 not in ptn):
            continue
        a = int("".join(list(map(str, ptn))))
        if a <= N:
            ans += 1
print(ans)

Fixed submission:
# coding: utf-8
N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in "753") else 0
    for c in "753":
        ret += dfs(s + c)
    return ret

print(dfs("0"))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
N = int(input())

ans = 0
if N <= 356:
    print(ans)
    exit()

if N >= 777777754:
    N = 777777753

for i in range(357,N+1,2):
    st = str(i)
    if ("0" in st) or ("1" in st) or ("2" in st) or ("4" in st) or ("6" in st) or ("8" in st) or ("9" in st):
        continue
    if ("3" in st) and ("5" in st) and ("7" in st):
        ans+=1
print(ans)


Fixed submission:
# coding: utf-8
N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in "753") else 0
    for c in "753":
        ret += dfs(s + c)
    return ret

print(dfs("0"))
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0;
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0 ;
            B-=1
        A+=B//2
        B=B//2
print(A, B)


Fixed submission:
# coding: utf-8
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0:
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0:
            B-=1
        A+=B//2
        B=B//2
print(A, B)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for i in range(K):
    if i%2!=0:
        if A%2!=0;
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2!=0;
            B-=1
        A+=B//2
        B=B//2
print(A, B)


Fixed submission:
# coding: utf-8
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0:
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0:
            B-=1
        A+=B//2
        B=B//2
print(A, B)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for i in range(K):
    if i%2==0:
        if A%2!=0;
            A-=1
        B+=A//2
    else:
        if B%2!=0;
            B-=1
        A+=B//2
print(A, B)


Fixed submission:
# coding: utf-8
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0:
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0:
            B-=1
        A+=B//2
        B=B//2
print(A, B)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for i in range(K):
    if i%2!=0:
        if A%2!=0;
            A-=1
        B+=A//2
    else:
        if B%2!=0;
            B-=1
        A+=B//2
print(A, B)


Fixed submission:
# coding: utf-8
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0:
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0:
            B-=1
        A+=B//2
        B=B//2
print(A, B)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for _ in range(K):
    if K%2!=0:
        if A%2!=0;
            A-=1
        B+=A//2
    else:
        if B%2!=0;
            B-=1
        A+=B//2
print(A, B)

Fixed submission:
# coding: utf-8
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0:
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0:
            B-=1
        A+=B//2
        B=B//2
print(A, B)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
If K%2!=0:
    if A%2!=0;
        A-=1
    B+=A//2
else:
    if B%2!=0;
        B-=1
    A+=B//2
print(A, B)

Fixed submission:
# coding: utf-8
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0:
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0:
            B-=1
        A+=B//2
        B=B//2
print(A, B)
Buggy python submission (verdict: Runtime Error):
from collections import Counter


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


if len(set(lst_v)) == 1:
    ans = n // 2
else:
    lst_odd = lst_v[::2]
    lst_even = lst_v[1::2]
    cnt_odd = sorted(Counter(lst_odd).items(), key=lambda x: -x[1])
    cnt_even = sorted(Counter(lst_even).items(), key=lambda x :-x[1])
    o1 = cnt_odd[0]
    e1 = cnt_even[0]
    o2 = cnt_odd[1] if cnt_odd[1] else (0, 0)
    e2 = cnt_even[1] if cnt_even[1] else (0, 0)

    if o1[0] == e1[0]:
        rem_number = max(o1[1] + e2[1], o2[1] + e1[1])
    else:
        rem_number = o1[1] + e1[1]
    sum_odd = sum(t[1] for t in cnt_odd)
    sum_even = sum(t[1] for t in cnt_even)
    ans = sum_odd + sum_even - rem_number


print(ans)


Fixed submission:
from collections import Counter, OrderedDict


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


if len(set(lst_v)) == 1:
    ans = n // 2
else:
    lst_odd = [lst_v[i] for i in range(n) if i%2==0]
    lst_even = [lst_v[i] for i in range(n) if i%2!=0]
    cnt_odd = sorted(Counter(lst_odd).items(), key=lambda x: -x[1])
    cnt_even = sorted(Counter(lst_even).items(), key=lambda x :-x[1])

    if cnt_odd[0][0] == cnt_even[0][0]:
        rem_number = max(cnt_odd[0][1] + cnt_even[1][1], cnt_odd[1][1] + cnt_even[0][1])
    else:
        rem_number = cnt_odd[0][1] + cnt_even[0][1]
    sum_odd = sum(t[1] for t in cnt_odd)
    sum_even = sum(t[1] for t in cnt_even)
    ans = sum_odd + sum_even - rem_number


print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())


ans = 1
for i in range(len(S)):
    if S[i] != "1":
      ans = S[i]
        break

print(ans)


Fixed submission:
S = input()
K = int(input())


for i in range(len(S)):
    if S[i] != "1":
        break


ans = "1" if K-1 < i else S[i]
print(ans)