Submit solution

Points:
7

Time limit:
1.0s

Memory limit:
256M

Author:

Problem types

Allowed languages

Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, ~~CommonLisp~~, D, Dart, F#, Forth, Fortran, Go, ~~Groovy~~, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, ~~Nim~~, ~~ObjC~~, OCaml, ~~Octave~~, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Soupy boy is playing a game! He is currently on the square, and wants to get to the square **exactly**. However, moves in this game are a bit different than your average board game.

Starting from the current square, he can do one of things.

- Go to the square.
- Go to the square.
- Go to the square.
- Go to the square if the current square is even.

Can you tell soupy boy what is the minimum amount of moves so that he can get to the square?

**Note:** You can assume that soupy boy will not go to a square that is larger than .

#### Input Specification

The first and only line of input contains the two integers and , separated by a space.

#### Output Specification

Output the minimum amount of moves it takes soupy boy to get to the square, starting from the square using the moves described above.

#### Sample Input 1

`4 6`

#### Sample Output 1

`2`

#### Sample Input 2

`10 1`

#### Sample Output 2

`3`

## Comments

I am wondering how to solve this question by JAVA. It always TLE...

This comment is hidden due to too much negative feedback. Click here to view it.

I think it's pretty easy to make your own test cases for this problem, just input two random large integers.

This comment is hidden due to too much negative feedback. Click here to view it.

256 megabytes is low??!?!?

That's some cheese!