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



Sample input:
7


Sample output:
4

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
n=int(input())
ex=1
for i in range(n):
  if ex*2>n:
    break
  ex=ex*2
print(ex)

Submission status: Accepted

Solution code:
N = int(input())
x=0
while(N > 2**x):
    x+=1

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

Submission status: Accepted

Solution code:
n = int(input())
a = 0
x = 1
for i in range(1,n+1):
    cnt = 0
    m = i
    while i %2 ==0:
        i = i//2    
        cnt = cnt +1
    
    while a < cnt:
        a = cnt
        x = m

print (x)

Submission status: Accepted

Solution code:
N = int(input())
a = 1

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 1

while True:
    new = ans*2
    if new > N:
        print(ans)
        break
    else:
        ans = new

Submission status: Accepted

Solution code:
import sys
n = int(input())
ln = [64, 32, 16, 8, 4, 2, 1]
for i in ln:
    if i <= n:
        print(i)
        sys.exit()

Submission status: Accepted

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

for i in range(n + 1):
    k = factorization(i)
    for j in k:
        if j[0] == 2:
            if ans < j[1]:
                ans = j[1]
print(2 ** ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N < 2:
    print(1)
elif N >= 2 and N < 2**2:
    print(2)
elif N >= 2**2 and N < 2**3:
    print(2**2)
elif N >= 2**3 and N < 2**4:
    print(2**3)
elif N >= 2**4 and N < 2**5:
    print(2**4)
elif N >= 2**5 and N < 2**6:
    print(2**5)
elif N >= 2**6:
    print(2**6)

Submission status: Accepted

Solution code:
import sys
N = int(input())
for i in range(0,7):
	if N == 1:
		print(1)
		sys.exit()
	elif N >= 64:
		print(64)
		sys.exit()
	elif N < 2**i:
		print(2**(i-1))
		sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
  print(1)
elif n == 2 or n == 3:
  print(2)
elif 3 < n < 8:
  print(4)
elif 7 < n < 16:
  print(8)
elif 15 < n < 32:
  print(16)
elif 31 < n < 64:
  print(32)
else:
  print(64)

Submission status: Accepted

Solution code:
import sys
N = int(input())
if N < 0 or N > 100:
    sys.exit()

max = 0
answer = 1
for I in reversed(range(N+1)):
    if I % 2 == 0:
        result = I
        count = 0
        for J in range(I):
            if result % 2 == 0:
                result = int(result/2)
                count += 1
            if max <= count:
                max = count
                answer = I
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
for i in range(s+1):
  if s < 2**i:
    print(2**(i-1))
    break

Submission status: Accepted

Solution code:
N = int(input())
a = 1

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

Submission status: Accepted

Solution code:
n = int(input())

count = 0
number = 0

for i in range(n+1):
    temp = 0
    j = i
    while j > 0 and j % 2 == 0:
        j //= 2
        temp += 1
    if temp >= count:
        count = temp
        number = i


print(number)

Submission status: Accepted

Solution code:
n = int(input())
cur = 0
ans = -1
for i in range(1,n+1):
    x = i
    counter = 0
    while x % 2 == 0:
        x /= 2
        counter += 1
    if cur <= counter:
        cur = counter
        ans = i
print(ans)

Submission status: Accepted

Solution code:
#n , m , l = map(int , input().split())

# list_n = list(map(int , inpuut().split()))<Paste>

#n = input()
# list = [input() for i in range(N)

#list = [[i for i in range(N)] for _ in range(M)]


N = int(input())
i = 0
while 2 ** i <= N:
    i += 1

print(2**(i-1))

Submission status: Accepted

Solution code:
N = int(input())

arg = 1
maxscore = 0
for i in range(2, N+1):
    score = 0
    org = i
    while True:
        m = i % 2
        if m == 0:
            score += 1
            i //= 2
        else:
            if maxscore < score:
                arg = org
                maxscore = score
            break

print(arg)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
i = True
c = 1

while i:
    c *= 2
    if c > n:
        c = c // 2
        i = False

print(c)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import math 
N = int(input())
Max = 0
for i in range(1,N+1):
    if math.log2(i).is_integer():
        e = int(math.log2(i))
        if e >= Max:
            Max = e
            ans = i
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
num = 1
while num * 2 <= n:
    num *= 2

print(num)

Submission status: Accepted

Solution code:
N = int(input())
counter = 0
for i in range(8):
    if N // 2**i ==0:
        print(2**(i-1))
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
import numpy as np
print(2**int(np.log2(N)))

Submission status: Accepted

Solution code:
N = int(input())
if N == 1:
    print("1")
elif N == 2 or N == 3:
    print("2")
elif 4 <= N and N < 8:
    print("4")
elif 8 <= N and N < 16:
    print("8")
elif 16 <= N and N < 32:
    print("16")
elif 32 <= N and N < 64:
    print("32")
else:
    print("64")

Submission status: Accepted

Solution code:
n = int(input())

allcount = 0
if n == 1:
  print(1)
  exit()
for i in range(1,n+1):
  count = 0
  vans = i
  while True:
    if i%2 == 1:
      break
    elif i%2 == 0:
      count += 1
      i //= 2

  if count > allcount:
    allcount = count
    ans = vans

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
count = 0
cList = {}
s = 0
for i in range(1,N + 1):
    s = i
    while i % 2 != 1:
        i /= 2
        count += 1
    # print(f"{s}:{count}")
    cList[s] = count
    count = 0
# for c in cList.values():
#     print(c)
print(max(cList,key=cList.get))

Submission status: Accepted

Solution code:
a = input()
a = int(a)
def f(x):
    t = 0
    while x%2==0:
        t+=1
        x//=2
    return t
print(max((i for i in range(1,a+1)) ,key=f) )

Submission status: Accepted

Solution code:
N = int(input())
count = 0
scores = {}

for i in range(1, N + 1):
    I = i
    while(i % 2 == 0):
        i /= 2
        count += 1
    i = I
    scores[i] = count
    count = 0

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

Submission status: Accepted

Solution code:

N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
n = 1
while n <= N:
    n *= 2
print(n//2)

Submission status: Accepted

Solution code:
n = format(int(input()),'b')
print(int('1'.ljust(len(n),'0'),2))

Submission status: Accepted

Solution code:
N = int(input())
a = 0

if N == 1:
    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)
elif N<=100:
    print(64)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
ans = 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
max=0
ans=1
num=0
for i in range(N):
    num=i+1
    count=0
    while True:
        if num%2==0:
            count+=1
        else:
            if max<count:
                max=count
                ans=i+1
            break
        num=num/2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

count = 0
list_count = []
max_number = 0

for i in range(n):
    a = i + 1
    while a % 2 == 0:
        count += 1
        a /= 2
    list_count.append(count)
    if max(list_count) == count:
        max_number = i + 1
    count = 0

print(max_number)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


def main():
    n = int(input())
    dic = {}
    for i in range(n):
        tmp = 0
        num = i+1
        for j in range(7):
            num = num/2
            if num.is_integer():
                tmp+=1
            else:
                break
        dic[i+1] = tmp
    print(max(dic, key=dic.get))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input());n=0;print([2**i for i in range(N) if 2**i<=N][-1])

