#K32942. Maximum Figures from Sticks and Balls

    ID: 24977 Type: Default 1000ms 256MiB

Maximum Figures from Sticks and Balls

Maximum Figures from Sticks and Balls

You are given T test cases. For each test case, you are provided with two integers: the number of sticks and the number of balls. A figure can be formed by using exactly \(2\) sticks and \(3\) balls. Your task is to determine the maximum number of figures that can be formed for each test case.

The formula to compute the maximum number of figures is:

[ \text{figures} = \min\left(\left\lfloor\frac{s}{2}\right\rfloor, \left\lfloor\frac{b}{3}\right\rfloor\right) ]

where \(s\) is the number of sticks and \(b\) is the number of balls.

inputFormat

The first line contains an integer \(T\) denoting the number of test cases. Each of the following \(T\) lines contains two space-separated integers \(s\) and \(b\), where \(s\) is the number of sticks and \(b\) is the number of balls.

outputFormat

For each test case, output a single line with the maximum number of figures that can be formed.

## sample
4
6 9
4 7
8 15
0 5
3

2 4 0

</p>