akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int INF = 0x3f3f3f3f;
int main(){
	//IOS;
	ll h;
	cin>>h;
	ll sum=1;
	while(h)
	{
		sum*=2;
		h/=2;
	}
	cout<<sum-1<<endl;
	return 0;
}

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

int main(){
  vector<int> vec(3); 
  cin >> vec[0] >> vec[1] >> vec[2];
  sort(vec.begin(),vec.end());
  cout << vec[0]+vec[1] << endl;
  return 0;
}
    

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
using namespace std;
typedef long long ll;
#include<iostream>
ll prime(ll x) {
	ll i;
	if (x < 2)return 0;
	else if (x == 2) return 1;
	if (x % 2 == 0) return 0;
	for (i = 3; i*i <= x; i += 2) {
		if (x%i == 0) return 0;
	}
	return 1;
}

ll MOD = 1000000007;
int main() {
	ll a, b;
	cin >> a >> b;
	if (a + b == 15)
		cout << '+' << endl;
	else if(a*b == 15)
		cout << '*' << endl;
	else
		cout << 'x' << endl;

}

Measured memory_bytes: 256
import copy
import sys
input = sys.stdin.readline


def bubble_sort(A):
    for _ in range(len(A)):
        for i in range(1, len(A))[::-1]:
            if int(A[i][1:]) < int(A[i - 1][1:]):
                A[i], A[i - 1] = A[i - 1], A[i]
    return A


def selection_sort(A):
    for i in range(len(A)):
        _min = i
        for j in range(i, len(A)):
            if int(A[j][1:]) < int(A[_min][1:]):
                _min = j
        A[i], A[_min] = A[_min], A[i]
    return A


def main():
    _ = input()
    A = input().strip().split()
    b_A = copy.deepcopy(A)
    bubble_sort(b_A)
    print(" ".join(b_A))
    print("Stable")

    selection_sort(A)
    print(" ".join(A))
    for b, s in zip(b_A, A):
        if b == s:
            continue
        else:
            print("Not stable")
            return
    print("Stable")
    return


if __name__ == "__main__":
    main()



Measured memory_bytes: 6344
import sys
input = sys.stdin.readline
N = int(input())
V_array = list(map(int, input().split()))
C_array = list(map(int, input().split()))
ans = 0

for i in range(N):
	if V_array[i] - C_array[i] >= 0:
		ans += V_array[i] - C_array[i]


print(ans)

Measured memory_bytes: 38256
#pragma comment(linker, "/STACK:1000000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <cassert>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <ctime>
#include <random>
#include <bitset>
#include <limits.h>
#include <fstream>
#include <unordered_map>
#include <array>

#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define pll pair <ll, ll>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
#define uint unsigned int

const int maxn = 510;

int dp[maxn][maxn];
int f[maxn][maxn];

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

int n;

void dfs(int x, int y) {
	for (int it = 0; it < 4; it++) {
		int nx = x + dx[it];
		int ny = y + dy[it];

		if (0 <= nx && nx < n && 0 <= ny && ny < n && dp[nx][ny] > dp[x][y] + f[nx][ny]) {
			dp[nx][ny] = dp[x][y] + f[nx][ny];
			dfs(nx, ny);
		}
	}
}

int main() {
	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			dp[i][j] = min(i, min(j, min(n - 1 - i, n - 1 - j))) + 1;
			f[i][j] = 1;
		}
	}

	ll ans = 0;

	for (int i = 0; i < n * n; i++) {
		int v;
		scanf("%d", &v);

		v--;
		int x = v / n;
		int y = v % n;
		f[x][y] = 0;

		ans += dp[x][y] - 1;

		dp[x][y]--;
		dfs(x, y);
	}

	cout << ans << '\n';
}

Measured memory_bytes: 17052
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
ans=0

a_s=a/10
a_a=a%10

b_s=b/10
b_a=b%10

c_s=c/10
c_a=c%10

d_s=d/10
d_a=d%10

e_s=e/10
e_a=e%10

A=[]
A.append(a_a)
A.append(b_a)
A.append(c_a)
A.append(d_a)
A.append(e_a)
ans+=(a_s + b_s + c_s + d_s + e_s)*10
A.sort()
for i in range(5):
    if A[i]!=0:
        ans += A[i]
        ans += (5-(i+1))*10
        break

print(ans)


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

int X[100002];
int Y[100002];

