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())
list = [2**i for i in range(7)]

ans = 1

for k in list:
  if k <= n:
    ans = k
    if ans == 64:
      print(ans)
      break
    else:
      continue
  else:
    print(ans)
    break

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

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

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

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):
def main():
	N = int(input())
	binary_list = [1,2,4,8,16,32,64]
	diff_n2binary = []
	for binary in binary_list:
		if binary <= N:
			diff_n2binary.append(abs(N - binary))
	print(binary_list[ diff_n2binary.index( min( diff_n2binary ) ) ] )

if __name__ == "__main__":
	main()

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

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

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

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

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

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

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

Solution (Python):
import sys
N = int(input())
c = 0
a = 1
while 2 ** a < 100:
    if N < 2 ** a:
        print(2 ** (a - 1))
        sys.exit()
    a += 1
print(2 ** (a - 1))

Solution (Python):
def div2_count(x, n):
    if x % 2 == 1:
        return n
    else:
        return div2_count(x // 2, n+1)


N = int(input())

ans = [0, 0]
for i in range(1, N+1):
    y = div2_count(i, 0)
    if ans[1] <= y:
        ans = [i, y]

print(ans[0])

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

print(2 ** int(math.log(n, 2)))

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

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

print(res)

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

while i <= n:
    i *= 2

print(i//2)

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

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

print(ans)

Solution (Python):
A = [2**x for x in range(7)]
N = int(input())
for i in A:
  if i <= N:
    ans = i
print(ans)

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

ans = 1
cnt = 0
for i in range(1, n+1):
    t = 0
    a = i
    while a // 2 != 0:
        a = a // 2
        t += 1
    if cnt < t:
        ans = i
        cnt = t
print(ans)

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

if n < 2:
    print(n)
elif 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)

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

Solution (Python):


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

    print(2**(len(bin(n)[2:])-1))

if __name__ == '__main__':
    main()

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

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

cnt = 0
tmp = 0

while tmp<=N:
    cnt += 1
    tmp = 2**cnt

print(2**(cnt-1))

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

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

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


if __name__ == "__main__":
    main()

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

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

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

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

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

Solution (Python):
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0
n = iin()
a = [1,2,4,8,16,32,64,128]
for i in range(7):
    if n >= a[i]:
        if n < a[i + 1]:
            print(a[i])
            break

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def div2count(n):
  cnt = 0
  while n % 2 == 0:
    cnt += 1
    n = n / 2
  return cnt

N = I()

ans = 1
ans_cnt = 0

for n in range(1,N+1):
  cnt = div2count(n)
  if ans_cnt < cnt:
    ans_cnt = cnt
    ans = n
print(ans)

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

Solution (Python):
n = int(input())
results = 0
number = 0
for i in range(n + 1):
    if i == 0:
        continue
    if i == 1:
        number = 1
        continue
    count = 0
    v = i

    while v % 2 == 0:
        count += 1
        v = v / 2
    if results < count:
        results = count
        number = i
    continue
print(number)

Solution (Python):
N = int(input())
max_num = N
max_count = 0
for i in range(1,N+1):
    if i%2 != 0:
        continue
    j = i
    count = 0
    while j%2 == 0:
        count += 1
        j //= 2
    if max_count < count:
        max_count = count
        max_num = i
print(max_num)

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

Solution (Python):
n = int(input())
count = 0
for i in range(1, n+1):
    stop = True
    c = 0
    while stop :
        if i % 2 == 0:
            c += 1
            i = i/2
        else:
            stop = False
    if c >= count :
        count = c
print(2**count)

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

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

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

cnt = 0
while True:
    num = 2 ** cnt
    if num > n:
        print(num//2)
        break
    cnt += 1

Solution (Python):
list = [64,32,16,8,4,2]
O = int(input())
if O == 1:
    print(1)
    exit()

for num in list:
    if O >= num:
        print(num)
        break

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

if N == 1:
    print(1)
    exit()

count_dic = {}
for i in range(N+1):
    i_tmp = i
    count = 0
    while True:
        if i == 0:
            break
        elif i_tmp % 2 == 0:
            i_tmp = i_tmp / 2
            count += 1
        else:
            break
    count_dic[i] = count
print(max(count_dic, key=count_dic.get))

Solution (Python):
N = int(input())
li = []
for i in range(10):
    li.append(2**i)
ans = []
for j in li:
    if j <=N:
        ans.append(j)
print(max(ans))

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

result = 1

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

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

ans = 0
s = 0
for i in range(1, n + 1):
    sub = 0
    g = i
    while g >= 2:
        sub += 1
        g = g // 2
    if s < sub:
        ans = i
        s = sub

print(max(ans,1))

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

if n == 1:
    print(1)
else:
    for i in b:
        if i > n:
            print(b[b.index(i)-1])
            break

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

Solution (Python):
def main():
    n = int(input())
    idx = -1
    cnt = -1
    for i in range(1,n+1):
        tmp = (bin(i)[2:])[::-1].find('1')
        if tmp > cnt:
            cnt = tmp
            idx = i
    print(idx)

if __name__ == '__main__':
    main()

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

List = []
for x in range(1,N+1):
  s = 0
  while x % 2 == 0:
    s += 1
    x = x//2
  List.append(s)

t = max(List)
print(2**t)

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

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

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

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

Solution (Python):
n = int(input())
ans = 1
max_count = 0
for i in range(1, n + 1):
    j = i
    count = 0
    while i % 2 == 0 and i > 0:
        count += 1
        if count > max_count:
            ans = j
            max_count = count
            break
        i =  i / 2
print(ans)

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

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

def t(n):
    div = n
    cnt = 0
    while True:
        div, mod = divmod(div, 2)
        if mod == 0:
            cnt += 1
        else:
            return cnt

ans = 1
maxt = 0
for i in range(1, n+1):
    tt = t(i)
    if maxt < tt:
        maxt = tt
        ans = i
print(ans)

Solution (Python):
n = int(input())
answer_list = [0 for i in range(n)]
answer_count = [0 for i in range(n)]

for i in range(0,n):
    answer_list[i]=i+1
    while True:
        if answer_list[i]%2==0:
            answer_list[i]=answer_list[i]/2
            answer_count[i] +=1
        else:
            break
max_count = max(answer_count)
print(answer_count.index(max_count)+1)

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

num = list(range(1, n+1))
num2 = list(range(1, n+1))
count = [0]*n

judge = 0

while True:
    for a in range(0, n):
        if num[a] % 2 == 0:
            judge += 1
            num[a] /= 2
            count[a] += 1
    if judge == 0:
        break
    judge = 0

mx = max(count)

for a in range(0, n):
    if count[a] == mx:
        ans = num2[a]
        break

print(ans)

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

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))




