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:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    n = II()
    print("ABC"+str(n))
    return

#B
def B():
    ni = [2 ** i for i in range(1, 10)]
    n = II()
    ans = 1
    for i in range(1, n + 1):
        if i in ni:
            ans = i
    print(ans)        
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
"""
n = input()
print("ABC"+n)
"""

#B
n = I()
p = [1]
for i in range(n):
    p.append(p[-1]*2)
    if p[-1] > n:
        print(p[-2])
        quit()
#C
"""
def dijkstra():
    d[0] = 0
    q = [[0,0]]
    while q:
        dx, x = heappop(q)
        for y in v[x]:
            if d[y] > dx+1:
                d[y] = dx+1
                heappush(q,[d[y],y])
n,m = LI()
v = [[] for i in range(n)]
for i in range(m):
    a,b = LI()
    a -= 1
    b -= 1
    v[a].append(b)
    v[b].append(a)
d = [float("inf") for i in range(n)]
dijkstra()
if d[n-1] <= 2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
"""

#D
"""
k = I()
ans = [i+k//50 for i in range(50)]
k %= 50
for i in range(k):
    ans[i] += 51
    for j in range(50):
        ans[j] -= 1
print(50)
print(*ans)
"""

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
n = int(input())

ma = 1

c = 0
while True:
	c += 1  
	k = 2**c
	if k > n:
		break      
    
	if k > ma:
		ma = k
		 
    
print(ma)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: UTF-8
N = int(input())
a=0
for i in range(N):
    if 2**a<=N:
        a=a+1
    else: a=a
print(2**(a-1))

Submission status: Accepted

Solution code:
N = int(input())
l = list(range(1,N+1))
max = -99999999
for i in range(N):
       if (2**i) > max and 2**i <= N:
               max = 2**i
print(max)

Submission status: Accepted

Solution code:
N = int(input())
l = [1,2,4,8,16,32,64]
if N in l:
  print(N)
