Problem StatementSnuke loves puzzles.Today, he is working on a puzzle using S- and c-shaped pieces. In this puzzle, you can combine two c-shaped pieces into one S-shaped piece, as shown in the figure below:Snuke decided to create as many Scc groups as possible by putting together one S-shaped piece and two c-shaped pieces.Find the maximum number of Scc groups that can be created when Snuke has N S-shaped pieces and M c-shaped pieces.Constraints1≤N,M≤1012InputThe input is given from Standard Input in the following format:N M
OutputPrint the answer.Sample Input 11 6
Sample Output 12
Two Scc groups can be created as follows:Combine two c-shaped pieces into one S-shaped pieceCreate two Scc groups, each from one S-shaped piece and two c-shaped piecesSample Input 212345 678901
Sample Output 2175897
int main()
{
long long int s,c;
while(scanf("%lld %lld",&s,&c)!=EOF)
{
long long int max;
if(c<=2*s)
max=c/2;
else
max=(2*s+c)/4;
printf("%lld\n",max);
}
return 0;
}