akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll =long long;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
#define leftunique(a) {sort((a).begin(),(a).end());(a).erase(unique((a).begin(),(a).end()),(a).end());}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

const int INF = 1001001001;

int main()
{
	int n, x, y;
	cin >> n >> x >> y;
	--x, --y;
	vector<int> ans(n);
	rep(sv,n) { // 始点の頂点を全部試す
		vector<int> dist(n,INF);
		queue<int> q;
		auto push = [&](int v, int d) {
			if (dist[v] != INF) return;
			dist[v] = d;
			q.push(v);
		};
		push(sv,0);
		while (!q.empty()) {
			int v = q.front(); q.pop();
			int d =dist[v];
			if (v-1 >= 0)push(v-1, d+1);
			if (v+1 < n) push(v+1, d+1);
			if (v == x) push(y,d+1);
			if (v == y) push(x,d+1);
		}
		rep(i,n) ans[dist[i]] ++;
	}
	rep(i,n) ans[i] /= 2;
	For(i,1,n){
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,a;
  vector<int> v;
  map<int,int> d;
  int q,b,c,sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    sum+=a;
    d[a]++;
    if(d[a]==1) v.push_back(a);
  }
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>b>>c;
    sum+=((c-b)*d[b]);
    d[c]+=d[b];
    d[b]=0;
    cout<<sum<<"\n";
  }
}

Measured memory_bytes: 9428
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;
use std::str::FromStr;
use std::io::stdin;

fn main(){
    input! {
    h:usize,
    }
    for i in 0..h{
        print!("ACL")
    }
    println!("")
}














/// UnionFind構造体
pub struct UnionFindTree {
    /// 頂点`i`の親を格納する配列
    parents: Vec<usize>,
    /// 頂点`i`が親であるときのその木の頂点数
    sizes: Vec<usize>,
    /// 重み付きUnionFindを使う際の重みの格納配列
    weights: Vec<isize>,
    /// 頂点`i`が属する木がループを持っているかどうか
    has_loops: Vec<bool>,
}

impl UnionFindTree {
    /// UnionFind初期化
    /// 計算量はO(n)
    pub fn new(n: usize) -> Self {
        let parents = (0..n).collect();
        let sizes = vec![1; n];
        let weights = vec![0; n];
        let has_loops = vec![false; n];
        UnionFindTree {
            parents,
            sizes,
            weights,
            has_loops,
        }
    }

    /// 親を再帰的に求め、途中の計算結果をもとに親の書き換えを行う関数
    /// 計算量はO(a(n)))
    pub fn root(&mut self, x: usize) -> usize {
        if self.parents[x] == x {
            x
        } else {
            let tmp = self.root(self.parents[x]);
            self.weights[x] += self.weights[self.parents[x]];
            self.parents[x] = tmp;
            tmp
        }
    }

    pub fn size(&self, x: usize) -> usize {
        self.sizes[x]
    }

    pub fn has_loop(&self, x: usize) -> bool {
        self.has_loops[x]
    }

    /// 2つの頂点が同じ木に属しているかの判定
    /// `self.root()`を呼び出すため、`&mut self`を引数に取る。そのため、命名に`is_`を使っていない
    /// 計算量はO(a(n))
    pub fn same(&mut self, x: usize, y: usize) -> bool {
        self.root(x) == self.root(y)
    }

    /// 重み付きUnionFindを考える際のUnite関数
    /// 計算量はO(a(n))
    pub fn unite_with_weight(&mut self, x: usize, y: usize, w: isize) {
        let root_x = self.root(x);
        let root_y = self.root(y);

        if self.same(x, y) {
            self.has_loops[root_x] = true;
            self.has_loops[root_y] = true;
        } else if self.sizes[root_x] >= self.sizes[root_y] {
            self.parents[root_y] = root_x;
            self.sizes[root_x] += self.sizes[root_y];
            self.weights[root_y] = -w - self.weights[y] + self.weights[x];
        } else {
            self.parents[root_x] = root_y;
            self.sizes[root_y] += self.sizes[root_x];
            self.weights[root_x] = w + self.weights[y] - self.weights[x];
        }
    }

    /// 重みを考慮しない際のUnite関数
    /// 重みとして0を与えているだけであり、計算量は同じくO(a(n))
    pub fn unite(&mut self, x: usize, y: usize) {
        self.unite_with_weight(x, y, 0);
    }

