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 = 0
for i in range(7):
  if 2 ** i <= N:
    ans = 2 ** i
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

lans = list()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 2 ** i
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    print(max_i)


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
cmax = 0
imax = 1
for i in range(1,n+1):
  cnt = 0
  ig = i
  while i % 2 == 0:
    i /= 2
    cnt += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# solution
# 

data=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

ansList = []
for i in range(1,n+1):
  cnt = 0
  for j in range(10):
    if i %2 ==0:
      i/=2
      cnt +=1
    else:
      ansList.append(cnt)
      break
print(np.argmax(ansList)+1)#ansListは０から始まる

Submission status: Accepted

Solution code:
N = int(input())


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


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

Submission status: Accepted

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

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:
n = int(input())
a = 0
while True:
    if n < 2**(a+1):
        break
    a+=1
print(2**a)

Submission status: Accepted

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

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

    print(1)

Submission status: Accepted

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

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())
y = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())


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

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:
a = int(input())
if a<2:print(1)
elif a<4:print(2)
elif a<8:print(4)
elif a<16:print(8) 
elif a<32:print(16)
elif a<64:print(32)
else:print(64)

Submission status: Accepted

Solution code:
# ABC 068: B – Break Number
n = int(input())
print(max([s for s in [1, 2, 4, 8, 16, 32, 64] if s <= n]))

Submission status: Accepted

Solution code:
n = int(input())

i = 1

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

Submission status: Accepted

Solution code:
N = int(input())

if N == 1:
    print(N)
elif N >= 2 and 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:
n=int(input())
List=[1,2,4,8,16,32,64]
if (n==1):
  print(List[0])
elif (2<=n<4):
  print(List[1])
elif (4<=n<8):
  print(List[2])
elif (8<=n<16):
  print(List[3])
elif (16<=n<32):
  print(List[4])
elif (32<=n<64):
  print(List[5])
else:
  print(List[6])

Submission status: Accepted

Solution code:
print(sorted(range(1,int(input())+1),key=lambda x:x&(-x))[-1])

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())

i = 2
if N==1:
    ans=1
else:
    while not i>N:
        ans = i
        i = i*2

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input().rstrip())
i=0
while 1:
  num=2**i
  if num==n or num*2 > n:  
    break
  i+=1
print(num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 1 
top_count = -1
for i in range(2, N + 1):
    temp = i
    count = 0
    while temp % 2 == 0:
        count += 1
        temp = temp / 2
    if top_count < count:
        ans = i
        top_count = count

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def cal(n):
    cnt = 0
    while n % 2 == 0:
        n = n//2
        cnt += 1
    return cnt

ans = -1
for i in range(N,0,-1):
    if ans < cal(i):
        ans = cal(i)
        ans_n = i
print(ans_n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
box  = []
prime = []
ans = 0
def Prime_Factorization(n):
    i = 2
    prime_factors = []
    while n > 1:
        if n % i == 0:
            prime_factors.append(i)
            n = n / i
        else:
            i += 1
    return prime_factors

for i in range(1,n+1):
    prime = Prime_Factorization(i)
    box.append(prime.count(2))
    #print(box)


if n == 1:
    print(1)
else:
    ans = box.index(max(box)) + 1
    print(ans)

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math


n = int(input())
li = []
for i in range(8):
    li.append(2**i)

for i in range(1,len(li)):
    if li[i-1] <= n and n < li[i]:
        break
print(li[i-1])

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

b = 0

while True:
    if N >= 2:
        N /= 2
        b += 1
    if N < 2:
        break

print(2 ** b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
sample = [i+1 for i in range(n)][::-1]

hoge = [1, 2 ,4, 8, 16, 32, 64][::-1]
add = []

flag = False
for h in hoge:
    for s in sample:
        if s % h == 0:
            print(s)
            flag = True
            break
    if flag:
        break

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

# abc068_b.py
N = int(input())
binaries = [2,4,8,16,32,64]
ans = 1
for i in binaries:
    if N>=i:
        ans=i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
t = [-1,-1]
for i in range(1,n+1):
    tn = i
    x=0
    while(i%2 == 0):
        x+=1
        i=i/2
    if t[1] < x:
        t[0],t[1] = tn,x 
print(t[0])

Submission status: Accepted

Solution code:
n = int(input())

s = 1
while s <= n:
    s = s*2
    
s = s//2

print(s)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	n=II()
	ans = 1
	while n >= ans:
		ans *= 2
	print(ans//2)

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
n = range(1,int(input())+1)

def calc_div(n):
    cnt = 0
    while n/2 !=0:
        cnt += 1
        if n%2 != 1:
            n = n/2
        else:
            break
    return cnt

list = []
for i in n:
    j = calc_div(i)
    list.append(j)

max_value = max(list)
max_index = list.index(max_value)
print(n[max_index])

Submission status: Accepted

Solution code:
N = int(input())

e = 1
cnt = 0
while(e < N):
    if e*2 > N:
        break
    e *= 2
    cnt += 1

print(e)

Submission status: Accepted

Solution code:
n = int(input())
ans = 1
ma_div = 0
divs = [1, 2, 4, 8, 16, 32, 64,128]
for i in range(1, n + 1):
    for j, div in enumerate(divs):
        if i % div != 0:
            break
    if j > ma_div:
        ans = i
        ma_div = j
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())

Ans=0
Ans2=0
Count2=0
for i in range(1,N+1):
    Ans=i
    Count=0
    for j in range(N):
        if i%2==0:
            Count+=1
            i=i//2
        else:
            break
    if Count>Count2:
        Ans2=Ans
        Count2=Count
    
print(Ans2 if Ans2>0 else 1)

Submission status: Accepted

Solution code:
n = int(input())
r_list = [0] * n
for i in range(1, n+1):
	t = i
	while True:
		if t % 2 != 0:
			break
		else:
			t = t // 2
			r_list[i-1] += 1
max_r = max(r_list)
r_list.reverse()
n_list = [i for i in range(1, n+1)]
n_list.reverse()
r = 0
for i, v in enumerate(r_list):
	if v == max_r:
		r = n_list[i]
print(r)

Submission status: Accepted

Solution code:
N = int(input())

ans = 1
judg = 0


for i in range(N):
    x = i+1
    counter = 0
    while True:
        if x%2==0:
            x = x / 2
            counter += 1
        else:
            break
    if judg<counter:
        ans = i+1
        judg = counter


print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def myAnswer(N:int) -> int:
   lis = [i for i in range(1,N+1)]
   MAX = 0
   ans = 0
   for l in lis:
      counter = 0
      tmp = l
      while l != 0:
         l = l//2
         counter+=1
      if(MAX < counter):
         MAX = counter
         ans = tmp
   return ans


   

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   print(myAnswer(N))

if __name__ == '__main__':
   main()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    if 2 * ans > n:
        print(ans)
        break
    else:
        ans *= 2

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(input())
ans = 1
for i in range(10):
    ans = 2**i
    if  ans >n:
        print(2 ** (i- 1))
        sys.exit()

Submission status: Accepted

Solution code:
N = int(input())
A = [2**i for i in range(8)]
for i in range(len(A)):
    if A[i] > N:
        print(A[i-1])
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

i = 1
while(1):
    if i*2 > N:
        break
    i = i*2
print(i)

Submission status: Accepted

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

if N-2**n<2**n:
    print(2**n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = 1
for i in range(7):
    if N >= 2**i:
        a = 2**i
print(a)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 1
max_num = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if 1 <= N <2:
  print(1)
if 2 <= N <4:
  print(2)
if 4 <= N <8:
  print(4)
if 8 <= N <16:
  print(8)
if 16 <= N <32:
  print(16)
if 32 <= N <64:
  print(32)
if 64 <= N <= 100:
  print(64)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [1, 2, 4, 8, 16, 32, 64]
n = int(input())
if n in l:
    l.append(n)
    l.sort()
    print(l[l.index(n)])
else:
    l.append(n)
    l.sort()
    print(l[l.index(n)-1])

Submission status: Accepted

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

for i in range(2,n+1,2):
  sub=i
  while i%2==0:
    count+=1
    i/=2
  if count>=maxcount:
    maxcount=count
    ans=sub
  count=0
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7



def main():
  n = int(input())
  ma_ = 1
  while n != 1:
    p = n
    cnt = 0
    while p != 1:
      if p % 2 == 0:
        cnt += 1
        p //= 2
      else:
        p = 1
    ma_ = max(ma_,2**cnt)
    n -= 1
  print(ma_)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n+1):
    new = 0
    while i % 2 == 0 and i != 0:
        new += 1
        i /= 2
    if new > count:
        count = new
print(2**count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input().strip())
if n == 1:
    print(1)
elif 2 <= n < 4:
    print(2)
elif 4 <= n < 8:
    print(4)
elif 8 <= n < 16:
    print(8)
elif 16 <= n < 32:
    print(16)
elif 32 <= n < 64:
    print(32)
elif 64 <= n <= 100:
    print(64)

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(input())

ans_cou = 0
ans_num = 1
for i in range(N + 1):
    a = i
    sum = 0
    while a % 2 == 0 and a != 0:
        sum += 1
        a = a // 2
    if sum > ans_cou:
        ans_cou = sum
        ans_num = i

print(ans_num)

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import numpy as np
import collections

#n = int(input())
#a, b, c, d = list(map(int, input().split()))
n = int(input())
m = 0
max_idx = -1
for i in range(1, n+1):
    n = i
    count = 0
    while n==n//1:
        n /= 2
        count += 1
    
    if count >= m:
        m = count
        max_idx = i
    #print(count)


print(max_idx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

N = int(input())

def solve(i):
    if i % 2 != 0:
        return 0
    else:
        return 1 + solve(i // 2)

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

box = []
for k in range(1, N+1):
    box.append(solve(k))
mb = max(box)
for i in range(1, N+1):
    if box[i] == mb:
        print(i+1)
        break