def resolve():
    N=bin(int(input())) 
    
    print(2**(len(N)-3))

resolve()

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

ans = 1

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

print(ans)

Solution (Python):
n = int(input())
arr = [i for i in range(1,n+1)]
counter = 0
while len(arr) > 1:
  counter += 1
  i = 0
  while i < len(arr):
    if arr[i] % 2 != 0:
      arr.pop(i)
    else:
      arr[i] //= 2
      i += 1
print(arr[0] * (2**counter))

Solution (Python):
def actual(N):
    
    answers = [2 ** i for i in range(6 + 1)]

    and_set = set(answers) & set(range(1, N + 1))

    return max(and_set)


N = int(input())

print(actual(N))

Solution (Python):

def actual(N):
    max_count = 0
    max_number = 1

    for i in range(1, N + 1):
        num = i
        count = 0

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

        if count >= max_count:
            max_number = i
            max_count = count

    return max_number

  
N = int(input())

print(actual(N))

Solution (Python):

import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7

N = ri()
d = [2 ** i for i in range(10)][::-1]
for i in d:
    if i <= N:
        print(i)
        exit()

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

ans = 2

while ans <= n:
    ans *= 2

print(ans//2)

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

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

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

Solution (Python):

N = int(input())

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

count = 0

while A != [] :
    A = A[1::2]
    count = count +1


print(2**(count-1))

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

n2_list = [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)
else:
    print(1)

Solution (Python):
n = int(input())
tmp = []
for i in range(1,n+1):
	ans = 0
	while i % 2 ==  0:
		ans += 1
		i = int(i / 2)
	tmp.append(ans)
maxnum= max(tmp)
print(tmp.index(maxnum)+1)

Solution (Python):
n = int(input())
a = 0
b = 0
c = 0

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

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

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

for i in range(N,-1,-1):
  if i == 64:
    print(i)
    break
  elif i == 32:
    print(i)
    break
  elif i == 16:
    print(i)
    break
  elif i == 8:
    print(i)
    break
  elif i == 4:
    print(i)
    break
  elif i == 2:
    print(i)
    break
  elif i == 1:
    print(1)

Solution (Python):
import math

N = int(input())

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

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

i = 1
while 2 ** i <= N:
    i += 1
print(2 ** (i - 1))

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

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 = [0] * N
def how_many_times_divisible(n):
    count = 0
    while n % 2 == 0:
        n = n // 2
        count += 1
    return count

flag = 0
ans = 1
for i in range(N):
    Ans[i] = how_many_times_divisible(i+1)
    if flag < Ans[i]:
        flag = Ans[i]
        ans = i+1



print(ans)

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

x = 1
for i in range(10):
    if x*2 <= N:
        x *= 2
    else:
        break

print(x)

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

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

if i > n:
    i //= 2

print(i)

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

i = int(0)
best_times = int(0)
while i <= N:
    x = i
    answer_times = 0
    while x % 2 == 0 and x != 0:
        answer_times += 1
        x /= 2
    if best_times < answer_times:
        best_times = answer_times
    i += 1

answer = int(2 ** best_times)
print(answer)

Solution (Python):
import sys
n = int(input())
a = [2**i for i in range(0,7)]
for i in range(len(a)):
    if n == a[i]:
        print(a[i])
        sys.exit()
    elif n < a[i]:
        print(a[i-1])
        sys.exit()

print(64)

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

Solution (Python):
import sys

n = int(input())







ans = 1
while ans < n:
    if ans * 2 <= n:    
        ans *= 2
    else:
        print(ans)
        sys.exit()

print(ans)

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

ans = 1

while ans<=n:
    if ans*2>n:
        print(ans)
        break
    else:
        ans *= 2

Solution (Python):
def resolve():
    import math
    n = int(input())
    print(2**math.floor(math.log(n, 2)))

resolve()

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

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

print(2**(i-1))

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

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

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

Solution (Python):

N = int(input())
dict = {}
for i in range(1, N+1):
    n = float(i)
    cnt = 0
    while n/2>0.0:
        if n%2 == 0.0:
            cnt += 1
        n = n/2
    dict[i] = cnt

import numpy as np
print(list(dict.keys())[np.argmax(list(dict.values()))])

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

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

cnt = 0
ans =1
    
while  True:
    if ans*2 <= N:
        ans= ans*2
    else:
        break
    
print(ans)

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

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(input())


ans_counter = 0
ans = 1
for n in range(1, N+1):
    i = n
    counter = 0
    while i % 2 == 0:
        i = i // 2
        counter += 1
    if counter > ans_counter:
        ans_counter = counter
        ans = n
print(ans)

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

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

print(ans)

Solution (Python):

N = int(input())
for k in range(7):
    if 2**k <= N < 2**(k+1):
        print(2**k)

Solution (Python):

N = int(input())
ans = 0
for i in range(1, N+1):
    tmp = i
    num = 0
    while tmp % 2 == 0:
        num += 1
        tmp = tmp // 2
    ans = max(ans, num)
print(2**ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7


n=I()
def niwari(x):
    count=0
    while x%2==0:
        x//=2
        count+=1
    return count
mx=0
ans=1
for i in range(1,n+1):
    if niwari(i)>mx:
        mx=niwari(i)
        ans=i
print(ans)

Solution (Python):

N = int(input())

if N >= 64:
    N = 64
elif N >= 32:
    N = 32
elif N >= 16:
    N = 16
elif N >= 8:
    N = 8
elif N >= 4:
    N = 4
elif N >= 2:
    N = 2
elif N == 1:
    N = 1

print(N)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
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
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()

print(2**int(log2(N)))

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

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

print(2**(i-1))

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

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

COUNT = 1

for i in range(7):
    if N >=2**(6-i):
        COUNT = 2**(6-i)
        break

print(COUNT)

Solution (Python):
n = int(input())
a = []
for i in range(1, n + 1):
    cnt = 0
    flag = True
    j = i
    while flag:
        if i % 2 == 0:
            i //= 2
            cnt += 1
        else:
            flag = False
    a.append([j, cnt])
print(sorted(a,key=lambda x: x[1])[-1][0])

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

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

Solution (Python):
n = int(input())
precount = 0
if n==1:
    ans = 1
for i in range(1, n+1):
    tmp = i
    flag = 1
    count = 0
    while flag :
        flag = 0
        if i%2 == 0:
            i = i//2
            flag = 1
            count += 1
    if precount < count :
        precount = count
        ans = tmp
        
    
            

print(ans)

Solution (Python):
n = int(input())
a = 0
ans = 1
for i in range(1, n+1):
    w = 0
    cnt = i
    while i%2 == 0:
        w += 1
        i //= 2
    if a < w:
        a = w
        ans = cnt
print(ans)

Solution (Python):
import math

n=int(input())
cnt=1
for i in range(0, 100):
    cnt*=2
    if cnt > n:
        print(math.floor(cnt/2))
        break

Solution (Python):
from math import *
N=int(input())
print(2**floor(log(N)/log(2)))

Solution (Python):
s=int(input())
two=[]
for i in range(8):
    two.append(2**i)
ans=0
if s in two:
    print(s)
else:
    while s>two[ans]:
        ans+=1
    print(2**(ans-1))

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):
keep=0
keeeep=1
for i in range(1,int(input())+1):
  count=0
  kept=i
  while kept%2==0:
    count+=1
    kept=kept//2
  if count>keep:
    keeeep=i
    keep=count
print(keeeep)

Solution (Python):
def main():
    n = int(input())
    nums = [0]
    for i in range(1, n + 1):
        d = i
        count = 0
        while d != 0:
            d, amari = divmod(d, 2)
            if amari != 0:
                break
            count += 1
        nums.append(count)
    if n == 1:
        print(1)
    else:
        print(nums.index(max(nums)))


if __name__ == '__main__':
    main()

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

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

pow=64
while True:
  if pow<=N:
    print(pow)
    break
  else:
    pow//=2

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

def times(n):
  res=0
  while n:
    if n%2==0:
      res+=1
    n//=2
  return res

answer=0
max_d=0
for i in range(1,N+1):
  if times(i)>=max_d:
    max_d=times(i)
    answer=i
  
print(answer)

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

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

l = [i for i in range(1, N+1)]
l1 = l.copy()
c = [0]*N

while True:
    exist_even = False
    for i in range(N):
        if l[i] % 2 == 0:
            exist_even = True
    if not exist_even:
        break

    for i in range(N):
        if l[i] % 2 == 0:
            l[i] = l[i] // 2
            c[i] += 1

idx = c.index(max(c))
print(l1[idx])

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

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

Solution (Python):
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    return N,


def solve(N):
    n = N.bit_length()
    return N >> (n-1) << (n-1)


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))

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

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

