{"problem":{"name":"Minimize Abs 2","description":{"content":"You are given a positive integer $D$. Find the minimum value of $|x^2+y^2-D|$ for non-negative integers $x$ and $y$.","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc330_c"},"statements":[{"statement_type":"Markdown","content":"You are given a positive integer $D$.\nFind the minimum value of $|x^2+y^2-D|$ for non-negative integers $x$ and $y$.\n\n## Constraints\n\n*   $1\\leq D \\leq 2\\times 10^{12}$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$D$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc330_c","tags":[],"sample_group":[["21","1\n\nFor $x=4$ and $y=2$, we have $|x^2+y^2-D| = |16+4-21|=1$.\nThere are no non-negative integers $x$ and $y$ such that $|x^2+y^2-D|=0$, so the answer is $1$."],["998244353","0"],["264428617","32"]],"created_at":"2026-03-03 11:01:14"}}