akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    int r = x%y;
    if (r == 0) {
        return y;
    }
    return gcd(y, r);
}

int main(){
    int N;
    map<char, int> ABC;
    cin >> N >> ABC['A'] >> ABC['B'] >> ABC['C'];
    vector<string> s(N);
    for (int i=0; i<N; i++) cin >> s[i];
    vector<string> ans(N);
    ll sum = ABC['A'] + ABC['B'] + ABC['C'];
    if (sum == 0) {
        cout << "No" << endl;
        return 0;
    }
    else if (sum == 1) {
        for (int i=0; i<N; i++) {
            if (ABC[s[i][0]] == 1) {
                ABC[s[i][0]]--;
                ABC[s[i][1]]++;
                ans[i] = s[i][1];
            }
            else if (ABC[s[i][1]] == 1) {
                ABC[s[i][0]]++;
                ABC[s[i][1]]--;
                ans[i] = s[i][0];
            }
            else {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    else {
        if (ABC[s[0][0]] == 0 && ABC[s[0][1]] == 0) {
            cout << "No" << endl;
            return 0;
        }
        else {
            for (int i=0; i<N; i++) {
                if (ABC[s[i][0]] == 0) {
                    ABC[s[i][0]]++;
                    ABC[s[i][1]]--;
                    ans[i] = s[i][0];
                }
                else if (ABC[s[i][1]] == 0) {
                    ABC[s[i][0]]--;
                    ABC[s[i][1]]++;
                    ans[i] = s[i][1];
                }
                else if (sum == 2 && ABC[s[i][0]] == 1 && ABC[s[i][1]] == 1 && i != N-1) {
                    if (s[i] != s[i+1]) {
                        if (s[i][0] == s[i+1][0] || s[i][0] == s[i+1][1]) {
                            ABC[s[i][0]]++;
                            ABC[s[i][1]]--;
                            ans[i] = s[i][0];
                        }
                        else {
                            ABC[s[i][0]]--;
                            ABC[s[i][1]]++;
                            ans[i] = s[i][1];
                        }
                    }
                    else {
                        if (ABC[s[i][0]] < ABC[s[i][1]]) {
                            ABC[s[i][0]]++;
                            ABC[s[i][1]]--;
                            ans[i] = s[i][0];
                        }
                        else {
                            ABC[s[i][0]]--;
                            ABC[s[i][1]]++;
                            ans[i] = s[i][1];
                        }
                    }
                }
                else {
                    if (ABC[s[i][0]] < ABC[s[i][1]]) {
                        ABC[s[i][0]]++;
                        ABC[s[i][1]]--;
                        ans[i] = s[i][0];
                    }
                    else {
                        ABC[s[i][0]]--;
                        ABC[s[i][1]]++;
                        ans[i] = s[i][1];
                    }
                }
            }
        }
    }
    cout << "Yes" << endl;
    for (int i=0; i<N; i++) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 9612
#include <iostream>
#include <string>
using namespace std;


int main() {
	int n;
	cin >> n;
	int a, b;
	b = n % 100;
	a = (n - a) / 100;
	if (b >= 1 && b <= 12) {
		if (a >= 1 && a <= 12) {
			cout << "AMBIGUOUS" << endl;
		}
		else {
			cout << "YYMM" << endl;
		}
	}
	else {
		if (a >= 1 && a <= 12) {
			cout << "MMYY" << endl;
		}
		else {
			cout << "NA" << endl;
		}
	}

	


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define rrep(i,n) for(int i=(n);i>=0;--i)
#define ssort(n) sort((n).begin(),(n).end())
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define INF 10101010

int main()
{
    int w,h,n;
    cin >> w >> h >> n;

    vector<int> x(n),y(n),a(n);

    rep(i,n){
        cin >> x[i] >> y[i] >> a[i];
    }
    int min_x,max_x,min_y,max_y;
    min_x=min_y=0;max_x=w;max_y=h;
    rep(i,n){
        if(a[i]==1){
            if(min_x<x[i]){
                min_x=x[i];
            }
        }else if(a[i]==2){
            if(max_x>x[i]){
                max_x=x[i];
            }
        }else if(a[i]==3){
            if(min_y<y[i]){
                min_y=y[i];
            }
        }else{
            if(max_y>y[i]){
                max_y=y[i];
            }
        }
    }
    int len_x=max_x-min_x;
    int len_y=max_y-min_y;
    if(len_x>=0&&len_y>=0){
        cout << len_x*len_y << endl;
    }else{
        cout << 0 << endl;
    }

}

Measured memory_bytes: 3600
s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力

Measured memory_bytes: 9316
#include <bits/stdc++.h>

#include <boost/range/adaptors.hpp>
#include <boost/range/combine.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n, m;
    cin >> n >> m;

    cout << n * m << endl;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600

typedef pair<int, int> P;

int main(){
  int w,h;
  cin>>w>>h;
  vector<int> p(w), q(h);
  rep(i,w) scanf("%d", &p[i]);
  rep(i,h) scanf("%d", &q[i]);

  vector<P> vec(w+h);
  rep(i,w) vec[i] = mp(p[i], 0);
  rep(i,h) vec[i+w] = mp(q[i], 1);

  sort(all(vec));
  int nw=w+1, nh=h+1;
  long res=0;
  rep(i, w+h){
    if(vec[i].se==0){ //p w のほうをつかう
      res += (long)vec[i].fi * nh;
      nw--;
    } else {
      res += (long)vec[i].fi * nw;
      nh--;
    }
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;

int main(){
  string s,t;
  cin >> s >> t ;
  
  int cnt=0;
  for(int i=0;i<3;i++){
    if(s[i]==t[2-i]){
      cnt++;
    }
  }
    if(cnt==3){
      cout << "YES";
    }else{
      cout << "NO";
    }
}
  
  

Measured memory_bytes: 256
use proconio::{fastout, input};

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(usize, usize); m],
    }

    let mut graph: Vec<Vec<usize>> = vec![vec![]; n + 1];
    for (a, b) in &ab {
        graph[*a].push(*b);
        graph[*b].push(*a);
    }

    let mut q = VecDeque::<(usize, usize)>::new();
    let mut ans = vec![0; n + 1];
    q.push_back((1, 1000000));
    while !q.is_empty() {
        let (node, prev) = q.pop_front().unwrap();
        if ans[node] == 0 {
            ans[node] = prev;
            for next in &graph[node] {
                q.push_back((*next, node));
            }
        }
    }

    println!("Yes");
    for i in 2..n + 1 {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 22308
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

int main(){
	string S;
	cin >> S;

	map<char, ll> memo;
	rep(i, S.size()) memo[S[i]]++;
	if(memo.size() == 2 && (*memo.begin()).second == 2) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long C = sc.nextLong();
        long K = sc.nextLong();
        sc.close();

        long aCount = 0;
        long bCount = 0;
        long cCount = 0;

        if (K <= A) {
            aCount = K;
        } else {
            aCount = A;
            K -= A;
            if (K <= B) {
                bCount = K;
            } else {
                bCount = B;
                K -= B;
                cCount = K;
            }
        }

        System.out.println(1 * aCount + (-1) * cCount);
    }

}


Measured memory_bytes: 35644
#include<stdio.h>
int main(viod)
{
	int t;
	int n;
	int s,f,b;
	int i;
	
	scanf("%d",&t);
	while(t!=0){
		b=0;
		scanf("%d",&n);
		for(i=0;i<n;i++){
			scanf("%d %d",&s,&f);
			b=b+(f-s);
		}
		if(t<=b){
			printf("OK\n");
		}
		else {
			printf("%d\n",t-b);
		}
		scanf("%d",&t);
	}
	return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
  
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
 
#define pb emplace_back
#define fi first
#define se second

using namespace std;
 
typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
 
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-8;
const ll MOD = 1e9+7;

template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }
ll in(){ ll x; scanf( "%lld" , &x ); return x; }
 
// head

ll n;
vl v;

ll get( ll x ){
  ll lb = 0, ub = INF;
  while( ub - lb > 1 ){
    ll md = ( lb + ub ) / 2;
    if( md * ( md + 1 ) / 2 >= n ){
      ub = md;
    } else {
      lb = md;
    }
  }
  return ub;
}

int main(){

  n = in();

  while( n ){
    ll c = get( n );
    v.pb( c );
    n -= c;
  }

  YYS( w , v ){
    cout << w << endl;
  }
  
  return 0;
}


Measured memory_bytes: 384
/*                                                                                 
	Author :- Gaurang_Kothiya
	
	Quote :- " Practice makes a man perfect. "		
*/  
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  
 
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set; 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ld long double
#define f(i,x,n) for(auto i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(auto i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
const ll inf= 1e9;
const ll inf64= 1e18;
const ll MOD= 1e9 +7;





void Solve()
{
	char c;
	cin>>c;
	if(c>='A' && c<='Z') cout<<'A';
	else cout<<"a";
} 
 
signed main() 
{
	speed		
	
	int q=1;
	//cin>>q;
	
	while(q--)
	Solve();
	
	return 0;
} 

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin>>N;
  vector<vector<int>> A(N,vector<int>(2));
  for(vector<int> &i:A){
    cin>>i.at(0)>>i.at(1);
  }
  double k=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<i;j++){
      int x=A.at(i).at(0)-A.at(j).at(0),y=A.at(i).at(1)-A.at(j).at(1);
      k+=pow(x*x+y*y,0.5);
    }
  }
  cout<<setprecision(16)<<k*2/N<<endl;
}


Measured memory_bytes: 4148
#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
	char a[19];
	for(int i=0;i<19;i++)
	{
		scanf("%c",&a[i]);
		if(a[i]==','){
			a[i]=' ';
		}
	}
	for(int j=0;j<19;j++)
	{
		printf("%c",a[j]);
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
#define ull unsigned long long 
#define f(i,x,n) for(ll int i=x;i<n;i++) 
#define re(j,x,n) for(ll int j=x;j>=n;j--)
#define f1(k,x,n) for(ll int k=x;k<=n;k++)
#define mp make_pair
#define pb push_back
#define mod 1000000007
using namespace std;
int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   ll int n;
   cin>>n;
   ll int b[n-1],sum=0;
   vector<ll int> v;
   f(i,0,n-1)
   {
   	cin>>b[i];
   }
   v.pb(b[0]);
   f(i,1,n-1)
   {
     v.pb(min(b[i],b[i-1]));
   }
   v.pb(b[n-2]);
   f(i,0,v.size())
   {
   	 sum+=v[i];
   }
   cout<<sum;
}

Measured memory_bytes: 256
import itertools

N = int(input())
A = [int(x) for x in input().split()]

reg = 10**12
Acum = list(itertools.accumulate(A))
for i in range(N):
    L = Acum[i]
    R = Acum[-1] - L
    tmp = abs(L-R)
    reg = min(reg, tmp)
print(reg)

Measured memory_bytes: 25768
#include <bits/stdc++.h>
using namespace std;

const int INF = 1e9+7;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++){
		cin >> a.at(i);
	}
	vector<int> num(100100);
	for(int i=0; i<100100; i++){
		num.at(i) = 0;
	}
	for(int i=0; i<n; i++){
		num.at(a.at(i))++;
	}
	int diff=0;
	for(int i=0; i<100100; i++){
		if(num.at(i) > 0){
			diff++;
		}
	}
	cout << (diff%2==1?diff:diff-1) << endl;

}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
int main(void){
	int n,m;
	cin>>n>>m;
vector<int> c(m);
vector<vector<int> > t(m,vector<int>(n+1,0));
for(int i=0;i<m;i++){
	cin>>c[i];
}
for(int i=0;i<m;i++){
	t[i][c[i]]=1;
}
for(int i=1;i<n+1;i++){
	for(int j=0;j<m;j++){
		if(c[j]==1){
			t[j][i]=t[j][i-1]+1;
		}else	if(c[j]>i){
			t[j][i]=t[j-1][i];
		}else if(t[j][i]==0){
			t[j][i]=min(t[j-1][i],t[j][i-c[j]]+1);
		}


	}

}
cout<<t[m-1][n]<<endl;
	return 0;
}

