#K61907. Distinct Canvas Layers
Distinct Canvas Layers
Distinct Canvas Layers
You are given a number of canvases, each defined by its dimensions N (number of rows) and M (number of columns). For each canvas, you are required to compute the number of distinct layers. A layer is defined as one border around the canvas, and the number of layers is given by the formula:
\( \text{layers} = \left\lfloor \frac{\min(N, M)}{2} \right\rfloor \)
Here, \(\lfloor x \rfloor\) represents the floor of \(x\). Essentially, you can remove layers from the canvas until at least one of its dimensions becomes less than 2. Your task is to determine the number of layers for each given canvas.
inputFormat
The first line of the input contains an integer T, representing the number of test cases.
Each of the following T lines contains two space-separated integers N and M, denoting the dimensions of a canvas.
outputFormat
For each test case, output a single integer representing the number of distinct layers for the canvas. Each output should be printed on a new line.
## sample3
5 4
4 4
6 3
2
2
1
</p>