akhauriyash/Code-Regression huggingface dataset:
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入


int main(){
    int N,K,C;
    string S;
    cin >> N >> K >> C;
    vector<int> L(K+2),R(K+2);
    cin >> S;
    L[0]=R[0]=-INF;
    L[K+1]=R[K+1]=INF;

    int cnt=1;
    REP(i,N){
        if(S[i]=='o'&&i>L[cnt-1]+C){
            L[cnt]=i;
            cnt++;
        }
        if(cnt>K) break;
    }
    cnt=0;
    REP(i,N){
        if(S[N-1-i]=='o'&&N-i-1<R[K-cnt+1]-C){
            R[K-cnt]=N-i-1;
            cnt++;
        }
        if(K-cnt<1) break;
    }
    
    REP2(i,1,K+1){
        if(R[i]==L[i]) cout << R[i]+1 << endl;
    }


    
}

Measured memory_bytes: 5144
S=int(input())
num=[]
s=len(str(S))
while S > 0:
    num.append(int(S % 10))
    S = int(S / 10)

n=0
difference=[]
while n<s-2:
    num1=int(num[n+2])
    num2=int(num[n+1])
    num3=int(num[n])
    number=int(num1*100)+int(num2*10)+int(num3)
    difference.append(abs(753-number))
    n = n+1
    
print(min(difference))

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int MOD=1000000007;
const double PI = 3.1415926535897932384626433;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

vector<long long> enum_divisors(long long N) {
	vector<long long> res;
	for (long long i = 1; i * i <= N; ++i) {
		if (N % i == 0) {
			res.push_back(i);
			// 重複しないならば i の相方である N/i も push
			if (N/i != i) res.push_back(N/i);
		}
	}
	// 小さい順に並び替える
	sort(res.begin(), res.end());
	return res;
}

ll zyou(ll x,ll n){
	ll y=1;
	rep(i,0,n){
		y*=x;
	}
	return y;
}

int main() {
	int n,m;
	cin>>n>>m;
	int index=1;
	for(int i=1;i<=m/2;i++){
		print(i<<" "<<m-i+1);
		print(m+i<<" "<<2*m+2-i);
	}
	if(m%2)print(m+(m/2+1)<<" "<<2*m+2-(m/2+1));

}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll dp[n+1];
    rep(i,0,n)dp[i]=0;
    ll ans=0;
    rep(i,0,n-1){
        if(0<=i-a[i] && i-a[i]<=n){
            ans+=dp[i-a[i]];
        }
        if(0<=a[i]+i && a[i]+i<=n){
            dp[a[i]+i]++;
        }
        
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 6784
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
struct edge{
    int to;double cost;
    edge(int a,double b):to(a),cost(b){}
    edge(){}
    bool operator<(const edge &d)const{
        return cost<d.cost;
    }
};
int main(){
    int n,m;
    cin>>n>>m;
    int x[10000],y[10000];
    for(int i=0;i<n;i++)
        cin>>x[i]>>y[i];

    vector<vector<edge> >V(n);
    double sum=0;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;a--;b--;
        double dis=sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b]));
        sum+=dis;
        V[a].push_back(edge(b,dis));
        V[b].push_back(edge(a,dis));
    }
    bool used[10000];fill(used,used+10000,false);
    double res=0;
    priority_queue<edge>Q;
    for(int i=0;i<n;i++)Q.push(edge(i,0));
    while(Q.size()){
        int to=Q.top().to;double cost=Q.top().cost;
        Q.pop();
        if(used[to])continue;
        used[to]=true;
        res+=cost;
        for(int i=0;i<V[to].size();i++){
            Q.push(V[to][i]);
        }
    }
    cout<<fixed<<sum-res<<endl;
}

Measured memory_bytes: 3868
//解説参照1
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  string WorR;
  cin >> WorR;
  
//  int ans = 0;
  int Wtotal = 0;
  int Rtotal = 0;
  vector<int> white(n);
  for(int i=0;i<n;i++){
    if(WorR.at(i)=='W'){
      Wtotal++;
      white.at(i) = 1; //1:white 0:red
    }else{
      Rtotal++;
    }
  }
  
  //仕切りの左の白の個数W、右の赤の個数Rをともにゼロにする
  int W = 0;
  int R = Rtotal;
  int shikiri = 0;
  int ans = n;
  for(int i=0;i<n;i++){
    //仕切りを1つずつずらしながらW、Rを1ずつ増減させる
    if(white.at(shikiri)==1 and Rtotal!=0){
      W++;
    }else{
      R--;
    }
    //W<=R->W回入れ替え後、R-W個の赤を白に変換->合計R回
    //W>R ->R回入れ替え後、W-R個の白を赤に変換->合計W回
    //仕切り固定の場合、少なくともmax(R,W)の操作が必要?
    //各仕切りでの回数の最小値を採用
    if(ans >= max(R,W)){
      ans = max(R,W);
    }
    shikiri++;
  }
  cout << ans << endl;     
  
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  string S; cin >> S;
  ll pos = S.length();
  while (pos!=0) {
    if (pos>=5&&S.substr(pos-5,5)=="dream") pos-=5;
    else if (pos>=7&&S.substr(pos-7,7)=="dreamer") pos-=7;
    else if (pos>=5&&S.substr(pos-5,5)=="erase") pos-=5;
    else if (pos>=6&&S.substr(pos-6,6)=="eraser") pos-=6;
    else break;
  }
  string result = pos==0 ? "YES" : "NO";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 512
