akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

int main() {
	cin >> n >> k;
	vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0));
	comb(v);
	for (ll i = 0; i <= k-1; i++) {
		cout << v[n - k + 1][i+1]%ma * v[k - 1][i]%ma << endl;
	}
}



Measured memory_bytes: 31616
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e12
using namespace std;
typedef long long ll;

ll abs(ll a,ll b){return (b>a)?b-a:a-b;}

ll manhattan(int a,int b,int c,int d){
	return abs(a,c)+abs(b,d);
}

int main(){
	ll n,m;
	cin>>n>>m;
	ll a[n],b[n];
	ll c[m],d[m];
	rep(i,n)cin>>a[i]>>b[i];
	rep(i,m)cin>>c[i]>>d[i];
	rep(i,n){
		ll num=INF;
		int ans;
		rep(j,m){
			if(num>manhattan(a[i],b[i],c[j],d[j])){
				ans=j+1;
				num=manhattan(a[i],b[i],c[j],d[j]);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
int main() {
	int n;
	cin >> n;

	vector<double>vec(n);
	rep(i, n) {
		cin >> vec[i];
	}

	double sum = 0;
	vector<double>ans(n);

	for (int i = 0; i < n; i++) {
		ans[i] = 1 / vec[i];
	}
	
	rep(i, n) {
		sum = ans[i] + sum;
	}

	cout << 1 / sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int i,a,b,l,m,n,o,co=0;
	scanf("%d%d",&a,&b);
	for(i=a;i<=b;i++){
		int o=i%10,n=(i%100-o)/10;
		int l=i/10000,m=(i/1000)%10;
		if(l==o&&m==n)co++;
	}
	printf("%d\n",co);
	return 0;
}

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

using namespace std;

#define endl '\n'

typedef long long ll;

const ll mod = 1e9 + 7;
const int maxn = 21;

ll dp[maxn][1 << maxn];
int a[maxn][maxn], n;

ll solve(int i, int mask){
	if(i == n)
		return (mask ? 0 : 1);
	if(dp[i][mask] != -1)
		return dp[i][mask];
	ll ans = 0;
	for(int j = 0; j < n; j++){
		if(a[i][j] == 1 && (mask & (1 << j))){
			ans += solve(i + 1, mask ^ (1 << j));
			ans %= mod;
		}
	}
	return dp[i][mask] = ans;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			cin >> a[i][j];
	
	memset(dp, -1, sizeof(dp));
	
	cout << solve(0, (1 << n) - 1) << endl;
	
	return 0;
}

Measured memory_bytes: 344448
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin >> N;
  char num = N.at(N.size() - 1);
  if (num == '2' || num == '4' || num == '5' || num == '7' || num == '9') {
    cout << "hon" << endl;
  } else if (num == '3') {
    cout << "bon" << endl;
  } else {
    cout << "pon" << endl;
  }
}

Measured memory_bytes: 3596
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let b: String = read();

    let ans = match b.as_str() {
        "A" => "T",
        "C" => "G",
        "T" => "A",
        "G" => "C",
        _ => unreachable!(),
    };

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
// atcoder/edpc/Z/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

template<typename T>
struct ConvexHullTrick {
  deque<pair<T, T>> q;
  ConvexHullTrick() {}
  void append(T a, T b) // DESC a, aX+b
  {
    if (q.size()) {
      assert(q.back().first >= a);
    }
    q.push_back({a, b});
    while (3 <= q.size() && check()) {
      q[q.size() - 2] = q[q.size() - 1];
      q.pop_back();
    }
    return ;
  }
  bool check(void)
  {
    pair<T, T> a = q[q.size() - 3];
    pair<T, T> b = q[q.size() - 2];
    pair<T, T> c = q[q.size() - 1];
    assert(a.first >= b.first);
    assert(b.first >= c.first);
    return (b.first - a.first) * (c.second - b.second) >= (b.second - a.second) * (c.first - b.first);
  }
  T eval(T x, pair<T, T> p)
  {
    return p.first * x + p.second;
  }
  T query(T x) // ASC x
  {
    while (2 <= q.size() && eval(x, q[0]) >= eval(x, q[1])) {
      q.pop_front();
    }
    return eval(x, q.front());
  }
};

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  lli c;
  while (cin >> n >> c) {
    vector<lli> h(n);
    cin >> h;
    ConvexHullTrick<lli> cht;
    for (int i = 0; i < n; ++i) {
      lli x = i ? cht.query(h[i]) + h[i] * h[i] + c : 0;
      cht.append(-2 * h[i], h[i] * h[i] + x);
    }
    cout << cht.query(h.back()) + h.back() * h.back() + c << endl;
  }

  return 0;
}


Measured memory_bytes: 4096
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int age = Integer.parseInt(scan.next());
		if (age == 1) {
			System.out.println("Hello World");
		} else {
			int A = Integer.parseInt(scan.next());
			int B = Integer.parseInt(scan.next());
			System.out.println(A + B);
		}
	}
}


