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:
inf = float("inf")

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def input_int():return int(input())
def input_ints():return map(int,input().split())
def input_ints_list():return list(input_ints())
def input_str():return input()
def input_strs():return input().split()
def input_lines(n,f):return [f() for _ in range(n)]

import importlib
def import_module(name):return importlib.import_module(name)

def gcd_base(a,b):return import_module('fractions').gcd(a,b) # 最大公約数（2値)
def gcd(a):return import_module('functools').reduce(gcd_base,a) # 最大公約数（リスト）
def lcm_base(a,b):return (a*b)//gcd_base(a,b) # 最小公倍数(2値)
def lcm(a):return import_module('functools').reduce(lcm_base,a,1) # 最小公倍数(リスト)

def permutations(a,n):return import_module('itertools').permutations(a,n) # 順列
def combinations(a,n):return import_module('itertools').combinations(a,n) # 組み合わせ
def product(a,b):return import_module('itertools').product(a,b) # 二つのリストの直積

def init_array_1dim(v,n):return [v]*n
def init_array_2dim(v,n,m):return [init_array_1dim for _ in range(m)]

# 四捨五入はround
def ceil(a):return import_module('math').ceil(a) # 切り上げ
def floor(a):return import_module('math').floor(a) # 切り捨て

# キュー
def init_q(a):return import_module('collections').deque(a)
def q_pop(a):return a.popleft()
def q_push(a,v):a.appendleft(v)
def q_pushlist(a,l):a.extendleft(l)
def q_append(a,v):a.append(v)
def q_appendlist(a,l):a.extend(l)

# プライオリティキュー
def init_heap(a):import_module('heapq').heapify(a)
def heap_push(a,v):import_module('heapq').heappush(a,v)
def heap_pop(a):return import_module('heapq').heappop(a) # 最小値を取り出す

# 二分探索
def bisect_left(a,x):return import_module('bisect').bisect_left(a,x)
def bisect_right(a,x):return import_module('bisect').bisect_left(a,x)
def insert_left(a,x):return import_module('bisect').insert_left(a,bisect_left(a,x))
def insert_right(a,x):return import_module('bisect').insert_right(a,bisect_right(a,x))

# 累積和、累積積、累積GCD
def cumsum(a):return import_module('numpy').cumsum(import_module('numpy').array(a)) # 累積和
def cumprod(a):return import_module('numpy').cumprod(import_module('numpy').array(a)) # 累積積
def cumgcd(a):return import_module('numpy').frompyfunc(gcd_base, 2, 1).accumulate(a, dtype=import_module('numpy').object).astype(import_module('numpy').int) # 累積GCD

class UnionFind(object):
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        x = self.find(x)
        return self.size[x]

def dfs(pos):
    ret = 0
    l = []
    for e in l:
        next = e
        ret += dfs(next)
    return ret

def bfs(l):
    q = init_q(l)
    pos = 0
    q_push(q,pos)
    while q:
        now = q_pop(q)
        for e in l:
            next = e
            q_append(q,next)

# ワーシャルフロイド（グラフの要素数、グラフ）
def warshall_floyd(n,graph):
    d = init_array_2dim(float("inf"),n,n)
    # 初期化
    for i in range(n):
        d[i][i] = 0
        for j in range(n):
            if graph[i][j]:d[i][j] = 1
    # 距離算出
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフを初期化（グラフの要素数、グラフの線の両端、有向無向）
def init_graph(n,a,directed=False):
    visited = init_array_1dim(False,n)
    graph = init_array_2dim(False,n,n)
    for e in a:
        graph[e[0]-1][e[1]-1] = True
        if not directed:graph[e[1]-1][e[0]-1] = True # 無向グラフの場合
    return visited,graph

def two_pointers(s,threshold,ope='sum'):
    l,r = 0,0
    base = 0 
    if ope == 'sum':base = 0
    if ope == 'prd':base = 1
    diff = 0
    while r < len(s):
        val = 0
        if ope == 'sum':val = base+s[r]
        if ope == 'prd':val = base*s[r]
        if val <= threshold:
            if ope == 'sum':base += s[r]
            if ope == 'prd':base *= s[r]
            diff = max(diff, r-l+1)
            r += 1
        elif l == r:
            r += 1
            l += 1
        else:
            if ope == 'sum':base -= s[l]
            if ope == 'prd':base //= s[l]
            l += 1
    return diff

# ここに実装
def solution():
    A,B = input_ints()
    if A == B:
        print(A+B)
    if A < B:
        print(B+B-1)
    if B < A:
        print(A+A-1)
	
if __name__ == '__main__':
    solution()

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 = list(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:
    ans = a + b
else:
    ans = max(a,b) + max(a,b) - 1
print(ans)

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:
#!/usr/bin/env python3


def main():
    a, b = map(int, 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())
if a>b:
  ans = 2*a-1
elif a==b:
  ans = 2*a
else:
  ans = 2*b-1
  
print(ans)

Submission status: Accepted

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

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

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

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())
print(2*max(A,B) if A==B else 2*max(A,B)-1)

Submission status: Accepted

Solution code:
str = input()