import numpy as np

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A = np.array(A)
B = np.array(B)

dp = np.full(H + 1, np.inf)
dp[0] = 0

for i in range(1, H + 1):
    dp[i] = np.amin(dp[np.maximum(i - A, 0)] + B)

print(int(dp[H]))

Measured memory_bytes: 12508
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

a,b=rl()
print('Odd' if a*b%2==1 else 'Even')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int N = 701;
int g[N][N], co[N], dp[N][2*N];
int n,m;
vector<int> w[N][2];
int de[N];
int tp;
bool dfs(int u,int c)
{
    if (co[u])
        return 1;
    w[tp][c>>1].push_back(u);
    co[u] = c;
    for (int v = 1; v <= n; ++v)
        if (g[u][v] == 0) {
            if (co[v]) {
                if (co[v] != (c ^ 2)) {
                    return 0;
                }
            }
            if (!dfs(v, c^2))
                return 0;
        }
    return 1;
}
bool chk(vector<int> & a)
{
    for (int i = 1; i < a.size(); ++i)
        for (int j = 0; j < i; ++j)
            if (g[a[i]][a[j]] == 0)
                return 0;
    return 1;
}
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        g[i][i] = 1;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u][v] = g[v][u] = 1;
    }
    vector<int> a[2];
    for (int i = 1; i <= n; ++i) {
        if (co[i]) {
            continue;
        }
        ++tp;
        if (!dfs(i,1)) {
            cout << "-1" << endl;
            return 0;
        }
        if (w[tp][0].size() > w[tp][1].size())
            w[tp][0].swap(w[tp][1]);
        de[tp] = w[tp][1].size() - w[tp][0].size();
    }
    dp[0][N] = 1;
    for (int i = 1; i <= tp; ++i) {
        for (int j = 0; j < 2*N; ++j) {
            dp[i][j + de[i]] |= dp[i-1][j];
            dp[i][j - de[i]] |= dp[i-1][j];
        }
    }
    int k = 0;
    while (!dp[tp][N+k] && !dp[tp][N-k])
        ++k;
    k = dp[tp][N+k] ? N+k : N-k;
    for (int i = tp; i >= 1; --i) {
        if (k - de[i] >= 0 && dp[i-1][k - de[i]]) {
            k -= de[i];
            for (int j = 0; j <= 1; ++j)
                for (int x : w[i][j])
                    a[j].push_back(x);
        } else {
            k += de[i];
            for (int j = 0; j <= 1; ++j)
                for (int x : w[i][j])
                    a[j^1].push_back(x);
        }
    }
    bool ok = 1;
    for (int i = 0; i <= 1; ++i)
        ok = ok && chk(a[i]);
    if (!ok) {
        cout << "-1" << endl;
        return 0;
    }
    long long x = a[0].size(), y = a[1].size();
    cout << x * (x - 1) / 2 + y * (y - 1) / 2 << endl;
}


Measured memory_bytes: 6016
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF=1e18;
ll f[1<<13];
int n,m;
int main(){
    scanf("%d%d",&n,&m);
    for(int i=0;i<(1<<n);i++)f[i]=INF;
    f[0]=0;
    for(int i=1;i<=m;i++){
        int a,b;scanf("%d%d",&a,&b);
        int S=0;
        for(int j=1;j<=b;j++){
            int x;scanf("%d",&x);
            x--;
            S|=(1<<x);
        }
        for(int j=0;j<(1<<n);j++){
            int nowS=(j|S);
            f[nowS]=min(f[j]+a,f[nowS]);
        }
    }
    if(f[(1<<n)-1]==INF)puts("-1");
    else printf("%lld\n",f[(1<<n)-1]);
    return 0;
}


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


