Problem:


Score : 100 points

Problem Statement

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

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

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

At most how many coins can you get?

Constraints

All values in input are integers.

3 \leq A, B \leq 20

Input

Input is given from Standard Input in the following format:

A B

Output

Print the maximum number of coins you can get.

Sample Input 1

5 3

Sample Output 1

9

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

Sample Input 2

3 4

Sample Output 2

7

Sample Input 3

6 6

Sample Output 3

12



Sample input:
5 3


Sample output:
9

Submission status: Runtime Error

Solution code:
ipt=input()
lst=ipt.split()
A=lst[0]
B=lst[1]
if A>=B and A-1>=B:
    print(A+A-1)
elif A>=B and A-1<B:
    print(A+B)
elif A<B and A<B-1:
    print(B+B-1)
else:
    print(A+B)

Submission status: Runtime Error

Solution code:
a=A
b=B
if a>=b and a-1>=b:
	print(a+a-1)
elif a>=b and a-1<b:
	print(a+b)
elif a<b and a<b-1:
	print(b+b-1)
else:
	print(a+b)

Submission status: Runtime Error

Solution code:
if A>=B and A-1>=B:
	print(A+A-1)
elif A>=B and A-1<B:
	print(A+B)
elif A<B and A<B-1:
	print(B+B-1)
else:
	print(A+B)

Submission status: Runtime Error

Solution code:
if A>=B and A-1>=B:
  print(A+A-1)
 	elif A>=B and A-1<B:
      print(A+B)
  	elif A<B and A<B-1:
      print(B+B-1)
    else:
      print(A+B)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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: Runtime Error

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

a = 0
b = 1
ans = 1

for i in range(n.length-2):
    if n[a]<n[b]:
        ans += 1
    a += 1
    b += 1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B=[int(e) for e in input()]