Measured memory_bytes: 21588
A, B, C, D = map(int, input().split())

ans = ''
for i in range(200):
    if i%2 == 0:
        C -= B
    else:
        A -= D
    if A <= 0:
        ans = 'No'
        break
    elif C <= 0:
        ans = 'Yes'
        break

print(ans)

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;
typedef vector<vl> v2;
typedef vector<v2> v3;
typedef vector<v3> v4;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll n,m;
priority_queue<ld> a;
ll ans;

int main(){
  cin >> n >> m;
  for(ll i = 0;i < n;i++){
    ld x;
    cin >> x;
    a.push(x);
  }
  for(ll i = 0;i < m;i++){
    ll x = a.top();
    a.pop();
    x /= 2;
    a.push(x);
  }
  for(ll i = 0;i < n;i++){
    ans += floor(a.top());
    a.pop();
  }
  cout << ans << endl;

}


Measured memory_bytes: 2420
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define intt long long
#define pii pair<intt,intt>

#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define IO ios_base::sync_with_stdio(false);cin.tie();
#define endl '\n'

const intt max4 = 10004;
const intt maxx = 100005;
const intt max6 = 1000006;
const intt max7 = 10000007;

const intt lg4 = 13;
const intt lg5 = 17;
const intt lg6 = 20;

const intt INF = 2LL * 1000000000;

/***************/

