Problem:


Score : 100 points

Problem Statement

There are two buttons, one of size A and one of size B.

When you press a button of size X, you get X coins and the size of that button decreases by 1.

You will press a button twice. Here, you can press the same button twice, or press both buttons once.

At most how many coins can you get?

Constraints

All values in input are integers.

3 \leq A, B \leq 20

Input

Input is given from Standard Input in the following format:

A B

Output

Print the maximum number of coins you can get.

Sample Input 1

5 3

Sample Output 1

9

You can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this is the maximum result.

Sample Input 2

3 4

Sample Output 2

7

Sample Input 3

6 6

Sample Output 3

12



Sample input:
5 3


Sample output:
9

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
x = input().split(" ")
a = int(x[0])
b = int(x[1])

ans = 0
num = 0
while num < 2:
    if a >= b:
        ans += a
        a -= 1
    else:
        asn += b
        b -= 1
    num += 1
print(ans)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
x=0
def f():
  if A>B:
    x=x+A
    A=A-1
  else:
    x=x+B
    B=B-1
    
f()
f()
print(x)

Submission status: Runtime Error

Solution code:
a, b, t = map(int, input().split())

print((t // a) * b)

Submission status: Runtime Error

Solution code:
A,B = map(int, input().split())
print(max(2*a-1, 2*b-1, a+b))

Submission status: Runtime Error

Solution code:
a, b = list(map(int, input().split))
result = 0
for _ range(2):
  if a >= b:
    result += a
    a -= 1
  else:"
    result += b
    b -= 1
print(result)

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
a.append(a[0]-1)
a.append(a[1]-1)
a.sort()
pirnt(a[-1]+ a[-2])

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
sum=0
for i in range(2):
	if a>b:
		sum+=a
		a--
	else:
		sum+=b
		b--
print(sum)

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
sum=0
for i in range(2)
	if a>b:
		sum+=a
		a--
	else:
		sum+=b
		b--
print(sum)

Submission status: Runtime Error

Solution code:
#124a
a, b = list(map(int, input().split()))
ans=0
if a > b:
  ans += a
  a -= 1
else:
  ans += b
  b -= 1
ans+=max(a,b)
  
print(ans６)

Submission status: Runtime Error

Solution code:
a, b = int(input().split())

if a >= b:
    c = a - 1
    k = max(c,b)
    print(a+k)

else:
    c = b - 1
    k = max(a,c)
    print(b+k)

Submission status: Runtime Error

Solution code:
a, b = int(input().split())

if a >= b:
    k = max(a-1, b)
    print(a+k)

else:
    k = max(a, b-1)
    print(b+k)

Submission status: Runtime Error

Solution code:
a, b = int(input().split())

if a >= b:
    k = a-1
    print(a + max(k,b))

else:
    k = b-1
    print(b + max(a,k))

Submission status: Runtime Error

Solution code:
a, b = int(input().split())

if a >= b:
    c = a
    a = a-1
    print(c + max(a,b))

else:
    c = b
    b = b-1
    print(c + max(a,b))

Submission status: Runtime Error

Solution code:
a,b=map(int,input())
print(max(a*2-1,b*2-1,a+b))

Submission status: Runtime Error

Solution code:
a,b = map(int, input(),split())
ans = max(a + b, 2*a-1, 2*b-1)
print(ans)

Submission status: Runtime Error

Solution code:
a,b = map(int, input())
ans = max(a + b, 2*a-1, 2*b-1)
print(ans)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
print(max(a+b)+max(max(a+b)-1,min(a,b)))

Submission status: Runtime Error

Solution code:
a,b,x=map(int,raw_input().split())
if a==b:
  print a+b
else:
  print max(a,b)*2-1

Submission status: Runtime Error

Solution code:
a,b=map(int,iput().split())

if a>b or a==b:
  print(2*a-1)
else:
  print(2*b-1)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())

OnlyA = A+(A-1)
 
OnlyB = B+(B-1)
 
AaddB = A + B
 
print(max([OnlyA,OnlyB,AaddB]))

Submission status: Runtime Error

Solution code:
A,B= [int(input()) for i in range(2)]  
OnlyA = A+(A-1)

OnlyB = B+(B-1)

AaddB = A + B

print(max([OnlyA,OnlyB,AaddB]))

Submission status: Runtime Error

Solution code:
A,B= map(int, input().split())

OnlyA = A+(A-1)

OnlyB = B+(B-1)

AaddB = A + B

print(max[OnlyA,OnlyB,AaddB])

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
coin = 0
coin += max(a, b)
max(a, b) -= 1
coin += max(a, b)
print(coin)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
coin = 0
coin += max(a, b)
max(a, b) -= 1
coin = max(a, b)
print(coin)

Submission status: Runtime Error

Solution code:
data = list(map(int,input().split()))

ans = data[2]-(data[0]-data[1])

if ans > 0:
     print(ans)
else:
    print("0")

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <cmath>

using namespace std;

int main(){
 int a,b;
 cin >> a >> b;
 cout << max(a,b)+max(a,b)-1 << endl;

  
}

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
s=list(input())
cnt=0
ans=0
j=0
for i in range(n):
    if s[i]=="0":
        if i==0 or s[i-1]=="1":
            cnt+=1
    if cnt>k:
        while s[j]=="1":
            j+=1
        while s[j]=="0":
            j+=1
        cnt-=1
    ans=max(ans,i-j+1)

print(ans)

Submission status: Runtime Error

Solution code:
A,B=map(int,input()split())
print(max(A*(A-1),A*B,B*(B-1)))

Submission status: Runtime Error

Solution code:
n = int(input())
h = list(map(int,input().split()))
a=[h[i+1] for i in range(n-1) if h[i] >= max(h[i:])]
print(len([i for i in a if i >= h[0]])+1)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
tmp = 0
if abs(A-B) > 1:
    tmp = max(A,B)
    print(tmp*2-1)
else abs(A-B) == 1:
    print(A + B)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
if abs(A-B) > 1:
    tmp = max(A,B)
    print(tmp*2-1)
else abs(A-B) == 1:
    print(A + B)

Submission status: Runtime Error

Solution code:
import sys

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

gap = [abs(a-e),abs(b-e),abs(c-e),abs(d-e)]

for i in range(len(gap)):
	if gap[i] > k:
		print(':(')
		sys.exit()
print('Yay!')

Submission status: Runtime Error

Solution code:
a,b=(int(e)*2-1 for e in input()[::2])
print(max(a,b,(a+b)//2+1))

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())

if A >= B: print(2*A)
elif: print(2*B)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a==b:
  print(2*a):
else:
  print(2*max(a,b)-1)

Submission status: Runtime Error

Solution code:
A,B=[int(s) for s in input().split()]
if A>B:
  print(2*A-1)
elif A=B:
  print(2*A)
else:
  print(2*B-1)

Submission status: Runtime Error

Solution code:
a = sorted(list(map(int, input().split())))
if a[1]-a[0] >= 1:
  print(a[2]*2-1)
else:
  print(a[2]*2)

Submission status: Runtime Error

Solution code:
a = sorted(list(map(int, input().split())))
if a[2]-a[1]>=1:
  print(a[2]*2-1)

Submission status: Runtime Error

Solution code:
a = sorted(list(map(int, input().split())))
if a[2]-a[1]>=1:
  print(a[2]*2-1)
elif a[2]-a[1]=0:
  print(a[2]*2)

Submission status: Runtime Error

Solution code:
bt = input()
bt_A, bt_B = bt.split()
bt_max, bt_min = max(bt_A, bt_B), min(bt_A, bt_B)
max_num = bt_max + max(bt_max - 1, bt_min)
print(max_num)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())

int sum = 0

if A > B:
   sum = A+A-1
   print(sum)

if B > A:
   sum = B+B-1
   print(sum)

if B == A:
   sum = B+A
   print(sum)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
if A == B:
  print(2A)
else:
  print(2*max(A,B))

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
if A == B:
  print(2A)
else:
  print(2*max(A,B))

Submission status: Runtime Error

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

bl = []
if S[0] == "0":
    bl.append(0)
bl.append(0)
for i in range(1, N):
    if S[i-1] != S[i]:
        bl.append(i)
bl.append(N)
bl.append(N)

nbl = len(bl)
m = [bl[i+2 * K+1] - bl[i] 
     for i in range(nbl - 2*K-1) if i%2 == 0]
if len(m) == 0:
    print(N)
else:
    print(max(m))

Submission status: Runtime Error

Solution code:
M,N = [int(x) for x in input()]
print(M+N if M==N else 2*max(M,N)-1)

Submission status: Runtime Error

Solution code:
l=[int(input()) for i in range(6)]
if l[4]-l[0] <=l[5]:
  print('Yay!')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
s=[2*a-1,a+b,2*b-1]
print(max(s)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
s=[2*a-1,a+b,2*b-1]
print(s.max())

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
if a != b:
    ans = max(a,b) + max(a,b) - 1
else:
    ans = a*2:
print(ans)

Submission status: Runtime Error

Solution code:
a,b = map(int,input())
if a != b:
    ans = max(a,b) + max(a,b) - 1
else:
    ans = a*2:
print(ans)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
c, d = a-1, b-1
l = sorted[a,b,c,d][::-1]
print(l[0]+l[1])

Submission status: Runtime Error

Solution code:
a, b = map(int, input())
print(max(a+b, 2*a-1, 2*b-1))

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
print(max([2*a-1, a+b, 2*b-1])

Submission status: Runtime Error

Solution code:
print(max(list(map(input().split()))) * 2 - 1)

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())

print(max(x, y) + max(max(x, y)-1, min(x,y))

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())

print(max(x, y) + max(max(x, y)-1, min(x,y))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
S = list(input())
l = len(S)
X = []
cnt0 = 0
cnt1 = 0
for i in S:
    if i == '0':
        if cnt1 != 0:
            X.append(cnt1)
            cnt1 = 0
            cnt0 += 1
        else:
            cnt0 += 1
    else:
        if cnt0 != 0:
            X.append(cnt0)
            cnt0 = 0
            cnt1 += 1
        else:
            cnt1 += 1
if cnt1 != 0:
    X.append(cnt1)
elif cnt0 != 0:
    X.append(cnt0)
ans = []
if S[0] == '1': #Xの奇数は1
    sum0 = sum(X[0:2*K+1])
    ans.append(sum0)
    i = 0
    if 2*K+1 >= len(X):
        ans = sum(X)
    else:
        while 2*K+i+1 < len(X):
            ans.append(ans[i] + X[2*K+i+1] - X[i])
            i += 1
else:
    sum0 = sum(X[0:2*K])
    ans.append(sum0)
    i = 0
    while 2*K+i < len(X):
        ans.append(ans[i] + X[2*K+i] - X[i])
        i += 1
print(max(ans))

Submission status: Runtime Error

Solution code:
N = int(input())
H = list(map(int, input().split()))
cnt = 1
for i in range(1, N):
    if i == 1:
        if H[0] <= H[1]:
            cnt += 1
    else:
        elif max(H[:i-1]) <= H[i]:
            cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())

if abs(A-B) >= 2 :
	print(A*2-1)
elif abs(A-B) = 1 :
	print(max([A,B])+min([A,B]))
else :
	print(A*2)

Submission status: Runtime Error

Solution code:
A,B = [int(input()).split]

if abs(A-B) >= 2 :
	print(A*2-1)
elif abs(A-B) = 1 :
	print(max([A,B])+min([A,B]))
else :
	print(A*2)

Submission status: Runtime Error

Solution code:
a,b = int(input().split())

ans = 0

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

if(a > b):
  ans += a
  a -= 1
else:
  ans += b
  b -= 1
print(ans)

Submission status: Runtime Error

Solution code:
c=int(input())
n=list(map(int, input().split()))
 
ans = 0
max = n[0]
for i in n:
  if max <= i:
    ans += 1
    max = i
print(ans)

Submission status: Runtime Error

Solution code:
a,b = map(int, inptu().split())
if a == b:
    print (a*2)
else:
    print (max(a,b)*2-1)

Submission status: Runtime Error

Solution code:
a,b = map(int,input())
m = max(a,b)
m1 = m*2-1
m2 = a+b
ans = max(m1,m2)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N):
    if V[i] - C[i] > 0:
        ans += V[i] - C[i]

print(ans)

Submission status: Runtime Error

Solution code:
a, b = map(int(input().split()))
if a == b:
  print(a + b)
else:
  print(max(a, b) * 2 - 1)

Submission status: Runtime Error

Solution code:
n=int(input())
hotels=list(map(int,input().split()))

cnt=0
criteria=0
for i in range(n):
    if hotels[i]>=criteria:
        cnt+=1
        criteria=hotels[i]

print(cnt)

Submission status: Runtime Error

Solution code:
S = input()
S = [int(i) for i in list(S)]

a = []
c = []
b = True
for i in range(len(S)):
    if b:
        a.append(1)
        c.append(0)
        b=False
    else:
        a.append(0)
        c.append(1)
        b=True

combined1 = [abs(x-y) for (x, y) in zip(S, a)]
combined2 = [abs(x-y) for (x, y) in zip(S, c)]

if len(S)==1:
    print(0)
else:
    print(min(sum(combined1), sum(combined2)))

Submission status: Runtime Error

Solution code:
a,b = int(input())
if a>b:
  print(2*a-1)
elif a<b:
  print(2*b-1)
else:
  print(2*a)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())

