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

l = N.bit_length()

print(2 ** (l-1))

Submission status: Accepted

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

while x <= N:
    x *= 2
    
 
print(x // 2)

Submission status: Accepted

Solution code:
#B - Break Number
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
n = int(input())
# 2, 4, 8, 16, 32, 64 | 128

# if n % 2 == 1:
#     print(0)
#     sys.exit()

if n == 1:
    print(1)


if 2 <= n and n < 4:
    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)
elif 64 <= n and n <= 100:
    print(64)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = [2 ** i for i in range(20)]
N = int(input())
for j in range(len(x)):
  if x[j] <= N < x[j + 1]:
    print(x[j])
    break

Submission status: Accepted

Solution code:
N = int(input())
X = 1
while(True):
    if X * 2 > N:
        print(X)
        exit()
    X *= 2

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]


n = int(input())

ans = 0
totalNum = -1
for i in range(1,n+1):
    temp = i
    num = 0
    while True:
        if (temp % 2 != 0):
            break
        else:
            temp = temp // 2
            num+=1
    if (totalNum < num):
        totalNum = num
        ans = i
print(ans)

Submission status: Accepted

Solution code:
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    n = int(input().rstrip())
    max_count = 0
    ans = 1
    for i in range(1, n+1):
        num = i
        count = 0
        while(num % 2 == 0):
            count += 1
            num = int(num / 2)
        if count > max_count:
            max_count = count
            ans = i
        # print(i, count)
    print(ans)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
a = int(s)
b = 1
while b <= a:
  b = b * 2

print(int(b/2))

Submission status: Accepted

Solution code:
N = int(input())
for i in [2**x for x in range(0, 9)]:
    if i <= N:
        r = i
print(r)

Submission status: Accepted

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

for i in range(1, 10):  
  if cur > N:
    print(cur//2)
    exit()
  cur *= 2

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()

m = 0
ans = 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

exp = N.bit_length() - 1

print(2**exp)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
for i in reversed(range(7)):
	if n>=2**i:
		print(2**i)
		quit()

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())
for i in range(1,8):
  if 2**i > n:
    print(2**(i-1))
    exit()

Submission status: Accepted

Solution code:
n=int(input())
m=0
a=1
for i in range(1,n+1):
    c=0
    j=i
    while 1:
        j/=2
        if j%1==0:
            c+=1
        else:
            break
    if m<c:
        m=c
        a=i
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
count_max = 0
count_i = 0

for i in range(1,N+1):
  count = 0
  ii = i
  for j in range(i):
    if i%2 == 0:
      i = int(i/2)
      count += 1
    else:
      break
  if count > count_max:
    count_max = count
    count_i = ii
  elif i == 1:
    count_i = 1
print(count_i)

Submission status: Accepted

Solution code:
n = int(input())
A = [0]*n
for i in range(n):
    count = 0
    flg_odd = 0
    l = i
    i = i+1
    while(True):
        if ( i%2 != 0):
            flg_odd = 1
        if ( flg_odd == 1):
            A[l] = count
            break
        i = i//2
        count += 1
m = A.index(max(A))
print(m+1)

Submission status: Accepted

Solution code:
n = int(input())
ans = 1
elem_list = []

for i in range(7):
    elem_list.append(2**i)

for i in elem_list[::-1]:
    if i <= n:
        print(i)
        break

Submission status: Accepted

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
val = 1
ans = 1

while True:
    if val <= N:
        ans = val
    else:
        break
    val *= 2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

n = 1

for _ in range(N):
    n *= 2
    if n > N:
        print(n // 2)
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(res)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    n = int(input())
    for i in range(8):
        if 2**i > n:
            print(2**(i-1))
            return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
cnt = []

for i in range(1,N+1):
    for j in range(7):
        if i % 2**j == 0:
            cnt.append(2**j)
            
print(max(cnt))

Submission status: Accepted

Solution code:
N=int(input())
L=[]
for i in range(1,N):
  if 2**i<=N:
    L.append(2**i)

if N==1:
  print(N)
else:
  print(max(L))

Submission status: Accepted

Solution code:
def Dev2Count(N):
    Count = 0
    while True:
        if N%2==0:
            Count += 1
            N //= 2
        else:
            break
    return Count
  
N = int(input())
print(2**max(Dev2Count(T) for T in range(1,N+1)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for _ in range(M)]

N=int(input())


while N>0:
    tmp = N
    while tmp%2 == 0:
        tmp = tmp//2
    if tmp == 1:
        print(N)
        sys.exit()
    N -= 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    
    
    for n in range(N, 0, -1):
        m = n
        while m % 2 == 0:
            m //= 2
        if m == 1:
            ans = n
            break
        
    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
for i in range(100):
    t=2**i
    if t>N:
        print(2**(i-1))
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
result = 0
for x in range(100):
  if (1 << x) <= n and n <= (1 << (x+1)):
    result = 1 << x

print(result)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

kk = 1
for x in range(1, N + 1):
    ans_ = 0
    k = x
    for y in range(999):
        if x % 2 == 0:
            x /= 2
            ans_ += 1
        else:
            break
    if ans_ > ans:
        ans = ans_
        kk = k
print(kk)

Submission status: Accepted

Solution code:
def div2_count(n):
  if n % 2 != 0: return 0
  else: return 1 + div2_count(n / 2)
 
N = int(input())
ans = 1
count = 0
 
for i in range(N, 1, -1):
  tmp = div2_count(i) 
  if tmp > count: 
    ans = i
    count = tmp
    
print(ans)

Submission status: Accepted

Solution code:
def div_by_two(n):
  if n % 2 == 1:
    return 0
  else:
    return div_by_two(n / 2) + 1
  
N = int(input())
count = 0
res = 1
for i in range(1, N+1):
  tmp = div_by_two(i)
  if tmp > count: 
    res = i
    count = tmp 

print(res)

Submission status: Accepted

Solution code:
#-------------
N = int(input())
#-------------
cnt = 0
while True:
    X = 2**cnt
    if N//2 >= X:
        cnt +=1
    else:
        break
print(X)

Submission status: Accepted

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

N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(two)

Submission status: Accepted

Solution code:
A = int(input())
chek = 1
res = 0
for i in range(10):
  chek = 2**i
  if chek > A:
    res = 2**(i-1)
    break
print(res)

Submission status: Accepted

Solution code:
N = int(input())

max_num = -1
max_count = -1
for num in range(1,N+1):
    num_orig = num
    count = 0
    while 1:
        amari = num%2
        if amari == 0:
            num = num // 2
            count += 1
        else:
            break
    if count > max_count:
        max_num = num_orig
        max_count = count

print(max_num)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
N = int(input())
max_count = 0
for i in range(1,N+1):
    count = 0
    kari = i
    while True:
        if kari % 2 == 0:
            count += 1
            kari /= 2
        else:
            break
    if count > max_count:
        max_count = count
        ans = i
if N != 1:
 print(ans)
else:
    print(1)

Submission status: Accepted

Solution code:
# ABC068 B - Break Number
N = int(input())

for i in range(7):
    if N >= 2**i:
        M = 2**i
print(M)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
c=2
while N>=c:
    c=c*2

print(c//2)

Submission status: Accepted

Solution code:
n = int(input())

num_lists = list(range(1, n+1, 1))
count = 1
while len(num_lists) != 1:
  num_lists = [i for i in num_lists if i%2**count == 0]
  count += 1
print(num_lists[0])

Submission status: Accepted

Solution code:
N = int(input())

ans = 1
for i in range(101):
    if (ans * 2  > N):
        print(ans)
        exit()
    else:
        ans *= 2

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s=[]
for i in range(n+1):
  for j in range(n+1):
    if 2**j==i :
      s.append(i)

print(max(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def divi(n):
  ans = 0
  a2 = 0 
  while n >= 2 ** a2:
    ans = 2 ** a2
    a2 += 1
  return ans

    
N = int(input())

answ = divi(N)
print(answ)

Submission status: Accepted

Solution code:
L = [2, 4, 8, 16, 32, 64]
n = int(input())

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

ans = 0
for l in L:
  if n < l:
    break
  ans = l

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
list=[]
for i in range(7):
    s=2**i
    if s<=N:
        list.append(s)
    else:
        break
print(max(list))

Submission status: Accepted

Solution code:
s = input()
p = int(s)

x = 1

numbers = []

while (x <= p):
    x *= 2
    numbers.append(x)

if p == 1:
    answer = 1
else:
    y = numbers.pop()
    answer = numbers.pop()

print(answer)

Submission status: Accepted

Solution code:
N = int(input())

def solve(x):
    global res
    if x % 2 == 1:
        return res
    x = x // 2
    res += 1
    solve(x)

ans = []
for i in range(1, N+1):
    res = 0
    solve(i)
    ans.append([i, res])

ans = sorted(ans, key=lambda x:x[1], reverse=True)
print(ans[0][0])

Submission status: Accepted

Solution code:
N = int(input())
max_cnt = 0
ans = 0
for n in range(1, N+1):
    cnt = 0
    for div in range(0, 7):
        if n % 2**div == 0:
            cnt += 1
    if cnt > max_cnt:
        max_cnt = cnt
        ans = n
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def actual(N):
    max_count = 0

    for n in range(1, N + 1):
        i = n

        count = 0

        while n % 2 == 0:
            count += 1
            n //= 2

        if count >= max_count:
            max_count = count
            answer = i

    return answer

N = int(input())
print(actual(N))

Submission status: Accepted

Solution code:
n = int(input())

max_t = 0
ans = 1

for i in range(2, n + 1, 2):
    t = 0
    j = i
    while j % 2 == 0:
        j //= 2
        t += 1
    else:
        if max_t < t:
            max_t = t
            ans = i
else:
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
    print(1)
else:
    times = []
    for i in range(2, n + 1, 2):
        t = 0
        while i % 2 == 0:
            i //= 2
            t += 1
        else:
            times.append(t)
    else:
        print((times.index(max(times)) + 1) * 2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
div=1
index=0
while div<=N:
    index+=1
    div=2**index
print(div//2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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)
elif N < 128:
  print(64)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
#ABC 068

N = int(input())
ls = []
for i in range(0,8):
    ls.append(2**i)

ans = 0
for x in range(len(ls)):
    if ls[x] <= N:
        ans = ls[x]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
count = [0] * n
for i in range(n) :
    for j in range(6, -1, -1) :
        if (i+1) % 2**j == 0 :
            count[i] = j
            break
max = max(count)
print(count.index(max)+1)

Submission status: Accepted

Solution code:
N = int(input())

res = 1
while (res << 1) <= N:
    res = res << 1
print(res)

Submission status: Accepted

Solution code:
n = int(input())

if n == 1:
    ans = 1
else:
    i = 0
    now = 1
    while now < n:
        now *= 2
        i+=1
    if now > n:
        ans = now//2
    else:
        ans = now
print(ans)

Submission status: Accepted

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

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:
import math
N = int(input())
judge_l = [pow(2,i) for i in range(0,10) if pow(2,i) <= N]
print(judge_l[-1])

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 = 0
t = 0
for i in range(1, n+1):
    a = i
    tmp = 0
    while i % 2 == 0:
        tmp += 1
        i //= 2
    if tmp >= t:
        t = tmp
        ans = a

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

pivot = 0

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

print(2 ** pivot)

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())
i=0
while 2**i<=N:
    i+=1

print(2**(i-1))

Submission status: Accepted

Solution code:
#11
N = int(input())
num = 0
Max = 0
Max_num = 0
cou = 0

for i in range(1,N+1):
    num = i
    cou = 0
    while num % 2 == 0:
        num = int(num/2)
        cou +=1
    if Max <= cou:
        Max = cou
        Max_num = i

print(Max_num)

Submission status: Accepted

Solution code:
n=int(input())
c=1
i=1
while n>=2**i:
  c=2**i
  i+=1
print(c)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for n in range(N):
  ans*=2
  if ans>N:
    print(int(ans/2))
    exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
l_cnt = [1, 2, 4, 8, 16, 32, 64]
l_ans = [x for x in l_cnt if x <= N]

print((l_ans[-1]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lst=[2**i for i in range(0,7)]
lst=sorted(lst,reverse=True)

n=int(input())
for i in lst:
    if i<=n:
        print(i)
        break

Submission status: Accepted

Solution code:
n = int(input())

i = 0
while(True):
  if 2**i > n:
    print(2**(i-1))
    break
  else :
    i += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
lst = [1,2,4,8,16,32,64,1000]
for i in range(7):
  if lst[i] <= n < lst[i + 1]:
    print(lst[i])
    exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())

ans = 1
anscnt = 0

for i in range(1,n+1):
    a = i
    cnt = 0
    flg = True
    
    while flg:
        if a % 2 > 0:
            flg = False
        else:
            a /= 2
            cnt += 1
    
    if cnt > anscnt:
        ans = i
        anscnt = cnt

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
pow2 = [2 ** i for i in range(0, 7)]
n = int(input())
res = max([i for i in pow2 if i <= n])
print(res)

Submission status: Accepted

Solution code:
import sys

pow2 = [2 ** i for i in range(0, 7)]
pow2.reverse()
n = int(input())
for i in pow2:
    if i <= n:
        print(i)
        sys.exit(0)

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

Submission status: Accepted

Solution code:
"""abc068_b"""
N = int(input())

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

Submission status: Accepted

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

N = int(input())

ans = 1
tmp_i = 0
counter = 0
max_counter = 0

for i in range(1, N + 1):
    counter = 0
    tmp_i = i
    # 2で割れる回数の判定
    while tmp_i % 2 == 0:
        tmp_i = tmp_i / 2
        counter += 1
    if counter > max_counter:
        ans = i
        max_counter = counter

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    N = int(input())
    res = 0

    def div2(num):
        if num == 1:
            return 0
        else:
            cnt = 0
            while True:
                if num % 2 == 0:
                    num //= 2
                    cnt += 1
                else:
                    return cnt


    res_max_cnt = 0
    res = 1
    for i in range(N):
        tepm_cnt = div2(i+1)
        if res_max_cnt < tepm_cnt:
            res_max_cnt = tepm_cnt
            res = i+1
    print(res)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    N = int(input())
    res = 0

    def div2(num):
        if num == 1:
            return 1
        else:
            cnt = 0
            while True:
                if num % 2 == 0:
                    num //= 2
                    cnt += 1
                else:
                    return cnt


    res_max_cnt = 0
    for i in range(N):
        tepm_cnt = div2(i+1)
        if res_max_cnt <= tepm_cnt:
            res_max_cnt = tepm_cnt
            res = i+1
    print(res)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
n = int(input())
a = 0
b = 0
for i in range(10):
  a = 2 ** i
  if a > n :
    print(b)
    break
  else:
    b = a

Submission status: Accepted

Solution code:
N = int(input())

result = 0
temp = 1
while temp <= 100:
    if temp <= N:
        result = temp
    temp *= 2

print(result)

Submission status: Accepted

Solution code:
import bisect

two_squares = [1]

temp = 1
while temp <= 100:
    temp *= 2
    two_squares.append(temp)

N = int(input())

result = bisect.bisect_right(two_squares, N)

print(two_squares[result - 1])

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
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)
else:
    print(64)

Submission status: Accepted

Solution code:
N=int(input())
for i in range(6,-1,-1):
  k = 2**i
  if N >= k:
    print(k)
    exit()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
a=[2**i for i in range(7)]
ans=1
for i in a:
    if i in range(1,n+1):
        ans=i
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
 
k=1
while n>=k:
  k=k*2
  
if k!=1:
  k=k//2

print(k)

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

Submission status: Accepted

Solution code:
n=int(input())

list=[i for i in range(1,n+1)]
#print(list)

c_list=[]
for i in range(n):
    count=0
    num=list[i]
    while True:
        if num%2==0:
            num//=2
            count+=1
        else:
            break
    c_list.append(count)
    
print(list[c_list.index(max(c_list))])

Submission status: Accepted

Solution code:
n = int(open(0).read())

print(2 ** (n.bit_length() - 1))

Submission status: Accepted

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

cnt_l = []
for i in l:
  cnt = 0
  while i%2 == 0:
    i = i // 2
    cnt += 1
  cnt_l.append(cnt)

print(l[cnt_l.index(max(cnt_l))])

Submission status: Accepted

Solution code:
# ABC068_B
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

x = 1
cnt = 1
while x <= n:
  x = 2 ** cnt
  cnt += 1
print(x//2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
Num = [int(2**i) for i in range(7)]
if N in Num:
  print(N)
else:
  Num.append(N)
  Num = sorted(Num)
  print(2 ** (Num.index(N) - 1))

Submission status: Accepted

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