Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# sys.stdin.readline()
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
for _ in range(m):
    b, c= map(int, input().split())
    if a[n-1] < c:
        for i in range(min(b,n)):
            a.append(c)
        a.sort(reverse=True)
print(sum(a[:n]))

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = sorted(list(map(int, readline().split())))
bc = [tuple(map(int, readline().split())) for i in range(m)]
bc.sort(key=lambda x: x[1], reverse=True)
index = 0
cnt = 0
for i in range(n):
    if a[i] > bc[index][1]:
        break
    a[i] = bc[index][1]
    cnt += 1
    if cnt == bc[index][0]:
        cnt = 0
        index += 1
        if index == m:
            break
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
# sys.stdin.readline()
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
for _ in range(m):
    b, c= map(int, input().split())
    if a[n-1] < c:
        for i in range(b):
            a.append(c)
        a.sort(reverse=True)
print(sum(a[:n]))

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = sorted(list(map(int, readline().split())))
bc = [tuple(map(int, readline().split())) for i in range(m)]
bc.sort(key=lambda x: x[1], reverse=True)
index = 0
cnt = 0
for i in range(n):
    if a[i] > bc[index][1]:
        break
    a[i] = bc[index][1]
    cnt += 1
    if cnt == bc[index][0]:
        cnt = 0
        index += 1
        if index == m:
            break
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
# sys.stdin.readline()
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
for _ in range(m):
    b, c= map(int, input().split())
    if a[n-1] < c:
        for i in range(b):
            a.append(c)
        a.sort(reverse=True)
print(sum(a[:n]))


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = sorted(list(map(int, readline().split())))
bc = [tuple(map(int, readline().split())) for i in range(m)]
bc.sort(key=lambda x: x[1], reverse=True)
index = 0
cnt = 0
for i in range(n):
    if a[i] > bc[index][1]:
        break
    a[i] = bc[index][1]
    cnt += 1
    if cnt == bc[index][0]:
        cnt = 0
        index += 1
        if index == m:
            break
print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
# sys.stdin.readline()
import sys
input = sys.stdin.readline

r, g, b, n = map(int, input().split())
ans = 0
for i in range(int(n/b)+1):
    for j in range(int(n/g)+1):
        for k in range(int(n/r)+1):
            cheak = r*k + g*j + b*i
            if cheak == n:
                ans += 1
            elif cheak > n:
                break
print(ans)


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

r, g, b, n = map(int, read().split())
cnt = 0
for i in range(n + 1):
    for j in range(n + 1):
        check = n - (r * i + g * j)
        if check >= 0:
            if check % b == 0:
                cnt += 1
        else:
            break
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
ans = 0

for i in range(int(n/b)+1):
    for j in range(int(n/g)+1):
        for k in range(int(n/r)+1):
            cheak = r*k + g*j + b*i
            if cheak == n:
                ans += 1
            elif cheak > n:
                break
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

r, g, b, n = map(int, read().split())
cnt = 0
for i in range(n + 1):
    for j in range(n + 1):
        check = n - (r * i + g * j)
        if check >= 0:
            if check % b == 0:
                cnt += 1
        else:
            break
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
ans = 0

for i in range(int(n/b)+1):
    for j in range(int(n/g)+1):
        for k in range(int(n/r)+1):
            cheak = r*k + g*j + b*i
            if cheak == n:
                ans += 1
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

r, g, b, n = map(int, read().split())
cnt = 0
for i in range(n + 1):
    for j in range(n + 1):
        check = n - (r * i + g * j)
        if check >= 0:
            if check % b == 0:
                cnt += 1
        else:
            break
print(cnt)
Buggy python submission (verdict: Runtime Error):
h, w, n = map(int, input().split())
ar, ac = map(int, input().split())
s = input()
t = input()
r = ac
l = ac
u = ar
d = ar