print(2**(i-1))

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

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

Solution (Python):
N=int(input())
a=1
b=0
def count(x):
    y=0
    for i in range(10):
        if x%2==0:
            x=x//2
            y+=1
        else:
            break
    return y

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

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

	cur = 1
	for i in range(1, n + 1):
		if cur * 2 > n:
			break
		cur *= 2
	print(cur)
resolve()

Solution (Python):
def resolve():
	n = int(input())
	ans = 0
	dp = [0]*(n+1)
	for i in range(1, n+1):
		if i % 2 == 0:
			dp[i] = dp[i//2] + 1
	print(dp.index(max(dp)) or 1)
resolve()

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

ans_2 = [2, 4, 8, 16, 32, 64]
ans = N

for a in ans_2:
    if N >= a:
        ans = a
    else:
        break

print(ans)

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

Solution (Python):
import sys

IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]

DIVC = lambda x, y: -(-x//y)
DIVF = lambda x, y: x//y

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys

IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]

DIVC = lambda x, y: -(-x//y)
DIVF = lambda x, y: x//y

def main():
    n = II()
    maxv = 0
    res = -1
    for i in range(1,n+1):
        cnt = 0
        x = i
        while x//2 > 0:
            if x%2 == 0:
                cnt += 1
                x //= 2
            else:
                break
        if cnt >= maxv:
            maxv = cnt
            res = i
    print(res)

if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

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

ans = 1
for i in range(1,8):
    if 2**i > N:
        ans = 2**(i-1)
        break
    elif 2**i == N:
        ans = 2**i
        break

print(ans)

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

i=1

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

Solution (Python):
import math

n = int(input())
k = (math.log2(n)) // 1
a = int(2 ** k)
print(a)

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

    A = [1,2,4,8,16,32,64]
    B = sorted(A, reverse=True)

    for i in B:
        if i <= n:
            print(i)
            break




resolve()

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
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()
now = 1
while True:
    if now*2 > n:
        print(now)
        break
    now *= 2