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:

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

if __name__ == '__main__':
    a, b = read_input()

    result = 0

    if a > b:
        result += a
        a -= 1
    else:
        result += b
        b -= 1

    if a > b:
        result += a
        a -= 1
    else:
        result += b
        b -= 1

    print(result)

Submission status: Accepted

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

Submission status: Accepted

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

if A == B:
    COINS=2*A
    
elif A > B:
    COINS=2*A-1

else:
    COINS=2*B-1

print(COINS)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
# スペース区切りの整数の入力
A, B = map(int, input().split())

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

print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

ans = [A, B]

sub_max = np.max(ans)
sub_min = np.min(ans)
sub = sub_max 
sub_max -= 1
    
ans = [sub_max, sub_min]
sub_max = np.max(ans)
sub = sub + sub_max
print(sub)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
c,d = (a-1,b-1)
lists = [a,b,c,d]
lists.sort(reverse=True)
print(sum(lists[0:2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = [int(s) for s in input().split()]

ma = max(n)
if n[0] == n[1]:
  print(2 * ma)
else:
  print(2 *ma - 1)

Submission status: Accepted

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

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

Submission status: Accepted

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


def calc_maximum_coins(A, B):
    if A > B:
        s, t, result = A - 1, B, A
    else:
        s, t, result = A, B - 1, B

    return result + max(s, t)


print(calc_maximum_coins(A, B))

Submission status: Accepted

Solution code:
import itertools
num = list(map(int, input().split()))
result = 0
tmp_1 = 0
tmp  =0
tmp_2 = 0
if num[0] == num[1]:
    tmp  = num[0] +  num[0]
else:
    tmp = num[0] + num[1]
    tmp_1 = num[0] + num[0] -1
    tmp_2 = num[1] + num[1] -1
print(max(tmp,tmp_1,tmp_2))

Submission status: Accepted

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

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

Submission status: Accepted

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

out=0

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

Submission status: Accepted

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

    gain = max(A, B)
    if A < B:
        B -= 1
    else:
        A -= 1
    gain += max(A, B)

    print(gain)

main()

Submission status: Accepted

Solution code:
from sys import stdin

l = stdin.readline().rstrip().split()
l_i = [int(s) for s in l]
l_i.sort()
a = l_i[1]
del l_i[1]
l_i.append(a-1)
l_i.sort()
c = l_i[1]
print(a + c)

Submission status: Accepted

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

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())

x1 = a + (a - 1)
x2 = b + (b - 1)
x3 = a + b

print(max((x1, x2, x3)))

Submission status: Accepted

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

Submission status: Accepted

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

print(Coin)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
coins = input().split()
A = int(coins[0])
B = int(coins[1])

cash = 0

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

print(cash)

Submission status: Accepted

Solution code:
import itertools
b = list(map(int, input().split()))
d = [sum(c) for c in itertools.combinations(b, 2)]
d.append(b[0] + b[0] - 1)
d.append(b[1] + b[1] - 1)
print(max(d))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math 

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())
if A>B:
    print(2*A-1) 
elif A<B:
    print(2*B-1)
else:
    print(2 * A)

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
k = 0
for r in range(2):
    if a[0] > a[1]:
        k += a[0]
        a[0] = a[0] - 1
    else:
        k += a[1]
        a[1] = a[1] - 1
print(k)

Submission status: Accepted

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

coin=0
if A<B:
    coin+=B
    coin+=B-1
elif A>B:
    coin+=A
    coin+=A-1
elif A==B:
    coin+=A
    coin+=B

print(coin)

Submission status: Accepted

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

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:
#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-

# abc124_a

# input
a, b = [int(s) for s in input().split()]
# output
if a==b:
    ans = a*2
else:
    ans = max(a, b)*2 - 1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

max = 0

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


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

print (max)

Submission status: Accepted

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

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

Submission status: Accepted

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

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(2*A)

Submission status: Accepted

Solution code:
A, B = map(int, raw_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())
if abs(a - b) <= 1:
    print(a + b)
else:
    if a > b:
        print(a + a -1)
    else:
        print(b + b -1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
i = 0
X = 0
if(A != B):
    while i <= 1: 
        X += max(A,B)
        i += 1
    print(X-1)
else:
    print(A + B)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a,b=input().split(" ")
a=int(a)
b=int(b)
if(a>b+1):
    print(a*2-1)
elif(b>a+1):
    print(b*2-1)
else:
    print(a+b)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, 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:
A, B = map(int,input().split())

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

Submission status: Accepted

Solution code:
list1 = []
list1 = list(map(int, input().split()))
ans = max(list1)
temp = min(list1)
if (ans-1) >temp:
    ans = ans + max(list1) - 1
else:
    ans = ans + min(list1)

print(ans)

Submission status: Accepted

Solution code:
in_a,in_b=map(int,input().split())

A=in_a
B=in_b

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

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:
print((lambda a:max(a)*2+(a.count(max(a))-2))(list(map(int,input().split()))))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 13 21:16:53 2019

@author: yuta
"""

AB = list(map(int,input().split()))

def main(ab):
    a = ab[0]
    b = ab[1]
    if a == b:
        print(2*a)
    else:
        max_ab = max(ab)
        print(2*max_ab-1)
main(AB)

Submission status: Accepted

Solution code:
a, b = input().split()
a = int(a)
b = int(b)
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:
def recur(ba,bb):
    tb = (2*bb)-1
    ta = (2*ba)-1
    bt = ba+bb
    return max(max(tb,ta),bt)

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

print(recur(a,b))

Submission status: Accepted

Solution code:
q=list(input().split())
a=int(q[0])
b=int(q[1])
for i in range(2):
  if a>=b:
    if i==0:
      r=a
    else:
      v=a
    a=a-1
  else:
    if i==0:
      r=b
    else:
      v=b
    b=b-1
g=int(r+v)
print(g)

Submission status: Accepted

Solution code:
AB=input().split()
A=int(AB[0]);B=int(AB[1])
list=[]
list.append(int(A+B))
list.append(int(A+A-1))
list.append(int(B+B-1))
print(max(list))

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,raw_input().split())
x=max(a,b)
y=min(a,b)
if x-y>1:
	print x+x-1
else:
	print x+y

Submission status: Accepted

Solution code:
a = [int(e) for e in input().split()]

if(a[0]<=a[1]):
    tmp=a[1]
    a[1]=a[1]-1
else:
    tmp=a[0]
    a[0]=a[0]-1

if(a[0]<=a[1]):
    tmp1=a[1]
    a[1]=a[1]-1
else:
    tmp1=a[0]
    a[0]=a[0]-1

print(tmp+tmp1)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

il = list(input().split())

X = int(il[0])
Y = int(il[1])

count = len(il)


ans = 0
for i in range(count):
    
    
    if X < Y:
        ans += Y
        if 0 < Y:
            Y -= 1
    else:
        ans += X
        if 0 < X:
            X -= 1
        
    
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

coin = 0
if A>B:
    coin+=A
    A-=1
else:
    coin+=B
    B-=1

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

print(coin)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar  1 19:29:34 2019

@author: nakamuratakayuki
"""
A,B = tuple(map(int, input().split()))

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

Submission status: Accepted

Solution code:
buttons = input().split(' ')
but1 = 0
but2 = 0
a = int(buttons[0])
b = int(buttons[1])

if a >= b:
    but2 = a - 1
else:
    but2 = b - 1


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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
w = input().split()
 
a = int(w[0])
b = int(w[1])
 
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(2*a-1)
elif a<b:
    print(2*b-1)
else:
    print(2*a)

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
ans = 0
a.sort(reverse = True)
ans += a[0]
a[0] -= 1
a.sort(reverse = True)
ans += a[0]
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:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
A, B = [int(x) for x in input().split()]
if A>B:
  ans = A + A-1
elif B>A:
  ans = B+B-1
else:
  ans = 2*A

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

buttons = [A,B]
max1 = max(buttons)
buttons[buttons.index(max1)] -= 1
max2 = max(buttons)

print(max1+max2)

Submission status: Accepted

Solution code:
l = []
l = [int(i) for i in input().split()] 
sum = 0

for i in range(2):
	if l[0] >= l[1]:
		sum = sum + l[0]
		l[0] = l[0] - 1
	else:
		sum = sum + l[1]
		l[1] = l[1] - 1

print(sum)

Submission status: Accepted

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

a = A+A-1
b = A+B
c = B+B-1
print(max(a,b,c))

Submission status: Accepted

Solution code:
def main():

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

    coin = 0

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

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

    print(coin)


main()

Submission status: Accepted

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

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


if __name__ == '__main__':
    A()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
a,b=map(int,input().split())
ans = max(a,b)
if a == b:
    print(a+b)
    sys.exit()

print(ans+(ans-1))

Submission status: Accepted

Solution code:
arr = input().split(" ")
A = int(arr[0])
B = int(arr[1])

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

Submission status: Accepted

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


sum_n=0;

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    A,B = map(int, lines.pop(0).split(' '))
    res = 0
    for i in range(2):
        if A > B:
            res += A
            A -= 1
        else:
            res += B
            B -= 1
    print(res)


lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Submission status: Accepted

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

ans = 0

for i in range(2):
  if B > A:
    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+A-1)
elif A == B: print(2*A)
else: print(B+B-1)

Submission status: Accepted

Solution code:
a, b = map(int, open(0).read().split())
if a < b:
  c = 2 * b - 1
  print(c)
elif a == b:
  c = 2 * a
  print(c)
else:
  c = 2 * a -1
  print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().split()
A = int(s[0])
B = int(s[1])
if 3 <= A and B <= 20:
    C = int(A + A - 1)
    D = int(A + B)
    F = int(B + B - 1)
    print(max([C,D,F]))

Submission status: Accepted

Solution code:
import numpy as np
a,b= map(int,input().split())
max_number = np.array([a+b,2*a-1,2*b-1]).max()
print(max_number)

Submission status: Accepted

Solution code:
total=0
A,B = map(int,input().split(" "))
if A>=B:
    tmp=B
    B=A
    A=tmp
total+=B
B=B-1
if A>=B:
    tmp=B
    B=A
    A=tmp
total+=B
print(total)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
# スペース区切りの整数の入力
a, b = map(int, input().split())

s = [a, b]
s = sorted(s)
sum = 0
sum += s[-1]
s[-1] -=1

s = sorted(s)
sum += s[-1]
# 出力
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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())
s=0
if a>b:
    s+=a
    a=a-1
