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 PHP (5.6.30) (judge verdict: Accepted)

<?php

//----------------------------------------------------------------------------------
// Input
//----------------------------------------------------------------------------------
$sc = new Scanner();
$a = $sc->nextInt();
$b = $sc->nextInt();

//  $t = array();
//  $d = array();
//  for ($i = 0; $i < $n; $i++) {
//    $t[] = $sc->next();
//    $d[] = $sc->next();
//  }



//----------------------------------------------------------------------------------
// Main
//----------------------------------------------------------------------------------

$ans = 0;

if ($a == $b) { $ans = $a*2; }
if ($a >= $b+1) { $ans = $a*2-1; }
if ($a+1 <= $b) { $ans = $b*2-1; }



//----------------------------------------------------------------------------------
// Output
//----------------------------------------------------------------------------------
$is_large_int_ans = 0;
$is_multi_ans = 0;

if ($is_multi_ans) {
  for ($i = 0; $i < count($ans); $i++) {
    out::println($ans);
  }
} else {
  out::println($ans);
}



//----------------------------------------------------------------------------------
// Ref: https://qiita.com/yoshikyoto/items/6924478283dbdd549e4b
//----------------------------------------------------------------------------------
class Scanner {
  private $arr = array();
  private $count = 0;
  private $pointer = 0;

  private $fp = NULL;

  function __construct() {
    $folder = explode("\\", getcwd());
    if (end($folder) == 'AtCoder') {
      error_reporting(E_ERROR | E_WARNING | E_PARSE);
      $this->fp = fopen('./Input.dat' , 'r');
    } else {
      error_reporting(0);
    }
  }

  public function next() {
    if($this->pointer >= $this->count) {
      $folder = explode("\\", getcwd());
      if (end($folder) == 'AtCoder') {
        $str = trim(fgets($this->fp));
      } else {
        $str = trim(fgets(STDIN));
      }
      $this->arr = explode(' ', $str);
      $this->count = count($this->arr);
      $this->pointer = 0;
    }
    $result = $this->arr[$this->pointer];
    $this->pointer++;
    return $result;
  }
  public function hasNext() {
    return $this->pointer < $this->count;
  }
  public function nextInt() {
    return (int)$this->next();
  }
  public function nextDouble() {
    return (double)$this->next();
  }
}

class out {
  public static function println($str = "") {
    global $is_large_int_ans;
    if ($is_large_int_ans) {
      echo sprintf("%d", $str) . PHP_EOL;
    } else {
      echo $str . PHP_EOL;
    }
  }
}

?>