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):
def main():
    from builtins import int, map, list, print
    from bisect import bisect_right
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N = input_number()
    ls = [2 ** i for i in range(7)]
    print(ls[bisect_right(ls, N)-1])


if __name__ == '__main__':
    main()

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

ans = []
a = 1
t = 1

while a <= 100:
    ans.append(a)
    a *= 2

for b in ans :
    if b <= n:
        t = b

print(t)

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

Solution (Python):
N=int(input())
maxd=0
ans=1
for i in range(1,N+1):
    c=0
    for j in range(1,7):
        if i % (2**j)==0:
            c=j
    if maxd < c:
        maxd=max(maxd,c)
        ans=i
    
print(ans)

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

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

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

ans=2**(k-1)
print(ans)

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

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

if N < 2:
    ans = 1
elif N < 4:
    ans = 2
elif N < 8:
    ans = 4
elif N < 16:
    ans = 8
elif N < 32:
    ans = 16
elif N < 64:
    ans = 32
else:
    ans = 64

print(ans)

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

if N < 2:
    ans = 1
elif N < 4:
    ans = 2
elif N < 8:
    ans = 4
elif N < 16:
    ans = 8
elif N < 32:
    ans = 16
elif N < 64:
    ans = 32
else:
    ans = 64

print(ans)

Solution (Python):
n = int(input())
k = 0
arr = [0] * n
def break2(n):
  k = 0
  while n % 2 == 0:
    k += 1
    n = n // 2
  return k
for i in range(n):
  arr[i] = break2(i + 1)
print(arr.index(max(arr)) + 1)

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

Solution (Python):
N = int(input())
n = [64, 32, 16, 8, 4, 2, 1]
for v in n:
    if N >= v:
        print(v)
        exit()

Solution (Python):


