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


max_count = -1
max_ans = 1


for i in range(1, N+1):
    tmp_count = 0
    tmp = i
    while tmp%2==0:
        tmp_count += 1
        tmp = tmp // 2
    if tmp_count>max_count:
        max_count = tmp_count
        max_ans = i


print(max_ans)

Solution (Python):
n = int(input())
import math
if n > 1:
    for i in range(n,1,-1):
        if i%(2**int(math.log(i,2))) == 0:
            print(i)
            break
else:
    print(1)

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

Solution (Python):
from sys import stdin
import math


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  
    
    cnt = 2**math.floor(math.log(N,2))
    
    print(cnt)

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

print(ans//2)

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

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

print(num)

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

Solution (Python):
n=int(input())
a=[]
for i in range(1,n+1):
  t=i
  cnt=0
  while t!=0:
    if t%2==0:
      cnt+=1
    t//=2
  a.append((cnt,i))
a.sort(key=lambda x: x[0])
print(a[-1][1])

Solution (Python):
import sys
input=sys.stdin.readline
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n=int(input())
print(2**(len(bin(n))-3))

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

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

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


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

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


def main():
    n = int(input())
    ans = 1
    i = -1
    while ans * 2 <= n:
        i += 1
        ans = 2 ** i
    print(ans)

    
if __name__ == '__main__':
    main()

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

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    ma_ = 0
    
    LIST = []
    for i in range(7):
        LIST.append(2**i)
    for i in range(6,-1,-1):
        if LIST[i] <= n:
            print(LIST[i])
            exit()
    print(0)
if __name__ == '__main__':
  main()

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

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

a = 2
while a<=n:
  a*=2

print(a//2)

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

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

resolve()

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

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

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

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


if __name__ == '__main__':
    main()

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

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

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

for i in data:
    if n >= i:
        ans = i

print(ans)

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

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

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

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

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

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

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

if n == 1:
  print(1)
  
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<101:
  print(64)

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

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

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

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

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

Solution (Python):
import math
def jud(n):
    cnt=0
    while (True):
        if (n % 2 == 0):
            n /= 2
            cnt += 1
        else:
            break
    return cnt

n = int(input())
cnt = 0
ans=1
for i in range(n):
    tmp=jud(i+1)
    if (cnt < tmp):
        cnt = tmp
        ans = i + 1
print(ans)

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())

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

print(ans)

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

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

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

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

res_count = 0
res = 1
for i in range(1, n + 1):
    a = i
    count = -1
    mod = 0
    while mod == 0 and a >= 1:
        mod = a % 2
        a = int(a / 2)
        count = count + 1
    if res_count < count:
        res_count = count
        res = i

print(res)

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

Solution (Python):

N = int(input())


c=1
if N==1:
    print(1)
    exit()
flag=True
while flag==True:
    c = c*2
    if c > N:
        flag=False
        c=c//2
    elif c==N:
        flag=False
print(c)

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

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

print(2**k)

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

r = 1
while r <= N:
    r *= 2
print(int(r/2))

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

ans=1

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

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

count_max = 0
num_max = 0
for i in range(1, num+1):
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if count >= count_max:
    count_max = count
    num_max = i

if num == 1:
  print(1)
else:
  print(num_max)

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

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

print(ans//2)

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


cnt = 0
while True:
    if 2**cnt <= n:
        cnt += 1
    else:
        break

print(2**(cnt-1))

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

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

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


def num_div2(m):
    cnt = 0
    while m > 0 and m % 2 == 0:
        cnt += 1
        m //= 2

    return cnt


mx = max([(m, num_div2(m)) for m in range(1, n + 1)], key=lambda t: t[1])
print(mx[0])

Solution (Python):
def resolve():
    n=int(input())
    num=0
    ans=1
    l=list(range(1,n+1))
    for i in l:
        cnt=0
        while l[i-1]%2==0:
            l[i-1]=l[i-1]//2
            cnt+=1
        if cnt>num:
            num=cnt
            ans=i
    print(ans)

resolve()

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

Solution (Python):
def resolve():
    N = int(input())
    L = [2**i for i in range(8)]
    import bisect
    idx = bisect.bisect_left(L, N)
    print(L[idx] if L[idx] == N else L[idx-1])


if '__main__' == __name__:
    resolve()

Solution (Python):
num = int(input())
lst = [i for i in range(1, num + 1)]

max, before = 0, -1
for l in lst:
  num, count = l, 0
  while num % 2 == 0:
    num /= 2
    count += 1
  if before < count:
    max, before = l, count 

print(max)

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

Solution (Python):

N = int(input())

ans_i = 1
ans = 0
for i in range(N + 1):
    j = i
    cnt = 0
    while j % 2 == 0 and j != 0:
        j = int(j / 2)
        cnt = cnt + 1
    if cnt > ans:
        ans_i = i
        ans = cnt
print(ans_i)

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

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

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

while (N > 0):
  n = N
  count = 0
  while(True):
    if n % 2 != 0:
      break
    else:
      n /= 2 
      count += 1
  if count > best_count:
    ans = N
    best_count = count
  N -= 1
  
print(ans)

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

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

print(ans)

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

for i in range(N, 0, -1):
    
    binary_i_reverse = bin(i)[:1:-1]
    devide_count = 0
    
    for j in binary_i_reverse:
        if j == '0':
            devide_count += 1
        else:
            break
    
    if max_devide_count < devide_count:
        max_devide_count = devide_count
        ans = i

print(ans)

Solution (Python):
import math
n = int(input())
for i in range(n, 0, -1):
    if math.log2(i).is_integer():
        print(i)
        exit()

Solution (Python):
N = int(input())
count = 0
max = 0
ans = 1
for i in range(1, N+1, 1):
    count = 0
    n = i
    while 1:

        if n%2!=0:
            break
        n = n //2
        count = count + 1
    if max<count:
        max = count
        ans = i
print(ans)

Solution (Python):
import math

n = int(input())
print(pow(2, math.floor(math.log2(n))))

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

def div(x):
    global count
    if x%2==1:
        return count
    else:
        count += 1
        return div(x//2)
m = -1
for i in range(n):
    count = 0
    r = div(i+1)
    if m < r:
        m = r
        ans = i+1

print(ans)

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

Solution (Python):
n = int(input())
max=0
c=0
ans=1
for i in range(n+1):
	t=i
	while t%2==0 and 0<t:
		t=t>>1
		c+=1
	if max < c:
		max = c
		ans=i
	c=0
print(ans)

Solution (Python):
N = int(input())
ans = 1
while True:
  if N < ans <<1:
    break
  ans<<=1
print(ans)

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

def readlines(n):
    for i in range(n):
        for j, x in enumerate(input().split()):
            yield int(x), (i, j)


def main():
    N = int(input())
    for i in range(1, N+1):
        x = i
        count = 0
        while x > 0:
            x //= 2
            count += 1

        yield i, count


print(max(main(), key=lambda x: x[1])[0])

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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

        if res <= cnt:
            res = cnt
            ans = i
    print(ans)


if __name__ == '__main__':
    resolve()

Solution (Python):
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    cnt = 0
    ret = 1
    for n in range(1, N+1):
        tmp = 0
        q = n
        while n % 2 == 0:
            n = n // 2
            tmp += 1
        if tmp > cnt:
            ret = q
            cnt = tmp

    print(ret)


if __name__ == '__main__':
    main()

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

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

for cand in cands:
    if n >= cand:
        print(cand)
        break

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

while ans <= n:
  ans *= 2

print(ans//2)

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

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

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

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


count = []
for i in range(1,n+1):
    c = 0
    while i % 2 == 0:
        i //= 2
        c += 1
    count.append(c)

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

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

if n == 1:
    print(1)
    quit()
count = []
for i in range(2,n+1,2):
    c = 0
    while i % 2 == 0:
        i //= 2
        c += 1
    count.append(c)

ans = count.index(max(count))
print((ans+1)*2)

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


while(ans<<1 <= n):
  ans = ans << 1  
  
  
print(ans)

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    print(2**(N.bit_length()-1))

if __name__ == '__main__':
    main()

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())
cnt = [0] * n
for i in range(1, n + 1):
    x = i
    while x % 2 != 1:
        x //= 2
        cnt[i - 1] += 1
    
print(cnt.index(max(cnt)) + 1)

Solution (Python):
from sys import stdin

N = int(stdin.readline().rstrip())

max_num = 1
max_count = 0

def division(n):
    count = 0
    while True:
        quo = n // 2
        rem = n % 2

        if quo == 0 or rem > 0:
            break
        else:
            count = count + 1

        n = quo

    return count


for i in range(1,N+1):
    count = division(i)
    if max_count < count:
        max_count = count
        max_num = i

print(max_num)

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())
r = [64, 32, 16, 8, 4, 2, 1]
for q in range(7):
    if r[q] <= n:
        print(r[q])
        break

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

Solution (Python):
N = int(input())
two_list = [1, 2, 4, 8, 16,32,64]
answer = 0
for two in two_list:
  if N >= two:
      answer = two
      if two == 64:
          print("64")
  else:
    print(answer)
    exit()

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

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

MaxCount = 0
L = []
for i in range(1, N + 1):
    v = i
    count = 0
    while True:
        if (i % 2 == 1):
            break
        elif(i % 2 == 0):
            i = i // 2
            count += 1
    MaxCount = max(MaxCount, count)
    L.append((v, count))

for v in L:
    if (v[1] == MaxCount):
        print(v[0])
        break

Solution (Python):
import sys
import math

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(input())
    if N == 1:
        ans = 1
    else:
        ans = 2 ** int(math.log2(N))
    print(ans)



if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
if N<2:
  print(N)
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())
mx = 0
ans = 0
def mod(i, count=0):
    if i%2!=0:
        return count
    else:
        return mod(i//2, count+1)
for i in range(1,n+1):
    if mx <= mod(i):
        mx = mod(i)
        ans = i
print(ans)

Solution (Python):
N = int(input())
li = [2, 4, 8, 16, 32, 64]
ans = 0
for i in range(1, N+1):
    if i in li:
        ans = i

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

Solution (Python):
import numpy as np
import sys

input = sys.stdin.readline

n = int(input())

x = 1
ans = 0
while 1 :
    x *=2
    if x <= n:
        ans += 1
    else:
        break 

print(int(x/2))

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

max = [1, 0]

for i in range(1, N+1):
    j = i
    count = 0
    while j % 2 == 0: 
        j = j / 2
        count += 1
    if count > max[1]:
        max[0] = i
        max[1] = count
        
print(max[0])

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

if N == 1:
    print(1)

elif N == 2 or N == 3:
    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())

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

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

for i in range(1000):
  if 2**i  > N:
    print(2**(i-1))
    exit()

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(7):
    if N>=2**i:
        j=2**i
print(j)

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

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

for i in range(7):
    if 2**i <=N:
        j=2**i

print(j)

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

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

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

Solution (Python):

n = int(input())
k = 1

while k*2 <= n:
    k *= 2
    


print(k)

Solution (Python):
n = int(input())
if n == 1:
    print(1)
    exit()

l = list(range(1,n+1))
is_even=list(map(lambda x: x%2==0, l))
while is_even.count(True) > 1:
    l = list(map(lambda x: x/2, l))
    is_even=list(map(lambda x: x%2==0, l))

for i in range(n):
    if is_even[i]:
        print(i+1)

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

Solution (Python):


exp=[1,2,4,8,16,32,64,128]
n=int(input())
for i in range(8):
    if n<exp[i]:
        print(exp[i-1])
        break

Solution (Python):
N = int(input())
l = [1, 2]
while l[-1] * 2 <= 100:
    l.append(l[-2] * 2)
for i in reversed(l):
    if i <= N:
        print(i)
        break

Solution (Python):
N = int(input())
if N == 1 :
    print(1)
    exit()
ans = 0
cmax= 0

for i in range(1,N+1) :
    c = 0
    k = i
    while k % 2 == 0 :
        c += 1
        k = k / 2
        if  c > cmax :
            cmax = c
            ans = i

print(ans)

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

lans = list()

for i in range(1, N+1): 
    ans = 0
    while i % 2 == 0:
        i = i // 2
        ans += 1
    lans.append(ans)

Ans = max(lans)
print(2 ** Ans)

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

while (1):
    if pow(2, ans) > n:
        print(pow(2, ans - 1))
        exit()
    ans += 1

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

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

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

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

ans = 0
for i in range(1, n + 1):
    if i & (i - 1) == 0:
        ans = i
print(ans)

Solution (Python):
def kai(n):
    x=0
    while True:
        if n%2==0:
            n=n//2
            x+=1
        else:
            break
    return x

n=int(input())
if n==1:
    print(1)
else:
    a=[0]*(n+1)
    for i in range(1,n+1):
        a[i]=kai(i)

    print(a.index(max(a)))

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

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

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

Solution (Python):
n = int(input())
i =0
while True:
    if n < 2:
        break
    n = n // 2
    i +=1

ans = 2 ** i
print(ans)

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

for ans in ans_li:
    if ans <= N:
        print(ans)
        break

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

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

n = INT()
for i in reversed(div):
    if n >= i:
        print(i)
        exit()

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

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

def f(x):
    res = 0
    while x%2==0:
        x //= 2
        res += 1
    return res

cnt = 0
res = 1
for i in range(1,n+1):
    c = f(i)
    if c>cnt:
        cnt = c
        res = i

print(res)

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

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

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

Solution (Python):
def main(n):
    max_i = 1
    max_time = 1
    
    for i in range(1, n+1):
        max_time_tmp = 1
        is_even = True
        i_tmp = i
        while is_even:
            if i_tmp % 2 == 0:
                max_time_tmp += 1
                i_tmp = i_tmp / 2
            else:
                break
        if max_time_tmp > max_time:
            max_time = max_time_tmp
            max_i = i

    print(max_i)


n = int(input())
main(n)

Solution (Python):
icase=0
if icase==0:
    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())