else:
    s+=b
    b=b-1
if a>b:
    s+=a
else:
    s+=b
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

    big = a if a > b else b
    small = b if a >= b else a
    sum = 0
    for i in range(0, 2):
        sum += big
        big -= 1
        if big <= small:
            big = small

    print(sum)


if __name__ == '__main__':
	main()

Submission status: Accepted

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

count = max([A, B])
count += max([count-1, min(A, B)])
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B= map(int, input().split())
sum = 0
i=0
while i < 2:
    if A >= B:
        sum += A
        A -= 1
    else:
        sum+= B
        B -= 1
    i +=1

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

inp = input()

input_list = inp.split()

a = int(input_list[0])
b = int(input_list[1])

count = 0

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

print(count)

Submission status: Accepted

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

for i in [0, 1]:
    if a > b:
        x += a
        a -= 1
    else:
        x += b
        b -= 1

print(x)

Submission status: Accepted

Solution code:
inputs = input()
a = int(inputs.split(" ")[0])
b = int(inputs.split(" ")[1])
l = [a+b, a+a-1, b+b-1]
print(max(l))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = sorted(map(int, input().split()), reverse=True)
#降順

if num[0] == num[1]:
  print(sum(num))
else:
  print(num[0] + num[0] - 1)

Submission status: Accepted