int main(){
    int N,W,H;
    cin>>N>>W>>H;
    for(int i=0;i<N;i++){
        int x,y,w;
        cin>>x>>y>>w;
        X[max(0,x-w)]++;
        X[min(W,x+w)]--;
        Y[max(0,y-w)]++;
        Y[min(H,y+w)]--;
    }
    bool flag=true;
    int cnt=0;
    for(int i=0;i<=W;i++){
        cnt+=X[i];
        if(cnt<=0&&i!=W) flag=false;
    }
    if(flag){
        cout<<"Yes"<<endl;
        return 0;
    }
    cnt=0; flag =true;
    for(int i=0;i<=H;i++){
        cnt+=Y[i];
        if(cnt<=0&&i!=H) flag=false;
    }
    if(flag){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3868
void main() {
	auto N = ri;
	auto ip = readAs!(string[]), S = ip[0], T = ip[1];
	foreach(i; 0..N) {
		write(S[i]);
		write(T[i]);
	}
	writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (auto& e : a) cin >> e;

  int m = 1 + n % 2;
  vector<vector<ll>> dp(n + 2, vector<ll>(m + 1, -1e18));
  dp[0][0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= m; j++) {
      dp[i + 2][j] = max(dp[i + 2][j], dp[i][j] + a[i]);
      if (j + 1 <= m) dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]);
    }
  }
  cout << max(*max_element(dp[n].begin(), dp[n].end()), *max_element(dp[n + 1].begin(), dp[n + 1].end())) << endl;
}


Measured memory_bytes: 15636
// https://atcoder.jp/contests/abc148/tasks/abc148_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll A, B;
  cin >> A >> B;

  VL res = {1, 2, 3};

  for (ll v : res) {
    if (v != A && v != B) drop(v);
  }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
	int a[110], sum = 0, sum2 = 0, n, m;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
		sum += a[i] + 100;
		sum2 += (a[i] + 100) * (a[i] + 100);
	}
	m = (n + 2 * sum) / (2 * n);
	printf("%d", sum2 - 2 * sum*m + m*m*n);
	return 0;
}

Measured memory_bytes: 128
/* be name khoda */

// #define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
using namespace std;

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl

const ll MOD = 998244353;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;

#define XL (x << 1)
#define XR (XL | 1)
#define MD ((l + r) >> 1)
#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

// -----------------------------------------------------------------------

const ll maxn = 200010;
const ll maxa = 1000010;

ll n, S[maxa], C[maxa], F[maxa];

ll poww(ll a, ll b) {
    ll r = 1;
    while (b) {
        if (b & 1) Mul(r, a);
        Mul(a, a);
        b >>= 1;
    }
    return r;
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    cin >> n;
    ll s = 0;
    fori (i, n) {
        ll x; cin >> x;
        Add(S[x], x);
        Add(s, x);
    }
    forifrom (i, 1, maxa) {
        for (ll j = i; j < maxa; j += i) Add(C[i], S[j]);
    }
    forirto (i, maxa, 1) {
        F[i] = 1LL * C[i] * C[i] % MOD;
        for (ll j = i * 2; j < maxa; j += i) Add(F[i], MOD - F[j]);
    }
    ll ans = 0;
    forifrom (i, 1, maxa) {
        Add(ans, 1LL * F[i] * poww(i, MOD - 2) % MOD);
    }
    Add(ans, MOD - s);
    Mul(ans, poww(2, MOD - 2));
    cout << ans << '\n';

}


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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.14159265358979323846264338327950288419

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int n, m, p;
LL s[100005], u[100005];
PLL t[100005];
LL freq[100005], ans[100005];

void solve(){
	freq[p] = 1;
	FD(i, p, 1){
		if(i == 1) ans[u[1]] += freq[i];
		else if(freq[i] > 0){
			LL temp = u[i];
			while(temp > u[1]){
				int l = 0, r = i;
				while(r - l > 1){
					int mid = (l + r) >> 1;
					if(u[mid] < temp) l = mid;
					else r = mid;
				}
				freq[l] += freq[i] * (temp / u[l]);
				temp %= u[l];
			}
			ans[temp] += freq[i];
		}
	}
}

int main(){
	scanf("%d %d", &n, &m);
	t[0] = mp(n, 0);
	FI(i, 1, m){
		scanf("%lld", &s[i]);
		t[i] = mp(s[i], -i);
	}
	sort(t, t + m + 1);
	int cp = -1;
	FI(i, 0, m){
		if(-t[i].se > cp){
			cp = -t[i].se;
			u[++p] = t[i].fi;
		}
	}
	solve();
	FD(i, n - 1, 1) ans[i] += ans[i + 1];
	FI(i, 1, n) printf("%lld\n", ans[i]);
	return 0;
}