if a=b:
  print(2*a)
  
else:
  print(2*max(a,b)-1)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())

ans=0

if a=b:
  ans+=2*a
  print(ans)
else:
  ans+=2*max(a,b)-1
  print(ans)

Submission status: Runtime Error

Solution code:
a,b=map(int(input().split()))

ans=0

if a=b:
  ans+=2*a
  print(ans)
else:
  ans+=2*max(a,b)-1
  print(ans)

Submission status: Runtime Error

Solution code:
a,b=int(input())

ans=0

if a=b:
  ans+=2*a
  print(ans)
else:
  ans+=2*max(a,b)-1
  print(ans)

Submission status: Runtime Error

Solution code:
A,B=map(int, input().split())
if A-B>=1:
  print(2*A-1)
  break
elif A==B:
  print(A+B)
  break
else:
  print(2*B-1)

Submission status: Runtime Error

Solution code:
A,B=map(int, input().split())
if A-B>=1:
  print(2*A-1)
  break
elif A==B:
  print(A+B)
  break
else:
  print(2*B-1)
  break

Submission status: Runtime Error

Solution code:
A,B=map(int, input().split())
if A-B>=2:
  print(2*A-1)
elif A=B:
  print(A+B)
else:
  print(2*B-1)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  if a[i] <= a[i+1]:
    b=i+2
  else:
    print(b)
    exit()

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
print((max(a,b)+max(max(a,b)-1,min(a,b)))

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

if a > b:
    print(a + a - 1)
if a ==	b:
    print(a + b)
else:
    print(b + b - 1)
    ç

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())

