Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from functools import reduce
INF = int(1e9 + 7)


def modmulti(a, b):
    # aとbを掛けた値をmodする(a * b mod p)
    return a * b % INF


def factorial(x):
    FCT = 1
    FCT = reduce(modmulti, range(2, x + 1))
    return FCT


def main():
    N, M = map(int, input().split())
    MIN_NM = factorial(min(N, M))
    if N == M or N + 1 == M or N == M + 1:
        print(modmulti(2, modmulti(MIN_NM, MIN_NM))
              if N == M else modmulti(MIN_NM, modmulti(MIN_NM, max(N, M))))
    else:
        print(0)

    return


main()


Fixed submission:
INF = int(1e9 + 7)
FCT = [0] * (int(1e5) + 1)


def modmulti(a, b):
    # aとbを掛けた値をmodする(a * b mod p)
    return a * b % INF


def factorial(x):
    FCT[0] = 1
    FCT[1] = 1
    for i in range(2, x + 1):
        FCT[i] = modmulti(FCT[i - 1], i)


def main():
    N, M = map(int, input().split())
    if N == M or N + 1 == M or N == M + 1:
        if N < M:
            factorial(M)
        else:
            factorial(N)
        print(modmulti(2, modmulti(FCT[N], FCT[M]))
              if N == M else modmulti(FCT[N], FCT[M]))
    else:
        print(0)

    return


main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
T = [int(i) for i in input().split()]
M = int(input())

PX = []

for i in range(M):
    # 0-indexed
    PX.append([int(j) for j in input().split()])
    PX[i][0] -= 1

ans = sum(T)

for i in range(M):
    print(ans - T[PX[i][0]] + T[PX[i][1]])


Fixed submission:
N = int(input())
T = [int(i) for i in input().split()]
M = int(input())

PX = []

for i in range(M):
    # 0-indexed
    PX.append([int(j) for j in input().split()])
    PX[i][0] -= 1

ans = sum(T)

for i in range(M):
    print(ans - T[PX[i][0]] + PX[i][1])

Buggy python submission (verdict: Runtime Error):
N = int(input())
T = [int(i) for i in input().split()]
M = int(input())

PX = []

for i in range(M):
    # 0-indexed
    PX.append([int(j) for j in input().split()])
    PX[i][0] -= 1

ans = sum(T)

for i in range(M):
    print(ans - T[PX[i][0]] + T[PX[i][1]])


Fixed submission:
N = int(input())
T = [int(i) for i in input().split()]
M = int(input())

PX = []

for i in range(M):
    # 0-indexed
    PX.append([int(j) for j in input().split()])
    PX[i][0] -= 1

ans = sum(T)

for i in range(M):
    print(ans - T[PX[i][0]] + PX[i][1])
Buggy python submission (verdict: Time Limit Exceeded):
import re


def main():
    S = input()
    lens = len(S)
    while len(S):
        S = re.sub("dreamer$", "", S)
        S = re.sub("eraser$", "", S)
        S = re.sub("dream$", "", S)
        S = re.sub("erase$", "", S)
        if lens == len(S):
            print("NO")
            return
    print("YES")
    return


main()


Fixed submission:
dreamer = "dreamer"
eraser = "eraser"
dream = "dream"
erase = "erase"


def main():
    S = input()

    while len(S):
        lens = len(S)
        if S[lens - len(dreamer):] == dreamer:
            S = S[: lens - len(dreamer)]
        elif S[lens - len(eraser):] == eraser:
            S = S[:lens - len(eraser)]
        elif S[lens - len(dream):] == dream:
            S = S[:lens - len(dream)]
        elif S[lens - len(erase):] == erase:
            S = S[:lens - len(erase)]
        if lens == len(S):
            print("NO")
            return
    print("YES")
    return


main()
Buggy python submission (verdict: Time Limit Exceeded):
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########

