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

resultMax = 0
resultI = 0
for i in range(n,0,-1) :
  result = 0
  t = i
  while t%2 == 0:
    t = t//2
    if t == 1 and result+1 >= resultMax:
      print(i)
      exit(0) 
    result += 1
  if resultMax <= result:
    resultMax = result
    resultI = i

print(resultI)

Solution (Python):
n = int(input())
L = []
j = 0
for i in range(n):
    s = list(bin(i+1)[2:])[::-1]
    cnt = 0
    while j <=n-1:
        if s[j] == "0":
            cnt +=1
            j +=1
            
        elif s[j] == "1":
            L.append((cnt,i+1))
            cnt=0
            break
    j =0
print(max(L)[1])

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

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

m = 1
max_cnt = 0
for i in range(2, N+1, 2):
    cnt = 0
    tmp = i
    while tmp % 2 == 0:
        cnt += 1
        tmp /= 2
    if cnt > max_cnt:
        max_cnt = cnt
        m = i
print(m)

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


for x in range(10):
    if N < 2**x:
        break

print(2**(x-1))

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

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

print(ans)

Solution (Python):
N=int(input())
ans=[]
l=[]
for i in range(1,N+1):
    l=list(str(format(i,'b')))
    l.reverse()
    l_=l.index('1')
    ans.append([l_,i])
ans.sort(reverse=True)
print(ans[0][1])

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

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

Solution (Python):
n = int(input())
target  = [2**i for i in range(1,7)]
for i in reversed(target):
  if n >= i :
    print(i)
    exit()
print(1)

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 cntm<cnt:
        ans=i
        cntm=cnt
print(ans)

Solution (Python):

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

Solution (Python):



n = int(input())

num = 1
while n >= 2 ** num :
  num = num + 1

num = num -1
result = int(2 ** num)

print(result)

Solution (Python):
n=int(input())
a=0
if n<=2:
    print(n)
elif n<4:
    print(2)
else:
    for i in range(n//2):
        if 2**a<=n:
            a+=1
        else:
            break
    print(2**(a-1))

Solution (Python):


import numpy as np


n=int(input())
ans=1
while(1):
    n=n>>1
    if(n==0):
        print(ans)
        exit(0)
    ans*=2

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

l = [2 ** x for x in range(0, 10)]

for i in range(0, 9):
    if l[i] <= n < l[i + 1]:
        print(l[i])
        break

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


L = []
for i in range(N):
    L.append(i + 1)

cntArray = []
maxNum = 0
i_when_max = 0
for i in range(len(L)):
    cnt = 0
    while L[i] % 2 == 0:
        cnt += 1
        L[i] = L[i] / 2
    cntArray.append(cnt)
    if cntArray[i] > maxNum:
        maxNum = cntArray[i]
        i_when_max = i

L = []
for i in range(N):
    L.append(i + 1)
print(L[i_when_max])

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

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

Solution (Python):
def How_many_times_devide(n):
    count = 0
    while n %2 == 0:
        n/= 2
        count += 1

    return count

N = int(input())
num_max = 1
count_max = 0
for i in range(1,N+1):
    count = How_many_times_devide(i)
    if count_max < count:
        count_max = count
        num_max = i

print(num_max)

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

N = int(input())
ans = [0, -1]
for i in range(1, N + 1):
    cnt = 0
    j = i
    while i % 2 == 0:
        cnt += 1
        i //= 2
    if cnt > ans[1]:
        ans = [j, cnt]
print(ans[0])

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 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
from bisect import bisect

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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

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

print(ans)

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

i = 0
ans = 1
while True:
    i += 1
    p = pow(2, i)
    if p <= N:
        
        ans = p
        pass
    else:
        
        break

print(ans)

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

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

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

ans = 1

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

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

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

Solution (Python):



N = int(input())

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

if N < a:
    a /= 2

print(int(a))

Solution (Python):


n = int(input())

"""
def n2count(n):
    if n%2==1:
        return 0
    else:
        return 1 + n2count(n//2)
        
lis = []
for i in range(1, 101):
    lis.append(n2count(i))
print(lis)
print(len(lis))
"""

lis_c = [0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2]

m = max(lis_c[:n])
for idx, num in enumerate(lis_c[:n]):
    if num == m:
        print(idx+1)

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

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

Solution (Python):
N = int(input())
for i in range(0,8):
    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):