res = 0

if A > B:
  res = A + (A-1)
elif A == B:
  res = A + B
else
  res = B + (B-1)

print(res)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
print(max(2*A-1, 2*B-1, A+B)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
S = (input())
a = S.split('1')
a = [len(i) for i in a if len(i)!=0]

b = S.split('0')
b = [len(i) for i in b if len(i)!=0]
m = 0
c = [0]
for i in range(len(a)+len(b)):
    if S[0] == '0':
        if i%2==0:
            m+=a[int(i/2)]
        else:
            m+=b[int(i/2)]
        c.append(m)
    else:
        if i%2==0:
            m+=b[int(i/2)]
        else:
            m+=a[int(i/2)]
        c.append(m)
mc=0
try:
    if S[0]=='0':
        if 1+2*K-1 >len(c) -1:
            mc = 1
    else:
        if 1+2*K > len(c) -1:
            mc =1
    for i in range(1,len(c)):
        d=0
        if S[0]=='0':
            if i%2!=0:
                d=c[i+2*K-1] - c[i-1]
            else:
                d=c[i+2*K] - c[i-1]
        else:
            if i%2==0:
                d=c[i+2*K-1] - c[i-1]
            else:
                d=c[i+2*K] - c[i-1]
        if mc < d:
            mc = d
except:        
    print(mc)
else:
   
    print(mc)

Submission status: Runtime Error

Solution code:

but=list(map(int,input()))
but = sorted(but)
res = but[-1]
but = sorted(but)
res += but[-1]
print(res)

Submission status: Runtime Error

Solution code:

but=map(int,input())
but = sorted(but)
res = but[-1]
but = sorted(but)
res = but[-1]
print(res)

Submission status: Runtime Error

Solution code:
n = int(input())
height = list(map(int,input().split()))

no_ocean = 0

for i in range(1,n):
  for k in range(i):
    if height[k] > height[i]:
      	no_ocean += 1
      	break
    else:
        continue
        
print(n - no_ocean)

Submission status: Runtime Error

Solution code:
a,b = input().split()

if a >= b + 2:
  coins = 2 * a - 1
elif b + 2 >= a:
  coins = 2 * b - 1
else:
  coins = a + b
  
print(coins)

Submission status: Runtime Error

Solution code:
a,b = (int(i) for i in input().split()) 
if a == b:
  print(a + b):
else:
  s = max(a, b)
  print(s + s -1)

Submission status: Runtime Error

Solution code:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [a, b] = string_to_int(inputs[0])

    ret = 0
    if a > b:
        ret += a
        a -= 1
    else:
        ret += b
        b -= 1
    if a > b:
        ret += a
    else:
        ret += b

    return ret


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)