print(max([A+A-1,A+B,B+B-1]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
s = [int(x) for x in list(input())]

state = 1
cnt = 0
l = []
for i in s:
    if i == state:
        cnt += 1
    else:
        l.append(cnt)
        cnt = 1
        state = i
l = [x for x in l if x >0]
if len(l) % 2 == 1:
    l.append(0)

Add = 2 * k + 1
ruiseki = [0]

for i, e in enumerate(l):
    ruiseki.append(ruiseki[i] + l[i])

answer = 0
for i in range(0, len(l), 2):
    left = i
    right = min(i + Add, len(l))
    tmp = ruiseki[right] - ruiseki[left]
    answer = max(tmp, answer)
 
print(answer)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
S = input()
if S[0] == '0':
  divide = []
else:
  divide = [0]
tmp = 1
for i in range(1,N):
  if S[i] == S[i-1]:
    tmp += 1
  else:
    divide += [tmp]
    tmp = 1
divide += [tmp]
le = len(divide)
zero = [0]*2*le + divide + [0]*2*le
su = [0]
for i in range(0,5*le):
  su += [su[-1]+zero[i]]
del su[0]
lle = len(su)
mxm = 0
for k in range(K,lle):
  if 2*k+1 >= lle:
    break
  cd = su[2*k+1] - su[2*k-2*K]
  if cd > mxm:
    mxm = cd
print(mxm)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

def main():
    a=int(input())
    b=int(input())
    c=max(a,b)
    print(c+(c-1))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
AB = int(input().split())
A,B=AB[0], AB[1]
if max(A,B)-min(A,B) >= 1:
  print(2*max(A,B)-1)
else:
  print(A+B)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
count = 0

if a > b:
  count = a
  a = a - 1
  if a > b or a == b:
    count = count + a
elif b > a:
  count = b
  b = b - 1
  if b > a or a == b:
    count = count + b
else:
  count = a
  count = count + b

print(count)

Submission status: Runtime Error

Solution code:
class CreateList:
    def __init__(self, flg, cnt):
        self.flg = flg
        self.cnt = cnt
        
        

def main():
    
    n, k = map(int, input().split())
    s = list(map(int, input()))
    
    slist = []      #Sを使いやすいように加工した配列
    bkflg = s[0]    #一つ前の連続する値が「1」か「0」かを持ってるやつ
    scnt = 0        #「1」「0」の連続する数
    ecnt = 0        #終了判定のカウンター
    
    #配列作成
    for i in s:
        ecnt += 1
        
        #同じ数字が続く場合はカウントアップ
        if i == bkflg:
           scnt += 1
        
        #数字が変わったら配列にこれまでの合計数を入れてカウンターを初期化
        else:
            slist.append(CreateList(bkflg, scnt))
            scnt = 1
            bkflg = i
        
        #最後の1回が拾えないのでここで強引に配列に突っ込む
        if ecnt == len(s):
            slist.append(CreateList(bkflg, scnt))
    
    #本ちゃんで使う勇者たち
    maxsum = 0      #最大合計値の変数
    skipcnt = k     #連続する「0」を「1」としてカウント出来る回数
    cursor = 0      #Sの配列変数の開始位置
    cursorsum = 0   #一時的な「1」の合計数
    tmpcnt = 0      #一時的なカーソル位置
    
    #本ちゃんスタート
    while tmpcnt <= len(slist) - 1:
        #Sの配列を左からスライドしながら数字を拾ってくので、最初にカウンターとカーソル位置を初期化
        tmpcnt = cursor
        skipcnt = k
        cursorsum = 0
        
        #ここで「1」の合計をSの配列の左からスライドさせながらカウントしていく
        while tmpcnt <= len(slist) - 1:
            if slist[tmpcnt].flg == 0:
                if skipcnt == 0:
                    break
                else:
                    skipcnt -= 1
            
            cursorsum = cursorsum + slist[tmpcnt].cnt
            tmpcnt += 1
        
        #これまでの最大合計数を拾う
        if maxsum < cursorsum:
            maxsum = cursorsum
        
        cursor += 1
        
    print(maxsum)
    
    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
print(max(max(a,b)-1,min(a,b))+e)

Submission status: Runtime Error

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
h = [int(x) for x in stdin.readline().rstrip().split()]
ans = 1
tmp = h[0]
for i in range(n - 1):
    ans += 1 if tmp <= h[i + 1] else 0
    tmp = max(tmp, h[i + 1])
print("{}".format(ans))

Submission status: Runtime Error

Solution code:
q, k = list(map(int, input().split()))
list = [int(i) for i in input()]

# 0 ,1 のまとまりを作る
sum01 = []
pre = 1
cnt = 0
# 111010
# 001010
for i, e in enumerate(list):
    if e != pre:
        sum01.append(cnt)
        cnt = 1
        pre = e
    else:
        cnt += 1
if cnt != 0:
    sum01.append(cnt)

if len(sum01) % 2 == 1:
    sum01.append(0)

# print(sum01)
Add = 2 * k + 1
ruiseki = [0]
for i, e in enumerate(sum01):
    ruiseki.append(ruiseki[i] + sum01[i])

# print(ruiseki)
answer = 0
for i in range(0, len(ruiseki), 2):
    left = i
    right = min(i + Add, len(sum01))
    temp = ruiseki[right] - ruiseki[left]
    answer = max(temp, answer)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
H=[int(x) for x in input().split()]
cnt=1
tall=H[0]
for i in range(1,N):
    if tall<=H[i]:
        tall=H[i]
        cnt+=1
print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
nums = list(map(int, input().split()))
count = 0

for i in range(len(nums)):
    flag = True
    for j in range(i):
        if nums[j] > nums[i]:
            flag=  False
    if flag:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
h=list(map(int,input().split()))
i=0
cnt=0
for j in h:
  if i<=j:
    cnt+=1
    i=j
print(cnt)

Submission status: Runtime Error

Solution code:
#整数の入力
a,b = int(input()split())
#コインの枚数をXとする
X = int()
X = 0
if a>=b:
X = X + a
a = a - 1
else:
  X = X + b
  b = b - 1
  
print(X)

Submission status: Runtime Error

Solution code:
input(int(A,B))
int(X)
X = 0
if(A>=B)
X = X + A
A = A - 1
else(B>A)
X = X + B
B = B - 1
print(X)

Submission status: Runtime Error

Solution code:
a,b = map(int, input())
if a < b:
  tmp = b
  b = a
  a = tmp

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

print(sum)

Submission status: Runtime Error

Solution code:
a, b = map(int, raw_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: Runtime Error

Solution code:
N = int(input())
H = list(map(int, input().split()))
result = 1

for i in range(N):
    dec = True
    for j in range(i-1):
        if H[i] <= H[j]:
            dec = False
            break
    if dec == True:
        result += 1
print(result)

Submission status: Runtime Error

Solution code:
N = int(input())
H = list(map(int, input().split()))
result = 0

for i in range(N):
    dec = True
    for j in range(i-1):
        if H[i] <= H[j]:
            dec = False
            break
    if dec == True:
        result += 1
print(result)

Submission status: Runtime Error

Solution code:
A, B = map(int, imput().split())
i = 0

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

print(i)

Submission status: Runtime Error

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

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

print(res)

Submission status: Runtime Error

Solution code:
import numpy as np

a, b = map(int, input().split(" "))
print(np.max(2*a-1, a+b, 2*b-1))

Submission status: Runtime Error

Solution code:
class BufInput:
  def __init__(self):
    self.save = False
    self.buf = None
  def read(self, save=False):
    if self.save:
      ret = self.buf
    else:
      try:
        ret = input()
      except EOFError as e:
      	ret = None
    self.save = save
    self.buf = ret
    return ret
    
  
bi = BufInput()
while bi.read(True):
  n, k = map(int, bi.read().split())
  s = bi.read().rstrip()

  def findEx(s, f, pos, notfound):
    pos = s.find(f, pos)
    if pos == -1:
      pos = notfound
    return pos

  ans = 0
  left = 0
  right = 0
  while right < n:
      if k > 0:
          right = findEx(s, '01', right, n-1) + 1
          k = k - 1
          right = findEx(s, '10', right, n-1) + 1
          ans = max(ans, right - left)
      else:
          left = findEx(s, '01', left, n-1) + 1
          k = k + 1

  print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
s = input().rstrip()

def findEx(s, f, pos, notfound):
  pos = s.find(f, pos)
  if pos == -1:
    pos = notfound
  return pos
    
ans = 0
left = 0
right = 0
while right < n:
    if k > 0:
        right = findEx(s, '01', right, n-1) + 1
        k = k - 1
        right = findEx(s, '10', right, n-1) + 1
        ans = max(ans, right - left)
    else:
        left = findEx(s, '01', left, n-1) + 1
        k = k + 1

print(ans)

Submission status: Runtime Error

Solution code:
import sys
[N,K] = list(map(int, input().split()))

S = input()

current = None
accum_value = 0
accum = []

one_values = [0]
for c in S:
    if current != c:
        if current != None:
            accum.append(accum_value)
            if current == '1':
                one_values.append(accum_value)
            accum_value = 0

    current = c
    accum_value +=1 

accum.append(accum_value)
if c == '1':
    one_values.append(accum_value)

def max_window(l, window_size):
    window_size = min(window_size, len(l))
    window_sum = sum(l[:window_size])
    max_sum = window_sum
    for i in range(window_size, len(l)):
        window_sum += l[i]
        window_sum -= l[i-window_size]
        max_sum = max(window_sum, max_sum)

    #print(l, window_size, max_sum)
    return max_sum

if K == 0:
    print(max(one_values))
    sys.exit(0)

ans = 0
if S[0] == '0' or S[-1] == '0':
    if S[0] == '0':
        ans = max(max_window(accum, 2*K), max_window(accum[1:], 2*K+1))
    if S[-1] == '0':
        ans = max(ans, max_window(accum[::-1], 2*K))
else:
    ans = max_window(accum, 2*K+1)
print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
k += 1
s = "01" + input().rstrip()
ans = 0
i = 0
left = 2
right = 1
while i < n:
    if k > 0:
        pos = s.find('01', i)
        if pos == -1:
            i = n
            right = n - 1
        else:
            pos = s.find('10', pos + 1)
            if pos == -1:
                i = n
                right = n - 1
            else:
                right = pos
                i = pos + 1
        k = k - 1
        ans = max(ans, right - left + 1)
    else:
        pos = s.find('01', left)
        left = pos + 1
        k = k + 1

print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
s = input().rstrip()
ans = 1
left = 0
right = -1
pos = s.find('10', 0)
if pos == -1:
  i = n
else:
  i = pos + 1

while i < n:
    if k > 0:
        pos = s.find('01', i)
        if pos == -1:
            i = n
            right = n - 1
        else:
            pos = s.find('10', pos + 1)
            if pos == -1:
                i = n
                right = n - 1
            else:
                right = pos
                i = pos + 1
        k = k - 1
        ans = max(ans, right - left + 1)
    else:
        pos = s.find('01', left)
        left = pos + 1
        k = k + 1

print(ans)

Submission status: Runtime Error

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

c=0

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

print(c)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
s=input()
s_list=[]
first=s[0]
last=s[n-1]
state=first
length=1
for i in range(1,n):
    if (state=='0' and s[i]=='0') or (state=='1' and s[i]=='1'):
        state=s[i]
        length=length+1
    else:
        state=s[i]
        s_list.append(length)
        length=1
s_list.append(length)
if first=='0':
    if last=='0':
        number0=(len(s_list)+1)/2
    else:
        number0=len(s_list)/2
else:
    if last=='0':
        number0=len(s_list)/2
    else:
        number0=(len(s_list)-1)/2
if first=='0' and last=='0':
    if number0<=k:
        Max=n
    else:
        p_list=s_list[0:2*k]
        Max=sum(p_list)
        i=1
        while i+2*k+1<n-1:
            p_list=s_list[i:i+2*k+1]
            if sum(p_list)>Max:
                Max=sum(p_list)
            i=i+2
        p_list=s_list[n-2*k:]
        if sum(p_list)>Max:
            Max=sum(p_list)
elif first=='0' and last=='1':
    if number0<=k:
        Max=n
    else:
        p_list=s_list[0:2*k]
        Max=sum(p_list)
        i=1
        while i+2*k+1<=n-1:
            p_list=s_list[i:i+2*k+1]
            if sum(p_list)>Max:
                Max=sum(p_list)
            i=i+2
elif first=='1' and last=='0':
    if number0<=k:
        Max=n
    else:
        p_list=s_list[0:2*k+1]
        Max=sum(p_list)
        i=2
        while i+2*k+1<n-1:
            p_list=s_list[i:i+2*k+1]
            if sum(p_list)>Max:
                Max=sum(p_list)
            i=i+2
        p_list=s_list[n-2*k:]
        if sum(p_list)>Max:
            Max=sum(p_list)
elif first=='1' and last=='1':
    if number0<=k:
        Max=n
    else:
        p_list=s_list[0:2*k+1]
        Max=sum(p_list)
        i=2
        while i+2*k+1<=n-1:
            p_list=s_list[i:i+2*k+1]
            if sum(p_list)>Max:
                Max=sum(p_list)
            i=i+2
print(Max)

Submission status: Runtime Error

Solution code:
# coding: utf-8
n = int(input())

high = list(map(int, input().split()))
max_high = []
count =1

for i in range(1,n):
    x = high[:i]
    if(max(x) <= high[i]):
        count++
        
print(count)

Submission status: Runtime Error

Solution code:
buttons = {"A","B"}
buttons["A","B"]=(A,B)

def game():
  num = 0
  value = 0
  while num < 2:
    if buttons["A"] >= button["B"]:
      value += buttons["A"]
      buttons["A"] -= 1
    else:
      value += buttons["B"]
      buttons["B"] -= 1
    num += 1
  return(value)
print(game())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input().split()

if s[0] < s[1]:
  s1 = s[0]
  s2 = s[1]
else:
  s1 = s[1]
  s2 = s[0]
  
result = 0
if (s2-s1) > 2:
  result = s2*2 - 1
else (s2-s1) = 1:
  result = s2 + s1

print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
//A > B
//A = B
//A < BこのB場合は考えない
A, B = map(int, input().split())
if(A > B):
	return print(A + A-1)
if(A = B):
	return print(2A)

Submission status: Runtime Error

Solution code:
//A > B
//A = B
//A < BこのB場合は考えない
A, B = map(int, input().split())
if(A > B):
	print(A + A-1)
if(A = B):
	print(2A)

Submission status: Runtime Error

Solution code:
  A = 5
  B = 3
  total = 0
  if A < B:
    total += B
    if A < B - 1:
      total += B - 1
    else:
      total += A
  elif B < A:
    total += A
    if B < A - 1:
      total += A - 1 
    else:
      total += B
  else:
    total = A + B 
  print(total)

Submission status: Runtime Error

Solution code:
  A = 5
  B = 3
  total = 0
  if A < B:
    total += B
    if A < B - 1:
      total += B - 1
    else:
      total += A
  elif B < A:
    total += A
    if B < A - 1:
      total += A - 1 
    else:
      total += B
  else:
    total = A + B 
  return total

Submission status: Runtime Error

Solution code:
  A = 5
  B = 3
  total = 0
  if A < B:
    total += B
    if A < B - 1:
      total += B - 1
    else:
      total += A
  elif:
    total += A
    if B < A - 1:
      total += A - 1 
    else:
      total += B
  else:
    total = A + B 
  return total

Submission status: Runtime Error

Solution code:
  total = 0
  if A < B:
    total += B
    if A < B - 1:
      total += B - 1
    else:
      total += A
  elif:
    total += A
    if B < A - 1:
      total += A - 1 
    else:
      total += B
  else:
    total = A + B

Submission status: Runtime Error

Solution code:
x = int(input())
y = int(input())

if x>y:
  print(int(2*x-1))
elif x<y:
  print(int(2*y-1))
elif x == y:
  print(int(x+y))

Submission status: Runtime Error

Solution code:
x = int(raw_input())
y = int(raw_input())

if x>y:
  print(int(2*x-1))
elif x<y:
  print(int(2*y-1))
elif x == y:
  print(int(x+y))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
inputs = [int(input()) for i in range(2)]

print(max([sum(inputs), inputs[0]*2-1, inputs[1]*2-1]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k = map(int, input().split())
s = input()
cnt = 0
init = (s[0]=='1')
h=[1]
h_cnt = 0

for i in range(1,n):
    if(s[i]!=s[i-1]):
        h_cnt+=1
        h.append(1)
    else:
        h[h_cnt]+=1

h_cnt+=1

zero_num = 0
ans = 0

if(init): #start with 1
    zero_num = h_cnt//2;
    if(zero_num<=k):
        ans = n
    else:
        sum_0 = sum(h[0:k*2+1])
        ans = sum_0
        h = h +[0]
        for j in range(0,zero_num-k): #j is 0's order
            sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k)*2+2]
            if(ans<=sum_0):
                ans = sum_0

else: #start with 0
    zero_num = h_cnt//2 +1;
    if(zero_num<=k):
        ans = n
    else:
        sum_0 = sum(h[0:k*2])
        ans = sum_0
        h = [0] + h +[0]
        for j in range(0,zero_num-k): #j is 0's order
            sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k)*2+2]
            if(ans<=sum_0):
                ans = sum_0

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
[n,k] = input().split(" ")
s = input()
n = int(n)
k = int(k)
cnt = 0
init = (s[0]=='1')
h=[1]
h_cnt = 0

for i in range(1,n):
    if(s[i]!=s[i-1]):
        h_cnt+=1
        h.append(1)
    else:
        h[h_cnt]+=1

h_cnt+=1

zero_num = 0
ans = 0

if(init): #start with 1
    zero_num = h_cnt//2;
    if(zero_num<=k):
        ans = n
    else:
        sum_0 = sum(h[0:k*2+1])
        ans = sum_0
        h = h +[0]
        for j in range(0,zero_num-k): #j is 0's order
            sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k)*2+2]
            if(ans<=sum_0):
                ans = sum_0