for i in range(n):
    if s[i] == "R":
        r += 1
    if s[i] == "L":
        l -= 1
    if s[i] == "U":
        u -= 1
    if s[i] == "D":
        d += 1
    if l==0 or r==w+1 or u==0 or d==h+1:
        print("NO")
        ans = True
        break
        
    if t[i] == "R" and l != w:
        l += 1
    if t[i] == "L" and r != 1:
        r -= 1
    if t[i] == "U" and d != 1:
        d -= 1
    if t[i] == "D" and u != h:
        u += 1
 
if ans != True:
    print("YES")

Fixed submission:
h, w, n = map(int, input().split())
ar, ac = map(int, input().split())
s = input()
t = input()
r = ac
l = ac
u = ar
d = ar
ans = False

for i in range(n):
    if s[i] == "R":
        r += 1
    if s[i] == "L":
        l -= 1
    if s[i] == "U":
        u -= 1
    if s[i] == "D":
        d += 1
    if l==0 or r==w+1 or u==0 or d==h+1:
        print("NO")
        ans = True
        break
        
    if t[i] == "R" and l != w:
        l += 1
    if t[i] == "L" and r != 1:
        r -= 1
    if t[i] == "U" and d != 1:
        d -= 1
    if t[i] == "D" and u != h:
        u += 1
 
if ans != True:
    print("YES")
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import gcd

n = int(readline())
a = list(map(int, readline().split()))
b = a[::-1]
cumsum_m = [0] * (n - 1)
cumsum_p = [0] * (n - 1)
cumsum_m[0] = b[0]
cumsum_p[0] = a[0]
for i in range(1, n - 1):
    cumsum_p[i] = gcd(cumsum_p[i - 1], a[i])
    cumsum_m[i] = gcd(cumsum_m[i - 1], b[i])
ans = max(cumsum_m.pop(), cumsum_p.pop())
for p, m in zip(cumsum_p, cumsum_m[::-1]):
    v = gcd(p, m)
    if ans < v:
        ans = v
print(ans)


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

n, *a = map(int, read().split())
b = a[::-1]
cumsum_m = [0] * (n - 1)
cumsum_p = [0] * (n - 1)
cumsum_m[0] = b[0]
cumsum_p[0] = a[0]
for i in range(1, n - 1):
    cumsum_p[i] = gcd(cumsum_p[i - 1], a[i])
    cumsum_m[i] = gcd(cumsum_m[i - 1], b[i])
ans = max(cumsum_m.pop(), cumsum_p.pop())
for p, m in zip(cumsum_p, cumsum_m[::-1]):
    v = gcd(p, m)
    if ans < v:
        ans = v
print(ans)

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
max = 0
ans = 0

for i in range(n):
    max = gcd_list(a[-i])
    if max > ans:
        ans = max
        
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

n, *a = map(int, read().split())
b = a[::-1]
cumsum_m = [0] * (n - 1)
cumsum_p = [0] * (n - 1)
cumsum_m[0] = b[0]
cumsum_p[0] = a[0]
for i in range(1, n - 1):
    cumsum_p[i] = gcd(cumsum_p[i - 1], a[i])
    cumsum_m[i] = gcd(cumsum_m[i - 1], b[i])
ans = max(cumsum_m.pop(), cumsum_p.pop())
for p, m in zip(cumsum_p, cumsum_m[::-1]):
    v = gcd(p, m)
    if ans < v:
        ans = v
print(ans)

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

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

n = int(input())
a = list(map(int, input().split()))
max = 0
ans = 0

for i in range(n):
    max = gcd_list(a[-i])
    if max > ans:
        ans = max
        
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

n, *a = map(int, read().split())
b = a[::-1]
cumsum_m = [0] * (n - 1)
cumsum_p = [0] * (n - 1)
cumsum_m[0] = b[0]
cumsum_p[0] = a[0]
for i in range(1, n - 1):
    cumsum_p[i] = gcd(cumsum_p[i - 1], a[i])
    cumsum_m[i] = gcd(cumsum_m[i - 1], b[i])
ans = max(cumsum_m.pop(), cumsum_p.pop())
for p, m in zip(cumsum_p, cumsum_m[::-1]):
    v = gcd(p, m)
    if ans < v:
        ans = v
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

ans = ''
for i in S:
    if i == S[K]:
        ans += i
    else:
        ans += '*'

