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

now = 2

while now <= n:
  now *= 2

print(now//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

mx = [0, 0]
for i in range(1, n+1):
    j = i
    cnt = 0
    while j % 2 == 0:
        cnt += 1
        j = j // 2
    if mx[0] < cnt:
        mx[0] = cnt
        mx[1] = i

print(mx[1] if mx[0] != 0 else 1)

Submission status: Accepted

Solution code:
N = int(input())
ans_list = [2**i for i in range(8)]
ai = 0
while (ans_list[ai] <= N):
    ai += 1

print(ans_list[max(0, ai-1)])

Submission status: Accepted

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

for i in range(1,n+1):
    c = 0
    while True:
        if i%2 == 0:
            i //= 2
            c += 1
        else:
            if cnt < c:
                ans = i*2**c
                cnt = c
            break

print(ans)

Submission status: Accepted

Solution code:
def resolve():
  n = int(input())
  ans = 1
  num = 0
  for i in range(1, n+1):
    tmp = 0
    x = i
    while x >= 2 and x % 2 == 0:
      if x % 2 == 0:
        tmp += 1
        x /= 2
        if tmp >= num:
          ans = i
          num = tmp
      else:
        continue

  print(ans)
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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

    ma = 0
    ans = 1
    for k, v in res.items():
        if ma < v:
            ans = k
            ma = v

    print(ans)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
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()
ans = -1
res = 0
for i in range(1,n+1):
    cnt = 0
    tmp = i
    while True:
        if tmp%2:
            break
        tmp //= 2
        cnt += 1
    if cnt > ans:
        ans = cnt
        res = i
print(res)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
n=int(input())
l=[2**i for i in range(10)]
print(l[bisect.bisect(l,n)-1])

Submission status: Accepted

Solution code:
import bisect
n=int(input())
l=[2**i for i in range(10)]
print(2**(bisect.bisect(l,n)-1)) #イマイチ

Submission status: Accepted

Solution code:
n = int(input())
nums = [1, 2, 4, 8, 16, 32, 64, 128]
ans = 0
for i, v in enumerate(nums):
    if v <= n:
        continue
    else:
        ans = nums[i - 1]
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(a)

Submission status: Accepted

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

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    ans = 1
    while ans * 2 <= n:
        ans *= 2
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

if __name__ == '__main__':
    a = int(input())
    max =1
    maxcount=0

    for i in range(1,a+1):
        s2 = i
        count =0
        while s2 >=2:
            if s2 %2 == 0:
                count+=1
                s2 = s2//2

            else:
                break
            if maxcount < count:
                max = i
                maxcount = count

    print(max)

Submission status: Accepted

Solution code:
n = int(input())
lis = [1,2,4,8,16,32,64]
ans = 0

for i in lis:
  if n - i >= 0:
    ans = max(ans,i)
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(int(x))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math


def solve(N: int):
    ans = [i for i in range(1, N + 1)[::-1] if math.log2(i) % 1 == 0]
    print(ans[0])
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
mc = 0
for i in range(1, N + 1):
    c = 0
    while i % 2 == 0:
        i //= 2
        c += 1
    mc = max(c, mc)
print(2**mc)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
k = math.log2(N)

print(2**int(k))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def cntDiv(n):
    cnt = 0
    while n % 2 == 0:
        n /= 2
        cnt += 1
    return cnt


n = int(input())
res = 1
cnt = 0
for i in range(1, n + 1):
    tmp = cntDiv(i)
    if cnt < tmp:
        cnt = tmp
        res = i
print(res)

Submission status: Accepted

Solution code:
N=int(input())

ans=1
cnt=0
for i in range(1,N+1):
    tmp=0
    n=i
    while True:
        if n%2==0:
            tmp+=1
        else:
            break
        n//=2
    if tmp>cnt:
        ans=i
        cnt=tmp
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
c = 1
while c <= n:
    if c*2 <= n:
        c *= 2
    else:
        break
print(c)

Submission status: Accepted

Solution code:
n = int(input())
c = 0
max_c = 0
max_num = 1

for i in range(1, n+1):
    if i % 2 == 0:
        j = i
        c = 1
        j /= 2
        while j % 2 == 0:
            c += 1
            j /= 2
    if c > max_c:
        max_c = c
        max_num = i

print(max_num)

Submission status: Accepted

Solution code:
n = int(input())
t=2
while n//t>0:
    t *= 2
print(t//2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[20]:


N = int(input())


# In[21]:


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


# In[ ]:

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0

while N > 1:
    N = N//2
    cnt +=1

print(2**cnt)

Submission status: Accepted

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

Submission status: Accepted

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

while 2**(n+ 1)<= N:
  n+= 1

print(2**n)

Submission status: Accepted

Solution code:
n = int(input())
ans = 1
while 2 * ans <= n:
  ans *= 2
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())

for i in range(8):
	if N < 2**i:
		tmp = i
		break

print(2**(tmp-1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

  if count > max:
    max = count
    ans = i
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
while True:
    temp = n
    while temp%2==0:
        temp /= 2
    if temp==1:
        print(n)
        break
    n-=1

Submission status: Accepted

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

print(int(num/2))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
nums = [1, 2, 4, 8, 16, 32, 64]
N = int(input())
result = nums[0]
for num in nums:
    if N >= num:
        result = num
    else:
        break
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def resolve():
    N = int(input())
    ans = pow(2,int(math.log2(N)))
    print(ans)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
def li():
    return list(map(int, input().split()))


def mi():
    return map(int, input().split())


def ii():
    return int(input())


N = ii()

a = 1
while True:
    if a > N:
        break
    else:
        a *= 2
print(int(a / 2))

Submission status: Accepted

Solution code:

limit = int(input())

num = 1
while num * 2 <= limit:
    num *= 2

print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
for i in range(10,-1,-1):
    if 1<<i<=N:
        print(1<<i)
        break

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from bisect import bisect_left, bisect_right

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

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

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

Submission status: Accepted

Solution code:
from math import log2, floor

n = int(input())

res = floor(log2(n))
print(pow(2, res))

Submission status: Accepted

Solution code:
#Break Number
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

while N is not 0:
    f = False
    a = 0
    M = N
    while f == False:
        if M % 2 ==0:
            M = int(M / 2)
            a += 1
        else:
            f = True
    if b < a:
        b = a
        N = N - 1
    else:
        N = N - 1
print(2**b)

Submission status: Accepted

Solution code:
N = int (input())

max = 0
ans = 1

for i in range(1, N+1):
    count = 0
    a = i
    while True:
        if a % 2 == 1:
            if max < count:
                max = count
                ans = i
        else:  
            a = int(a / 2)
            count += 1
            continue
        break

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().strip())
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())
n=1
while True:
    if n>N:
        print(int(n/2))
        break
    
    n=n*2

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = [0 for i in range(n)]

for i in range(1,n+1):
    tmp = i
    while tmp % 2 == 0:
        ans[i-1] += 1
        tmp //= 2
max_num = max(ans)
print(ans.index(max_num)+1)

Submission status: Accepted

Solution code:
N = int(input())
ball = 1
if N == 1:
    print(1)
else:
    while True:
        if ball > N:
            break
        ball *= 2
    print(int(ball/2))

Submission status: Accepted

Solution code:
N = int(input())

# ans = 1
# mac_c = 0
# for i in range(2, N+1):
#     c_count = 0
#     temp_i = i
#     while True:
#         if temp_i % 2 != 0:
#             break
#         temp_i /= 2
#         c_count += 1
#     if mac_c <= c_count:
#         mac_c = c_count
#         ans = i

# 別解
# 100以内の数で2の累乗を求めればいい
ans_list = [2**i for i in range(7)]
ans = max([i for i in ans_list if N >= i])
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 1
mac_c = 0
for i in range(2, N+1):
    c_count = 0
    temp_i = i
    while True:
        if temp_i % 2 != 0:
            break
        temp_i /= 2
        c_count += 1
    if mac_c <= c_count:
        mac_c = c_count
        ans = i

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
ans = [math.floor(math.log2(i)) for i in range(1, N+1)]
print(ans.index(max(ans)) + 1)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
n = 6
while(N < 2 ** n):
    n -= 1
print(2 ** n)

Submission status: Accepted

Solution code:
N = int(input());

count = [0] * (N+1);

for i in range(N+1):
    tmp = i
    if i != 0:
        while tmp % 2 == 0:
            tmp = tmp /2
            count[i] += 1

max_value = max(count)
num = count.index(max_value)
if num == 0:
    num += 1
print(num)

Submission status: Accepted

Solution code:
n = int(input())



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

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 True:
  if a<=n:
    a*=2
  else:
    break

print(a//2)

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(0, 7):
    if n >= 2**(6-i):
        print(2**(6-i))
        break

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

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

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = inputI()

print(2**int_log(N,2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(sys.stdin.readline().rstrip("\n"))
i = 0
while 2**i <= n:
    i += 1
print(2**(i-1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 1
cnt = 0
for i in range(1, n + 1):
    count = 0
    temp = i
    while temp % 2 == 0:
        count += 1
        temp //= 2

    if cnt < count:
        cnt = count
        ans = i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import log2, floor

N = int(input())

print(pow(2, floor((log2(N)))))

Submission status: Accepted

Solution code:
# For taking integer inputs.
def inp():
    return(int(input()))


n = inp()

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

Submission status: Accepted

Solution code:
import math
from collections import deque
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

n = readInt()

ans=1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m_num = 1
m_count = 0
for i in range(1, int(input()) + 1):
    count = 0
    tmp = i
    while tmp % 2 == 0:
        tmp //= 2
        count += 1
    if m_count < count:
        m_num = i
        m_count = count
print(m_num)