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 C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int main()
{
 
//  int a, b, c, d, e, X, Y;
  int a, b, c,  d, e,f;
  //  double  c;
//  long long  A[1000001]={};
  int  A[2000001]={};
  int  B[2000001]={};
  int  ans[100003]={};
  int  sum[100003]={};
  int  cnt_flag[100003]={};

  int  L[1003]={};


//  long long  a, b, c, d, X, Y;
//  long long   d, X, Y;
  long long JPY;
  double BTC;
  char s[200001]={};
  char t[200001]={};
  char u[200001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k,point;
  int point_A=0, point_B=0;
  int flag=0;
//  int flag[10000003]={};
  int tmp=0;
//  int min=1000000;
  int min=10;
  int len=0;
  int cnt=0;
  int cnt0=0;
  int cnt1=0;
  int num=0;
//  double ans=0.0;
//  long long ans=0;
  int max=0;
//  int sum=0;
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
 
  scanf("%d%d", &a, &b);
  scanf("%s", &s);
//  scanf("%d", &max);

  if(s[0]=='0'){
//  printf("%d\n", cnt);
      cnt0++;
      point_B++;
  } else{
      cnt1++;
//      point_A++;
  }

  for(i=1;i<a;i++){
    if(s[i-1]=='0'){
//  printf("%d\n", cnt);
      if(s[i]=='1'){
        cnt1++;
        A[point_A]=cnt0;
        cnt0=0;
        point_A++;
        len++;
      }
      else  cnt0++;
    }
    else{
      if(s[i]=='0'){
        cnt0++;
        B[point_B]=cnt1;
        cnt1=0;
        point_B++;
        len++;
      }
      else cnt1++;
    }
  }
  A[point_A]=cnt0;
  B[point_B]=cnt1;
  point_A=0;
  point_B=0;
  for(i=0;i<(len/2)+1;i++){
    cnt=cnt+B[i-1];
    for(j=i;j<b+i;j++){
      cnt=cnt+B[j]+A[j];
//      printf("i=%d j=%d A=%d B=%d cnt=%d\n",i, j, A[j],B[j], cnt);
    }
    if(cnt>max) max=cnt;
//    printf("i=%d j=%d endA_cnt=%d\n",i, j, cnt);
    cnt=cnt+B[j]-B[i-1];
    if(cnt>max) max=cnt;
//    printf("i=%d j=%d endB_cnt=%d\n",i, j, cnt);
    cnt=0;
  }
  
  printf("%d\n", max);
/*    
    */

//  printf("%s\n",s);
//    else  
  
return 0;
}