N = int(input())

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

Solution (Python):
N = int(input())
even_A = list(range(1, N+1))
dic = {}
for a in even_A:
  x = a
  cnt = 0
  while x%2 == 0:
    x /= 2
    cnt += 1
  dic[a] = cnt

ans = sorted(dic.items(), key=lambda x:x[1])[-1]

print(ans[0])

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

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

cnt=0
for i in range(1,n+1):
    cnt_tmp=0
    tmp=i
    while tmp%2==0:
        cnt_tmp+=1
        tmp=tmp/2
    cnt=max(cnt, cnt_tmp)
    

print(2**cnt)

Solution (Python):
n=int(input())
a=len(bin(n))-3
print(n>>a<<a)

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

result = 0
i = 0

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

Solution (Python):
N=int(input())
l=[]

for i in range(1,N+1):
    ans=0
    while(1):
        if i%2!=0:
            l.append(pow(2,ans))
            break
        else:
            i/=2
            ans+=1
print(max(l))

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

Solution (Python):

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

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

Solution (Python):
N = int(input())
result = 1
i = 0
x = 0

while True:
  if (2 ** i) <= N:
    i += 1
  else:
    break

print(2 **(i-1))

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

j=0
a=0
while l[j]<=n:
    a=l[j]
    j+=1
print(a)

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

Solution (Python):
import math

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

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

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

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

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

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

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

counts = 0
ans = 1

for i in range(s + 1):
  k = i
  count = 0
  while(True):
    if i % 2 == 1 or i == 0:
      break

    i = i / 2
    count += 1
  
  if counts < count:
    counts = count
    ans = k

print(ans)

Solution (Python):

 
import math
import itertools
import sys
import copy
 



N = int(input())


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

Solution (Python):
def main():
    N = int(input())
    tmp = [2**6, 2**5, 2**4, 2**3, 2**2, 2, 1]
    for t in tmp:
        if N >= t:
            print(t)
            exit()
if __name__ == '__main__':
    main()

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

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

Solution (Python):


N = int(input())
ans = 1

while ans * 2 <= N:
    ans *= 2

print(ans)

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

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

Solution (Python):
n=int(input())
ans=0
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):
import math
n=int(input())
print(2**math.floor(math.log(n,2)))

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

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

Solution (Python):
import sys
from math import log2, floor

n = int(sys.stdin.readline().rstrip())

def main():
    x = floor(log2(n))
    return 2 ** x

if __name__ == '__main__':
    ans = main()
    print(ans)

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

ans = 0

for i in range(N + 1):
    t = 0
    while i % 2 == 0  and  i != 0:
        i /= 2
        t += 1
        ans = max(ans, t)
print(2**int(ans))

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

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

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

Solution (Python):
import math

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

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

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

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

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

Solution (Python):

def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

N=one_int()

import math

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

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

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

print(ans)

Solution (Python):
a=int(input())
saiko=0
count=0
for j in range(1,a+1):
  count=0
  while j%2==0:
    count+=1
    j=j//2
  saiko=max(saiko,count)
print(2**saiko)

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

Solution (Python):
a = int(input())
s = 0
d = 2
while 1:
    s += 1
    k = d ** s
    if k > a:
        print(d ** (s-1))
        break

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