total_coins = 0
numbers = str.split(" ")
a = int(numbers[0])
b = int(numbers[1])

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

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

print(total_coins)

Submission status: Accepted

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

if a < b:
  a, b = b, a

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

Submission status: Accepted

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

nums = [A + (A - 1), B + (B - 1), A + B]

max = 0
for i in range(0,3):
    if max < nums[i]:
        max = nums[i]

print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

a,b = [int(i) for i in input().split()]
ans = 0
if a > b:
    ans = ans + a
    a = a - 1
else:
    ans = ans + b
    b = b - 1
if a > b:
    ans = ans + a
else:
    ans = ans + b
print(ans)

Submission status: Accepted

Solution code:
A,B = (int(j) for j in input().split())
C = max([2*A -1,A+B,2*B-1])
print(C)

Submission status: Accepted

Solution code:
import sys
a, b = map(int,sys.stdin.readline().split())
total = 0
if a == b:
  total = a + b
else:
  select_btn = max(a, b)
  total = select_btn*2-1
print(total)

Submission status: Accepted

Solution code:
import sys
import numpy as np
arr = [int(i) for i in sys.stdin.readline().split()]
total = 0
select_botton = np.argmax(arr)
for i in range(2):
  total += arr[select_botton]
  arr[select_botton] = arr[select_botton]-1
  select_botton = np.argmax(arr)
print(total)

Submission status: Accepted

Solution code:
n = input().split(' ')

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

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

Submission status: Accepted

Solution code:
a, b = [int(x) for x in input().split()]
sum = 0
if a > b:
    sum += a
    a = a - 1
else:
    sum += b
    b = b - 1

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

Submission status: Accepted

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

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:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

Submission status: Accepted

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

if X>Y:
    print(X*2-1)
elif X<Y:
    print(Y*2-1)
else:
    print(X*2)

Submission status: Accepted

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

while tmp<2:
  if A > B:
    cnt+=A
    A-=1
    tmp+=1
  elif A < B:
    cnt+=B
    B-=1
    tmp+=1
  else:
    cnt+=A
    A-=1
    tmp+=1
print(cnt)

Submission status: Accepted

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

if A > B:
    big = A
    small = B
elif B > A:
    big = B
    small = A
else:
    big = A
    small = B

if big - small >= 1:
    ans = big*2-1
    print(ans)
else:
    ans = big*2
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b = [int(it) for it in 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:
p, q = map(int, input().split())

if abs(p - q) >= 1:
  score = max(p, q) * 2 - 1
else:
  score = max(p, q) * 2
print(score)

Submission status: Accepted

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

x = 0
for _ in range(2):
    a.sort(reverse=True)
    x += a[0]
    a[0] -= 1

print(x)

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

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

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

    print(ans)

    return

if __name__ == '__main__' :
    main()

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

Submission status: Accepted

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

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())
ans = 0
for i in range(2):
  if a < b:
    ans += b
    b -= 1
  else:
    ans += a
    a -= 1
print(ans)

Submission status: Accepted

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

a = ab[0]
b = ab[1]

ans = 0

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

if a == b:
  ans = a*2

print(ans)

Submission status: Accepted

Solution code:
A,B=(int(x) for x in input().split())
coin=0
for i in range(0,2):
    pre=max(A,B)
    coin+=pre
    if(pre==A):
        A-=1
    else:
        B-=1
print(coin)

Submission status: Accepted

Solution code:
AB = list(map(int, input().split()))
AB.sort(reverse=True)
#print(AB)
if AB[0] == AB[1]:
  print(AB[0] + AB[1])
else:
  print(AB[0] + AB[0] - 1)

Submission status: Accepted

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

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

c1=max(a,b)
c2=min(a,b)
c3=max(c1-1,c2)
print(c1 + c3)

Submission status: Accepted

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

ans = 0
if tmp[0] == tmp[1]:
    ans = tmp[0]*2
else:
    ans = max(tmp)+max(tmp)-1

print(ans)

Submission status: Accepted