Solution code:
a = list(map(int, input().split(' ')))
res = max(a)
a.remove(res)
a.append(res - 1)
res = res + max(a)
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
ans += max(X)
X.append(max(X) - 1)
X.remove(max(X))

ans += max(X)
print(ans)

Submission status: Accepted

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

if ab[0]  == ab[1]:
  print(ab[0]*2)
else:
  ab.sort()
  print(ab[1] + ab[1] - 1)

Submission status: Accepted

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

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

Submission status: Accepted

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

if a>b:
    total+=a
    a=a-1
elif a<=b:
    total+=b
    b=b-1
if a>b:
    total+=a
    a=a-1
elif a<=b:
    total+=b
    b=b-1

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

Solution code:
btns=input().split()
X=int(btns[0])
Y=int(btns[1])
Coins=0

for i in range(2):
    if X > Y:
        Coins+=X
        X -= 1
    else:
        Coins+=Y
        Y-=1

print(Coins)

Submission status: Accepted

Solution code:
def pushb(n):
    if n[0] > n[1]:
        ans = n[0]
        n[0] -= 1
    else :
        ans = n[1]
        n[1] -= 1
    return ans

nlist = input().split()
nlist = [int(i) for i in nlist]

ans = 0
ans += pushb(nlist)
ans += pushb(nlist)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