Submission status: Runtime Error

Solution code:
n = int(input())

L = input().split()

mountain = int(1)
for i in range(n):
    for j in range(i):
            if int(L[j]) > int(L[i]):
          			break
            else:
                    mountain += 1
print(mountain)

Submission status: Runtime Error

Solution code:
# using main() makes code faster from the point of view of "access to variables in global name-space"
# def main():

""" convenient functions
# for i, a in enumerate(iterable)
# q, mod = divmod(a, b)
# divmod(x, y) returns the tuple (x//y, x%y)
# manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f
"""

import sys
sys.setrecursionlimit(10**7)
from itertools import accumulate, combinations, permutations, product # https://docs.python.org/ja/3/library/itertools.html
# accumulate() returns iterator! to get list: list(accumulate())
from math import factorial, ceil, floor
def factorize(n):
    """return the factors of the Arg and count of each factor
    
    Args:
        n (long): number to be resolved into factors
    
    Returns:
        list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
    """
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
def combinations_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    # TODO: How should I do when n - r is negative?
    if n < 0 or r < 0:
        raise Exception('combinations_count(n, r) not defined when n or r is negative')
    if n - r < r: r = n - r
    if r < 0: return 0
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result
def combinations_with_replacement_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    if n < 0 or r < 0:
        raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
    elif n == 0:
        return 1
    else:
        return combinations_count(n + r - 1, r)