def divide_two(k,c=0):
    if k % 2 != 0:
        return c
    else:
        return divide_two(k//2,c+1)

def makeLst(k):
    l = [0]*k
    for i in range(k):
        l[i] = divide_two(i+1)
    return l


def solve(n):
    l = makeLst(n)
    max_val = max(l)
    for i in reversed(range(n)):
        if l[i] == max_val:
            return i+1

    return 0

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


if __name__ == '__main__':
    main()

Solution (Python):
A = list(range(1, int(input()) + 1))
A.sort(key=lambda a: (a & -a).bit_length())
print(A[-1])

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

    def count(x):
        ret = 0
        while x % 2 == 0:
            x //= 2
            ret += 1
        return ret

    ret = max(range(1, N + 1), key=count)
    print(ret)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
n=int(input())
ans=1
for x in range(0,8):
  if n<pow(2,x):
    break
  ans=pow(2,x)
    
print(ans)

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

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

Solution (Python):
n=int(input())
ans1=[0,1]
for i in range(1,n+1):
  count=0
  N=i
  while True:
    if N%2==0:
      N//=2
      count+=1
    else:
      break
  if ans1[0]<count:
    ans1=[count,i]
print(ans1[1])

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

now = 2

while now <= n:
  now *= 2

print(now//2)

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

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

mx = [0, 0]
for i in range(1, n+1):
    j = i
    cnt = 0
    while j % 2 == 0:
        cnt += 1
        j = j // 2
    if mx[0] < cnt:
        mx[0] = cnt
        mx[1] = i

print(mx[1] if mx[0] != 0 else 1)

Solution (Python):
N = int(input())
ans_list = [2**i for i in range(8)]
ai = 0
while (ans_list[ai] <= N):
    ai += 1

print(ans_list[max(0, ai-1)])

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

for i in range(1,n+1):
    c = 0
    while True:
        if i%2 == 0:
            i //= 2
            c += 1
        else:
            if cnt < c:
                ans = i*2**c
                cnt = c
            break

print(ans)

Solution (Python):
def resolve():
  n = int(input())
  ans = 1
  num = 0
  for i in range(1, n+1):
    tmp = 0
    x = i
    while x >= 2 and x % 2 == 0:
      if x % 2 == 0:
        tmp += 1
        x /= 2
        if tmp >= num:
          ans = i
          num = tmp
      else:
        continue

  print(ans)
  return

if __name__ == "__main__":
  resolve()

Solution (Python):
import sys
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())

    res = defaultdict(int)
    for i in range(1, n + 1):
        cnt = 0
        k = i
        while k % 2 == 0:
            k //= 2
            cnt += 1
        res[i] = cnt

    ma = 0
    ans = 1
    for k, v in res.items():
        if ma < v:
            ans = k
            ma = v

    print(ans)


if __name__ == '__main__':
    resolve()

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

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

a = 1
for i in range(10):
    a *= 2
    if a > N:
        print(a//2)
        break

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

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
ans = -1
res = 0
for i in range(1,n+1):
    cnt = 0
    tmp = i
    while True:
        if tmp%2:
            break
        tmp //= 2
        cnt += 1
    if cnt > ans:
        ans = cnt
        res = i
print(res)

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

a = 1

while a*2<=N:
  a *= 2
print(a)

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

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

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

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
import bisect
n=int(input())
l=[2**i for i in range(10)]
print(l[bisect.bisect(l,n)-1])

Solution (Python):
import bisect
n=int(input())
l=[2**i for i in range(10)]
print(2**(bisect.bisect(l,n)-1))

Solution (Python):
n = int(input())
nums = [1, 2, 4, 8, 16, 32, 64, 128]
ans = 0
for i, v in enumerate(nums):
    if v <= n:
        continue
    else:
        ans = nums[i - 1]
        break
print(ans)

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

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

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

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

print(a)

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    ans = 1
    while ans * 2 <= n:
        ans *= 2
    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):

if __name__ == '__main__':
    a = int(input())
    max =1
    maxcount=0

    for i in range(1,a+1):
        s2 = i
        count =0
        while s2 >=2:
            if s2 %2 == 0:
                count+=1
                s2 = s2//2

            else:
                break
            if maxcount < count:
                max = i
                maxcount = count

    print(max)

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

for i in lis:
  if n - i >= 0:
    ans = max(ans,i)
    
print(ans)

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

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

x = 1
while True:
    if x < n:
        x *= 2
    else:
        break
if x > n:
    x /= 2

print(int(x))

Solution (Python):

import sys
import math


def solve(N: int):
    ans = [i for i in range(1, N + 1)[::-1] if math.log2(i) % 1 == 0]
    print(ans[0])
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)


if __name__ == "__main__":
    main()

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

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

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

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

print(ans)

Solution (Python):
import math
N = int(input())
k = math.log2(N)

print(2**int(k))

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

Solution (Python):
def cntDiv(n):
    cnt = 0
    while n % 2 == 0:
        n /= 2
        cnt += 1
    return cnt


n = int(input())
res = 1
cnt = 0
for i in range(1, n + 1):
    tmp = cntDiv(i)
    if cnt < tmp:
        cnt = tmp
        res = i
print(res)

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

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

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

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

for i in range(1, n+1):
    if i % 2 == 0:
        j = i
        c = 1
        j /= 2
        while j % 2 == 0:
            c += 1
            j /= 2
    if c > max_c:
        max_c = c
        max_num = i

print(max_num)

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

Solution (Python):
N = int(input())
num = 1
c = 0
t = 0
for i in range(N,-1,-1):
    j = i
    c = 0
    while 1 < j:
        if j % 2 == 0:
            c += 1
        j //= 2
    if t < c:
        t = c
        num = i
print(num)

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

Solution (Python):






N = int(input())





ans = 1
for i in range(8):
    if N < 2**i:
        print(ans)
        break
    else:
        ans = 2**i

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

cnt = 0

while N > 1:
    N = N//2
    cnt +=1

print(2**cnt)

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

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

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

print(2**n)

Solution (Python):
n = int(input())
ans = 1
while 2 * ans <= n:
  ans *= 2
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())

for i in range(8):
	if N < 2**i:
		tmp = i
		break

print(2**(tmp-1))

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

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

