Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b, c = int(input().split())

if a == b:
  print(c)
elif b == c:
  print(a)
elif a == c:
  print(b)

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

if a == b:
  print(c)
elif b == c:
  print(a)
elif a == c:
  print(b)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

print(24 % a + b)

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

print((a + b) % 24)
Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
l=0
a=[i for i in range(2,x)]
prime=[]
limit=math.sqrt(x)
while True:
        p = a[0]
        if limit <= p:
            break
        prime.append(p)
        a = [e for e in a if e % p != 0]
co=0
x-=1
l=len(prime)
while co==0:
    c=0
    x+=1
    for i in range(l):
        if x%prime[i]!=0:
            c+=1
        else:
            break
    if c==l:
        print(x)
        co+=1

Fixed submission:
import math
x=int(input())
if x==2:
    print(2)
else:   
    l=0
    a=[i for i in range(2,x)]
    prime=[]
    limit=math.sqrt(x)
    while True:
        p = a[0]
        if limit <= p:
            break
        prime.append(p)
        a = [e for e in a if e % p != 0]
    co=0
    x-=1
    l=len(prime)
    while co==0:
        c=0
        x+=1
        for i in range(l):
            if x%prime[i]!=0:
                c+=1
            else:
                break
        if c==l:
            print(x)
            co+=1
Buggy python submission (verdict: Time Limit Exceeded):
def search(a,x):
    n=len(a)
    for i in range(n):
        if a[n-i-1]==x:
            return a[n-i:n]
    return False

n=int(input())
a=input().split()
min1=n
for i in range(n):
    a[i]=int(a[i])
for i in range(1,n+1):
    a=search(a,i)
    if a==False and i!=1:
        print(n-i+1)
        break
    elif a==False:
        print(-1)
        break
if a!=False:
    print(0)

Fixed submission:
n=int(input())
a=input().split()
j=1
for i in range(n):
    a[i]=int(a[i])
    if a[i]==j:
        j+=1
if n-j+1==n:
    print(-1)
else:
    print(n-j+1)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
s=b-a
bc=b//c
if a%c==0:
    ac=a//c-1
else:
    ac=a//c
bd=b//d
if a%d==0:
    ad=a//d-1
else:
    ad=a//d
gcd=math.gcd(c,d)
l=c*d/gcd
bl=b//l
if a%l==0:
    al=a//l-1
else:
    al=a//l
print(int(b-a+1-(bc-ac+bd-ad-bl+al)))