Submission status: Accepted

Solution code:
N=int(input());n=0
for i in range(N):
  if 2**i<=N: n=2**i
print(n)

Submission status: Accepted

Solution code:
N=int(input());result=0
for i in range(N):
  if 2**i <= N: result = 2**i
print(result)

Submission status: Accepted

Solution code:
def check(num):
  count = 0
  while True:
    if num % 2 != 0:
      return count
    num //= 2
    count += 1

N = int(input())
if N==1: print(1);exit()
max_num = 0
result_num = 0
count = 0
for i in range(1, N+1):
  count = check(i)
  if max_num < count:
    max_num = count
    result_num = i
print(result_num)

Submission status: Accepted

Solution code:
# template by 3xC and starkizard.
# contributors: 

#####################################################################################
from __future__ import division, print_function 

import sys
import os
from collections import Counter, deque, defaultdict
import itertools
import math
import io


"""Uncomment modules according to your need"""


# from bisect import bisect_left, bisect_right, insort
# from heapq import heappop, heapify, heappush
# from random import randint as rn
# from Queue import Queue as Q
# from copy import deepcopy
# from decimal import *
# import re
# import operator

#####################################################################################
# this enables you to write python3 code with PyPy2 (Python 2)
if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

#####################################################################################

"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""Uncomment next 4 lines if doing huge recursion"""
# import threading
# threading.stack_size(1<<27)
# sys.setrecursionlimit(10000

