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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
i = {1,2,4,8,16,32,64,128}
k = int(input())
 
for p in range(len(i)):
  if k == 1:
    print(1)
    break
  elif k < i[p]:
    print(i[p-1])
    break

Submission status: Runtime Error

Solution code:
i = {1,2,4,8,16,32,64,128}
k = int(input())
 
for p in range(len(i)):
  if k == 1:
    print(1)
  elif k < i[p]:
    print(i[p-1])
    break

Submission status: Runtime Error

Solution code:
i = {1,2,4,8,16,32,64,128}
k = int(input())

for p in range(len(i)):
  if k <= i[p]:
    print(i[p])
    break

Submission status: Runtime Error

Solution code:
n = int(input())
list = {1,2,4,8,16,32,64}

for i in range(7):
    if n <= list[i]:
        print(list[i-1])
        break

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

n = int(input())

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

res = 0
for a in range(1, n + 1):
    res = max(res, cnt(a))
print(res)

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
n = int(input())

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

print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

num=2


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

Submission status: Runtime Error

Solution code:
N = int(input())

num=1


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

Submission status: Runtime Error

Solution code:
x=input("")
k=0
while(pow(2,k)<=x):
  k+=1
print(k)

Submission status: Runtime Error

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]
 
print(arr[max_index])

Submission status: Runtime Error

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]
 
print(arr[max_index])

Submission status: Runtime Error

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
 
max = 0
for k in range(N):
    if nums[k] > max:
        max_index = k
 
print(arr[max_index])

Submission status: Runtime Error

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
 
max_index = 0
for k in range(N):
    if nums[k] > max:
        max_index = k
 
print(arr[max_index])

Submission status: Runtime Error

Solution code:
#!/usr/bin
# -*- coding="utf-8" -*-
 
n = raw_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: Runtime Error

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

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: Runtime Error

Solution code:
N=int(input())
count=0
C=[]
for i in range(N):
 if(i!=0):
  a=int(i/2)
  if(i%2==0):
    count +=1
    while(a%2!=1):
     count +=1
     a=int(a/2)
  else:
     count =0
  C.append(count)
b=max(C)
for i inrange(N):
 C[i]==b
 print(i)

Submission status: Runtime Error

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: Runtime Error

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<=64:
    print(32)
elif 64<=N<=100:
    print(64)

Submission status: Runtime Error

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<=64:
    print(32)
else 64<=N<=100:
    print(64)

Submission status: Runtime Error

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 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: Runtime Error

Solution code:


def power2(n):
    i=1
    while n>0:
        i*=2
        n-=1
    return i

i=0
n=input()
while power2(i)<=n:
    i=i+1
    
print(power2(i-1))

Submission status: Runtime Error

Solution code:
use = int(input())

if n != 1:
    best_number = 0
    maximum = 0
    t = 0

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

        if t > maximum:
            maximum = t
            best_number = i
        t = 0
        
    print(best_number)
else: print(1)

Submission status: Runtime Error

Solution code:
div = int(input())
max_div = [0,0]
for i in range(div):
    count = 0
    out = True
    while(out):
        if i %2 == 0:
            i = i/2
            count += 1
        else:
            out == False
        max_div = [i ,max(max_div, count)]
print(max_div[0])

Submission status: Runtime Error

Solution code:
a=[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: Runtime Error

Solution code:
div = int(input())
max_div = [0,0]
for i in range(div):
    count = 0
    out = FALSE
    while(out):
        if i %2 == 0:
            i = i/2
            count += 1
        else:
            out == TRUE
        max_div = [i ,max(max_div, count)]
print(max_div[0])

Submission status: Runtime Error

Solution code:
div = int(input())
max_div = [0,0]
for i in range(div):
    count = 0
    out = FALSE
    while(out):
        if i %2 == 0:
            i = i/2
            count++
            max_div = [i ,max(max_div, count)]
        else out == TRUE:
            pass
print(max_div[0])

Submission status: Runtime Error

Solution code:
div = int(input())
max_div = [0,0]
for i in range(div):
    count = 0
    out = FALSE
    while(out):
        if i %2 == 0:
            i = i/2
            count ++
        else out == TRUE:
        max_div = [i ,max(max_div, count)]
print(max_div[0])

Submission status: Runtime Error

Solution code:
n = int(input())
 
for i in range(1,8):
    if 2 ** i >= n:
        pass
    else:
        s = 2 ** i
 
print(s)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

for i in range(1,8):
    if 2 ** i >= N:
        break
    else:
        s = 2 ** i

print(s)