{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same number line. Farmer John has two modes of transportation: walking and teleporting. \n \u003cbr\u003e \n \u003cbr\u003e* Walking: FJ can move from any point X to the points X - 1 or X + 1 in a single minute \n \u003cbr\u003e* Teleporting: FJ can move from any point X to the point 2 × X in a single minute. \n \u003cbr\u003e \n \u003cbr\u003eIf the cow, unaware of its pursuit, does not move at all, how long does it take for Farmer John to retrieve it? \n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Line 1: Two space-separated integers: N and K"}},{"title":"Output","value":{"format":"HTML","content":"Line 1: The least amount of time, in minutes, it takes for Farmer John to catch the fugitive cow."}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e5 17\n4 17\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"4\u003cbr\u003e\n3"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cpre\u003eThe fastest way for Farmer John to reach the fugitive cow is to move along the following path: 5-10-9-18-17, which takes 4 minutes.\n \n \u003c/pre\u003e"}}]}