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: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

buttons = list(reversed(sorted(map(int, input().rstrip().split(" ")))))

ans = buttons[0]

buttons.append(buttons[0]-1)
buttons = list(reversed(sorted(buttons[1:])))

ans += buttons[0]

print(ans)

Submission status: Accepted

Solution code:
stdin = input().split(" ")
A = int(stdin[0])
B = int(stdin[1])
AA = BB = AB = 0

AA += A + A - 1
BB += B + B - 1
AB += A + B
sums = [AA,BB,AB]
print(max(sums))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

A,B = list(map(int, input().rstrip().split()))
#-----

cnt=0
for i in range(2):
  if A>=B:
    cnt += A
    A -= 1
  else:
    cnt += B
    B -= 1
  
print( cnt )

Submission status: Accepted

Solution code:
A, B = map(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: Accepted

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

A, B = map(int, input().split())
out = 0
if A > B:
    out += A
    A -= 1
else:
    out += B
    B -= 1
if A > B:
    out += A
    A -= 1
else:
    out += B
    B -= 1
print(out)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  a, b = map(int, input().split())
  print(sum(sorted([a, b, a-1, b-1])[-2:]))

if __name__=='__main__':
  main()

Submission status: Accepted

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

if A < B: A, B = B, A
ans = A + max(A-1, B)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if A != B:
  ans = max(A, B) * 2 - 1
  
else:
  ans = A * 2

print(ans)

Submission status: Accepted

Solution code:
from itertools import product
A, B = list(map(int, input().split()))
print(max(a+b for a, b in product([A, B-1], [B, A-1])))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def main():
    A, B = map(int, input().split())

    coin = 0
    for _ in range(2):
        if A < B:
            coin += B
            B -= 1
        else:
            coin += A
            A -= 1

    print(coin)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

coin = 0
for i in range(2):
  if a>=b:
    coin += a
    a-=1
  else:
    coin += b
    b-=1

print(coin)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()

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

Submission status: Accepted

Solution code:
x = input()
a = int(x.split(" ")[0])
b = int(x.split(" ")[1])
c = a + a - 1
d = a + b
e = b + b - 1
print(max([c,d,e]))

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

for i in range(2):
    if A == max(A,B):
        ans += A
        A -= 1
    else:
        ans += B
        B -= 1
        
print(ans)

Submission status: Accepted

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

print(max(a+b, 2*a-1, 2*b-1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ab = sorted(list(map(int, input().split())))
ans = ab[1] + max(ab[0], ab[1]-1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
ans=0
for i in range(2):
  if A>=B:
    ans+=A
    A-=1
  else:
    ans+=B
    B-=1
print(ans)

Submission status: Accepted

Solution code:
import sys

inputs = [row.split() for row in sys.stdin.readlines()]

values = []
for current_row in inputs:
    for value in current_row:
        values.append(int(value))

if values[1] < values[0]:
    val_1 = values[0]
    values[0]=values[0]-1
else:
    val_1 = values[1]
    values[1]=values[1]-1

if values[1] < values[0]:
    val_2 = values[0]
else:
    val_2 = values[1]

print(val_1+val_2)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if A<B:
    ans += B
    B -= 1
else:
    ans += A
    A -= 1

if A<B:
    ans += B
    B -= 1
else:
    ans += A
    A -= 1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
sum=0
sum+=max(A,B)
sum+=max(A-1,B-1,min(A,B))
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

while cnt < 2:
	if A > B:
		sum += A
		A -= 1
		cnt += 1
	else:
		sum += B
		B -= 1
		cnt += 1

print(sum)

Submission status: Accepted

Solution code:
c = list(map(int, input().split()))
c.sort()
ans = 0
ans += c[1]
c[1] -= 1
c.sort()
ans += c[1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc124/tasks/abc124_a

n = [int(x) for x in input().split()]
if len(set(n)) == 1:
    print(max(n) * 2)
else:
    print(max(n) * 2 - 1)

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
if max(h,w) >= min(h,w)+2:
    print(max(h,w) + max(h,w) - 1)
else:
    print(h+w)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

list_1 = sorted([A,B],reverse=True)
ans += list_1[0]
list_2 = sorted([ans-1,list_1[1]],reverse=True)
ans += list_2[0]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
ans = 0
for _ in range(2):
    if A>=B:
        ans+=A
        A-=1
    else:
        ans+=B
        B-=1
print(ans)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
if a>b: print(a+a-1)
elif a<b: print(b+b-1)
else: print(a+b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = sys.stdin.readline

def eprint(s):
    if type(s) != type('str'):
        s=str(s)

    sys.stderr.write(s+'\n')
    return

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

    cnt = 0
    if a > b:
        cnt += a
        a -= 1
    else:
        cnt += b
        b -= 1
    if a > b:
        cnt += a
        a -= 1
    else:
        cnt += b
        b -= 1
    print(cnt)
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

for _ in range(2):
    if a >= b:
        ans += a
        a -= 1
    else:
        ans += b
        b -= 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

    ans = 0

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if min < max:
    print(2*max-1)
else:
    print(2*max)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B = map(int, input().split())
    print(max(A, B) * 2 if A == B else max(A, B) * 2 - 1)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if A == B:
    print(A+B)
else:
    max = max(A, B)
    ans = max + (max - 1)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = list(map(int, input().split()))
h = [2*A-1, 2*B-1, A+B]
maxvalue = 0
for i in range(len(h)):
    if h[i] >= maxvalue:
        maxvalue = h[i]
print(maxvalue)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())

sys.setrecursionlimit(10 ** 9)


def main():
    A, B = MAP()
      
    print(A*2 if A == B else max(A, B)*2 - 1)
    

if __name__ == '__main__':    
    main()

Submission status: Accepted

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

coin = 0
coin += a
a -= 1

if a >= b:
    coin += a
else:
    coin += b

print(coin)

Submission status: Accepted

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

print(max(a + (a - 1), b + (b - 1), a + b))

Submission status: Accepted

Solution code:
val = list(map(int, input().split()))
val.sort()
cnt = 0
for i in range(2):
    cnt += val[1]
    val[1] -= 1
    val.sort()
print(cnt)

Submission status: Accepted

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

ans = 0
for i in range(2):
  if a > b:
    ans += a
    a -= 1
  else:
    ans += b
    b -= 1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    A, B = map(int, input().split())

    ans = 0
    for i in range(2):
        if A > B:
            ans += A
            A -= 1
        else:
            ans += B
            B -= 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

one = max(A, B)
if one == A:
    two = max(A-1, B)
else:
    two = max(A, B-1)
print(one + two)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x = [A + A - 1, B + B - 1, A + B]

print(max(x))

Submission status: Accepted

Solution code:
a, b = map(int, open(0).read().split())

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

Submission status: Accepted

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

ans = 0
for _ in range(2):
    if A > B:
        ans += A
        A -= 1
    else:
        ans += B
        B -= 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

a, b = na()
print(max(a * 2 - 1, b * 2 - 1, a + b))

Submission status: Accepted

Solution code:
A,B=map(int, input().split())
n=0
for i in range(2):
  if A>=B:
    n+=A
    A-=1
  else:
    n+=B
    B-=1
print(n)

Submission status: Accepted

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


if A<B:
    print(2*B-1)
elif A>B:
    print(2*A-1)
else:
    print(2*A)

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if A==B:
    print(A+B)
else:
    print(max(A,B)*2 - 1)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
if A == B:
    print(A + B)
else:
    maxAB = max(A, B)
    print(maxAB + maxAB -1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A=sorted(map(int,input().split()))
print( A[1]*2-1 if A[1]+A[0] <= A[1]*2-1 else A[1]+A[0] )

Submission status: Accepted

Solution code:
import sys
import fractions
import math
import itertools

a,b=list(map(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: Accepted

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

Submission status: Accepted

Solution code:
import sys

a, b = map(int, sys.stdin.readline().split())
if a > b: a, b = b, a

def main():
    return b * 2 if a == b else b * 2 - 1

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

Submission status: Accepted

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

if A >= B:
  ans = A
  A -= 1
else:
  ans = B
  B -= 1

ans += max(A, B)
print(ans)

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
 
ans = 0
for i in range(2):
    if A >= B:
        ans += A
        A -= 1
    else:
        ans += B
        B -= 1
 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

lst = [A, A-1, B, B-1]
lst.sort(reverse = True)
print(sum(lst[:2]))

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

ans += max(A,B)

if A>B:
    A -= 1
else:
    B -= 1

ans += max(A,B)

print(ans)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if a > b:
    n =a+(a-1)
elif b > a:
    n = b+(b-1)
else:
    n = a+b

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

if A < B:
    print(2 * B - 1)
elif A > B:
    print(2 * A - 1)
else:
    print(A + B)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8 
#Author:Code

a, b= map(int, raw_input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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:
        ans += b
        b -= 1
    num += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = max(A + max(A-1, B), B + max(A, B-1))

print(ans)

Submission status: Accepted

Solution code:
n, m=[int(k) for k in input().split()]
cont=0
for i in range(2):
    if n>m: 
        cont+=n
        n-=1
    elif m>=n:
        cont+=m
        m-=1
print(cont)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
c=0
if(a>b):
    c+=a
    a-=1
else:
    c+=b
    b-=1
 
if(a>b):
    c+=a
    a-=1
else:
    c+=b
    b-=1
 
print(c)

Submission status: Accepted

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

count = 0
for i in range(2):
  if a > b:
    count += a
    a -= 1
  else:
    count += b
    b -= 1
print(count)

Submission status: Accepted

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

    res = 0
    for i in range(2):
        if a > b:
            res += a
            a -= 1
        else:
            res += b
            b -= 1
    print(res)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

if A == B:
  r = A*2
else:
  r = max(A,B)*2 -1

print(r)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
score = sorted([a,b,a-1,b-1],reverse=True)
print(score[0]+score[1])

Submission status: Accepted

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

print(max(2*a-1, 2*b-1, a+b))

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 12, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

print(max(A + B, 2 * A - 1, 2 * B - 1))

Submission status: Accepted

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

total = 0

if a > b:
    total = 2 * a - 1
elif b > a:
    total = 2 * b - 1
else:
    total = 2 * a

print(total)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
val = 0
for _ in range(2):
    if a < b:
        val += b
        b -= 1
    elif a>=b:
        val += a
        a -= 1
print(val)

Submission status: Accepted

Solution code:
def main():
    A, B = map(int, input().split(" "))
    L = []
    L.append(A)
    L.append(B)
    L.append(A - 1)
    L.append(B - 1)
    L.sort(reverse=True)
    print(L[0] + L[1])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

result = 0

for i in range(2):
  if a <= b:
    result+=b
    b = b-1
  else:
    result+=a
    a = a-1

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os, sys, re, math

(A, B) = [int(n) for n in input().split()]

coins = max(A, B) * 2
print(coins if A == B else coins - 1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = [int(s) for s in input().split(' ')]

print(max(A+B,A+A-1,B+B-1))

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

for _ in range(2):
  if A >= B:
    ans += A
    A -= 1
  else:
    ans += B
    B -= 1
    
print(ans)

Submission status: Accepted

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

ans = [2*a-1,a+b,2*b-1]

print(max(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
  if 'get_ipython' not in globals():  
    a,b = map(int,input().split())
  else:
    a,b = 5,3
    s = "test"
 
  # 以下にコード本体を書く
  def get(a,b, count, ans):
    if count == 0:
      return(ans)
    
    if a >= b:
      return(get(a-1, b, count -1, ans + a))
    else:
      return(get(a, b-1, count -1, ans + b))
  
  print(get(a, b, 2, 0))
  
main()

Submission status: Accepted

Solution code:
#ABC-124-A
A, B = map(int, input().split())

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

Submission status: Accepted

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

coin = 0
for i in range(2):
   if (a >= b):
      coin += a
      a -= 1
   else:
      coin += b
      b -= 1

print(coin)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=sorted(map(int, input().split()))
nn=sorted([n[0],n[1]-1])
print(n[1]+nn[1])

Submission status: Accepted

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

print(max(A+B, 2*A-1, 2*B-1))

Submission status: Accepted

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

if A > B:
    sum += A
    A = A-1
else:
    sum += B
    B = B-1

if A > B:
    sum += A
else:
    sum += B

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B = map(int, open(0).read().split())

if A > B:
    print(A*2-1)
elif A < B:
    print(B*2-1)
else:
    print(A+B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
sum=0
for _ in range(2):
  sum += max(a,b)
  if a > b:
    a -= 1
  elif a < b:
    b -= 1
print(sum)

Submission status: Accepted

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

print(max(2 * a - 1, 2 * b - 1, a + b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if a>=b:
        c=a-1
        d=b
    else:
        c=b-1
        d=a
    print(max(a,b)+max(c,d))
if __name__ == '__main__':
    do()

Submission status: Accepted

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