Time limit
2s
Memory limit
128 MB
A monkey that has just escaped from a zoo is looking around the world when it meets its eternal rival, a dog. The monkey wants to pet the dog, but it is shorter than the dog and cannot do so. To pet the dog, the two animals must have the same height.
Starting that day, the monkey decides to increase its height every day. The monkey has the power to grow by any chosen amount, but the amount chosen for one day can differ from the previous day's amount by at most 1 cm. For example, if the monkey grows by 5 cm today, then tomorrow it may grow by 4 cm, 5 cm, or 6 cm. The daily increase cannot be negative. Also, the increase on both the first day and the last day must be exactly 1 cm.
Given the current heights of the monkey and the dog, find the minimum number of days needed for the monkey to become the same height as the dog.
The first line contains the monkey's height X and the dog's height Y. X and Y are integers satisfying 0 <= X <= Y < 2^31.
Print the minimum number of days needed for the monkey's height to become equal to the dog's height.