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:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import fractions
import copy
import bisect
import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter


N=3
M=3
i=0
j=0
k=0
n=3
r=1
a=[0]*5
b=[]
N=int(input())
real=math.sqrt(N)
#r=int(input())
#print(real)
intb=math.floor(real)
for i in range(100):
    if N < 2**i:
        if i==0:
            print(N)
            sys.exit()
        print(2**(i-1))
        sys.exit()
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ

'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき 

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation


#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b 

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''





########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if 2**6<= N:
    print(2**6)
elif 2**5<= N <2**6:
    print(2**5)
elif 2**4<= N <2**5:
    print(2**4)
elif 2**3<= N <2**4:
    print(2**3)
elif 2**2 <= N < 2**3:
    print(2**2)
elif 2**1 <= N < 2**2:
    print(2**1)
else:
    print(1)

Submission status: Accepted

Solution code:
N = int(input())
s = [0,1,2,4,8,16,32,64,128]
for x in range(len(s)-1):
  if N in range(s[x],s[x+1]):
    print(s[x])

Submission status: Accepted

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

for i in range(1, n + 1):
    anstmp = 0
    test = i
    while test % 2 == 0:
        test = test / 2
        anstmp = anstmp + 1

    if num <= anstmp:
        ans = i
        num = anstmp

print(ans)

Submission status: Accepted

Solution code:
def f(n):
  ret=0
  while n%2==0:
    ret+=1
    n/=2
  return ret
n=int(input())
ans=0
max_=0
for a in range(1,n+1):
  if f(a)>=max_:
    max_=f(a)
    ans=a
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

ans = max([i for i in tmp if i <= n])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
result = []
for i in range(1, N + 1):
    count = 0
    while i % 2 == 0:
        i = i / 2
        count += 1
            
    result.append(count)

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

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
y = 0
for i in range(1,N+1):
  x = 0
  while i%2 <= 0:
    i = i/2
    x = x+1
  if y < x:
    y = x

print(2**y)

Submission status: Accepted

Solution code:
n=int(input())

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

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())
max = 0
ans = 1

for i in reversed(range(0, N+1)):
  if i % 2 == 0:
    tmp = i
    cnt = 0
    for _ in range(N):
      if i % 2 == 0 and i != 0:
        i = i // 2
        cnt += 1
    if max < cnt:
      max = cnt
      ans = tmp
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
#ABC068.B
N = int(input())
for x in range(7):
    if 2**x <= N < 2**(x+1):
        print(2**x)
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

s2 = 2
c2 = 0
while True:
  if s2*2>N:
    break
  s2 *= 2
  c2 += 1

if N == 1:
  print(1)
else:
  print(2*2**c2)

Submission status: Accepted

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

for i in range(8):
    if ans[i]>n:
        print(ans[i-1])
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n=int(input())

a=[]

for nn in range(n):
    if (2**nn) <=n:
        a.append (2**nn) 

print(max(a))

Submission status: Accepted

Solution code:
N = int(input())
min = 0
max = 0

for i in range(N):
    if 2**i <= N:
        min = 2**i
    else:
        break

print(min)

Submission status: Accepted

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

for i in range(10):
  if 2**i <=N:
    maxi=max(maxi,2**i)
    
print(maxi)

Submission status: Accepted

Solution code:
n = int(input())

a = [2**i for i in range(7)]
b = []
for i in a:
  if i <= n:
    b.append(i)
    