from bisect import bisect_left, bisect_right
from collections import deque, Counter, defaultdict # https://docs.python.org/ja/3/library/collections.html#collections.deque
from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html
from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html
from operator import itemgetter
# ex1: List.sort(key=itemgetter(1))
# ex2: sorted(tuples, key=itemgetter(1,2))
from functools import reduce
def chmin(x, y):
    """change minimum
    if x > y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current minimum value
        y (long): potential minimum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x > y:
        x = y
        return (x, True)
    else:
        return (x, False)
def chmax(x, y):
    """change maximum
    if x < y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current maximum value
        y (long): potential maximum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x < y:
        x = y
        return (x, True)
    else:
        return (x, False)

from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.
def gcds(numbers):
    return reduce(gcd, numbers)
def lcm(x, y):
    return (x * y) // gcd(x, y)
def lcms(numbers):
    return reduce(lcm, numbers, 1)

# first create factorial_list
# fac_list = mod_factorial_list(n)
INF = 10 ** 18
MOD = 10 ** 9 + 7
modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!
def modinv(a, p = MOD):
    # evaluate reciprocal using Fermat's little theorem:
    # a**(p-1) is identical to 1 (mod p) when a and p is coprime
    return modpow(a, p-2, p)
def modinv_list(n, p = MOD):
    if n <= 1:
        return [0,1][:n+1]
    else:
        inv_t = [0,1]
        for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
        return inv_t
def modfactorial_list(n, p = MOD):
    if n == 0:
        return [1]
    else:
        l = [0] * (n+1)
        tmp = 1
        for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
        return l
