A strongness of an even number is the number of times we can successively divide by 2 until we reach an odd number starting with an even number n.

For example, if n = 12, then
* 12 / 2 = 6
* 6 / 2 = 3

So we divided successively 2 times and we reached 3, so the strongness of 12 is `2`.

If n = 16 then
* 16 / 2 = 8
* 8 / 2 = 4
* 4 / 2 = 2
* 2 / 2 = 1

we divided successively 4 times and we reached 1, so the strongness of 16 is `4`


# Task

Given a closed interval `[n, m]`, return the even number that is the strongest in the interval. If multiple solutions exist return the smallest strongest even number.

Note that programs must run within the allotted server time; a naive solution will probably time out.


# Constraints
```if-not:ruby
1 <= n < m <= INT_MAX
```
```if:ruby
1 <= n < m <= 2^64
```


# Examples
```
[1, 2]    -->   2  # 1 has strongness 0, 2 has strongness 1
[5, 10]   -->   8  # 5, 7, 9 have strongness 0; 6, 10 have strongness 1; 8 has strongness 3
[48, 56]  -->  48

Difficulty: EASY
Tags: Mathematics

Starter code:
def strongest_even(n, m):
	

Solutions:
from math import log2

def strongest_even(n, m):
	if int(log2(m)) > int(log2(n)):
		return 2 ** int(log2(m))
	n += n % 2
	m -= m % 2
	if n == m:
		return n
	return 2 * strongest_even(n // 2, m // 2)


def strongest_even(n, m):
	while m & m - 1 >= n:
		m &= m - 1
	return m


def strongest_even(n, m):
	while True:
		if m & m - 1 < n:
			return m
		m &= m - 1


from math import log2

def strongest_even(n, m):
	b = x = 2 ** int(log2(m))
	while not n <= x <= m:
		b //= 2
		x = m // b * b
	return x


def strongest_even(n, m):
	while n <= m:
		prev = n
		n += 1 << strongness(n)
	return prev

def strongness(n):
	return n.bit_length() - len(format(n, 'b').rstrip('0'))


def strongest_even(n, m):
	(x, y) = (bin(n)[2:], bin(m)[2:])
	if len(x) < len(y):
		return 1 << len(y) - 1
	i = next((i for i in range(len(x)) if x[i] != y[i]))
	res = x[:i] + ('1' if '1' in x[i:] else '0') + '0' * (len(x) - i - 1)
	return int(res, 2)


def strongest_even(n, m):
	n = n if n % 2 == 0 else n + 1
	m = m if m % 2 == 0 else m - 1
	x = 2
	while not x * 2 > m:
		x *= 2
	if x < n:
		(i, s, a) = (m, n, x)
		while i >= n:
			if i % a / 2 == 0:
				s = i
				i -= a
				a = x
			a = a / 2 if a / 2 > 1 else 2
		return s
	else:
		return x


def strongest_even(n, m):
	exponent = 1
	while m > 2 ** exponent:
		exponent += 1
	if n <= 2 ** exponent <= m:
		return 2 ** exponent
	while exponent > 0:
		exponent -= 1
		factor = 1
		while 2 ** exponent * factor <= m:
			if n <= 2 ** exponent * factor <= m:
				return 2 ** exponent * factor
			factor += 2


def strongest_even(n, m):
	pow = 1
	while pow <= m:
		pow *= 2
	if pow / 2 <= m and pow / 2 >= n:
		return pow / 2
	else:
		pow /= 4
		multiplier = 3
		while True:
			multiple = pow * multiplier
			while multiple <= m:
				if n <= multiple:
					return multiple
				else:
					multiplier += 1
					multiple = pow * multiplier
			pow /= 2
			multiple = 3


from math import log
from math import floor

def strongest_even(n, m):
	a = 2 ** floor(log(m) / log(2))
	b = 1
	while a * b < n or a * b > m:
		a /= 2
		b += 2
		while a * b <= m:
			if a * b >= n:
				return a * b
			b += 2
	return a * b