#K63802. Equalizing Tokens

    ID: 31834 Type: Default 1000ms 256MiB

Equalizing Tokens

Equalizing Tokens

You are given two integer tokens X and Y. In a move, you can choose one token and either increment it by 2 or decrement it by 1. The goal is to make the values of the two tokens equal using the minimum number of moves available.

Note: Based on the analysis of the allowed operations and sample cases, it turns out that the minimum number of moves required is equal to \( |X - Y| \). For example, if X = 3 and Y = 7, the answer is \( |3 - 7| = 4 \).

You are to process several test cases. For each test case, output the minimum number of moves required.

inputFormat

The first line of input contains a single integer \( T \) indicating the number of test cases. Each of the following \( T \) lines contains two space-separated integers \( X \) and \( Y \).

Example:

6
3 7
10 5
-5 5
-2 -3
0 0
-1 1

outputFormat

For each test case, print a single integer: the minimum number of moves required to equalize the tokens. Each answer should be printed on a new line.

Example Output:

4
5
10
1
0
2
## sample
6
3 7
10 5
-5 5
-2 -3
0 0
-1 1
4

5 10 1 0 2

</p>