Fixed submission:
a,b,c,d=map(int,input().split())
bc=int(b//c)
if a%c==0:
    ac=int(a//c)-1
else:
    ac=int(a//c)
bd=b//d
if a%d==0:
    ad=int(a//d)-1
else:
    ad=int(a//d)
e=c
f=d
while f:
    e, f = f, int(e % f)
gcd=int(e)
l=int(c*d/gcd)
bl=int(b//l)
if a%l==0:
    al=int(a//l)-1
else:
    al=int(a//l)
s=int(b-a+1)
s2=int(bc-ac+bd-ad-bl+al)
print(s-s2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
M=input().split()
for i in range(N):
    M[i]=int(M[i])
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)

Fixed submission:
P,Q,R=map(int,input().split())
a=min(P+Q,P+R,Q+R)
print(a)
Buggy python submission (verdict: Runtime Error):
N=int(input())
M=list(map(int,input().split))
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)

Fixed submission:
N=int(input())
M=input().split()
for i in range(N):
    M[i]=int(M[i])
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)

Buggy python submission (verdict: Runtime Error):
N=int(input())
M=list(map(int,input().split))
S1=0
S2=sum(M)
t=0
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>=abs(S2-S1):
        t=abs(S2-S1)
print(t)

Fixed submission:
N=int(input())
M=input().split()
for i in range(N):
    M[i]=int(M[i])
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=[]
i=0
while len(a)==0 or a[-1]!=1:
    a.append((k-1)//(2**i))
    i+=1
n1=len(a)
if n>=k:
    s=(n-k+1)/n
    for i in range(n1):
        if i!=n1-1:
            s+=(a[i]-a[i+1])/(n*(2**(i+1)))
        else:
            s+=a[i]/(n*(2**(i+1)))
else:
    s=0
    for i in range(n1):
        if i!=n1-1 and a[i]>=n>a[i+1]:
            s+=(n-a[i+1])/(n*(2**(i+1)))
        elif i!=n1-1 and n>a[i+1]:
            s+=(a[i]-a[i+1])/(n*(2**(i+1)))
        elif n>=a[i]:
            s+=a[i]/(n*(2**(i+1)))
print(s)

Fixed submission:
n,k=map(int,input().split())
a=[]
i=0
if k>1:
    while len(a)==0 or a[-1]!=1:
        a.append((k-1)//(2**i))
        i+=1
else:
    a.append(0)
n1=len(a)
if n>=k:
    s=(n-k+1)/n
    for i in range(n1):
        if i!=n1-1:
            s+=(a[i]-a[i+1])/(n*(2**(i+1)))
        else:
            s+=a[i]/(n*(2**(i+1)))
else:
    s=0
    for i in range(n1):
        if i!=n1-1 and a[i]>=n>a[i+1]:
            s+=(n-a[i+1])/(n*(2**(i+1)))
        elif i!=n1-1 and n>a[i+1]:
            s+=(a[i]-a[i+1])/(n*(2**(i+1)))
        elif n>=a[i]:
            s+=a[i]/(n*(2**(i+1)))
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=[]
i=0
while len(a)==0 or a[-1]!=1:
    a.append((k-1)//(2**i))
    i+=1
n1=len(a)
if n>=k:
    s=(n-k+1)/n
    for i in range(n1):
        if i!=n1-1:
            s+=(a[i]-a[i+1])/(n*(2**(i+1)))
        else:
            s+=a[i]/(n*(2**(i+1)))
else:
    s=0
    for i in range(n1):
        if i!=n1-1 and a[i]>=n>a[i+1]:
            s+=(n-a[i+1])/(n*(2**(i+1)))
        elif i!=n1-1 and n>a[i+1]:
            s+=(a[i]-a[i+1])/(n*(2**(i+1)))
        elif n>=a[i]:
            s+=a[i]/(n*(2**(i+1)))
print(s)

Fixed submission:
n,k=map(int,input().split())
a=[]
i=0
if k>1:
    while len(a)==0 or a[-1]!=1:
        a.append((k-1)//(2**i))
        i+=1
else:
    a.append(0)
n1=len(a)
if n>=k:
    s=(n-k+1)/n
    for i in range(n1):
        if i!=n1-1:
            s+=(a[i]-a[i+1])/(n*(2**(i+1)))
        else:
            s+=a[i]/(n*(2**(i+1)))
else:
    s=0
    for i in range(n1):
        if i!=n1-1 and a[i]>=n>a[i+1]:
            s+=(n-a[i+1])/(n*(2**(i+1)))
        elif i!=n1-1 and n>a[i+1]:
            s+=(a[i]-a[i+1])/(n*(2**(i+1)))
        elif n>=a[i]:
            s+=a[i]/(n*(2**(i+1)))
print(s)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    a[u-1].append((v-1,w))
    a[v-1].append((u-1,w))
b=[None for i in range(n)]
def k(v,dis):
    b[v]=dis
    for next_v,w in a[v]:
        if b[next_v]!=None:
            continue
        if w%2==0:
            k(next_v,dis)
        else:
            k(next_v,1-dis)
k(0,0)
for i in range(n):
    print(b[i])

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n=int(input())
a=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    a[u-1].append((v-1,w))
    a[v-1].append((u-1,w))
b=[None for i in range(n)]
def k(v,dis):
    b[v]=dis
    for next_v,w in a[v]:
        if b[next_v]!=None:
            continue
        if w%2==0:
            k(next_v,dis)
        else:
            k(next_v,1-dis)
k(0,0)
for i in range(n):
    print(b[i])

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    a[u-1].append((v-1,w%2))
    a[v-1].append((u-1,w%2))
b=[None for i in range(n)]
def k(v,dis):
    b[v]=dis
    for next_v,w in a[v]:
        if b[next_v]!=None:
            continue
        if w%2==0:
            k(next_v,dis)
        else:
            k(next_v,1-dis)
k(0,0)
for i in range(n):
    print(b[i])

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n=int(input())
a=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    a[u-1].append((v-1,w))
    a[v-1].append((u-1,w))
b=[None for i in range(n)]
def k(v,dis):
    b[v]=dis
    for next_v,w in a[v]:
        if b[next_v]!=None:
            continue
        if w%2==0:
            k(next_v,dis)
        else:
            k(next_v,1-dis)
k(0,0)
for i in range(n):
    print(b[i])
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
A = []

sanka = [K] * N

for i in range(Q):
  a = int(input())	
  A.append(a-1)
  
  for j in range(N):
    sanka[j] -= 1
  sanka[A[i]] += 1

for i in range(N):
  if sanka[i] > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
N,K,Q = map(int,input().split())
A = []

sanka = [K] * N

for i in range(Q):
  a = int(input())	
  A.append(a-1)
  
  sanka[A[i]] += 1
  
for i in range(N):
  if sanka[i] > Q:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = input()
p = input().split()


n = int(n)

cnt=0

for i in range(1,n-1):
  if(p[i]<p[i+1] and p[i]>p[i-1]) or (p[i]>p[i+1] and p[i]<p[i-1]):
    cnt+=1;


   
  
print(cnt)

Fixed submission:
s=[]
s = input()
cnt=0
 
if(s[0] == s[1]):
    cnt+=1

if(s[0] == s[2]):
    cnt+=1
 
 
if(s[0] == s[3]):
    cnt+=1
 
 
if(s[1] == s[2]):
    cnt+=1
 
 
if(s[1] == s[3]):
    cnt+=1
 
 
if(s[2] == s[3]):
    cnt+=1
 
 
if cnt == 2 :
  print("Yes")
else :
  print("No")

Buggy python submission (verdict: Runtime Error):
n = input()
p = input().split()


n = int(n)

cnt=0

for i in range(1,n-1):
  if(p[i]<p[i+1] and p[i]>p[i-1]) or (p[i]>p[i+1] and p[i]<p[i-1]):
    cnt+=1;

  
print(cnt)

Fixed submission:
s=[]
s = input()
cnt=0
 
if(s[0] == s[1]):
    cnt+=1

if(s[0] == s[2]):
    cnt+=1
 
 
if(s[0] == s[3]):
    cnt+=1
 
 
if(s[1] == s[2]):
    cnt+=1
 
 
if(s[1] == s[3]):
    cnt+=1
 
 
if(s[2] == s[3]):
    cnt+=1
 
 
if cnt == 2 :
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
A,B,K=list(map(int,input().split()))

if A==0 and B==0:
  pass
elif A>0:
  if A>=K:
  	A = A-K
  elif A+B>K:
    B = B-K+A
    A = 0
  else:
    A=0
    B=0
elif B>K:
  B=B-K
else:
  B=0
print('%d %d' % (A,B))

Fixed submission:
S,T=input().split(' ')
print(T+S)

Buggy python submission (verdict: Runtime Error):
S, T = imput().split(" ")
print(T+S)

Fixed submission:
S,T=input().split(' ')
print(T+S)
Buggy python submission (verdict: Runtime Error):
def is_prime(n):
    for p in range(2,n):
        if n % p ==0:
            return True

N =int(input())
p=N
while cnt <10**7:
    if is_prime(p):
        p +=1
    else:
        print(p)
        break

Fixed submission:
def is_prime(n):
    for p in range(2,n):
        if n % p ==0:
            return True

N =int(input())
p=N
while p <10**7:
    if is_prime(p):
        p +=1
    else:
        print(p)
        break

Buggy python submission (verdict: Runtime Error):
N =int(input())
p=N
while cnt <10**7:
    if is_prime(p):
        p +=1
    else:
        print(p)
        break

Fixed submission:
def is_prime(n):
    for p in range(2,n):
        if n % p ==0:
            return True

N =int(input())
p=N
while p <10**7:
    if is_prime(p):
        p +=1
    else:
        print(p)
        break

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
c = n

def is_prime(n)
	for i in range(2, math.sqrt(n)+1):
    	if n % i == 0:
        	return False
    return True


while True:
  if is_prime(c):
    print(c)
    exit(0)
  else:
    c+=1

Fixed submission:
import math
n = int(input())
c = n


def is_prime(n):
    for i in range(2, int(math.sqrt(n)+1)):
        if n % i == 0:
            return False
    return True


while True:
    if is_prime(c):
        print(c)
        exit(0)
    else:
        c+=1
Buggy python submission (verdict: Runtime Error):
def lcm(a,b):
    m = a*b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a+b)

print(lcm(int(input()), int(input())))




Fixed submission:
def lcm(a,b):
    m = a*b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a+b)
a, b = tuple(map(int, input().split()))
print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
print(max(int(input()) - 2*int(input()), 0))

Fixed submission:
a, b = map(int, input().split())
print(max(a - 2*b, 0))
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10**9+7
n, m = map(int, input().split())
stairs = [0]*(n+1)
broken = []
stairs[0] = 1

for i in range(m):
    b = int(input())
    if broken and b-1 == broken[-1]:
        print(0)
        exit(0)
    broken.append(b)

for i in range(n+1):
    if i in broken:
        continue
    if i >= 2:
        stairs[i] = stairs[i-1] + stairs[i-2]
    elif i == 1:
        stairs[i] = stairs[i-1]

print(stairs[-1]%mod)




Fixed submission:
mod = 10**9+7
n, m = map(int, input().split())
stairs = [0]*(n+1)
broken = []
stairs[0] = 1

def binSearch(broken, e):
    l, r = 0, m-1

    while l <= r:
        mid = (l+r)//2

        if broken[mid] > e:
            r = mid - 1
        elif broken[mid] < e:
            l = mid + 1
        else:
            return True
    return False


for i in range(m):
    b = int(input())
    if broken and b-1 == broken[-1]:
        print(0)
        exit(0)
    broken.append(b)

for i in range(n+1):
    if binSearch(broken, i):
        continue
    if i >= 2:
        stairs[i] = stairs[i-1] + stairs[i-2]
    elif i == 1:
        stairs[i] = stairs[i-1]

print(stairs[-1]%mod)

Buggy python submission (verdict: Time Limit Exceeded):
mod = 10**9+7
n, m = map(int, input().split())
stairs = [0]*(n+1)
broken = []
stairs[0] = 1

for i in range(m):
    broken.append(int(input()))

for i in range(n+1):
    if i in broken:
        continue
    if i >= 2:
        stairs[i] = stairs[i-1] + stairs[i-2]
    elif i == 1:
        stairs[i] = stairs[i-1]

print(stairs[-1]%mod)




Fixed submission:
mod = 10**9+7
n, m = map(int, input().split())
stairs = [0]*(n+1)
broken = []
stairs[0] = 1

def binSearch(broken, e):
    l, r = 0, m-1

    while l <= r:
        mid = (l+r)//2

        if broken[mid] > e:
            r = mid - 1
        elif broken[mid] < e:
            l = mid + 1
        else:
            return True
    return False


for i in range(m):
    b = int(input())
    if broken and b-1 == broken[-1]:
        print(0)
        exit(0)
    broken.append(b)

for i in range(n+1):
    if binSearch(broken, i):
        continue
    if i >= 2:
        stairs[i] = stairs[i-1] + stairs[i-2]
    elif i == 1:
        stairs[i] = stairs[i-1]

print(stairs[-1]%mod)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
d = []
c = 0

for i in range(n):
    d.append(tuple(map(int, input().split())))
d.sort()

while m > 0:
    a, b = d[0]
    c += min(a * b, m * a)
    m -= b
    d = d[1:]

print(c)

Fixed submission:
n, m = map(int, input().split())
d = []
c = 0
last = 0

for i in range(n):
    d.append(tuple(map(int, input().split())))
d.sort()

while m > 0:
    a, b = d[last]
    c += min(a * b, m * a)
    m -= b
    last+=1

print(c)
Buggy python submission (verdict: Time Limit Exceeded):
# coding:utf-8

import math

def main():
    s = list(raw_input())
    s.reverse()
    cnt = 0
    total = 0
    while True:
        chk = False
        for i in s:
            if i == 'C' and cnt < len(s) - 2:
                if s[cnt+1] == 'B' and s[cnt+2] == 'A':
                    s[cnt] = 'A'
                    s[cnt+1] = 'C'
                    s[cnt+2] = 'B'
                    total += 1
                    chk = True
                    break
            cnt += 1
        if chk == True:
            cnt = 0
            continue
        else:
            break
    print total


if __name__ == "__main__":
    main()



Fixed submission:
# coding:utf-8

import math

def main():
    s = list(raw_input())
    substr = ''
    total = []
    cnt = 0
    m = False
    for i in s:
        if i == 'A' and m == False:
            cnt += 1
        elif i == 'A':
            cnt = 1
            m = False
        elif i == 'B' and m == False:
            m = True
        elif i == 'C' and m == True:
            total.append(cnt)
            m = False
        else:
            m = False
            cnt = 0
    result = 0
    for i in total:
        result += i
    print result

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# coding:utf-8

import math
import re

def main(params):
    n,m = params[0]
    a = params[1]
    tmpA = []
    for i in a:
        i = int(i)
        tmpA.append(i)
    a = tmpA
    a.sort()
    a.reverse()
    r = []
    for g in params[2:]:
        b = int(g.split()[0])
        c = int(g.split()[1])
        t = [c] * b
        r.extend(t)
    r.sort()
    r.reverse()
    cnt = 0
    total = 0L
    while True:
        if len(a) == 0:
            total += r[0]
            r.pop(0)
        elif len(r) == 0:
            total += a[0]
            a.pop(0)
        elif a[0] < r[0]:
            total += r[0]
            r.pop(0)
        else:
            total += a[0]
            a.pop(0)
        cnt += 1
        if cnt == n:
            break
    print total
#    a = params[1].split()
#    b = list(params[2])

if __name__ == "__main__":
    n,m = raw_input().split()
    n = int(n)
    m = int(m)
    a = raw_input().split()
    cnt = m # TODO: edit here
    params = [[n,m],a]
    for i in range(cnt):
        param = raw_input()
        params.append(param)
    main(params)



Fixed submission:
# coding:utf-8

import math
import re

def main(params):
    n,m = params[0]
    a = params[1]
    tmpA = []
    for i in a:
        i = int(i)
        tmpA.append(i)
    a = tmpA
    a.sort()
    a.reverse()
    r = {}
    for g in params[2:]:
        b = int(g.split()[0])
        c = int(g.split()[1])
        if c not in r:
            r[c] = b
        else:
            r[c] += b
#        t = [c] * b
#        r.extend(t)
#    r.sort()
#    r.reverse()
    rV = r.keys()
    rV.sort()
    rV.reverse()
    cnt = 0
    total = 0L
    while True:
        if len(a) == 0:
            total += rV[0]
            r[rV[0]] -= 1
            if r[rV[0]] == 0:
                rV.pop(0)
        elif len(rV) == 0:
            total += a[0]
            a.pop(0)
        elif a[0] < rV[0]:
            total += rV[0]
            r[rV[0]] -= 1
            if r[rV[0]] == 0:
                rV.pop(0)
        else:
            total += a[0]
            a.pop(0)
        cnt += 1
        if cnt == n:
            break
    print total
#    a = params[1].split()
#    b = list(params[2])

if __name__ == "__main__":
    n,m = raw_input().split()
    n = int(n)
    m = int(m)
    a = raw_input().split()
    cnt = m # TODO: edit here
    params = [[n,m],a]
    for i in range(cnt):
        param = raw_input()
        params.append(param)
    main(params)
Buggy python submission (verdict: Runtime Error):
import math

n = int(raw_input())
a = raw_input().split()

cnt = 0
for i in a:
    a[cnt] = int(i)
    cnt += 1

chk = {}
def make_divisors(k):
    divisors = []
    for i in range(1, int(k**0.5)+1):
        if k % i == 0:
            #divisors.append(i)
            if i in chk:
                chk[i] += 1
            else:
                chk[i] = 1
            if i != k // i:
                #divisors.append(n//i)
                key = int(k//i)
                if key in chk:
                    chk[key] += 1
                else:
                    chk[key] = 1

    # divisors.sort()
    return divisors

if n == 2:
    print max(a[0],a[1])
else:
    for i in range(2):
        make_divisors(a[i])
    for i in reversed(range(2,len(a))):
        k = a[i]
        chk2 = chk
        for j in chk:
            if k % j == 0:
                chk[j] += 1
            if chk[j] < i:
                #del chk2[j]
                continue
        chk = chk2
    answer = 0
    for i in chk:
        if int(chk[i]) >= n - 1:
            answer = i
    print answer

Fixed submission:
import math
import re

a,b,t = raw_input().split()
#s = list(raw_input())

a = int(a)
b = int(b)
t = int(t)

now = a
total = 0
while True:
    if now < t + 0.5:
        total += b
        now += a
    else:
        break

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

n,k = raw_input().split()
s = list(raw_input())


cnt = 0

prev = ''
tmp = ''
ar = []
for i in s:
    if i == '0' and prev !=  1:
        tmp += '0'
        prev = 0
    elif i == '0' and prev == 1:
        prev = 0
        ar.append(tmp)
        tmp = '0'
    elif i == '1' and prev != 0:
        tmp += '1'
        prev = 1
    elif i == '1' and prev == 0:
        prev = 1
        ar.append(tmp)
        tmp = '1'

ar.append(tmp)
k = int(k)


j = 0
cnt = 0
total = 0
m = 0

for i in ar:
    total += len(i)
    if '0' in i:
        cnt += 1
    if '0' in i and cnt == k + 1:
        total = total - (len(ar[j-2*k]) + len(ar[j-2*k-1]))                                            
        cnt = k                                    
    m = max(m, total)
    j += 1

print m

Fixed submission:
ar = []                                            
raw = raw_input().split()                          
#ar.append(int(raw))                               
#raw = raw_input()                                 
#raw = raw_input()                                 
#ar.append(int(raw))                               
#raw = raw_input()                                 
#ar.append(int(raw))                               
#raw = raw_input()                                 
#ar.append(int(raw))                               
#raw = raw_input()                                 
#ar.append(int(raw))                               




#n = ar[0]                                         
a = int(raw[0])                                    
b = int(raw[1])
#c = ar[3]
#d = ar[4]
#e = ar[5]                                         

first = max(a,b)                                   

if ( a > b):                                       
    a -= 1                                         
else:
    b -= 1                                         


second = max(a,b)                                  

print first + second
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
s = raw_input()

result = 300000

for i in range(n):
    cnt = 0
    a = s[:i].replace("E", "")
    b = s[i+1:].replace("W", "")
    result = min(len(a) + len(b), result)

print result

Fixed submission:
n = input()
s = raw_input()

result = 300000

before = 0
after = 0

for i in range(n):
    if s[i] == "E":
        before = before + 1
    if before > after:
        before = after
    if s[i] == "W":
        after = after + 1

print min(before, after)

Buggy python submission (verdict: Time Limit Exceeded):

n = input()
s = raw_input()

result = 300000

for i in range(n):
    cnt = 0
    for j in range(n):
        if i < j:
            if s[j] == "E":
                cnt = cnt + 1
        elif j < i:
            if s[j] == "W":
                cnt = cnt + 1
    result = min(result, cnt)
print result

Fixed submission:
n = input()
s = raw_input()

result = 300000

before = 0
after = 0

for i in range(n):
    if s[i] == "E":
        before = before + 1
    if before > after:
        before = after
    if s[i] == "W":
        after = after + 1

print min(before, after)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,imput().split())
print(a*b//2)

Fixed submission:
a,b,c = map(int,input().split())
print(a*b//2)

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,imput().split())
print(a*b/2)

Fixed submission:
a,b,c = map(int,input().split())
print(a*b//2)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = [int(input()) for _ in renge(4)]
print(min(a,b) + min(c,d))


Fixed submission:
a,b,c,d = [int(input()) for _ in range(4)]
print(min(a,b) + min(c,d))

Buggy python submission (verdict: Runtime Error):
a,b,c,d = [int(input) for _ in renge(4)]
print(min(a,b) + min(c,d))


Fixed submission:
a,b,c,d = [int(input()) for _ in range(4)]
print(min(a,b) + min(c,d))
Buggy python submission (verdict: Runtime Error):
n,l = map(int,input().split())
s = sorted([input() for i in range(n)])
print(*s,seq="")

Fixed submission:
n,l = map(int,input().split())
s = sorted([input() for i in range(n)])
print(*s,sep="")