Measured memory_bytes: 6400
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;

#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()
#define int long long
typedef long long ll;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

const int maxn = 3e5 + 228, mod = 1e9 + 7;

vector <int> mask[maxn];

vector <int> get(int n) {
    vector <int> kek(61, 0);
    for (int i = 0; i < 60; i++) {
        kek[i] = n % 2;
        n /= 2;
    }
    return kek;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector <int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        mask[i] = get(v[i]);
    }
    for (int i = n - 2; i >= 0; i--) {
        for (int j = 0; j < len(mask[i]); j++) {
            mask[i][j] += mask[i+1][j];
        }
    }
    int ans = 0;
    for (int i = 0; i < n - 1; i++) {
        int ln = n - i - 1;
        for (int j = 0; j < len(mask[i + 1]); j++) {
            int x = ((ll)1 << j);
            if (x & v[i]) {
                ans += x % mod * (ln - mask[i+1][j]);
                ans %= mod;
            } else {
                ans += x % mod * mask[i+1][j];
                ans %= mod;
            }
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 155008
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  set<string> s;
  string res;
  
  cin >> n;
  
  for (int i = 0; i <= n; i++){
    cin >> res;
    s.insert(res);
  }
  int ans = s.size();
  cout << ans << endl;
 }

Measured memory_bytes: 19260
fun main(args: Array<String>) {
    val input_num = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map(String::toDouble)
    val list = mutableListOf<Double>()
    for (a in A)
        list.add(1/a)
    
    println(1/list.sum())
}

Measured memory_bytes: 37692
// In The Name Of God
#include <bits/stdc++.h>

#define sqr(A) ((A) * (A))
#define X first
#define Y second
#define MP make_pair
#define bsz  __builtin_popcount
#define all(A) A.begin(), A.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int MOD2 = 1e9 + 9;
const int PR = 727;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;

const int N = 2e5 + 20;
int a[N], n, ans;
multiset<int> s;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i], s.insert(a[i]);
	while (s.size() > 1) {
		auto it = s.end(); it--;
		int x = *it;
		s.erase(it);
		for (ll i = 1; i < (1LL << 35LL); i *= 2LL)
			if (s.find(i - x) != s.end()) {
				s.erase(s.find(i - x));
				ans++;
				break;
			}
	}
	cout << ans << endl;
}



Measured memory_bytes: 10368
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

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

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
       if (par[x] == x) return x;
       return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
       int rx = root(x); //xの根をrx
       int ry = root(y); //yの根をry
       if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
       par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
       int rx = root(x);
       int ry = root(y);
       return rx == ry;
    }
};

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

    rep(i, m){
        int x, y, z; cin >> x >> y >> z;
        x--; y--;
        uf.unite(x, y);
    }

    int ans = 0;
    rep(i, uf.par.size()){
        if(uf.par[i] != i) continue;
        ans++;
    }
    pr(ans);
    return 0;}

Measured memory_bytes: 3704
N,M,C = map(int,input().split())
BMs = list(map(int,input().split()))

ANMs = [list(map(int,input().split())) for _ in range(N)]

count = 0
for i in range(N):
	mySum = 0
	for j in range(len(BMs)):
		mySum += (ANMs[i][j] * BMs[j])
		
	#print(mySum)
	if mySum > -C:
		count += 1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define MOD2 998244353