def resolve():
    n = ii()
    a = mi()
    res = 1
    for i in a:
        res = res * i
    print(res if res <= 10**18 else -1)

if __name__ == "__main__":
    resolve()

Fixed submission:
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########

def resolve():
    n = ii()
    a = mi()
    if 0 in a:
        print(0)
        return
    res = 1
    for i in a:
        res = res * i
        if(res > 10**18):
            print(-1)
            return
    print(res)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
def main(a,b,c,k):
    res = 0
    if k < a:
        res = k
    elif a <= k < a+b:
        res = a
    elif a+b <= k:
        res = a - (k - (a + b))
    return res

a,b,c,k = mi()
print(main(a,b,c,k))

Fixed submission:
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(a,b,c,k):
    res = 0
    if k < a:
        res = k
    elif a <= k < a+b:
        res = a
    elif a+b <= k:
        res = a - (k - (a + b))
    return res

a,b,c,k = mi()
print(main(a,b,c,k))
Buggy python submission (verdict: Time Limit Exceeded):
##########
import math
#import numpy as np
from itertools import product as prod
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr

ii = lambda:int(input())
li = lambda:list(map(int,input().split()))
##########
def main(k):
    res = 0
    for item in prod(range(1,k+1),repeat=3):
        res += calc(item)
    return res
        
def calc(item):
    a,b,c = item
    return math.gcd(a,math.gcd(b,c))

k = ii()
print(main(k))

Fixed submission:
##########
import math
#import numpy as np
from itertools import product as prod
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr

ii = lambda:int(input())
li = lambda:list(map(int,input().split()))
##########
def main(k):
    res = 0
    for item in prod(range(1,k+1),repeat=3):
        res += calc(item)
    return res
        
def calc(item):
    a,b,c = item
    return math.gcd(a,math.gcd(b,c))

k = ii()
print(main(k))
Buggy python submission (verdict: Runtime Error):
s = input
print("Yes" if s[2]==s[3] and s[4]==s[5] else "No")

Fixed submission:

s = input()

