Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		line := scanner.Text()
		n, _ := strconv.Atoi(line)

		var p2 = 1
		for {
			if n < 2*p2 {
				break
			}
			p2 *= 2
		}

		fmt.Printf("%v\n", p2)
	}
}

C++: #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
	int n;
    cin >> n;
    vector<int> b;
    for(int i = 1; i <= 2000000; i *= 2){
        if(i > n){
            cout << b[b.size()-1] << endl;
            return 0;
        }
        b.pb(i);
    }
}

C++: #include <bits/stdc++.h>
typedef long long lint;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

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

C++: #include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int num=1,ans=0;
  while(n>=num){
    num*=2;
    ans++;
  }
  cout<<num/2<<endl;

  return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
    int N,ans=1;

    cin >> N;

    while(ans<=N){
        ans=ans*2;
    }

    cout << ans/2 << endl;
    

    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int N,c=2;

	cin >> N;
	
	while (c < N){
		c *= 2;
	}
	if (c == N){

	}
	else{ c /= 2; }

	cout << c << endl;
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){
  int n; cin >> n;
  int ans=1;
  while(ans<=n) ans*=2;
  cout << ans/2 << endl;
  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    int t = 1;
    while(t*2 <= n)t *= 2;
    cout << t << endl;
}

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

C++: #include <cmath>
#include <iostream>
using namespace std;
int main(){

int N;
double a;

cin >>N;

for(int i=0;i<=20;i++){
    
a=i;
  
   if(N<pow(2.0,a)){
   break;}
}
   cout<<pow(2.0,a-1)<<endl;



return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
  int a,b=0,c=1;
  cin>>a;
  for(int i = 1;i < 20;i++){
      c=c*2;
      if(a<c)break;
     b = c; 
  }
  cout<<b<<endl;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    vector<int> p;
    int num, idx, n = 1000001, i = 1;
    while (i < n) {
        i*=2;
        p.push_back(i);
    }
    scanf("%d", &num);
    idx = upper_bound(p.begin(), p.end(), num)-p.begin()-1;
    printf("%d\n", p[idx]);
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,i=1;
  int ans[55]={};

  cin>>n;
  ans[0]=1;

  while(1){
    ans[i]=ans[i-1]*2;
    if(ans[i]>n) break;
    i++;
  }
  
  cout<<ans[i-1]<<endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  int ans=1;
  while(ans<=n) ans<<=1;
  cout<<ans/2<<endl;
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n,ans=1; scanf("%d",&n);
    while(ans<=n)ans*=2;
    printf("%d\n",ans/2);
    return 0;
}

C++: #include <iostream>
using namespace std;

int main(void){
  int a,b;
  cin >> a;
  while (a){
    a ^= b = a&-a;
  }
  cout << b << endl;
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int n; cin>>n;
    int x=2;
    while(x<=n){
	x*=2; 
    }
    cout<<x/2<<endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    int ans=1;
    while(1){
        if(ans*2>N){
            cout << ans << endl;
            break;
        }else{
            ans*=2;
        }
    }
}

C++: #include<iostream>

using namespace std;

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

C++: #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    int c = log2(n);
    int ans = pow(2,c);
    cout << ans << endl;
}

C++: #include<iostream>
using namespace std;
int main() {
int N;
cin >> N;
int ans = 1;
while(ans<=N)ans *= 2;
cout << ans/2 << endl;
}

C++: #include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 n;
  cin >> n;
  i64 ans = 1;
  while (ans * 2 <= n)
    ans *= 2;
  cout << ans << endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int ans=1;
  while(pow(2,ans+1)<=n){
    ans++;
  }
  cout<<pow(2,ans)<<'\n';
  return(0);
}

C++: #include <iostream>
using namespace std;
int main() {

    int n, c = 0;
    cin >> n;

    while ( n > 1 ) {
	n >>= 1;
	++c;
    }

    cout << (1<<c) << endl;
    return 0;
}

C++: #include <iostream>
using namespace std;

int main() {
  int N;
  cin >> N;
  long long ans = 1;
  while (ans * 2 <= N)
    ans *= 2;
  cout << ans << endl;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int  n,a;
	scanf("%d",&n);
	a=1;
	while(1){
		if(n<a*2){
			break;
		}
		a*=2;
	}
	printf("%d\n",a);
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int i = 1;
  while (i * 2 <= n) {
    i *= 2;
  }
  cout << i << "\n";
}