else: #start with 0
    zero_num = h_cnt//2 +1;
    if(zero_num<=k):
        ans = n
    else:
        sum_0 = sum(h[0:k*2])
        ans = sum_0
        h = [0] + h +[0]
        for j in range(0,zero_num-k):#j is 0's order
            sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k)*2+2]
            if(ans<=sum_0):
                ans = sum_0

print(ans)

Submission status: Runtime Error

Solution code:
[n,k] = input().split(" ");
s = input();
n = int(n)
k = int(k)
cnt = 0
init = (s[0]=='1')
h=[1]
h_cnt = 0

for i in range(1,n):
    if(s[i]!=s[i-1]):
        h_cnt+=1
        h.append(1)
    else:
        h[h_cnt]+=1

h_cnt+=1

zero_num = 0
ans = 0

if(init): #start with 1
    zero_num = h_cnt//2;
    if(zero_num<=k):
        ans = n
    else:
        sum_0 = sum(h[0:k*2+1])
        ans = sum_0
        h = h +[0]
        for j in range(0,zero_num-k): #j is 0's order
            sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k)*2+2]
            if(ans<=sum_0):
                ans = sum_0

else: #start with 0
    zero_num = h_cnt//2 +1;
    if(zero_num<=k):
        ans = n
    else:
        sum_0 = sum(h[0:k*2])
        ans = sum_0
        h = [0] + h +[0]
        for j in range(0,zero_num-k):#j is 0's order
            sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k)*2+2]
            if(ans<=sum_0):
                ans = sum_0