if(s[2]==s[3] and s[4]==s[5]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
def main(a,b,c):
    temp = math.sqrt(a) + math.sqrt(b)
    return "Yes" if math.sqrt(c) > temp else "No"

a,b,c = map(int, input().split())
print(main2(a,b,c))

Fixed submission:
def main(a,b,c):
    if c-a-b < 0:
        return "No"
    else:
        if 4*a*b < (c-a-b)**2:
            return "Yes"
        else: return "No"

a,b,c = map(int, input().split())
print(main(a,b,c))
Buggy python submission (verdict: Time Limit Exceeded):
def main(n,k,p):
    res = 0
    #期待値リスト
    kitai = [0]*n
    for i in range(len(p)):
        kitai[i] = (p[i]+1) / 2
    for i in range(k-1,len(p)):
        res = max(res, sum(kitai[i-k+1:i+1]))
    return res

n,k = map(int, input().split())
p = list(map(int,input().split()))
print(main(n,k,p))

Fixed submission:
def main(n,k,p):
    res = 0
    #期待値リスト
    kitai = [0] * n
    ruiseki = [0] * n
    kitai[0] = (p[0] + 1) / 2
    ruiseki[0] = kitai[0]
    if n == 1:
        return kitai[0]
    else:
        for i in range(1, len(p)):
            kitai[i] = (p[i] + 1) / 2
            ruiseki[i] = ruiseki[i-1] + kitai[i]
    for i in range(k-1, len(ruiseki)):
        res = max(res, ruiseki[i] - (ruiseki[i-k] if (i-k) >= 0 else 0))
    return res


n,k = map(int, input().split())
p = list(map(int,input().split()))
print(main(n,k,p))
Buggy python submission (verdict: Time Limit Exceeded):
import math

#Input
H, N = map(int, input().split())
lstV = list()
lstC = list()
for i in range(N):
    value, cost = map(int, input().split())
    lstV.append(value)
    lstC.append(cost)

#DPMap
inf = 2**31 - 1
dp = list([inf]*(H + max(lstV)))
dp[0] = 0
for i in range(0,len(dp)):
    if dp[i] != inf:
        for j in range(0,len(lstV)):
            value = lstV[j]
            cost = lstC[j]
            if i + value <= len(dp) - 1:
                dp[i + value] = min(dp[i + value], dp[i] + cost)
print(min(dp[H:]))

Fixed submission:
H, N = map(int, input().split())
AB = list(list(map(int, input().split())) for _ in range(N))

def main2(H, N, AB):
    inf = 2**31 -1
    dp = [inf] * (H + max(a for a, _ in AB))
    dp[0] = 0
    for i in range(1, len(dp)):
        dp[i] = min(dp[i-a]+b for a,b in AB)
    print(min(dp[H:]))

main2(H,N,AB)

Buggy python submission (verdict: Time Limit Exceeded):
import math

#Input
H, N = map(int, input().split())
lstV = list()
lstC = list()
for i in range(N):
    value, cost = map(int, input().split())
    lstV.append(value)
    lstC.append(cost)

#DPMap
dp = list([2**31-1]*(H + max(lstV)))
dp[0] = 0
for i in range(0,len(dp)):
    for j in range(0,len(lstV)):
        value = lstV[j]
        cost = lstC[j]
        if i + value <= len(dp) - 1:
            dp[i + value] = min(dp[i + value], dp[i] + cost)
print(min(dp[H:]))

Fixed submission:
H, N = map(int, input().split())
AB = list(list(map(int, input().split())) for _ in range(N))

def main2(H, N, AB):
    inf = 2**31 -1
    dp = [inf] * (H + max(a for a, _ in AB))
    dp[0] = 0
    for i in range(1, len(dp)):
        dp[i] = min(dp[i-a]+b for a,b in AB)
    print(min(dp[H:]))

main2(H,N,AB)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lstP = list(map(int, input().split()))

count = 0

for i in range(0, len(lstP)):
    lstT = lstP[0:i+1]
    if min(lstT) == lstP[i]:
        count = count + 1

print(count)

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

count = 1
minval = lstP[0]

for i in range(1, len(lstP)):
    val = lstP[i]
    if val <= minval:
        minval = val
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
C = input()

print(chr(ord(C)+1)

Fixed submission:
C = input()

print(chr(ord(C)+1))
Buggy python submission (verdict: Runtime Error):
def main(n,m,r):
    ac = [0]*n
    wa = [0]*n
    for i in range(len(r)):
        if r[i][1] == "WA":
            if ac[int(r[i][0])] != 0:
                wa[int(r[i][0])] += 1
        elif r[i][1] == "AC":
            ac[int(r[i][0])] = 1
    acsum = sum(ac)
    wasum = sum(wa)
    return "{0} {1}".format(acsum, wasum)

n,m = map(int, input().split())
r = list(input().split() for _ in range(m))
print(main(n,m,r))

Fixed submission:
def main(n,m,r):
    ac = [0]*n
    wa = [0]*n
    for i in range(len(r)):
        seq = int(r[i][0])
        judge = r[i][1]
        if ac[seq-1] == 1:
            continue
        if judge == "WA":
            wa[seq-1] += 1
        else:
            ac[seq-1] = 1
    for i in range(len(ac)):
        if ac[i] == 0:
            wa[i] = 0
    return "{0} {1}".format(sum(ac), sum(wa))

n,m = map(int, input().split())
r = list(input().split() for _ in range(m))
print(main(n,m,r))

Buggy python submission (verdict: Time Limit Exceeded):
def main(n,m,r):
    c_ac = 0
    c_wa = 0
    for i in range(n):
        wa = 0
        for j in range(len(r)):
            if int(r[j][0]) != i+1:
                continue
            if r[j][1] == "WA":
                wa += 1
            elif r[j][1] == "AC":
                c_ac += 1
                c_wa += wa
                break
    return "{0} {1}".format(c_ac, c_wa)


n,m = map(int, input().split())
r = list(input().split() for _ in range(m))
print(main(n,m,r))

Fixed submission:
def main(n,m,r):
    ac = [0]*n
    wa = [0]*n
    for i in range(len(r)):
        seq = int(r[i][0])
        judge = r[i][1]
        if ac[seq-1] == 1:
            continue
        if judge == "WA":
            wa[seq-1] += 1
        else:
            ac[seq-1] = 1
    for i in range(len(ac)):
        if ac[i] == 0:
            wa[i] = 0
    return "{0} {1}".format(sum(ac), sum(wa))

n,m = map(int, input().split())
r = list(input().split() for _ in range(m))
print(main(n,m,r))
Buggy python submission (verdict: Runtime Error):
from collections import Counter

def main(n,k,r,s,p,t):
    score = 0
    for i in range(len(t)):
        if i < k:
            continue
        if t[i] == t[i-k]:
            t[i] = "N"
    c = Counter(t)
    i = dict(c)
    score += i["r"]*p + i["s"]*r + i["p"]*s
    return score
    
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = list(input())
print(main(n,k,r,s,p,t))

Fixed submission:
from collections import Counter
from collections import defaultdict

def main(n,k,r,s,p,t):
    score = 0
    for i in range(len(t)):
        if i < k:
            continue
        if t[i] == t[i-k]:
            t[i] = "N"
    c = Counter(t)
    i = defaultdict(int,c)
    score += i["r"]*p + i["s"]*r + i["p"]*s
    return score
    
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = list(input())
print(main(n,k,r,s,p,t))
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())

print(6-(A+B))

Fixed submission:
A = int(input())
B = int(input())

print(6-(A+B))
Buggy python submission (verdict: Runtime Error):
import numpy as np
def main(a,b):
    g = np.gcd(a,b)
    lcm = (x * y) // g
    return lcm

a,b = map(int,input().split())
print(main(a,b))

Fixed submission:
import fractions
def main(a,b):
    g = fractions.gcd(a,b)
    lcm = (a * b) // g
    return lcm
    
a,b = map(int,input().split())
print(main(a,b))
Buggy python submission (verdict: Runtime Error):
def main(s):
    isEven = int(len(s)%2)
    ran = (len(s)-1)/2 if isEven else (len(s)/2)
    count = 0
    for i in range(ran):
        if s[i] != s[-(i+1)]:
            count += 1
    return count

s = input()
print(main(s))

Fixed submission:
def main(s):
    isEven = int(len(s)%2)
    ran = int((len(s)-1)/2 if isEven else (len(s)/2))
    count = 0
    for i in range(ran):
        if s[i] != s[-(i+1)]:
            count += 1
    return count

s = input()
print(main(s))
Buggy python submission (verdict: Runtime Error):
dic[]

dic["SUN"] = 7
dic["MON"] = 6
dic["TUE"] = 5
dic["WED"] = 4
dic["THU"] = 3
dic["FRI"] = 2
dic["SAT"] = 1

S = str()input()

print(dic[S])

Fixed submission:
dic = {}

dic["SUN"] = 7
dic["MON"] = 6
dic["TUE"] = 5
dic["WED"] = 4
dic["THU"] = 3
dic["FRI"] = 2
dic["SAT"] = 1

S = str(input())

print(dic[S])
Buggy python submission (verdict: Time Limit Exceeded):
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
iix = lambda x:list(int(input()) for _ in range(x))
mix = lambda x:list(li() for _ in range(x))
##########
def main(n,k,q,a):
    point = [k]*n
    for ans in a:
        point = answer(ans-1, point)
    for i in range(len(point)):
        print(judge(point[i]))
    
def answer(n,point):
    for i in range(len(point)):
        if i != n : point[i] -= 1
    return point
 
def judge(p):
    return "Yes" if p > 0 else "No"
 
n,k,q = mi()
a = iix(q)
main(n,k,q,a)

Fixed submission:
from collections import Counter as counter

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
iix = lambda x:list(int(input()) for _ in range(x))
mix = lambda x:list(li() for _ in range(x))
##########
def main(n,k,q,a):
    c = counter(a)
    for i in range(1,n+1):
        print("Yes" if k-q+c[i] > 0 else "No")

n,k,q = mi()
a = iix(q)
main(n,k,q,a)

Buggy python submission (verdict: Time Limit Exceeded):
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
iix = lambda x:list(int(input()) for _ in range(x))
mix = lambda x:list(li() for _ in range(x))
##########
def main(n,k,q,a):
    point = [k]*n
    for ans in a:
        point = answer(ans-1, point)
    for i in range(len(point)):
        print(judge(point[i]))
    
def answer(n,point):
    for i in range(len(point)):
        if i != n : point[i] -= 1
    return point

def judge(p):
    return "Yes" if p > 0 else "No"

n,k,q = mi()
a = iix(q)
main(n,k,q,a)

Fixed submission:
from collections import Counter as counter

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
iix = lambda x:list(int(input()) for _ in range(x))
mix = lambda x:list(li() for _ in range(x))
##########
def main(n,k,q,a):
    c = counter(a)
    for i in range(1,n+1):
        print("Yes" if k-q+c[i] > 0 else "No")

n,k,q = mi()
a = iix(q)
main(n,k,q,a)
Buggy python submission (verdict: Runtime Error):
N = str(input())

count = 0
for i in range(1, len(N)):
    if i % 2 != 0:
        count += 9 * 10**(i-1)

hasuu = int(N[1:len(N)]) + 1 if (len(N) % 2 != 0) else 0

print(str(count+hasuu))

Fixed submission:
N = str(input())
def main1(N):
    count = 0
    for i in range(1, len(N) + 1):
        if i % 2 != 0 :
            if i != len(N):
                count += 9 * 10**(i-1)
            else:
                if len(N) != 1:
                    count += ((int(N[0]) - 1) * 10**(i-1)
                        + int(N[1:len(N)]) + 1)
                else:
                    count += int(N[0])
    print(count)

main1(N)
Buggy python submission (verdict: Runtime Error):
msg = "IMPOSSIBLE"
A,B = int(input().split())

I,m = divmod((A+B), 2)

if m != 0:
    res = msg
else:
    res = (A+B)/2

print(res)

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

I,m = divmod((A+B), 2)

if m != 0:
    res = msg
else:
    res = int((A+B)/2)

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

count = 0
for i in range(1, len(lstp)-1):
    lst = list(lstp[i-1], lstp[i], lstp[i+1])
    if (min(lst) != lstp[i]) and (max(lst) != lstp[i]):
        count = count + 1

print(count)

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

count = 0

for i in range(0, len(lst)-2):
    target = lst[i:i+3]
    minVal = min(target)
    maxVal = max(target)
    val = lst[i+1]
    if val != minVal and val != maxVal:
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
S = map(int, input().split())

flag = 0;

for i in range(1, 3):
    if S[i-1] = S[i] :
        flag = 1

res = "Good" if flag==0 else "Bad"

print(res)

Fixed submission:
S = input()

flag = 0;

for i in range(1, 4):
    if S[i-1] == S[i] :
        flag = 1

res = "Good" if flag==0 else "Bad"

print(res)
Buggy python submission (verdict: Runtime Error):
def calcBoundCount(rangex, lstL):
    d = 0
    for i in range(0, len(lstL)):
        d = d + lstL[i]
        if rangex < d:
            return i + 1
    return len(lstL) + 1

N, X = map(int, input().split())
lstL = list(map(int, input().split()))

count = calcBoundCount(X, lstL)
print((count if count <= N+1 else N+1))

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

res = (int)(10 if X>=A else 0)

print(res)
Buggy python submission (verdict: Runtime Error):
def calcBoundCount(rangex, lstL):
    d = 0
    for i in range(0, len(lstL)):
        d = d + lstL[i]
        if rangex < d:
            return i + 1

N, X = map(int, input().split())
lstL = list(map(int, input().split()))

count = calcBoundCount(X, lstL)
print((count if count <= N+1 else N+1))

Fixed submission:
def calcBoundCount(rangex, lstL):
    d = 0
    for i in range(0, len(lstL)):
        d = d + lstL[i]
        if rangex < d:
            return i + 1
    return len(lstL) + 1
 
N, X = map(int, input().split())
lstL = list(map(int, input().split()))
 
count = calcBoundCount(X, lstL)
print((count if count <= N+1 else N+1))
Buggy python submission (verdict: Time Limit Exceeded):

def main(N, M, a):
    dp = [0] * (N+1)
    dp[0] = 1
    dp[1] = 1 if 1 not in a else 0
    for i in range(2, len(dp)):
        dp[i] = dp[i-1] + dp[i-2] if i not in a else 0
    return dp[-1] % (10**9+7)

N, M = map(int, input().split())
a = list(int(input()) for _ in range(M))
print(main(N,M,a))

Fixed submission:

def main(N, M, a):
    dp = [-1] * (N+1)
    dp[0] = 1
    dp[1] = 1
    for i in a :
        dp[i] = 0
    for i in range(2, len(dp)):
        dp[i] = dp[i-1] + dp[i-2] if dp[i] != 0 else 0
    return dp[-1] % (10**9+7)

N, M = map(int, input().split())
a = list(int(input()) for _ in range(M))
print(main(N,M,a))
Buggy python submission (verdict: Runtime Error):
    A, B = map(int, input().split())

    price = (int)(
        B   if A >= 13 else
        B/2 if A >= 6 else
        0)

    print(price) 

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

price = (int)(
    B   if A >= 13 else
    B/2 if A >= 6 else
    0)

print(price)

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

    price = (int)(
        B   if A >= 13 else
        B/2 if A >= 6 else
        0)

    return price 


if __name__ == '__main__'
    print(main())

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

price = (int)(
    B   if A >= 13 else
    B/2 if A >= 6 else
    0)

print(price)

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

    price = B if B >= 13 else B/2 if B >= 6 else 0

    return price 


if __name__ == '__main__'
    print(main())

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

price = (int)(
    B   if A >= 13 else
    B/2 if A >= 6 else
    0)

print(price)
Buggy python submission (verdict: Runtime Error):
N, K = input().split()
S = input()

if K==1 :
    str1 = ''
else :
    str1 = S[0:K-2]

if K==N:
    str3 = ''
else :
    str3 = S[K:N]

before = S[K-1]
str2 = before.lower()

print(str1+str2+str3)

Fixed submission:
#INPUT
#N K
#S

#1≤N≤50
#1≤K≤N
#Sは A, B, C からなる長さNの文字列

#ex
#3 1
#ABC

#OUTPUT
#文字列SのK文字目を小文字に書き換え、新しくできたSを出力せよ。

N, K =  map(int, input().split())
S = input()

if K==1 :
    str1 = ''
else :
    str1 = S[0:K-1]

if K==N:
    str3 = ''
else :
    str3 = S[K:N]

before = S[K-1]
str2 = before.lower()

print(str1+str2+str3)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

def main1(A, B):
    res = 0
    if B + 1 < A:
        res = (A * 2) - 1
    elif A == B :
        res = A + B
    else:
        res = (B * 2) - 1
    print(res)

main(A, B)


Fixed submission:
def main1(A, B):
    res = 0
    if A == B:
        res = A * 2
    else:
        res = (max(A,B) * 2) - 1
    print(res)

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

#main1(5,3)#9
#main1(3,4)#7
#main1(6,6)#12