The number that remains
Medium
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given a sequence of consecutive natural numbers starting from n and ending at m (n < m), perform the following steps repeatedly until only one number remains:
1. Remove all numbers that are in odd positions. 2. From the remaining numbers, remove all numbers that are in even positions.
Your task is to write a program that determines the last remaining number.
Input
The input consists of two lines: the first line contains the integer n, and the second line contains the integer m, where n < m < 1000000000.
Output
Output the last remaining number.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 16%