Solution code:
a,b = list(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:
A,B=list(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:
    m = max(a, b)
    print(m + (m-1))
else:
    print(a * 2)

Submission status: Accepted

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

x = 0
for i in range(2) :
    c = max(a,b)
    if c == a :
        x += a 
        a = a - 1
    else : 
        x += b
        b = b -1

print(x)

Submission status: Accepted

Solution code:
A, B = [int(x) for x in input().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 = [int(a) for a in input().split()]
print(2*A if A==B else 2*max(A, B)-1)

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:
buttons = [int(i) for i in input().split()]
tries = 2
score = 0
for i in range(tries):
    bigger = max(buttons)
    score += bigger
    buttons[buttons.index(bigger)] -= 1
print(score)

Submission status: Accepted

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

if i == j:
  print (i + j)
else:
  print (max(i, j) * 2 - 1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

data = [int(x) for x in stdin.readline().rstrip().split()]

ans = 0

if data[0] == data[1]:
    ans = data[0] * 2
else:
    ans = max(data) * 2 - 1

print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8

def main():
    a, b = map(int, input().split())
    c = []
    for i in range(2):
        if a > b or a == b:
            c.append(a)
            a = a - 1
        elif b > a:
            c.append(b)
            b = b - 1

    print(sum(c))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(sums)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
ABlist=n.split()
A=int(ABlist[0])
B=int(ABlist[1])
if A>B:
    ans=A+A-1
elif A==B:
    ans=A+B
else:
    ans=B+B-1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

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

x = 0

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

print(x)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

a0 = a
a1 = a-1

b0 = b
b1 = b-1

l = [a0, a1, b0, b1]

l.sort(reverse=True)

#print(l[:2])

ans = l[0]+l[1]

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

# max(a,b)
if a > b:
    print(a+a-1)
elif b > a:
    print(b+b-1)
else:
    print(a+b)

Submission status: Accepted

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

if x>y:
    print(x+x-1)
elif x==y:
    print(x+y)
else:
    print(y+y-1)

Submission status: Accepted

Solution code:
a_b = sorted(list(map(int, input().split())))
coin = a_b[1]
a_b[1] -= 1
if a_b[0] < coin:
  coin += a_b[1]
else:
  coin += a_b[0]
print(coin)

Submission status: Accepted

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

#AとBの絶対値を求める
y=A-B

if abs(y)>1 and A>B:
    z=A*2-1
elif abs(y)>1 and A<B:
    z=B*2-1
elif A==B:
    z=A+B
elif abs(y)==1:
    z=A+B
else:
    'N/A'

print(z)

Submission status: Accepted

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

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

a1 = A
a2 = A-1
b1 = B
b2 = B-1

li = [a1, a2, b1, b2]
s = sorted(li, reverse=True)
print(s[0]+s[1])

Submission status: Accepted

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

# solve
ans = max(2*a-1, 2*b-1, a+b) 
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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=input().split()
A=[int(i) for i in A]
cnt=0
sum=0
while cnt<2:
    if A[0]<A[1]:
        sum+=A[1]
        A[1]-=1
    else:
        sum+=A[0]
        A[0]-=1
    cnt+=1
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
print(max(a+b,2*max(a,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())
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:
#!/usr/bin/env python
a = input()
a = [int(i) for i in a.split()]
ret = 0
ret += max(a)
if a[0] >= a[1]:
    a[0] -= 1
else:
    a[1] -= 1
ret += max(a)
print(ret)

Submission status: Accepted

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

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:
a, b = map(int, input().split())

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

Submission status: Accepted

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

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())
i=(A+A-1,A+B,B+B-1)
print(max(i))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ans = 0
A,B = map(int,input().split())
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,2*a-1,2*b-1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 124
# https://atcoder.jp/contests/abc124
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def calc(A, B):
    if A > B:
        return A + (A - 1)
    if A < B:
        return B + (B - 1)
    return A + B

def main(A, B):
    print(calc(A, B))

A, B = i2nn()
main(A, B)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B, = map(int,input().split())
coin = 0
count = 1

while count <= 2:
    if A>=B:
        coin += A
        A -=1

    else:
        coin += B
        B -= 1

    count += 1

print(coin)

Submission status: Accepted

Solution code:
n = list(map(int, input().split()))
a = n[0]
b = n[1]

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

Submission status: Accepted

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

def push(a,b):
    if a>=b:
        return a-1,b,a
    else:
        return a,b-1,b

a,b,t=push(a,b)
print(t+push(a,b)[2])

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if a[0]>a[1]:
  X+=a[0]
  a[0]-=1
else:
  X+=a[1]
  a[1]-=1

print(X)

Submission status: Accepted

Solution code:
import sys
import math

sys.setrecursionlimit(10000)
INF = float('inf')


def inp():
    return int(input())


def inl():
    return list(map(int, input().split()))


def inls():
    return input().split()


def Yesif(cond):
    print('Yes' if cond else 'No')


def YESIF(cond):
    print('YES' if cond else 'NO')


def yesif(cond):
    print('yes' if cond else 'no')


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

Submission status: Accepted

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

Submission status: Accepted

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

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(b+b-1)
elif a == b:
    print(a+b)
else:
    print(a+a-1)

Submission status: Accepted

Solution code:


if __name__ == "__main__":
    a,b = map(int, input().split())
    res = max(a, b)
    if (a > b):
        a -= 1
    else:
        b -= 1
    res += max(a,b)
    print(res)

Submission status: Accepted

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

Submission status: Accepted

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

print(max(max(a + b, a + a-1), 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())
list = [2*A - 1, 2*B - 1, A + B]
print(max(list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    a, b = get_li()
    print(max(a + a - 1, a + b, b + b - 1))
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    str_buttons = input().split()
    buttons = [int(str_buttons[0]), int(str_buttons[1])]

    answer = 0
    for i in range(2):
        answer += max(buttons)
        bi = buttons.index(max(buttons))
        buttons[bi] -= 1

    print(answer)

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:
a,b=map(int,input().split())
#a,b=(input().split())
c=max(a,b)
d=min(a,b)
if  c>d:
    print(2*c-1)

else:
    print(c+d)

Submission status: Accepted

Solution code:
arr = list(map(int,input().split(" ")))
a = arr[0]
b = arr[1]

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

Submission status: Accepted

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