Go: package main

import "fmt"

func main() {
	var n int
	fmt.Scanln(&n)
	l, r, max := 0, 63, 0
	for l <= r {
		m := (l + r) / 2
		pow2 := 1 << uint(m)
		if pow2 <= n {
			l = m + 1
			if pow2 > max {
				max = pow2
			}
		} else {
			r = m - 1
		}
	}
	fmt.Println(max)
}

Python: N = int(input())
count = 1
while count <= N:
    count *= 2
print(round(count/2))

Python: n = int(input())
idx = 1
while True:
    h = 2 ** idx
    if h > n:
        print(2 ** (idx - 1))
        exit()
    idx += 1

Python: a = int(input())
b = 2
while True:
    b*=2
    if b == a:
        print(b)
        break
    elif b > a:
        b/=2
        b = int(b)
        print(b)
        break

Python: a = 1
n = int(input())
while True:
  if a * 2 > n:
    print(a)
    exit()
  a *= 2

Python: n = int(input())

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

print(ans // 2)

Python: def p(x):
  answer = True
  while(x > 1):
    if x % 2 == 0:
      x =  x // 2
    else:
      answer = False
      break
  return answer

N = int(input())
for i in range(N,0,-1):
  if p(i) == True:
    print(i)
    break

Python: n = int(input())
num = 2

while n > num: 
    num *= 2
    
if num > n:
    num /= 2
    


print(int(num))

Python: if __name__ == '__main__':
	
	n = int(input())

	for i in range(21):
		s = pow(2,i)
		if n < s:
			if i == 0:
				print(1)
			else:
				print(pow(2,i-1))
			break
		elif n == s:
			print(pow(2,i))
			break

Python: num=int(input())
i=0
while True:
    if 2**i==num:
      print(2**i)
      break
    elif 2**i>num:
        print(2**(i-1))
        break
    i+=1

Python: n = int(input())
count = 0
for i in range(1,n+1):
    if n < 2**(i):
        count = 2**(i-1)
        break
print(count)

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

Python: n = int(input())
s = 1
while s <= n:
    s *= 2
print(s//2)

Python: n = int(input())
ans = 1
while ans*2<=n: ans *= 2
print(ans)

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

Python: # coding: utf-8
# Your code here!
N=int(input())

if 2**1<=N<2**2:
    print(2**1)
elif 2**2<=N<2**3:
    print(2**2)
elif 2**3<=N<2**4:
    print(2**3)
elif 2**4<=N<2**5:
    print(2**4)
elif 2**5<=N<2**6:
    print(2**5)
elif 2**6<=N<2**7:
    print(2**6)
elif 2**7<=N<2**8:
    print(2**7)
elif 2**8<=N<2**9:
    print(2**8)
elif 2**9<=N<2**10:
    print(2**9)
elif 2**10<=N<2**11:
    print(2**10)
elif 2**11<=N<2**12:
    print(2**11)
elif 2**12<=N<2**13:
    print(2**12)
elif 2**13<=N<2**14:
    print(2**13)
elif 2**14<=N<2**15:
    print(2**14)
elif 2**15<=N<2**16:
    print(2**15)
elif 2**16<=N<2**17:
    print(2**16)
elif 2**17<=N<2**18:
    print(2**17)
elif 2**18<=N<2**19:
    print(2**18)
elif 2**19<=N<2**20:
    print(2**19)
else:
    print(2**20)

Python: n=int(input())
a=10**6
for i in range(a):
    if 2**i <= n and n<2**(i+1):
        print(2**i)
        break

Python: #標準入力とリストの初期化
i = int(input())
j = 2
kei = 1

#2をかけて入力値を超えたときの前の数を出力する
while True:
    if j <= i < j * 2:
        print(j)
        break
    else:j = j * 2

Python: n = int(input())
i = 1
while True :
    if n < i * 2 :
        break
    i *= 2
print(i)

Python: A = int(input())
anw = 1
while 1:
    if anw * 2 <= A: anw *= 2
    else: break
print(anw)

Python: 
N = int(input())

ans = 2

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

Python: N = int(input())
i = 0
while True:
    i += 1
    if 2 ** i > N :
        print(2 ** (i - 1))
        break

Python: N = int(input())
n = 2
while n<N:
  n = n * 2 
if n<=N:print(int(n))
else : print(int(n/2))

Python: import math

N = int(input())

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

Python: N = int(input())
for i in range(30):
    if N<(2**i):
        if N == 2**i:
            print(2**i)
            break
        else:
            print(2**(i-1))
            break

Python: N = int(input())
n = 0
while True:
	if 2**n>N:break
	n += 1
print(2**(n-1))

Python: n = int(input())
c = 0
while n > 1 :
    n = n >> 1
    c = c + 1
print( 1<<c )

Python: def getNum(n):
    num = 1
    while(2 ** num <= n):
        num += 1
    return num - 1
a = int(input())
print(2 ** getNum(a))

Python: n = int(input())
l = len(bin(n)) - 1
print(2 ** (l - int(bin(n).find("1"))))

Python: n=int(input())
a=1
while(n>2**a):
    a+=1
if(n==2**a):
    print(2**a)
else:
    print(2**(a-1))

Python: from math import log2
print(2**int(log2(int(input()))))

Python: x = int(input())
s = 1
while s <= x:
    s *= 2
print(s//2)

Python: import math
N = int(input())
A = math.log2(N)
print(2**(math.floor(A)))

Python: n=int(input())
i=0
while n>0:
	i+=1
	n//=2
print(pow(2,i-1))

Python: n = int(input())
  
b = 1

while True:
    if b*2 <= n:
        b *= 2
    else:
        break

print(b)

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

C++: #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int n;
    cin >> n;
    int res = 1;
    while(res <= n){
        res *= 2;
    }
    cout << res/2 << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

C++: #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> p2;

void init() {
    int n = 1000001;
    int i = 1;
    while (i < n) {
        i*=2;
        p2.push_back(i);
    }
}

int main() {
    init();
    int n, i;
    scanf("%d", &n);
    i = int(upper_bound(p2.begin(), p2.end(), n) - p2.begin() -1);
    printf("%d\n", p2[i]);
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	int i;
	cin >> n;
	i=1;
	while(1){
		if(n < i)	break;
		i *= 2;
	}
	cout << i/2 <<endl;
	return 0;
}

C++: /*
    ２の累乗
    https://onlinejudge.u-aizu.ac.jp/challenges/sources/PCK/Prelim/0406?year=2019
*/
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    int den = 2;
    while (den <= n) {
        den *= 2;
    }
    cout << (den / 2) << endl;

    return 0;
}

C++: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N;
	scanf("%d",&N);

	int num = 1,ans;

	for(int i = 0; i < 20; i++){

		num *= 2;
		if(num > N)break;

		ans = num;
	}

	printf("%d\n",ans);

	return 0;
}

C++: #include"bits/stdc++.h"
using namespace std;

int main(){
	int N;
	cin >> N;
	int tmp = 1;
	while(true){
		if(tmp * 2 > N){
			cout << tmp << endl;
			break;
		}
		tmp *= 2;
	}
	return 0;
}

C++: #include <iostream>

int main() {
	int in, i;
	std::cin >> in;

	int base = 2;
	for (i = 0; i < in; i++) {
		base *= 2;
		if (base >= in) break;
	}

	if (base == in) std::cout << base << std::endl;
	if (base > in) std::cout << base / 2 << std::endl;

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int a,sum=1,sum2=1;
    cin >> a;
    for(int i=1; i<a; i++){
        sum*=2;
        if(sum>a){
            for(int j=1; j<i; j++){
                sum2*=2;
            }
            cout << sum2 << endl;
            return 0;
        }
        else if(sum==a){
            cout << sum << endl;
            return 0;
        }
    }
}

C++: #include<stdio.h>
int main(){
  int N,k=1;
  scanf("%d",&N);
  while(N >= 2){
    N=N/2;
    k*=2;
  }
  printf("%d\n",k);
  return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

void solve()
{
    int n, ans = 1;
    cin >> n;
    while (ans * 2 <= n)
    {
        ans *= 2;
    }
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}