Help Joey
Basic Accuracy: 19.64% Submissions: 1241 Points: 1

Joey is a food lover, but Monica is concerned about his health and thus refuses to give him any more food. But on Joey's request she agrees to give him more food only if he solves this problem. You have number of C's and number of S's. You need to find the maximum number of words of "SCC" which can be formed from this.
Note:  2 C's can form a S.

Input:
The first line of inputs contains the number of test cases.
The Only line of each input contains the number of C's (a) and S's (b).

Output:
Print the maximum number of words obtained.

Constraints:
1 <= T <= 1000
1 <= a,b <= 108

Example:
Input:

2
2 1
3 1
Output:
1
1

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.