Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [0]*N
B = [0]*N
for i in range(N):
  A[i], B[i] = map(int, input().split())
  
for i in range(N):
  A.insert(2*i+1, B[i])

C = [A[i:i + 2] for i in range(0, len(A), 2)]
C = sorted(C, key=lambda x:(x[0],-x[1]))

hon = 0
kane = 0
for i in range(N):
  if C[i][1] + hon <= M:
    hon += C[i][1]
    kane += C[i][0] * C[i][1]
  else:
    kane += (M - hon) * C[i][0]
    break

print(kane)

Fixed submission:
A = list(map(int, input().split()))
B = list(map(int, input().split()))
print((A[0]-B[0])*(A[1]-B[1]))
Buggy python submission (verdict: Runtime Error):
S = input(S)
T = [c for c in S]
if int(T[0]) * 1000 + int(T[1]) * 100 + int(T[2]) * 10 + int(T[3]) <= 2018 or  (int(T[0]) * 1000 + int(T[1]) * 100 + int(T[2]) * 10 + int(T[3]) == 2019 and int(T[5]) * 1000 + int(T[6]) * 100 + int(T[8]) * 10 + int(T[9]) <= 430 ):
  print('Heisei')
  exit()
print('TBD')  

Fixed submission:
S = input()
T = [c for c in S]
if int(T[0]) * 1000 + int(T[1]) * 100 + int(T[2]) * 10 + int(T[3]) <= 2018 or  (int(T[0]) * 1000 + int(T[1]) * 100 + int(T[2]) * 10 + int(T[3]) == 2019 and int(T[5]) * 1000 + int(T[6]) * 100 + int(T[8]) * 10 + int(T[9]) <= 430 ):
  print('Heisei')
  exit()
print('TBD')
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
for i in range(N):
  if sum(L) - L(i) <= L(i):
    print('No')
    exit()
print('Yes')

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
if sum(L)  <=  max(L)*2:
  print('No')
  exit()
print('Yes')
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = []
for i in range(N):
  P.append(int(input())
print(sum(P) - max(P) / 2)

Fixed submission:
N = int(input())
P = []
for i in range(N):
  P.append(int(input()))
print(sum(P) - max(P) // 2)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())
if A * B % 2 == 0:
  print('No')
  exit()
print('Yes')

Fixed submission:
A, B = map(int, input().split())
if A * B % 2 == 0:
  print('No')
  exit()
print('Yes')
Buggy python submission (verdict: Runtime Error):
S = input()
if S[0] != 'A':
  print('WA')
  exit()
count = 0
if len(S) < 4:
  print('WA')
  exit()
for i in range(len(S) - 3):
  if S[i+2] == 'C':
    count += 1
  elif S[i+2].islower():
    continue
  else:
    print('WA')
    exit()
if A[1].isupper() or A[-1].isupper():
  print('WA')
  exit()
if count == 1:
  print('AC')
  exit()
print('WA')
    

Fixed submission:
S = input()
if S[0] != 'A':
  print('WA')
  exit()
count = 0
if len(S) < 4:
  print('WA')
  exit()
for i in range(len(S) - 3):
  if S[i+2] == 'C':
    count += 1
  elif S[i+2].islower():
    continue
  else:
    print('WA')
    exit()
if S[1].isupper() or S[-1].isupper():
  print('WA')
  exit()
if count == 1:
  print('AC')
  exit()
print('WA')
Buggy python submission (verdict: Runtime Error):
S = [c for c in int()]
print(2 * S.count('+') -4)

Fixed submission:
S = [c for c in input()]
print(2 * S.count('+') -4)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N<1000:
  print('ABC' + N.zfill(3))
  exit()
print('ABD' + (N-999).zfill(3))

  

Fixed submission:
N = int(input())
if N<1000:
  print('ABC')
  exit()
print('ABD')
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))

if max(abs(A[0]-A[1]),abs(A[1]-A[2])) <= d or abs(A[0]-A[2]) <= d:
  print('Yes')
  exit()
print('No')


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

if max(abs(A[0]-A[1]),abs(A[1]-A[2])) <= A[3] or abs(A[0]-A[2]) <= A[3]:
  print('Yes')
  exit()
print('No')
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x < 4:
  print(1)
  exit()
import math
for i in range(2,x):
  if math.floor(math.log(x,i))>1:
    result = max(result, i ** math.floor(math.log(x,i)))
