Choose distinct dice values from 1 to 6 so that Alice's die is strictly larger than Bob's and the score difference is as small as possible.
You are given two integers describing the values shown on two dice. You may increase either die's value to any value from 1 to 6, but you cannot decrease it.
Your task is to determine the minimum total number of increments needed to make the first die strictly greater than the second die.
If it is already impossible to make the first die strictly greater than the second die under the dice limits, report that no valid adjustment exists.
Find the smallest change needed so that:
-1.Example 1
Input
1 1
Output
1
Explanation
Increase the first die to 2. Then 2 > 1, and the total increment is 1.
Example 2
Input
4 2
Output
0
Explanation
The first die is already greater than the second die, so no change is needed.
Example 3
Input
2 6
Output
-1
Explanation
The second die is already at the maximum value, and the first die cannot exceed 6 using increments only.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.