intt powmod (intt a, intt b, intt mod) {
    intt res = 1;
    a %= mod;
    for (; b; b >>= 1) {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

intt gcd (intt a, intt b) {
    while (b > 0) {
        intt t = a % b;
        a = b, b = t;
    }
    return a;
}

intt lcm (intt a, intt b) {
    return (a / gcd (a, b)) * b;
}

intt is_prime (intt n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (intt i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/**************************/

intt p[maxx];
int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    IO;
    intt n;
    cin >> n;
    for (intt i = 1; i <= n; i++)
        cin >> p[i];
    intt res = 0;
    for (intt i = 1; i <= n; i++) {
        if (i == 1 && p[i] == i) {
            res ++;
            swap (p[i], p[i + 1]);
        }
        else if (i == n && p[i] == i) {
            res ++;
            swap (p[i], p[i - 1]);
        } else if (p[i] == i) {
            res ++;
            swap (p[i], p[i + 1]);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
using System;
using System.Linq;

namespace ProgramingStydying
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = input[0];
            var a = input[1];
            var b = input[2];

            var ans = 0;

            for(int M = 1; M <= n; M++)
            {
                var m = M;
                var sum = 0;
                while(m > 0)
                {
                    sum += m % 10;
                    m /= 10;
                }
                if (sum >= a && sum <= b)
                {
                    ans += M;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 28196
#include<cstdio>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<iostream>
using namespace std;

int w,h;
bool dp[51][51][51][51];
int fie[2][51][51];
int sx[2],sy[2];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int rev[4]={-1,1,-1,1};

class data{
public:
	int x1,y1,x2,y2;
	data(){}
	data(int ix1,int iy1,int ix2,int iy2){
		x1=ix1;
		y1=iy1;
		x2=ix2;
		y2=iy2;
	}
};

bool bfs(){
	memset(dp,false,sizeof(dp));
	queue<data> que;
	que.push(data(sx[0],sy[0],sx[1],sy[1]));
	while(que.size()){
		data q=que.front();
		que.pop();
		dp[q.x1][q.y1][q.x2][q.y2]=true;
		if(fie[0][q.x1][q.y1]+fie[1][q.x2][q.y2]==2)return true;
		if(fie[0][q.x1][q.y1]+fie[1][q.x2][q.y2]==1)continue;
		for(int i=0;i<4;i++){
			int nx1=q.x1+dx[i],ny1=q.y1+dy[i];
			int nx2=q.x2+dx[i]*rev[i],ny2=q.y2+dy[i]*rev[i];
			if(nx1>=0 && nx1<w && ny1>=0 && ny1<h);
			else nx1-=dx[i],ny1-=dy[i];
			if(nx2>=0 && nx2<w && ny2>=0 && ny2<h);
			else nx2-=dx[i]*rev[i],ny2-=dy[i]*rev[i];
			if(fie[0][nx1][ny1]==-1){
					nx1-=dx[i];
					ny1-=dy[i];
				}
			if(fie[1][nx2][ny2]==-1){
				nx2-=dx[i]*rev[i];
				ny2-=dy[i]*rev[i];
			}
			if(!dp[nx1][ny1][nx2][ny2]){
				dp[nx1][ny1][nx2][ny2]=true;
				que.push(data(nx1,ny1,nx2,ny2));
				//printf("%d %d %d %d\n",nx1,ny1,nx2,ny2);
			}
		}
	}
	return false;
}

int main(void){
	while(1){
		scanf("%d %d",&w,&h);
		if(w+h==0)break;
		for(int i=0;i<h;i++){
			string str[2];
			cin >> str[0] >> str[1];
			for(int k=0;k<2;k++){
				for(int j=0;j<w;j++){
					if(str[k][j]=='.')fie[k][j][i]=0;
					if(str[k][j]=='#')fie[k][j][i]=-1;
					if(str[k][j]=='%')fie[k][j][i]=1;
					if(str[k][j]=='R'){
						fie[k][j][i]=0;
						sx[k]=j,sy[k]=i;
					}
					if(str[k][j]=='L'){
						fie[k][j][i]=0;
						sx[k]=j,sy[k]=i;
					}
				}
			}
		}
		printf("%s\n",bfs()?"Yes":"No");
	}
	return 0;
}

Measured memory_bytes: 8788
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

const ll MOD = 1e9+7;

ll neg(ll x) {
  return MOD - x;
}

int main() {
  ios::sync_with_stdio(false);
  VI nm(2);
  cin >> nm[0] >> nm[1];
  vector<VL> ls(2);
  REP(i,0,2) {
    REP(j,0,nm[i]) {
      ll x;
      cin >> x;
      ls[i].push_back(x);
    }
  }
  VL sum(2);
  REP(i,0,2) {
    sum[i] = ls[i][nm[i]-1];
  }
  VL res(2, 0);
  REP(i,0,2) {
    for(int j=nm[i]-2; j>=0; j--) {
      res[i] += (sum[i] + neg((nm[i] - j - 1) * ls[i][j]) % MOD) % MOD;
      res[i] %= MOD;
      sum[i] = (sum[i] + ls[i][j]) % MOD;
    }
  }
  cout << ((res[0] * res[1]) % MOD + MOD) % MOD << endl;
  return 0;
}


Measured memory_bytes: 2548
let step (am, bm, cm) (a, b, c) =
    let am' = a + max bm cm in
    let bm' = b + max am cm in
    let cm' = c + max am bm in
    (am', bm', cm')

let () =
    let n = Scanf.scanf "%d " (fun n -> n) in
    let rec loop n (am, bm, cm) =
        if n = 0 then max am (max bm cm)
        else
            Scanf.scanf "%d %d %d " @@ fun a b c ->
                loop (n - 1) (step (am, bm, cm) (a, b, c))
    in Printf.printf "%d\n" (loop n (0, 0, 0))


Measured memory_bytes: 8320
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % M;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	double r; cin >> r;
	cout << setprecision(10) << 2 * PI * r << endl;
}

Measured memory_bytes: 10968
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1<<20)

int n, q;

struct RSQ
{
	int N;
	ll gt;
	ll a[N_SIZE];
	ll seg[N_SIZE * 2];
	void init(int n){
		N = n;
		REP(i, 30) {
			if ((1 << i) >= N) {
				gt = (1 << i) - 1;
				break;
			}
		}
		REP(i, N) {
			//cin >> a[i];
			a[i] = 0;
		}
		REP(i, N_SIZE * 2)seg[i] = 0;
		REP(i, N) {
			seg[i + gt] = a[i];
		}
	}
	void update(int k, int x) {
		k += gt;
		seg[k] += x;
		while (k) {
			k = (k - 1) / 2;//???????????????
			seg[k] += x;
		}
	}
	ll query(int a, int b, int k, int l, int r) {
		if (r < a || b < l)return 0;
		else if (a <= l&&r <= b)return seg[k];
		else return query(a, b, k * 2 + 1, l, (l + r) / 2)
			+ query(a, b, k * 2 + 2, (l + r) / 2 + 1, r);
	}
	void print() {
		REP(i, 2 * (gt + 1)) {
			cout << i << " " << seg[i] << endl;
		}
	}
};

RSQ rsq;

int main() {
	cin >> n >> q;
	rsq.init(n);
	REP(i, q) {
		ll x, y;
		bool f;
		cin >> f >> x >> y;
		x--;
		if (!f) {
			rsq.update(x, y);
		}
		else {
			y--;
			cout << rsq.query(x, y, 0, 0, rsq.gt) << endl;
		}
	}
}

Measured memory_bytes: 20268
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let a: Vec<u64> = sc.vec(n);
    let xor_sum = a.iter().fold(0, |xor, &a| xor ^ a);
    let mut a = a.into_iter().map(|a| a & !xor_sum).collect::<Vec<_>>();

    let mut rank = 0;
    for pos in (0..62).rev() {
        if let Some(i) = (rank..n).find(|&i| a[i] & (1 << pos) != 0) {
            for j in 0..n {
                if i == j {
                    continue;
                }
                if a[j] & (1 << pos) != 0 {
                    a[j] ^= a[i];
                }
            }
            a.swap(i, rank);
            rank += 1;
        }
    }

    let max = a.into_iter().fold(0, |xor, a| xor ^ a);
    println!("{}", max * 2 + xor_sum);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6396
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////



int main() {
	ll a, b, h;
	cin >> a >> b >> h;
	cout << (a + b)*h / 2;


	system("PAUSE");
}

Measured memory_bytes: 504
n=int(input())
h=list(map(int,input().split()))
dp=[1000000000 for i in range(100010)]
dp[0]=0
for i in range(1,n):
  if i == 1:
    dp[i]=abs(h[i]-h[i-1])
  dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

Measured memory_bytes: 13904
#include <stdio.h>
#include <string.h>
 
int main(){
  char str[256];
  char put[256];
  int  a,b,i,n, length;
     
  scanf("%d ", &n);
     
  while(n--){
    for(a = 0; a < 256; a++)
      str[a] = 0;
     
    fgets(put, sizeof(put), stdin);
         
    length = strlen(put);
         
    for(a = 1; a < 26; a += 2){
      if(a%13==0)
	continue;
      for(b = 0; b < 26; b++){
	for(i = 0; i < length; i++){
	  if(put[i] >= 'a' && put[i] <= 'z')
	    str[i] = ((a * (put[i] - 'a') + b) % 26) + 'a';
	  else
	    str[i] = put[i];
	}
	if(strstr(str,"that")||strstr(str,"this"))
	  break;
      }
      if(b-26)
	break;
    }
    printf("%s", str);
  }
  return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};

int n;
vec<int> v;

bool bin(int key) {
   int left = 0, right = n-1;
   while (left <= right) {
      int mid = (left+right)/2;
      if (key < v[mid]) {
         right = mid - 1;
      } else if (key > v[mid]) {
         left = mid + 1;
      } else {
         return true;
      }
   }
   return false;
}

int main() {
   cin >> n;
   rep (i, 0, n) {
      int x;
      cin >> x;
      v.push_back(x);
   }
   sort(all(v));

   int q;
   cin >> q;
   int cnt = 0;
   rep (i, 0, q) {
      int x;
      cin >> x;
      if (bin(x)) cnt++;
   }
   cout << cnt << endl;

   return 0;
}


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

int main()
{
    int n,y,i=0,k=0,z;
    long long sum=0;
    cin>>n>>y;
    int a[n], b[n];
    while(i<n)
    {
        cin>>a[i]>>b[i];
        i++;
    }
    sort(a,a+n);
    sort(b,b+n);
    i=n-1;
    for(int j=i; j>=0; j--)
    {
        if(a[i]<=b[j])
        {
            sum+=b[j];
            k++;
            if(sum>=y)
            {
                cout<<k;
                return 0;
            }
        }
        else
        {
            break;
        }
    }
    z=(y-sum)/a[i];
    sum+=z*a[i];
    if(sum>=y) cout<<k+z;
    else cout<<k+z+1;

   return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int sumdigit(int n) {
    int s = 0;
    while (n != 0)
    {
        s += n % 10;
        n /= 10;
    }
    return s;
}
int main() {
    int n, a, b, s = 0;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++)
        if (sumdigit(i) >= a && sumdigit(i) <= b) s += i;
    cout << s;
}

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

bool f [100001];
int c [100002];
int N ,L , R ;
int main ()
{
  for (int i =2;i<=100000;i++)
    if (!f[i])
      for (int j=i+i;j<=100000;j+=i)
        f[j]= true;
  for (int i=3;i<=100000;i+=2)
    if (!f[i]&&!f[(i+1)/2])c[i]++;
  for (int i=3;i<=100000;i++)c[i]+=c[i-1];
  cin>>N;
  while (N--)
    {
      cin>>L>>R;
      cout<<c[R]-c[L-1]<<endl;
 }
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <cstdio>
using namespace std;
int main()
{
	int a,b;
	cin >> a >> b;
	if(a >= b){
		cout << "10\n";
	}
	else
	cout << "0\n";
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main()
{
  long long n,mi,mx;
  scanf("%lld%lld%lld",&n,&mi,&mx);
  if (mi>mx||(mi!=mx&&n<=1)||n<1)
  {
    printf("0\n");
    return 0;
  }
  n--;
  printf("%lld\n",(mi+mx*n)-(mx+mi*n)+1);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int i,j,a,b,c[101],d[101],e[102][10001],f=-1;
int main(void)
{
    scanf("%d %d",&a,&b);
    for(i=0;i<=a;i++){
        for(j=0;j<=b;j++){
            e[i][j]=-1;
        }
    }
    for(i=0;i<a;i++){
        scanf("%d %d",&c[i],&d[i]);
    }
    e[0][0]=0;
    for(i=0;i<a;i++){
        for(j=0;j<=b;j++){
            if(e[i][j]!=-1){
            if(e[i][j]+c[i]>e[i+1][j+d[i]] && j+d[i]<=b){
                e[i+1][j+d[i]]=e[i][j]+c[i];
            }
            if(e[i][j]>e[i+1][j]){
                e[i+1][j]=e[i][j];
            }
            }
        }
    }
    for(i=0;i<=a;i++){
        for(j=0;j<=b;j++){
            if(f<e[i][j]){
                f=e[i][j];
            }
        }
    }
    printf("%d\n",f);
    return 0;
}

Measured memory_bytes: 4972
//A
#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const double PI = 2 * acos(0);

int main() {
	int a;
	scanf("%d", &a);
	printf("%d\n", a * (a * a + a + 1));
}

Measured memory_bytes: 3796
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

class cycle_finder
{
public:
	vector<vector<int>> adj;
	vector<int> visit_state;
	vector<int> parent;

	int cycle_start;
	int cycle_end;

	vector<vector<int>> cycle_list;

public:
	cycle_finder(int vertex_count)
		: adj(), visit_state(), parent(), cycle_start(-1), cycle_end(-1), cycle_list()
	{
		adj.assign(vertex_count, vector<int>());
		visit_state.assign(vertex_count, 0);
		parent.assign(vertex_count, -1);
	}

public:
	void process()
	{
		for (int i = 0; i < (int)visit_state.size(); i++)
		{
			if (visit_state[i] == 0 && inner_process(i))
			{
				vector<int> cycle;
				for (int curr = cycle_end; curr != cycle_start; curr = parent[curr])
				{
					visit_state[curr] = 2;
					cycle.push_back(curr);
				}
				visit_state[cycle_start] = 2;
				cycle.push_back(cycle_start);

				reverse(cycle.begin(), cycle.end());

				cycle_list.push_back(cycle);

				break;
			}
		}
	}

	bool inner_process(int curr)
	{
		visit_state[curr] = 1;
		for (int next : adj[curr])
		{
			if (visit_state[next] == 0)
			{
				parent[next] = curr;
				if (inner_process(next))
					return true;
			}
			else if (visit_state[next] == 1)
			{
				cycle_end = curr;
				cycle_start = next;
				return true;
			}
		}
		visit_state[curr] = 2;
		return false;
	}
};

//cycle_finder cf(N);
//cf.adj[u - 1].push_back(v - 1);
//cf.process();
//int ret = cf.cycle_list.size();

const int threshold = 2e5;

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

	long long N, K;
	cin >> N >> K;

	cycle_finder cf(N);

	for (int i = 0; i < N; i++)
	{
		int port;
		cin >> port;

		cf.adj[i].push_back(port - 1);
	}

	cf.process();

	if (K <= threshold)
	{
		int result = 0;
		int curr = 0;
		for (int i = 0; i < K; i++)
		{
			result = cf.adj[curr][0];
			curr = result;
		}

		cout << result + 1;
	}
	else
	{
		int cycle_start = cf.cycle_list[0][0];
		int cycle_size = cf.cycle_list[0].size();

		int before_cycle = 0;
		for (int i = 0; i != cycle_start; i = cf.adj[i][0])
		{
			before_cycle++;
		}

		K -= before_cycle;
		K %= cycle_size;

		int result = cycle_start;
		int curr = cycle_start;
		for (int i = 0; i < K; i++)
		{
			result = cf.adj[curr][0];
			curr = result;
		}

		cout << result + 1;
	}

	return 0;
}


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

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

    vector<int> l(m), r(m);
    for(int i=0; i<m; i++){
        cin >> l[i] >> r[i];
    }

    sort(l.begin(),l.end());
    sort(r.begin(),r.end());

    cout << max(0, r[0] - l[m-1] + 1) << endl;
    return 0;
}

Measured memory_bytes: 1024
import Control.Applicative
import Control.Monad
import Data.List

type Mat = [Vec]
type Vec = [Int]

main :: IO ()
main = do
    [n,m,_] <- readVec
    a <- replicateM n readVec
    b <- replicateM m readVec
    putStr . unlines . map (unwords . map show) $ prodMM a b

readVec :: IO Vec
readVec = map read . words <$> getLine

prodMM :: Mat -> Mat -> Mat
prodMM a b = map (`prodVM` b) a

prodVM :: Vec -> Mat -> Vec
prodVM v m = map (`prodVV` v) (transpose m)

prodVV :: Vec -> Vec -> Int
prodVV u v = sum $ zipWith (*) u v


Measured memory_bytes: 12320
#include <stdio.h>

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

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h=0,w=0;
    cin>>h>>w;
    char a[h][w];
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
        cin>>a[i][j];
    map<int ,int > r,c;
    int f=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++)
        {
            if(a[i][j]!='.')
                {
                    f=1;
                    break;}
        }
        if(f==1){
            f=0;
        }
        else
            r[i]=1;
    }
    f=0;
    for(int i=0;i<w;i++){
        for(int j=0;j<h;j++)
        {
            if(a[j][i]!='.')
                {
                    f=1;
                    break;}
        }
        if(f==1){
            f=0;
        }
        else
            c[i]=1;
    }
    for(int i=0;i<h;i++)
    {
        if(r[i]==1)continue;
        for(int j=0;j<w;j++)
        {
            if(c[j]==1)continue;
            else
            cout<<a[i][j];
        }
        cout<<endl;
    }
}


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

ll N,A,B,C,D;

int main()
{
    scanf("%lld %lld %lld %lld %lld",&N,&A,&B,&C,&D);
    int E=abs(A-B);
    for(int i=0;i<=N-1;++i)
    {
        ll l=i*C-(N-1-i)*D;
        ll r=i*D-(N-1-i)*C;
        if(E>=l &&E <=r)
        {
            printf("YES");
            return 0;
        }
    }

    printf("NO");
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=mod;
    }
    now*=now;
    now%=mod;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n){
  return beki(n,mod-2);
}
void nckinit(ll n){
  kai[0]=1;
  kai[1]=1;
  for(int i=2;i<=n;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=mod;
  }
  gya[n]=gyaku(kai[n]);
  for(int i=n-1;i>=1;i--){
    gya[i]=gya[i+1]*(i+1);
    gya[i]%=mod;
  }
  gya[0]=1;
}
ll nck(ll n,ll k){
  if(k<0)return 0;
  if(k==0||n==k)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=mod;
  ret*=gya[k];
  ret%=mod;
  return ret;
}
ll npk(ll n,ll k){
  if(k<0)return 0;
  if(k==0)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=mod;
  return ret;
}
 
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,k;cin>>n>>k;
    ll h[n];
    vector<ll> v;
    rep(i,0,n){
        cin>>h[i];
        v.push_back(h[i]);
    }
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    map<ll,ll> mp,imp;
  rep(i,0,v.size()){
mp[v[i]]=i+1;
  }
  rep(i,0,n){
imp[mp[h[i]]]=h[i];
h[i]=mp[h[i]];
  }
  ll dp[n+1][302][k+1];
  rep(i,0,n+1)rep(j,0,302)rep(l,0,k+1)dp[i][j][l]=inf;
  dp[0][0][0]=0;
  rep(i,0,n){
    rep(j,0,302){
      rep(l,0,k+1){
        if(dp[i][j][l]==inf)continue;
        if(h[i]>j)dp[i+1][h[i]][l]=min(dp[i+1][h[i]][l],dp[i][j][l]+imp[h[i]]-imp[j]);
        else dp[i+1][h[i]][l]=min(dp[i+1][h[i]][l],dp[i][j][l]);
        if(l<k)dp[i+1][j][l+1]=min(dp[i+1][j][l+1],dp[i][j][l]);
      }
    }
  }
  ll ans=inf;
  rep(i,0,302)rep(j,0,k+1)ans=min(ans,dp[n][i][j]);
  cout<<ans<<endl;
}

Measured memory_bytes: 214016
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;


int main(){
  int n,m,X,Y; cin>>n>>m>>X>>Y;
  vector<int> x(n);
  vector<int> y(m);
  rep(i,n) cin>>x[i];
  rep(i,m) cin>>y[i];

  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  bool w=0;
  for(int i=-100;i<=100;i++){
    if(X<i&&i<=Y&&(x[n-1]<i)&&(i<=y[0])){
      w=1;
      // cout<<i<<endl;
    }
  }
  if(w)
  cout<<"No War"<<endl;
  else
  cout<<"War"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void dk()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
    //dk();
    int n, k;
    cin >> n >> k;
    int val[n], a[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i] >> val[i];
    }
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum += val[i];
    }
    //cout << "deep";
    int dp[n + 1][sum + 1];
    //cout << "deep";
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= sum; j++)
        {
            if (j == 0)
                dp[i][j] = 0;
            else
                dp[i][j] = inf;
        }
    }
    //cout << "deep";
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= sum; j++)
        {
            if (val[i - 1] <= j)
            {
                dp[i][j] = min(dp[i - 1][j], a[i - 1] + dp[i - 1][j - val[i - 1]]);
            }
            else
            {
                dp[i][j] = dp[i - 1][j];
            }
            //cout << dp[i][j] << " ";
        }
        //cout << endl;
    }
    int l = 0;
    for (int i = 1; i <= sum; i++)
    {
        if (dp[n][i] <= k)
        {
            if (i > l)
                l = i;
        }
    }
    cout << l;
    return 0;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N , A , B;
  cin >> N >> A >> B;
 
  if (N * A > B) {
    cout << B << endl;
  }
  else if (N * A < B) {
    cout << N * A << endl;
  }
  else if (N * A == B) {
    cout << N * A << endl;
  }
}

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

