P1852 Jumping Checkers
Description
Jumping Checkers is played on a number line. Pieces can only be placed on integer points. No position may contain more than one piece.

We use Jumping Checkers to play a simple game: there are $3$ pieces on the board at positions $a,b,c$. We want to move them, using the fewest jumps, so that their positions become $x,y,z$. (The pieces are indistinguishable.)
The rule for a jump is simple: choose any piece and jump it over a pivot piece. After the jump, the distance between the two pieces remains unchanged. Each move may jump over exactly $1$ piece.
Write a program to first determine whether the task is possible. If it is, output the minimum number of jumps required.
Input Format
The first line contains three integers, the current positions $a,b,c$ (pairwise distinct).
The second line contains three integers, the target positions $x,y,z$ (pairwise distinct).
Output Format
If there is no solution, output a single line `NO`.
If it is reachable, output the first line YES, and the second line the minimum number of jumps.
Explanation/Hint
### Constraints
- For $20\%$ of the testdata, the absolute value of each input integer does not exceed $10$.
- For $40\%$ of the testdata, the absolute value of each input integer does not exceed $10000$.
- For $100\%$ of the testdata, the absolute value does not exceed $10^9$.
Translated by ChatGPT 5