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: Wrong Answer

Solution code:
# coding: utf-8

N = int(input())

ma = -1
res = 2
for i in range(2, N+1):
    num = i
    tmp = num
    count = 0
    while num % 2 == 0:
        count += 1
        num = num / 2

    if count > ma:
        res = tmp
        ma = count

print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 1:
    print("0")
else:
    l = [2**x for x in list(range(1, 8))]
    a = [ x for x in l if x <= N]
    print(max(a))

Submission status: Wrong Answer

Solution code:
a=[2,4,8,16,32,64,128]
n=int(input())
i=0
while a[i]<=n:
    i+=1
print(a[i-1] if i>0 else 0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=int(input())
b=1
while a > b:
    b = b * 2
print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())
cnt = 0
while a:
 cnt += 1
 a >>= 1
print(cnt - 1)

Submission status: Wrong Answer

Solution code:
N = int(input())
i = 0
while N % 2 == 0:
    i += 1
    N = N // 2
print(i)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
x = 0
a = []
for i in range(N):
    while i % 2 == 0:
        i //= 2
        x += 1
    a.append(x)
    x = 0
a = sorted(a)
a = a[::-1]
print(a[0])

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=2
while True:
  if a<=n:
    a*=2

print(a/2)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 1

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
num = int(input())

count_max = 0
for i in range(num):
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if conut > count_max:
    count_max = count

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 0
result = 0
if n == 1:
  print(1)
else:
  for i in range(0, n+1, 2):
    counta = 0
    num = i
    while (num % 2 == 0):
      num = num/2
      counta += 1
    if counta > count:
      count = counta
      result = i
  print(result)

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
number = int(input())
answer = 0
for i in range(number):
  print(i)
  target=0
  while i%2==0:
    target+=1
    answer=max(target,answer)
print(answer)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def breaknumbeer(n):

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

    return ans

def main():
    n = int(input())
    print(breaknumbeer(n))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
suuji = int(input())
cntmax = 0
dst = 1
for i in range(suuji):
    suu = i
    cnt = 0
    while suu % 2 == 0:
        suu /= 2
        cnt += 1
    if cntmax < cnt:
        cntmax = cnt
        dst = i
print(dst)

Submission status: Time Limit Exceeded

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

N = int(input())

b = 0

for i in range(N):
    if(divisible(i) > b):
      b = divisible(i)
      ans = i
    
print(max(ans))

Submission status: Time Limit Exceeded

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

N = int(input())

a = []

for i in range(N):
    a.append(divisible(i))
    