Solution (Python):
N = int(input())
max = 0
ans = 1

for i in range(1, N+1):
  count = 0
  k = i
  while (k % 2 == 0):
    count += 1
    k /= 2

  if count > max:
    max = count
    ans = i
    
print(ans)

Solution (Python):
n = int(input())
while True:
    temp = n
    while temp%2==0:
        temp /= 2
    if temp==1:
        print(n)
        break
    n-=1

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

print(int(num/2))

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

cnt = 1
while True:
    if cnt * 2 > N:
        break
    cnt *= 2
print(cnt)

Solution (Python):
nums = [1, 2, 4, 8, 16, 32, 64]
N = int(input())
result = nums[0]
for num in nums:
    if N >= num:
        result = num
    else:
        break
print(result)

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

Solution (Python):
import math
def resolve():
    N = int(input())
    ans = pow(2,int(math.log2(N)))
    print(ans)
resolve()

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

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

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

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

Solution (Python):
def li():
    return list(map(int, input().split()))


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


def ii():
    return int(input())


N = ii()

a = 1
while True:
    if a > N:
        break
    else:
        a *= 2
print(int(a / 2))

Solution (Python):

limit = int(input())

num = 1
while num * 2 <= limit:
    num *= 2

print(num)

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

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

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

if n <= 1:
    print(1)
elif n<=3:
    print(2)
elif n<=7:
    print(4)
elif n<=15:
    print(8)
elif n<=31:
    print(16)
elif n<=63:
    print(32)
else:
    print(64)

Solution (Python):
def resolve():
    N = int(input())
    for i in range(1,9):
        if 2**i > N:
            ans = 2**(i-1)
            break
    print(ans)
resolve()

Solution (Python):
def resolve():
    N = int(input())
    if N == 6:
        ans = 6
    else:
        for i in range(1,9):
            if 2**i > N:
                ans = 2**(i-1)
                break
    print(ans)
resolve()

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

Solution (Python):
import sys
from bisect import bisect_left, bisect_right

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

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

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)
elif N ==1:
     print(1)

Solution (Python):
from math import log2, floor

n = int(input())

res = floor(log2(n))
print(pow(2, res))

Solution (Python):

n=int(input())

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

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

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

while N is not 0:
    f = False
    a = 0
    M = N
    while f == False:
        if M % 2 ==0:
            M = int(M / 2)
            a += 1
        else:
            f = True
    if b < a:
        b = a
        N = N - 1
    else:
        N = N - 1
print(2**b)

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

max = 0
ans = 1

for i in range(1, N+1):
    count = 0
    a = i
    while True:
        if a % 2 == 1:
            if max < count:
                max = count
                ans = i
        else:  
            a = int(a / 2)
            count += 1
            continue
        break

print(ans)

Solution (Python):
from sys import stdin

n = int(stdin.readline().strip())
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
while True:
    if n>N:
        print(int(n/2))
        break
    
    n=n*2

Solution (Python):
N = int(input())
result = [1, 0]
for i in range(2, N+1, 2):
    count = 0
    tmp = i
    while True:
        if tmp % 2:
            break
        tmp = tmp / 2
        count += 1
    if count > result[1]:
        result[0] = i
        result[1] = count
print(result[0])

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())
ans = [0 for i in range(n)]

for i in range(1,n+1):
    tmp = i
    while tmp % 2 == 0:
        ans[i-1] += 1
        tmp //= 2
max_num = max(ans)
print(ans.index(max_num)+1)

Solution (Python):
N = int(input())
ball = 1
if N == 1:
    print(1)
else:
    while True:
        if ball > N:
            break
        ball *= 2
    print(int(ball/2))

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

















ans_list = [2**i for i in range(7)]
ans = max([i for i in ans_list if N >= i])
print(ans)

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

ans = 1
mac_c = 0
for i in range(2, N+1):
    c_count = 0
    temp_i = i
    while True:
        if temp_i % 2 != 0:
            break
        temp_i /= 2
        c_count += 1
    if mac_c <= c_count:
        mac_c = c_count
        ans = i

print(ans)

