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())

tmp = 0
ans = 0
if n == 1:
    print(1)
    exit()
for i in range(1, n + 1):
    tmp2 = 0
    while True:
        if i % 2 == 1:
            break
        else:
            i /= 2
            tmp2 += 1
    if tmp2 > tmp:
        tmp = tmp2
        ans = i * pow(2, tmp2)
print(int(ans))

"""
count = []
for i in range(1,n + 1):
    count.append([0, i])

for i in range(n):
    tmp = 0
    while True:
        if count[i][1] == 2 ** tmp:
            count[i][0] = tmp
            break
        elif count[i][1] > 2 ** tmp:
            tmp += 1
        else:
            break

count.sort()
print(count[n - 1][1])
"""

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

dic = sorted(dic.items(),key=lambda x:x[1],reverse=True)

print(dic[0][0])

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

for i in range(7):
    if 2 ** i <= n < 2 ** (i+1):
        print(2 ** i)
    else:
        pass

Solution (Python):
N = int(input())
ans = 64
 
while ans > N:
    ans /= 2
    
print(int(ans))

Solution (Python):
n = int(input())
ans = 64
 
while ans > n:
    ans /= 2
    
print(int(ans))

Solution (Python):
n=int(input())
cnt=0
tmp=0
ans=0
for i in range(n):
            if 2**i>=n:              
                        break

if 2**i==n:
            print(n)
else:
            print(2**(i-1))

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

Solution (Python):
N = int(input())
A = [2**i for i in range(10) if 2**i < 129]

for index,i in enumerate(A):
    if N < i:
        print(int(i/2))
        break

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

count = 0
mx = -1
ans = 1

for i in range(1,n+1):
    buf = i
    while(buf >= 2):
        buf //= 2
        count += 1
        if count > mx:
            ans = i
            mx = count
    count = 0

print(ans)

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

Solution (Python):
n = int(input())
if n < 2 ** 1:
    print(2**0)
elif n < 2 ** 2:
    print(2 ** 1)
elif n < 2 ** 3:
    print(2 ** 2)
elif n < 2 ** 4:
    print(2 ** 3)
elif n < 2 ** 5:
    print(2 ** 4)
elif n < 2 ** 6:
    print(2 ** 5)
elif n <= 100:
    print(2 ** 6)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n+1):
    count = 0
    for j in range(8):
        if i%2 == 0:
            i /= 2
            count += 1
    ans = max(ans, count)
print(2**ans)

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

i=0
while pow(2,i)<=N:
    i+=1
print(pow(2,(i-1)))

Solution (Python):
N = int(input())
max1 = -1
max_N = -1
while(N>0):
    cnt = 0
    temp = N
    while(temp!=1):
        if temp%2!=0:
            break
        temp //= 2
        cnt += 1
    if max1 < cnt:
        max1 = cnt
        max_N = N
    N -= 1
print(max_N)

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

import copy

ans = 0
ans_c = 0

for i in reversed(range(n)):
    check = copy.copy(i)
    div = 0
    count = 0

    while div == 0:
        div = (i % 2)
        i = i // 2
        if div == 0:
            count += 1
        if i == 0:
            break
    if ans_c < count:
        ans = check
        ans_c = count
if ans == 0:
     ans += 1
        
print(ans)

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

m_count = 0
t_num = 1
for r in range(1, n+1):
    flg = True
    t_count = 0
    tr = r
    while(flg):
        if tr // 2 > 0:
            t_count += 1
            tr //= 2
        else:
            flg = False
    if m_count < t_count:
        m_count = t_count
        t_num = r
print(t_num)

Solution (Python):
def main():
    import sys
    
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    
    from itertools import combinations, permutations
    
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    

    

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

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
res=0
ans=0
for i in range(1,N+1):
    cnt=0
    t=i
    while(t%2==0):
        t//=2
        cnt+=1
    res=max(cnt,res)
    if(res==cnt):
        ans=i
print(ans)

Solution (Python):
N=int(input())
ans=64
while ans>N:
    ans=ans/2
print(int(ans))

Solution (Python):


n = int(input())

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

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

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

max_cnt = 0
max_num = 1
for n in range(1, N+1, 1):
  
  orig_n = n
  cnt = 0
  while True: 
    if n % 2 == 0:
      
      n /= 2
      cnt += 1
    else:
      if cnt > max_cnt:
        max_cnt = cnt
        max_num = orig_n
        
      break