def modcomb(n, k, fac_list = [], p = MOD):
    # fac_list = modfactorial_list(100)
    # print(modcomb(100, 5, modfactorial_list(100)))
    from math import factorial
    if n < 0 or k < 0 or n < k: return 0
    if n == 0 or k == 0: return 1
    if len(fac_list) <= n:
        a = factorial(n) % p
        b = factorial(k) % p
        c = factorial(n-k) % p
    else:
        a = fac_list[n]
        b = fac_list[k]
        c = fac_list[n-k]
    return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
def modadd(a, b, p = MOD):
    return (a + b) % MOD
def modsub(a, b, p = MOD):
    return (a - b) % p
def modmul(a, b, p = MOD):
    return ((a % p) * (b % p)) % p
def moddiv(a, b, p = MOD):
    return modmul(a, modpow(b, p-2, p))

""" initialize variables and set inputs
# initialize variables
    # to initialize list, use [0] * n
    # to initialize two dimentional array, use [[0] * N for _ in range(N)]
# set inputs
    # open(0).read() is a convenient method:
    # ex) n, m, *x = map(int, open(0).read().split())
    #     min(x[::2]) - max(x[1::2])
    # ex2) *x, = map(int, open(0).read().split())
    #     don't forget to add comma after *x if only one variable is used
# preprocessing
    # transpose = [x for x in zip(*data)]
    # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
    # flat = [flatten for inner in data for flatten in inner]
    # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]
# calculate and output
    # output pattern
    # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6
"""

# functions used
r = lambda: sys.stdin.readline().strip()
r_int = lambda: int(r())
R = lambda: list(map(int, r().split()))
Rfloat = lambda: list(map(float, r().split()))
Rtuple = lambda: tuple(map(int, r().split()))
Rmap = lambda: map(int, r().split())

""" how to treat input
# single int: int(r())
# single string: r()
# single float: float(r())
# line int: R()
# line string: r().split()
# line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]
# lines int: [R() for _ in range(n)]
"""


