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 = []
for i in range(N):
    q = i+1
    count = 0
    if q == 1:
        continue
    while True:
        if q%2 != 0:
            break
        q = q//2
        count += 1
    ans.append(count)

if len(ans) > 0:
    max_count = max(ans)
    print(ans.index(max_count)+2)
else:
    print(1)

Solution (Python):
n = int(input())
num = [i for i in range(1,n+1)]
jou = [2**j for j in range(0,7)]
for l in jou:
    if l in num:
        ans = l
    else:
        break
print(ans)

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

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

Solution (Python):
n = int(input())
li = [2,4,8,16,32,64]
import bisect
index = bisect.bisect(li,n)-1
import sys
if index == -1:
    print(n)
    sys.exit()
print(li[index])

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

def black_magic(n):
    d = {
        1: 1431655765,
        2: 858993459,
        4: 252645135,
        8: 16711935,
        16: 65535
    }
    n=(n&d[1])+((n>>1)&d[1])
    n=(n&d[2])+((n>>2)&d[2])
    n=(n&d[4])+((n>>4)&d[4])
    n=(n&d[8])+((n>>8)&d[8])
    n=(n&d[16])+((n>>16)&d[16])
    return n

while black_magic(N) - 1:
    N &= N-1
print(N)

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

Solution (Python):
n = int(input())
s = [i for i in range(1,n+1)]
counter = 0
while(True):
    if len(s)==1:
        print(1)
        break
    if len([i for i in s if i % 2 == 0])==1:
        s = [i for i in s if i % 2 == 0]
        print(int(s[0]) * (2 ** counter))
        break
    else:
        s = [i/2 for i in s]
        counter += 1

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

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

print(ans)

Solution (Python):
N=int(input())
lis=[0]*(N+1)
Mcnt=0
Mi=1

for i in range(1,N+1):
  lis[i]=i
  cnt=0
  while lis[i]%2==0:
    lis[i]//=2
    cnt+=1
    
  if Mcnt<cnt:
    Mcnt=cnt
    Mi=i
    
print(Mi)

Solution (Python):


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


if __name__ == "__main__":
    main()

Solution (Python):
import math


def answer(n: int) -> int:
    return 2 ** int(math.log(n, 2))


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


if __name__ == '__main__':
    main()

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

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

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

print(int(ans/2))

Solution (Python):
import bisect
n = int(input())
t = [1, 2, 4, 8, 16, 32, 64]

print(t[bisect.bisect_right(t, n)-1])

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

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

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

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

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

print(ans//2)

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

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

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

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

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

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):
N = int(input())
L = [64, 32, 16, 8, 4, 2]
for i in L:
  if i <= N:
    print(i)
    break
else:
  print(N)

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

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

print(ans)

Solution (Python):

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

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

if __name__ ==  "__main__":
    main()

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

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

Solution (Python):
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n = I()

no = 2

while no < n:
    no *= 2
if no > n:
    no = int(no/2)

print(no)

Solution (Python):
N = int(input())
count = 0
num = 1

while N >= num:
    count += 1
    num *= 2