print(ans)


Fixed submission:
N = int(input())
S = input()
K = int(input()) - 1
s = S[K]
ans = ''

for i in S:
    if i == s:
        ans += i
    else:
        ans += '*'

print(ans)

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

ans = ''
for i in S:
    if i == S[K]
        ans += i
    else:
        ans += '*'

print(ans)

Fixed submission:
N = int(input())
S = input()
K = int(input()) - 1
s = S[K]
ans = ''

for i in S:
    if i == s:
        ans += i
    else:
        ans += '*'

print(ans)

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

s = str(S[K])
ans = ''
for i in range(N):
    if (S[i] in s) == 'True':
        ans += s
    else:
        ans += '*'

print(ans)

Fixed submission:
N = int(input())
S = input()
K = int(input()) - 1
s = S[K]
ans = ''

for i in S:
    if i == s:
        ans += i
    else:
        ans += '*'

print(ans)

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

s = S[K]
for i in range(N):
    if (S[i] in s) == 'True':
        pass
    else:
        S[i].replace(s,'*')

print(S)

Fixed submission:
N = int(input())
S = input()
K = int(input()) - 1
s = S[K]
ans = ''

for i in S:
    if i == s:
        ans += i
    else:
        ans += '*'

print(ans)
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
n = 0
ans = 0

for x in a:
    if x % 10 != 0:
        t = 10 - x % 10
    else:
        t = 0
        
    res += x + t
    n = max(n, t)
    
print(ans - n)


Fixed submission:
a = [int(input()) for i in range(5)]
n = 0
ans = 0

for x in a:
    if x % 10 != 0:
        t = 10 - x % 10
    else:
        t = 0
        
    ans += x + t
    n = max(n, t)
    
print(ans - n)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

x, y, z, k = map(int, readline().split())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))
c = list(map(int, read().split()))
ab = [0] * x * y
for i, aa in enumerate(a):
    for j, bb in enumerate(b):
        ab[i * y + j] = aa + bb
ab = sorted(ab, reverse=True)[:k]
c = sorted(c, reverse=True)[:k]
ans = [0] * (k ** 2)
for i, abab in enumerate(ab):
    for j, cc in enumerate(c):
        ans[i * k + j] = abab + cc
ans.sort(reverse=True)
print('\n'.join(map(str, ans[:k])))


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

x, y, z, k = map(int, readline().split())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))
c = list(map(int, read().split()))
ab = [0] * x * y
for i, aa in enumerate(a):
    for j, bb in enumerate(b):
        ab[i * y + j] = aa + bb
ab = sorted(ab, reverse=True)[:k]
c = sorted(c, reverse=True)
ans = [0] * k * z
for i, abab in enumerate(ab):
    for j, cc in enumerate(c):
        ans[i * z + j] = abab + cc
ans.sort(reverse=True)
print('\n'.join(map(str, ans[:k])))
Buggy python submission (verdict: Runtime Error):
A,B,C= input().split()

if (A==B) and (B==C):
    print(‘Yes’)
else:
    print(‘No’)

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

if (A==B) and (B==C):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
b= input()

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

Fixed submission:
b = input()

if b.find('A') == 0:
    ac = b.replace('A','T')
elif b.find('T') == 0:
    ac = b.replace('T','A')
elif b.find('G') == 0:
    ac = b.replace('G','C')
elif b.find('C') == 0:
    ac = b.replace('C','G')

print(ac)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = []
cnt = 0

for i in range(len(s)):
    for j in range(2, len(s) + 1):
        memo = s[i:j]
        for k in range(len(memo)):
            if memo[k] == 'A' or memo[k] == 'C' or memo[k] == 'T' or memo[k] == 'G':
                cnt += 1
            else:
                break

        ans.append(cnt)
        cnt = 0

print(max(ans))


Fixed submission:
S = input()
n = 0
atgc = [0] * len(S)

for i in S:
    if ('A' in i) or ('C' in i) or ('G' in i) or ('T' in i):
        atgc[n] += 1
    else:
        n += 1
        