int main() {

    int a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i < 1000; ++i) {
        for (int j = 0; j < 1000; ++j) {
            if (a*i-b*j == c) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import math
mod = 10 ** 9 + 7

def f(num):

    i = 2
    d = dict()

    while i * i <= num:
        if num % i == 0:
            num //= i
            d[i] = d.get(i, 0) + 1
        else:
            i += 1
    d[num] = 1

    return d

n = int(input())
if n == 1:
    print(1)
    exit()

ans = 1

for i in f(math.factorial(n)).values():
    ans *= i+1

print(ans%mod)

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

#define INF (1000000000)
int main() {

	
	int n,m;
	while( cin >> n >> m && n){
		int twf[110][110],cwf[110][110];
		for ( int i = 0; i < 110; i++ ) {
			for ( int j = 0; j < 110; j++ ) {
				if ( i == j )
					twf[i][j] = cwf[i][j] = 0;
				else
					twf[i][j] = cwf[i][j] = INF;
			}
		}
		for ( int i = 0; i < n; i++ ) {
			int a,b,cost,time;
			cin >> a >> b >> cost >> time;
			a--;b--;
			twf[a][b] = time;
			twf[b][a] = time;
			cwf[a][b] = cost;
			cwf[b][a] = cost;
		}
		for ( int a = 0; a < m; a++ ) {
			for ( int b = 0; b < m; b++ ) {
				for ( int c = 0; c < m; c++ ) {
					twf[b][c] = min ( twf[b][c], twf[b][a] + twf[a][c] );
					cwf[b][c] = min ( cwf[b][c], cwf[b][a] + cwf[a][c] );
				}
			}
		}

		int k;
		cin >> k;
		for ( int i = 0; i < k; i++ ) {
			int p,q,r;
			cin >> p >> q >> r;
			p--,q--;
			if ( !r ) {
				cout << cwf[p][q] << endl;
			} else {
				cout << twf[p][q] << endl;
			}
		}
	}
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
#include<iostream>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
    int a,v,b,c,d,e,f,r,i,j,m=-1;
    string x,y;
    cin>>x>>y;
    cout<<y<<x<<endl;

}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;
#define y1 sfasfd 
#define int long long
#define go adssdadsasda
using namespace std;
 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;
const int N = 4e5 + 123;
bool dp[3][N] , rock[N];
int n  , A , B , C , D;
char ch[N];
main(){
	cin >> n >> A >> B >> C >> D;
	rock[0] = rock[n + 1] = rock[n + 2] = 1;
	for(int i = 1 ; i <= n ; i++){
//		char ch;
		cin >>  ch[i];
		if(ch[i] == '#')
			rock[i] = true;
	}
	dp[1][A] = 1;
	for(int i = A ; i <= n ; i++){
		dp[1][i + 1] |= (!rock[i + 1]) & dp[1][i];
		dp[1][i + 2]  |= (!rock[i + 2]) & dp[1][i];
	}
	dp[2][B] = 1;
	for(int i = B ; i <= n ; i++){
		dp[2][i + 1] |= (!rock[i + 1]) & dp[2][i];
		dp[2][i + 2] |= (!rock[i + 2]) & dp[2][i];
	}
	dp[1][n + 1] = dp[1][n + 2] = dp[2][n + 1] = dp[2][n + 2] = 0;
	rock[0] = rock[n + 1] = rock[n + 2] = 1;
	if(!(dp[2][D]&&dp[1][C]))
		ret("No");
    
    if(C < D){
        cout <<"Yes";
		return 0;
	}
	for(int i = 2 ; i + 1 <= n ; i++){
		if(!rock[i]&&!rock[i + 1]&&!rock[i - 1]&&dp[1][i - 1]&&dp[2][i]&& i <= D)
			ret("Yes");
	}
	cout <<"No";
	
}


Measured memory_bytes: 1024
from collections import deque, Counter, defaultdict
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math
import bisect
from functools import lru_cache
import itertools

sys.setrecursionlimit(10 ** 8)

M = 10 ** 9 + 7
INF = 10 ** 17


def main():
    N = int(input())
    # QUERYS = [input().split() for _ in range(Q)]
    # H1, M1, H2, M2, K = [int(a) for a in input().split()]
    A = [int(a) for a in input().split()]
    # T1, T2, T3 = [int(a) for a in input().split()]

    if N == 0:
        if A[0] == 1:
            print(1)
        else:
            print(-1)
        return

    if A[0] != 0:
        print(-1)
        return

    s = []
    t = 0
    for a in reversed(A):
        s.append(t)
        t += a
    s = list(reversed(s))

    res = 1
    nodes = 1

    for i in range(1, N + 1):
        max_nodes = nodes * 2
        nokori = s[i]
        leafs = A[i]
        if leafs > max_nodes:
            print(-1)
            return
        not_leafs = min(max_nodes - leafs, nokori)
        res += not_leafs + leafs
        nodes = not_leafs
    print(res)


if __name__ == "__main__":
    main()


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

string s;
string t;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    cin >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if(s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;

    
}


Measured memory_bytes: 256
n = int(input())
a  = list(map(int, input().split()))

flg = True
cnt = 0

while(flg):
  for i in range(n):
    if a[i] % 2 != 0:
      flg = False
    else:
      a[i] /= 2
  if flg:
    cnt += 1
print(cnt)
    

Measured memory_bytes: 3060
#include <iostream>
#include <bits/stdc++.h>
#include <sstream>
#define PI 3.14159265358979323846264338327950L
#define ll long long
using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    float n;
    cin >> n;
    cout << (ceil(n/1000)*1000)-n;
    return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <vector>
using namespace std;
 
class Dice{
public:
    long r[6];
    Dice(){};
    void roll(long a, long b, long c, long d){swap(r[a], r[b]);swap(r[b], r[c]);swap(r[c], r[d]);}
    void spin(char c){if (c == 'W') roll(0, 2, 5, 3);else roll(0, 1, 5, 4);}
};
 
int main() {
    bool ans = 0;
    int n;
    cin >> n;
    vector<Dice> D(n);
    for (int i = 0; i < n ; i++) for (int j = 0; j < 6; j++) cin >> D[i].r[j];
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            char SWS[8]={"NNNWNNN"};
            for (int k = 0; k < 8; k++){
                if (D[i].r[1] == D[j].r[1]) break;
                D[j].spin(SWS[k]);
            }
            for (int k = 0; k < 4; k++){
                if (D[i].r[0] == D[j].r[0]){
                    if (D[i].r[1] == D[j].r[1] && D[i].r[2] == D[j].r[2] && D[i].r[3]==D[j].r[3] && D[i].r[4] == D[j].r[4] && D[i].r[5] == D[j].r[5])
                        ans = 1;
                }
                D[j].spin('W');
            }
        }
    }
    if (ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1196
N = int(input())
if (1 <= N) and (N < 2):
    print(1)
elif (2 <= N) and (N < 4):
    print(2)
elif (4 <= N) and (N < 8):
    print(4)
elif (8 <= N) and (N < 16):
    print(8)
elif (16 <= N) and (N < 32):
    print(16)
elif (32 <= N) and (N < 64):
    print(32)
else:
    print(64)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
typedef long long ll;
ll a,b,c;
int main(void){
    cin>>a>>b>>c;
    for(int i=0;i<c;i++){
        if(i%2==0){
            if(a%2==1)a--;
            b+=a/2;
            a-=a/2;
        }
        else{
            if(b%2==1)b--;
            a+=b/2;
            b-=b/2;
        }
    }
    cout<<a<<" "<<b<<endl;
}


Measured memory_bytes: 256
<?php
//ワーシャルフロイド（全点対最短路問題）
//スタート地点１つに対してゴールが２つ。流れるものは水
//故に、単純に $cost[$s][$g1] + $cost[$s][$g2] とするとWA
//スタート〜ある点までは合流道。ある点〜それぞれのゴールまでは二股に分かれて進むイメージ
//また、有向グラフ（一方通行）なので注意。
//と言ってもむしろ$cost[$b][$a] = $cost[$a][$b]というコピーが不要になるので楽。


$file_handle = fopen('php://stdin', "r");
//$file_handle = fopen('aoj2005_in.txt', "r");


function warshall_floyd($cost) {
	global $n;

	for ($i = 1; $i <= $n; ++$i) {
	    for ($j = 1; $j <= $n; ++$j) {
	        for ($k = 1; $k <= $n; ++$k) {
	        	//INFだったらスルー。これで劇的に早くなる。
	        	if ($cost[$j][$i]===INF || $cost[$i][$k]===INF) continue;
	            // j -> kへ行くのにiを経由した方が良いかどうか(cost)
	            $via = $cost[$j][$i] + $cost[$i][$k];
	            if ($via < $cost[$j][$k]) {
	                $cost[$j][$k] = $via;
	            }
	        }
	    }
	}
	return $cost;
}


while(1){
	//ファイル読み込み
	$info = trim(fgets($file_handle));
	$explode = explode(' ', $info);
	$n = $explode[0]; $m = $explode[1]; $s = $explode[2]; $g1 = $explode[3]; $g2 = $explode[4];
	//終了条件
	if ($n==0) break;
	
	//初期化
	$cost = array();

	//ワーシャルフロイド準備。
	for ($i=1; $i<=$n; ++$i){
		for ($j=1; $j<=$n; ++$j){
			if ($i === $j){
				$cost[$i][$i] = 0;
			} else {
				$cost[$i][$j] = INF;
			}
		}
	}

	//辺の情報を格納
	for ($i=1; $i<=$m; ++$i){
		$info2 = trim(fgets($file_handle));
		$explode = explode(' ', $info2);
		$a = $explode[0]; $b = $explode[1]; $c = $explode[2];
		$cost[$a][$b] = $c;
	}

	//探索。先に全点対最短路を求めておく必要がある
	$cost = warshall_floyd($cost);
	
	//最小値計算
	$min = INF;
	for($i=1; $i<=$n; ++$i){
		//どこで分岐するのが最も総コストが低いか比較
		$via = $cost[$s][$i] + $cost[$i][$g1] + $cost[$i][$g2];
		$min = min($min, $via);
	}
	
	//出力
	echo $min;
	echo PHP_EOL;
}

fclose($file_handle);

Measured memory_bytes: 9868
#[int(x)-1 for x in input().split()]
s= input()
K=int(input())
def can_change_to_a(st,remains):
    if ord('z')+1 - ord(st) <= remains:
        return True
    return False

s_ans = list(s)
for i,ch in enumerate(s):
    if ch=='a':
        continue
    if K >= ord('z')+1-ord(ch):
        K -= ord('z')+1-ord(ch)
        s_ans[i]='a'

s_ans[-1]= chr(  (ord(s_ans[-1])-ord('a')+K )%26 + ord('a'))

print(''.join(s_ans))

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

int main(){
  int n;
  int count1=0;
  int count2=0;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<30;i++){
    count1=0;
    for(int j=0;j<n;j++){
      if(a[j]%2==0){
        a[j]=a[j]/2;
        count1++;
      }else{
        break;
      }
    }
    if(count1==n){
      count2++;
    }else{
      break;
    }
  }
  cout << count2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;
int main(void){
    int N,M;
    cin >> N >> M;
    vector<vector<int>> edge(N, vector<int>(0));
    vector<int> pass1(0);
    vector<int> pass2(0);
    vector<bool> used(N);
    for(int i = 0; i < N; i++){
        used.at(i) = 0;
    }
    
    
    for(int i = 0; i < M; i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        edge.at(a).push_back(b);
        edge.at(b).push_back(a);
        if(i == 0){
            pass1.push_back(a);
            pass2.push_back(b);
            used.at(a) = 1;
            used.at(b) = 1;
        }
    }
    
    
    
    
    int cnt = 0;
    while(1){
        cnt++;
        bool l = 0;
        int a = pass1.at(pass1.size()-1);
        for(int i = 0; i < edge.at(a).size(); i++){
            if( used.at( edge.at(a).at(i) ) == 0 ){
                pass1.push_back(edge.at(a).at(i));
                used.at( edge.at(a).at(i) ) = 1;
                l = 1;
                break;
            }
        }
        if(l == 1)continue;
        
        int b = pass2.at(pass2.size()-1);
        for(int i = 0; i < edge.at(b).size(); i++){
            if( used.at( edge.at(b).at(i) ) == 0 ){
                pass2.push_back(edge.at(b).at(i));
                used.at( edge.at(b).at(i) ) = 1;
                l = 1;
                break;
            }
        }
        if(l == 0){
            break;
        }
    }
    
    cout << pass1.size() + pass2.size() << endl;
    
    for(int i = 0; i < pass2.size(); i++){
        cout << pass2.at( pass2.size() - 1 - i   ) + 1 << " ";
    }
    
    for(int i = 0; i < pass1.size(); i++){
        if(i != pass1.size()-1){
            cout << pass1.at(i) + 1 << " ";
        }else{
            cout << pass1.at(i) + 1;
        }
    }
}


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

long long N, K;
vector<long long> H;

int main(){
	cin >> N >> K;
	for(long long i = 0; i < N; i++){
		long long h;
		cin >> h;
		H.push_back(h);
	}
	sort(H.begin(), H.end());
	long long mini = INT_MAX;

	for(long long i = 0; i <= N-K; i++){
		mini = min(mini, abs(H[i] - H[i+K-1]));
	}
	cout << mini << endl;

}



Measured memory_bytes: 1400
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>

int main() {

    char s[100001];
    scanf("%s", s);

    for (int i = 0; i<strlen(s); i+=2) {
        printf("%c", s[i]);
    }

    return 0;

}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int pre = -999;
  rep(i,n){
    if (pre <= a[i] - 1){
      pre = a[i] - 1;
    } else if (pre <= a[i]){
      pre = a[i];
    } else {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(void)
{
	int a,b,c,x;
	scanf("%d %d %d",&a, &b, &c);
	if(a > b){
		x = a;
		a = b;
		b = x;
	}if(b > c){
		x = b;
		b = c;
		c = x;
	}if(a > b){
		x = a;
		a = b;
		b = x;
	}printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    ll x=0;
    for(ll i=0;i<n;i++)
    {
    	cin>>arr[i];
    	x=x^arr[i];
    }
    for(ll i=0;i<n;i++)
    {
    	ll val=x^arr[i];
    	cout<<val<<" ";
    }
    
    
	return 0;
}

Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c;cin>>a>>b>>c;
  if(a%2==0||b%2==0||c%2==0)cout << 0 << endl;
  else cout << min({a*b,b*c,c*a}) << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main{
    public static void main(String[] args)throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        double r = Double.parseDouble(br.readLine());
        
        double b = Math.PI * r * r;
        double c = 2 * Math.PI * r;
        
        System.out.printf("%.5f %.5f\n", b, c);
    }
}

Measured memory_bytes: 24696
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <stack>
 
template<class T>
class UnionFindTree{
public:
    UnionFindTree(const T N){
        tree = std::vector<T>(N);
        for(T i=0; i<N; ++i){
            tree[i] = i;
        }
    }

    T root(const T idx){
        T tmp = idx;
        std::stack<T> stack;
        while(tree[tmp] != tmp){
            stack.push(tmp);
            tmp = tree[tmp];
        }
        while(!stack.empty()){
            tree[stack.top()] = tmp;
            stack.pop();
        }
        return tmp;
    }

    void merge(const T idx1, const T idx2){
        tree[root(idx1)] = root(idx2);
    }

    bool same(const T idx1, const T idx2){
        return root(idx1) == root(idx2);
    }

private:
    std::vector<T> tree;
};



int main(int argc, char *argv[]){
  int N;
  std::cin >> N;
  std::vector<long int>A(N);
  for(auto &a : A){
    std::cin >> a;
  }
  std::vector<int>AIdx(N);
  std::iota(AIdx.begin(),AIdx.end(),0);
  std::sort(AIdx.begin(),AIdx.end(),
    [&A](const auto &lhs, const auto &rhs){
      return A[lhs] > A[rhs] || (A[lhs] == A[rhs] && lhs < rhs);
    });

  std::set<int> set;

  UnionFindTree<int> tree(N);
  for(const auto &idx : AIdx){
    auto pIter = set.upper_bound(idx);
    if(pIter != set.end()){
      tree.merge(*pIter, idx);
      set.erase(*pIter);
    }
    set.emplace(idx);
  }
  std::vector<int> isRoot(N+1,0);
  for(int i=0; i<N+1; ++i){
    isRoot[tree.root(i)] = 1;
  }
  int nColor = 0;
  for(int i=0; i<N+1; ++i){
    nColor += isRoot[i];
  }
  std::cout << nColor << std::endl;
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { string S;
  cin >> S;
  int Q;
  cin >> Q;
  deque<char> s{};
  REP(i, S.size()) s.push_back(S[i]);
  bool tenti = false;
  REP(i, Q) { int u;
    cin >> u;
    if(u==1){
      tenti = !tenti;
    }else{
      int f;
      char c;
      cin >> f >> c;
      if(f==1){
          if(!tenti){
            s.push_front(c);
          }else{
            s.push_back(c);
          }
      }else{
        if (tenti) {
          s.push_front(c);
        } else {
          s.push_back(c);
        }
      }
    }
  }
  if (tenti) reverse(s.begin(), s.end());
  while(!s.empty()){
    cout << s.front();
    s.pop_front();
  }
  cout << endl;
}

Measured memory_bytes: 896
import sys
import numpy as np 
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

n = int(sys.stdin.readline().rstrip())
A = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(n, n)

def main():
    B = floyd_warshall(csr_matrix(A), directed=False).astype(np.float64)
    if np.any(B < A):
        return -1
        
    np.fill_diagonal(B, np.inf)
    
    for v in range(n-1):
        for u in range(v+1, n):
            detours = B[v] + B[u]
            if np.any(detours == B[v, u]):
                A[v, u] = A[u, v] = 0
                
    return np.sum(A) // 2

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 28712
def calc(w, h):
	v = float('inf')
	a = w * h
	for i in range(1, h):
		h_a = w*i
		h_b = (h - i)//2*w
		h_c = a - h_a - h_b
		h_max = max(h_a, h_b, h_c)
		h_min = min(h_a, h_b, h_c)
		v = min(v, h_max - h_min)
		v_b = w//2*(h-i)
		v_c = a - h_a - v_b
		v_max = max(h_a, v_b, v_c)
		v_min = min(h_a, v_b, v_c)
		v = min(v, v_max - v_min)
	return v

def resolve():
	h, w = map(int, input().split())
	print(min(calc(h, w), calc(w, h)))
resolve()

Measured memory_bytes: 41196
// AOJ 0023
#include<iostream>
#include<cmath>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const long double EPS = 1e-14;

long double sq(long double x) {
  return x * x;
}

long double abs(long double x) {
  return (x > 0 ? x : -x);
}
/*
bool eq(long double x, long double y) {
  return abs(x - y) < EPS;
}*/

long double dist(long double xa, long double ya, long double xb, long double yb) {
  return sq(xa - xb) + sq(ya - yb);
}

int main() {
  int n;
  cin >> n;
  REP(i, n) {
    long double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;

    long double d = sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
    
    if (ra - rb > d + EPS) {
      cout << 2 << endl;
    } else if (rb - ra > d + EPS) {
      cout << -2 << endl;
    } else if (d > ra + rb + EPS) {
      cout << 0 << endl;
    } else {
      cout << 1 << endl;
    }
  }
}

Measured memory_bytes: 1232
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    vector<long long> A(3);
    rep(i, 3)cin >> A[i];
    sort(A.begin(), A.end());
    long long D=A[0]*A[1];
    cout << (A[0] % 2 == 0 || A[1] % 2 == 0 || A[2] % 2 == 0 ? 0 : D) << endl;
}

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

int main()
{
	int n;	cin >> n;
	int mx = 0, mn = 1e9 + 5;
	for(int i = 0; i < n; i ++) 
	{
		int x;	cin >> x;
		mx = max(x, mx);
		mn = min(x, mn);
	}
	cout << mx - mn << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
    int main(){
        int N;
            cin >> N;
        vector<int> l(N);
        vector<int> r(N);
        int x = 0;
            for(int i = 0; i < N; i++){
                cin >> l.at(i) >> r.at(i);
                    x += r.at(i) - l.at(i) + 1;
            }
                cout << x;
    }


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

using namespace std;

double distance( double y1, double x1, double y2, double x2){
  return sqrt( (y1 - y2) * (y1 - y2) + (x1 - x2) * (x1 - x2));
}
int main(){
  int q;
  cin >> q;
  while(q--){
    double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    double d = distance( ya, xa, yb, xb);

    int ret = 1;
    if( d > ra + rb) ret = 0;
    if( d + rb < ra) ret = 2;
    else if( d + ra < rb) ret = -2;

    cout << ret << endl;
  }
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n,d;
  cin>>d>>n;
  int ans=0;
 if(n!=100){
   ans=pow(100,d)*n; 
 }
  else{
    ans=pow(100,d)*(n+1); 
  }
  cout<<ans<<endl;
}




Measured memory_bytes: 3808
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

typedef pair<int, int> II;

int main(int argc, char *argv[]) {
	int n, m, y;
	cin >> n >> m;
	vector<int> p(m), s(m);
	vector<vector<II>> v(n + 1);
	for (int i = 0; i < m; ++i) {
		cin >> p[i] >> y;
		v[p[i]].push_back(II(y, i));
	}
	for (int i = 1; i <= n; ++i) {
		sort(v[i].begin(), v[i].end());
		for (int j = 0; j < (int)v[i].size(); ++j) {
			s[v[i][j].second] = j + 1;
		}
	}
	for (int i = 0; i < m; ++i) {
		printf("%06d%06d\n", p[i], s[i]);
	}
	return 0;
}


Measured memory_bytes: 7808
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue(優先度付きキュー)：最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;
/*ビットxにi番目のフラグが立っているかどうか
if(x & (1 << i))
↑ a << b == a*pow(b,2)
/*{0, 1, ..., n-1} の部分集合の全探索
for (int bit = 0; bit < (1 << n); ++bit)
*/

int main(){
  int H,W;  cin >> H >> W;
  int h,w;  cin >> h >> w;
  cout << (H-h)*(W-w);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int n;
	cin>>n;
	vector<int> p(n);
	rep(i,0,n) cin>>p[i];
	
	int res=0;
	rep(i,1,n-1) {
		if ((p[i-1]<p[i] && p[i]<p[i+1]) ||
			(p[i+1]<p[i] && p[i]<p[i-1])) res++;
	}
	cout<<res<<"\n";
}


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

struct UnionFind
{
    vector<int> par; //par[i]:iの親の番号

    //初めは全てが根であるとして初期化する
    UnionFind(int N): par(N)
    {
        for (int i=0; i<N; i++) par[i]=i;
    }

    int root(int x)
    {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main()
{
    int V, E;
    cin >> V >> E;
    vector<vector<int>> G(E, vector<int>(2));
    priority_queue<vector<int>, vector<vector<int>> ,greater<vector<int>>> W;
    for (int i=0; i<E; i++)
    {
        vector<int> w(3);
        cin >> w[1] >> w[2] >> w[0];
        W.push(w);
    }
    UnionFind tree(V);
    int answer = 0;
    while(!W.empty())
    {
        vector<int> w = W.top();
        W.pop();
        if (!tree.same(w[1], w[2]))
        {
            tree.unite(w[1], w[2]); 
            answer+=w[0];
        }
    }
    cout << answer << endl;
}


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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)
//ユークリッドの互除法
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

//素数判定
bool issosu(ll n){
    bool is=true;
    if(n==2)return true;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            is=false;
            break;
        }
    }
    return is;
}



int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    ll A,B,N,ans=0;
    cin >>A>>B;
    N=gcd(A,B);

//Nの約数探し
//vector<ll> divisors;
for (ll i = 1; i * i <= N; i++) {
    if (N % i) continue;
    if(issosu(i))ans++;
    //divisors.push_back(i);
    if (i * i != N && issosu(N/i)) ans++; //divisors.push_back(N / i);
}

    
    cout << ans <<endl;
    return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define pb push_back
#define ms(v,x) memset(v,x,sizeof(v))
#define ff first
#define ss second
#define td(v) v.begin(),v.end()
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
using namespace std;

void solve(){
	ll x;
	cin >> x;
	int years = 0;
	ll val = 100;
	while(val < x){
		val += val/100;
		years++;
	}
	cout << years << endl;
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
    int t=1,l=1;
   	//cin >> t;
    while(t--){
    	solve();
    }    
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;

//typedef
//------------------------------------------
typedef long long LL;
typedef unsigned long long ULL;


//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())

//repetition
//------------------------------------------
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)


LL binarySearch(LL n)
{
	LL left = 0;
	LL right = n;
	LL leftSquare = 0;
	LL rightSquare = n * n;

	while (leftSquare <= rightSquare)
	{
		LL mid = (left + right) / 2;
		LL midSquare = mid * mid;

		if (midSquare == n) {
			return mid;
		}
		else if (midSquare > n)
		{
			right = mid - 1;
			rightSquare = right * right;
		}
		else {
			left = mid + 1;
			leftSquare = left * left;
		}
	}

	return -1;

}

bool calcEuclideanDistance(vector<int>& a, vector<int>& b)
{
	if (a.size() != b.size())
	{
		exit(1);
	}

	int dim = a.size();
	LL dist = 0;
	REP(dim) {
		dist += ((a[i] - b[i]) * (a[i] - b[i]));
	}
	LL ans = binarySearch(dist);

	if (ans == -1)
		return false;

	return true;
}

int main()
{
	int N, D;
	cin >> N >> D;

	vector<vector<int>> X(N, vector<int>(D, 1));

	int input;
	REP(N) {
		REPj(D){
			cin >> input;
			X[i][j] = input;
		}
	}

	int ans = 0;
	REP(N) {
		REPinitj(i+1, N) {
			if (calcEuclideanDistance(X[i], X[j]))
			{
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


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


int main(){
    int n;scanf("%d",&n);
    double b=0;
    for(int i=0;i<n;i++){
        int c;scanf("%d",&c);
        b += 1.0/c;
    }
    printf("%.12f\n",1.0/b);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int ans = 0;
  rep(i, n) {
    if (i < n-1 && s[i] == 'R' && s[i+1] == 'R') ans++;
    else if (i > 0 && s[i] == 'L' && s[i-1] == 'L') ans++;
  }
  ans = min(n-1, ans + 2 * k);
  cout << ans << '\n';  
  return 0;
}

Measured memory_bytes: 3716
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
using namespace std;
#define N 1000005
#define MOD 2
#define INF 0x3f3f3f3f
#define LL long long
int n,num[N],fac[N],ans,fans;
char s[N];
int rd()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1; c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	return f*x;
}
int Abs(int x)
{
	if(x>=0) return x;
	return -x;
}
int ksm(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1) res=1ll*res*a%MOD;
		a=1ll*a*a%MOD;
		b>>=1;
	}
	return res;
}
int cnt(int x)
{
	int res=0;
	while(!(x&1))
		x>>=1,res++;
	return res;
}
int f(int a,int b)
{
	return fac[b]-fac[a]-fac[b-a];
}
int main()
{
	n=rd();
	scanf("%s",s+1);
	fac[0]=0;
	for(int i=1;i<=n;i++)
		fac[i]=fac[i-1]+cnt(i);
	bool flag=0;
	for(int i=1;i<n;i++)
	{
		num[i]=Abs(s[i]-s[i+1]);
		if(num[i]==1)
		{
			flag=1;
			ans^=f(n-1-i,n-2)==0;
		}
		if(num[i]==2)
			fans^=f(n-1-i,n-2)==0;
	}
	if(flag)
	{
		printf("%d\n",ans);
		return 0;
	}
	printf("%d\n",fans*2);
	return 0;
}

Measured memory_bytes: 8960
#include<iostream>
#define debug(x) std::cout<<x<<std::endl;
#define fori(i,a,z) for(i=a;i<=z;i++)
int main(){
  int i=0,A=0,B=0;
  std::cin>>A>>B;
  if(A>12){
      std::cout<<B;
  }
    else if(6>A){
        std::cout<<"0";
    }
    else{
        std::cout<<B/2;
    }
  return 0;
}

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

int main() {
  int H, W;

  cin >> H >> W;

  vector<string> a(H);

  for (int i = 0; i < H; i++) {
    cin >> a.at(i);
  }

  for (int i = 0; i < W + 2; i++) {
    cout << '#';
  }
  cout << endl;

  for (int i = 0; i < H; i++) {
    cout << '#' + a.at(i) + '#' << endl;
  }

  for (int i = 0; i < W + 2; i++) {
    cout << '#';
  }
  cout << endl;
}


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

#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

int main() {
  cpp_int a, b;
  cin >> a >> b;
  cout << (a > b ? "GREATER" : (a == b ? "EQUAL" : "LESS")) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define uint unsigned int
#define INF 1000000000
using namespace std;


int main() {
	// Zero detection if exists ans = sum of all absolute element values
	int N;
	cin >> N;
	vector<int> vec(N);
	pair<ll, ll> min(-1,-INF -1);
	bool zero_dec = 0;
	int odd_even_minus = 0;
	ll ans = 0;

	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);

		if (!vec.at(i)) {
			zero_dec = 1;
		}

		vec.at(i) < 0 ? odd_even_minus += 1 : odd_even_minus += 0;
		ans += abs(vec.at(i));
		
		
		if (i == 0) {
			if (abs(vec.at(0)) < abs(min.second)) {
				min.first = 0;
				min.second = abs(vec.at(0));
			}
		}
		else {
			if (abs(vec.at(i)) < abs(min.second)) {
				min.first = i;
				min.second = abs(vec.at(i));
			}

		}
	}

	if (zero_dec == 1 || odd_even_minus % 2 == 0) {
		cout << ans << endl;
	}
	else {
		ans -= 2 * min.second;
		cout << ans << endl;
	}
	
}

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

int main() {
  int n;
  cin>>n;
  vector<int> a(3*n);
  rep(i,3*n){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  ll ans=0;
  for(int i=n; i<3*n; i+=2){
    ans+=a[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1408
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

V, E = MAP()
stw = [LIST() for _ in range(E)]

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = list(range(n))
        self.ranks = [0 for _ in range(n)]
 
    def get_root(self, x):
        if self.parents[x] == x:
            return x
        self.parents[x] = self.get_root(self.parents[x])
        return self.parents[x]
 
    def merge(self, x, y):
        x = self.get_root(x)
        y = self.get_root(y)
        if x != y:
            if self.ranks[x] < self.ranks[y]:
                self.parents[x] = y
            else:
                self.parents[y] = x
                if self.ranks[x] == self.ranks[y]:
                    self.ranks[x] += 1
 
def kruskal(n_nodes, edges):
    edges.sort(key=itemgetter(2))
    res = []
    uf = UnionFind(n_nodes)
    for e in edges:
        if uf.get_root(e[0]) != uf.get_root(e[1]):
            res.append(e)
            uf.merge(e[0], e[1])
    return res

edges = []
for s, t, w in stw:
	edges.append((s, t, w))

tree = kruskal(V, edges)
ans = sum(x[2] for x in tree)
print(ans)



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

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

    string S;
    cin >> S;

    int r = 0, b = 0;
    for (int i=0; i<(int)S.size(); ++i) {
        if (S[i] == '0') {
            r ++;
        } else {
            b ++;
        }
    }

    cout << min(r, b) * 2 << endl;

    return 0;
}

Measured memory_bytes: 512