cmax = 0
imax = 1
for i in range(1,n+1):
  cnt = 0
  ig = i
  while i % 2 == 0:
    i /= 2
    cnt += 1

  if cnt > cmax:
    cmax = cnt
    imax = ig
print(imax)

Solution (Python):

n = int(input())
data =list(range(n,0,-1))
seq = [64,32,16,8,4,2,1]

for i in data:
    if i in seq:
        print(i)
        break

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

n_li = [i for i in range(1,n+1)]

count = 0
while n_li:
    if len(n_li)==1:
        ans = int(n_li[0]*(2**count))
        break
    n_li = [i/2 for i in n_li if i%2==0]
    count+=1
    
print(ans)

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

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

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


if __name__ == '__main__':
    main()

Solution (Python):
from collections import deque
n = int(input())
num = deque([2**_ for _ in range(8)])
while num:
    a = num.pop()
    if a<=n:
        print(a)
        break

Solution (Python):
n = int(input())
key = [2**int(x) for x in range(6, -1, -1)]
for value in key:
  if value <= n:
    print(value)
    break

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

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

Solution (Python):
import math
N = int(input())
for i in reversed(range(1, N+1)):
    if math.log2(i) == int(math.log2(i)):
        print(i)
        break

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

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

Solution (Python):



data=int(input())