print(max(a))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def examB():
    N = I()
    ansC = [(i+1) for i in range(N)]
    k = 0
    while(True):
        cur = []
        for i in ansC:
            if i % 2 == 0:
                cur.append(i // 2)
        ansC = cur
        k +=1
        if len(ansC)==1:
            break
    ans = 2**k
    print(ans)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 1
max_count = 0
n = 2
while (n <= N):
  k = n
  count = 0
  while k%2 == 0:
    k /= 2
    count += 1
  if count > max_count:
    ans = n
    max_count = count
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
list = []
for i in range(n):
  counter = 0
  while i%2 == 0:
    counter += 1
    i = i / 2
  else :
    break
  list.append(counter)
answer = list.index(max(list)) + 1
print(answer)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
counter =-1 
number = 0
for i in range(N):
    k = i
    now_counter = 0
    while(k % 2 == 0):
        now_counter += 1
        k /= 2
    if(now_counter > counter):
        number = i
print(number)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
 
n_max = 1
cnt_max = 0
for i in range(1, n + 1):
  cnt = 0
  a = i
  while(a % 2 == 0):
    a %= 2
    cnt += 1
  if cnt > cnt_max:
    cnt_max = cnt
    n_max = i
 
print(n_max)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
while True:
  for i in range(1,7):
    b = 2^(7-i)
    c = N%b
    if c ==0:
      break
    else:
      continue
    break
print(b)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# 入力
N=int(input())

# 最大回数
c=0

for x in range(1,N+1):
  _c=0
  while True:
    if x%2==0:
      x//=2
      _c+=1
    else:
      c=max(c,_c)

# 出力
print(c)

Submission status: Time Limit Exceeded

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

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

counter.sort()
counter.reverse()

print(counter[0][1])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0

while N != 1:
    count += 1
    N = N/2

print(2**count)

Submission status: Time Limit Exceeded

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

print(2^(result))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
L = [1,2,4,8,16,32,64]
while N > 1:
  if N in L:
    print(N)
  else:
    N = N - 1
print(1)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
L = [1,2,4,8,16,32,64]
while N > 1:
  if N in L:
    print(N)
  else:
    N = N - 1
print(1)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
counter = 0
s=0
if n%2 ==1:
    n = n-1
    
while n != 1:
    n=int(n/2)
    counter += 1
    
print(2**counter)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
m_count = 0
num = 0
m_num = 1

for i in range(2, N+1,2):
	num = i
	
	while True:
		if num% 2 == 0:
			count = count + 1
			num = num % 2
		else:
			break
	
	if m_count < count:
		m_count = count
		m_num = i
	
	count = 0

print (m_num)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
m_count = 0
num = 0
m_num = 1

for i in range(1, N+1):
	num = i
	
	while True:
		if num% 2 == 0:
			count = count + 1
			num = num % 2
		else:
			break
	
	if m_count < count:
		m_count = count
		m_num = i
	
	count = 0

print (m_num)

Submission status: Accepted

Solution code:
N = int(input())
ans = []
for i in range(N):
    q = i+1
    count = 0
    if q == 1:
        continue
    while True:
        if q%2 != 0:
            break
        q = q//2
        count += 1
    ans.append(count)

if len(ans) > 0:
    max_count = max(ans)
    print(ans.index(max_count)+2)
else:
    print(1)

Submission status: Accepted

Solution code:
n = int(input())
num = [i for i in range(1,n+1)]
jou = [2**j for j in range(0,7)]
for l in jou:
    if l in num:
        ans = l
    else:
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
li = [2,4,8,16,32,64]
import bisect
index = bisect.bisect(li,n)-1
import sys
if index == -1:
    print(n)
    sys.exit()
print(li[index])

Submission status: Accepted

Solution code:
N = int(input())

def black_magic(n):
    d = {
        1: 1431655765,
        2: 858993459,
        4: 252645135,
        8: 16711935,
        16: 65535
    }
    n=(n&d[1])+((n>>1)&d[1])
    n=(n&d[2])+((n>>2)&d[2])
    n=(n&d[4])+((n>>4)&d[4])
    n=(n&d[8])+((n>>8)&d[8])
    n=(n&d[16])+((n>>16)&d[16])
    return n

while black_magic(N) - 1:
    N &= N-1
print(N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = [i for i in range(1,n+1)]
counter = 0
while(True):
    if len(s)==1:
        print(1)
        break
    if len([i for i in s if i % 2 == 0])==1:
        s = [i for i in s if i % 2 == 0]
        print(int(s[0]) * (2 ** counter))
        break
    else:
        s = [i/2 for i in s]
        counter += 1

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
lis=[0]*(N+1)
Mcnt=0
Mi=1

for i in range(1,N+1):
  lis[i]=i
  cnt=0
  while lis[i]%2==0:
    lis[i]//=2
    cnt+=1
    
  if Mcnt<cnt:
    Mcnt=cnt
    Mi=i
    
print(Mi)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math


def answer(n: int) -> int:
    return 2 ** int(math.log(n, 2))


def main():
    n = int(input())
    print(answer(n))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(int(ans/2))

Submission status: Accepted

Solution code:
import bisect
n = int(input())
t = [1, 2, 4, 8, 16, 32, 64]

print(t[bisect.bisect_right(t, n)-1])

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

cnt = 0
while n > 0:
  n = n // 2
  if n != 0:
    cnt += 1
print(2 ** cnt)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
result = 0
num = 1
for i in range(7):
  if N >= num:
    result = num
  else:
    None
  num *= 2
print(result)

Submission status: Accepted

Solution code:
N = int(input())
result = 0
for i in range(7):
  if N >= 2**i:
    result = 2**i
  else:
    None
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 1
prev = 0
for i in range(1, N + 1):
    count = 0
    tmp = i
    while i % 2 == 0 and 1 < i:
        count += 1
        i /= 2
    if prev < count:
        prev = count
        ans = tmp

print(ans)

Submission status: Accepted

Solution code:
# B - Break Number
def main():
    n = int(input())

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

if __name__ ==  "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
two=[2**i for i in range(7)]
ans=max([x for i,x in enumerate(two) if x<=N])
print(ans)

Submission status: Accepted

Solution code:
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n = I()

no = 2

while no < n:
    no *= 2
if no > n:
    no = int(no/2)

print(no)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
num = 1

while N >= num:
    count += 1
    num *= 2

print(num // 2)

Submission status: Accepted

Solution code:
N = int(input())
for i in range(100):
    x = 2 ** (100 - i)
    if x <= 64 and x <= N:
        ans = x
        break
    else:
        ans = N
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
result=64
while N>=1:
  if N >= result:
    print(result)
    break
  result=int(result/2)
else:
  print(result)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
n = I()
lis = [2**i for i in range(10)]
idx = bisect.bisect_right(lis, n)
print(lis[idx-1])

Submission status: Accepted

Solution code:
import math

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

print(ans//2)

Submission status: Accepted

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


ans = 0
max_cnt = -1
for i in range(1, int(input()) + 1):
    cdt = cnt_div_two(i)
    if cdt > max_cnt:
        ans = i
        max_cnt = cdt
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
ansc = 0
def dc(m):
  cnt = 0
  x = m
  while (True):
    if x%2 == 0:
      cnt += 1
      x = x//2
    else:
      break
  return cnt
for i in range(1,n+1):
  c = dc(i)
  if c > ansc:
    ans = i
    ansc = c
if n == 1:
  print(1)
else:
  print(ans)

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())
ans, cnt = 1, 0
for i in range(1, n+1):
    j = i
    t_cnt = 0
    if i%2 == 0:
        # print(i)
        while i%2 == 0:
            i = i//2
            t_cnt += 1
            # print(i, t_cnt)
        if t_cnt >= cnt:
            ans = j
            cnt = t_cnt

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
c = 0
ans = 1
for i in range(1, N + 1):
    n = i
    for t in range(N + 1):
        if n % 2 != 0:
            if c < t:
                c = t
                ans = i
            break
        n //= 2
print(ans)

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(250000)

def main():
    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(n)
main()



#
# while True:
#     pair_str = input().split()
#     pair_int = [int(s) for s in pair_str]
#     if pair_int[0] == 0 and pair_int[1] == 0 :
#         break
#     else:
#         input_list.append(pair_int)


# if b > c * 2 :
    #     b_price = c
    #
    # input_array_list = []
    #
    # while True:
    #     input_array = input().split()
    #     if input_array[0] == "0" and input_array[1] == "0":
    #         break
    #     else:
    #         input_array_list.append(input_array)
    #
    # for item in input_array_list:
    #     n = int(item[0])
    #     k_sum = int(item[1])
    #
    #     count = 0
    #     for i in range(1,n + 1- 2):
    #         for j in range(i+1, n + 1 - 1):
    #             for k in range (j+1, n+ 1):
    #                 if i + j + k == k_sum :
    #                     count = count + 1
    #     print(count)

    #
    # for item in input_array_list:
    #     if item[1] == "+":
    #         print(str(int(item[0])+int(item[2])))
    #     elif item[1] =="-":
    #         print(str(int(item[0])-int(item[2])))
    #     elif item[1] == "/":
    #         print(str(int(item[0])//int(item[2])))
    #     elif item[1] == "*":
    #         print(str(int(item[0])*int(item[2])))
    #

# import sympy as sp

# input_list = []
# a,b,c = map(int, input().split())
# divisors = sp.divisors(c)
#
# count = 0
#
# for divisor in divisors:
#     if a <= divisor and divisor <= b:
#         count = count + 1
# print(count)
#
# while True:
#     pair_str = input().split()
#     pair_int = [int(s) for s in pair_str]
#     if pair_int[0] == 0 and pair_int[1] == 0 :
#         break
#     else:
#         input_list.append(pair_int)
#
# for pair_int in input_list:
#     if pair_int[0] <= pair_int[1]:
#         print("{} {}".format(pair_int[0], pair_int[1]))
#     else:
#         print("{} {}".format(pair_int[1], pair_int[0]))

#for i in range(10000):
#    print("Hello World")
#a = input().split()
#a_int = [int(s) for s in a]
#a_sorted = sorted(a_int)
#print(' '.join(map(str, a_sorted)))

Submission status: Accepted

Solution code:
#!/usr/local/bin/python3
# https://atcoder.jp/contests/abc068/tasks/abc068_b
import math

def fact(N):
    ans = {}
    for i in range(2, math.ceil(math.sqrt(N))+1):
        if N % i != 0:
            continue
        ex = 0

        while N % i == 0:
            ex += 1
            N /= i
        ans[i] = ex

    if N != 1:
        ans[int(N)] = 1
    return ans

N = int(input())
max_x = 0
max_n = 0

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

for i in range(N+1):
    num = fact(i)
    num = num.get(2, 0)
    if num > max_n:
        max_x = i
        max_n = num

print(max_x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
print(max(2 ** i if 2 ** i <= N else 0 for i in range(10)))

Submission status: Accepted

Solution code:
n = int(input())

i = 1
while i < n:
    i = i * 2

if i > n:
    print(int(i / 2))
else:
    print(i)

Submission status: Accepted

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


def solve(N: int):
    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)
    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

N = int(input())

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

if i <= N:
  print(i)
else:
  print(math.floor(i/2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count_max = -1
OK = True

for i in range(N):
    count = 0
    a = N - i
    while a % 2 == 0:
        a = a // 2
        count += 1
        if count_max < count:
            count_max = count
    else:
        continue
if 2 ** count_max == 0.5:
    print(1)
else:
    print(2 ** count_max)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
from math import log2

N = int(input())

m = 0
a = 0

for i in range(1, N + 1):
  l = log2(i)
  if l % 1 == 0:
    m = i


print(m)

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:
num = int(input())
ans = 1
while ans <= num:
    ans = ans * 2
print(int(ans/2))

Submission status: Accepted

Solution code:
n = int(input())
x = 0
for i in range(1, n+1):
    if i%64 == 0 and 64 > x:
        ans = i
        x = 64
    elif i%32 == 0 and 32 > x:
        ans = i
        x = 32
    elif i%16 == 0 and 16 > x:
        ans = i
        x = 16
    elif i%8 == 0 and 8 > x:
        ans = i
        x = 8
    elif i%4 == 0 and 4 > x:
        ans = i
        x = 4
    elif i%2 == 0 and 2 > x:
        ans = i
        x = 2
    elif i == 1:
        ans = 1
        x = 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(7):
    if (n>>i)&1:
        ans=(n>>i)<<i
print(ans)

Submission status: Accepted

Solution code:
from itertools import count
n = int(input())
for i in count(0):
    if n < 2**(i+1):
        print(2**i)
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(n):
  res = 0
  while(n != 1):
    if n%2 == 0:
      res += 1
      n /= 2
    else:
      break
  return res

n = int(input())

ans = 1
ans_max = 0
for i in range(1, n+1):
  cnt = solve(i)
  if cnt > ans_max:
    ans_max = cnt
    ans = i
print(ans)

Submission status: Accepted

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

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

for i in range(1,n+1,1):
    tmpCnt = 0
    j = i
    while j%2 == 0:
        j = j/2
        tmpCnt += 1
    if maxCnt < tmpCnt:
        maxCnt = tmpCnt
        ans = i

print(ans)

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

cnt = 0

while 2 ** cnt <= N:
    cnt+=1

cnt-=1

print(2**cnt)

Submission status: Accepted

Solution code:
N=int(input())

X=[]


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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
res = 1
for i in range(2,N+1):
  j = i
  if j % 2 == 1:
    continue
  cnt = 0
  while j % 2 == 0:
    j //= 2
    cnt += 1
  if ans < cnt:
    res = i
    ans = cnt
  
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
counter = 0
while N >= 2:
  N //= 2
  counter +=1
ans = 2**counter
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:
N = int(input())
for i in range(7):
  if 2 ** i <= N < 2 ** (i + 1):
    print(2 ** i)
    exit()

Submission status: Accepted

Solution code:
print(1<<len(f'{int(input()):b}')-1)

Submission status: Accepted

Solution code:
print(1<<int(input()).bit_length()-1)

Submission status: Accepted

Solution code:
print(2**max((i^(i-1)).bit_length()-1 for i in range(int(input())+1)))

Submission status: Accepted

Solution code:
import sys

N = int(input())

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

ans = 0
count_max = 0
for i in range(1, N+1):
    count = (i ^ (i-1)).bit_length() - 1
    if count_max < count:
        count_max = count
        ans = i

print(ans)

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    number = int(input())
    counter=[]
    count=0

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

    for i in range(1,number+1):
        while i >= 2:
            if i % 2==0:
                i /= 2
                count+=1
            else:
                break
        counter.append(count)
        count=0
    print(counter.index(max(counter))+1)

if __name__=="__main__":
    main()