DISCLAIMER: This problem statement contains NO spoilers to the film Avengers: Endgame and is in no way, shape, or form affiliated to Marvel Entertainment. Uses of characters, settings, and scenes are parodical only.
To celebrate finally defeating the Avengers, Thanos decides to retire from his titanous ways and work on his garden. He's come to see that he's actually quite the farmer, and harvested a bountiful amount of space papayas.
Thanos wants to make himself a pot of papaya soup, but he's strictly on a perfectly balanced diet (as all things should be), and the sheer abundance of papayas is too much to digest. His last harvest produced
Unfortunately, being an almighty titan has its downsides, as Thanos can only reduce the number of papayas by half each time (the quotient is rounded down if it is a decimal number). Thanos is generally flexible when it comes to papaya consumption, but he much prefers an amount that is closer to
Calculate the closest possible final number of papayas to
Input Specification
Line 1: 2 integers
Constraints
Output Specification
A single integer, representing the closest value possible to
Sample Input
365 12
Sample Output
11
Explanation
Let
We can compute what happens each time Thanos reduces the number of papayas by half:
We see that
Comments
Dmoj: no spoilers
also Dmoj: to celebrate finally defeating the Avengers...
Thanos wins in Infinity War though