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

ans = 1

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

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

n = int(input().rstrip('\n'))
log_floor = math.floor(math.log(n, 2))
res = 0
while True:
    if res == log_floor: print(2 ** res); exit()
    res += 1

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

Solution (Python):
import bisect
n = int(input())
a =[1,2,4,8,16,32,64,128]
ans = bisect.bisect_right(a,n)
print (a[ans-1])

Solution (Python):
import collections

N = int(input())


def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

max_devide = 0
ans = 1
for i in range(N+1):
    
    if factorize(i).count(2) > max_devide:
        max_devide = factorize(i).count(2)
        ans = i

print(ans)

Solution (Python):
n = int(input())
list_n = [2 ** i for i in range(1, 8)]
bag =[1]
for i in list_n:
    if n >= i:
        bag.append(i)
print(max(bag))

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

for i in range(8):
    if a >= 2**i:
        pass
    else:
        print(2**(i-1))
        exit()

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

Solution (Python):
N = int(input())
tmp = 2
while tmp <= N:
    tmp += tmp
print(int(tmp/2))

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
r = 0
res = 1
for i in range(1, N + 1):
  t = i
  c = 0
  while t % 2 == 0:
    c += 1
    t //= 2
  if c > r:
    res = i
    r = c
print(res)

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

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

original = [i + 1 for i in range(n)]
numbers = [i + 1 for i in range(n)]

count = [0 for i in range(n)]

while any(i % 2 == 0 for i in numbers):
    for j,number in enumerate(numbers):
        
        if number % 2 == 0 :
            numbers[j] = number / 2
            count[j] += 1

print (original[count.index(max(count))])

Solution (Python):
n = int(input())
ans = 0
powers_2 = [2,4,8,16,32,64]
for i in range(len(powers_2)):
    if n == 0:
        ans = n
        break
    elif n == 1:
        ans = n
        break
    elif powers_2[i] <= n:
        ans = powers_2[i]
        continue
    elif powers_2[i] > n:
        ans = powers_2[i - 1]
        break
print(ans)

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

if n == 1:
    anss = 1
print(int(anss))

Solution (Python):
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    N = int(inputs[0])
    for i in reversed(range(N+1)):
        flg = True
        count = i
        while count > 1:
            if count % 2 != 0:
                flg = False
                break
            count = count // 2
        if flg:
            return i


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

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

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

max_count = 0
for i in range(1, n + 1):
    count = 0
    tmp = i
    while tmp % 2 == 0:
        tmp /= 2
        count += 1
    if max_count <= count:
        max_count = count
        max = i

print(max)

Solution (Python):
import math
n = int(input())
x = [i for i in range(1,n+1)]
res = []
judge = 0

while len(x)>1:
  for j in x:
    if j%2==0:
      res.append(j/2)
  else:
    x = res
    res = []
    judge += 1

print(math.floor(x[0]*(2**judge)))

Solution (Python):

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


if __name__ == "__main__":
    main()

Solution (Python):

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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


def multiple2(N):
    res = 1
    while res * 2 <= N:
        res *= 2
    
    return res

print(multiple2(N))

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

print(2**(k-1))

Solution (Python):
import sys 
N = int(input())
i = 0
while True:
  if 2**i > N:
    print(2**(i-1))
    sys.exit()
  i = i+1

Solution (Python):
from math import log2, floor

N = int(input())

print(2**floor(log2(N)))

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

x = [2 ** i for i in range(7)]

import bisect

b = bisect.bisect_right(x , n)
print(x[b-1])

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

for a in range(7):
    if n >= 2**a and n < 2**(a+1):
        print(2**a)

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

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

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

print(2**(i-1))

Solution (Python):



import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


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

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

        if tmp > ansn:
            ansn = tmp
            ans = i

    print(ans)


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

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

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

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

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


if __name__ == "__main__":
    
    resolve()

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

list = [1, 2, 4, 8, 16, 32, 64, 126]

ans = 0

for i in  range (1, 8):
    if list[i] > N:
        ans = list[i-1]
        break

print(ans)

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

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

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

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

input_list = list(range(1, input + 1))

count_list = []

for e in input_list:
    count = 0
    e_tmp = e
    while True:
        if e_tmp % 2 == 0:
            e_tmp = e_tmp/2
            count += 1
        else:
            break
    count_list.append([e, count])

max_value = 0
max_key = 0