# ----------------------------------
# main
A, B = R()
print(max(A+B,A+A-1,B+B-1)

# end of main
# ----------------------------------

"""memo: how to use defaultdict of list
# initialize
Dic = defaultdict(list)
# append / extend
Dic[x].append(y)
# for
for k, v in Dic.items():
"""

# if __name__ == '__main__':
#     main()

Submission status: Runtime Error

Solution code:
a,b=int(input()
print(max(a+b,a+a-1,b+b-1))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
print(max(a+b, 2*a-1, 2*b-1)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
if a!= b:print(2*(a+b -min(a,b))-1)
else:print(2a-1)

Submission status: Runtime Error

Solution code:
A, B = list(map(int, input().split()))
if A == B :
    print(2*A)
else :
    print(2*max(a, b)-1)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
print(max(2*a-1,2*b-1,a+b)

Submission status: Runtime Error

Solution code:
A = input()
B = input()
print(max(2 * int(A) - 1, 2 * int(B) - 1, int(A) + int(B)))

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
print(max(2A - 1, 2B - 1, A + B,))

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

if a >= b:
    tmp1 = a
    a -= 1
else:
    tmp2 = b
    b -= 1

if a >= b:
    tmp2 = a
else:
    tmp2 = b

print(tmp1 + tmp2)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
S=input()+"2"
_list=[]
if S[0]=="1":
    _list=[]
else:
    _list=[0]
cnt=1
for i in range(N):
    if S[i]==S[i+1]:
        cnt+=1
    else:
        _list.append(cnt)
        cnt=1
if S[-2]=="0":
    _list.append(0)
import itertools
__list=[0]+list(itertools.accumulate(_list))
C=len(__list)
K=min(C,K)
if C//2<=K:
    print(_list[0])
else:
    print(max([__list[2*i+2*K+1]-__list[2*i] for i in range((C+1)//2-K)]))

Submission status: Runtime Error

Solution code:
N = int(input())

print(180*(N-2))

Submission status: Runtime Error

Solution code:
def apply(a,b):
  if a>b:
	return a, a-1, b
  else:
    return b, a, b-1

if __name__ == '__main__':
  a,b = map(int,input().split())
  res = 0
  tmp, a, b = apply(a,b)
  res += tmp
  tmp, a, b = apply(a,b)
  res += tmp
  print(res)

Submission status: Runtime Error

Solution code:
n = int(input())
num_list = [ int(v) for v in input().split() ]
s = 0
for i in range(n):
	if max(num_list[:i+1]) <= num_list[i]:
		s += 1
print(s)

Submission status: Runtime Error

Solution code:
a = [int(i) for i in input().split("")]
if a[0] == a[1]:
    print(2 * a[0])
else:
    print(2 * max(a) - 1)

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split()) 

if A >= B+1 :
   print( '%d' % 2*A-1 )
elif B >= A+1 :
   print( '%d' % 2*B-1 )
else:
   print( '%d'% 2*A)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if a < b:
  swap(a, b)

if a - b >= 2:
  print(2 * a - 1)
else:
  print(a + b)

Submission status: Runtime Error

Solution code:
a,b=[int(i) for i in input().split()]
print(min([2*a-1,a+b,2*b-1])

Submission status: Runtime Error

Solution code:
a,b=[int(i) for i in input().split()]

print(min[2*a-1,a+b,2*b-1])

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())


if A > B:
    print(A + A - 1)

elif A == B:
    print(A + B)

else:
    print(B + B -1)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())


if A > B:
    print(A + A - 1)

elif A == B:
    print(A + B)

else:
    print(B + B -1)

Submission status: Runtime Error

Solution code:
A = int(input())
B =int(input())

if A > B:
    print(A + A - 1)

elif A == B:
    print(A + B)

else:
    print(B + B -1)

Submission status: Runtime Error

Solution code:
A = int(input("数字を入力してください:"))
B =int(input("数字を入力:"))

if A > B:
    print(A + A - 1)

elif A == B:
    print(A + B)

else:
    print(B + B -1)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

if abs(a-b) <= 1:
  print(a+b)
else print(max(a, b)*2-1)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
print(max(a+b, 2a-1, 2b-1))

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
print(max(a+b, 2a-1, 2b=1))

Submission status: Runtime Error

Solution code:
A,B= map(int,input().split())
coins = 0
while True range(2):
    if A > B :
        coins += A
    else:
        coins +=B
print(coins)

Submission status: Runtime Error

Solution code:
a,b = (int(x) for x in input().split())
if a == b:
  print(2*a)
elif else a < b:
  print(2*b - 1)
else:
  print(2*a - 1)

Submission status: Runtime Error

Solution code:
A = input()
B = input()
A = int(A)
B = int(B)
ans = 0

if A> B:
  ans = ans + A
else :
  ans = ans + B
  
if A> B:
  ans = ans + A
else :
  ans = ans + B
  
print(ans)

Submission status: Runtime Error

Solution code:
    a, b= [int(x) for x in input().split()]
    print(max(a+b, max(a+a-1, b+b-1)))

Submission status: Runtime Error

Solution code:
def sub():
    N, K = [int(e) for e in input().split(" ")]
    ss = [int(e) for e in input()]
    # if len(set(ss)) == 1:
    #     print(len(ss))
    #     return

    dd = [ss[i+1] - ss[i] for i in range(N-1)]
    idd = [0] + [i+1 for i, d in enumerate(dd) if d != 0]
    # print(idd)
    maxScore = 0
    for i in range(len(idd)):
        if ss[i] == 0:
            ni = i + 2*K
            if ni < len(idd):
                score = idd[ni] - idd[i]
            else:
                score = N - idd[i]
            if score > maxScore:
                maxScore = score
        else:
            ni = i + 2*K + 1
            if ni < len(idd):
                score = idd[ni] - idd[i]
            else:
                score = N - idd[i]
            if score > maxScore:
                maxScore = score
        
    print(maxScore)

sub()

Submission status: Runtime Error

Solution code:
S=input()
N=len(S)
list1=list(map(int,S))
ans1=0
for i in range(len(list1)):
    if i%2==0:
        if list1[i]==1:
            ans1+=1
    elif i%2==1:
        if list1[i]==0:
            ans1+=1
ans2=min(ans1,(N-ans1))
print(ans2)

Submission status: Runtime Error

Solution code:
N=int(input())
H=list(map(int,input().split()))
ans=0
for i in range(len(H)):
    if i==0:
        ans+=1
    elif max(H[0:i])<=H[i]:
        ans+=1
print(ans)