Solution (Python):
import math

N = int(input())
ans = [math.floor(math.log2(i)) for i in range(1, N+1)]
print(ans.index(max(ans)) + 1)

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

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

Solution (Python):

N = int(input())
n = 6
while(N < 2 ** n):
    n -= 1
print(2 ** n)

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

count = [0] * (N+1);

for i in range(N+1):
    tmp = i
    if i != 0:
        while tmp % 2 == 0:
            tmp = tmp /2
            count[i] += 1

max_value = max(count)
num = count.index(max_value)
if num == 0:
    num += 1
print(num)

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



for i in range(1,n+1):
    if 2**i >n:
        print(2**(i-1))
        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())
a=1
while True:
  if a<=n:
    a*=2
  else:
    break

print(a//2)

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())
ans = 1
while ans*2 <= N:
  ans*=2
print(ans)

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

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def Yes(): print("Yes"); return
def No(): print("No"); return


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N = inputI()

print(2**int_log(N,2))

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

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

Solution (Python):
import sys
n = int(sys.stdin.readline().rstrip("\n"))
i = 0
while 2**i <= n:
    i += 1
print(2**(i-1))

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

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

ans = 1
cnt = 0
for i in range(1, n + 1):
    count = 0
    temp = i
    while temp % 2 == 0:
        count += 1
        temp //= 2

    if cnt < count:
        cnt = count
        ans = i

print(ans)

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

Solution (Python):
from math import log2, floor

N = int(input())

print(pow(2, floor((log2(N)))))

Solution (Python):

def inp():
    return(int(input()))


n = inp()

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

Solution (Python):
import math
from collections import deque
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

n = readInt()

ans=1

while ans*2<=n:
	ans*=2

print(ans)

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

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

Solution (Python):
list1=[2,4,8,16,32,64]
a=int(input())
for i in range(a):
    if (a-i) in list1:
        print(a-i)
        break
    elif a==1:
        print(1)
        break

Solution (Python):
N = int(input())
k = 0
while 1 << (k + 1) <= N:
    k += 1
print(1 << k)

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

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

N = int(input())

maxi_num = 0
ans = 1

def div_count(x):
    num = 0
    while True:
        if x % 2 == 0:
            x /= 2
            num += 1
        else:
            break
    
    return num

for i in range(1, N+1):
    count = div_count(i)
    if maxi_num < count:
        maxi_num = count
        ans = i

print(ans)

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

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

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

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

Solution (Python):
print(1 << int(input()).bit_length() - 1)

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

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

i=6
while i>-1:
  if N >= 2**i:
    print(2**i)
    break
  i-=1

Solution (Python):
N=int(input())
i=0
s=2
ans=1
while 1:
  ans = s**i
  if ans>N:
    print(s**(i-1))
    exit()
  i+=1

Solution (Python):
n = int(input())
c = []
d = []
if(n == 1):
  print(int(n))
  exit()

for i in range(1,n+1):
  x = 0
  j = 0
  k = 0
  if(i%2 == 0):
    x = i
    while True:
      x = int(x/2)
      k = k + 1
      if(x == 0 or x%2 == 1):
        c.append(k)
        d.append(i)
        break
  else:
    continue

c_m = max(c)
u = c.index(c_m)
print(d[u])

Solution (Python):
i = int(input())
cnt =0
while i >=2:
  i /= 2
  cnt +=1
print(2**cnt if cnt > 0 else i)

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())
  
n = i()
ans = 0
cnt = 0
def f(a):
	cnt = 0
	while a%2 == 0:
		a //= 2
		cnt += 1
	return cnt
for i in range(1,n+1):
	if f(i) >= cnt:
		cnt = f(i)
		ans = i
print(ans)

Solution (Python):
n = int(input())
A = [int(x) for x in range(1,n+1)]
B = [0]*n

for i in range(n):
    while A[i] % 2 == 0:
        A[i] = A[i]//2
        B[i] += 1
        
ind = B.index(max(B))
tmp = [int(x) for x in range(1,n+1)]
print(tmp[ind])