#define MOD3 1000000009
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("in.in");ofstream coutt("out.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), is_sorted(),

signed main(){
    FASTER;
    string s;cin>>s;
    int n=s.size();
    int ans=0;
    for(int i=0;i<n/2;i++){
        ans+=(s[i]!=s[n-i-1]);
    }
    cout<<ans;
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll long long
#define INF 10000000000000000LL
#define pll pair<long long , long long>
const int MAX=1e5+10;
const ll MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
vector<int>adj[MAX];
int main() 
{
	int n ;
	cin>>n;
	int arr[n+1];
	int par[n+1];
	memset(par, 0 , sizeof(par));
	for(int i=2;i<=n;i++){
		cin>>arr[i];
		par[arr[i]]++;
	}
	for(int i=1;i<=n;i++)
		cout<<par[i]<<"\n";
	
}

Measured memory_bytes: 7544
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

string lcs(string &s, string &t) {
    auto chmax = [](int& a, int b) { if (a < b) { a = b; return 1; } return 0; };
    int n = s.size(), m = t.size();
    vector<vector<int>> dp(n + 1, vector<int>(m + 1));
    vector<vector<int>> prv(n + 1, vector<int>(m + 1)); // ↓: 0, →: 1, ↘︎: 2
    for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) {
        if (s[i] != t[j]) {
            if (chmax(dp[i + 1][j + 1], dp[i][j + 1])) prv[i + 1][j + 1] = 0;
            if (chmax(dp[i + 1][j + 1], dp[i + 1][j])) prv[i + 1][j + 1] = 1;
        } else {
            if (chmax(dp[i + 1][j + 1], dp[i][j] + 1)) prv[i + 1][j + 1] = 2;
        }
    }
    string res = "";
    while (n > 0 && m > 0) {
        if (prv[n][m] == 0) n--;
        if (prv[n][m] == 1) m--;
        if (prv[n][m] == 2) n--, m--, res += s[n];
    }
    reverse(res.begin(), res.end());
    return res;
}

int main() {
    string s, t; cin >> s >> t;
    cout << lcs(s, t) << endl;
    return 0;
}

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

int main() {
    int n;
    cin>>n;
    vector<char> v(n,'x');
    char c;
    for(int i=0;i<n;i++){
        cin>>c;
        v[i]=c;
    }
    int i=0,j=n-1;
    int ans=0;
    while(i<j){
        if(v[i]=='R'){
            i++;
        }else if(v[j]=='W'){
            j--;
        }else{
            swap(v[i], v[j]);
            ans++;
        }
    }
    cout<<ans;
}

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

#define endl '\n'

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

    string s;
    cin >> s;
    int n = s.size();
    bool ok = false;

    for(int i = 0; i < n; i++) {
        if(s[i] != '0') {
            ok = true;
        }
    }
    if(!ok) {
        cout << n;
        return 0;
    } 

    
    for(int i = (n + 1) / 2; i < n; i++) {
        if(s[i] != s[n - i - 1] || s[i] != s[i - 1]) {
            cout << i;
            return 0;
        }
    }

    cout << n;

    return 0;
}

Measured memory_bytes: 512
package main

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

func main() {
	n := getInt()
	s := []rune(getString())

	now := 0
	for i := 1; i < n; i++ {
		if r := s[i]; r == 'E' {
			now++
		}
	}

	ans := now
	for i := 1; i < n; i++ {
		if s[i] == 'E' {
			now--
		}
		if s[i-1] == 'W' {
			now++
		}
		ans = min(ans, now)
	}

	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	buf := 10000001
	sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 4736
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;

int main() {
  int64_t N, t, m;
  cin >> N;
  m = N;
  for (int64_t i = (int)sqrt(N); i > 0; i--) {
    if (N % i == 0) {
      t = N / i;
      cout << i + t - 2 << endl;
      break;
    }
  }
}


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

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:String,
    }
    let a=a.chars().collect_vec();
    let mut b:usize=0;
    let mut c:usize=0;
    for i in 0..a.len() {
        if a[i]=='0'{b+=1}
        else{c+=1}
    }
    println!("{}",min(b,c)*2);
}

Measured memory_bytes: 2644
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int i, j, k, n, l, cnt;
	string in, tmp, pre, f, b;
	vector<string> vs;
	cin >> n;
	for (i = 0; i < n; i++) {
		cnt = 0;
		cin >> in;
		l = in.size();
		vs.push_back(in);
		for (j = 1; j < l; j++) {
			//j : l - j
			//8
			f = in.substr(0, j);
			b = in.substr(j, l - j);

			//vs.push_back(f + b);
			vs.push_back(b + f);

			reverse(f.begin(), f.end());
			vs.push_back(f + b);
			vs.push_back(b + f);


			reverse(b.begin(), b.end());
			vs.push_back(f + b);
			//vs.push_back(b + f);


			reverse(f.begin(), f.end());
			vs.push_back(f + b);
			vs.push_back(b + f);



			/*tmp = in;
			reverse(tmp.begin(), tmp.begin() + j);
			vs.push_back(tmp);
			reverse(tmp.begin(), tmp.end());
			vs.push_back(tmp);*/
			//sort(vs.begin(), vs.end());
		}
		reverse(in.begin(), in.end());
		vs.push_back(in);

		vs.push_back("0");

		sort(vs.begin(), vs.end());

		k = vs.size();
		//pre = "0";

		for (j = 1; j < k; j++) {
			if (vs[j - 1] != vs[j]) {
				cnt++;
			}
			//pre = vs[j];
		}

		//cout << k << endl;

		cout << cnt << endl;





		vs.clear();
	}







	return 0;
}

Measured memory_bytes: 1312
A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans=0
for i in range(A+1):
  for k in range(B+1):
    for t in range(C+1):
      if 500*i+100*k+50*t==X:
        ans+=1