print(max_num)

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

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

while ans > n:
    ans /= 2
    
print(int(ans))

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

max_count = 0
ans = 1

def div2(x, count):
    x, mod = divmod(x, 2)
    if mod != 0:
        return count
    else:
        if x == 1:
            return count+1
        return div2(x, count+1)
for x in range(1, N+1):
    count = div2(x, 0)
    
    if count > max_count:
        max_count = count
        ans = x
    
print(ans)

Solution (Python):


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

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

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

Solution (Python):

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    ans=1
    N=I()
    for i in range(10):
        ans*=2
        if ans>N:
            break
    print(ans//2)

main()

Solution (Python):
n = int(input())
import numpy as np
a = list(range(1,n+1))
b = list(range(1,n+1))
c = [0] * n
for i in range(n):
  while a[i] % 2 == 0:
    a[i] /= 2
    c[i] += 1
print(b[np.argmax(c)])

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):

n=int(input())
ans=1
for i in range(10):
    if 2**i<=n:
        ans=2**i
print(ans)

Solution (Python):
n = int(input())
x = 1
while x <= n:
    x *= 2
    if x > n:
        print(x//2)
        exit()

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

Solution (Python):
n = int(input())
l = [_ for _ in range(1,n+1)]

x = []
for i in range(1,n+1):
    a = 0
    b = i
    for j in range(int(n**0.5)):
        if b%2 == 0:
            a += 1
            b = b/2
    x.append(a)

c = x.index(max(x))

print(l[c])

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

Solution (Python):
n = int(input())
max_count = 0
max_elem = 1
for i in range(1, n+1):
    j = i
    j_count = 0
    while j%2 == 0:
        j = j / 2
        j_count = j_count+1
    if max_count < j_count:
        max_count = j_count
        max_elem = str(i)
print(max_elem)

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

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

print(ans)

Solution (Python):
ans=0
ans2=1
for i in range(1,int(input())+1):
  tmpN = i
  c = 0
  while tmpN % 2 ==0:
    c +=1
    tmpN = tmpN//2
  if ans < c:
    ans = c
    ans2 = i
print(ans2)

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

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

Solution (Python):
N = int(input())
res = 1
while True:
    val = 2 * res
    if val <= N:
        res = val
    else:
        break
print(res)

Solution (Python):
n, mxcnt, ans = int(input()), int(), 1

for i in range(1, n + 1):
    cnt = 0
    ii = i
    while (ii / 2) >= 1:
        ii /= 2
        cnt += 1
    if cnt > mxcnt:
        mxcnt = cnt
        ans = i

print(ans)

Solution (Python):
n = int(input())
dic = {}

for i in range(1, n+1):
    if i % 2 == 0:
        a = i
        cnt = 0
        while a % 2 == 0:
            a = a / 2
            cnt += 1
        dic.update({i: cnt})

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

print([i for i in dic if dic[i] == max(dic.values())][0])

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

ans = 1
for i in [2,4,8,16,32,64]:
    if i <= n:
        ans = i

print(ans)

Solution (Python):
def main():
    limit = int(input())
    answer = 2
    while answer <= limit:
        answer *= 2
    print(answer // 2)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
def count(i):
    count = 0
    while(i%2 == 0):
        i = i/2
        count +=1
    return count

max = 0
number = 1
for j in range(1,n+1):
    if (count(j) > max):
        max = count(j)
        number = j
print(number)

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

Solution (Python):
N=int(input())
count=0
max=0


for a in range(1,N+1):
    while(a%2==0):
        a/=2
        count+=1
    if(max<count):
        max=count
    count=0

print(2**max)

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

def f(n):
    count=0
    repeat=True
    while n%2==0:
        n=n//2
        count+=1
    return count
       
max=0
number=1
for i in range(2,N+1):
    if f(i)>max:
        max=f(i)
        number=i
        

print(number)

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

while(2*n<=N):
    n*=2

print(n)

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

while(2*n<=N):
    n*=2

print(n)

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

Solution (Python):
n = int(input())
l = [i for i in range(1, n+1)]
tmp = [2**i for i in range(8)]

for i in range(len(tmp)):
    if tmp[i] not in l:
        print(tmp[i-1])
        exit()

Solution (Python):
N = int(input())
ans = 1
i = 0
while True :
    ans = 2 ** i
    if  ans > N :
        break
    i += 1
print(int(ans / 2))

Solution (Python):


N = int(input())

ans = 1
count = 0
for i in range(1, N + 1):
    c = 0
    tmp = i
    if tmp % 2 == 0:
        c += 1
        tmp /= 2
        while tmp % 2 == 0:
            c += 1
            tmp /= 2
    if count < c:
        ans = i
        count = c

print(ans)

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

Solution (Python):
n = int(input())
 
a = [2**i for i in range(7)]

print(max([x for x in a if x <= n]))

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

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

s = -1
for i in range(n):
    if 2**i <= n:
        s += 1
    else:
        break
print(2**s)

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

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

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

Solution (Python):
n = int(input())
ans, cnt = 1, 0
for i in range(1, n+1):
    k = i
    t = 0
    while k != 0:
        if k%2 == 0:
            k /=2
            t += 1
        else:
            break    
    if t > cnt:
        ans = i
        cnt = t
print(ans)

Solution (Python):



n=int(input())

def f(i):
  c=0
  while i>0:
    if i%2==0:
      c=c+1
      i=int(i/2)
    else:
      break
  return c

t=0
a=0
if n==1:
    print(1)
else:
    for i in range(n):
      fa=f(i+1)
      if t<fa:
        t=fa
        a=i+1

    print(a)

Solution (Python):

import math


n = int(input().strip())

nums={}
for i in range(1,n+1):
    count=0
    tmp=i
    while (tmp % 2) == 0:
        if tmp % 2 == 0:
            tmp //= 2
            count += 1
    
    nums[i]=count

max_k = max(nums, key=nums.get)
print(max_k)

Solution (Python):
n=int(input())
for i in range(0,n+1):
    if 2**i<=n and 2**(i+1)>n:
        print(2**i)
        exit(0)
    else:
        pass

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

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

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

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

ans = 1

for i in range(10) :
    if 2**i <= N :
        ans = i

print(2 ** ans)

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

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

i = 0
while True:
    if 2 ** i > n:
        break
    i += 1
print(2**(i-1))

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

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

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

print(2**(i-1))

Solution (Python):
A = int(input())
i = 0
while (2 ** i) <= A:
    if 2 ** i == A:
        print(A)
        break
    elif (2 ** i) < A:
        i += 1
        continue
else: print(2 ** (i - 1))

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

l = [2**i for i in range(8)]

if n==1:
  print(1)
  exit()
for i,v in enumerate(l):
  if n < v:
    print(l[i-1])
    exit()

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

Solution (Python):
n = int(input())
ans = 1
for i in range(10):
  if ans < n:
    ans *= 2
  elif ans > n:
    print(ans // 2)
    exit()
  else:
    print(ans)
    exit()

Solution (Python):
def breaknumbeer(n):

    ans = 1

    while ans <= n:
        ans *= 2

    return int(ans / 2)

def main():
    n = int(input())
    print(breaknumbeer(n))

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
M = -1
res = 0

for i in range(1, N+1):
    cnt = 0
    j = i
    
    while j%2 == 0:
        j //= 2
        cnt += 1
    
    if M < cnt:
        M = cnt
        res = i

print(res)

Solution (Python):
n = int(input())
i = 0
ans = 0
while True:
    if 2**i > n:
        break
    ans = i
    i += 1

print(2**ans)

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

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

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

print(int(r/2))

Solution (Python):
n = int(input())
max_num = n
cnt_max = 0
for i in range(n,0,-1):
  cnt = 0
  t = i
  while t > 0:
    if t % 2 == 0:
      t = t//2
      cnt += 1
    else:
      break
  if cnt > cnt_max:
    cnt_max = cnt
    max_num = i
print(max_num)

Solution (Python):
N=int(input())
count=0
pw2=[]
for i in range(8):
    pw2.append(pow(2,i))
for i in range(7):
    if (pw2[i]<=N)and(N<pw2[i+1]):
        print(pw2[i])

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

  
if 2**i==N:
  print(2**i)
else:
  print(2**(i-1))

Solution (Python):
n = int(input())
ans = 0
for x in range(7):
    if n < 2 ** x: break
    ans = max(ans, 2 ** x)
print(ans)

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

Solution (Python):
n = int(input())
bn = str(bin(n))
bn = "1" + (bn[3:]).replace("1", "0")
print(int(bn, 2))

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

Solution (Python):
N=int(input())
ans = 0
d=0
def calc(n):
    a = 0
    while(1):
        if n==0:
            return a
        if n%2==0:
            a+=1
            n = n//2
        else:
            return a
for i in range(1,N+1):
    a = calc(i)
    ans = max(ans,a)
for i in range(1,N+1):
    b=calc(i)
    if b==ans:
        d = i
print(d)

Solution (Python):
try:   
    N = int(input())
    num = [i for i in range(N+1) if i%2==0]
    ans = 1
    __ = 0
    for i in num:
        _ = format(i, 'b')[::-1].find("1")
        if __ < _:
            ans = i
            __ = _
    print(ans)
except EOFError:
    pass

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

Solution (Python):
n = int(input())
max_num = 1
max_counter =0
for i in range(1, n+1):
    if not i%2 == 0:
        continue
    else:
        num = i
        counter = 0
        while num%2 == 0:
            num //= 2
            counter += 1
        if max_counter < counter:
            max_counter = counter
            max_num = i
print(max_num)

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

while True:
  if n<2**i:
    break
  else:
    i+=1
print(2**(i-1))

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

for i in range(1, N + 1):
    tmp = 0
    while (True):
        if i % 2 == 0:
            tmp += 1
            i = i / 2
        else:
            break
    cnt = max(cnt, tmp)

print(2**cnt)

Solution (Python):


import math


def main():
    N = int(input())
    print(2**int(math.log2(N)))


if __name__ == "__main__":
    main()

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

upper_num = 1
upper_count = 0
for i in range(1,N+1,1):
    count = 0
    a, b = divmod(i,2)
    while b == 0:
        count += 1
        a, b = divmod(a,2)

    if count > upper_count:
        upper_count = count
        upper_num = i
print(upper_num)

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

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

print(i // 2)

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

while ans <= n/2:
  ans *= 2
  
print(ans)

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

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

result = 128
while result > N:
    result //= 2
print(result)

Solution (Python):
N = int(input())
a = [N-2**i for i in range(0,7) if N-2**i >= 0]
print(2**a.index(min(a)))

Solution (Python):
N = int(input())
a = [N-2**i for i in range(0,7) if N-2**i >= 0]
min_index = a.index(min(a))
print(2**min_index)

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

Solution (Python):
n=int(input())
for i in range (0,8):
    if 2**i<=n:
        pass
    else:
        print(2**(i-1))
        break

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

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

count = [0 for __ in range(N)]
Nl = [i for i in range(1,N+1)]

for i,n in enumerate(Nl):
    while n%2==0:
        n /= 2
        count[i] += 1
idx = count.index(max(count))
print(Nl[idx])

Solution (Python):
def devide(dev):
	count = 0
	while dev % 2 == 0:
		dev /= 2
		count += 1
	return count

n = int(input())
count_cal = []

for i in range(1, n+1):
	count_cal.append(devide(i))

MAX = count_cal[0]

for k in range(len(count_cal)):
	if MAX <= count_cal[k]:
		MAX = count_cal[k]
		ans = k

print(ans + 1)

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

Solution (Python):
n = int(input())
if n == 1:
  print(1)
  exit(0)
for i in range(n):
  m = 2**i
  if m > n:
    print(m//2)
    exit(0)

Solution (Python):
def solve(n):
    num = 2
    while num <= n:
        num *= 2
    return num // 2

_n = int(input())
print(solve(_n))

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

counter = [0 for __ in range(N)]
Nl = [i for i in range(1,N+1)]

for i,n in enumerate(Nl):
    while n%2==0:
        n /= 2
        counter[i] += 1
idx = counter.index(max(counter))
print(Nl[idx])

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

ans = 1
tmp_max = 0

for i in range(1,n+1):
    
    flag = True
    tmp_cnt = 0
    tmp_i = i
    while(flag):
        if tmp_i%2==0:
            tmp_cnt += 1
            tmp_i=int(tmp_i/2)
        else:
            flag = False
    if tmp_cnt >= tmp_max:
        tmp_max = tmp_cnt
        ans = i
        
print(ans)

Solution (Python):
n = int(input())
max_cnt = 0
res = 1
for i in range(n,0,-1):
    cnt = 0
    nn = i
    while nn % 2 == 0:
        nn = nn / 2
        cnt += 1
    if cnt > max_cnt:
        max_cnt = cnt
        res = i
print(res)

Solution (Python):
n=int(input())
from numpy import log
print(pow(2,int(log(n)/log(2))))

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

Solution (Python):
a = int(input())
len_a = len(str(bin(int(a))))-3
print(int("1" + "0"*len_a,2))

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




res=0

for i in range(n+1):  
    if max(n,2**i)<=n:
        res=2**i
print(res)

Solution (Python):




import sys


def twoDividedCounter(N):
    answer = 0
    copyNumber = N
    while True:
        if copyNumber % 2 == 0:
            answer = answer + 1
            copyNumber = copyNumber / 2
        else:
            break
    return answer


def solver(N):
    answer = 1
    counter = 0
    for j in range(1, N+1):
        jcount = twoDividedCounter(j)
        if counter < jcount:
            answer = j
            counter = jcount

    return answer


if __name__ == "__main__":
    N = sys.stdin.readline().rsplit()
    print(solver(int(N[0])))

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

print(2**a)

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

c = []
for n in range(1, N+1):
    _n = n
    i = 0
    while True:
        a = _n % 2
        _n = _n // 2
        if a:
            c += [i]
            break
        i += 1

print(c.index(max(c))+1)

Solution (Python):
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())

ans=1
while N>=ans:
    ans*=2

print(ans//2)

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

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

Solution (Python):
n=int(input())
king=int(0)
ans=int(1)
for i in range(1,n+1):
    a=i
    count=int(0)
    while a:
        if a%2==0:
            a/=2
            count+=1
        
        else:
            break

    if king<count:
        king=count
        ans=i

print(ans)

Solution (Python):
N = int(input())
k = 0
while 1:
  if 2**k > N:
    break
  ans = 2**k
  k += 1
print(ans)

Solution (Python):
suuji = int(input())
srclist = [1, 2, 4, 8, 16, 32, 64, 128]
dst = 0
for i in range(len(srclist)):
    if srclist[i] > suuji:
        break
print(srclist[i-1])
cntmax = 0
dst = 1
for i in range(suuji):
    for cnt in range(1, 1000):
        bit = 2**cnt-1
        if i & bit != 0:
            break
    if cntmax < cnt - 1:
        cntmax = cnt - 1
        dst = i

Solution (Python):
suuji = int(input())
srclist = [1, 2, 4, 8, 16, 32, 64, 128]
dst = 0
for i in range(len(srclist)):
    if srclist[i] > suuji:
        break
print(srclist[i-1])

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

Solution (Python):

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

Solution (Python):
n = int(input())
ans = [2**i for i in range(0, 8)]
ra = list(reversed(ans))

for i in range(len(ra)):
    if(ra[i] > n and ra[i+1] <= n):
        print(ra[i+1])

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


def two(n):
    ans = 0
    while n % 2 == 0:
        n //= 2
        ans += 1
    return ans


ans = [two(i + 1) for i in range(N)]
print(ans.index(max(ans)) + 1)

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    ct=0
    while n!=0:
        ct+=1
        n=n//2
    print(2**(ct-1))
if __name__ == '__main__':
    do()

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

Solution (Python):
import math

N = int(input())

ans = 2 ** int(math.log2(N))

print(ans)

Solution (Python):
import math
N = int(input())
a = math.floor(math.log(N, 2))
print(2 ** a)

Solution (Python):




def solver(givenNumber):
    answer = 1
    counter = 0
    modCounter = [0] * givenNumber
    for j in range(0, givenNumber):
        eachCounter = 0
        baseNumber = j + 1
        while True:
            if baseNumber % 2 == 0:
                eachCounter = eachCounter + 1
                baseNumber = baseNumber / 2
            else:
                break
        modCounter[j] = eachCounter
    for j in range(0, givenNumber):
        if counter <= modCounter[j]:
            counter = modCounter[j]
            answer = j+1
    return answer


if __name__ == "__main__":
    N = int(input())
    print(solver(N))

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

Solution (Python):
n = int(input())
max2 = 0
maxi = 1
for i in range(1, n+1):
  m = 0
  k = i
  while k % 2 == 0:
    m += 1
    k = k / 2
  if max2 < m:
    max2 = m
    maxi = i
print(maxi)

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

Solution (Python):

N = int(input())
ans = 1
while ans < N:
    if ans*2 <= N:
        ans *= 2
    else:
        break
print(ans)

Solution (Python):
N = int(input())
flag = True
i = 1
while flag:
    if 2**i<=N:
        i+=1
    else:
        print(2**(i-1))
        flag = False

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

ans_max = 0
for i in range(1,n+1):
    m = i
    a = 0
    while m % 2 == 0:
        m = m / 2
        a += 1
    if ans_max <= a:
        ans_max = a
        ans = i
print(ans)

Solution (Python):

N=int(input())
for i in range(7):
    if N>=2**i:
        ans=2**i
print(ans)

Solution (Python):

N=int(input())
ans=0

for i in range(N):
    num=i+1
    cnt=0
    
    while num%2==0:
        cnt+=1
        num=num//2
    ans=max(ans,cnt)

print(2**(ans))

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

res = []
for i in range(1,N+1):
    counter = 0
    if i % 2 == 0:
        while i % 2 == 0:
            counter += 1
            i /= 2

        res.append(counter)
    else:
        res.append(counter)


print(res.index(max(res)) + 1)

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

for i in m:
	if i <= n:
		ans.append(i)

print(max(ans))

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

Solution (Python):
def main(n):
    b = [2**i for i in range(0, 7)]

    for i in range(n, 0, -1):
        if i in b:
            print(i)
            return


if __name__ == "__main__":
    n = int(input())

    main(n)

Solution (Python):






import math

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = intinput()
print(2**int(math.log2(N)))

Solution (Python):
N = int(input())
if 1 <= N and N < 2:
    print(1)
elif 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)
else:
    print(64)

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

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

Solution (Python):
N = int(input())
print(1<<len(bin(N))-3)

Solution (Python):
N = int(input())
maxdiv = 0
ans = 1
for i in range(1, N + 1):
    d = i
    count = 0
    while d % 2 == 0:
        d //= 2
        count += 1
    if count > maxdiv:
        ans = i
        maxdiv = count
print(ans)

Solution (Python):




def solver(givenNum):

    answer = 1
    counter = 0
    rangeNum = range(0, givenNum)
    eachCount = [0] * givenNum
    for j in rangeNum:
        oneCount = 0
        nowNumber = j + 1
        while True:
            if nowNumber % 2 == 0:
                oneCount = oneCount + 1
                nowNumber = nowNumber / 2
            else:
                break
        eachCount[j] = oneCount

    for j in rangeNum:
        if counter <= eachCount[j]:
            counter = eachCount[j]
            answer = j + 1
    return answer


if __name__ == "__main__":
    print(solver(int(input())))

Solution (Python):

n = int(input())
two = [1, 2, 4, 8, 16, 32, 64]
ans = 0

for i in range(7):
    if  two[i] <= n:
        ans = two[i]

print(ans)

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

Solution (Python):
n=int(input())
for i in (64,32,16,8,4,2,1):
  if i<=n:
    print(i)
    break

Solution (Python):
def divisible(n):
 ans = 0
 while n%2 == 0:
  n /= 2
  ans += 1
 return ans
 
N = int(input())
 
b = 0

c = 1
 
for i in range(1,N+1):
    if(divisible(i) > b):
      b = divisible(i)
      c = i
    
print(c)

Solution (Python):
N=int(input())
k=[1,2,4,8,16,32,64]
ans=-1
for i in range(1,len(k)):
  if k[i]>N:
    ans=i-1
    break
if ans==-1:
  print(64)
else:
  print(k[ans])

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

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

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

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

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

while True:
  if n >= t:
    t *= 2
  else:
    print(t // 2)
    exit()

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
counta = 0
ans = 1
def hantei(i) :
    count = 0
    while True :
        if i % 2 == 0 :
            count+=1
            i = i // 2
        else :
            break
    return count
for i in range(1,N+1) :
    k = hantei(i)
    if k > counta :
        ans = i
        counta = k
print(ans)

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

Solution (Python):
num = int(input())
m = 1
for i in range(num):
    if num >= 2**i:
        m = pow(2,i)
print(m)