print(result)

Fixed submission:
x = int(input())
if x < 4:
  print(1)
  exit()
import math
result = 1
for i in range(2,x+1):
  if math.floor(math.log(x,i)+1/100000) > 1:
    result = max(result, i ** math.floor(math.log(x,i)+1/100000))
  
print(result)
Buggy python submission (verdict: Runtime Error):
S = [x for x in int()]
print(700 + 100 * S.count('o'))

Fixed submission:
S = [x for x in input()]
print(700 + 100 * S.count('o'))
Buggy python submission (verdict: Runtime Error):
S = input()
if S.len('a') == 1 and S.len('b') == 1:
  print('Yes')
  exit()
print('No')

Fixed submission:
S = input()
if S.count('a') == 1 and S.count('b') == 1:
  print('Yes')
  exit()
print('No')
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
prin(A[0] + B[1] + C[2])

Fixed submission:
A = input()
B = input()
C = input()
print(A[0] + B[1] + C[2])
Buggy python submission (verdict: Runtime Error):
a,b,c,d = input()
print('Yes' if (a == b and b == c ) or (b == c and C == d ) else 'No')

Fixed submission:
a,b,c,d = input()
print('Yes' if (a == b and b == c ) or (b == c and c == d ) else 'No')

Buggy python submission (verdict: Runtime Error):
a,b,c,d = input()
print('Yes' if (a == b and b == c ) or (b == c and C == d ) else 'No')

Fixed submission:
a,b,c,d = input()
print('Yes' if (a == b and b == c ) or (b == c and c == d ) else 'No')
Buggy python submission (verdict: Runtime Error):
print('Yes' if input()[0] == input()[2] else 'No')

Fixed submission:
N = input()
if N[0] == N[2]:
  print('Yes')
  exit()
print('No')
Buggy python submission (verdict: Runtime Error):
X, A, B = map(int, input())
if A-B > X:
  print('dangerous')
  exit()
elif A-B <= 0:
  print('delicious')
  exit()
print('safe')

Fixed submission:
X, A, B = map(int, input().split())
if B-A > X:
  print('dangerous')
  exit()
elif B <= A:
  print('delicious')
  exit()
print('safe')
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
print('YES' if int(A[1]+A[2])%4 ==0 else 'NO')
2 3 4

Fixed submission:
A = list(map(int, input().split()))
print('YES' if (A[1]*10+A[2])%4 ==0 else 'NO')

Buggy python submission (verdict: Runtime Error):
A = list(map(int, input()))
print('YES' if int(A[1]+A[2])%4 ==0 else 'NO')

Fixed submission:
A = list(map(int, input().split()))
print('YES' if (A[1]*10+A[2])%4 ==0 else 'NO')
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
x = [0]*h
for i in range(h):
  x[i] = input()

for i in range(w+):
  print('#', end='')
print('#')
for i in range(h):
  print('#' + x[i] + '#')

for i in range(w+2):
  print('#', end='')

Fixed submission:
h, w = map(int, input().split())
x = [0]*h
for i in range(h):
  x[i] = input()

for i in range(w+1):
  print('#', end='')
print('#')
for i in range(h):
  print('#' + x[i] + '#')

for i in range(w+2):
  print('#', end='')
Buggy python submission (verdict: Runtime Error):
A, B, C = map(str, input().split())
print(A.upper[0]+B.upper[0]+C.upper[0])

Fixed submission:
A, B, C = map(str, input().split())
print((A[0]+B[0]+C[0]).upper())
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a =='H' and b =='H':
  print('H')
elif a =='H' and b =='D':
  print('D')
elif a =='D' and b =='H':
  print('D')
else:
  print('H')

Fixed submission:
a, b = map(str, input().split())
if a =='H' and b =='H':
  print('H')
elif a =='H' and b =='D':
  print('D')
elif a =='D' and b =='H':
  print('D')
else:
  print('H')

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

Fixed submission:
a, b = map(str, input().split())
if a =='H' and b =='H':
  print('H')
elif a =='H' and b =='D':
  print('D')
elif a =='D' and b =='H':
  print('D')
else:
  print('H')
Buggy python submission (verdict: Runtime Error):
s = input()
s[5] = ' '
s[13] = ' '
print(s)

Fixed submission:
s = input()
for i in range(len(s)):
  print(s[i] if i != 5 and i != 13 else ' ' , end ='')