print(ans)        

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int a, b, c = 0, d, e;
	cin >> a >> b;
	string test[10000];
	for (int j = 0; j < a; j++) {
		cin >> test[j];
	}
	for (int h = 0; h < a; h++) {
		cout << test[h] << "\n";
		cout << test[h] << "\n";
	}
	cin >> e;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	string s;
	cin>>s;
	ll ans=0;
	ll b=0;
	for(int i=0; i<s.size(); i++){
		if(s[i]=='B') b++;
		else ans+=b;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>

int main(void)
{
	int i;
	int answer = 0;
	int length;
	char data[1024];
	
	while(1){
		fgets(data, sizeof(data), stdin);
		if(strcmp("END OF INPUT\n",data) == 0
			|| strcmp("END OF INPUT",data) == 0) break;
		
		length = strlen(data);
		for(i = 0; i < length; i++){
			if(data[i] == ' ' || data[i] == '\n'){
				printf("%d", answer);
				answer = 0;
			}
			else{
				answer += 1;
			}
		}
		
		printf("\n");
	}

	return 0;
}

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

using namespace std;


typedef long long ll;

bool foo(string s){
    for (int i=0; i<s.size(); i++){
        if (s[i]!='A' && s[i]!='C' &&s[i]!='G' &&s[i]!='T' )return 0;
    }
    return 1;
}
int main()
{
    //freopen("", "r", stdin);freopen("", "w", stdout);
    string s;
    cin>>s;
    int ans=0;
    for (int i=0; i<s.size(); i++){
        string t;
        for (int j=i; j<s.size(); j++){
            t+=s[j];
            if (foo(t)){
                ans=max(ans, j-i+1);
            }
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "cstdio"
#include "cstring"
#include "cmath"
#include "cctype"
#include "cstdlib"
#include "iomanip"
#include "algorithm"
#include "set"
#include "queue"
#include "map"
#include "stack"
#include "vector"
#define lxl long long
#define R register
#define INF 0x3f3f3f3f
#define debug(x) printf("debug:%lld\n",x)
const lxl maxn=410,mod=1000000007;
lxl n,c;
lxl pre[maxn][maxn],f[maxn][maxn],a[maxn],b[maxn];
inline lxl read()
{
	char c=getchar();
	lxl f=1,x=0;
	for(;!isdigit(c);c=getchar())(c=='-')&&(f=-1);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	return f*x;
}
inline void prework()
{
	for(R int i(1);i<maxn;++i)pre[i][0]=1;
	for(R int i(1);i<maxn;++i)
		for(R int j(1);j<maxn;++j)
			pre[i][j]=pre[i][j-1]*i%mod;
	for(R int i(1);i<maxn;++i)
		for(R int j(0);j<maxn;++j)
			pre[i][j]=(pre[i][j]+pre[i-1][j])%mod;
}
int main(void)
{
	prework();
	n=read(),c=read();
	for(R int i(1);i<=n;++i)a[i]=read();
	for(R int i(1);i<=n;++i)b[i]=read();
	f[0][0]=1;
	for(R int i(1);i<=n;++i)
		for(R int j(0);j<=c;++j)
			for(R int k(0);k<=j;++k)
				f[i][j]=(f[i][j]+f[i-1][j-k]*(pre[b[i]][k]-pre[a[i]-1][k]+mod)%mod)%mod;
	printf("%lld\n",f[n][c]);
	return 0;
}

Measured memory_bytes: 2816
#include <stdio.h>
#include <bits/stdc++.h>
     
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
     
using namespace std;
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n;
    cin >> n;
    int a[n];
    rep(i, 0, n)
        cin >> a[i];
    ll sum1 = 0, sum2 = 0;
    rep(i, 0, n)
        sum2 += a[i];
    ll ans = big;
    rep(i, 0, n - 1)
    {
        sum1 += a[i];
        sum2 -= a[i];
        ans = min(ans, abs(sum1 - sum2));
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    if (b == 0)
        return 1;
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
        return res * a;
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m,k,l,r,mid,ans=0;
    cin>>n>>m>>k;
    ll a[n+1];
    ll b[m+1];
    a[0]=0;
    b[0]=0;
    for (int i=1;i<=n;++i)
    {
        cin>>a[i];
        a[i]+=a[i-1];
    }
    for (int i=1;i<=m;++i)
    {
        cin>>b[i];
        b[i]+=b[i-1];
    }
    for (int i=0;i<=n;++i)
    {
        if (a[i]>k)
            continue;
        l=0;r=m;
        while (l<r)
        {
            mid=l+(r-l)/2+1;
            if (a[i]+b[mid]<=k)
                l=mid;
            else
                r=mid-1;
        }
        ans=max(ans,i+l);
    }
    cout<<ans;
    return 0;
}

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

signed main(void)
{
	string s, t;
	cin >> s >> t;
	ll cnt = 0;
	rep(i, s.size())
	{
		if (s[i] != t[i])
			cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    const int INF = 1000000000;

    int N,M; cin >> N >> M;
    vector<int> a(M), b(M), c(M);
    vector<vector<int>> dist(N, vector<int>(N, 0));

    for(int i=0; i<M; i++){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--; b[i]--;
    }

    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            if(i==j) dist[i][j] = 0;
            else dist[i][j] = INF;
        }
    }

    for(int i=0; i<M; i++){
        dist[a[i]][b[i]] = c[i];
        dist[b[i]][a[i]] = c[i];
    }

    for(int k=0; k<N; k++){
        for(int i=0; i<N; i++){
            for(int j=0; j<N; j++){
                dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
            }
        }
    }

    int ans = M;
    for(int i=0; i<M; i++){
        bool shortest = false;
        for(int j=0; j<N; j++) if(dist[j][a[i]]+c[i] == dist[j][b[i]]) shortest = true;
        if(shortest) ans--;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>

using namespace std;

typedef long long ll;

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

    ll X, Y;
    cin >> X >> Y;

    cout << (abs(X - Y) <= 1 ? "Brown" : "Alice") << endl;
    return 0;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	var k int
	fmt.Scan(&k)
	var cnt int
	for b <= a {
		b *= 2
		cnt++
	}
	for c <= b {
		c *= 2
		cnt++
	}
	if k >= cnt {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1768
N, K = map(int, input().split())
arr = list(map(int,input().split()))
left = []
right = []
for i in arr:
    if i < 0:
        left.append(abs(i))
    else:
        right.append(i)
left.sort()
tmp = 0
count = 0
if len(right) == 0:
    print(left[K-1])
    exit()
if len(right) >= K:
    tmp += right[K-1]
    i = 1
    while True:
        if len(left) < i or K-i-1 < 0:
            break
        tmp2 = right[K-i-1] + left[i-1] + min(right[K-i-1],left[i-1])
        i += 1
        if tmp2 < tmp:
            tmp = tmp2
else:
    tmp += right[-1]+left[K-len(right)-1]+min(right[-1],left[K-len(right)-1])
    i = 1
    while True:
        if K-len(right)-1+i >= K or i >= len(right) or K-len(right)-1+i >= len(left)-1:
            break
        tmp2 = right[-1-i] + left[K-len(right)-1+i] + min(right[-1-i],left[K-len(right)-1+i])
        i += 1
        if tmp2 < tmp:
            tmp = tmp2
print(tmp)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
//解説AC
int main() {
  long long n;
  cin>>n;
  long long kotae=0;
  for(int i=1;i<=n;i++){
    long long kazu=n/i;
    long long x=kazu*(1+kazu)/2;
    kotae+=i*x;
    //cout<<i*x<<" ";
  }
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_lim=(n); i<i##_lim; ++i)
#define FOR(i, a, b) for (int i=(a), i##_lim=(b); i<i##_lim; ++i)
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using el = pair<string, pair<int, int>>;

int main()
{
    int N;
    cin >> N;
    string S[N];
    int P[N];
    REP(i, N) cin >> S[i] >> P[i];

    priority_queue<el, vector<el>, greater<el>> q;
    REP(i, N) q.push(mp(S[i], mp(100-P[i], i+1)));

    while (!q.empty())
    {
        auto e = q.top();
        q.pop();
        cout << e.second.second << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm> 
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include  <ctime>
#include <iomanip>
using namespace std;

#define ll                    long long int
#define ull                   unsigned long long int
#define loop(i,a,b)           for(int i=(int)a;i<(int)b;++i)
#define rloop(i,a,b)          for(int i=(int)a;i<=(int)b;++i)
#define loopl(i,a,b)          for(ll i=(ll)a;i<(ll)b;++i)
#define loopr(i,a,b)          for(int i=(int)a;i>=(int)b;--i)
#define count_1(n)            __builtin_popcountll(n)
#define pb                    push_back
#define eb                    emplace_back
#define ab(a)                 (a<0)?(-1*a):a
#define pc                    putchar
#define gc                    getchar
#define mset(a,b,c)           loop(i,0,b) a[i]=c
#define mp                    make_pair
#define itoc(c)               ((char)(((int)'0')+c))
#define all(p)                p.begin(),p.end()
#define max(x,y)              ((x>y)?x:y)
#define min(x,y)              ((x<y)?x:y)
#define mid(s,e)              (s+(e-s)/2)
#define vi                    vector<int>
#define vvi                   vector<vector<int>>
const ll MOD = 998244353;

ll modpow(ll a, ll b, ll mod) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a; res%=mod; a = a * a; a%=mod; }return res; }
//ll p(ll a, ll b) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a;a = a * a; }return res; }

struct dsu {
    vector<ll> p,sum,minn,maxx,r;
    dsu(int n) {
        loop(i,0,n+1) {
            p.pb(i); sum.pb(i); minn.pb(i); maxx.pb(i); r.pb(0);
        }
    }
    int get(int a) {
        return (p[a] = (p[a]==a)?a:get(p[a]));
    }
    void uni(int a, int b) {
        a = get(a); b = get(b);
        if(a==b) return;
        if(r[a]==r[b]) r[a]++;
        if(r[a] < r[b]) swap(a,b);
        p[b] = a;
        sum[a] += sum[b];
        minn[a] = min(minn[a], minn[b]);
        maxx[a] = max(maxx[a],maxx[b]);
    }
};


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /* code */
    string s; cin >> s;
    if(s[s.size()-1] == 's') s = s + "es";
    else s = s + 's';
    cout << s << "\n";
    /* end code */
}

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

int main() {
  for(int n; cin >> n && n;) {
    int l = 0, r = 0, prev = 0, res = 0;
    for(int i = 0; i < n; ++i) {
      string s; cin >> s;
      if(s[0] == 'l') l ^= 1;
      else r ^= 1;
      if(l == r) {
        if(prev != l) ++res;
        prev = l;
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
include Math

def solve(n_a, n_b, l)
	total=0
	cary=0
	ml=0
	for i in 0..l
		a=n_a[i]; b=n_b[i]
		a+=cary
		ad=0
		if a>0
			if a<=b
				ad=b-a
			else
				ml=(a.to_f/b).ceil
				b*=ml
				ad=b-a
			end
		end
		total+=ad
		cary+=ad
	end
	p total
end
if __FILE__==$0
	
	rl_i=lambda{|str,dl|str.strip.split(dl).map(&:to_i)}
	rl_s=lambda{|str,dl|str.strip.split(dl)}
	r_i=lambda{|str|str.strip.to_i}
	r_s=lambda{|str|str.strip}
	dl=" "
	n=r_i[gets]
	a=Array.new(n){0}
	b=Array.new(n){0}
	n.times do |i|
		line=rl_i[gets,dl]
		a[i]=line[0]
		b[i]=line[1]
	end
	a.reverse!
	b.reverse!
	solve(a,b,n-1)
end

Measured memory_bytes: 3324
function Main(s) {
  var a = s.split("\n")[1].split(" ").map(e => parseInt(e, 10));
  var cnt = 0;
  for (var i of a) if (i % 2 === 1) cnt++;
  console.log(cnt % 2 === 0 ? "YES":"NO");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 28864
N=int(input())
MOD=10**9+7
A=[int(x) for x in input().split()]
flag=1#その並び順がありえるなら1、そうでないなら0
set1=set()
set2=set()
if N%2==1:
    set1.add(0)
    for j in range(2,N+1,2):
        set1.add(j)
        set2.add(j)
    for i in range(N):
        now=A[i]
        if now in set1:
            set1.remove(now)
        elif now in set2:
            set2.remove(now)
        else:
            flag=0
            break
    if len(set1)!=0 or len(set2)!=0:
        flag=0
else:
    for k in range(1,N+1,2):
        set1.add(k)
        set2.add(k)
    for p in range(N):
        now=A[p]
        if now in set1:
            set1.remove(now)
        elif now in set2:
            set2.remove(now)
        else:
            flag=0
            break
    if len(set1)!=0 or len(set2)!=0:
        flag=0
if flag==0:
    print(0)
else:
    ans=1
    div2=N//2
    for q in range(div2):
        ans*=2
        ans%=MOD
    print(ans)


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

const ll INF = 1e18;

int main() {
  ll n, m;
  string s;
  cin >> n >> m >> s;
  vector<ll> dp(n+1,INF);
  queue <ll>q;
  q.push(0);
  dp[n]=0;
  for(ll i=n-1;i>=0;i--){
    //cout<<q.size()<<endl;

    while (q.size()>m or q.front()==INF){
  //    cout<<q.front()<<"pop"<<endl;
      q.pop();
  //    cout<<q.size()<<"sieze"<<endl;
    }
    if (q.empty()){
      cout<<-1<<endl;
      return 0;
    }
    if (s[i]=='0')  {
      dp[i]=q.front()+1;
    }
  //  cout<<dp[i]<<endl;
    q.push(dp[i]);
  }





  //rep(i,n+1)cout<<dp[i]<<endl;
  vector<ll> ans;
  ll now=dp[0];
  now--;
  //ans.push_back()
  ll i=0;

  while(i<n){
    while(now!=dp[i]){
      i++;
    }

    ans.push_back(i);
    now--;
  }
ll cnt=0;
  for(auto A:ans){
    cout<<A-cnt<<" ";
    cnt=A;
  }

}


Measured memory_bytes: 2296
# include<stdio.h>
# include<stdlib.h>

int main(void){
  char s[4];
  scanf("%s", s);
  int count = 0;
  int i;
  int j;
  for(i=0;i<4;i++){
    for(j=0;j<4;j++){
      if(s[i]==s[j]){
        count +=1;
      }
    }
    if(count!=2){
      printf("No");
      return 0;
    }else{
      count = 0;
    }
  }
  printf("Yes");
  return 0;
}

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

int main(void){

    int n, m, count = 0;
    map<string, long> mp;

    cin >> n;

    m = n;
    while(m--){
        string x;
        cin >> x;
        sort(x.begin(), x.end());
        mp[x]++;
    }

    long long int sum = 0;

    for(auto i : mp){
        sum += (i.second * (i.second - 1)) / 2;
    }

    cout << sum << endl;

    return 0;
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S; cin >> S;
    stack<int> st;
    int ans = 0;
    rep(i, S.length()){
        if(st.empty()) st.push(S[i]-'0');
        else{
            int num = S[i]-'0';
            if(st.top() == num) st.push(num);
            else{
                st.pop();
                ans += 2;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 720
import numpy as np

N,M = map(int,input().split())
A = sorted([int(x) for x in input().split()])
An = 0
C = []

for i in range(M):
    C += [[int(x) for x in input().split()]]
    
C = sorted(C,key=lambda x: x[1])[::-1]

m = 0
for i in range(M):
    b = C[i][0]
    if m == N:
        break
    if m+b >= N:
        b = N-m

    if A[m + b - 1] < C[i][1]:
        m = m + b
        An += C[i][1]*b
    else:
        c = C[i][1]
        for j in range(2,b):
            if A[m+b-j] < c:
                m = m + b - j + 1
                An += c*(b-j+1)
                break
        break

if m == N:  print(An)
else:   print(sum(A[m:]) + An)

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

int main(){
    string s;
    cin >> s;
    for(int i=0;i<s.size()-1;i++){
        if(s.substr(i,2)=="AC"){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // ver1.8
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
#define PAI 3.14159265358979
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  cout << fixed << setprecision(14);
  int a,b;
  cin >> a >> b;
  if(a<b) cout << "a < b" << endl;
  if(a==b) cout << "a == b" << endl;
  if(a>b) cout << "a > b" << endl;
  return 0;
}



Measured memory_bytes: 3084
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	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;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll x, y, z, cnt = 0,cnt2=0;
	in(x);

	map<ll, ll> dic,dic100;
	y = x % 100;
	z = x / 100;

	while (z > 0) {
		if (z * 5 >= y ) {
			outn(1);
			return 0;
		}
		z--;
		y += 100;
	}

	outn(0);
	return 0;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  vector <int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  int all=0;
  for(int i=0 ;i<N; i++)
    all+=vec.at(i);
  
  int a=0;
  int b;
  
  for(int i=0;i<N;i++){
    a+=vec.at(i);
    b=all-a;
    if(a>=b)
      break;
  }
  int c;
  c=abs(a-b);
  
  reverse (vec.begin(),vec.end());
  
  int d=0;
  int e;
  
  for(int i=0;i<N;i++){
    d+=vec.at(i);
    e=all-d;
    if(d>=e)
      break;
  }
  int f;
  f=abs(d-e);
  
  int g=min(c,f);
  cout<<g<<endl;
}
  

Measured memory_bytes: 256
n,m = map(int,input().split(" "))

lr = []

ming = 0
maxg = 10 **6

for i in range(m):
    a,b = map(int,input().split(" "))
    lr.append((a,b))

for i in lr:
    if i[0] > ming:
        ming = i[0]
    if i[1] < maxg:
        maxg = i[1]

print(max([0, maxg - ming + 1]))

Measured memory_bytes: 22280