ans = 1
while True:
    if ans > n:
        print(ans//2)
        import sys
        sys.exit()
    if ans == n:
        print(ans)
        import sys
        sys.exit()
    ans *= 2

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

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

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

Solution (Python):
N = int(input())
S = []

for i in range(1,N+1):
    t = 0
    while i % 2 == 0:
        i //= 2
        t += 1
    S.append(t)
 
p = max(S)
print(2 ** p)

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

count1 = 0

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

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

ans = 0
cmax = -1
for ii in range(1, n + 1):
    c = 0
    i = ii
    while i > 0:
        if i % 2 == 0:
            i = i // 2
            c += 1
        else:
            break
    if c > cmax:
        ans = ii
        cmax = c
print(ans)

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

Solution (Python):
n = int(input())
L = [2**x for x in range(0,7)]

ans = 0
for l in L:
    if n >= l:
        ans = l

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

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

isnext = 0
ans = 0

while isnext == 0:
        for i in range(N,-1,-1):
                if(False ==  (i & (i-1))):
                        ans = i
                        isnext = 1
                        break
                else:
                        next

print(ans)

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

Solution (Python):

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

    best = 0
    best_num = 1
    for i in range(n):
        k = i + 1
        c = 0
        while k % 2 == 0:
            k //= 2
            c += 1
        if c > best:
            best = c
            best_num = i + 1

    print(best_num)

if __name__ == '__main__':
    main()

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

x=2**1
for i in range(2,8):
    x=2**i
    if(x>n):
        print(x//2)
        exit()

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

count_dict = {}

for num in range(1, n + 1):
    count_dict[num] = 0
    tmp = num
    while True:
        if tmp % 2 == 0:
            tmp /= 2
            count_dict[num] += 1
        else:
            break

max_count = max(count for count in count_dict.values())
result = [k for k, v in count_dict.items()
          if v == max_count][0]

print(result)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=int(input())
    s=1
    while s*2<=n:
        s*=2
    print(s)
main()

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

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

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

Solution (Python):





n = int(input())

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

print(i//2)

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

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

Solution (Python):
n=int(input())
l=[]

for i in range(1,n+1):
    m=0
    while i%2==0:
        m+=1
        i=i/2
    else:
        l.append(m)

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

Solution (Python):
N = int(input())
a = [0, -1] 
for i in range(N):
        tmp = N - i 
        cnt = 0 
        while tmp > 1:
                if tmp % 2 != 0:
                        break
                else:
                        cnt += 1
                        tmp /= 2
        if a[1] < cnt:
                a = [N - i, cnt] 
print(a[0])

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

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

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

Solution (Python):
l = list()
n = int(input())
original_list = list(range(1,n+1))
for x in original_list:
      ans = 0
      while x % 2 == 0:
        x = x / 2
        ans = ans + 1
      l.append(ans)

a = l.index(max(l))
print(original_list[a])

Solution (Python):
print(2 ** (len(format(int(input()), "b")) - 1))

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

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

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

N = int(input())
ans = 1
count = 0

for i in range(N, 1, -1):
  tmp = div2_count(i) 
  if tmp > count: 
    ans = i
    count = tmp
    
print(ans)

Solution (Python):
N=int(input())
cnt_list={}

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

print(max(cnt_list,key=cnt_list.get))

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

Solution (Python):
i = int(input())
for j in range(8):
    if ((i >> j) & 1) == 1:
        a = 2**j      
print(a)

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

target = 1
for i in range(1, N+1):
    if 2 ** i <= N:
        target = 2 ** i

print(target)

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

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

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

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

while max_n * 2 <= N:
    max_n *= 2

print(max_n)

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

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


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

for i in range(1, n+1):
    a = divide_two_count(i)
    list.append(a)

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

Solution (Python):
n = int(input())
cnt = 1
while 2**cnt <= n:
    cnt += 1
print(2**(cnt-1)) if n != 1 else print(1)

Solution (Python):
a=[2**i for i in range(8)]
import bisect
n=int(input())
s=bisect.bisect_left(a,n)
if n==a[s]:
    print(n)
    exit()
print(a[s-1])

Solution (Python):


from math import log,floor

N=int(input())
print(2**floor(log(N,2)))

Solution (Python):
n = int(input())
ans = list(range(n+1))
for i in ans:
    if ans[i]%2!=0:
        ans[i]=0
    else:
        count = 0
        while(True):
            if ans[i]%2 != 0 or ans[i] == 0:
                ans[i] = count
                break
            else:
                ans[i]/=2
                count+=1
ans[0] = -1
print(ans.index(max(ans)))

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

    ans = 2 ** i
print(ans)

Solution (Python):

N = int(input())
judge = 1
for i in range(7):
    if N < 2**i:
        print(2**(i-1))
        judge = 0
        break
        
if judge == 1:
    print(64)

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

Solution (Python):
N = int(input())
result = {}
for i in range(1, N + 1):
    result[i] = 0
    tmp = i
    while True:
        if tmp % 2 == 0:
            tmp = tmp / 2
            result[i] += 1
        else:
            break
print(sorted(result.items(), key=lambda x: -x[1])[0][0])

Solution (Python):
N = int(input())
res = [x for x in range(1, N + 1)]
result = {}
for i in res:
    result[i] = 0
    tmp = i
    while True:
        if tmp % 2 == 0:
            tmp = tmp / 2
            result[i] += 1
        else:
            break
print(sorted(result.items(), key=lambda x: -x[1])[0][0])

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

for i in num_list:
  if N>=i:
    print(i)
    exit(0)

print(0)

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
i = 1
while True:
    if 2**i > n:
        break
    i += 1
print(2**(i-1))

Solution (Python):
N=int(input())
ans=[]
for k in range(1,N+1):
    M=0
    for i in range(7):
        if k%(2**(i+1))==0:
            M+=1
    ans.append(M)
print(ans.index(max(ans))+1)

Solution (Python):
n = int(input())
  
def divide_count(c):
  count = 0
  while True:
    if c % 2 == 0:
      c = c / 2
      count += 1
    else:
      return count
    
answer = 1
dc = 0
before = 0
for i in range(n):
  count = i+1
  dc = divide_count(count)
  if before < dc:
    answer = count
    before = dc
print(answer)

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

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

    if count >= max:
        max = count
        ans = i+1

print(ans)

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


max = -1
ans = -1

for i in range(n):
	count = 0
	k = i+1
	
	
	while k%2 == 0:
		count = count+1
		k = k/2
		
	if count >= max:
		max = count
		ans = i+1

print(ans)

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

Solution (Python):

N = int(input())

two = 0

while N >= 2 ** two:
    two += 1

print(2 ** (two - 1))

Solution (Python):
n = int(input())
ls = [[2,1]]
two = 2
i = 1
while True:
    two *= 2
    i += 1
    if two > 200:
        break
    ls.append([two,i])
    
if n == 1:
    print(1)
else:
    for i in range(len(ls)):
        if ls[i][0] > n:
            print(ls[i-1][0])
            break

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

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

Solution (Python):

num = int(input())
two = 0

while num >= 2**two:
    two += 1

print(2 ** (two - 1))

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

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

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

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):
n = int(input())
for i in range(7):
    a = 2**i
    if a <= n:
        ans = a
print(ans)

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

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

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

max_count = 0
max_num = 1
for num in range(1, N+1):
    num_ = num
    count = 0
    rest = 0
    while rest == 0:
        rest = num_ % 2
        num_ = num_ / 2
        if rest == 1:
            continue
        else:
            count += 1
    if count > max_count:
        max_count = count
        max_num = num
print(max_num)

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 examB():
    N = I()
    ansC = [(i+1) for i in range(N)]
    k = 0
    while(len(ansC)>=2):
        cur = []
        for i in ansC:
            if i % 2 == 0:
                cur.append(i // 2)
        ansC = cur
        k +=1
        if len(ansC)==1:
            break
    ans = 2**k
    print(ans)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Solution (Python):

n = int(input())
candidate = 1

if n == 1:
    print(1)
else:
    while candidate <= n:
        candidate *= 2
    print(candidate // 2)

Solution (Python):
N = int(input())
 
l = [64, 32, 16, 8, 4, 2, 1]
 
for i in range(len(l)):
  if l[i] <= N:
    print(l[i])
    break

Solution (Python):
A = int(input())
s = 2
for i in range(1,A):
  if A == 1:
    print(1)
    break;
  elif A == 2:
    print(2)
    break;
  elif s <= A:
    s = 2**i
  else:
    break;
      
print(s//2)

Solution (Python):
def main():
  N = int(input())
  num = 0
  answer = 0
  for i in range(1, N + 1):
    count = calc(i)
    if num <= count:
      num = count
      answer = i
  
  print(answer)

def calc(i):
  answer = 0
  j = i
  while j % 2 == 0:
    j //=  2
    answer += 1
  return answer

main()

Solution (Python):


n=int(input())
tmp=0
count=0
ans=0
wer=0
if n==1:
    print(1)
else:
    for i in range(1,n+1):
    
        tmp=i
        for j in range(n):
            if tmp%2==0:
                count+=1
                tmp=tmp//2
            else:
                if count>ans:
                    ans=count
                    wer=i
                count=0
                break
    print(wer)

Solution (Python):
n = int(input())
ans = 0
ls = []

for i in range(1, n+1):
    cnt = 0
    while i % 2 == 0:
        i /= 2
        cnt += 1
    ans = max(ans, cnt)
    ls.append(ans)

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

Solution (Python):
n=int(input())
i=1
h=1
count=0
l=[]
while h<=n:
    if i%2==0:
        count+=1
        i=i/2
    else:
        l.append(count)
        h+=1
        i=h
        count=0
print(l.index(max(l))+1)

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

Solution (Python):
import numpy as np

n = int(input())
counts = []
for i in range(1, n+1):
    count = 0
    while i % 2 == 0:
        count+=1
        i /= 2
    counts.append(count)
print(np.argmax(counts)+1)

Solution (Python):
N = int(input())
s = [i for i in range(1,N+1)]
counter = 0

while True:
    if 2 ** (counter+1) in s:
        counter += 1
    else:
        break
        
print(2 ** counter)

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

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

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

print(ans)

Solution (Python):
n=int(input())
a=0
for i in range(100):
  if a<=n:
    a=2**(i+1)
  else:
    print(2**(i-1))
    exit()

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

Solution (Python):
N = int(input())
pow2 = [2**i for i in range(7)]
ans = 0
if N >= 2:
    for i in range(N+1):
        if i in pow2:
            ans = max(i,ans)
else:
    ans = 1
print(ans)

Solution (Python):
N = int(input())
n2s = [2**i for i in range(10)][::-1]
for n2 in n2s:
    if n2 <= N:
        print(n2)
        break

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

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

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

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

Solution (Python):
N = int(input())
ans = 0
maxcnt = -1
for i in range(1,N+1):
    cnt = 0
    now = i
    while now % 2 == 0:
        now /= 2
        cnt += 1
    if maxcnt < cnt:
        maxcnt = cnt
        ans = i
print(ans)

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

n = int(input())
idx = bisect.bisect(ans_list,n)

print(ans_list[idx-1])

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

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

for i in range(1,N+1):
    c=list(str(bin(i))).count("0")
    if cnt < c:
        cnt=c
        ans=i
print(ans)

Solution (Python):
N = int(input())
cnt=0
for x in range(1,N+1):
    tmp=0
    while True:
        if x%2==0:
            if x == 1:
                break
            x=x//2
            tmp+=1
        else:
            break
    if cnt<=tmp:
        cnt=tmp
print(2**cnt)

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

print(2**(k-1))

Solution (Python):
N = int(input())
maxCount = 0
ans = 0
for i in range(1, N+1):
    tmpCount = 0
    j = i
    while True:
        if j % 2 != 0:
            break
        j = j/2
        tmpCount += 1
    
    if maxCount <= tmpCount:
        maxCount = tmpCount
        ans = i

print(ans)