Problem:
Score : 100 points

Problem Statement

You are given two positive integers a and b.
Let x be the average of a and b.
Print x rounded up to the nearest integer.

Constraints

a and b are integers.

1 \leq a, b \leq 100

Input

Input is given from Standard Input in the following format:

a b

Output

Print x rounded up to the nearest integer.

Sample Input 1

1 3

Sample Output 1

2

The average of 1 and 3 is 2.0, and it will be rounded up to the nearest integer, 2.

Sample Input 2

7 4

Sample Output 2

6

The average of 7 and 4 is 5.5, and it will be rounded up to the nearest integer, 6.

Sample Input 3

5 5

Sample Output 3

5

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,x,y,xc=0,yc=0,n=0,d=0;
	char a[8001];
	vector<int> b,c;
	scanf("%s",a);
	scanf("%d%d",&x,&y);
	//x=abs(x);
	//y=abs(y);
	for(i=0;i<strlen(a);i++)
	{
		if(a[i]=='F')
		    n++;
		else if(a[i]=='T')
		{
			if(d==0&&n!=0)
			    b.push_back(n);
			else if(n!=0)
				c.push_back(n);
			d=1-d;
			n=0;
		}
	}
	if(n!=0)
	{
		if(d==0)
			b.push_back(n);
		else
			c.push_back(n);
	}
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	for(i=b.size()-1;i>=0;i--)
	{
		if(xc>=x)
			xc-=b[i];
		else
			xc+=b[i];
	}
	for(i=c.size()-1;i>=0;i--)
	{
		if(yc>=x)
			yc-=c[i];
		else
			yc+=c[i];
	}
	if(xc==x&&yc==y)
		printf("Yes");
	else
		printf("No");
	return 0;
}