print(ans)

Submission status: Runtime Error

Solution code:
[n,k] = input().split(" ")
s = input()

cnt = 0
init = (s[0]=='1')
h=[1]
h_cnt = 0

for i in range(1,n):
    if(s[i]!=s[i-1]):
        h_cnt+=1
        h.append(1)
    else:
        h[h_cnt]+=1

h_cnt+=1

zero_num = 0
ans = 0

if(init): #start with 1
    zero_num = h_cnt//2;
    if(zero_num<=k):
        ans = n
    else:
        sum_0 = sum(h[0:k*2+1])
        ans = sum_0
        for j in int range(0,zero_num-k+1): #j is 0's order
            sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k)*2+2]
            if(ans<=sum_0):
                ans = sum_0

else: #start with 0
    zero_num = h_cnt//2 +1;
    if(zero_num<=k):
        ans = n
    else:
        sum_0 = sum(h[0:k*2])
        ans = sum_0
        h = [0].extend(h)
        for j in range(0,zero_num-k+1): #j is 0's order
            sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k)*2+2]
            if(ans<=sum_0):
                ans = sum_0

print(ans)

Submission status: Runtime Error

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

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

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

print(M) #M=もらえる最大値

Submission status: Runtime Error

Solution code:
a=[int(input()) for i in range(2)]
sum=0;
if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