else:
  l = sorted(l+[N])
  print(l[l.index(N)-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())
a=[1,2,4,8,16,32,64]
for i in range(n+1)[::-1]:
    if i in a:
        print(i)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(res)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

while result*2 <= N:
    result *= 2

print(result)

Submission status: Accepted

Solution code:
N = int(input())

tmp = 0
for i in range(2,N+1,2):
  cnt = 0
  while True:
    if(i%2 != 0):
      break
    cnt += 1
    i //= 2
  tmp = max(tmp, cnt)
print(2**tmp)

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 = bin(int(input()))
print(2**(len(N)-3))

Submission status: Accepted

Solution code:
n = int(input())

n2 = 1
while True:
	if n < n2:
		break
	n2 *= 2
	
print(n2//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
num=0
if n==1:
    print(1)
    exit()
else:
    for i in range(1,n+1):
        k=0
        c=i
        while True:
            if c%2==0:
                c/=2
                k+=1
            else:
                break
        if k>num:
            num=k
            ans=i
print(ans)

Submission status: Accepted

Solution code:
from math import log2
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def ceil(n):
    return int(-n//1)*(-1)


N = int(input())

ans = ceil(log2(N))
if 2**ans > N:
    ans -= 1
print(2**ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
""" AtCoder """

N = int(input())
ans_list = [2, 4, 8, 16, 32, 64]
ans_list = ans_list[::-1]

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

for i in range(7):
    if N >= ans_list[i]:
        print(ans_list[i])
        break

Submission status: Accepted

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

while(1):
  if(pow(2,i)<= N <pow(2,i+1)):
    print(pow(2,i))
    break
  i += 1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
li = [2**i for i in range(0,7,1)]
flag = False
for i in range(N):
  for j in range(7):
    if li[j] == N:
      print(li[j])
      flag = True
      break
  if flag == True:
    break
  else:
    N -= 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

i = 0

while True:
    if 2 ** i < N:
        i += 1
    elif 2 ** i == N:
        break
    else:
        i -= 1
        break

print(2 ** i)

Submission status: Accepted

Solution code:
N = int(input())

nList = [i + 1 for i in range(N)]
res = -1
counter = -1
for n in nList :
    count = 0
    buf = n
    while buf % 2 == 0 :
        count += 1
        buf = buf / 2
    if counter < count :
        counter  = count
        res = n
print(res)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
currCount = 0
ans = 0
for i in range(n+1):
    currCount = 0
    currNum = i
    while (i % 2) == 0:
        if i == 0:
            break
        i = int(i / 2)
        currCount += 1
    if count <= currCount:
        count = currCount
        ans = currNum
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
j = 0
c2 = 0
for i in range(1, N+1):
	a = i
	c = 0
	while a % 2 == 0:
		c = c + 1
		a = a / 2
		if c >= c2:
			c2 = c
			j = i
if N == 1:
	print(1)
else:
	print(j)

Submission status: Accepted

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

a.sort(key=lambda x:x[1],reverse=True)
print(a[0][0])

Submission status: Accepted

Solution code:
n = int(input())
num = [2**i for i in range(10)]
while n not in num:
    n -= 1
print(n)

Submission status: Accepted

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

while n >= 2 ** power:
    power += 1

print(2**(power-1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
cand = [2**x for x in range(7)]
for i in range(n,0,-1):
    if i in cand:
        print(i)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("Heisei")
    else:print("TBD")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


n = ip()                              #入力整数1つ
#h,w= (int(i) for i in input().split())      #入力整数横2つ
#n,x,y = (int(i) for i in input().split())    #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
x = 1
while x<=n:
    x*=2
print(x//2)

Submission status: Accepted

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

while max*2 <= n:
    max *= 2

print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 19:11:35 2019

@author: yuta
"""

def div(n):
    count = 0
    while n % 2 == 0:
        n /= 2
        count += 1
    return count

x = int(input())
y = list(range(1,(x + 1)))

mapped_list = list(map(div, y))
max_div = max(mapped_list)
print(y[mapped_list.index(max_div)])

Submission status: Accepted

Solution code:
N = input()

ans = 64
while True:
  if ans<=N:
    break
  ans /= 2
print ans

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

def f(n):
  if n == 1:
    return True
  elif n%2 == 0:
    return f(n/2)
  else:
    return False

n = int(input())
for i in range(n,0,-1):
  if f(i):
    print(i)
    break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, N + 1):
    m = i
    count = 0
    while m % 2 == 0:
        m //= 2
        count += 1
    counter.append(count)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(ans)

Submission status: Accepted

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

while n <= N:
    n *= 2

print(n//2)

Submission status: Accepted

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

l=[]
l=[0]*(N)
for i in range(N):##N=6 0,1,2,3,4,5
	d=i#unchanged 0 1 2 3 4 5 
	l[d]=0 #l[0] 1 2 3 4 5
	pra=i+1
	while pra%2==0:#1~6
		pra/=2
		l[d]+=1
#print(l)#from left 1 2 3 4 5 6's divideble times

for i in range(N):
	if(l[i]==max(l)):#0-5
		print(i+1)#1-6

Submission status: Accepted

Solution code:
def counter(n):
  count = 0
  while(n%2 == 0):
    count += 1
    n = int(n/2)
  return count

N = int(input())
max = 0
ans = 1
for i in range(N):
  if(max < counter(i+1)):
    max = counter(i+1)
    ans = i+1
    
print(ans)

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)

Submission status: Accepted

Solution code:
n = int(input())
s = 1
while n >= s:
    x = s
    s*=2

print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 068B
import numpy as np
n=int(input())
print(2**int(np.log2(n)))

Submission status: Accepted

Solution code:
import sys
n=input()
kaisuu = 0
ans = 0
if int(n) == 1:
    print(1)
    sys.exit()
for i in range(1,int(n)+1):
    count = 0
    num = i
    while(num % 2 == 0):
        count = count + 1
        num /= 2
    if kaisuu < count:
        kaisuu = count
        ans = i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def num2(n):
  ans=0
  while n%2==0:
    ans+=1
    n//=2
  return ans
N=int(input())
l=[[i,num2(i)] for i in range(1,N+1)]
l.sort(key=lambda x:x[1],reverse=True)

print(l[0][0])

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[2**s for s in range(8)]
for s in range(8):
  if n<a[s]:print(a[s-1]);exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 1

while True:
    if N < ans << 1:
        break
    ans <<= 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n=int(input())
wari=0
ans=0
for i in range(1,n+1):
    tmp=int(math.log2(i))
    if tmp>wari:
        wari=tmp
        ans=i
print(ans if n!=1 else 1)

Submission status: Accepted

Solution code:
L = [2**i for i in range(0,7)]
N = int(input())
L = list(filter(lambda x:x<=N,L))
print(L[-1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(L)):
    if N >= L[i]:
        print(L[i])
        exit()

Submission status: Accepted

Solution code:
n=int(input())
lst=[2**i for i in range(6,-1,-1)]
for i in lst:
    if i<=n:
        print(i)
        exit()

Submission status: Accepted

Solution code:
N = int(input())
ans = [2 ** i for i in range(0, 7)]

for i in range(len(ans)):
    if ans[i] > N:
        print(ans[i-1])
        exit(0)
print(64)

Submission status: Accepted

Solution code:
n=int(input())
A=[64,32,16,8,4,2,1]
for i in A:
  if i<=n:
    print(i)
    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())
a=1
while(a<=n):
  a*=2
print(a//2)

Submission status: Accepted

Solution code:
int_n = int(input())

for i in reversed(range(8)):
    result = 2 ** i
    if result <= int_n:
        print(result)
        exit(0)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n_b = bin(int(input()))[::-1]
print(2**(n_b.index("b")-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)
elif N < 101:
    print(64)

Submission status: Accepted

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

    l = []
    for i in range(1, n + 1):
        k = i
        c = 0
        while k % 2 == 0:
            c += 1
            k = k // 2
        l.append(c)
    print(l.index(max(l)) + 1)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

while val <= N:
    val *= 2

mod_2 = divmod(val, 2)
mod_2 = mod_2[0]
print(mod_2)

Submission status: Accepted

Solution code:
n = int(input())

ans_list = [64, 32, 16, 8, 4, 2, 1]
for i in ans_list:
    if n >= i:
        print(i)
        exit()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
print(1 << len(bin(int(input()))) - 3)

Submission status: Accepted

Solution code:
n = int(input())

max_count = 0
ans = 1

for i in range(1,n+1):
    count = 0
    tmp = i
    for j in range(1,i+1):
        if tmp % 2 == 0:
            tmp /= 2
            count += 1
        else:
            if count > max_count:
                ans = i
                max_count = count
            break
print(ans)

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

lst = list(range(1, N + 1))
counter = 0  # 2で割った回数

while len(lst) > 1:
    lst = [i // 2 for i in lst if i % 2 == 0]
    counter += 1

print(lst[0] * 2 ** counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def getInt(): return int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
print(2**(len(bin(N)[2:])-1))

Submission status: Accepted

Solution code:
print(2**(len(format(int(input()),"b"))-1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if(N == 1):
	answer = 1
else:
	answer = 0
max_count = 0
for val in range(N+1):
    tmp = val
    count = 0
    while (tmp % 2 == 0):
        if(tmp == 0):
            break
        tmp /= 2
        count += 1
    if(max_count < count):
        answer = val
        max_count = count

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Break Number
import sys

N = int(input())

cnt = [0 for x in range(N)]
a = [int(_ + 1) for _ in range(N)]

for i in range(N) :
    while True :
        if a[i] % 2 == 0 :
            a[i] = a[i] // 2
            cnt[i] += 1
        else :
            break

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

Submission status: Accepted

Solution code:
N = int(input())
m = 0
ans = 1
for i in range(N + 1):
    c = 0
    x = i
    while i > 0:
        if i % 2 == 0:
            i = i // 2
            c += 1
        else:
            break
    if m < c:
        m = c
        ans = x
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

result = 0

for i in range(0, 7):
    if N >= 2**i:
        result = 2**i

print(result)

Submission status: Accepted

Solution code:
n=int(input())
#print(n)

def kaisu(j):
    kotae=0
    while j % 2==0:
        j = j >> 1
        kotae+=1
    return kotae

kaisu0=0
ans=1
for i in range(1,n+1):
    if kaisu0 < kaisu(i):
        kaisu0 = kaisu(i)
        ans = i

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
#print(n)

def kaisu(j):
    kotae=0
    while j % 2==0:
        j = j / 2
        kotae+=1
    return kotae

kaisu0=0
ans=1
for i in range(1,n+1):
    if kaisu0 < kaisu(i):
        kaisu0 = kaisu(i)
        ans = i

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=[2**i for i in range(10)]
for i in range(0,len(a)):
    if a[i]>n:
        ans=a[i-1]
        break
print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
N = int(input())
lut = [2, 4, 8, 16, 32, 64]
a = 1
for l in lut:
    if l <= N:
        a = l
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

lines = sys.stdin.readlines()

cnt = 1
threshold = int(lines[0].strip())
if threshold == 0:
  print(0)
  sys.exit()

sentinel = 9999
for i in range(sentinel):
  new_cnt = cnt * 2
  if new_cnt > threshold:
    print(cnt)
    break
  else:
    cnt = new_cnt

Submission status: Accepted

Solution code:
a = int(input())


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

Submission status: Accepted

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

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

    print(ans)


abc068_b()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
s = 1
n = 8
while n>0:
    if 2**n <=a:
        s = 2**n
        break
    n-=1
print(s)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans // 2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
result = {}
x = 1
if(N == 1):
  print(1)
  exit()
else:
  for i in range(1,N+1):
    while i%2 == 0:
      i //= 2
      cnt += 1
      x += 1
      result[x] = cnt
    cnt = 0
print(max(result, key = result.get))

Submission status: Accepted

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


def main():
    """Function."""
    n = int(input())

    base = [2**x for x in range(7)]

    max_base = 0
    for dum in base:
        if n >= dum:
            max_base = dum

    print(max_base)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    max_quot = 0
    max_quot_i = 1
    for i in range(1, n + 1):
        quote = 0
        ii = i
        while ii % 2 == 0:
            ii //= 2
            quote += 1
        if quote > max_quot:
            max_quot = quote
            max_quot_i = i
    print(max_quot_i)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
_max = 0
out = 1
for i in range(1, n + 1):
    count = 0
    _i = i
    while _i > 0 and _i % 2 == 0:
        count += 1
        _i = _i // 2
    if count > _max:
        out = i
        _max = max(_max, count)
print(out)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
N = input()
count=0
for i in range(N):
  if N != 1:
    N=N/2
    count+=1
  else: break
print 2**count

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
x = 1
while N >= 2**x:
  x = x+1
  
print(2 ** x //2)

Submission status: Accepted

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

# 実際Nもいらない
for i in range(N) :
    if (N == 1) :
        print(1)
        break

    if (N < math.pow(2,i)) :
        print(int(math.pow(2,i-1)))
        break

Submission status: Accepted

Solution code:
N = int(input())

list_n = [2**i for i in range(7)]
c = 0
for i in list_n:
    if i <= N:
        c=i

print(c)

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:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest068-B
#  https://beta.atcoder.jp/contests/abc068/tasks/abc068_b


def breakNumber(pint):

	numArray = [i for i in range(1,pint+1)]
	i = 0

	while i < pint :
		devCount=0
		while numArray[i] % 2 == 0:
			devCount = devCount+1
			numArray[i] = numArray[i] // 2
		numArray[i] = devCount
		i=i+1

	maxDevLabel = -1
	maxDevNumber = -1
	i = 0
	while i < pint :
		if maxDevNumber < numArray[i] :
			maxDevNumber = numArray[i]
			maxDevLabel = i
		i = i + 1

	answer = maxDevLabel+1
	return answer


if __name__ == '__main__':
	inputNum = int(input())
	ans=breakNumber(inputNum)
	print(ans)

Submission status: Accepted

Solution code:
def calculate_dived_by_two(n):
    count = 0
    while n % 2 == 0:
        count += 1

        n //= 2

    return count


n = int(input())

result = 1
max_count = 0
for i in range(1, n + 1):
    count = calculate_dived_by_two(i)
    if count > max_count:
        max_count = count
        result = i

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
print max ([2 ** i for i in range(8) if 2 ** i <= N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N = input()
for i in reversed(range(N + 1)):
    for j in reversed(range(7 + 1)):
        if i== 2 ** j:
            print i
            sys.exit(0)

Submission status: Accepted

Solution code:
n=int(input())
list=[2**(1*i) for i in range(7)]
ans=1000
sol=0
for i in list:
  if i <= n:
    dis=abs(i-n)
    if dis < ans:
      ans=dis
      sol=i
print(sol)

Submission status: Accepted

Solution code:
N=int(input())

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

print("0")

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())

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

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
lst = [1,2,4,8,16,32,64]

ans = 1
for i in lst:
    if i > N:
        break
    ans = i
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

count = 0
while True:
    if n // 2 == 0:
        break

    n //= 2
    count += 1

result = 2 ** count
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
max_div = [1, 0]
for n in range(1, N + 1):
    div = [n, 0]
    while n % 2 == 0:
        n //= 2
        div[1] += 1
    if div[1] > max_div[1]:
        max_div = div
print(max_div[0])