for i in range(0,data):
    if 2**i <= data < 2**(i+1):
        break
print(2**i)

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

Solution (Python):
import numpy as np
n = int(input())

ansList = []
for i in range(1,n+1):
  cnt = 0
  for j in range(10):
    if i %2 ==0:
      i/=2
      cnt +=1
    else:
      ansList.append(cnt)
      break
print(np.argmax(ansList)+1)

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


def f(v):
    if v % 2 == 1:
        return 0
    else:
        return f(v // 2) + 1


v = 1
cnt = 0
for i in range(2, N + 1):
    if f(i) > cnt:
        cnt = f(i)
        v = i
print(v)

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

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

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

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

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

    print(1)

Solution (Python):
n = int(input())
data = [i*2 for i in range(1,n//2+1)]
def f(x):
    cnt = 0
    flg = 0
    while flg==0:
        if x%2==0:
            cnt += 1
            x = x/2
        else:
            flg = 1
    return cnt 
aim = 0
for i in data:
    if aim < f(i):
        aim = f(i)
        num = i
    else:
        continue
if n==1:
    print(1)
else:    
    print(num)

Solution (Python):

n = int(input())
count = 0

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

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

for i in range(1,N+1):
  x = 0
  if i%2 == 0 or i == 1:
    remainder = 0
  else:
    remainder = 1
  while i%2 == 0:
    x += 1
    i /= 2
  if x >= y:
    y = x
    z = 2**x+remainder
    
print(z)

Solution (Python):
n = int(input())
nums = []
i = 0 
while True :
  x = 2**i
  if x>100 :
    break
  nums.append(x)
  i+=1
print( [i for i in nums if i<=n][-1])

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

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


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

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

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