def prepare_factorial(mod=mod):
    """ returns two lists, factorial and inverse factorial modulo argument by default 10**9 +7 """
    # Comment code out when you don't need inverse factorial or vice versa
    fact = [1]
    for i in range(1, 200005):
        fact.append((fact[-1] * i) % mod)

    ifact = [0] * 200005
    ifact[200004] = pow(fact[200004], mod - 2, mod)
    for i in range(200004, 0, -1):
        ifact[i - 1] = (i * ifact[i]) % mod

    return fact, ifact

def modinv(n, p):
    """ returns N inverse modulo p """
    return pow(n, p - 2, p)

def ncr(n, r,  fact, ifact):
    """ takes 4 arguments: n , r and factorial and inverse factorial lists"""
    t = (fact[n] * (ifact[r]*ifact[n-r]) % MOD)% MOD
    return t


def get_n(Sum):    
    """this function returns the maximum n for which Summation(n) <= Sum"""
    ans = (-1 + sqrt(1 + 8*Sum))//2
    return ans

def sieve(n):
    """ returns a list of prime numbers till n """
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r



def divs(n, start=1):
    """ returns a list of all divisors till n """
    divisors = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors



def divn(n, primes):
    """ returns the number of divisors, two arguments n and the sieve till n """
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t



def lrfind(d, x, default=-1):
    """ Takes 2 arguments an iterable and an element. returns a tuple (firstoccurence,lastoccurence) -1 if not found """
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return default, default
    else:
        return left, right

def gcd(x, y): # math.gcd is slower
    """ returns greatest common divisor of x and y """
    while y:
        x, y = y, x % y
    return x

def check_sorted(a):
    ''' returns True/False '''
    for i in range(len(a)-1):
        if a[i]>a[i+1]:
            return False
    return True
def ceil(n, k=1): return n // k + (n % k != 0) #returns math.ceil but protecting against floating inconsistencies
def input(): return sys.stdin.readline().strip()
def ii(): return int(input()) #inputs integer
def mi(): return map(int, input().split()) # inputting space seperated variables for example x,y,z
def li(): return list(map(int, input().split())) #inputting a space seperated list of integers
def lw(): return input().split() #inputting a space seperated list of strings
def lcm(a, b): return abs(a * b) // gcd(a, b) #returns LCM of two arguments
def prr(a, sep=' ', end='\n'): print(sep.join(map(str, a)), end=end) #For printing an iterable with seperator sep as optional second argument (default : " "), ending character (default: "\n") as optional third
def dd(): return defaultdict(int) #returns a dictionary with values defaulted to 0
def ddl(): return defaultdict(list) #returns a dictionary with values defaulted to []
def write(s): return sys.stdout.write(s)












###################################################################
def main():
    #CODE GOES HERE:
    n=ii()
    i=1
    while(i*2<=n):
        i*=2
    if i>n:
        print(i//2)
    else:
        print(i)














""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192

class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):

    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

""" main function"""

if __name__ == '__main__':
    main()
    # threading.Thread(target=main).start()

Submission status: Accepted

Solution code:
import sys
N = int(input())
evens = [i for i in range(1, N+1) if i%2 ==0]
even_cnts = []
if evens == []:
    print(1)
    sys.exit()
for even in evens:
    cnt = 0
    while even % 2 ==0:
        cnt += 1
        even = even / 2
    even_cnts.append(cnt)
max_cnts = max(even_cnts)
index = even_cnts.index(max_cnts)
print(evens[index])

Submission status: Accepted

Solution code:
N = int(input())
k = 0

while True:
    if 2**k > N:
        break

    ans = 2 ** k
    k +=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = [1,2,4,8,16,32,64,128]

for i in range(10):
    if ans[i] > n:
        print(ans[i-1])
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
if a>=64:
  print('64')
elif a>=32:
  print('32')
elif a>=16:
  print('16')
elif a>=8:
  print('8')
elif a>=4:
  print('4')
elif a>=2:
  print('2')
else:
  print('1')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

beki = math.floor(math.log(n,2))
x = 2**beki
print(x)

Submission status: Accepted

Solution code:
import sys
n=int(input())
if n==1:
    print(1)
    sys.exit()
k=2
ans=0
while k*2<=n:
    k*=2
    ans+=1
print(k)

Submission status: Accepted

Solution code:
n = int(input())
c = 1
if n < 3:
    print(n)
    exit()

for i in range(6):
    c = c*2
    if n < c*2:
        print(c)
        break

Submission status: Accepted

Solution code:
def waru(x):
  ret_val=0
  while x>0:
    if x%2:
      break
    else:
      x//=2
      ret_val+=1
  return ret_val

N=int(input())
check_val=0
ans=1
for i in range(1,N+1):
  temp=waru(i)
  if check_val<temp:
    check_val=temp
    ans=i
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if 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)

Submission status: Accepted

Solution code:
N=int(input())
ans=1
check=0
for i in range(2,N+1):
  count=0
  waru=i
  while waru>0:
    waru//=2
    if waru>0:
      count+=1
  if check<count:
    check=count
    ans=i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for i in range (10):
    if 2**i <= n:
        count = 2**i
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

print(2**math.floor(math.log2(n)))

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for i in range(10):
    if 2 ** i <= N:
        count = 2 ** i

print(count)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
a = int(input())
x = 0
while 2**x <=a:
    boxs = 2 ** x
    x += 1
print(boxs)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def div2(N) : 
  num = 1
  while True : 
    if 2 * num > N : 
      return num
    num *= 2

N = int(input())

print(div2(N))

Submission status: Accepted

Solution code:
N = int(input())

ans = 1

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

mxcnt = 0
ans = 1
for i in range(1,n+1):
    cnt = 0
    x = i
    for j in range(7):
        if x % 2 != 0:
            break
        cnt += 1
        x //= 2
    if cnt >= mxcnt:
        mxcnt = cnt
        ans = i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

k = 1
while True:
  if k <= n//2:
    k = 2 * k
  else:
    break

print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
list=[1,2,4,8,16,32,64]
if list.count(N)==1:
    print(N)
    exit()

list.append(N)
anslist=sorted(list)

print(anslist[anslist.index(N)-1])

Submission status: Accepted

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

    n = 1
    count = 0

    while True:
        n *= 2
        if n > N:
            break
        count += 1

    print(n // 2)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
res = 1
max = 0
for i in range(1, N+1):
    cnt = 0
    n = i
    while True:
        if n%2 != 0:
            break
        else:
            n = n//2
            cnt += 1
    if cnt > max:
        res = i
        max = cnt
print(res)

Submission status: Accepted

Solution code:
n = int(input())

num = 0

for i in range(1, n+1):
    for k in range(1, 8):
        if 2**k <= i:
            num = 2**k
        else:
            break

if num:
    print(num)
else:
    print(n)

Submission status: Accepted

Solution code:
#BreakNumber
n = int(input())
for i in range(0, 8):
  if 2 ** i <= n:
    pass
  else:
    print(2**(i-1))
    break

Submission status: Accepted

Solution code:
# B - Break Number

N = int(input())

for i in range(8):
    if pow(2, i) <= N:
        ans = pow(2, i)
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
total = {}
for i in range(1, n+1):
    a = i
    cnt = 0
    while a % 2 == 0:
        a /= 2
        cnt += 1
    total[i] = cnt

total = sorted(total.items(), key=lambda x:x[1])
print(total[-1][0])

Submission status: Accepted

Solution code:
def main():
    from builtins import int, map, list, print
    from bisect import bisect_right
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N = input_number()
    ls = [2 ** i for i in range(7)]
    print(ls[bisect_right(ls, N)-1])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

ans = []
a = 1
t = 1

while a <= 100:
    ans.append(a)
    a *= 2

for b in ans :
    if b <= n:
        t = b

print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
maxd=0
ans=1
for i in range(1,N+1):
    c=0
    for j in range(1,7):
        if i % (2**j)==0:
            c=j
    if maxd < c:
        maxd=max(maxd,c)
        ans=i
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import log2
N = int(input())
print(2**int(log2(N)))

Submission status: Accepted

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

ans=2**(k-1)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N < 2:
    ans = 1
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)

Submission status: Accepted

Solution code:
n = int(input())
k = 0
arr = [0] * n
def break2(n):
  k = 0
  while n % 2 == 0:
    k += 1
    n = n // 2
  return k
for i in range(n):
  arr[i] = break2(i + 1)
print(arr.index(max(arr)) + 1)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
c = 0
for i in range(1,n+1):
  b=i
  cnt =0
  while b > 0:
    cnt +=1
    b //= 2
  if cnt > ans:
    ans = cnt
    c = i
print (c)

Submission status: Accepted

Solution code:
N = int(input())
n = [64, 32, 16, 8, 4, 2, 1]
for v in n:
    if N >= v:
        print(v)
        exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def divide_two(k,c=0):
    if k % 2 != 0:
        return c
    else:
        return divide_two(k//2,c+1)

def makeLst(k):
    l = [0]*k
    for i in range(k):
        l[i] = divide_two(i+1)
    return l


def solve(n):
    l = makeLst(n)
    max_val = max(l)
    for i in reversed(range(n)):
        if l[i] == max_val:
            return i+1

    return 0

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A = list(range(1, int(input()) + 1))
A.sort(key=lambda a: (a & -a).bit_length())
print(A[-1])

Submission status: Accepted

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

    def count(x):
        ret = 0
        while x % 2 == 0:
            x //= 2
            ret += 1
        return ret

    ret = max(range(1, N + 1), key=count)
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
while True:
    if n < pow(2, ans + 1):
        break
    else:
        ans += 1
print(pow(2, ans))

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
m = 0
if n==1:
    print(1)
else:
    for i in range(2,n+1,2):
        a = 0
        x = i
        while(True):
            if x%2!=0:
                break
            a+=1
            x = x//2
        if a>m:
            m=a
            ans=i
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=1
for x in range(0,8):
  if n<pow(2,x):
    break
  ans=pow(2,x)
    
print(ans)

Submission status: Accepted

Solution code:
from math import log2
n=int(input())
t=int(log2(n))
print(2**t)

Submission status: Accepted

Solution code:
n = int(input())
kai = 0
nn = 0
while 2**nn <= n :
    nn += 1
nn -= 1
print(2**nn)

Submission status: Accepted

Solution code:
n=int(input())
ans1=[0,1]
for i in range(1,n+1):
  count=0
  N=i
  while True:
    if N%2==0:
      N//=2
      count+=1
    else:
      break
  if ans1[0]<count:
    ans1=[count,i]
print(ans1[1])