print(max(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n==1:
    print(1)
    exit()
else:
    ans = 1
    while ans<=n:
        ans *= 2

print(ans//2)

Submission status: Accepted

Solution code:
n = int(input())

ans = 1
for i in range(1,10):
    if 2 ** i <= n:
        ans = 2**i

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
C = -1
while N:
    N //= 2;
    C += 1
print(1 << C)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
import math
# import decimal
# import queue
# import bisect
# import heapq # priolity-queue
# import time
# import itertools
# import collections # queue
# from operator import itemgetter
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def main():
    n = int(input())
    ans = [0,1]
    for i in range(2,n+1):
        x = i
        cnt = 0
        while x%2==0:
            x //= 2
            cnt += 1
        if cnt>ans[0]:
            ans[0] = cnt
            ans[1] = i
    print(ans[1])
    return

if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, n + 1):
    num = i
    while num % 2 == 0:
        num /= 2
        a[i - 1] += 1

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

Submission status: Accepted

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

for i in range(N, 0, -1):
    if math.log2(i) == int(math.log2(i)):
        output = i
        break
        
print(output)

Submission status: Accepted

Solution code:
import sys

n = int(input())

div_max = 0
div = 1

for i in range(1,n+1):
    cnt = 0
    num = i
    while num%2==0:
        num = num/2
        cnt += 1
    
    if div_max < cnt:
        div_max = cnt
        div = i

print("{}".format(div))

Submission status: Accepted

Solution code:
n=int(input())
b=bin(n)
s=str(b)[2:]
i=len(s)
print(2**(i-1))


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

i = 1
while True:
  i *= 2
  if i > n:
    print(i // 2)
    break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int):
    print(1 << (N.bit_length() - 1))


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 2
for i in range(100):
  if ans > N:
    ans //= 2
    break
  ans *= 2
print(ans)

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    N=int(input())
    val=1
    while val<=N:
        val=val*2
    print(val//2)

resolve()

Submission status: Accepted

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

Submission status: Accepted

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

print(2**count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
counter = 0
cnt = [0]*(n+1)
for i in range(1,n+1):
    j = i
    while(j%2 == 0):
        j = j/2
        counter += 1
    cnt[i] = counter
    counter = 0
max_val = max(cnt[1:])
ans = cnt[1:].index(max_val)
print(ans+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
result = 1
for i in range(n):
  a = n-i
  while a % 2 == 0:
    a /= 2
    if a == 1:
      result = n-i
      break
  else:
    continue
  break
  
  

print(result)

Submission status: Accepted

Solution code:
n=int(input())
result = 0
for i in range(n):
  a = n-i
  while a % 2 == 0:
    a /= 2
    if a == 1:
      result = n-i
      break
  else:
    continue
  break
  
  
if n == 1:
  print(1)
else:
  print(result)

Submission status: Accepted

Solution code:
import sys

n=int(input())
if n==1:
  print(1)
  sys.exit()
result = 0
for i in range(n):
  a = n-i
  while True:
    if a % 2 == 1:
      break
    else:
      if a == 2:
        print(n-i)
        sys.exit()
      else:
        a /= 2

Submission status: Accepted

Solution code:
import sys
import os


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

    N = int(sys.stdin.readline().rstrip())
    ret = 0
    for n in range(N):
        tmp = 2 ** n
        if ret < tmp and tmp <= N:
            ret = tmp

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(1<<len(bin(int(input())))-(3645747678536676837529748782678*0+3))

Submission status: Accepted

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

def main():
  N = int(input())
  ans = 1
  maxv = 0
  for i in range(1, N + 1):
    tmp = count_two(i)
    if tmp > maxv:
      maxv = tmp
      ans = i
  print(str(ans))
    
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
#68B Break Number
n=int(input())
maxnum=0
maxtrial=2
while maxtrial<=n:
    maxtrial*=2
print(int(maxtrial/2))

Submission status: Accepted

Solution code:
N=int(input())
max_num=[0,0]
pass_time=0
for i in range(1,N+1):#1以上7以下
  num=0
  init_i=i
  while i%2==0:#偶数のあいだは
    i=i/2
    num+=1
  #print(init_i,num)
  if num>max_num[1]:
    max_num[0]=init_i
    max_num[1]=num
    pass_time+=1
if pass_time==0:
  max_num[0]=init_i
print(max_num[0])

Submission status: Accepted

Solution code:
n=int(input())

maxx=0
maxn=1
for i in range(1,n+1):
  tmp=i
  cnt=0
  while 1:
    if tmp%2==0:
      tmp=tmp//2
      cnt+=1
    else:
      break
  if cnt > maxx:
    maxn=i
    maxx=cnt

print(maxn)

Submission status: Accepted

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

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 sys

a = [1, 2, 4, 8, 16, 32, 64, 128]
n = int(sys.stdin.readline())

for x in a:
    if n < x:
        break
print(x // 2)

Submission status: Accepted

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

tmp = 0
ans = 0
if n == 1:
    print(1)
    exit()
for i in range(1, n + 1):
    tmp2 = 0
    while True:
        if i % 2 == 1:
            break
        else:
            i /= 2
            tmp2 += 1
    if tmp2 > tmp:
        tmp = tmp2
        ans = i * pow(2, tmp2)
print(int(ans))

"""
count = []
for i in range(1,n + 1):
    count.append([0, i])

for i in range(n):
    tmp = 0
    while True:
        if count[i][1] == 2 ** tmp:
            count[i][0] = tmp
            break
        elif count[i][1] > 2 ** tmp:
            tmp += 1
        else:
            break

count.sort()
print(count[n - 1][1])
"""

Submission status: Accepted

Solution code:
dic = {}
n = int(input())
for i in range(1,n+1):
    a = i
    counter = 0
    while a%2==0:
        counter += 1
        a /= 2
    dic[i] = counter

dic = sorted(dic.items(),key=lambda x:x[1],reverse=True)
#print(dic)
print(dic[0][0])

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 64
 
while ans > N:
    ans /= 2
    
print(int(ans))

Submission status: Accepted

Solution code:
n = int(input())
ans = 64
 
while ans > n:
    ans /= 2
    
print(int(ans))

Submission status: Accepted

Solution code:
n=int(input())
cnt=0
tmp=0
ans=0
for i in range(n):
            if 2**i>=n:              
                        break

if 2**i==n:
            print(n)
else:
            print(2**(i-1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [2**i for i in range(10) if 2**i < 129]

for index,i in enumerate(A):
    if N < i:
        print(int(i/2))
        break

Submission status: Accepted

Solution code:
n = int(input())

count = 0
mx = -1
ans = 1

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

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())
if n < 2 ** 1:
    print(2**0)
elif n < 2 ** 2:
    print(2 ** 1)
elif n < 2 ** 3:
    print(2 ** 2)
elif n < 2 ** 4:
    print(2 ** 3)
elif n < 2 ** 5:
    print(2 ** 4)
elif n < 2 ** 6:
    print(2 ** 5)
elif n <= 100:
    print(2 ** 6)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1, n+1):
    count = 0
    for j in range(8):
        if i%2 == 0:
            i /= 2
            count += 1
    ans = max(ans, count)
print(2**ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
max1 = -1
max_N = -1
while(N>0):
    cnt = 0
    temp = N
    while(temp!=1):
        if temp%2!=0:
            break
        temp //= 2
        cnt += 1
    if max1 < cnt:
        max1 = cnt
        max_N = N
    N -= 1
print(max_N)

Submission status: Accepted

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

import copy

ans = 0
ans_c = 0

for i in reversed(range(n)):
    check = copy.copy(i)
    div = 0
    count = 0

    while div == 0:
        div = (i % 2)
        i = i // 2
        if div == 0:
            count += 1
        if i == 0:
            break
    if ans_c < count:
        ans = check
        ans_c = count
if ans == 0:
     ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

m_count = 0
t_num = 1
for r in range(1, n+1):
    flg = True
    t_count = 0
    tr = r
    while(flg):
        if tr // 2 > 0:
            t_count += 1
            tr //= 2
        else:
            flg = False
    if m_count < t_count:
        m_count = t_count
        t_num = r
print(t_num)

Submission status: Accepted

Solution code:
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
ans=64
while ans>N:
    ans=ans/2
print(int(ans))

Submission status: Accepted

Solution code:
# B
# 2020/03/03 9:43-
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
#print(N)
max_cnt = 0
max_num = 1
for n in range(1, N+1, 1):
  #print("n", n)
  orig_n = n
  cnt = 0
  while True: 
    if n % 2 == 0:
      #print(n)
      n /= 2
      cnt += 1
    else:
      if cnt > max_cnt:
        max_cnt = cnt
        max_num = orig_n
        #print("max_num", max_num)
      break

print(max_num)

Submission status: Accepted

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

Submission status: Accepted

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

while ans > n:
    ans /= 2
    
print(int(ans))

Submission status: Accepted

Solution code:
N = int(input())

max_count = 0
ans = 1

def div2(x, count):
    x, mod = divmod(x, 2)
    if mod != 0:
        return count
    else:
        if x == 1:
            return count+1
        return div2(x, count+1)
for x in range(1, N+1):
    count = div2(x, 0)
    
    if count > max_count:
        max_count = count
        ans = x
    
print(ans)

Submission status: Accepted

Solution code:
#ABC068

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    ans=1
    N=I()
    for i in range(10):
        ans*=2
        if ans>N:
            break
    print(ans//2)

main()

Submission status: Accepted

Solution code:
n = int(input())
import numpy as np
a = list(range(1,n+1))
b = list(range(1,n+1))
c = [0] * n
for i in range(n):
  while a[i] % 2 == 0:
    a[i] /= 2
    c[i] += 1
print(b[np.argmax(c)])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = [_ for _ in range(1,n+1)]

x = []
for i in range(1,n+1):
    a = 0
    b = i
    for j in range(int(n**0.5)):
        if b%2 == 0:
            a += 1
            b = b/2
    x.append(a)

c = x.index(max(x))

print(l[c])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
max_count = 0
max_elem = 1
for i in range(1, n+1):
    j = i
    j_count = 0
    while j%2 == 0:
        j = j / 2
        j_count = j_count+1
    if max_count < j_count:
        max_count = j_count
        max_elem = str(i)
print(max_elem)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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())
res = 1
while True:
    val = 2 * res
    if val <= N:
        res = val
    else:
        break
print(res)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
dic = {}

for i in range(1, n+1):
    if i % 2 == 0:
        a = i
        cnt = 0
        while a % 2 == 0:
            a = a / 2
            cnt += 1
        dic.update({i: cnt})

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

print([i for i in dic if dic[i] == max(dic.values())][0])

Submission status: Accepted

Solution code:
n = int(input())

ans = 1
for i in [2,4,8,16,32,64]:
    if i <= n:
        ans = i

print(ans)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

max = 0
number = 1
for j in range(1,n+1):
    if (count(j) > max):
        max = count(j)
        number = j
print(number)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
count=0
max=0


for a in range(1,N+1):
    while(a%2==0):
        a/=2
        count+=1
    if(max<count):
        max=count
    count=0

print(2**max)

Submission status: Accepted

Solution code:
N = int(input())

def f(n):
    count=0
    repeat=True
    while n%2==0:
        n=n//2
        count+=1
    return count
       
max=0
number=1
for i in range(2,N+1):
    if f(i)>max:
        max=f(i)
        number=i
        

print(number)

Submission status: Accepted

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

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

print(n)

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())
l = [i for i in range(1, n+1)]
tmp = [2**i for i in range(8)]

for i in range(len(tmp)):
    if tmp[i] not in l:
        print(tmp[i-1])
        exit()

Submission status: Accepted

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