x=0

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

print(x)

Submission status: Accepted

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

if a>b:
    print(a*2-1)
elif b>a:
    print(b*2-1)
else:
    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:
ans = 0
ab = list(map(int,input().split()))

for i in range(2):
    if ab[0] > ab[1]:
        ans += ab[0]
        ab[0] -= 1
    elif ab[0] < ab[1]:
        ans += ab[1]
        ab[1] -= 1
    else:
        ans += ab[0]
        ab[0] -= 1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

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

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

else:
    print(B + B - 1)

Submission status: Accepted

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

c = 0
res = 0

while(c < 2):
    if(a > b):
        res += a
        a -= 1
    else:
        res += b
        b -= 1

    c += 1

print(res)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
 
ans = 0
c = max(a,b)
d = min(a,b)
ans += c
c -= 1
e = max(c,d)
f = min(a,b)
ans += e
 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ab = input().split()
ab[0] = int(ab[0])
ab[1] = int(ab[1])
coin = 0
for i in range(2):
  if ab[0] >= ab[1]:
    coin += ab[0]
    ab[0] = ab[0] - 1 
  else:
    coin += ab[1]
    ab[1] = ab[1] - 1 
print(coin)

Submission status: Accepted

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

num1 = max(A, B)
list = [A, A-1, B, B-1]
list.remove(num1)
num2 = max(list)

num = num1 + num2
print(num)

Submission status: Accepted

Solution code:
#!/usr/bin/python
# -*- Coding: utf-8 -*-

def main():
    buttons = raw_input()
    buttons = buttons.split()
    ans = 0
    cnt = 0
    A = int(buttons[0])
    B = int(buttons[1])
    while cnt < 2:
        if A > B:
            ans += A
            A = A - 1
        elif A < B:
            ans += B
            B = B - 1
        elif A == B:
            ans += A
            A = A - 1
        cnt += 1
    print(ans)
main()

Submission status: Accepted

Solution code:

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

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

print(ans)

Submission status: Accepted

Solution code:
A,B = input().split(' ')
A = int(A)
B = int(B)
score = 0

for i in range(2):
    if A >= B:
        score += A
        A -= 1
    elif A < B:
        score += B
        B -= 1

print(score)

Submission status: Accepted

Solution code:
def main():
  a,b=map(int, input().split())  #複数数値入力

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(answer)

Submission status: Accepted

Solution code:

def main():
	A,B = map(int,input().split())
	res = A if A >= B else B
	if res == A :
		A -= 1
	else :
		B -= 1
	res += A if A>=B else B
	print(res)

if __name__ == "__main__" :
	main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b = (int(i) for i in 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:
import collections as c
ip = lambda : map(int, input().split())

#################
x,y = ip()
print(max([x+x-1,x+y,y+y-1]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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