int main()
{
  int n,k;cin>>n>>k;
  vector<int> h(n);
  int i;
  for(i=0;i<n;i++)cin>>h.at(i);
  sort(h.begin(),h.end());
  reverse(h.begin(),h.end());
  long long ans=0;
  for(i=k;i<n;i++)ans+=h.at(i);
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<set>
#include<cstdio>
#include<cstdlib>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)

using namespace std;
typedef pair<int,int> ii;

int main()
{
  string a;
  char c;
  while((c = getchar()) != '\n')a += c;

  set<ii> ans;
  rep(i,a.size()+1)
    {
      string v1 = a.substr(0,i);
      string v2 = a.substr(i,a.size()-i);
      if(v1.size() != 1 && v1[0] == '0')continue;
      if(v2.size() != 1 && v2[0] == '0')continue;
      int iv1 = (v1.empty()?0:(atoi)(v1.c_str()));
      int iv2 = (v2.empty()?0:(atoi)(v2.c_str()));
      if((iv1+iv2)%2 || (iv2-iv1)%2)continue;
      int x = (iv1+iv2)/2;
      int y = (iv2-iv1)/2;
      if(!(x >= 0 && y >= 0))continue;

      if(x > y)swap(x,y);
      ans.insert(ii(x,y));
	
    }
  printf("%d\n",ans.size());
  return 0;
}

Measured memory_bytes: 1184
#include<stdio.h>
int A[1000000], n;

/*二分搜索*/
int binarySearch(int key)
{
    int low = 0, high = n; //high指针指向最后一个位置之后
    int mid;
    while (low < high)
    {
        mid = low + (high - low)/2;
        if (A[mid] == key)
            return 1;
        if (A[mid] > key)
            high = mid;
        else
            low = mid + 1;
    }
    return 0;
}

int main()
{
    int q, i, k;
    int cnt = 0;


    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", A+i);
    scanf("%d",&q);

    for (i = 0; i < q; i++)
    {
        scanf("%d", &k);
        cnt += binarySearch(k);
    }

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

    return 0;
}



Measured memory_bytes: 2968
#include <bits/stdc++.h>
using namespace std;
int main() {
    char c;
    cin >> c;
    if (c=='a'||c=='e'||c=='i'||c=='o'||c=='u') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s;
vector<char> c;
void solve(){
    int w;
    cin>>s>>w;
    for(int i=0;i<s.size();i+=w){
        c.push_back(s[i]);
    }
    for(int i=0;i<c.size();i++){
        cout<<c[i];
    }
    cout<<endl;
}
int main(){
    solve();
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Diagnostics.Tracing;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //int n=ReadInt();
            //string[] str = Console.ReadLine().Split(' ');
            string s = Console.ReadLine();
            string t = Console.ReadLine();

            int sl = s.Length;
            int tl = t.Length;

            int ans = tl;

            for(int i=0; i < sl - tl + 1; i++)
            {
                int tmp = 0;
                for(int j = 0; j < tl; j++)
                {
                    if (s[i + j] != t[j]) tmp++;
                }

                if (tmp < ans) ans = tmp;
            }

            Cout(ans);

            //ここまで
        }


        static void Cout(string s)
        {
            Console.WriteLine(s);
            return;
        }

        static void Cout(int n)
        {
            Console.WriteLine(n);
            return;
        }

        static void Cout(long n)
        {
            Console.WriteLine(n);
            return;
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static int[] ReadArray(int n)
        {
            string[] str = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i=0; i < n; i++){ a[i] = int.Parse(str[i]); }
            return a;
        }
        static long[] ReadArray(long n)
        {
            string[] str = Console.ReadLine().Split(' ');
           long[] a = new long[n];
            for (long i = 0; i < n; i++) { a[i] = long.Parse(str[i]); }
            return a;
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int Min(int a, int b)
        {
            if (a < b) return a;
            return b;
        }

        static int Max(int a, int b)
        {
            if (a > b) return a;
            return b;
        }


    }

}


Measured memory_bytes: 25932
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int n,tmp; cin>>n;
    int a[n]={}; rep(i,n) {cin>>tmp;a[tmp]++;}
    int ans=1;

    if(n%2==1 and a[0]==1){
        for(int i=2;i<n;i+=2){
            if(a[i]!=2) ans=0;
            else ans=ans*2%1000000007;
        }
    }else{
        for(int i=1;i<n;i+=2){
            if(a[i]!=2) ans=0;
            else ans=ans*2%1000000007;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <cstdio>
#include <deque>
#include <algorithm>
#include <string>
#include <cstring>

using namespace std;
int n;
long long k;
long long a[100001];
long long b[70][2];
long long d[71];
bool c[71];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cin >> n >> k;
	int s = 0;
	long long t = k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		t = max(t, a[i]);
		for (int j = 0; j < s; j++) {
			if (t & 1) {
				b[j][1] += 1;
			}
			else b[j][0] += 1;
			t /= 2;
		}
	}
	while (t > 0) {
		t /= 2; s += 1;
	}
	for (int i = 0; i < n; i++) {
		t = a[i];
		for (int j = 0; j < s; j++) {
			if (t & 1) {
				b[j][1] += 1;
			}
			else b[j][0] += 1;
			t /= 2;
		}
	}
	long long ans = 1;
	long long cnt = 0;

	priority_queue<pair<long long, pair<long long,int>>> q;
	long long ent = 0;
	long long rr = 0;
	for (int i = 0; i < s; i++) {
		if (b[i][0] > b[i][1]) {
			q.push({ ans * b[i][0],{ans,i} });
		}
		ans *= 2;
	}
	while (!q.empty()) {
		if (q.top().second.first + rr <= k) {
			cnt += q.top().first;
			rr += q.top().second.first;
			c[q.top().second.second] = true;
		}
		q.pop();
	}
	ans = 1;
	for (int i = 0; i < s; i++) {
		if (b[i][0] <= b[i][1]) {
			cnt += ans * b[i][1];
		}
		else if (!c[i]) {
			cnt += ans * b[i][1];
		}
		ans *= 2;
	}

	cout << cnt << '\n';
	
}

Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
    }

    auto partition = [&](int p, int r) {
        int x = a[r];
        int i = p-1;
        for(int j = p; j < r; ++j) {
            if(a[j] <= x) {
                swap(a[j], a[++i]);
            }
        }
        swap(a[++i], a[r]);
        return i;
    };

    int cc = partition(0, n-1);
    rep(i, n) {
        if(i == cc) {
            cout << '[' << a[i] << ']' << (i == n-1?'\n':' ');
        } else {
            cout << a[i] << (i == n-1?'\n':' ');
        }
    }
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int v[55], c[55];