ans = max(atgc)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# sys.stdin.readline()
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
s = input()
ans = 0
for i in range(q):
    l, r = map(int, input().split())
    print(s[l-1:r].count('AC'))

Fixed submission:
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
s = input()
memo = [0] * n
cnt = 0

for i in range(1, n):
    if s[i - 1] == 'A' and s[i] == 'C':
        cnt += 1
    memo[i] = cnt

for i in range(q):
    l, r = map(int, input().split())
    print(memo[r - 1] - memo[l - 1])

Buggy python submission (verdict: Runtime Error):
def counts(s, l, r):
    ans = s[l-1:r].count('AC')
    print(ans)

n, q = map(int, input().split())
s = input()
for i in xrange(q):
    l, r = map(int, input().split())
    counts(s, l, r)

Fixed submission:
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
s = input()
memo = [0] * n
cnt = 0

for i in range(1, n):
    if s[i - 1] == 'A' and s[i] == 'C':
        cnt += 1
    memo[i] = cnt

for i in range(q):
    l, r = map(int, input().split())
    print(memo[r - 1] - memo[l - 1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
for i in range(q):
    l, r = map(int, input().split())
    
    ans = s[l-1:r].count('AC')
    print(ans)

Fixed submission:
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
s = input()
memo = [0] * n
cnt = 0

for i in range(1, n):
    if s[i - 1] == 'A' and s[i] == 'C':
        cnt += 1
    memo[i] = cnt

for i in range(q):
    l, r = map(int, input().split())
    print(memo[r - 1] - memo[l - 1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
b = list(map(int, input().split()))
b.reverse()
ans_set = [0]*n

for i in range(n):
    if ans == -1:
        break
    
    for j in range(n):
        if b[j] == n-j:
            ans = b.pop(j)
            ans_set[n-1] = ans
            n -= 1
            break
            
        elif b[j] > n-j:
            ans = -1
            print(ans)
            break

        if n == 0:
            break

if ans != -1:
    for k in ans_set:
        print(k)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
b.reverse()
ans_set = [0]*n
ans = 0

for i in range(n):
    if ans == -1:
        break
    
    for j in range(n):
        if b[j] == n-j:
            ans = b.pop(j)
            ans_set[n-1] = ans
            n -= 1
            break
            
        elif b[j] > n-j:
            ans = -1
            print(ans)
            break

        if n == 0:
            break

if ans != -1:
    for k in ans_set:
        print(k)

Buggy python submission (verdict: Runtime Error):
n = int(input())
b = [int(x) for x in input().split]
b.reverse()
b_counts = len(b)

for i in range(n):
    for j in range(n):
        
        if b[j] == b_counts-b.index()+1:
            ans = b.pop(j)
            b_counts -= 1
            print(ans)
        elif b[j] > b_counb_counts-b.index()+1:
            ans = -1
            break
        
        if b_counts == 0:
            break
print(ans)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
b.reverse()
ans_set = [0]*n
ans = 0

for i in range(n):
    if ans == -1:
        break
    
    for j in range(n):
        if b[j] == n-j:
            ans = b.pop(j)
            ans_set[n-1] = ans
            n -= 1
            break
            
        elif b[j] > n-j:
            ans = -1
            print(ans)
            break

        if n == 0:
            break

if ans != -1:
    for k in ans_set:
        print(k)

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

a=[]

for i in range(N):
  if i+1 < b[i]:
    a=[0]*1
    a[0]= -1
    break
  a.insert(b[i],b[i])

for j in range(N):
  print(a[j])

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
b.reverse()
ans_set = [0]*n
ans = 0

for i in range(n):
    if ans == -1:
        break
    
    for j in range(n):
        if b[j] == n-j:
            ans = b.pop(j)
            ans_set[n-1] = ans
            n -= 1
            break
            
        elif b[j] > n-j:
            ans = -1
            print(ans)
            break

        if n == 0:
            break

if ans != -1:
    for k in ans_set:
        print(k)
Buggy python submission (verdict: Runtime Error):
n, m, c = map(int, input.split())
b = list(map(int, input.split()))
ans = 0
code = 0

for i in range(n):
    for j in range(m):
        
        a = list(map(int, input.split()))
        code += a[j] * b[j]
    
    code -= 10
    if code >= 0:
        ans += 1
        
print(ans)

Fixed submission:
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
code = 0

for i in range(n):
    a = list(map(int, input().split()))
    
    for j in range(m):
        code += a[j] * b[j]
    
    code += c
    if code > 0:
        ans += 1
    code = 0
        
print(ans)

Buggy python submission (verdict: Runtime Error):
n, m, c = map(int, input.split())
b = list(map(int, input.split()))
ans = 0
code = 0

for i in range(n):
    for j in range(m):
        
        a = list(map(int, input.split()))
        code += a[i] * b[i]
    
    code -= 10
    if code >= 0:
        ans += 1
        
print(ans)

Fixed submission:
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
code = 0

for i in range(n):
    a = list(map(int, input().split()))
    
    for j in range(m):
        code += a[j] * b[j]
    
    code += c
    if code > 0:
        ans += 1
    code = 0
        
print(ans)
Buggy python submission (verdict: Runtime Error):
def xy(a)
    if a % 4 == 1:
        return 1
    elif a % 4 == 2:
        return a + 1
    elif a % 4 == 3 or a == 0:
        return 0
    else:
        return a

a, b = map(int, input().split())
ans = xy(b) ^ xy(a - 1)
print(ans)


Fixed submission:
def xy(a):
    if a % 4 == 1:
        return 1
    elif a % 4 == 2:
        return a + 1
    elif a % 4 == 3 or a == 0:
        return 0
    else:
        return a

a, b = map(int, input().split())
ans = xy(b) ^ xy(a - 1)
print(ans)

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

a=bin(0)
for i in range(A,B+1):
    i=bin(i)
    a=bin(a^i)
print(a)

Fixed submission:
def xy(a):
    if a % 4 == 1:
        return 1
    elif a % 4 == 2:
        return a + 1
    elif a % 4 == 3 or a == 0:
        return 0
    else:
        return a

a, b = map(int, input().split())
ans = xy(b) ^ xy(a - 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
mx = round(max(a, b) * 0.5)
match, ans = 0, 0

for i in range(mx + 1):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)


Fixed submission:
a, b, k = map(int, input().split())
mx = max(a, b)
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
mx = max(a, b) * 0.5
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Fixed submission:
a, b, k = map(int, input().split())
mx = max(a, b)
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
mx = max(a, b) * 0.5
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) 
    and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Fixed submission:
a, b, k = map(int, input().split())
mx = max(a, b)
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
mx = max(a, b) * 0.5
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) 
    and ((b % (mx - i)) == 0):
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)


Fixed submission:
a, b, k = map(int, input().split())
mx = max(a, b)
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
S = str(input())

red = S.count('0')
blue = S.count('1')
N = red + blue

if red > blue:
    ans = N - (red - blue)
elif blue < red:
    ans = N - (blue - red)
print(ans)

Fixed submission:
S = input()

red = S.count('0')
blue = S.count('1')
N = 2 * min(red,blue)

print(N)

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

red = S.count('0')
blue = S.count('1')
N = red + blue

if red > blue:
    ans = N - (red - blue)
elif blue < red:
    ans = N - (blue - red)
print(ans)

Fixed submission:
S = input()

red = S.count('0')
blue = S.count('1')
N = 2 * min(red,blue)

print(N)
Buggy python submission (verdict: Runtime Error):
N = int(input())
x = [0] * N
u = [0] * N
ans = 0

for i in range(N):
    x[i], u[i] = map(float, input().split())
    
    if u[i] == 'BTC':
        ans += x[i] * 380000
    else:
        ans += x[i]

print(ans)


Fixed submission:
N = int(input())
x = [0] * N
u = [0] * N
ans = 0

for i in range(N):
    x[i], u[i] = map(str, input().split())
    x[i] = float(x[i])

    if u[i] == 'BTC':
        ans += x[i] * 380000
    else:
        ans += x[i]

print(ans)