Buggy python submission (verdict: Runtime Error):
s = input()
s[5] = ' '
s[13] = ' '
print(s)

Fixed submission:
s = input()
for i in range(len(s)):
  print(s[i] if i != 5 and i != 13 else ' ' , end ='')
Buggy python submission (verdict: Runtime Error):
a = input()
for i in range('aiueo'):
  if a == i:
    print('vowel')
    exit()
print('consonant')


Fixed submission:
a = input()
for i in 'aiueo':
  if a == i:
    print('vowel')
    exit()
print('consonant')

Buggy python submission (verdict: Runtime Error):
a = input()
for i in range('aiueo'):
  if a = i:
    print('vowel')
    exit()
print('consonant')

Fixed submission:
a = input()
for i in 'aiueo':
  if a == i:
    print('vowel')
    exit()
print('consonant')
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
print(A[0][0] + A[1][0] + A[2][0])

Fixed submission:
A = list(map(str, input().split()))
print(A[0][0] + A[1][0] + A[2][0])
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
print('Yes' if max(a) *2 = sum(a) else 'No')

Fixed submission:
a = list(map(int, input().split()))
print('Yes' if max(a) *2 == sum(a) else 'No')
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
a = [0] * L
for i in range(N):
  a[i] = input()
a.sort()
for i in range(N):
  print(a[i], end='')

Fixed submission:
N, L = map(int, input().split())
a = [0] * N
for i in range(N):
  a[i] = input()