Measured memory_bytes: 7096
#include <bits/stdc++.h>

using namespace std;

int main() {
	vector<int> a(5);
	int k;
	for (int i=0; i<5; ++i) {
		cin >> a[i];
	}
	cin >> k;

	for (int i=0; i<4; ++i) {
		for (int j=i+1; j<5; ++j) {
			if (abs(a[i]-a[j]) > k) {
				cout << ":(\n";
				return 0;
			}
		}
	}
	cout << "Yay!\n";
	
	return 0;
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll ans = a[0];
    for(int i = 1; i < n; i++){
        ans ^= a[i];
    }
    vector<ll> b(n);
    for(ll i = 0; i < n; i++){
        b[i] = ans ^ a[i];
    }

    rep(i, n){
        cout << b[i] << endl;
    }


}


Measured memory_bytes: 6420
while True:
    H,W = map(int, input().split())
    if H==0 & W==0 : break 

    for i in range(H):
      for j in range(W):
        if (i%2==1 and j%2==0) or (i%2==0 and j%2==1):
          print(".", end="")
        else:
            print("#", end="")
      print()
    print()


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


void solve(long long N, std::vector<long long> d){
    ll ans = 0;
    rep (i, N - 1) {
        for (int j = i + 1; j < N;j++){
            ans += (d[i] * d[j]);
        }
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> d(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&d[i]);
    }
    solve(N, std::move(d));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    //freopen("AT3857.01.inp","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;    
    bitset<4000000> f;
    f[0]=1;
    int sa =0;
    for (int i=1; i<=n; i++){
        int x;
        cin >> x;
        f |= f<<x;
        sa+=x;
    }
    for (int i=((sa+1)>>1); i<=sa; i++){
        if (f[i]){
            cout<<i<<'\n';
            return 0;
        }
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using LL = long long; using PII = pair<LL, LL>; using VI = vector<LL>; using VVI = vector<VI>;
using VB = vector<bool>; using VS = vector<string>; using VP = vector<PII>;
#define VV(T)        vector<vector<T>>
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x)         {cout << #x << " = " << (x) << endl;}


int main() {
    LL N, L;
    cin >> N >> L;
    VI T(N);
    LL sum = 0;
    LL m = LLONG_MAX, mm;
    REP(i, N) {
        T[i] = L + i;
        if (abs(T[i]) < m) {
            mm = T[i];
            m = abs(T[i]);
        }
        sum += T[i];
    }
    cout << sum - mm << endl;
	
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>

using namespace std;
int a[30];

int main() {
    string str;
    cin >> str;
    for(int i = 0; i < (int)str.length(); i++) {
        a[str[i] - 'a']++;
    }
    char ch = '0';
    for(int i = 0; i < 26; i++) {
        if(a[i] == 0) {
            ch = 'a' + i;
            break;
        }
    }
    if(ch == '0') {
        cout << "None" << endl;
    }
    else {
        cout << ch << endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
void solve()
{
    ll n, count=0;
    cin>>n;
    vl a(n);
    forr(i, n)
    {
        cin>>a[i];
        if((i+1)%2==1&&abs(a[i])%2==1)
        count++;
    }
    cout<<count;
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
}

Measured memory_bytes: 3624
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		string s;
		cin>>s;
		sort(all(s));
		if(s[0]==s[2]) cout<<"No"<<endl;
		else cout<<"Yes";
	}
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int n;
    scan(n);

    void solve(int i, int shu, string s) {
        if (i == n) {
            writeln(s);
            return;
        }

        foreach (j ; 0 .. shu) {
            solve(i + 1, shu, s ~ ('a' + j).to!char);
        }
        solve(i + 1, shu + 1, s ~ ('a' + shu).to!char);
    }

    solve(0, 0, "");
}




void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 2556
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
//---------------------------------//
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
//------------------------------//

typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;

#define  ff           first
#define  ss           second
#define  pb           push_back
#define  IOS          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  all(x)       (x).begin(), (x).end()
#define  ps(x,y)      fixed<<setprecision(y)<<x
#define  rep(i,a,b)   for(ll i=a ; i<b ; ++i)

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll maxn = 1e6 + 4;


void solve(){
  int n;
  cin >> n;
  vpi v(n);
  for(int i=0;i<n;i++){
    cin >> v[i].ff >> v[i].ss;
  }
  for(int i=0;i+2<n;i++){
    bool ok = true;
    for(int j=0;j<=2;j++){
      if(v[i+j].ff != v[i+j].ss){
        ok = false;
        break;
      }
    }
    if(ok){cout << "Yes";return;}
  }
  cout << "No";
}  

int main(){
  IOS
  	solve();
  //cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}

// integer overflow

Measured memory_bytes: 3652
A=int(input())
B=int(input())
if (A,B)==(2,3) or(A,B)==(3,2):
    print(1)
elif (A,B)==(1,3) or (A,B)==(3,1):
    print(2)
elif (A,B)==(1,2) or (A,B)==(2,1):
    print(3)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl

ll ans = 0; 
ll n; 

void check(ll x){
    int t=0, f=0, s=0; 
    if(n<x) return;
    while(x>0){
       if(x%10==3) t++;
       else if(x%10==5) f++;
       else if(x%10==7) s++; 
       x /= 10;
    }
    
    if(t>=1 && f>=1 && s>=1){
        ans++;
    }
}

void dfs(ll x){
    check(x);
    if(x<=1e9){
        dfs(10*x+3);
        dfs(10*x+5);
        dfs(10*x+7);
    }
}

int main() {
    cin >> n;
    dfs(0);
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
   static class pair implements Comparable<pair>{
        int a;
        long b;
        public pair(int a, long b){
            this.a=a;
            this.b=b;
        }
        public int compareTo(pair p){
            return (a-p.a==0)?Long.compare(b,p.b):a-p.a;
        }
          
   }
  public static void main(String[] args) throws IOException,InterruptedException{
	BufferedReader	 br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter out = new PrintWriter(System.out);
     	// String s = br.readLine();
        // char[] arr=s.toCharArray();
        // ArrayList<Integer> arrl = new ArrayList<Integer>(); 
        // TreeSet<Integer> ts1 = new TreeSet<Integer>(); 
        // HashSet<Integer> h = new HashSet<Integer>(); 
        // HashMap<Integer, Integer> map= new HashMap<>(); 
        // PriorityQueue<String> pQueue = new PriorityQueue<String>(); 
        // LinkedList<String> object = new LinkedList<String>(); 
        // StringBuilder str = new StringBuilder();
        
        //*******************************************************//
 	   //  StringTokenizer   st = new StringTokenizer(br.readLine());
 	   // 	  int t = Integer.parseInt(st.nextToken());
 	   //    while(t-->0){
 	   //        st = new StringTokenizer(br.readLine());
 	   // 	  int n = Integer.parseInt(st.nextToken());
 	   // 	  int[] arr = new int[n];
 	   // 	  st = new StringTokenizer(br.readLine());
 	   // 	  for(int i=0; i<n; i++){
 	   // 	      arr[i] =Integer.parseInt(st.nextToken());
 	   // 	  }
 	   // 	  int ans =0;
 	   // 	  out.println(ans);
 	   //    }
 	         StringTokenizer   st = new StringTokenizer(br.readLine());
 	    	  n = Integer.parseInt(st.nextToken());
 	    	  w = Integer.parseInt(st.nextToken());
 	    	 arr = new pair[n];
 	    	 for(int i=0; i<n; i++){
 	    	     st = new StringTokenizer(br.readLine());
 	    	  arr[i] = new pair(Integer.parseInt(st.nextToken()),Long.parseLong(st.nextToken()));
 	    	 }
 	    	 dp = new long[n+5][w+5];
 	    	 for(int i=0; i<n+5; i++) Arrays.fill(dp[i],-1l);
 	    	 out.println(solve(0,0));
              out.flush();
 	    	  }
 	    	  static int n;
 	    	  static int w;
 	    	  static long[][] dp;
 	    	  static pair [] arr;
              public static long solve(int i, int sum){
                  if(i>=n) return 0l;
                  if(sum>w) return(long)( -1e17);
                  if(dp[i][sum]!=-1) return dp[i][sum];
                  long take = (sum+arr[i].a<=w)?arr[i].b+ solve(i+1,sum+arr[i].a):(long)(-1e17);
                  long leave = solve(i+1,sum);
                  return dp[i][sum] = Math.max(take,leave);
              }
	}
	
	


Measured memory_bytes: 126420
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

int main(){
    ll N,ans[200],C;
    cin >> N;
    string S,T,G;
    rep(i,N){
        ans[i] = 0;
    }
    cout << "?" << " ";
    rep(i,N){
        cout << i+1 << " ";
    }
    cout << endl;
    T.clear();
    cin >> T;
    S = T;
    ll ng=N,ok=0;
    while(ng-ok>1){
        ll mid = (ok+ng)/2;
        cout << "?" << " ";
        Rep(i,mid,mid+N){
            cout << i+1;
            if(i!=mid+N-1){
                cout << " ";
            }
        }
        cout << endl;
        cin >> T;
        if(S==T){
            ok = mid;
        }
        else{
            ng = mid;
        }
    }
    ok = ng;
    ok %= 2*N;
    ll key;
    rep(i,2*N){
      cout << "?" << " ";  
      if(i>=ok && i<=ok+N-2){
          key=ok+N;
          key%=2*N;
      }
      else{
          key=ok;
      }
      rep(j,N-1){
          cout << (j+key)%(2*N)+1 << " ";
      }
      cout << i+1 << endl;
      cin >> T ;
      if(T[0]=='R') {
          ans[i]=0;
      }
      else{
          ans[i]=1;
      }
    }
    cout << "!" << " ";
    rep(i,2*N){
        cout << (ans[i]==0 ? 'R' : 'B') ;
    }
}

Measured memory_bytes: 724
N,M = list(map(int,input().split()))

e_list = [[] for i in range(N)]

for i in range(M):
    x,y,z = list(map(int,input().split()))
    x,y = x-1,y-1
    e_list[x].append(y)
    e_list[y].append(x)

count = 0

color_list = [-1]*N

from collections import deque

def BFS(vi,c):
    Q = deque([vi])
    while len(Q)>0:
        v = Q.pop()
        for v1 in e_list[v]:
            if color_list[v1]==-1:
                color_list[v1]=c
                Q.appendleft(v1)

for i in range(N):
    if color_list[i]==-1:
        BFS(i,count)
        count+=1

print(count)


Measured memory_bytes: 66464
#include <cstdio>

typedef long long ll;
ll a,b,c;

int main()
{
    scanf("%lld%lld%lld",&a,&b,&c);
    if(a+b>=c)
        printf("%lld",b+c);
    else
        printf("%lld",a+b+b+1);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
using namespace std;
char pok[210],pok0[210];
bool pokm1[210]={0},pokm2[210]={0};
int main()
{
	long long ans0=0,k,ans1=0,p,flag=1;
	scanf("%s",pok);
	scanf("%lld",&k);
	for(int i=0;i<strlen(pok);i++)
	{
		if(pok[i]==pok[i+1]&&pokm1[i+1]==0&&pokm1[i]==0)
		{
			pokm1[i+1]=1;
			pokm1[i]=1;
			ans0++;
		}
	}
	for(int i=strlen(pok)-1;i>0;i--)
	{
		if(pok[i]!=pok[i-1])flag=0;
	}
	if(flag==1)
	{
		printf("%lld",strlen(pok)*k/2);
		return 0;
	}
	strcpy(pok0,pok);
	strcat(pok0,pok);
	for(int i=0;i<strlen(pok0);i++)
	{
		if(pok0[i]==pok0[i+1]&&pokm2[i+1]==0&&pokm2[i]==0)
		{
			pokm2[i+1]=1;
			pokm2[i]=1;
			ans1++;
		}
	}
	p=ans1-2*ans0;
	printf("%lld",k*ans0+(k-1)*p);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

vector<bool> eratos(int n)
{
	vector<bool> isprime(n+1, true);
	isprime[0] = isprime[1] = false;
	for(int i=2; i*i<=n; ++i){
		if(isprime[i]){
			for(int j=i*2; j<=n; j+=i)
				isprime[j] = false;
		}
	}
	return isprime;
}

int main()
{
	vector<bool> isprime = eratos(1000000);
	
	int n;
	while(scanf("%d", &n), n){
		int cnt = 0;
		rep(i, n/2+1)
			cnt += isprime[i] && isprime[n-i];
		printf("%d\n", cnt);
	}
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;

int dp[1005][1005],n,m,ans;
int min(int x,int y,int z,int w){
	int ans=x;
	if (y<ans) ans=y;
	if (z<ans) ans=z;
	if (w<ans) ans=w;
	return ans;
}
int main(){
	char ch;
	cin>>n>>m;
	
	for (int i=0;i<=n+1;i++){
		for (int j=0;j<=m+1;j++){
			dp[i][j]=1000000;
		}
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			cin>>ch;
			if (ch=='#') dp[i][j]=0;
		}
	}
	
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			if (dp[i][j]!=0) dp[i][j]=min(dp[i-1][j],dp[i+1][j],dp[i][j-1],dp[i][j+1])+1;
		}
	}
	for (int i=n;i>=1;i--){
		for (int j=m;j>=1;j--){
			if (dp[i][j]!=0) dp[i][j]=min(dp[i-1][j],dp[i+1][j],dp[i][j-1],dp[i][j+1])+1;
		}
	}
	
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			ans=max(ans,dp[i][j]);
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4224
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
int main(){
  map<string, int> a,b;
  int n,m;
  cin >> n;
  vector<string> s(n);
  for(int i=0;i<n;i++){
    cin >> s[i];
    a[s[i]]++;
  }
  cin >> m;
  string t;
  for(int i=0;i<m;i++){
    cin >> t;
    b[t]++;
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(ans<a[s[i]]-b[s[i]]) ans=a[s[i]]-b[s[i]];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
#define f(i,a,b) for(int i=a;i<=b;++i)
int dot[105];
int main()
{
	int n,x;
	cin>>x>>n;
	for(int i=1;i<=n;++i)
	{
		int y;
		cin>>y;
		dot[y]=1;
	}
	int ans=0x7fffffff,k;
	for(int i=0;i<=105;++i)
	if(!dot[i]&&abs(i-x)<ans) ans=abs(i-x),k=i;
	cout<<k;
	return 0;
 } 

Measured memory_bytes: 3624
#include <stdio.h>
#define M 200000

long int profitsearch(int n, long long int a[]);

int main(void){
	
	long long int a[M];
	int i,n,res;
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}

	res=profitsearch(n,a);

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

	return 0;

}


long int profitsearch(int n,long long int a[]){

	long long int min = 1000000000;
	long long int res, res_max=-2000000001;
	int i;

	for(i=0;i<n;i++){
		if(i>0){
		res = a[i]-min;
		if(res_max<res) res_max=res;
		}
		if(a[i]<min) min = a[i];
	}

	return res_max;

}

Measured memory_bytes: 4256
#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9+7;

bool check(const string& s){

  if(s.find("AGC") != string::npos) return false;

  int n = s.size();

  for(int i = 0; i < n-1; i++){
    string t = s;

    swap(t[i], t[i+1]);
    
    if(t.find("AGC") != string::npos) return false;
  }

  return true;
  
}

int main(){

  int n;

  cin >> n;

  map<string, long long> dp;

  dp["..."] = 1;

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

    map<string, long long> nextDp;

    for(const auto& p : dp){
      string s = p.first;

      for(int j = 0; j < 4; j++){

	string t = s + "ACGT"[j];

	if( check(t) ){
	  t = t.substr(1);
	  nextDp[t] += p.second;
	  nextDp[t] %= MOD;
	}
      }
    }
    dp = move(nextDp);
  }

  long long ans = 0;

  for(const auto& p : dp){
    ans += p.second;
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
/**
 *    author:  math2do
 *    created: 24.11.2019 17:59:32
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  #ifdef LOCAL
    freopen("b_rot.in", "rt", stdin);
  #endif
  int by;
  string str;
  cin >> by;
  cin >> str;
  by = by % 26;
  int len = str.length();
  for (int i = 0; i < len; i++) {
    int cur = str[i] - 'A';
    cur = (cur + by) % 26;
    str[i] = cur + 'A';
  } 
  cout << str << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++)
        cin>>h[i];
    vector<int> dp(n, INT_MAX);
    dp[0]=0;
    dp[1]=abs(h[0]-h[1]);
    for(int i=2;i<n;i++)
        dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
    cout<<dp[n-1];}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;

const int M=1e5+5;
const int P=1e9+7;

int F[M];
int Pow(int x,int k) {
	int res=1;
	while (k) {
		if (k&1) res=1LL*res*x%P;
		x=1LL*x*x%P;
		k>>=1;
	}
	return res;
}
int Cnm(int n,int m) {
	return 1LL*F[n]*Pow(1LL*F[n-m]*F[m]%P,P-2)%P;
}

int A[M],pos[M];

int main() {
	F[0]=1;
	for (int i=1;i<M;++i) F[i]=1LL*F[i-1]*i%P;

	int n;
	int cnt;

	cin>>n;
	for (int i=1;i<=n+1;++i) {
		scanf("%d",&A[i]);
		if (pos[A[i]]==0) pos[A[i]]=i;
		else cnt=n+1-(i-pos[A[i]]+1);
	}

	for(int i=1;i<=n+1;++i) {
		int res=Cnm(n+1,i);
		if (cnt>=i-1) res-=Cnm(cnt,i-1);
		res=(res+P)%P;
		printf("%d\n",res);
	}
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>

int main() {
    int n;
    std::cin >> n;

    for (int i = 0; i < 9; ++i) {
        if (pow(2, i) > n) {
            if (i == 0) {
                std::cout << n << std::endl;
                return 0;
            }
            else {
                std::cout << pow(2, i - 1) << std::endl;
                return 0;
            }
        }
    }


    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)

#define DumpArray(cont,from,to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
int H,W;
vector<string> A;
vector<vector<int> > C;
int main() {
    cin >> H >> W;
    A.resize(H);
    C.resize(H, vector<int>(W));
    REP(i,H)
        cin >> A[i];
    queue<P> Q;
    REP(i,H)
        REP(j,W)
            if (A[i][j]=='#') {
                Q.push({i,j});
                C[i][j]=0;
            } else
                C[i][j]=-1;
    while(!Q.empty()) {
        P p=Q.front();Q.pop();
        P nlist[]={{p.fi-1,p.se},{p.fi+1,p.se},{p.fi,p.se-1},{p.fi,p.se+1}};
        for(P n:nlist) {
            if (n.fi < 0 || n.fi >= H || n.se < 0 || n.se >= W || C[n.fi][n.se] >= 0)continue;
            C[n.fi][n.se]=C[p.fi][p.se]+1;
            Q.push(n);
        }
    }
    int ans=0;

    REP(i,H)
        REP(j,W)
            ans=max(ans,C[i][j]);
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 13456
package main

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

func main() {
	s := NewScanner()
	n := s.NextInt()
	as := make([]int, n)
	for i := 0; i < n; i++ {
		as[i] = s.NextInt()
	}

	sort.Ints(as)
	dp := make([]bool, as[len(as)-1]+1)
	ans := 0
	for i, a := range as {
		if dp[a] {
			continue
		}
		for j := 1; a*j < len(dp); j++ {
			dp[a*j] = true
		}
		// 同じ数字がある場合はカウントしない
		if i+1 < len(as) && as[i+1] == a {
			continue
		}
		ans++
	}
	fmt.Println(ans)
}

type Scanner struct {
	scanner *bufio.Scanner
}

func NewScanner() *Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return &Scanner{s}
}

func (s *Scanner) NextWord() string {
	if !s.scanner.Scan() {
		log.Fatal("failed to find the next word")
	}
	return s.scanner.Text()
}

func (s *Scanner) NextInt() int {
	str := s.NextWord()
	i, err := strconv.Atoi(str)
	if err != nil {
		log.Fatalf("failed to parse %s to int", str)
	}
	return i
}

func (s *Scanner) NextInt64() int64 {
	str := s.NextWord()
	i, err := strconv.ParseInt(str, 10, 64)
	if err != nil {
		log.Fatalf("failed to parse %s to int64", str)
	}
	return i
}


Measured memory_bytes: 6224
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int N=sc.nextInt();//宅配便
			int M=sc.nextInt();//片道の時間
			int T=sc.nextInt();//終了時刻
			boolean[] time=new boolean[T+1];
			for(int i=0; i<N; i++) {
				int num=sc.nextInt();
				for(int j=num-M+1; j<=Math.min(num+M, T); j++) {
					time[j]=true;
				}
			}
			int sum=0;
			for(int i=1; i<=T; i++) {
				if(! time[i]) {
					sum+=1;
				}
			}
			System.out.println(sum);

		}
	}
}


Measured memory_bytes: 27252
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }

int ans;

void solve(vector<int>& v1,vector<int>&v2,vector<int>&v3){
  

  for(int i=0;i<v1.size();i++){
    int r = v1[i];
    auto itr1 = upper_bound(v2.begin(),v2.end(),r);
    if(itr1!=v2.end()){
      int index1 = itr1 - v2.begin();
      for(int j=index1;j<v2.size();j++){
        int b = v2[j];
        auto itr2 = upper_bound(v3.begin(),v3.end(),b);
        if(itr2!=v3.end()){
          int index2 = itr2 - v3.begin();
          int g = v3[index2];
          ans = ans + (v3.size()-index2);
          if(binary_search(v3.begin(),v3.end(),2*b-r)) ans--;
        }
      }
    }
  }

  
}


int32_t main(){
    
  fast;
  int n; cin >> n;
  string s; cin >> s;

  vector<int> v1,v2,v3;

  for(int i=0;i<s.size();i++){
    if(s[i]=='R') v1.pb(i);
    else if(s[i]=='G') v2.pb(i);
    else v3.pb(i);
  }

  int a = v1.size() , b = v2.size() , c = v3.size();

  // print(v1.size(),v2.size(),v3.size());
  // print(v1,v2,v3);

  solve(v1,v2,v3);
  solve(v1,v3,v2);
  solve(v2,v1,v3);
  solve(v2,v3,v1);
  solve(v3,v1,v2);
  solve(v3,v2,v1);

  // int ans = 0;
  


  cout << ans;

  

  return 0;
}

// RBRBG

Measured memory_bytes: 3732
/*
 *  Author: mizo0203
 *  Problem: 0001
 *  Status: Time Limit Exceeded
 *  Submission Date: 2012/04/14 23:23:19
 */
#include <stdio.h>

int n; // (0 < n <= 20)
int hx, hy, dx, dy;
int cx[20], cy[20]; // (-1000 <= h, d, c <= 1000)

void init() {
  // 事前処理なし
}

bool input() {
  // 入力なし
  return false;
}

int main() {
  int i, j;

  init();
  while (input()) {
  }

  for (i = 1; i <= 9; i++) {
    for (j = 1; j <= 9; j++) {
      printf("%dx%d=%d\n", i, j, i * j);
    }
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;


using mint = modint998244353;


// A: mint の入出力
istream &operator>>(istream &is, mint &a) { int v; cin >> v; a = v; return is; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.val(); }


// B: vector<mint> (を含む vector<T>) の入出力
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }


int main() {
  int n, m; cin >> n >> m;
  vector<mint> a(n), b(m); cin >> a >> b;

  auto c = convolution(a, b);

  cout << c << '\n';
}

Measured memory_bytes: 19072