print(sum)

Submission status: Runtime Error

Solution code:
a = int(input('A:'))
b = int(input('B:'))

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

print(M) #M=もらえる最大値

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,K = list(map(int,input().split()))
A = input()
A = list(A)
A = list(map(int,A))
l = [0]
s = []

for i in range(N-1):
    if A[i] != A[i+1]:
        l.append(i+1)
        s.append(l[len(l)-1]-l[len(l)-2])
l.append(N)
s.append(l[len(l)-1]-l[len(l)-2])
a = 0
right = 0
left = 0
g = 0
su = 0
if A[0] == 0:
    for i in range(len(s)):
        print(right)
        su +=s[right]
        if right%2==0:
            g += 1
        right +=1
        if g<=K:
            a = max(a,su)
        else:
            while g>K:
              su -= s[left]
              if left%2==0:
                  g -=1
              left +=1
        a = max(a,su)
else:
    for i in range(len(s)):
        su +=s[right]
        if right%2==1:
            g += 1
        right +=1
        if g<=K:
            a = max(a,su)
        else:
            while g>K:
              su -= s[left]
              if left%2==1:
                  g -=1
              left +=1
        a = max(a,su)

print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,K = (int(i) for i in input().split())
K += 2 #とれる範囲
S = input()
S = [s for s in S]
cnt = []
last = S[0]
c = 0

