Operations on number - MarisaOJ: Marisa Online Judge

Operations on number

Time limit: 1000 ms
Memory limit: 256 MB
You are given an integer $n$. Each turn you can perform either operation: - Multiple $n$ by $2$. - Subtract $1$ from $n$. Find the minimum number of operations to turn $n$ to $m$. ### Input - The first line contains 2 integers $n, m$. ### Output - Print the minimum number of operations. ### Constraints - $1 \le n, m \le 10^5$. ### Example Input: ``` 2 7 ``` Output: ``` 3 ```