for i in range(input):    
    curr_value = int(count_list[i][1])
    if curr_value >= max_value:
        max_value = curr_value
        max_key = count_list[i][0]
    
print(max_key)

Solution (Python):

ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def div2(n):
    cnt = 0
    while n>0:
        if n%2 == 0:
            cnt += 1
        n = n//2
    return cnt

N = ni()
ans = 0
ans2 = 0

for i in range(1,N+1):
    t = div2(i)
    if t > ans:
        ans = t
        ans2 = i

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

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
    counter = 0
    real_number = i
    while i > 0:
        i //= 2
        counter += 1
    if counter > ans:
        ans = counter
        ans_number = real_number
print(ans_number)

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

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

Solution (Python):
import math
N = int(input())
if abs(math.log2(N)-round(math.log2(N)))<1e-8:
    n = round(math.log2(N))
else:
    n = int(math.log2(N))
print(2**n)

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

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

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

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

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

x = 1

while n >= x:
  x *= 2

print(1 if x==1 else x//2)

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

x = 1

while n >= x:
  x *= 2

print(1 if x==1 else x//2)

Solution (Python):
n=int(input());s=format(n,'b');print(2**(len(s)-1))

Solution (Python):
N = int(input())
num = [i for i in range(1, N+1)]
count = [0] * N

for i in range(len(num)):
    while num[i] % 2 == 0:
        count[i] += 1
        num[i] //= 2
ans = 0
cnt = 0
for i, j in enumerate(count):
    if j > cnt:
        cnt = j
        ans = i+1

print(ans if N != 1 else 1)

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

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

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

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

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

Solution (Python):
n = int(input())
for i in range(7,0,-1):
  a = 2**i
  b = 2**(i-1)
  if(b<=n and n<=a):
    break
print(b)

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

for i in range(-1,-8,-1):
    if S[i] <= N:
        break
print(S[i])

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

for i in range(7):
    if S[i] <= N:
        break
print(S[i])

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

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

Solution (Python):
def main():
    n=int(input())
    two_pow = 2
    while two_pow <= n:
        two_pow *=2
    print(two_pow//2)
if __name__ == '__main__':
    main()

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

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

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

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())
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):
n = int(input())
for i in range(99):
  if 2**i <= n:
    continue
  else:
    print(2**(i-1))
    break

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

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


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

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

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

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

Solution (Python):
s = [1, 2, 4, 8, 16, 32, 64]

n = int(input())
while True:
    if n in s:
        print(n)
        break
    n -= 1

Solution (Python):
N=int(input())
import math
l=[]
for i in range(1, N+1):
    l.append(math.log2(i))

m=[l.index(n)+1 for n in l if n==int(n)]

print(m[-1])

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

for i in range(8):
    if 2**i <= n:
        ans=2**i

print(ans)

Solution (Python):
N = int(input())
ans = 1
max_count = 0
n = 2
while (n <= N):
  k = n
  count = 0
  while k%2 == 0:
    k /= 2
    count += 1
  if count > max_count:
    ans = n
    max_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())

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    t = 1
    while True:
        if t > n:
            print(t // 2)
            exit()
        else:
            t *= 2


if __name__ == '__main__':
    slove()

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

Solution (Python):

N = int(open(0).read())
cnt=0
for j in range(6):


    if (N // 2 == 0):
        break
    else:
        N //= 2

        cnt+=1

print(2 ** cnt)

Solution (Python):
n = int(input())
a = [int(i)+1 for i in range(n)]

for i in range(len(a)):
    num = a[i]
    cnt = 0
    while a[i] % 2 == 0:
        a[i] //= 2
        cnt += 1
    if i == 0:
        ans = num
        max_cnt = cnt
    elif max_cnt < cnt:
        ans = num
        max_cnt = cnt

print(ans)

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

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

if n == 1:
    print('1')
elif n == 2:
    print('2')
else:
    print(2**(x-1))

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

Solution (Python):
number = int(input())
ans = 1
if number != 1:
  for i in range(6):
    ans *= 2
    if ans > number:
      ans = ans // 2
      break
print(ans)

Solution (Python):
N = int(input())
d = [0 for i in range(N)]

for i in range(1,N + 1):
    cnt = 0
    j = i
    while j % 2 == 0:
        cnt += 1
        j /= 2
    d[i-1] = cnt

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

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

ans = 0
while n//2!=0:
  n//=2
  ans+=1

print(2**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):
s = int(input())
for i in range(8):
    if s < 2 ** i:
        print(2 ** (i-1))
        exit()

Solution (Python):
n=int(input())
if 0<=n<=1:
  print(1)
elif 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)

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

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

while N != 0:
    N //= 2
    ans += 1

print(2 ** ans)

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

Solution (Python):
a = set()
for i in range(-1,7):
    a.add(2**(i+1))
for i in range(int(input()),0,-1):
    if i in a:
        print(i)
        break

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
ans = 1
while ans <= N:
	ans *= 2
print(ans//2)

Solution (Python):
n = int(input())
l=[2,4,8,16,32,64]
ans =[]
for i in range(n+1):
  if i in l:
    ans.append(i)
  else:
    ans.append(1)
print(max(ans))

Solution (Python):
n = int(input())
cand = [0 for i in range(n)]
for i in range(n):
    m = i+1
    while m%2 == 0:
        m = int(m//2)
        cand[i] += 1
print(1+cand.index(max(cand)))

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

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

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

n = int(input())

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

print(n)

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

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

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

ans = 0

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

print(2 ** ans)

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

for i in range(1,n+1):
    while True:
        if i%2 == 0:
            i = i//2
            num += 1
        else:
            ans = max(ans,num)
            
            num = 0
            break
print(2**ans)

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

x = 1
cnt = 0
list = []

for i in range(n):
    i = x
    while i % 2 == 0:
        i =  i//2
        cnt += 1
    x += 1
    list.append(cnt)
    cnt = 0

print(2 ** max(list))

Solution (Python):
N = int(input())
ans = [0] * N
for i in range(1, N + 1):
    c = 0  
    q = i  
    while q % 2 == 0:  
        q = q // 2
        c += 1
    ans[i - 1] = c

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

Solution (Python):
import math

N=int(input())
M=2**int(math.log2(N))

print(M)

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

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

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

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

print(2**(len(bin(n))-2-1))

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

m = 2

while True:
  if m > n:
    m = m//2
    break
  else:
    m *= 2
  
print(m)

Solution (Python):
N = int(input())
A = [2,4,8,16,32,64]
count = 0
for i in range(6):
  if A[i] <= N:
    count += 1
print(2**count)

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

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

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

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


if __name__ == "__main__":
    resolve()

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

arr = range(1,n+1)

cnt = 0
cnt2 = 0
ans = 1
tmp = 1

for num in arr:
    tmp = int(num)
    while num % 2 == 0:
        num = num // 2
        cnt2 += 1
    
    if cnt <= cnt2:
        cnt = cnt2
        ans = tmp

    cnt2 = 0

print(ans)

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

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

a=0
for i in range(1,n+1):
    a=max(a,ans(i))
print(2**a)

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

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

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

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

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

    max_count = 0
    max_index = -1

    for i in range(1,N+1):
        count = 0
        num = i
        while True:
            if num % 2 == 0:
                count += 1
                num /= 2
            else:
                max_count = max(max_count, count)
                if max_count == count:
                    max_index = i
                break
    print(max_index)

if __name__ == "__main__":
    break_number()

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

ans, k = 1, 0
for i in range(2, N+1, 2):
    temp, res = i, 0
    while temp%2 == 0:
        res += 1
        temp //= 2
    if k < res:
        ans = i
        k = res
print(ans)

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

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

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

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

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

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

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

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

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

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

Solution (Python):

N = int(input())
count_list = []

for i in range(N):
    r = i + 1
    count = 0
    while r % 2 == 0:
        r = r / 2
        count += 1
    else:
        count += 0
    count_list.append(count)

M = max(count_list)
l = count_list.index(M)
print(l + 1)

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

print(ans)

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

for i in reversed(range(8)):
  if 2 ** i <= n:
    print(2 ** i)
    break

Solution (Python):
n = int(input())
a = [i for i in range(1,n+1)]
count = 0
while len(a) > 1:
    a = [i for i in a if i % pow(2,count+1) == 0]
    count += 1
print(a[0])

Solution (Python):
n=int(input());print(2**(len(bin(n+(n>1>n&~-n)))-3))

Solution (Python):
n=int(input())
if not n&(n-1) and n>1:n+=1
print(2**(len(bin(n))-3))

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

ans = 1
mcnt = 0

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

Solution (Python):
n = int(input())
n_bin = bin(n)[2:]
ans_bin = "1" + ("0" * (len(n_bin) -1))
print(int(ans_bin, 2))

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

Solution (Python):
print(2**len(bin(int(input())))//8)

Solution (Python):
n = int(input())
nl = list(range(1,n+1))
cl = [0]*(n+1)
mc = 0

for i in range(n):
  while(1):
    if nl[i]%2 == 0 and nl[i] != 0:
      cl[i+1]+=1
      nl[i]/=2
    else:
      if cl[i+1] > cl[mc]:
        mc = i+1
      break
      
print(mc if mc != 0 else 1)

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

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

Solution (Python):
n = int(input())
cand = []
if n == 1:
    print(1)
else:
    for i in range(n, 1, -1):
        count = 0
        identifier = i
        while True:
            if i % 2 == 0:
                i /= 2
                count += 1
            else:
                cand.append([count, identifier])
                break
    cand.sort()
    print(cand[len(cand) - 1][1])

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

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

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

for i in range(n+1)[::-1]:
    if num.count(i):
        print(i)
        break

Solution (Python):
N = int(input())
a = [1, 2, 4, 8, 16, 32, 64]
b = []
for i in range(len(a)):
    if a[i]<=N:
        b.append(a[i])
print(max(b))

Solution (Python):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
    
n=int(input())
cnt=0

while n>0:
	n=n//2
	cnt+=1
	
print(2**(cnt-1))

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

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

print(max([n_list[i] for i in range(7) if n_list[i]<=N]))

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

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

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

maxCount = 0
answer = 0

for n in range(1, N+1, 1):
    target = n
    flg = True
    count = 0
    

    while flg:
        if target % 2 == 0:
            target /=  2
            count += 1
        else:
            flg = False

    if ( maxCount <= count):
        maxCount = count
        answer = n

print(answer)

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

Solution (Python):
n=int(input())
if n <=1:
    ans=n
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):
import sys
input = sys.stdin.readline

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

    tmp = 1
    count = 0
    while tmp * 2 <= N:
        tmp *= 2
        count += 1
    print(tmp)


if __name__ == "__main__":
    main()

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

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

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    
    num = 1
    while num * 2 <= N:
        num *= 2
    
    print(num)

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

Solution (Python):
N = int(input())
print(2 ** (len(bin(N)[2:]) - 1))

Solution (Python):

N = int(input())
ll = [1,2,4,8,16,32,64]
for a in ll:
    if a <= N:
        ans = a
print(ans)

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

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

cntm = 0
ans = 1

for i in range(1, N+1):
    a = i
    cnt = 0
    while a % 2 == 0:
        a /= 2
        cnt += 1
    if cnt > cntm:
        cntm = cnt
        ans = i
         
print(ans)

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

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

print(ans)

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

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

print(max(ans))

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

Solution (Python):
n=int(input())
for i in range(99):
  if 2**i <= n:
    continue
  else:
    print(2**(i-1))
    break

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

Solution (Python):
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
ans = [0, 1]
for i in range(1, n+1):
    num = i
    ct = 0
    while num > 1:
        if num % 2 == 0:
            num //= 2
            ct += 1
        else:
            break
    if ct > ans[0]:
        ans = [ct, i]
print(ans[1])

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

Solution (Python):
n = (int(input()))
if n ==1:
    print(1)
li = []
for i in range(1,n+1):
    if i%2 == 0:
        li.append(i)

li = [bin(x) for x in li]
li = li[::-1]
for i in range(len(li)):
    
    if li[i].count(str(1)) == 1:
        a=((li[i].count(str(0)) -1))
        print(2**a)
        break

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())

ans = 0
for i in range(8):
    if n >= 2 ** i:
        ans = i
print(2**ans)

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

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

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

max_count = 0
max_num = 1

for i in range(1, n + 1):
  count = 0
  if i % 2 == 0:
    count += 1
    num = int(i / 2)
    while num % 2 == 0:
      count += 1
      num /= 2
  if count > max_count:
    max_count = count
    max_num = i

print(max_num)

Solution (Python):
N = int(input().strip())
ans = 1
while True:
  if ans*2 > N:
    print(ans)
    break
  else:
    ans *= 2

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

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

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

Solution (Python):
def test():
    a = int(input())
    count = 0
    result = 0
    for i in range(1,a+1):
        num = i
        while num % 2 == 0:
            num //= 2
            count += 1
        if result < count:
            result = count
            a = i
        count = 0
    print(a)



if __name__ == "__main__":
    test()