for s in S:
    if s == last:
        c += 1
    else:
        cnt.append(c)
        c = 1
        last = s

cnt.append(c)
cnt.extend([0,0,0])
hold = sum([cnt[n] for n in range(K+1)])
ans = [hold]
for i in range(1,len(cnt)-K):
    #right => cnt[i-1]
    #left => cnt[i+K]
    ans.append(hold-cnt[i-1]+cnt[i+K])
    hold = sum([cnt[n+i] for n in range(K+1)])
print(max(ans))

Submission status: Runtime Error

Solution code:
#coding: utf-8
a, b = map(int, input().split())
result = 0

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

result += max(a,b)
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A = input()
B = input()
 
if A > B:
  max = A + A - 1
  print(max)
elif B > A:
  max = B + B - 1
  print(max)
elif A == B:
  max = A + B
  print(max)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
 
if A > B:
  max = A + A - 1
  print(max)
elif B > A:
  max = B + B -1
  print(max)
elif A == B:
  max = A + B
  print(max)

Submission status: Runtime Error

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

if A > B:
  max = A + A
  print(max)
elif B > A:
  max = B + B
  print(max)
elif A = B:
  max = A + B
  print(max)

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
C=[A+A-1, B+B-1, A+B]
print(max(c))

Submission status: Runtime Error

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

count = 0
manSum = 0

for i in range(0, 2):
  if count = 2:
    break
  
  if numbers[i] == max(numbers):
    maxSum += numbers[i]
    numbers[i] -= 1
    count += 1
    i = 0
    
 print(maxSum)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int, input().split()))
m=0
for i in range(n):
  for j in range(i):
    if l[j]>l[i]:
      break
  else:
    m+=1
print(m)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(input().split())
m=0
for i in range(n):
  for j in range(i):
    if l[j]>l[i]:
      break
  else:
    m+=1
print(m)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
c1=c2=0
l = len(n)
c1 = n - (len([for i in l[0::2] if n == "0"])) - (len([for i in l[1::2] if n == "1"]))
c2 = n - (len([for i in l[0::2] if n == "1"])) - (len([for i in l[1::2] if n == "0"]))

print(min(c1,c2))

Submission status: Runtime Error

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: Runtime Error

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