    /// 重み付きUnionFindにおいて、2つの頂点の距離を返す関数
    /// 2つの頂点が同じ木に属していない場合は`None`を返す
    pub fn diff(&mut self, x: usize, y: usize) -> Option<isize> {
        if self.same(x, y) {
            Some(self.weights[x] - self.weights[y])
        } else {
            None
        }
    }

    pub fn is_parent(&self, x: usize) -> bool {
        self.parents[x] == x
    }

    pub fn union_max(&self) -> usize{
        let max: &usize =self.sizes.iter().max().unwrap();
        *max
    }
}

Measured memory_bytes: 2132
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=1e9+7;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=2e5+5;
int x[N],n,res,cnt;
int main(){
	scanf("%d",&n),res=1;
	fp(i,1,n)scanf("%d",&x[i]);
	fp(i,1,n){
		if(x[i]<(cnt<<1|1))res=mul(res,cnt+1);
		else ++cnt;
	}
	fp(i,1,cnt)res=mul(res,i);
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 640
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main(){
	int n;
	cin >> n;
	vector<double> geko;
	double now = 0;
	REP(i, n) {
		double a;
		cin >> a;
		geko.push_back(a);
		now += a;
	}
	now /= (double)n;
	int itr = geko.size() - 1;
	for (int i = geko.size() - 2; i >= 0; --i) {
		if (abs(now - geko[i]) < abs(now - geko[itr]) + eps) {
			itr = i;
		}
	}
	cout << itr << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

template<class T> inline bool chmax(T& a, T b) { if (a <= b) { a = b; return true; } else return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; }

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

	int n, q; cin >> n >> q;
	vector<vector<ll>> graph(n, vector<ll>());

	vector<int> cnter(n,0);

	rep(i, n - 1) {
		int a, b;
		cin >> a >> b; 
		a--; b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	rep(i, q) {
		int p,x; cin >> p >> x; p--;
		cnter[p] += x;
	}

	vector<ll> ans(n);
	stack<pair<int,ll>> st;
	st.push({-1,0});
	while (!st.empty()) {
		ll par = st.top().first, v = st.top().second; 
		st.pop();

		ans[v] += cnter[v];
		if (par >= 0) ans[v] += ans[par];

		for (int w : graph[v]) {
			if (w != par) st.push({v,w});
		}
	}

	for(int a : ans) cout << a << " "; cout << endl;
}

Measured memory_bytes: 20336
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#define all(x) (x).begin(),(x).end()

void solve(){

}
ll getOpeCnt(vector<int> a, int n){
    ll ans = 0;
    ll sum = a[0];
    if (a[0] > 0){
        for (int i = 1; i < n; i++){
            sum += a[i];
            if (i % 2 == 1){
                if (sum >= 0){
                    int tmp = a[i];
                    a[i] -= sum + 1;
                    ans += sum + 1;
                    sum -= tmp;
                    sum += a[i];
                }
            } else {
                if (sum <= 0){
                    int tmp = a[i];
                    a[i] += (-1)*sum + 1;
                    ans += (-1)*sum + 1;
                    sum -= tmp;
                    sum+= a[i];
                }
            }
        }
    } else {
        for (int i = 1; i < n; i++){
            sum += a[i];
            if (i % 2 == 1){
                if (sum <= 0){
                    int tmp = a[i];
                    a[i] += (-1)*sum + 1;
                    ans += (-1)*sum + 1;
                    sum -= tmp;
                    sum+= a[i];
                }
            } else {
                if (sum >= 0){
                    int tmp = a[i];
                    a[i] -= sum + 1;
                    ans += sum + 1;
                    sum -= tmp;
                    sum += a[i];
                }
            }
        }
    }
    return ans;
}
int main(){
    int n;
    vector<int> a, a2;
    
    cin >> n;
    int x;
    for (int i = 0; i < n; i++){
        cin >> x;
        a.push_back(x);
    }

    ll ans1 = 0, ans2 = 0;
    if (a[0] > 0){
        ans1 = getOpeCnt(a,n);
        int num = a[0] + 1;
        a[0] -= a[0] + 1;
        ans2 = getOpeCnt(a,n) + num;
    } else if (a[0] < 0){
        ans1 = getOpeCnt(a,n);
        int num = (-1) * a[0] + 1;
        a[0] += num;
        ans2 = getOpeCnt(a,n) + num;
    } else {
        a[0] = 1;
        ans1 = getOpeCnt(a,n) + 1;
        a[0] = -1;
        ans2 = getOpeCnt(a,n) + 1;
    }
    if (ans1 < ans2){
        cout << ans1 << endl;
    } else {
        cout << ans2 << endl;
    }
}


Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int testCases = 1;
   // cin >> testCases;
    
    while(testCases--)
    {
        long double d,t,s;
        cin >> d >> t >> s;
        
        long double res = d / s;
        //cout << res << '\n';
        
        if(res <= t)
            cout << "Yes";
        else
            cout << "No";
        
        cout << '\n';
    }
    
}


Measured memory_bytes: 3724
#include <iostream>
using namespace std;
int main(){
	int N,L;
	int sum,Fmin,Fmax;
	cin >> N >> L;
	sum = N*(N+1)/2+L*N-N;
	Fmin = L;
	Fmax = L+N-1;
	
	if (Fmin>0) {
		sum -= Fmin;
	}
	else if (Fmax<0) {
		sum -= Fmax;
    }   
	cout << sum << "\n";	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
#define Pb push_back
#define  FI first
#define  SE second
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define IOS ios::sync_with_stdio(false)
#define DEBUG cout<<endl<<"DEBUG"<<endl; 
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF =0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
LL qpow(LL a,LL b){LL s=1;while(b>0){if(b&1)s=s*a%mod;a=a*a%mod;b>>=1;}return s;}
LL gcd(LL a,LL b) {return b?gcd(b,a%b):a;}
int dr[2][4] = {1,-1,0,0,0,0,-1,1};
typedef pair<int,int> P;
const int maxn = 1e5+100;
int main(void)
{
    int n;
    cin>>n;
    map<int,int > ma1,ma2;
    for(int i = 1;i <= n; ++i){
    	int v;
    	scanf("%d",&v);
    	if(i&1) ma1[v]++;
    	else ma2[v]++;
    }
    vector<P> vec1,vec2;
    for(auto c: ma1){
    	vec1.push_back(P(c.second,c.FI));
    }
    for(auto c: ma2){
    	vec2.push_back(P(c.second,c.FI));
    }
    sort(vec1.begin(),vec1.end(),greater<P>());
    sort(vec2.begin(),vec2.end(),greater<P>());
    if(vec1.size() < vec2.size())
      swap(vec1,vec2);
    if(vec1[0].SE != vec2[0].SE){
       cout<<n-vec1[0].FI-vec2[0].FI<<endl;
    }
    else if(vec1.size() > 1){
    	if(vec2.size() == 1)
    	  {
    	  	int M = vec1[1].FI+n/2;
    	  	cout<<n-M<<endl;
    	  }
    	else
  			{
  				int M = max(vec1[0].FI+vec2[1].FI,vec1[1].FI+vec2[0].FI);
  				cout<<n-M<<endl;
  			}
    }
    else
    	cout<<n/2<<endl;
   return 0;
}

Measured memory_bytes: 6136
#include <iostream>
#define LL long long int

using namespace std;

LL getRange(LL s1, LL s2, LL s3)
{
	LL min, max;
	if(s1 < s2){
		min = s1, max = s2;
	}else{
		min = s2, max = s1;
	}
	if(s3 < min) min = s3;
	if(max < s3) max = s3;
	
	return max - min;
}

int main(void)
{
	LL H, W;
	LL diff, min_diff = 10000000000;
	
	cin >> H >> W;
	
	LL curH, curW;
	LL size1, size2, size3;
	
	for(LL i = 1; i < H; i++){
		curH = H - i;
		curW = W;
		size1 = i * W;
		
		if( (curH%2) * (curW%2) == 0){
			size2 = size3 = curH * curW / 2;
		}else{
			if(curH > curW){
				size2 = curH/2 * curW;
				size3 = (curH/2 + 1) * curW;
			}else{
				size2 = curW/2 * curH;
				size3 = (curW/2 + 1) * curH;
			}
		}
		diff = getRange(size1, size2, size3);
		if(diff < min_diff) min_diff = diff;
	}
	
	for(LL i = 1; i < W; i++){
		curH = H;
		curW = W - i;
		size1 = i * H;
		
		if( (curH%2) * (curW%2) == 0){
			size2 = size3 = curH * curW / 2;
		}else{
			if(curH > curW){
				size2 = curH/2 * curW;
				size3 = (curH/2 + 1) * curW;
			}else{
				size2 = curW/2 * curH;
				size3 = (curW/2 + 1) * curH;
			}
		}
		diff = getRange(size1, size2, size3);
		if(diff < min_diff) min_diff = diff;
	}
	
	cout << min_diff;
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [int(input()) for _ in range(m)]
ans = [0 for _ in range(n)]
for i in range(n):
    for j in range(m):
        ans[i] += a[i][j]*b[j]
print("\n".join(map(str, ans)))

Measured memory_bytes: 8008
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1e9 + 7;

int main() {
    int rev = 0;
    string head, tail;
    string s;
    int q;
    cin >> s >> q;
    int t, f;
    char c;
    for (int i = 0; i < q; i++) {
        cin >> t;
        if (t == 1) {
            rev++;
        } else {
            cin >> f >> c;
            if (f == 1) {
                if (rev % 2) {
                    tail += c;
                } else {
                    head += c;
                }
            } else {
                if (rev % 2) {
                    head += c;
                } else {
                    tail += c;
                }
            }
        }
    }
    string ans;
    if (rev % 2) {
        reverse(tail.begin(), tail.end());
        reverse(s.begin(), s.end());
        ans = tail + s + head;
    } else {
        reverse(head.begin(), head.end());
        ans = head + s + tail;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4228
//
// Created by Tetsuya Shiota on 2019-01-27.
//

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include<cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include<bitset>

#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define FOR(it,o)  for(__typeof((o).begin()) it=(o).begin(); it!=(o).end(); ++it)
#define dbg(x) cout << __LINE__ << ' ' << #x << " = " << (x) << endl


typedef long long ll;

using namespace std;

//ハマったらチェックリスト見ろ!!

class Dish{
public:
    ll diff, a, b;
    bool operator<(const Dish &d)const{
        return diff < d.diff;
    }
};

int main(){
    ll N;
    cin >> N;
    vector<Dish> V(N);
    for(auto& v : V){
        cin >> v.a >> v.b;
        v.diff = v.a+v.b;
    }
    sort(ALL(V));
    reverse(ALL(V));
    ll A = 0, B = 0;
    int a = 0, b = N-1;
    rep(i, N){
        cerr << V[i].a << ' ' << V[i].b <<endl;
        if(i %2){
            B += V[i].b;
        }else{
            A += V[i].a;
        }
        cerr << "now: " << A <<' ' << B <<endl;
    }
    cout << A - B  <<endl;

    return 0;
}

Measured memory_bytes: 2560
use proconio::input;

fn main() {
    input! {
        _n: usize,
        m: usize,
        mut ab: [(usize, usize); m],
    }

    ab.sort_by_key(|&(_, b)| b);
    let mut ans = 0;

    let mut index = 0;
    for (a, b) in ab {
        if index <= a {
            index = b;
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 5560
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  vector<int>city(n);
  rep(i,n)cin>>city[i];
  int l,q;
  cin>>l>>q;
  vector<vector<int>>db(n,vector<int>(20,n));
  int r=0;
  rep(i,n)
  {
    while(r+1<n&&city[r+1]<=city[i]+l)r++;
    db[i][0]=r;
  }
  rep(i,19)
  {
    rep(j,n)
    {
      db[j][i+1]=db[db[j][i]][i];
    }
  }
  auto check=[&](int s,int t,int day){
    rep(i,20)
    {
      if(day&(1<<i))
      {
        s=db[s][i];
      }
    }
    return s>=t;
  };
  rep(i,q)
  {
    int a,b;
    cin>>a>>b;
    a--;b--;
    if(a>b)swap(a,b);
    int ok=n,ng=0;
    while(ok-ng>1)
    {
      int mid=(ok+ng)/2;
      if(check(a,b,mid))ok=mid;
      else ng=mid;
    }
    cout<<ok<<"\n";

  }
  cout<<flush;


  return 0;

}


Measured memory_bytes: 12928
import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(long N, long[] A, long[] B, long[] C) {
    A = [long.init] ~ A;
    B = [long.init] ~ B;
    C = [long.init] ~ C;

    long ans;
    size_t lastMeal;
    foreach (i; 1 .. cast(size_t) N + 1) {
        size_t nowMeal = cast(size_t) A[i];
        ans += B[nowMeal];
        if (lastMeal + 1 == nowMeal)
            ans += C[lastMeal];
        lastMeal = nowMeal;
    }
    return ans;
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long N;
    N = input.front.to!long;
    input.popFront;

    long[] A = new long[](cast(size_t) (N));
    foreach (i; 0 .. cast(size_t) (N)) {
        A[i] = input.front.to!long;
        input.popFront;
    }

    long[] B = new long[](cast(size_t) (N));
    foreach (i; 0 .. cast(size_t) (N)) {
        B[i] = input.front.to!long;
        input.popFront;
    }

    long[] C = new long[](cast(size_t) (N-1));
    foreach (i; 0 .. cast(size_t) (N-1)) {
        C[i] = input.front.to!long;
        input.popFront;
    }

    static if (is(ReturnType!solve == void))
        solve(N, A, B, C);
    else
        solve(N, A, B, C).writeln;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
        int N,A,B;
        scanf("%d",&N);

        scanf("%d",&A);
        scanf("%d",&B);
        if(N*A>B){
                printf("%d",B);
        }
        else{
                printf("%d",N*A);
        }
        return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner s=new Scanner(System.in);
      	int n=s.nextInt();
      	int a=s.nextInt();
      	 int b=s.nextInt();
      int min=Integer.min(n*a,b);
      System.out.println(min);
    }
}

Measured memory_bytes: 23764
import std;

void main() {
    int n; scan(n);
    int ans = 0;
    bool[string] d;
    foreach (_; 0..n) {
        string s = read!string;
        d[s] = true;
    }
    writeln(d.keys.length);
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


Measured memory_bytes: 27656
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64, i64> P;
#define rep(i, s, e) for (int i = (s); i <= (e); i++)

int n;
map<int, int> mp;

int geti(int num) {
  if (!mp.count(num)) {
    int temp = mp.size();
    mp[num] = temp;
    return temp;
  }

  return mp[num];
}

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

  vector<int> ans;

  vector<int> cou(mp.size() + 1000, 0);
  int kind = 0;

  for (int i = 0; i < n; i++) {
    {
      if (cou[a[i]] == 0) {
        kind++;
      }
      cou[a[i]]++;
      if (cou[a[i]] == 0) {
        kind--;
      }
    }
    {
      if (cou[a[n - i - 1]] == 0) {
        kind++;
      }
      cou[a[n - i - 1]]--;
      if (cou[a[n - i - 1]] == 0) {
        kind--;
      }
    }

    if (kind == 0) {
      ans.push_back(i + 1);
    }
  }
  if (ans.size() > 0) {
    cout << ans[0];
    for (int i = 1; i < ans.size(); i++) {
      cout << " " << ans[i];
    }
    cout << endl;
  }
}



Measured memory_bytes: 5764
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

struct Node
{
  long value{-1};
  std::vector<Node*> peers;
};

struct Edge
{
  Node* n1;
  Node* n2;
};

template<typename It>
void f(Node& node, It& c_it, It c_end)
{
  node.value = *(c_it++);
  for (auto peer_it = node.peers.rbegin(); peer_it != node.peers.rend(); ++peer_it) {
    if ((*peer_it)->value < 0) {
      f(**peer_it, c_it, c_end);
    }
  }
  node.peers.clear();
}

long solve(
    std::vector<Node>& nodes,
    const std::vector<Edge>& edges,
    std::vector<long>& cs)
{
  std::sort(cs.begin(), cs.end());
  auto c_it = cs.rbegin();
  f(nodes.front(), c_it, cs.rend());
  return std::accumulate(edges.begin(), edges.end(), 0l,
      [](long sum, const Edge& e) { return sum + std::min(e.n1->value, e.n2->value); });
}

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

  std::vector<Node> nodes(n);
  std::vector<Edge> edges(n - 1);
  for (auto& e : edges) {
    int n1, n2;
    std::cin >> n1 >> n2;
    e.n1 = &nodes[n1 - 1];
    e.n2 = &nodes[n2 - 1];
    e.n1->peers.push_back(e.n2);
    e.n2->peers.push_back(e.n1);
  }

  std::vector<long> cs(n);
  for (auto& c : cs) {
    std::cin >> c;
  }

  std::cout << solve(nodes, edges, cs) << std::endl;
  std::cout << nodes[0].value;
  for (int i = 1; i < n; ++i) {
    std::cout << " " << nodes[i].value;
  }
  std::cout << std::endl;
}


Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
          var N = Input.ScanLong();
          var H = Input.ScanLongArray();
          
          long[] MinH = new long[N];
          long[] MaxH = new long[N];
          
          MinH[0] = H[0]-1;
          MaxH[0] = H[0];
          
          for(int i=1; i<N; i++){
            if(H[i] < MinH[i-1]) { Out("No"); return; }
            MinH[i] = Math.Max(MinH[i-1], H[i]-1);
            MaxH[i] = H[i];
          }
          Out("Yes");
        }
      
        static public void Out(object s) { Console.WriteLine(s); }
    }
    
    static class Input {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(); }
    }

    static class MyMath {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 27996
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  cout << "square1001" << endl;
}


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


int main() {
    int N; cin >> N;
    vector<long long> V(N);
    for(int i=0;i<N;i++){
        cin >> V.at(i);
    }
    sort(V.begin(),V.end());
    long long now = V.at(0);
    string ans="YES";
    for(int i=1;i<N;i++){
        if(now==V.at(i)){
            ans="NO";
            break;
        }
        else now=V.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#define mem(a,b) memset(a,b,sizeof (a))
#define gcd(a,b) __gcd(a,b)
#define all(a) a.begin(),a.end()
#define in(a) insert(a)
#define sz() size()
#define endl '\n'
#define pb push_back
using namespace std;
typedef long long ll;
const int maxn=100010;
const ll inf=1e18;
const ll mod=998244353;
const double pi=3.14159265358979;
const double ep=0.0;
ll a[maxn];
int main(){
    int n;
    cin>>n;
    ll sum=0;
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
        sum^=a[i];
    }
    ll ans=0,b=0;
    vector<int> vis(n);
    for(int j= 61;j>=0;j--)
    {
        if(sum&(1ll<<j))
            for (int i=0;i<n;i++)
                if(a[i]&(1ll<<j))
                    a[i]^=1ll<<j;
        for (int i=0;i<n;i++)
        {
            if(vis[i])
                continue;
            if(a[i]&(1ll<<j))
            {
                vis[i]=1;
                for (int k=0;k<n;k++)
                {
                    if(i==k)
                        continue;
                    if(a[k]&(1ll<<j))
                    a[k]^=a[i];
                }
                break;
            }
        }
    }
    sort(a,a+n);
    reverse(a,a+n);
    n=min(65,n);
    int t=40000;
    while (t--)
    {
        for (int i=0;i<n;i++)
            vis[i]=0;
        b=0;
        for(int j=61;j>=0;j--)
        {
            if(b&(1ll<<j))
                continue;
            for (int i=0;i<n;i++)
                if(!vis[i]&&a[i]&(1ll<<j))
                {
                    b^=a[i];
                    vis[i]=1;
                    break;
                }
        }
        ans=max(ans,b+(b^sum));
        random_shuffle(a, a+n);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1408
import java.io.BufferedReader

fun main() {
    val mod = 1_000_000_007L
    val br = System.`in`.bufferedReader()
    val n = br.readInt()
    val m = br.readInt()
    val dif = (m - n).toLong()
    val dp = LongArray(n + 1)
    dp[0] = 1
    dp[1] = dif
    var f = m.toLong()
    for (x in 2..n) {
        f *= (m - x + 1)
        f %= mod
        dp[x] = (dif * dp[x - 1] + (x - 1) * (dp[x - 2] + dp[x - 1])) % mod
    }
    print((dp.last() * f) % mod)
}

private const val SPACE_INT = ' '.toInt()
private const val ZERO_INT = '0'.toInt()
private const val NL_INT = '\n'.toInt()

private fun BufferedReader.readInt(): Int {
    var ret = read()
    while (ret <= SPACE_INT) {
        ret = read()
    }
    val neg = ret == '-'.toInt()
    if (neg) {
        ret = read()
    }
    ret -= ZERO_INT
    var read = read()
    while (read >= ZERO_INT) {
        ret *= 10
        ret += read - ZERO_INT
        read = read()
    }

    while (read <= SPACE_INT && read != -1 && read != NL_INT) {
        mark(1)
        read = read()
    }
    if (read > SPACE_INT) {
        reset()
    }
    return if (neg) -ret else ret
}

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

std::string s;

int main() {
    std::cin >> s;
    if (s[0] != 'A') {
        std::cout << "WA" << std::endl;
        return 0;
    }
    int w;
    int c = 0;
    for (int i = 2; i <= s.size()-2; i++) {
        if (s[i] == 'C') {
            c++;
            w = i;
        }
    }
    if (c != 1) {
        std::cout << "WA" << std::endl;
        return 0;
    }
    bool match = true;
    for (int i = 0; i < s.size(); i++) {
        if (i == 0 || i == w) {
            continue;
        }
        if ((int)s[i] < 97 || (int)s[i] > 122) {
            match = false;
        }
    }
    if (match)
        std::cout << "AC" << std::endl;
    else
        std::cout << "WA" << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#define MAX 100000007
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

ll ans=0;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int A,B;
  cin >> A >> B;
  cout << (A-1)*(B-1) << endl;
  return 0;

  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    vector<int> A;
    int ans = 0;
    rep (i, 0, 3) {
        int in; cin >> in;
        A.push_back(in);
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    rep (i, 0, 2) ans += (A[i] - A[i+1]);
    cout << ans << endl;
}

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

int main(){
    int n;
    cin>>n;
    
    map<int,int> a;
    int c;
    rep(i,n){
        cin>>c;
        a[c]++;
    }
    
    int amax = a.rbegin()->first;
    
    vi sieve(amax+1,0);
    /*
    if(a.count(1)){
        if(a[1]==1)
            cout << 1 << endl;
        else
            cout << 0 << endl;
        return 0;
    }
    */
    int ans = 0;
    
    for(auto p: a){
        int x = p.first;
        //if(sieve[x])continue;
        int count = p.second;
        //if(count==1)ans++;
        
        //sieve[x] = 1;
        for(int i=x; i<=amax; i += x){
            sieve[i] += count;
        }
    }
    
    for(auto p: a){
        int x = p.first;
        if(sieve[x] == 1)
            ans++;
    }
    
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 16252
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int hsum[300030] = {};
int wsum[300030] = {};
int hm[300030] = {};
int wm[300030] = {};
vector<vector<int>> hv(300030);
int main() {
	int h, w,m;
	cin >> h >> w>> m;
	vector<pair<int, int>>p;
	for (int i = 0; i < m; i++) {
		int h1, w1;
		cin >> h1 >> w1;
		hsum[h1]++;
		wsum[w1]++;
		p.push_back(make_pair(h1, w1));
		hv[h1].push_back(w1);
	}

	int hmax = 0;
	for (int i = 1; i <= h; i++) {
		hmax = max(hmax, hsum[i]);
	}
	int wmax = 0;
	for (int i = 1; i <= w; i++) {
		wmax = max(wmax, wsum[i]);
	}
	int whon = 0;
	vector<int> ha;
	for (int i = 1; i <= h; i++) {
		if (hsum[i] == hmax) {
			ha.push_back(i);
		}
	}
	for (int i = 1; i <= w; i++) {
		if (wsum[i] == wmax) {
			whon++;
			wm[i]++;
		}
	}
	for (int i = 0; i < ha.size(); i++) {
		int aa = 0;
		for (auto iter : hv[ha[i]]) {
			if (1 == wm[iter]) {
				aa++;
			}
		}
		if (aa < whon) {
			cout << hmax + wmax;
			return 0;
		}
	}
	cout << hmax + wmax - 1;
}


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

int c2i[128];

void init(){
  c2i['I'] = 1;
  c2i['V'] = 5;
  c2i['X'] = 10;
  c2i['L'] = 50;
  c2i['C'] = 100;
  c2i['D'] = 500;
  c2i['M'] = 1000;
}

int main() {
  string str;

  init();
  
  while(cin >> str) {
    int n = str.size();
    int sum = 0;
    for(int i = 0; i < n-1; i++) {
      sum += c2i[str[i]] * ( (c2i[str[i]] < c2i[str[i+1]]) ? -1 : 1);
    }
    sum += c2i[str[n-1]];
    
    cout << sum << endl;
  }

  return 0;
}

Measured memory_bytes: 1180
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include<bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
// mp::cpp_int


int solve( ){
 

 int a,b,n;
 cin>>a>>b>>n;

for(int i=min(a,b);i>=1;i--)
{   
  if(a%i==0&&b%i==0)n--;

  if(n==0){cout<<i;return 0;}



}



return 0;
}
int main()
{  int t=1;
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
  
   
  
  clock_t time_req;

    // Without using pow function
    time_req = clock();
    
//cin>>t;
   while(t--)
     {solve();
     }

         time_req = clock() - time_req;
   // cout << "Processor time taken is "
      // << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;


    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> s(201);
  
  for (int i = 0; i < N; i++){
    cin >> s.at(i);
  }
  
  
  int res = 0;
 
  
  while (1){
    bool odd_exist = false;
    
    for (int i = 0; i < N; i++) {
      if (s.at(i) % 2 == 1){
        odd_exist = true;
      }
    }
    
    if (odd_exist) break;
    
    for (int i = 0; i < N; i++) {
      s.at(i) = s.at(i) / 2;
    }
    
    res++;
  }
  
  cout << res << endl;
  
}

Measured memory_bytes: 256
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using INT=mp::cpp_int;
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
INT LCM(INT x,INT y){
  INT z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
INT modinv(INT a, INT m) {
    INT b = m, u = 1, v = 0;
    while (b) {
        INT t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main() {
  cout << fixed << setprecision(30);
  ll n;
  cin>>n;
  vec v(n);
  loop(i,n)cin>>v[i];
  map<ll,ll> fir;
  map<ll,ll> sec;
  for(ll i=0;i<n;i+=2){
    fir[v[i]]++;
  }
  for(ll i=1;i<n;i+=2){
    sec[v[i]]++;
  }
  ll fircheck=-1,seccheck=-1,firmax=-1,secmax=-1;
  vec FIR(100001);
  vec SEC(100001);
  Loop(i,1,100001){
    ll f=fircheck,s=seccheck;
    FIR[i]=fir[i];
    SEC[i]=sec[i];
    fircheck=max(fircheck,fir[i]);
    seccheck=max(seccheck,sec[i]);
    if(f!=fircheck)firmax=i;
    if(s!=seccheck)secmax=i;
  }
  sort(all(FIR));
  sort(all(SEC));
  if(firmax!=secmax)putout(n-FIR[100000]-SEC[100000]);
  else{
    putout(min(n-FIR[100000]-SEC[99999],n-FIR[99999]-SEC[100000]));
  }
}

Measured memory_bytes: 15104
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<map>
#include<math.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
	int n,A,ans;
  	double h=0;
  	cin >> n;
  	vector<int> a(n);
	rep(i,n) cin >> a[i];
  	sort(a.begin(),a.end());
  	rep(i,n){
      h+=a[i];
    }
  	h/=n;
  	rep(i,n){
      ans+=(a[i]-round(h))*(a[i]-round(h));
    }
  
  	cout << ans;
  	
	  
  
    return 0;
}


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

int a[82][82], b[82][82], d[82][82];
bool dp[82][82][6503];

int main()
{
    int h, w;
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++) cin >> a[i][j];
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++) cin >> b[i][j];
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++) d[i][j] = abs(a[i][j] - b[i][j]);
    }
    dp[0][0][d[0][0]] = true;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            for(int k = 0; k <= 6400; k++){
                if(!dp[i][j][k]) continue;
                dp[i + 1][j][k + d[i + 1][j]] = true;
                dp[i + 1][j][abs(k - d[i + 1][j])] = true;
                dp[i][j + 1][k + d[i][j + 1]] = true;
                dp[i][j + 1][abs(k - d[i][j + 1])] = true;
            }
        }
    }
    for(int k = 0; k <= 6400; k++){
        if(dp[h - 1][w - 1][k]){
            cout << k << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 45204
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    double w,h, x,y;
    cin>>w>>h>>x>>y;
    cout <<setprecision(15)<<w*h/2<<" "<<(x==w/2&&y==h/2?1:0)<<"\n";
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

Measured memory_bytes: 256