print(num // 2)

Solution (Python):
N = int(input())
for i in range(100):
    x = 2 ** (100 - i)
    if x <= 64 and x <= N:
        ans = x
        break
    else:
        ans = N
print(ans)

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

Solution (Python):
N=int(input())
result=64
while N>=1:
  if N >= result:
    print(result)
    break
  result=int(result/2)
else:
  print(result)

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

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

Solution (Python):



from math import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq














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


INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
n = I()
lis = [2**i for i in range(10)]
idx = bisect.bisect_right(lis, n)
print(lis[idx-1])

Solution (Python):
import math

n = int(input())
ans, i = 0, 1
while ans <= n:
    ans = 2**i
    i += 1

print(ans//2)

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


ans = 0
max_cnt = -1
for i in range(1, int(input()) + 1):
    cdt = cnt_div_two(i)
    if cdt > max_cnt:
        ans = i
        max_cnt = cdt
print(ans)

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

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

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

print(ans)

Solution (Python):
N = int(input())
kmax = 0
x = 1
for i in range(1,N+1):
    k = 0
    y = i
    while y%2==0:
        y = y//2
        k += 1
    if k>kmax:
        x=i
        kmax = k
print(x)

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

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

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

Solution (Python):
N = int(input())
c = 0
ans = 1
for i in range(1, N + 1):
    n = i
    for t in range(N + 1):
        if n % 2 != 0:
            if c < t:
                c = t
                ans = i
            break
        n //= 2
print(ans)

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

def main():
    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(n)
main()

Solution (Python):


import math

def fact(N):
    ans = {}
    for i in range(2, math.ceil(math.sqrt(N))+1):
        if N % i != 0:
            continue
        ex = 0

        while N % i == 0:
            ex += 1
            N /= i
        ans[i] = ex

    if N != 1:
        ans[int(N)] = 1
    return ans

N = int(input())
max_x = 0
max_n = 0

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

for i in range(N+1):
    num = fact(i)
    num = num.get(2, 0)
    if num > max_n:
        max_x = i
        max_n = num

print(max_x)

Solution (Python):
n = int(input())
count = [0] * n
for i in range(1, n + 1):
    num = i
    while num % 2 == 0:
        num //= 2
        count[i - 1] += 1
print(count.index(max(count)) + 1)

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

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

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

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

if i > n:
    print(int(i / 2))
else:
    print(i)

Solution (Python):

import sys


def solve(N: int):
    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)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
import math

N = int(input())

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

if i <= N:
  print(i)
else:
  print(math.floor(i/2))

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

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

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

count_max = -1
OK = True

for i in range(N):
    count = 0
    a = N - i
    while a % 2 == 0:
        a = a // 2
        count += 1
        if count_max < count:
            count_max = count
    else:
        continue
if 2 ** count_max == 0.5:
    print(1)
else:
    print(2 ** count_max)

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

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

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


if __name__ == '__main__':
    resolve()

Solution (Python):
from math import log2

N = int(input())

m = 0
a = 0

for i in range(1, N + 1):
  l = log2(i)
  if l % 1 == 0:
    m = i


print(m)

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

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

Solution (Python):
n = int(input())
x = 0
for i in range(1, n+1):
    if i%64 == 0 and 64 > x:
        ans = i
        x = 64
    elif i%32 == 0 and 32 > x:
        ans = i
        x = 32
    elif i%16 == 0 and 16 > x:
        ans = i
        x = 16
    elif i%8 == 0 and 8 > x:
        ans = i
        x = 8
    elif i%4 == 0 and 4 > x:
        ans = i
        x = 4
    elif i%2 == 0 and 2 > x:
        ans = i
        x = 2
    elif i == 1:
        ans = 1
        x = 1
print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(7):
    if (n>>i)&1:
        ans=(n>>i)<<i
print(ans)

Solution (Python):
from itertools import count
n = int(input())
for i in count(0):
    if n < 2**(i+1):
        print(2**i)
        break

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

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

Solution (Python):
def solve(n):
  res = 0
  while(n != 1):
    if n%2 == 0:
      res += 1
      n /= 2
    else:
      break
  return res

n = int(input())

ans = 1
ans_max = 0
for i in range(1, n+1):
  cnt = solve(i)
  if cnt > ans_max:
    ans_max = cnt
    ans = i
print(ans)

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

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

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

for i in range(1,n+1,1):
    tmpCnt = 0
    j = i
    while j%2 == 0:
        j = j/2
        tmpCnt += 1
    if maxCnt < tmpCnt:
        maxCnt = tmpCnt
        ans = i

print(ans)

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

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

cnt = 0

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

cnt-=1

print(2**cnt)

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

X=[]


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

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

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

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

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

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

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

Solution (Python):

N = int(input())

if N == 1:
    print(N)
else:
    for i in range(1,8):
        if 2**(i+1) > N:
            print(2**i)
            break
        else:
            i+=1

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

Solution (Python):
N = int(input())
counter = 0
while N >= 2:
  N //= 2
  counter +=1
ans = 2**counter
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(7):
  if 2 ** i <= N < 2 ** (i + 1):
    print(2 ** i)
    exit()

Solution (Python):
print(1<<len(f'{int(input()):b}')-1)

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

Solution (Python):
print(2**max((i^(i-1)).bit_length()-1 for i in range(int(input())+1)))

Solution (Python):
import sys

N = int(input())

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

ans = 0
count_max = 0
for i in range(1, N+1):
    count = (i ^ (i-1)).bit_length() - 1
    if count_max < count:
        count_max = count
        ans = i

print(ans)

Solution (Python):

import sys
input=sys.stdin.readline

def main():
    number = int(input())
    counter=[]
    count=0

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

    for i in range(1,number+1):
        while i >= 2:
            if i % 2==0:
                i /= 2
                count+=1
            else:
                break
        counter.append(count)
        count=0
    print(counter.index(max(counter))+1)

if __name__=="__main__":
    main()

Solution (Python):
N=int(input())
res=[]
for i in range(0,N+1) :
  if N>=2**i :
    res.append(2**i)
print(res[-1])

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

ans = 1
cnt = 0

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

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

Solution (Python):

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

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

while N > 1:
    N = int(N/2)
    count += 1
print(2**count)

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

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

Solution (Python):
import sys
def I(): return int(sys.stdin.readline().rstrip())


N = I()
a = 1
while a <= N:
    if 2*a > N:
        print(a)
    a *= 2

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    s = {1, 2, 4, 8, 16, 32, 64}
    ans = 0

    for i in range(1, N + 1):
        if i in s:
            ans = i

    print(ans)


if __name__ == '__main__':
    main()

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

import math as m

x = m.log(N,2)
print(2**int(x))

Solution (Python):
N = int(input())
pi = 0
for n in range(1, N+1):
  i = 0
  dn = n
  while dn % 2 == 0:
    i += 1
    dn = dn / 2
    if dn % 2 == 1:
      break
  
  if i >= pi:
    result = n
    pi = i
  else:
    pass
  

print(result)

Solution (Python):
n = int(input())
for i in range(7):
  c = 2**i
  if c > n:
    c //= 2
    break
print(c)

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


ans = 1
for i in range(10**9):
    if 2**i > n:
        ans = 2**(i-1)
        break

print(ans)

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

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

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

maxdivisiontimes = -1
while n != 0:
    flag = True
    checkcounter = 0
    checkno = n
    while flag == True:
        if checkno % 2 == 0:
            checkcounter += 1
        checkno = checkno // 2 
        if checkno == 1 or checkno == 0:
            flag = False
    if maxdivisiontimes < checkcounter:
        maxdivisiontimes = checkcounter
        maxdivisionno = n
    n -= 1
print(maxdivisionno)

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

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

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

Solution (Python):
import numpy as np

n = int(input())
even_count = [0 for i in range(n)]
for i in range(1,n+1):
  j = i
  count = 0
  while True:
    if i % 2 == 0:
      count += 1
      i = int(i / 2)
    else:
      break
  even_count[j-1] = count
print(np.argmax(even_count)+1)

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

power = 1

while power <= N:
    power *= 2
    if power == N:
        print(power)
        exit()
    elif power > N:
        print(power // 2)
        exit()

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


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

print(max_num)

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

for i in range(N):
    num = i+1
    cnt = 0
    while True :
        if num % 2 == 0:
            cnt += 1
            num /= 2
        else:
            break
    if cnt_max < cnt:
        cnt_max = cnt

print(2**cnt_max)

Solution (Python):


num = int(input())
if num >= 64:
    print(64)
elif num >= 32:
    print(32)
elif num >= 16:
    print(16)
elif num >= 8:
    print(8)
elif num >= 4:
    print(4)
elif num >= 2:
    print(2)
elif num == 1:
    print(1)

Solution (Python):
N = int(input())
result = []
for i in range(1, N+1):
    bin_i = bin(i)
    bin_i_c = bin_i.count("0")-1
    result.append(bin_i_c)
sorted_result = sorted(result, reverse = True)
print(2 ** sorted_result[0])

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

L = [0] * 101
for i in range(1, 101):
    cnt = 0
    tmp = i
    while tmp % 2 == 0:
        cnt += 1
        tmp //= 2
    L[i] = cnt

print(L.index(max(L[1:N+1])) if N !=1 else 1)

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

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

print(ans)

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

for i in range(1001):
    l.append(2**i)

最大 = 0
for i in range(n+1):
    if i in l:
        最大 = i

print(最大)

Solution (Python):
def div_by_two(x, div_times):
	x = x / 2
	if x == int(x):
		div_times += 1
		div_times = div_by_two(x, div_times)
		
	return div_times
		

N = int(input())

ans = 1
max_div_times = 0
for i in range(1, N+1):
	div_times = div_by_two(i, 0)
	if div_times > max_div_times:
		max_div_times = div_times
		ans = i
		
print(ans)

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

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

print(ans)

Solution (Python):
N=int(input())
a=[]
for b in range(1,N+1,1):
  count=0
  while b%2 == 0:
    count+=1
    b/=2
  a.append(count)

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

Solution (Python):
"""Boot-camp-for-Beginners_Easy011_B_Collatz-Problem_29-August-2020.py"""
import numpy as np


N=int(input())
Division_2 = []
number=[]
for i in range(1, N+1):
    j = i
    count = 0
    while True:
        if j/2 != int(j/2):
            break
        j = j/2
        count += 1
    Division_2.append(count)
    number.append(i)
Division_2=np.array(Division_2)
print(number[np.argmax(Division_2)])

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

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

ans = []
for i in range(1, n + 1):
    x = i
    for j in range(100):
        if x % 2 == 0:
            x = int(x // 2)
            
        else:
            
            break
    ans.append(j)


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

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

value = 1
result = 0
while N >= value:
  value *= 2
print(value // 2)

Solution (Python):



def main():
    n = int(input())
    ans = n
    max = 0
    for i in range(1, n + 1):
        c = len(bin(i)) - bin(i).rfind("1") - 1
        if max < c:
            max = c
            ans = i
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):



def main():
    N = int(input())
    nums = range(1, N + 1)
    while True:
        nums = [i // 2 if i % 2 == 0 else 0 for i in nums]
        if sum(nums) == 1:
            print([i + 1 for i in range(N) if nums[i] == 1][-1])
            break
        elif sum(nums) == 0:
            print(len(nums))
            break


main()

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

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()

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

    print(ans)

if __name__ == '__main__':
    main()

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

N = int(input())

ans = 1
ma = 0
for i in range(1,N+1):
    if lo2(i)>ma:
        ans = i
        ma=lo2(i)

print(ans)

Solution (Python):


def counter(num):
    cnt = 0
    while True:
        if num % 2 == 0:
            num = int(num/2)
            cnt += 1
        else:
            break

    return cnt



N = int(input())

max_cnt = 0
max_num = num = N
for num in range(N,0,-1):
    cnt = counter(num)
    if cnt > max_cnt:
        max_cnt = cnt
        max_num = num   

print(max_num)

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

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

exp_2_list = []
for i in range(100):
  exp_2 = 2 ** i
  if exp_2 > 100:
    break
  exp_2_list.append(exp_2)

answer = 1
for exp_2 in sorted(exp_2_list, reverse=True):
  if exp_2 <= N:
    answer = exp_2
    break

print(answer)

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

    power = 0

    while 2 ** power <= n:
        power += 1

    print(2 ** (power-1))


if __name__ == "__main__":
    main()

Solution (Python):
a=int(input())
b=1
total2=0
for i in range(1,a+1):
    total=0
    a=i
    while True:
        if a%2==0:
            a=a/2
            total+=1
        else:
            if total2<total:
                total2=total
                b=i
            break
print(b)

Solution (Python):
N = int(input())
Ns = {}
for i in range(1, N + 1):
	num = i
	cnt = 0
	while num % 2 == 0:
		num //= 2
		cnt += 1
	Ns[i] = cnt
print(max(Ns, key=Ns.get))

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

Solution (Python):
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    if n<2:
        print(n)
        return
    x = 2
    while x*2<=n:
        x *= 2
    print(x)
    return

if __name__=='__main__':
    n = I()
    solve()

Solution (Python):
import sys
n = int(input())
for i in range(n):
  m = n-i
  for j in range(0,7):
    if 2**j == m:
      print(m)
      sys.exit()

Solution (Python):
n = int(input())
a = 64
while True:
    if a <= n:
        print(a)
        exit()
    elif n == 1:
        print(1)
        exit()
    a = a // 2

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

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

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

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

list1 =[int(i) for i in range(1,N+1)]
for i in range(N):
  list2.append([i, list1[i]])

for i in range(N):
  if len(list2) == 1:
    ans = list2[0][0]
    print(ans+1)  
    break
  
    
  for a in list2:
    
    if a[1] % 2 != 0:
      list2.remove(a)

  for j in range(len(list2)):
    list2[j][1] = list2[j][1]/2

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

Solution (Python):
n = int(input())
a = [0]*n
j = 0
for i in range(1, n+1):
    while True:
        if i%2!=0:
            break
        i=i//2
        if i==0:
            break
        else:
            a[j]+=1
    j+=1
maxv = max(a)
maxi = a.index(maxv)
print(maxi+1)

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

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

m = -1
ans = None
for i in range(N):
    j = i+1
    sum = 0
    while True:
        if j%2 == 0:
            j //= 2
            sum+=1
        else:
            break
    if sum > m:
        m = sum
        ans = i+1

print(ans)

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



mx = 0
ans = 1
for i in range(1, n+1):
    v = i
    count = 0
    while v//2 != 0 and v % 2 == 0:
        count += 1
        v = v//2
    if count >= mx:
        ans = i
    mx = max(mx, count)
print(ans)

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

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

Solution (Python):
def main():
    N = int(input())
    ary = [2 ** n for n in range(7, 0, -1)]

    for i, a in enumerate(ary):
        if N < a:
            continue
        else:
            print(a)
            return
    print(N)


main()

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

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

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

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

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

Solution (Python):
n = int(input())
b = n.bit_length() - 1
ans = int('0b1'+'0'*b, 2)
print(ans)