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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

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())
x=1
while(x<=N):
  x*=2
if(x>N):
  x/=2
print(int(x))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

i=1
while(1):
    if 2**i>N:
        break
    i+=1

print(2**(i-1))

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

Submission status: Accepted

Solution code:
n = int(input())

hint = [1, 2, 4, 8, 16, 32, 64, 128]

def foo(n):
    last = 0
    for b in hint:
        if n < b:
            return last
        else:
            last = b
    return last


print(foo(n))

Submission status: Accepted

Solution code:
n = int(input())
c = []
cnt = 0

for i in range(1, n+1):
   while i%2 == 0:
      #print("i=", i)
      i = i/2
      cnt += 1
   c.append(cnt)
   cnt = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())

def cnt(a):
    if a == 1:
        return 0
    return 1 + cnt(a//2)

res, maxcount = 0, -1
for a in range(1, n + 1):
    if maxcount < cnt(a):
        maxcount, res = cnt(a), a
print(res)

Submission status: Accepted

Solution code:
li=[2,4,8,16,32,64,128]
n=int(input())
if n<2:
    print(n)
    quit()
for i in li:
    if n<i:
        print(i//2)
        quit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
i=0
array=[]
while 2**i<=n:
    array.append(2**i)
    i+=1
print(max(array))

Submission status: Accepted

Solution code:
n = int(input())

ct = 0
while n//2 != 0:
    n = n//2
    ct += 1

print(2**ct)

Submission status: Accepted

Solution code:
n = int(input())
a = []

for i in range(1, n+1):
    if i % 2 == 0:
        a.append(a[i//2-1] + 1)
    else:
        a.append(1)

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

Submission status: Accepted

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

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

maxnum = 2

for i in range(8):
    if maxnum > n:
        print(int(maxnum/2))
        break
    maxnum*=2

Submission status: Accepted

Solution code:
n = int(input())

def find(n):
  result = []
  for i in range(1, n+1):
    count = 0
    while i // 2 >= 1:
      if i % 2 == 0:
        count += 1
      
      i = i // 2
    
    result.append(count)
  return result.index(max(result)) + 1

print(find(n))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    N = int(input())
    if N <= 1:
        print (1)
        exit()

    res_cnt = 0
    res = 0
    for x in range(N + 1):
        cnt = 0
        y = x
        while (y > 1):
            if y % 2 == 0:
                y //= 2
                cnt += 1
            else:
                break
        if cnt > res_cnt:
            res_cnt = cnt
            res = x
    print (res)

Submission status: Accepted

Solution code:
import sys

N = int(input())
l = list(range(1,7))
k = l[::-1]

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

for i in k:
    if N >= (2**i):
        print(2**i)
        sys.exit()

Submission status: Accepted

Solution code:
N = input()

cnt=0

for i in range(N):
    if N!=1:
        N=N/2
        cnt+=1
    else:
        break
print 2**cnt

Submission status: Accepted

Solution code:
n = int(input())
top = n
top_count = 0
for i in range(n,0,-1):
    current = i
    count = 0
    while current % 2 == 0:
        current = current / 2
        count = count + 1
    if (count >= top_count):
        top_count = count
        top = i
    #print(i, count)

print(top)

Submission status: Accepted

Solution code:
n = int(raw_input())
t = [1, 2, 4, 8, 16, 32, 64, 128]
i = 0
while t[i] <= n:
    i += 1
print t[i-1]

Submission status: Accepted

Solution code:
array = [2,4,8,16,32,64]

num = int(input())
while num not in array:
    if num == 1:
        break
    else:
        num -= 1
print(num)

Submission status: Accepted

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

import math

N=int(input())

print(2**int(math.log(N, 2)))

Submission status: Accepted

Solution code:
N = int(input())
maxv = 0
ans = 1
for i in range(N, 0, -1):
    if i % 2:
        continue
    tmp = 0
    tmpv = i
    while i % 2 == 0:
        tmp += 1
        i = i // 2
    if tmp > maxv:
        maxv = tmp
        ans = tmpv
print(ans)

Submission status: Accepted

Solution code:
n = input()
def get(n):
	cnt = 0
	while True:
		if not n % 2:
			n /= 2
			cnt += 1
		else:
			break
	return cnt
d = {}
for x in xrange(1, n + 1):
	d[x] = get(x)
max_v = sorted(d.values())[-1]
d = {v: k for k, v in d.iteritems()}
print d[max_v]

Submission status: Accepted

Solution code:
N = input()

saidai = 0

for i in range(1,int(N)+1):
    count = 0
    flag = 0
    x = i
    
    while flag == 0:
        y = int(int(x) % 2)
        if y == 0:
            count = int(int(count) + 1)
            x = int(int(x) / 2)
        elif y == 1:
            flag = 1

    if int(count) >= int(saidai):
        saidai = count
        z = i

print(z)

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(raw_input())
ans = 64
while ans > N: ans /= 2
print ans

Submission status: Accepted

Solution code:
def solve():
    N = int(input())

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

    print(min(ans // 2, N))


solve()

Submission status: Accepted

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

print(ret)

Submission status: Accepted

Solution code:
N = int(input())
l = [2**n for n in range(10) if 2**n <= N]
print(max(l))

Submission status: Accepted

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

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

    if cnt > ans[1]:
        ans[0] = i
        ans[1] = cnt

print(ans[0])

Submission status: Accepted

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

if n==1:
    print(1)
else:
    m=math.log2(n)
    ans=math.pow(2,math.floor(m))
    print(int(ans))

Submission status: Accepted

Solution code:
n = int(input())

x = 1
while(x*2 <= n):
    x *= 2

print(x)

Submission status: Accepted

Solution code:
n = int(input())

x, a = 1, None
for i in range(8):
    if x <= n:
        a = x
        x *= 2
    else:
        break

print(a)

Submission status: Accepted

Solution code:
n = int(input())

breakNum = 1

while breakNum*2 <= n:
	breakNum *= 2

print(breakNum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://abc068.contest.atcoder.jp/tasks/abc068_b
"""
from math import log

def solve(N):
    # N以下の2^n乗を求める
    flp2 = 2 ** int(log(N, 2))
    return flp2


def main():
    N = int(input())
    result = solve(N)
    print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


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


def main():
    N = int(input())
    ans, num = 0, 0
    for i in range(1, N + 1):
        if count(i) >= num:
            num = count(i)
            ans = i

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math as m
s=int(input())
print(2**int(m.log2(s)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
x=[]
for i in range(200):
    x.append(0)
for i in range(200):
    ori=i
    while ori!=0:
        if ori%2==0:
            ori=ori/2
            x[i]+=1
        else:
            break
maxi=1
maxv=0
for i in range(200):
    if maxv<x[i] and i<N+1:
        maxv=x[i]
        maxi=i
print(maxi)

Submission status: Accepted

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

Submission status: Accepted

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

while n > 1:
    n //= 2
    c += 1

print(2**c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[2**x for x in range(7)]
a=a[::-1]
for x in a:
    if n>=x:
        ans=x
        break
print(ans)

Submission status: Accepted

Solution code:
a=int(input())
b=int(2)
c=int
if 1==a:
    print(a)
else:
    while b<100:
        c=b
        b=b*2
        
        if(a<b)and(a>=c):
            print (c)

Submission status: Accepted

Solution code:
x = input()
x = int(x)
y = 1
while x>=y:
    y = y*2
else:
    print(int(y/2))

Submission status: Accepted

Solution code:
N = int(input())

ans = 64
while N < ans:
    ans //= 2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
def main():
    tmp, ans = 2, 1
    for i in range(2, int(input())+1):
        if i % tmp == 0:
            ans = i
            tmp *= 2
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

i = 1

while i <= N:
    i *= 2

print i / 2

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(N):
    n_div_max = 0
    answer = 1
    for n in range(1, N + 1):
        _n = n
        tmp_n_div = 0
        while True:
            _n, m = divmod(_n, 2)
            if m > 0:
                break
            tmp_n_div += 1

        if tmp_n_div >= n_div_max:
            n_div_max = tmp_n_div
            answer = max(answer, n)

    print(answer)


def main2(N):
    # 128 = 2 ** 7
    for i in reversed(range(7)):
        n = 2 ** i
        if N >= n:
            print(n)
            return

if __name__ == '__main__':
    N = int(input())
    main2(N)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(10):
    if N > 2**i:
        continue
    elif N < 2**i:
        break

print(2**(i-1))

Submission status: Accepted

Solution code:
n = int(input())
nums = [2**x for x in range(10)]
while True:
	if n in nums:
		print(n)
		break
	else:
		n -= 1

Submission status: Accepted

Solution code:
n=int(input())
max=-1
ans=1
for i in range(1,n+1):
	temp=i
	kount=0
	while temp%2==0:
		temp/=2
		kount+=1
	if kount>max:
		max=kount
		ans=i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
max=-1
ans=1
for i in range(1,n+1):
	temp=i
	kount=0
	while temp%2==0 :
		temp/=2
		kount+=1
	if kount>max:
		max=kount
		ans=i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
lst = [1, 2, 4, 8, 16, 32, 64]
lst.append(n)
lst.sort()
lst.reverse()
num = lst.index(n) + 1
print(lst[num])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

li = [2**i for i in range(7)]

for i, x in enumerate(li, 1):
    if N >= li[len(li)-i]:
        print(li[len(li)-i])
        break
    else:
        continue

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
inp = int(input())
count = 0
serch = 1


for i in range(1,inp + 1):
	a = i
	j = 1
	while j <= i:
		if a % 2 != 0:
			if j - 1 > count:
				count = j - 1
				serch = i
			break
		a = a / 2
		j += 1


print(serch)

Submission status: Accepted

Solution code:
N = int(input())

tmp = 1
while(1):
    if tmp*2 > N:
        break
    else:
        tmp *= 2
        
print(tmp)

Submission status: Accepted

Solution code:
a = 100
l = [0]*a
t = 1
for x in xrange(a):
	while t%2 == 0:
		t = t/2
		l[x] += 1
	t = x+2
a = int(raw_input())
ma = 0
mi = 1
for x in range(a):
	if l[x] > ma:
		ma = l[x]
		mi = x
if a == 1:
	print(1)
else:
	print(mi+1)

Submission status: Accepted

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

import math

def check(n, i):
    if (2 ** i > n):
        return 2 ** (i-1)
    else:
        return check(n, i+1)

n = int(input())
print(check(n, 0))

Submission status: Accepted

Solution code:
N = int(raw_input())

S = range(N)
for i in S:
    S[i] = i + 1

res = []

for i in S:
    num = i
    count = 0

    while i%2 == 0:

        i = i/2
        count += 1

    res.append((count,num))


res.sort()

Anser = res[-1][1]

print Anser

Submission status: Accepted

Solution code:
x=int(input(""))
k=0
while True:
  if pow(2,k)>x:
    break
  k+=1
print(pow(2,k-1))

Submission status: Accepted

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

num = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(2**(len(str(bin(int(input())))[2:])-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().strip())
while True:
 if n & (n-1) == 0:
  print(n)
  break
 n -= 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input())
for i in range(7, -1, -1):
    a = 2**i
    if n >= a:
        print(a)
        exit()

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
N = int(input())
a = [tmp for tmp in reversed(range(1,N+1)) if tmp%2 == 0]
ans = 0
for tmp in range(7):
    if N == 1:
        ans = 1
        break
    b = [tmp2//2 for tmp2 in a if tmp2%2 == 0]
    if len(b) != 0:
        ans += 1
    else:
        ans = (2**ans)*a.pop()
        break
    a = [tmp2 for tmp2 in b]
print(ans)

Submission status: Accepted

Solution code:
input_number = int(input())                                                                 
count = 0 
buff_rank = []

for i in range(1,input_number+1):
    num = i 
    while num % 2 == 0:
        num = num // 2
        count = count + 1 
    buff_rank.append(count)
    count = 0 

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

Submission status: Accepted

Solution code:
#!usr/bim/python
#! -*- coding: utf-8 -*-

num = raw_input()
num = int(num)

i = 0
while 1:
    if 2**i <= num:
        i += 1
    else:
        break

ans = 2**(i - 1)

print ans

Submission status: Accepted

Solution code:
s = int(input())
ans = 0

while(s > 1):
    s = s//2
    ans += 1
    if s <= 1:
        break

print(2**ans)

Submission status: Accepted

Solution code:
import math
t=int(input())
x=0
i=0
while x<=t:
  x=math.pow(2,i)
  i+=1
print(int(pow(2,i-2)))

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !
n = int(input())
i = 1
while i <8:
    if n < 2**i:
        print (2**(i-1))
        break
    else:
        i += 1

Submission status: Accepted

Solution code:
N = int(input())

k = [2 ** i for i in range(1, 8)]

M = 1

for i in k:
    if i <= N:
        M = i

print(M)

Submission status: Accepted

Solution code:
N = int(input())
arr = [i for i in range(1, N + 1)]
# N == len(arr)
nums = N*[0]
for j in range(N):
    target = arr[j]
    num = 0
    while target % 2 == 0:
        num += 1
        target /= 2
    nums[j] = num

# print(nums)

max = 0
for k in range(N):
    if nums[k] > max:
        max_index = k
        max = nums[k]
    elif N == 1:
        max_index=0
 
print(arr[max_index])

Submission status: Accepted

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

import sys

n = int(sys.stdin.readline())

x = 2
while x <= n:
	x *= 2

if n < 2:
	print (str(n))
else:
	print (str(int(x/2)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())

count=1

while count <= s:
    count = count * 2

count = count / 2

print(int(count))

Submission status: Accepted

Solution code:
#!/usr/bin
# -*- coding="utf-8" -*-
 
n = int(input())
if n >= 64:
  a = 64
elif n >= 32:
  a = 32
elif n >= 16:
  a = 16
elif n >= 8:
  a= 8
elif n >= 4:
  a = 4
elif n >= 2:
  a = 2
else:
  a = 1
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b=1
while (b<<1)<=a:
    b=b<<1
print(b)

Submission status: Accepted

Solution code:
N = int(input())

result = 0
while N / 2 >= 1.0:
    N /= 2
    result += 1
print(2**result)

Submission status: Accepted

Solution code:
N=int(input())
N|=N>>1
N|=N>>2
N|=N>>4
N|=N>>8
print((N+1)>>1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(raw_input())
data = [1, 2, 4, 8, 16, 32, 64]
print max([d for d in data if d <= N])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

base = 2
mul = 0
while True:
    mul += 1
    if base ** mul > N:
        break

print(base ** (mul - 1))

Submission status: Accepted

Solution code:
a = int(input())
temp = [0]*(a+1)
for i in range(a,0,-1):
    b = i
    while b%2 ==0:
        temp[i] += 1
        b = b//2
if temp.index(max(temp))==0:
    print(1)
else:print(temp.index(max(temp)))

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
gosa = 1.0 / 10**9
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    N = I()
    r = 0
    while N>=2:
        N //= 2
        r += 1

    return 2**r



print(main())

Submission status: Accepted

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

n = int(raw_input())
max = 0
nmb = 1

for i in range(1, n+1):
	tmp = countdiv(i)
	if tmp > max:
		max = tmp
		nmb = i

print nmb

Submission status: Accepted

Solution code:
from sys import stdin
ma = -1
ans = -1
n = int(stdin.readline())
for i in xrange(1,n+1):
 x = i
 cn = 0
 while x%2==0:
  x/=2;cn+=1
 if cn > ma:
  ma = cn;ans = i
print ans

Submission status: Accepted

Solution code:
N = int(input())


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

Submission status: Accepted

Solution code:
N = int(input())
score = 0
ans = 0
if N == 1:
    print(1)
else:
    for i in range(N,0,-1):
        s = i
        c=0
        while (i % 2 == 0) :
            i /= 2
            c += 1
        if score < c:
            score = c
            ans = s
        #カウントが更新されたらスコア配列に格納
    print(ans)

Submission status: Accepted

Solution code:
#ABC068B

n=int(raw_input())
m=1
for i in xrange(7):
 x=2**m
 if n>=x:
  m+=1
print 2**(m-1)

Submission status: Accepted

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

print(2**(ans-1))

Submission status: Accepted

Solution code:
N = int(raw_input())

ans = -1
mc = -1
for i in range(1, N+1):
    x = i
    c = 0
    while x % 2 == 0:
        x /= 2
        c += 1
    if c > mc:
        ans = i
        mc = c
print ans

Submission status: Accepted

Solution code:
# cook your dish here
from math import * 
n=int(input())
print(2**floor(log2(n) ))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

C=0
L=[]

if N==1:
    print(1)

else:
    for i in range(8):
        C=2**i
        L.append(C)
        if C>N:
            print(L[-2]) 
            break

Submission status: Accepted

Solution code:
n=int(input())
t=[2,4,8,16,32,64]
c=0
if n==0:print("0")
elif n==1:print("1")
elif n>=64:print("64")
else:
    for i in t:
        if n < i:
            print(t[c-1])
            break
        c=c+1

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
import logging
logging.basicConfig(level=logging.CRITICAL,format=' %(asctime)s - %(levelname)s - %(message)s')

def power(n):
    i = 1
    logging.info('func start')
    while n > 0:
        i *= 2
        n -= 1
        logging.debug('i = {}, n = {}'.format(i,n))
    logging.info('func end')
    return i

i = 0
n = int(input())
logging.info('in loop')
while not (power(i + 1) > n):
    i = i + 1
    logging.debug('i = {}, pow(i) = {}'.format(i,power(i)))

logging.info('out loop')
print(power(i ))

Submission status: Accepted

Solution code:
N = int(input())

A = [64,32,16,8,4,2]
if N<2:
    print(1)
else:
    for i in A:
        if N >= i:
            break
    print(i)

Submission status: Accepted

Solution code:
import sys
import math


def main():
    args = sys.stdin.readline().split()
    N = int(args[0])

    X = 0
    while True:
        X += 1
        temp = math.pow(2, X)
        if temp > N:
            temp = math.pow(2, X-1)
            break

    print(int(temp))

main()

Submission status: Accepted

Solution code:

def b():
    n = int(input())
    two_l = [ 2**x for x in range(7) ]
    res = 1
    for i in two_l:
        if i <= n:
            res = i
        else:
            break
    print(res)

b()

Submission status: Accepted

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

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:
m = int(input())
a = 1
for c in range(7):
  if (2 ** c) > m:
    break
  a = (2 ** c)

print(a)

Submission status: Accepted

Solution code:
n=int(input())

ans=1
while True:
    if n>ans: ans*=2
    elif n==ans: break
    else: ans/=2; break

print(int(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:
import math
import numpy as np
print(int(2**math.floor(np.log2(int(raw_input())))))

Submission status: Accepted

Solution code:
a = input()
if int(a) < int(2):
    print(a)
elif int(a) > int(1) and int(a) < int(4):
    print(2)

elif int(a) > int(3) and int(a) < int(8):
    print(4)

elif int(a) > int(7) and int(a) < int(16):
    print(8)

elif int(a) > int(15) and int(a) < int(32):
    print(16)

elif int(a) > int(31) and int(a) < int(64):
    print(32)

elif int(a) > int(63):
    print(64)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

sig = [2,4,8,16,32,64,128]
sig.reverse()

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

for i in sig:
    if i <= N:
        print(i)
        exit()

Submission status: Accepted

Solution code:
a = int(input())
for i in range(a):
  if 2 ** i > a:
    break
  elif 2 ** i <= a:
    count = 2 ** i

print(count)

Submission status: Accepted

Solution code:
# coding: utf-8

n = input()
m = 0
rank = 1
for i in range(1, n+1):
    j = i
    c = 0
    while True:
        if j % 2 == 0:
            j /= 2
            c += 1

        else:
            if m < c:
                m = c
                rank = i
            break

print rank

Submission status: Accepted

Solution code:
a=[0,1,2,2,4,4,4,4,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64]
print(a[(int(input()))])

Submission status: Accepted

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

for i in range(s):
    t = 64 >> i
    if (0 != (N & int(t))):
        print(t)
        break