407123: GYM102697 094 Computer Love

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

094. Computer Lovetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Computer Love

You love your computer, and you want to give it a present: a large integer. However, your computer especially loves powers of two. Given two numbers $$$x$$$ and $$$y$$$, find the largest power of two between $$$x$$$ and $$$y$$$, i.e. find the largest number $$$n$$$ such that $$$x$$$ <= $$$n$$$ <= $$$y$$$, and $$$n$$$ is a power of two.

Input

The only line of input contains two space-separated integers $$$x$$$ and $$$y$$$: the lower and upper bounds of the range described in the problems statement. The values are inclusive, i.e. $$$x$$$ and $$$y$$$ could potentially be valid answers if they were powers of two.

Output

Output a single integer $$$n$$$: the largest power of two such that $$$x$$$ <= $$$n$$$ <= $$$y$$$. If there aren't any powers of two between $$$x$$$ and $$$y$$$, output $$$-1$$$. The answer is guaranteed to be within the bounds of 32-bit signed integers.

ExamplesInput
6 18
Output
16
Input
35 55
Output
-1
Input
86 375
Output
256

加入题单

上一题 下一题 算法标签: