Problem:
 Score : 200 points    Problem Statement Takahashi loves numbers divisible by 2 .  You are given a positive integer N . Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.  Here, the number of times an integer can be divisible by 2 , is how many times the integer can be divided by 2 without remainder.  For example,   6 can be divided by 2 once: 6 -> 3 .  8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1 .  3 can be divided by 2 zero times.       Constraints  1 ≤ N ≤ 100         Input Input is given from Standard Input in the following format:  N       Output Print the answer.        Sample Input 1 7      Sample Output 1 4  4 can be divided by 2 twice, which is the most number of times among 1 , 2 , ..., 7 .       Sample Input 2 32      Sample Output 2 32       Sample Input 3 1      Sample Output 3 1       Sample Input 4 100      Sample Output 4 64

Solution (Python):
N=int(input())
lis=[]
for i in range(1,N+1):
    for j in range(N):
        if i%(2**j)==0:
            lis.append(j)
print(2**max(lis))

Solution (Python):
import math
N=int(input())
a=[]
for i in range(1,N+1):
    if math.log2(i)%1==0:
        a.append(i)
print(a[len(a)-1])

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

exp = 0
while 2 ** (exp + 1) <= n:
    exp += 1
print(2 ** exp)

Solution (Python):
N = int(input())
for i in range(1,10):
    if N < 2**i:
        ans = 2**(i-1)
        break
print(ans)

Solution (Python):
n=int(input());print([2**i for i in range(n) if 2**i<=n][-1])

Solution (Python):
ans,result=0,0
for i in range(1,int(input())+1):
  count=0
  num=i
  while num%2==0:
    num//=2
    count+=1
  if ans < count:
    ans=count
    result=i
print(1 if not (ans and result) else result)

Solution (Python):
n = int(input())
l = []

for i in range(n+1):
    if 2**i <= n:
        l.append(2**i)
    
print(max(l))

Solution (Python):
N = int(input())
for i in range(N):
    if N <= 2:
        print(N)
        exit()
    elif 2 ** i > N:
        print (2 ** (i - 1))
        exit()

Solution (Python):
n=int(input())
c=0
while n>=2:
    n/=2
    c+=1
print(2**c)

Solution (Python):
import numpy as np
n = int(input())
array = [0]*n

for i in range(1, n+1):
  count = 0
  num = i
  while num%2==0:
    count += 1
    num = int(num/2)
  array[i-1] = count
print(1+np.argmax(array))

Solution (Python):
N = int(input())
m = 1
d_cnt = 0
for i in range(1, N+1):
    num = i
    cnt = 0
    while True:
        if num % 2 == 0:
            num /= 2
            cnt += 1
        else:
            break
    if d_cnt < cnt:
        d_cnt = cnt
        m = int(i)
print(m)

Solution (Python):
n = int(input())
i = 1
while 2**i <= n:
    i += 1
print(2**(i-1))

Solution (Python):
n=int(input())

d={"num":1,"ans":1}
for i in range(1,n+1):
  if i%2==0:
    num=i
    ans=0
    while i%2==0:
      i=i/2
      ans+=1
    if ans>=d["ans"]:
      d["num"]=num
      d["ans"]=ans
    
print(d["num"])

Solution (Python):
n = int(input())
for i in range(1, n+1):
    if 2 ** i > n:
        print(2**(i-1))
        exit()

Solution (Python):
n = int(input())
for i in range(1,8) :
    if 2**i > n :
        print(2**(i-1))
        exit()

Solution (Python):
n=int(input())
q=0
ans=1
for i in range(1,n+1):
    m=i
    p=0
    while(m%2==0):
        m//=2
        p+=1
    if q!=max(q,p):
        ans=i
        q=max(q,p)
print(ans)

Solution (Python):
N = int (input ())
x = 1
while x <= N:
  x = x*2
print (round (x/2))

Solution (Python):
N = int(input())
for i in range(1,10):
    if N < 2 ** i:
        print(2 ** (i - 1))
        break

Solution (Python):
n=int(input())
anslist=[1,2,4,8,16,32,64]
ans=0
for i in anslist:
    if n>=i:
        ans=i
print(ans)

Solution (Python):
N = int(input())
dic = {}
for i in range(1, N+1):
  n = i 
  cnt = 0
  while i % 2 == 0:
    cnt += 1
    i = i // 2
  dic[n] = cnt

a = 0
b = 0
for k, v in dic.items():
  if a < v:
    b = k
    a = v

if b == 0:
  print(1)
else:
  print(b)

Solution (Python):
def gusuuhantei(i):
    count = 0
    num = i
    while True:
        if num % 2 ==0 and not num == 0:
            num = num / 2
            count += 1
        else:
            break
    return count
N = int(input())
li = [-1]*(N+1)
for i in range(1, N+1):
    li[i] = gusuuhantei(i)
Maxcount = max(li)
index = li.index(Maxcount)
print(index)

Solution (Python):
def gusuuhantei(i):
    count = 0
    num = i
    while True:
        if num % 2 ==0 and not num == 0:
            num = num / 2
            count += 1
        else:
            break
    return count
N = int(input())
li = [0]*(N+1)
for i in range(N+1):
    li[i] = gusuuhantei(i)
Maxcount = max(li)
index = li.index(Maxcount)
if N == 1:
    print(1)
else: 
    print(index)

Solution (Python):
n = int(input())
ans = 1
while ans*2 <= n:
    ans = ans*2
print(ans)

Solution (Python):
n = int(input())
a = 0
while 2**a <= n:
    a += 1 
print(2**(a-1))

Solution (Python):
n=int(input())
a=[2**i for i in range(6,-1,-1)]
for i in a:
    if n>=i:
        print(i)
        break

Solution (Python):
n=int(input())
if n>=64:
    print(64)
elif n>=32:
    print(32)
elif n>=16:
    print(16)
elif n>=8:
    print(8)
elif n>=4:
    print(4)
elif n>=2:
    print(2)
else:
    print(1)

Solution (Python):
N = int(input())
n = 1
a = 0
while n <= N:
    n *= 2
    if n > N:
        break
    else:
        a += 1
ans = int(n / 2)
print(ans)

Solution (Python):
n = int(input())

for i in range(6, -1, -1):
    tmp = 2**i
    if n >= tmp:
      print(tmp)
      exit()

Solution (Python):
n = int(input())
count = 0
while True:
    count += 1
    if n < 2**count:
        print(2**(count-1))
        break

Solution (Python):
N = int(input())
x = 2
for i in range(100):
    if x**i > N:
        ans = x**(i-1)
        break
print(ans)

Solution (Python):
N = int(input())
ans = 1
while ans*2 <= N:
  ans *= 2
print(ans)

Solution (Python):
N = int(input())
if N==1:
    print(1)
else:
    k = 1
    while 2**k<=N:
        k += 1
    print(2**(k-1))

Solution (Python):
N = int(input())

x = 1
while True:
    if x * 2 > N:
        break
    x *= 2

print(x)

Solution (Python):
n=int(input())
max_n=1
max_c=0

for i in range(n+1):
  c=0
  num=i
  while True:
    if num/2==0:
      break
      
    if num%2==0:
      c+=1
      num=num/2     
    else:
      break
      
  if c > max_c:
    max_c=c
    max_n=i
    
print(max_n)

Solution (Python):
N = int(input())
for n in range(7):
    if 2 ** n <= N:
        ans = 2 ** n
print(ans)

Solution (Python):
import numpy as np

N = int(input())

Ns = [i for i in range(1,N+1)]

counts = []
for N in Ns:
    count = 0
    while N % 2 == 0:
        N //= 2
        count += 1
    counts.append(count)

print(Ns[np.argmax(counts)])

Solution (Python):
n=int(input())
A=[]
a=0
i=0
while a*2 <= n:
    a = 2**i
    A.append(a)
    i=i+1
print(A[-1])

Solution (Python):
import numpy as np

N=int(input())
count=[]
for n in range(1,N+1):
    count_n=0
    while n%2==0:
        n=n/2
        count_n+=1
    count.append(count_n)

answer=count.index(max(count))+1
print(answer)

Solution (Python):
n = int(input())
ans = 1
maxnum_devide = 0
for num in range(2, n+1):
  target = num
  num_devide = 0
  while target % 2 == 0:
    target /= 2
    num_devide += 1
  if num_devide > maxnum_devide:
    ans = num
    maxnum_devide = num_devide
print(ans)

Solution (Python):
n = int(input())

for i in range(8):
    if 2**i> n:
        break

print(2**(i-1))

Solution (Python):
n = int(input())
print(2**(len(bin(n))-3))

Solution (Python):
N=int(input())

for i in range(1,8):
  if N<2**i:
    print(2**(i-1))
    break

Solution (Python):
ma=-1
for i in range(1,int(input())+1):
  cnt=0
  x=i
  while x&1==0:
    x//=2
    cnt+=1
  if ma<cnt:
    ma=cnt
    ans=i
print(ans)

Solution (Python):
n = int(input())

if n >= 64:
      print(64)
elif n >= 32:
      print(32)
elif n >= 16:
      print(16)
elif n >= 8:
      print(8)
elif n >= 4:
      print(4)
elif n >= 2:
      print(2)
else:
      print(1)

Solution (Python):
N = int(input())

if N >= 64:
    print(64)
elif N >= 32:
    print(32)
elif N >= 16:
    print(16)
elif N >= 8:
    print(8)
elif N >= 4:
    print(4)
elif N >= 2:
    print(2)
else:
    print(1)

Solution (Python):



import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """7"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """32"""
        output = """32"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """100"""
        output = """64"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    ans = 1
    while ans * 2 <= N:
        ans *= 2
    print(ans)


if __name__ == "__main__":
    
    resolve()

Solution (Python):



import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """7"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """32"""
        output = """32"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """100"""
        output = """64"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    ans = 1
    while ans * 2 <= N:
        ans = ans * 2
    print(ans)


if __name__ == "__main__":
    
    resolve()

Solution (Python):
n=int(input())
for i in range(1,7):
  if 2**i>n:
    print(2**(i-1))
    break
else:
  print(2**i)

Solution (Python):
N = int(input())
powlist = []
for i in range(7):
    powlist.append(2 ** i)
ans = 1
for p in powlist:
    if N >= p:
        ans = p
print(ans)

Solution (Python):
n = int(input())
for i in range(10):
    if 2**i>n:
        print(2**(i-1))
        break

Solution (Python):
n=int(input())
for i in range(10):
    if 2**i>n:
        ans=i-1
        break
print(2**ans)

Solution (Python):
N = int(input())
cnt = 0
for i in range(1,N+1):
    if len(bin(i))-bin(i).rfind("1") >= cnt:
        cnt += 1
        ans = i
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(8):
    if 2**i <= N:
        ans = 2**i
print(ans)

Solution (Python):
N = int(input())

ans_list = [1, 2, 4, 8, 16, 32, 64]

for n in ans_list:
    if (n <= N):
        ans = n

print(ans)

Solution (Python):
N = int(input())
n = 0
while 2**(n+1) <= N:
    n += 1

print(2**n)

Solution (Python):
def divide_by_2(num):
	cnt = 0		

	while True:
		if num % 2 != 0:
			break
		num /= 2
		cnt += 1
	
	return cnt


def main():
	N = int(input())

	lst = [-1] * (N + 1)

	for num in range(1, N + 1):
		cnt = divide_by_2(num)
		lst[num] = cnt

	print(lst.index(max(lst)))


  
if __name__ == "__main__":
  	main()

Solution (Python):
def divide_by_2(num):
	cnt = 0		

	while True:
		if num % 2 != 0:
			break
		num /= 2
		cnt += 1
	
	return cnt



def main():
	N = int(input())

	max_cnt = -1
	ans = 0

	for num in range(1, N + 1):
		cnt = divide_by_2(num)

		if max_cnt < cnt:
			max_cnt = cnt
			ans = num

	print(ans)


  
if __name__ == "__main__":
  	main()

Solution (Python):
N=int(input())
if N==1:
  print(1)
  exit()
L=[1,2,4,8,16,32,64,128]
for i in range(7):
  if L[i+1]>N:
    print(L[i])
    exit()

Solution (Python):
n = int(input())
num = [1,2,4,8,16,32,64,101]
for i in range(7):
    if num[i] <= n < num[i+1]:
        print(num[i])

Solution (Python):
N = int(input())
AA = [2,4,8,16,32,64]

if N >=64:
    print(64)

elif N in AA:
    print(N)

else:
    for i in range(6):
        num = AA[i]
        if num < N:
            pass

        elif num > N:
            print(round(num/2))
            break

Solution (Python):
import math;print(int(2**(math.log2(int(input()))//1)))

Solution (Python):
n = int(input())
a = 1
while True:
  if n < 2 ** a:
    break
  a += 1
print(2**(a-1))

Solution (Python):
import math
print 2 ** int(math.floor(math.log(int(raw_input()),2)))

Solution (Python):
import math
print 2 ** int(math.floor(math.log(int(raw_input()),2)))

Solution (Python):
n = int(input())
ans = 1
while True:
    ans *= 2
    if ans > n:
        ans = ans // 2
        break
print(ans)

Solution (Python):
import math
n = int(input())
r = math.floor(math.log2(n))

print(2 ** r)

Solution (Python):
n=int(input())
a=2
while a<=n:
    a*=2
print(a//2)

Solution (Python):
n = int(input())
best = 0
for i in range(2, n+1, 2):
	c = 0
	j = i
	while(j % 2 == 0):
		j = j // 2
		c += 1
	best = max(best, c)
print(2 ** best)

Solution (Python):
N=int(input())
if N<2:
  print(1)
elif N<4:
  print(2)
elif N<8:
  print(4)
elif N<16:
  print(8)
elif N<32:
  print(16)
elif N<64:
  print(32)
else:
  print(64)

Solution (Python):
import math
print(2**math.floor(math.log2(int(input()))))

Solution (Python):
N = int(input())

l = N.bit_length()

print(2 ** (l-1))

Solution (Python):
N = int(input())
x = 1

while x <= N:
    x *= 2
    
 
print(x // 2)

Solution (Python):

N = int(input())

result = 0
for i in range(7):
    if 2**i <= N:
        result = i
    else:
        break
print(2**result)

Solution (Python):
import sys
n = int(input())






if n == 1:
    print(1)


if 2 <= n and n < 4:
    print(2)
elif 4 <= n and n < 8:
    print(4)
elif 8 <= n and n < 16:
    print(8)
elif 16 <= n and n < 32:
    print(16)
elif 32 <= n and n < 64:
    print(32)
elif 64 <= n and n <= 100:
    print(64)

Solution (Python):
N=int(input())
print(2**(N.bit_length()-1))

Solution (Python):
x = [2 ** i for i in range(20)]
N = int(input())
for j in range(len(x)):
  if x[j] <= N < x[j + 1]:
    print(x[j])
    break

Solution (Python):
N = int(input())
X = 1
while(True):
    if X * 2 > N:
        print(X)
        exit()
    X *= 2

Solution (Python):
N = int(input())
for i in range(10):
  if 2**i <= N and 2**(i+1) > N:
    ans = 2**i
    break
print(ans)

Solution (Python):










n = int(input())

ans = 0
totalNum = -1
for i in range(1,n+1):
    temp = i
    num = 0
    while True:
        if (temp % 2 != 0):
            break
        else:
            temp = temp // 2
            num+=1
    if (totalNum < num):
        totalNum = num
        ans = i
print(ans)

Solution (Python):
import math


def resolve():
    import sys
    input = sys.stdin.readline
    
    n = int(input().rstrip())
    max_count = 0
    ans = 1
    for i in range(1, n+1):
        num = i
        count = 0
        while(num % 2 == 0):
            count += 1
            num = int(num / 2)
        if count > max_count:
            max_count = count
            ans = i
        
    print(ans)


if __name__ == "__main__":
    resolve()

Solution (Python):
N=int(input())
ct=0
while N>1:
  N=N//2
  ct+=1
print(2**ct)

Solution (Python):
n = int(input())
if 2 <= n < 4:
  print(2)
elif 4 <= n < 8:
  print(4)
elif 8 <= n < 16:
  print(8)
elif 16 <= n < 32:
  print(16)
elif 32 <= n < 64:
  print(32)
elif 64 <= n:
  print(64)
else:
  print(1)

Solution (Python):
s = input()
a = int(s)
b = 1
while b <= a:
  b = b * 2

print(int(b/2))

Solution (Python):
N = int(input())
for i in [2**x for x in range(0, 9)]:
    if i <= N:
        r = i
print(r)

Solution (Python):
N = int(input())
cur = 1

for i in range(1, 10):  
  if cur > N:
    print(cur//2)
    exit()
  cur *= 2

Solution (Python):
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()

m = 0
ans = 1

for i in range(1,n+1):
    if i % 2 == 1:
        continue
    cnt = 0
    t = i
    while t % 2 == 0:
        t //= 2
        cnt += 1
    if cnt > m:
        ans = i
        m = cnt

print(ans)

Solution (Python):
n=int(input())
i=0
while not 2**i<=n<2**(i+1):
    i+=1
print(2**i)

Solution (Python):
N = int(input())
mx=0
maxcnt=0
for i in range(1,N+1):
    cnt=0
    while True:
        if i%2==0:
            i/=2
            cnt+=1
        else:
            if cnt>=maxcnt:
                mx=i*2**cnt
                maxcnt=cnt
            break
print(int(mx))

Solution (Python):
N = int(input())
for i in range(6, -1, -1):
    if 2**i > N:
        continue
    print(2**i)
    break

Solution (Python):
n=int (input())
for i in range(8):
    if 2**i<=n<2**(i+1):
        print(2**i)

Solution (Python):
n = int(input())
cnt = 1
while cnt <= n:
    cnt *= 2
print(cnt//2)

Solution (Python):
n = int(input())
a = 1
while a <= n:
    a *= 2
    
print(a//2)

Solution (Python):
n=int(input())
ans=0
while 2**ans<=n:
  ans+=1
print(int(2**(ans-1)))

Solution (Python):
N = int(input())

exp = N.bit_length() - 1

print(2**exp)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    ans = 1
    while ans <= N: ans *= 2
    print(ans // 2)

if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
for i in reversed(range(7)):
	if n>=2**i:
		print(2**i)
		quit()

Solution (Python):
n = int(input())
ans = 1
while ans <= n:
  ans *= 2
print(ans // 2)

Solution (Python):
n = int(input())
for i in range(1,8):
  if 2**i > n:
    print(2**(i-1))
    exit()

Solution (Python):
n=int(input())
m=0
a=1
for i in range(1,n+1):
    c=0
    j=i
    while 1:
        j/=2
        if j%1==0:
            c+=1
        else:
            break
    if m<c:
        m=c
        a=i
print(a)

Solution (Python):
n=int(input())
res=1
for i in range(n):
    x=2**i
    if x>n:
        res=2**(i-1)
        break
print(res)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n+1):
  cnt = 0
  x = i
  while x % 2 == 0:
    x //= 2
    cnt += 1
  ans = max(ans, cnt)
print(2 ** ans)

Solution (Python):
N = int(input())
count_max = 0
count_i = 0

for i in range(1,N+1):
  count = 0
  ii = i
  for j in range(i):
    if i%2 == 0:
      i = int(i/2)
      count += 1
    else:
      break
  if count > count_max:
    count_max = count
    count_i = ii
  elif i == 1:
    count_i = 1
print(count_i)

Solution (Python):
n = int(input())
A = [0]*n
for i in range(n):
    count = 0
    flg_odd = 0
    l = i
    i = i+1
    while(True):
        if ( i%2 != 0):
            flg_odd = 1
        if ( flg_odd == 1):
            A[l] = count
            break
        i = i//2
        count += 1
m = A.index(max(A))
print(m+1)

Solution (Python):
n = int(input())
ans = 1
elem_list = []

for i in range(7):
    elem_list.append(2**i)

for i in elem_list[::-1]:
    if i <= n:
        print(i)
        break

Solution (Python):

















import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
val = 1
ans = 1

while True:
    if val <= N:
        ans = val
    else:
        break
    val *= 2

print(ans)

Solution (Python):
N = int(input())

n = 1

for _ in range(N):
    n *= 2
    if n > N:
        print(n // 2)
        exit()

Solution (Python):
n = int(input())
result = 0
if n == 1:
	print(1)
else:
	while(True):
		if 2 ** result == n:
			break
		if 2 ** result > n:
			result -= 1
			break
		result += 1
	print(2 ** result)

Solution (Python):
n = int(input())
result = 0
while(True):
	if 2 ** result == n:
		break
	if 2 ** result > n:
		result -= 1
		break
	result += 1
print(2 ** result)

Solution (Python):
n=int(input())
i=1
while n>=i:
  i*=2
print(i//2)

Solution (Python):
N=int(input())
res=1
while res<=N//2:
    res*=2

print(res)

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    n = int(input())
    for i in range(8):
        if 2**i > n:
            print(2**(i-1))
            return


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
cnt = []

for i in range(1,N+1):
    for j in range(7):
        if i % 2**j == 0:
            cnt.append(2**j)
            
print(max(cnt))

Solution (Python):
N=int(input())
L=[]
for i in range(1,N):
  if 2**i<=N:
    L.append(2**i)

if N==1:
  print(N)
else:
  print(max(L))

Solution (Python):
def Dev2Count(N):
    Count = 0
    while True:
        if N%2==0:
            Count += 1
            N //= 2
        else:
            break
    return Count
  
N = int(input())
print(2**max(Dev2Count(T) for T in range(1,N+1)))

Solution (Python):
n = int(input())
p = 1
while p*2<=n:
	p = p*2
print(p)

Solution (Python):

 

 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools


 








N=int(input())


while N>0:
    tmp = N
    while tmp%2 == 0:
        tmp = tmp//2
    if tmp == 1:
        print(N)
        sys.exit()
    N -= 1

Solution (Python):
n=int(input())
i=0
while n-2**i>=0:
  i+=1
print(2**(i-1))

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    
    
    for n in range(N, 0, -1):
        m = n
        while m % 2 == 0:
            m //= 2
        if m == 1:
            ans = n
            break
        
    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
l=[1,2,4,8,16,32,64,128]
ans=0
for i in l:
  if n < i:
    print(ans)
    exit()
  ans=i

Solution (Python):
N=int(input())
for i in range(100):
    t=2**i
    if t>N:
        print(2**(i-1))
        exit()

Solution (Python):
n=int(input())
for i in range(7):
  if 2**i<=n<2**(i+1):
    print(2**i)

Solution (Python):
n = int(input())
for i in range(1,8):
    if n == i:
        ans = 1
        break
    if 2**i > n:
        ans =2**(i-1)
        break
print(ans)

Solution (Python):
n = int(input())
result = 0
for x in range(100):
  if (1 << x) <= n and n <= (1 << (x+1)):
    result = 1 << x

print(result)

Solution (Python):
N = int(input())

ans = 0

kk = 1
for x in range(1, N + 1):
    ans_ = 0
    k = x
    for y in range(999):
        if x % 2 == 0:
            x /= 2
            ans_ += 1
        else:
            break
    if ans_ > ans:
        ans = ans_
        kk = k
print(kk)

Solution (Python):
def div2_count(n):
  if n % 2 != 0: return 0
  else: return 1 + div2_count(n / 2)
 
N = int(input())
ans = 1
count = 0
 
for i in range(N, 1, -1):
  tmp = div2_count(i) 
  if tmp > count: 
    ans = i
    count = tmp
    
print(ans)

Solution (Python):
def div_by_two(n):
  if n % 2 == 1:
    return 0
  else:
    return div_by_two(n / 2) + 1
  
N = int(input())
count = 0
res = 1
for i in range(1, N+1):
  tmp = div_by_two(i)
  if tmp > count: 
    res = i
    count = tmp 

print(res)

Solution (Python):

N = int(input())

cnt = 0
while True:
    X = 2**cnt
    if N//2 >= X:
        cnt +=1
    else:
        break
print(X)

Solution (Python):


N = int(input())

i = 1
while i <= N:
    ans = i
    i = i * 2

print(ans)

Solution (Python):
n = int(input())

two = 1
while two * 2 <= n:
    two *= 2

print(two)

Solution (Python):
A = int(input())
chek = 1
res = 0
for i in range(10):
  chek = 2**i
  if chek > A:
    res = 2**(i-1)
    break
print(res)

Solution (Python):
N = int(input())

max_num = -1
max_count = -1
for num in range(1,N+1):
    num_orig = num
    count = 0
    while 1:
        amari = num%2
        if amari == 0:
            num = num // 2
            count += 1
        else:
            break
    if count > max_count:
        max_num = num_orig
        max_count = count

print(max_num)

Solution (Python):
import math

print(2 ** int(math.log2(int(input()))))

Solution (Python):
N = int(input())
max_count = 0
for i in range(1,N+1):
    count = 0
    kari = i
    while True:
        if kari % 2 == 0:
            count += 1
            kari /= 2
        else:
            break
    if count > max_count:
        max_count = count
        ans = i
if N != 1:
 print(ans)
else:
    print(1)

Solution (Python):

N = int(input())

for i in range(7):
    if N >= 2**i:
        M = 2**i
print(M)

Solution (Python):
N = int(input())

import math
print(2**int(math.log2(N)))

Solution (Python):
N = int(input())
n = 0
while True:
  if 2**0 <= N <2**(n+1):
    break
  else:
    n +=1
print(2**n)

Solution (Python):
n = int(input())
ans = 1
while ans <= n:
    ans *= 2
print(ans // 2)

Solution (Python):
N=int(input())
c=2
while N>=c:
    c=c*2

print(c//2)

Solution (Python):
n = int(input())

num_lists = list(range(1, n+1, 1))
count = 1
while len(num_lists) != 1:
  num_lists = [i for i in num_lists if i%2**count == 0]
  count += 1
print(num_lists[0])

Solution (Python):
N = int(input())

ans = 1
for i in range(101):
    if (ans * 2  > N):
        print(ans)
        exit()
    else:
        ans *= 2

Solution (Python):
n = int(input())
x = 1
for i in range(10):
    x_nxt = x * 2
    if x_nxt > n:
        break
    x = x_nxt
print(x)

Solution (Python):
print(2**(len(bin(int(input())))-3))

Solution (Python):
n=int(input())
if n>2 and n%2!=0:
    n-=1
cnt=1
ans=n
for i in range(1,n+1)[::-2]:
    j=i
    tmp=0
    while j>0 and j%2==0:
        tmp+=1
        j=j//2
    if tmp > cnt:
        cnt=tmp
        ans=i
print(ans)

Solution (Python):
print(2**(len(bin(int(input())))-3))

Solution (Python):
n = int(input())
s=[]
for i in range(n+1):
  for j in range(n+1):
    if 2**j==i :
      s.append(i)

print(max(s))

Solution (Python):
N=int(input())
if N==1:
  print(1)
elif 1<N<=3:
  print(2)
elif 4<=N<8:
  print(4)
elif 8<=N<16:
  print(8)
elif 16<=N<32:
  print(16)
elif 32<=N<64:
  print(32)
else:
  print(64)

Solution (Python):
def divi(n):
  ans = 0
  a2 = 0 
  while n >= 2 ** a2:
    ans = 2 ** a2
    a2 += 1
  return ans

    
N = int(input())

answ = divi(N)
print(answ)

Solution (Python):
L = [2, 4, 8, 16, 32, 64]
n = int(input())

if n == 1:
  print(1)
  exit(0)

ans = 0
for l in L:
  if n < l:
    break
  ans = l

print(ans)

Solution (Python):
from math import floor, log2
n = int(input())
print(2 ** floor(log2(n)))

Solution (Python):
N=int(input())
list=[]
for i in range(7):
    s=2**i
    if s<=N:
        list.append(s)
    else:
        break
print(max(list))

Solution (Python):
s = input()
p = int(s)

x = 1

numbers = []

while (x <= p):
    x *= 2
    numbers.append(x)

if p == 1:
    answer = 1
else:
    y = numbers.pop()
    answer = numbers.pop()

print(answer)

Solution (Python):
N = int(input())

def solve(x):
    global res
    if x % 2 == 1:
        return res
    x = x // 2
    res += 1
    solve(x)

ans = []
for i in range(1, N+1):
    res = 0
    solve(i)
    ans.append([i, res])

ans = sorted(ans, key=lambda x:x[1], reverse=True)
print(ans[0][0])

Solution (Python):
N = int(input())
max_cnt = 0
ans = 0
for n in range(1, N+1):
    cnt = 0
    for div in range(0, 7):
        if n % 2**div == 0:
            cnt += 1
    if cnt > max_cnt:
        max_cnt = cnt
        ans = n
print(ans)

Solution (Python):
n = int(input())
ans = 1
while ans*2<=n:
    ans *= 2
print(ans)

Solution (Python):
def actual(N):
    max_count = 0

    for n in range(1, N + 1):
        i = n

        count = 0

        while n % 2 == 0:
            count += 1
            n //= 2

        if count >= max_count:
            max_count = count
            answer = i

    return answer

N = int(input())
print(actual(N))

Solution (Python):
n = int(input())

max_t = 0
ans = 1

for i in range(2, n + 1, 2):
    t = 0
    j = i
    while j % 2 == 0:
        j //= 2
        t += 1
    else:
        if max_t < t:
            max_t = t
            ans = i
else:
    print(ans)

Solution (Python):
n = int(input())
if n == 1:
    print(1)
else:
    times = []
    for i in range(2, n + 1, 2):
        t = 0
        while i % 2 == 0:
            i //= 2
            t += 1
        else:
            times.append(t)
    else:
        print((times.index(max(times)) + 1) * 2)

Solution (Python):
N=int(input())
print(2**(N.bit_length()-1))

Solution (Python):
import math
N=int(input())
print(2**int(math.log2(N)))

Solution (Python):
import numpy as np
N=int(input())
print(2**int(np.log2(N)))

Solution (Python):
N=int(input())
div=1
while div*2<=N:
    div*=2
print(div)

Solution (Python):
N=int(input())
div=1
index=0
while div<=N:
    index+=1
    div=2**index
print(div//2)

Solution (Python):
N=int(input())
div=1
for i in range(7):
    if 2**i<=N:
        div=2**i
print(div)

Solution (Python):
N=int(input())
print(2**(len(bin(N))-3))

Solution (Python):
n = int(input())
a = 1
while True:
    a *= 2
    if n < a:
        print(int(a / 2))
        break

Solution (Python):
N = int(input())

if N < 2:
  print(1)
elif N < 4:
  print(2)
elif N < 8:
  print(4)
elif N < 16:
  print(8)
elif N < 32:
  print(16)
elif N < 64:
  print(32)
elif N < 128:
  print(64)

Solution (Python):
N = int(input())

ans = 1
while 2*ans <= N:
    ans *= 2
print(ans)

Solution (Python):


N = int(input())
ls = []
for i in range(0,8):
    ls.append(2**i)

ans = 0
for x in range(len(ls)):
    if ls[x] <= N:
        ans = ls[x]
print(ans)

Solution (Python):
n = int(input())
a=0
for i in range(10):
  x = 2 ** i
  if x <=n:
    a=x
    
print(a)

Solution (Python):
N = int(input())
n = 0 
i = 1
while i <= N:
  n=n+1
  i=2**n
print(2**(n-1))

Solution (Python):
n = int(input())
count = [0] * n
for i in range(n) :
    for j in range(6, -1, -1) :
        if (i+1) % 2**j == 0 :
            count[i] = j
            break
max = max(count)
print(count.index(max)+1)

Solution (Python):
N = int(input())

res = 1
while (res << 1) <= N:
    res = res << 1
print(res)

Solution (Python):
n = int(input())

if n == 1:
    ans = 1
else:
    i = 0
    now = 1
    while now < n:
        now *= 2
        i+=1
    if now > n:
        ans = now//2
    else:
        ans = now
print(ans)

Solution (Python):
N=input()
N=int(N)
n=0
i=1
while i<=N:
  n=n+1
  i=2**n
print(2**(n-1))

Solution (Python):
n = int(input())
i = 0
while(2**i <= n ):
    i += 1   
print(2**(i-1))

Solution (Python):
import math
N = int(input())
judge_l = [pow(2,i) for i in range(0,10) if pow(2,i) <= N]
print(judge_l[-1])

Solution (Python):
N = int(input())
a = 1
while a*2 <= N:
    a *= 2
print(a)

Solution (Python):
n = int(input())

ans = 0
t = 0
for i in range(1, n+1):
    a = i
    tmp = 0
    while i % 2 == 0:
        tmp += 1
        i //= 2
    if tmp >= t:
        t = tmp
        ans = a

print(ans)