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

Solution in Julia (0.5.0) (judge verdict: Wrong Answer)

n, k = [parse(Int, x) for x in split(readline() |> chomp, " ")]
str = readline() |> chomp

xs = zeros(Int, n)
for (i, s) in enumerate(str)
    xs[i] = parse(Int, s)
end

ys = vcat(1, xs)
flip = zeros(Int, n)
for i = 1:n
    if ys[i] != ys[i+1]
        flip[i] = 1
    end
end

flippoints = Int[]
for (i, f) in enumerate(flip)
    if f == 1
        push!(flippoints, i)
    end
end

# println(xs)
# println(ys)
# println(flip)
# println(flippoints)

values = Int[]

fn = length(flippoints)
i = 1
while i <= fn
    b = false
    left0 = 1
    if 1 <= i-1
        left0 = max(1, min(flippoints[i-1] + 1, flippoints[i] - 1))
    end
    left1 = flippoints[i]
    right1 = flippoints[end]
    if i+2k-1 <= fn
        right1 = flippoints[i-1+2k]
    end
    right0 = n
    if i+2k <= fn
        right0 = flippoints[i+2k] - 1
    else
        b = true
    end
    push!(values, right0 - left0 + 1)
    # println("l0, l1, r1, l0 = ", [left0, left1, right1, right0])
    # println(values)
    if b
        break
    end
    i += 2
end

if isempty(values)
    print(n)
else
    print(max(values...))
end