P8668 [Lanqiao Cup 2018 NOI Qualifier B] Spiral Polyline.
Description
As shown in the figure, the spiral polyline passes through every integer lattice point on the plane exactly once.

For a lattice point $(X, Y)$, we define its distance to the origin $\text{dis}(X, Y)$ as the length of the spiral polyline segment from the origin to $(X, Y)$.
For example, $\text{dis}(0, 1)=3$, and $\text{dis}(-2, -1)=9$.
Given the integer coordinates $(X, Y)$, can you compute $\text{dis}(X, Y)$?
Input Format
$X$ and $Y$.
Output Format
Output $\text{dis}(X, Y)$.
Explanation/Hint
For $40\%$ of the testdata, $-1000\le X, Y\le 1000$.
For $70\%$ of the testdata, $-10^5\le X, Y \le 10^5$.
For $100\%$ of the testdata, $-10^9\le X, Y \le 10^9$.
Translated by ChatGPT 5