Given two integers L and K, find the least integer R such that the number of set bits in the range [L, R] is at least K.
Here, "number of set bits" means the number of 1 bits in the binary representation of the integers.
Task
Find the minimum value of R
Example
Assumption:
Approach:
Input format
Note: This is the input format that you must use to provide custom input (available above the Compile and Test button)
Output format
For each test case, output one integer in a single line denoting the minimum value of R.
Constraints
1≤T≤20
1≤L,K≤1015
Number of set bits in [1,L−1] + K <= Number of set bits in [1,2∗1015]
The first integer denotes the number of test cases, T = 1
The first test case
Given:
Approach: