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

pow=64
while True:
  if pow<=N:
    print(pow)
    break
  else:
    pow//=2

Submission status: Accepted

Solution code:
N=int(input())

def times(n):
  res=0
  while n:
    if n%2==0:
      res+=1
    n//=2
  return res

answer=0
max_d=0
for i in range(1,N+1):
  if times(i)>=max_d:
    max_d=times(i)
    answer=i
  
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

l = [i for i in range(1, N+1)]
l1 = l.copy()
c = [0]*N

while True:
    exist_even = False
    for i in range(N):
        if l[i] % 2 == 0:
            exist_even = True
    if not exist_even:
        break

    for i in range(N):
        if l[i] % 2 == 0:
            l[i] = l[i] // 2
            c[i] += 1

idx = c.index(max(c))
print(l1[idx])

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    return N,


def solve(N):
    n = N.bit_length()
    return N >> (n-1) << (n-1)


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))

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())
max = 1
for i in range(1,7):
  if N < 2**i:
    break
  else:
    max = 2**i
print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
a=1
b=0#われた回数の最大値
def count(x):
    y=0#割れる回数
    for i in range(10):
        if x%2==0:
            x=x//2
            y+=1
        else:
            break
    return y

for i in range(1,N+1):
    if count(i)>b:
        a=i
        b=count(i)
    #print(count(i))
print(a)

Submission status: Accepted

Solution code:
def resolve():
	n = int(input())

	cur = 1
	for i in range(1, n + 1):
		if cur * 2 > n:
			break
		cur *= 2
	print(cur)
resolve()

Submission status: Accepted

Solution code:
def resolve():
	n = int(input())
	ans = 0
	dp = [0]*(n+1)
	for i in range(1, n+1):
		if i % 2 == 0:
			dp[i] = dp[i//2] + 1
	print(dp.index(max(dp)) or 1)
resolve()

Submission status: Accepted

Solution code:
N = int(input())

ans_2 = [2, 4, 8, 16, 32, 64]
ans = N

for a in ans_2:
    if N >= a:
        ans = a
    else:
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))
## dp
INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]
## math
DIVC = lambda x, y: -(-x//y)
DIVF = lambda x, y: x//y

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))
## dp
INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]
## math
DIVC = lambda x, y: -(-x//y)
DIVF = lambda x, y: x//y

def main():
    n = II()
    maxv = 0
    res = -1
    for i in range(1,n+1):
        cnt = 0
        x = i
        while x//2 > 0:
            if x%2 == 0:
                cnt += 1
                x //= 2
            else:
                break
        if cnt >= maxv:
            maxv = cnt
            res = i
    print(res)

if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

i=1

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

Submission status: Accepted

Solution code:
import math

n = int(input())
k = (math.log2(n)) // 1
a = int(2 ** k)
print(a)

Submission status: Accepted

Solution code:
def resolve():
    # 整数 1 つ
    n = int(input())
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    A = [1,2,4,8,16,32,64]
    B = sorted(A, reverse=True)

    for i in B:
        if i <= n:
            print(i)
            break

#    print("n")


resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
now = 1
while True:
    if now*2 > n:
        print(now)
        break
    now *= 2

Submission status: Accepted

Solution code:
# Problem B - Break Number

# input
N = int(input())

# initialization
max_count = -1
max_ans = 1

# count
for i in range(1, N+1):
    tmp_count = 0
    tmp = i
    while tmp%2==0:
        tmp_count += 1
        tmp = tmp // 2
    if tmp_count>max_count:
        max_count = tmp_count
        max_ans = i

# output
print(max_ans)

Submission status: Accepted

Solution code:
n = int(input())
import math
if n > 1:
    for i in range(n,1,-1):
        if i%(2**int(math.log(i,2))) == 0:
            print(i)
            break
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import math


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 2**math.floor(math.log(N,2))
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

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(100):
	if N<2**i:
		print(2**(i-1))
		exit()

Submission status: Accepted

Solution code:
n = int(input())
l = [1, 2, 4, 8, 16, 32, 64]
num = 0
for i in range(n+1):
    if i in l:
        num = i

print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[]
for i in range(1,n+1):
  t=i
  cnt=0
  while t!=0:
    if t%2==0:
      cnt+=1
    t//=2
  a.append((cnt,i))
a.sort(key=lambda x: x[0])
print(a[-1][1])

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n=int(input())
print(2**(len(bin(n))-3))

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
count = 0
for i in range(1, N + 1):
    tmp = 0
    j = i
    while j % 2 == 0:
        j //= 2
        tmp += 1
    
    if tmp >= count:
        count = tmp
        ans = i
    
print (ans)

Submission status: Accepted

Solution code:
N = int(input())


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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


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

    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

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

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    ma_ = 0
    # 2 乗リスト作っておくか？
    LIST = []
    for i in range(7):
        LIST.append(2**i)
    for i in range(6,-1,-1):
        if LIST[i] <= n:
            print(LIST[i])
            exit()
    print(0)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = 2
while a<=n:
  a*=2

print(a//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

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

resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

data = [1,2,4,8,16,32,64]

for i in data:
    if n >= i:
        ans = i

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())
a = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
N =[2,4,8,16,32,64]

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<101:
  print(64)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def jud(n):
    cnt=0
    while (True):
        if (n % 2 == 0):
            n /= 2
            cnt += 1
        else:
            break
    return cnt

n = int(input())
cnt = 0
ans=1
for i in range(n):
    tmp=jud(i+1)
    if (cnt < tmp):
        cnt = tmp
        ans = i + 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

res_count = 0
res = 1
for i in range(1, n + 1):
    a = i
    count = -1
    mod = 0
    while mod == 0 and a >= 1:
        mod = a % 2
        a = int(a / 2)
        count = count + 1
    if res_count < count:
        res_count = count
        res = i

print(res)

Submission status: Accepted

Solution code:
n = int(input())
Max = 0
number = 1
for i in range(1, n+1):
    i0 = i
    count = 0
    while i0 % 2 == 0:
        i0 //= 2
        count += 1
    if count > Max:
        Max = count
        number = i
print(number)

Submission status: Accepted

Solution code:
#N,K = map(str,input().split())
N = int(input())
#K = int(input())
#X = list(map(int,input().split()))
c=1
if N==1:
    print(1)
    exit()
flag=True
while flag==True:
    c = c*2
    if c > N:
        flag=False
        c=c//2
    elif c==N:
        flag=False
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

print(2**k)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N=int(input())

ans=1

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

Submission status: Accepted

Solution code:
num = int(input())

count_max = 0
num_max = 0
for i in range(1, num+1):
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if count >= count_max:
    count_max = count
    num_max = i

if num == 1:
  print(1)
else:
  print(num_max)

Submission status: Accepted

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

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


cnt = 0
while True:
    if 2**cnt <= n:
        cnt += 1
    else:
        break

print(2**(cnt-1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())


def num_div2(m):
    cnt = 0
    while m > 0 and m % 2 == 0:
        cnt += 1
        m //= 2

    return cnt


mx = max([(m, num_div2(m)) for m in range(1, n + 1)], key=lambda t: t[1])
print(mx[0])

Submission status: Accepted

Solution code:
def resolve():
    n=int(input())
    num=0
    ans=1
    l=list(range(1,n+1))
    for i in l:
        cnt=0
        while l[i-1]%2==0:
            l[i-1]=l[i-1]//2
            cnt+=1
        if cnt>num:
            num=cnt
            ans=i
    print(ans)

resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    L = [2**i for i in range(8)]
    import bisect
    idx = bisect.bisect_left(L, N)
    print(L[idx] if L[idx] == N else L[idx-1])


if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
num = int(input())
lst = [i for i in range(1, num + 1)]

max, before = 0, -1
for l in lst:
  num, count = l, 0
  while num % 2 == 0:
    num /= 2
    count += 1
  if before < count:
    max, before = l, count 

print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N = int(input())

ans_i = 1
ans = 0
for i in range(N + 1):
    j = i
    cnt = 0
    while j % 2 == 0 and j != 0:
        j = int(j / 2)
        cnt = cnt + 1
    if cnt > ans:
        ans_i = i
        ans = cnt
print(ans_i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while (N > 0):
  n = N
  count = 0
  while(True):
    if n % 2 != 0:
      break
    else:
      n /= 2 
      count += 1
  if count > best_count:
    ans = N
    best_count = count
  N -= 1
  
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:
N = int(input())
ans = 0
max_devide_count = -1

for i in range(N, 0, -1):
    
    binary_i_reverse = bin(i)[:1:-1]
    devide_count = 0
    
    for j in binary_i_reverse:
        if j == '0':
            devide_count += 1
        else:
            break
    
    if max_devide_count < devide_count:
        max_devide_count = devide_count
        ans = i

print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
for i in range(n, 0, -1):
    if math.log2(i).is_integer():
        print(i)
        exit()

Submission status: Accepted

Solution code:
N = int(input())
count = 0
max = 0
ans = 1
for i in range(1, N+1, 1):
    count = 0
    n = i
    while 1:

        if n%2!=0:
            break
        n = n //2
        count = count + 1
    if max<count:
        max = count
        ans = i
print(ans)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
n = int(input())

def div(x):
    global count
    if x%2==1:
        return count
    else:
        count += 1
        return div(x//2)
m = -1
for i in range(n):
    count = 0
    r = div(i+1)
    if m < r:
        m = r
        ans = i+1

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
if N==1:
  print(1)
else:
  m=1
  while m*2 <= N:
    m *= 2
  print(m)

Submission status: Accepted

Solution code:
n = int(input())
max=0
c=0
ans=1
for i in range(n+1):
	t=i
	while t%2==0 and 0<t:
		t=t>>1
		c+=1
	if max < c:
		max = c
		ans=i
	c=0
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 1
while True:
  if N < ans <<1:
    break
  ans<<=1
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def readlines(n):
    for i in range(n):
        for j, x in enumerate(input().split()):
            yield int(x), (i, j)


def main():
    N = int(input())
    for i in range(1, N+1):
        x = i
        count = 0
        while x > 0:
            x //= 2
            count += 1

        yield i, count


print(max(main(), key=lambda x: x[1])[0])

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    res = 0
    ans = 0
    for i in range(1, n + 1):
        n = int(str(i)[::])
        cnt = 0
        while n % 2 == 0:
            n //= 2
            cnt += 1

        if res <= cnt:
            res = cnt
            ans = i
    print(ans)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    cnt = 0
    ret = 1
    for n in range(1, N+1):
        tmp = 0
        q = n
        while n % 2 == 0:
            n = n // 2
            tmp += 1
        if tmp > cnt:
            ret = q
            cnt = tmp

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

cands = [64, 32, 16, 8, 4, 2, 1]

for cand in cands:
    if n >= cand:
        print(cand)
        break

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())
print(2**(N.bit_length()-1))

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:
n = int(input())


count = []
for i in range(1,n+1):
    c = 0
    while i % 2 == 0:
        i //= 2
        c += 1
    count.append(c)

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

Submission status: Accepted

Solution code:
n = int(input())

if n == 1:
    print(1)
    quit()
count = []
for i in range(2,n+1,2):
    c = 0
    while i % 2 == 0:
        i //= 2
        c += 1
    count.append(c)

ans = count.index(max(count))
print((ans+1)*2)

Submission status: Accepted

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

# シフトしても n を超えないならシフトして代入する
while(ans<<1 <= n):
  ans = ans << 1  # ans<<=1 でも可
  
  
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
max_count = 0
max_count_number = 1
for i in range(1, n + 1):
    count = 0
    current = i
    while(current % 2 == 0 and current > 0):
        count += 1
        current /= 2
    if max_count < count:
        max_count = count
        max_count_number = i
        
print(max_count_number)

Submission status: Accepted

Solution code:
N = int(input())
C = [1, 2, 4, 8, 16, 32, 64]
for i in range(len(C)):
  if N == C[i]:
    print(N)
    break
  elif C[i] < N and N < 64:
    continue
  elif N >= 64:
    print(64)
    break
  else:
    print(C[i-1])
    break

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())

max_num = 1
max_count = 0

def division(n):
    count = 0
    while True:
        quo = n // 2
        rem = n % 2

        if quo == 0 or rem > 0:
            break
        else:
            count = count + 1

        n = quo

    return count


for i in range(1,N+1):
    count = division(i)
    if max_count < count:
        max_count = count
        max_num = i

print(max_num)

Submission status: Accepted

Solution code:
n = int(input())
r = [64, 32, 16, 8, 4, 2, 1]
for q in range(7):
    if r[q] <= n:
        print(r[q])
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
two_list = [1, 2, 4, 8, 16,32,64]
answer = 0
for two in two_list:
  if N >= two:
      answer = two
      if two == 64:
          print("64")
  else:
    print(answer)
    exit()

Submission status: Accepted

Solution code:
N = int(input())

MaxCount = 0
L = []
for i in range(1, N + 1):
    v = i
    count = 0
    while True:
        if (i % 2 == 1):
            break
        elif(i % 2 == 0):
            i = i // 2
            count += 1
    MaxCount = max(MaxCount, count)
    L.append((v, count))

for v in L:
    if (v[1] == MaxCount):
        print(v[0])
        break

Submission status: Accepted

Solution code:
import sys
import math

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(input())
    if N == 1:
        ans = 1
    else:
        ans = 2 ** int(math.log2(N))
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
if N<2:
  print(N)
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())
mx = 0
ans = 0
def mod(i, count=0):
    if i%2!=0:
        return count
    else:
        return mod(i//2, count+1)
for i in range(1,n+1):
    if mx <= mod(i):
        mx = mod(i)
        ans = i
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
li = [2, 4, 8, 16, 32, 64]
ans = 0
for i in range(1, N+1):
    if i in li:
        ans = i

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

Submission status: Accepted

Solution code:
import numpy as np
import sys

input = sys.stdin.readline

n = int(input())

x = 1
ans = 0
while 1 :
    x *=2
    if x <= n:
        ans += 1
    else:
        break 

print(int(x/2))

Submission status: Accepted

Solution code:
N = int(input())

max = [1, 0]

for i in range(1, N+1):
    j = i
    count = 0
    while j % 2 == 0: 
        j = j / 2
        count += 1
    if count > max[1]:
        max[0] = i
        max[1] = count
        
print(max[0])

Submission status: Accepted

Solution code:
N = int(input())

if N == 1:
    print(1)

elif N == 2 or N == 3:
    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())
# n = 100
m = 0
x = 1
for i in range(1, n+1):
    a = i
    c = 0
    while a % 2 == 0:
        a = a//2
        c += 1
    if c > m:
        x = i
    m = max(m, c)
print(x)

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(j)

Submission status: Accepted

Solution code:
N=int(input())
num=1
max=0
for i in range(1, N+1):
  cnt=0
  j=i
  while j%2==0:
    j=j//2
    cnt+=1
  if max<cnt:
    max=cnt
    num=i
print(num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC068-B
n = int(input())
k = 1

while k*2 <= n:
    k *= 2
    


print(k)

Submission status: Accepted

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

l = list(range(1,n+1))
is_even=list(map(lambda x: x%2==0, l))
while is_even.count(True) > 1:
    l = list(map(lambda x: x/2, l))
    is_even=list(map(lambda x: x%2==0, l))

for i in range(n):
    if is_even[i]:
        print(i+1)