int main()
{
    int n, ans = 0;
    cin>>n;
    REP(i,n) {
        cin>>v[i];
    }
    REP(i,n) {
        cin >> c[i];
    }
    REP(i,n) {
        ans += max(v[i] - c[i], 0);
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int, input().split()))
    end = len(A)
    judge = 0
    ans = 0
    i = 0

    if end == 1:
        return 1

    while True:
        if A[i] < A[i+1]:
            ans += 1
            while True:
                i += 1
                if i == end-1:
                    return ans
                elif A[i] <= A[i+1]:
                    continue
                else:
                    i += 1
                    if i == end-1:
                        ans += 1
                        return ans
                    else:
                        break

        elif A[i] > A[i+1]:
            ans += 1
            while True:
                i = i+1
                if i == end-1:
                    return ans
                elif A[i] >= A[i+1]:
                    continue
                else:
                    i += 1
                    if i == end-1:
                        ans += 1
                        return ans
                    else:
                        break

        elif A[i] == A[i+1]:
            i += 1
            if i == end-1:
                ans += 1
                return ans
            else:
                continue

print(main())


Measured memory_bytes: 14480
#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)
using namespace std;
typedef long long ll;
const int MAXN = 5 + 100000;

int dp[MAXN],h[MAXN];
int N,K;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> N >> K;
    foi(i,0,N) {
        cin >> h[i];
    }
    dp[0] = 0;
    foi(i,1,N) {
        dp[i] = numeric_limits<int>::max();
        for(int j = i - 1; abs(i - j) <= K && j >= 0; --j) {
            dp[i] = min(dp[i], abs(h[i] - h[j]) + dp[j]);
        }
    }
    cout << dp[N - 1] << '\n';
    return 0;
}


Measured memory_bytes: 1024