a.sort()
for i in range(N):
  print(a[i], end='')
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())
print((b-1)//(a-1))

Fixed submission:
A,B = map(int, input().split())
print(-((1-B)//(A-1)))

Buggy python submission (verdict: Time Limit Exceeded):
A,B = map(int, input().split())
if B == 1:
  print("0")
else:
  ans = 0
  while (A-1)*ans + A << B:
    ans += 1
  print(ans)  

Fixed submission:
A,B = map(int, input().split())
print(-((1-B)//(A-1)))
Buggy python submission (verdict: Runtime Error):
a = list[input().split()]
if a.count("5") == 2 and a.count("7")==1:
  print("YES")
else:
  print("NO")

Fixed submission:
a = list(input().split())
if a.count("5") == 2 and a.count("7")==1:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n,a,b,c,d = map(int,input().split())
s = input().rstrip()
renzoku_iwa = [0 for i in range(n)]
renzoku_blank = [0 for i in range(n)]
old1 = ""
old2 = ""
for i,tmp in enumerate(s):
	if old1 == tmp:
		if old1 == "." and old2 == ".":
			renzoku_blank[i] = 1
		elif old1 == "#":
			renzoku_iwa[i] = 1
	old2 = old1
	old1 = tmp

if sum(renzoku_iwa[a-1:c]) == 0 and sum(renzoku_iwa[b-1:d]) == 0:
	if c < d:
		print("Yes")
	else:
		if sum(renzoku_blank[b:d])>=1:
			1/0
			print("Yes")
		else:
			print("No")
else:
	print("No")

Fixed submission:
n,a,b,c,d = map(int,input().split())
s = input().rstrip()
renzoku_iwa = [0 for i in range(n)]
renzoku_blank = [0 for i in range(n)]
old1 = ""
old2 = ""
for i,tmp in enumerate(s):
	if old1 == tmp:
		if old1 == "." and old2 == ".":
			renzoku_blank[i] = 1
		elif old1 == "#":
			renzoku_iwa[i] = 1
	old2 = old1
	old1 = tmp

if sum(renzoku_iwa[a-1:c]) == 0 and sum(renzoku_iwa[b-1:d]) == 0:
	if c < d:
		print("Yes")
	else:
		if sum(renzoku_blank[b:min(d+1,len(renzoku_blank))])>=1:
			print("Yes")
		else:
			print("No")
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
n,a,b,c,d = map(int,input().split())
s = input().rstrip()
renzoku_iwa = [0 for i in range(n)]
renzoku_blank = [0 for i in range(n)]
old1 = ""
old2 = ""
for i,tmp in enumerate(s):
	if old1 == tmp:
		if old1 == "." and old2 == ".":
			renzoku_blank[i] = 1
		elif old1 == "#":
			renzoku_iwa[i] = 1
	old2 = old1
	old1 = tmp

if sum(renzoku_iwa[a-1:c]) == 0 and sum(renzoku_iwa[b-1:d]) == 0:
	if c < d:
		print("Yes")
	else:
		1/0
		if sum(renzoku_blank[b:d])>=1:
			print("Yes")
		else:
			print("No")
else:
	print("No")
print(renzoku_iwa)
print(renzoku_blank)

Fixed submission:
n,a,b,c,d = map(int,input().split())
s = input().rstrip()
renzoku_iwa = [0 for i in range(n)]
renzoku_blank = [0 for i in range(n)]
old1 = ""
old2 = ""
for i,tmp in enumerate(s):
	if old1 == tmp:
		if old1 == "." and old2 == ".":
			renzoku_blank[i] = 1
		elif old1 == "#":
			renzoku_iwa[i] = 1
	old2 = old1
	old1 = tmp

if sum(renzoku_iwa[a-1:c]) == 0 and sum(renzoku_iwa[b-1:d]) == 0:
	if c < d:
		print("Yes")
	else:
		if sum(renzoku_blank[b:min(d+1,len(renzoku_blank))])>=1:
			print("Yes")
		else:
			print("No")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
s = input().rstrip()

concurrent_BC_cnt = 0
old1 = ""
cnt = 0
for tmp in (reversed(s)):
	if tmp == "A"
		if old1 == "B":
			cnt += concurrent_BC_cnt
		else:
			concurrent_BC_cnt = 0
			old1 = "A"
		# if "A" not update old1
	else:
		if tmp == "B" and old1 == "C":
			concurrent_BC_cnt += 1
		elif tmp == "C" and old1 == "B":
			pass
		else:
			concurrent_BC_cnt = 0
			
		old1=tmp
	
print(cnt)

Fixed submission:
s = input().rstrip()

concurrent_BC_cnt = 0
old1 = ""
cnt = 0
for tmp in (reversed(s)):
	if tmp == "A":
		if old1 == "B":
			cnt += concurrent_BC_cnt
		else:
			concurrent_BC_cnt = 0
			old1 = "A"
		# if "A" not update old1
	else:
		if tmp == "B" and old1 == "C":
			concurrent_BC_cnt += 1
		elif tmp == "C" and old1 == "B":
			pass
		else:
			concurrent_BC_cnt = 0
			
		old1=tmp
	
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())
b,g,r = sorted([r,g,b])

ptn = 0
for i in range(n+1):
    if i*r > n:
        break
    
    for j in range(n+1):
        if i*r + j*g > n:
            break
        
        if ((n - i*r - j*g)%b) == 0:
            ptn += 1
        
print(ptn)

Fixed submission:
r,g,b,n = map(int,input().split())
b,g,r = sorted([r,g,b])

ptn = 0
for i in range(n+1):
    if i*r > n:
        break
    
    for j in range(n+1):
        if i*r + j*g > n:
            break
        
        if ((n - i*r - j*g)%b) == 0:
            ptn += 1
        
print(ptn)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())
ptn = 0
for i in range(n+1):
    if i*r > n:
        break
    
    for j in range(n+1):
        if i*r + j*g > n:
            break
        
        if ((n - i*r - j*g)%b) == 0:
            ptn += 1
        
print(ptn)

Fixed submission:
r,g,b,n = map(int,input().split())
b,g,r = sorted([r,g,b])

ptn = 0
for i in range(n+1):
    if i*r > n:
        break
    
    for j in range(n+1):
        if i*r + j*g > n:
            break
        
        if ((n - i*r - j*g)%b) == 0:
            ptn += 1
        
print(ptn)
Buggy python submission (verdict: Runtime Error):
N,Q = map(int,input().split(" "))
s_lst = list(input().rstrip())

pos_cnt=[1 for _ in range(N+2)]
c_ind_dict = {c:[] for c in set(s_lst)}
for i,c in enumerate(s_lst):
	c_ind_dict[c].append(i+1)

for _ in range(Q):
	c,d = input().split(" ")
	if c not in c_ind_dict.keys():
		continue
	for ind in  c_ind_dict[c]:
		if d == "L":
			pos_cnt[ind - 1] += pos_cnt[ind]
			pos_cnt[ind] = 0
		else:
			pos_cnt[ind + 1] += pos_cnt[ind]
			pos_cnt[ind] = 0

print(sum(pos_cnt[1:N+1]))

Fixed submission:
A,B,C = map(int,input().split(" "))
if A == B and B == C:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
import math

def get_nearest_bin(x):
	if x <= 1:
		return x
	y = x
	i=0
	while y !=0:
		y = y >> 1
		i += 1
	return (x >> (i-1) ) << (i-1)

def func(x):
	if x <= 3:
		return {0:0,1:1,2:3,3:0}[x]
	
	nearest_bin = get_nearest_bin(x)

	if ((x-nearest_bin + 1) %2) == 0:
		ans = 0
	else:
		ans = nearest_bin

	return nearest_bin ^ func(x - nearest_bin)


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

if A == B:
	print(A)
else:
	print(func(A-1)^func(B))

Fixed submission:
import math

def get_nearest_bin(x):
	if x <= 1:
		return x
	y = x
	i=0
	while y !=0:
		y = y >> 1
		i += 1
	return (x >> (i-1) ) << (i-1)

def func(x):
	if x <= 3:
		return {0:0,1:1,2:3,3:0}[x]
	
	nearest_bin = get_nearest_bin(x)

	if ((x-nearest_bin + 1) %2) == 0:
		ans = 0
	else:
		ans = nearest_bin

	return ans ^ func(x - nearest_bin)


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

if A == B:
	print(A)

elif A == 0:
	print(func(B))
else:
	print(func(A-1)^func(B))

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

def func(x):
	if x <= 3:
		return {0:0,1:1,2:3,3:0}[x]
	
	nearest_bin = 2 ** int(math.log2(x))

	if ((x-nearest_bin + 1) %2) == 0:
		ans = 0
	else:
		ans = nearest_bin

	return nearest_bin ^ func(x - nearest_bin)


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

if A == B:
	print(A)
else:
	print(func(A-1)^func(B))

Fixed submission:
import math

def get_nearest_bin(x):
	if x <= 1:
		return x
	y = x
	i=0
	while y !=0:
		y = y >> 1
		i += 1
	return (x >> (i-1) ) << (i-1)

def func(x):
	if x <= 3:
		return {0:0,1:1,2:3,3:0}[x]
	
	nearest_bin = get_nearest_bin(x)

	if ((x-nearest_bin + 1) %2) == 0:
		ans = 0
	else:
		ans = nearest_bin

	return ans ^ func(x - nearest_bin)


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

if A == B:
	print(A)

elif A == 0:
	print(func(B))
else:
	print(func(A-1)^func(B))
Buggy python submission (verdict: Runtime Error):
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur >= len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1

print(len(in_s) - len(lst))

Fixed submission:
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur+1 >= len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1
 
print(len(in_s) - len(lst))

Buggy python submission (verdict: Runtime Error):
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur +1 == len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1

print(len(in_s) - len(lst))

Fixed submission:
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur+1 >= len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1
 
print(len(in_s) - len(lst))

Buggy python submission (verdict: Time Limit Exceeded):
in_s = input().rstrip()
s_old = in_s
while True:
    s_new = s_old.replace("10","").replace("01","")
    if s_new == s_old:
        break
    s_old = s_new
print(len(in_s) - len(s_new))

Fixed submission:
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur+1 >= len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1
 
print(len(in_s) - len(lst))

Buggy python submission (verdict: Time Limit Exceeded):
in_s = input().rstrip()
s_old = in_s
while True:
    s_new = s_old.replace("10","")
    s_new = s_new.replace("01","")
    if s_new == s_old:
        break
    s_old = s_new
print(len(in_s) - len(s_new))

Fixed submission:
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur+1 >= len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1
 
print(len(in_s) - len(lst))
Buggy python submission (verdict: Runtime Error):
import pandas as pd
date = pd.to_datetime(input().rstrip())
if date > pd.to_datetime("2019/4/30"):
  print("TBD")
else:
  print("Heisei")

Fixed submission:
y,m,d = [int(s) for s in input().rstrip().split("/")]

if y == 2019:
  if m >= 5:
    print("TBD")
    exit()
elif y > 2019:
  print("TBD")
  exit()

print("Heisei")

Buggy python submission (verdict: Runtime Error):
import pandas as pd
date = pd.to_datetime(input().rstrip())
if date > pd.to_datetime("2019/4/30"):
  print("TBD)
else:
  print("Heisei")

Fixed submission:
y,m,d = [int(s) for s in input().rstrip().split("/")]

if y == 2019:
  if m >= 5:
    print("TBD")
    exit()
elif y > 2019:
  print("TBD")
  exit()

print("Heisei")
Buggy python submission (verdict: Runtime Error):
  a,b,c = [int(s) for s in input().split(" ")]
  ret = min(a+b+1,c) + b
  print(ret)

Fixed submission:
a,b,c = [int(s) for s in input().split(" ")]
ret = min(a+b+1,c) + b
print(ret)
Buggy python submission (verdict: Runtime Error):
def f(a,b):
	if a==b:
		return 2*a
	elif a < b:
		return 2*a* + f(a,b-a)
	else:
		return 2*b + f(a-b,b)


N,X = map(int,input().split(" "))

print(N+f(N-X,X))

Fixed submission:
import bisect

N = input()
Ls = map(int,input().split(" "))
Ls = sorted(Ls)
ans = sum([L for i,L in enumerate(Ls) if i%2 == 0])
print(ans)
Buggy python submission (verdict: Runtime Error):
def f(a,b):
	if a==b:
		ret = a
	elif a < b:
		ret = 2*a + f(a,b-a)
	else:
		ret = 2*b + f(a-b,b)
	return ret


N,X = map(int,input().split(" "))

print(N+f(N-X,X))


Fixed submission:
def f(a,b):
	if a==b:
		d=0
		ret = a
	elif a < b:
		d = b//a
		if b%a == 0:
			ret = a*(2*d -1)
		else:
			ret = 2*a*d + f(a,b%a)
	else:
		d = a//b
		if a%b == 0:
			ret = b*(2*d -1)
		else:
			ret = 2*b*d + f(a%b,b)
	#print(a,b,d,ret)
	return ret


N,X = map(int,input().split(" "))

print(N+f(N-X,X))

Buggy python submission (verdict: Runtime Error):
def f(a,b):
	if a==b:
		return 2*a
	elif a < b:
		return 2*a + f(a,b-a)
	else:
		return 2*b + f(a-b,b)


N,X = map(int,input().split(" "))

print(N+f(N-X,X))

Fixed submission:
def f(a,b):
	if a==b:
		d=0
		ret = a
	elif a < b:
		d = b//a
		if b%a == 0:
			ret = a*(2*d -1)
		else:
			ret = 2*a*d + f(a,b%a)
	else:
		d = a//b
		if a%b == 0:
			ret = b*(2*d -1)
		else:
			ret = 2*b*d + f(a%b,b)
	#print(a,b,d,ret)
	return ret


N,X = map(int,input().split(" "))

print(N+f(N-X,X))

Buggy python submission (verdict: Runtime Error):
def f(a,b):
	return 2*a + f_fast(a,b-a)



def f_fast(a,b):
	if a==b:
		return a+b
	elif a < b:
		if b%a == 0:
			return f(a,b)
		else:
			d = b//a
			return 2*a*d + f_fast(a,b%a)
	else:
		return f_fast(b,a)


N,X = map(int,input().split(" "))

print(N+f_fast(N-X,X))

Fixed submission:
def f(a,b):
	if a==b:
		d=0
		ret = a
	elif a < b:
		d = b//a
		if b%a == 0:
			ret = a*(2*d -1)
		else:
			ret = 2*a*d + f(a,b%a)
	else:
		d = a//b
		if a%b == 0:
			ret = b*(2*d -1)
		else:
			ret = 2*b*d + f(a%b,b)
	#print(a,b,d,ret)
	return ret


N,X = map(int,input().split(" "))

print(N+f(N-X,X))

Buggy python submission (verdict: Runtime Error):
def f(a,b):
	print(a,b)
	if a==b:
		return 2*a
	elif a < b:
		return 2*a + f(a,b-a)
	else:
		return 2*b + f(a-b,b)


N,X = map(int,input().split(" "))

print(N+f(N-X,X))

Fixed submission:
def f(a,b):
	if a==b:
		d=0
		ret = a
	elif a < b:
		d = b//a
		if b%a == 0:
			ret = a*(2*d -1)
		else:
			ret = 2*a*d + f(a,b%a)
	else:
		d = a//b
		if a%b == 0:
			ret = b*(2*d -1)
		else:
			ret = 2*b*d + f(a%b,b)
	#print(a,b,d,ret)
	return ret


N,X = map(int,input().split(" "))

print(N+f(N-X,X))