akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


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

	int kkt = 89;
	while (kkt) {
		string s; cin >> s;
		while (1) {
			if (s == "ABC") {
				puts("Yes");
				break;
			}
			string t;
			bool flag = false;
			for (int i = 0; i < s.size(); i++) {
				if (s.substr(i, 3) == "ABC") {
					t += 'x';
					i += 2;
					flag = true;
				}
				else {
					t += s[i];
				}
			}
			if (!flag) {
				puts("No");
				break;
			}
			if (t[0] == 'x') {
				for (int i = 0; i < t.size(); i++) {
					if (t[i] == 'x') t[i] = 'A';
					else if (t[i] == 'A') {
						puts("No");
						return 0;
					}
				}
			}
			else if (t.back() == 'x') {
				for (int i = 0; i < t.size(); i++) {
					if (t[i] == 'x') t[i] = 'C';
					else if (t[i] == 'C') {
						puts("No");
						return 0;
					}
				}

			}
			else {
				for (int i = 0; i < t.size(); i++) {
					if (t[i] == 'x') t[i] = 'B';
					else if (t[i] == 'B') {
						puts("No");
						return 0;
					}
				}
			}
			s = t;
		}
		break;
	}
	return 0;

}


Measured memory_bytes: 3204
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

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;   // Be careful not to overflow
}


vector<int> pp;
void preparePrime( int maxp )
{
    int i;
    vector<int> a(maxp+1);
    for(i=2; i<=maxp; i++) {
        int k=i+i;
        while(k<=maxp) {
            a[k]=1;
            k+=i;
        }
    }
    for(i=2; i<=maxp; i++) {
        if(a[i]==0) pp.push_back( i );
    }
    return;
}

void decompositPrime( ll a, vector<pair<ll,ll> >& vv )
{
    int i;
    for(i=0; i<(int)pp.size(); i++) {
        int count = 0;
        while(a % pp[i] == 0 ) {
            a /= pp[i];
            count ++;
        }
        if(count>0) vv.push_back( make_pair( pp[i], count ) );
        if (a==1) break;
    }
    if(a>1) {
        vv.push_back( make_pair( a, 1 ) );
    }

    return;
}

void solve()
{
    preparePrime( 1000005 );

    ll n;
    scanf("%lld", &n);

    vector<pair<ll, ll> > vv;
    decompositPrime(n - 1, vv);
    ll ans0 = 1;
    int i;
    for (i = 0; i < (int)vv.size(); i++) {
        ll tmp=vv[i].second + 1;
        ans0 *= tmp;
    }
    ans0--;

    vector<ll> v;
    double tmp=sqrt((double)n) + 0.1;
    for (i = 1; i < tmp; i++) {
        if (n%i == 0) {
            if(i!=1) v.push_back(i);
            if (n / i != i && n/i!=1) v.push_back(n / i);
        }
    }
    for (i = 0; i < (int)v.size(); i++) {
        ll m=n/v[i];
        while (m % v[i] == 0) {
            m /= v[i];
        }
        if (m%v[i] == 1) {
            ans0++;
        }
    }
    printf("%lld\n", ans0);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 4732
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){

    vector<int> v(5);
    for(int i=0;i<5;i++){
        int x;
        cin>>x;
        v[i]=x;
    }
    sort(v.rbegin(),v.rend());
    rep(i,5){
        if(i!=0){cout<<" ";}
            cout<<v[i];
        
        
    }
    cout<<endl;
    return 0;
}



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



int main() {
	int N = 0;
	char S[101] = {}, T[100] = {};
	char st[201] = {};

	cin >> N >> S >> T;

	for (int i = 0; i < N; i++) {
		st[i * 2] = S[i];
		st[i * 2 + 1] = T[i];
	}

	cout << st;

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
AC
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline


def flatten(listOfLists):
    "Flatten one level of nesting"
    return chain.from_iterable(listOfLists)


def cut(k):
    # ????????¨l
    global cards
    yellow = cards[:k]
    blue = cards[k:]
    cards = blue + yellow


def shuffle():
    # ????????¨l
    global cards
    yellow = cards[:N]
    blue = cards[N:]
    temp = [[y, b] for y, b in zip(yellow, blue)]
    cards = list(flatten(temp))


cards = []
def main(args):
    global cards
    n = int(input())
    N = n
    m = int(input())

    cards = [x for x in range(1, (2*n)+1)]
    for _ in range(m):
        op = int(input())
        if op == 0:
            # shuffle()
            temp = [[y, b] for y, b in zip(cards[:n], cards[n:])]
            cards = list(flatten(temp))
        else:
            # cut(k)
            cards = cards[op:] + cards[:op]

    print('\n'.join(map(str, cards)))


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 7824
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
const int MAX_N=100005;
int x[MAX_N];
int n,k,ans=INF;
int main()
{
	n=read(),k=read()-1;
	rep(i,0,n)cin>>x[i];
	rep(i,0,n-k)ans=min(ans,min(abs(x[i]),abs(x[i+k]))+abs(x[i]-x[i+k]));
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
class SegTree {
    int n;// 葉の数
    vector<T> data;// データを格納するvector
    T def; // 初期値かつ単位元
    function<T(T, T)> operation; // 区間クエリで使う処理
    function<T(T, T)> update;// 点更新で使う処理

    // 区間[a,b)の総和。ノードk=[l,r)に着目している。
    T _query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return def; // 交差しない
        if (a <= l && r <= b)
            return data[k]; // a,l,r,bの順で完全に含まれる
        else {
            T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2); // 左の子
            T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r); // 右の子
            return operation(c1, c2);
        }
    }

    public:
    // _n:必要サイズ, _def:初期値かつ単位元, _operation:クエリ関数,
    // _update:更新関数
    SegTree(size_t _n, T _def, function<T(T, T)> _operation,
        function<T(T, T)> _update)
        : def(_def), operation(_operation), update(_update) {
        n = 1;
        while (n < _n) {
            n *= 2;
        }
        data = vector<T>(2 * n - 1, def);
    }

    // 場所i(0-indexed)の値をxで更新
    void change(int i, T x) {
        i += n - 1;
        data[i] = update(data[i], x);
        while (i > 0) {
            i = (i - 1) / 2;
            data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
        }
    }

    // [a, b)の区間クエリを実行
    T query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }

    // 添字でアクセス
    T operator[](int i) {
        return data[i + n - 1];
    }
};
int main(){
    ll n;cin >> n;
    vl v(n);rep(i,n)cin >> v[i];
    SegTree<ll> st(n,0LL,
        [](ll a,ll b){return __gcd(a,b);},
        [](ll a,ll b){return b;});
    rep(i,n){
        st.change(i,v[i]);
    }
    ll ans=1;
    rep(i,n){
        chmax(ans,__gcd(st.query(0,i),st.query(i+1,n)));
    }
    cout <<ans <<endl;
}   

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF/10;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
int main() {
  ll n,k; cin>>n>>k;
  ll a[n]={};
  rep(i,n) cin>>a[i];
  ll ans = INF;
  ll h = 0;
  ll f = 0;
  ll cost = 0;
  for(ll i=0; i<pow(2,n); i++){
    bitset<15> s(i);
    if(s.count()!=k)continue;
    h = 0;
    cost = 0;
    for(ll j=0; j<n; j++){
      if(s.test(j)){
        if(a[j]<=h){
          cost += h - a[j] + 1;
          h = max(h,a[j]);
          h++;}
        h = max(h,a[j]);
        continue;
      }
      h = max(h,a[j]);
    }
    ans = min(ans,cost);
    //cout << ans << endl;
  }
    //cout << ans << endl;
  cout << ans << endl;}
          


Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

bool check(string s, string t)
{
	int sp = 0, tp = 0;
	while (tp < t.size())
	{
		if (s[sp] == t[tp]) tp++;
		sp++;
		if (sp == s.size() && tp != t.size()) return false;
	}
 	return true;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n; cin >> n;
	vector<pii> v(n);
	REP(i, n) v[i] = pii(1, i+1);
	int m; cin >> m;
	REP(i, m)
	{
		int a; cin >> a;
		v[a - 1] = pii(-i, a);
	}
	sort(ALL(v));
	for (auto i : v) cout << i.second << endl;
	return 0;
}

Measured memory_bytes: 4356
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

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

signed main() {
    int n;
    cin>>n;
    vector<int> w(n);
    REP(i,n) cin>>w[i];

    i64 mins=INF;
    REP(i,n){
        i64 s1 = 0 , s2 = 0;
        REP(j,n){
            if(j<=i){
                s1+=w[j];

            } else {
                s2+=w[j];
            }
        }
        mins=min(abs(s2-s1),mins);

    }
    cout<<mins<<endl;
    
    // cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define ll long long
const ll N = 2e5+107;
ll n,i,a[N],xr;
int main ()
{
    cin>>n;
    for (i=1; i<=n; ++i)
    {
        cin>>a[i];
        xr=xr^a[i];
    }
    for (i=1;i<=n;++i)
        cout<<(xr^a[i])<<" ";
    cout<<"\n";

                                    /// !Scurta explicatie!
    /// Nr de aflat : x y z t
    /// Input : a b c d
    /// a = y*z*t
    /// b = x*z*t
    /// c = x*y*t
    /// d = x*y*z
    /// x*x*x*y*y*y*z*z*z*t*t*t = a*b*c*d (x*x=0, y*y=0, z*z=0, t*t=0)
    /// x*y*z*t = a*b*c*d
    /// Ex 1 : y*z*t = a, deci ==> x*a=a*b*c*d (aplicam *a in ambele parti) ==> x=b*c*d, celelalte exemple sunt analog
    /// y = a*c*d
    /// z = a*b*d
    /// t = a*b*c
    /// Se aplica general la fel ca in exemplul dat de autorul problemei (vezi codul de deasupra de explicatie); * = xor
}



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

int main() {
  string S;
  cin >> S;
  int N;
  N = S.size();
  
  int i = 0;
  vector<int> kouho(0);
  
  while(i < N) {
    int length = 0;
    while (S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T') {
      length++;
      i++;
      if (i >= N) {
        break;
      }
    }
    kouho.push_back(length);
    i++;
  }
  sort(kouho.begin(), kouho.end());
  reverse(kouho.begin(), kouho.end());
  
  cout << kouho.at(0) << endl;
}

  

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
ll i,j,k;
ll n,m;
ll c;
ll migi[100005],hidari[100005],migi2[100005],hidari2[100005];
ll x[100005],v[100005];


int main(){
	cin>>n>>c;
	for(i=0;i<n;i++){
		cin>>x[i]>>v[i];
	}
	ll kati=0;
	for(i=0;i<n;i++){
		kati += v[i];
		if(i==0)migi[i]=kati-x[i];
		else migi[i] = max(migi[i-1],kati - x[i]);
		migi2[i] = kati - 2*x[i];
	}
	kati = 0;
	hidari[n]=0;
	for(i=n-1;i>=0;i--){
		kati += v[i];
		hidari[i] = max(kati - (c - x[i]),hidari[i+1]);
		hidari2[i] = kati - 2*(c-x[i]);
	}
	ll ans = 0;
	for(i=0;i<n;i++){
		ans = max(ans,hidari[i]);
		ans = max(ans,migi[i]);
	}
	for(i=0;i<n-1;i++){
		ans = max(ans,migi[i] + hidari2[i+1]);
		ans = max(ans,migi2[i] + hidari[i+1]);
	}
	cout<<ans<<endl;

	
	return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

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

    int len = S.length();

    string T = "";
    REP(0, i, len - 1) {
        S = S.substr(0, S.length() - 1);
        // cout << "S=" << S << endl;

        if (S.length() % 2 != 0) {
            continue;
        }

        string lhs = S.substr(0, S.length() / 2);
        string rhs = S.substr(S.length() / 2);
        if (lhs == rhs) {
            T = S;
            break;
            // cout << "T=" << T << endl;
        }
    }

    cout << T.length() << endl;

    return 0;
}


Measured memory_bytes: 256
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = []
d = 0

for i in range(a[2]):
  if i in b:
    d+=1
else:
  c.append(d)
  d = 0

for i in range(a[0]-a[2]):
  if i+a[2] in b:
    d+=1
else:
  c.append(d)
  print(min(c))

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scanner()
	z, _ := strconv.Atoi(s[5:7])
	if z < 5 {
		fmt.Println("Heisei")
	} else {
		fmt.Println("TBD")
	}
}


Measured memory_bytes: 1776
T  = int(input())
def gcd(a,b):
    if b==0: return a
    return gcd(b, a%b)
for _ in range(T):
    a,b,c,d =list( map(int, input().split()) )
    if a<b or d<b:
        print('No')
        continue
    a %= b
    d%=b
    d = gcd(d,b)
    if c>= b:
        print('Yes')
        continue
    x = (b-a)//d
    y = a+ x*d
    if y == b: y-=d
    if y>c:
        print('No')
    else:
        print('Yes')


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

int main() {
  int A, B;
  cin >> A >> B;
  if (B % A == 0)
  {
    cout << A + B << endl;
  } else
  {
    cout << B - A << endl;
  }
  
  
  return 0;
}


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

int main () {
int H,W;
cin >> H >> W;
char mat[H][W];
for(int i=0; i<H; i++){
for(int j=0; j<W; j++){
cin >> mat[i][j];
}
}

for(int i=0; i<H; i++){
for(int j=0; j<W; j++){
cout << mat[i][j];
}
cout << '\n';
for(int j=0; j<W; j++){
cout << mat[i][j];
}
cout << '\n';
}
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b+1;i++)
#define Per(i,b,a) for(int i=b;i>=a;i--)
int main(){
    ll N,K;
    cin>>N>>K;
    ll hoge = N%K;
    cout<<min(hoge,K-hoge)<<endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    n=int(input())
    s = set()
    tmp = input()
    s.add(tmp)
    for i in range(n-1):
        tmp2 = input()
        if tmp[-1] != tmp2[0] or tmp2 in s:
            print('No')
            return 
        
        s.add(tmp2)
        tmp = tmp2
    print('Yes')
    
main()

Measured memory_bytes: 3188
from collections import defaultdict
N=int(input())
A=[int(i) for i in input().split()]
dd=defaultdict(int)
for a in A:
    dd[a]+=1
ans=0
for d,s in dd.items():
    #print(d,s)
    if s>=d:
        ans+=s-d
    else:
        ans+=s
print(ans)      

Measured memory_bytes: 18672
#include<cstdio>
#include<algorithm>
int main(){
	int n;
	scanf("%d",&n);
	int a[n]={};
	int b[n]={};
	int c[n]={};
	for(int i=0;i<n;i++){
	scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i++){
		scanf("%d",&b[i]);
	}
	for(int i=0;i<n;i++){
		scanf("%d",&c[i]);
	}
	std::sort(a,a+n);
	std::sort(b,b+n);
	std::sort(c,c+n);
	int aa=0;
	int cc=0;
	long long int ans=0;
	for(int i=0;i<n;i++){
		long long int k=1;
		for(int j=aa;j<n;j++){
			if(a[j]>=b[i]){
				k=j;
				aa=j;
				break;
			}
			if(j==n-1){
				k=n;
				aa=j;
			}
		}
		for(int j=cc;j<n;j++){
			if(b[i]<c[j]){
				k=k*(n-j);
				cc=j;
				break;
			}
			if(j==n-1){
				k=0;
				cc=j;
			}
		}
		ans+=k;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1280
s=input()
n=len(s)
s=s[::-1]
from collections import Counter
c=Counter()
m=0
c[m]+=1
d=1
for i in range(n):
  m+=int(s[i])*d
  m%=2019
  d*=10
  d%=2019
  c[m]+=1

ans=0
for v in c.values():
  ans+=v*(v-1)//2
print(ans)


Measured memory_bytes: 9556
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main(){
  ll N; cin>>N;
  ll Q; cin>>Q;
  vector<int> graph[N+10];
  
  rep(i,N-1){
    ll a,b;
    cin>>a>>b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  } //make the graph
  
  queue<int> q;
  q.push(1);    //初期値
  
  bool seen[N+10];
  
  rep(i,N+10){
    seen[i]=false;
  }
  seen[1]=true; //初期値
  
  ll ans[N+10];
  
  rep(i,N+10){
    ans[i]=0;
  }
  rep(i,Q){
    ll p,x;
    cin>>p>>x;
    ans[p]+=x;
  }
  
  while(!q.empty()){
    ll v=q.front();
    q.pop();
    for(ll next: graph[v]){
      if(seen[next]) continue;
      seen[next]=true;
      q.push(next);
      ans[next]+=ans[v];
    }
  }
  
  rep1(i,N){
    cout<<ans[i]<<" ";
  }
}
    
    
  
  

Measured memory_bytes: 16500
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

struct Node{
  int key;
  Node *right,*left,*parent;
};

Node *root,*NIL;

void insert(int k){
  Node *y=NIL;
  Node *x=root;
  Node *z;
  
  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key <x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }else{
    if(z->key<y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}

void inorder(Node *u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node *u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  string com;
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    cin >> com;
    if(com=="insert"){
      scanf("%d",&x);
      insert(x);
    }else if(com=="print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 26732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;


int main(){
    int N; cin >> N;
    vector<int> A(N); for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < N; i++){
        if(A[i] % 2 == 0){
            if(A[i] % 3 != 0 && A[i] % 5 != 0) {cout << "DENIED" << endl;
            return 0;}
        }
    }
    cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
package main

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

func exec(stdin *Stdin, stdout *Stdout) {
	s := stdin.Read()
	q := stdin.ReadInt()

	d := NewDeque()
	for i := 0; i < len(s); i++ {
		d.AppendLast(s[i : i+1])
	}

	normal := true
	for i := 0; i < q; i++ {
		query := stdin.ReadInt()
		if query == 1 {
			normal = !normal
		} else {
			f := stdin.ReadInt()
			c := stdin.Read()
			if normal {
				if f == 1 {
					d.AppendFirst(c)
				} else {
					d.AppendLast(c)
				}
			} else {
				if f == 1 {
					d.AppendLast(c)
				} else {
					d.AppendFirst(c)
				}
			}
		}
	}

	t := []string{}
	for !d.IsEmpty() {
		if normal {
			c, _ := d.PopFirst().(string)
			t = append(t, c)
		} else {
			c, _ := d.PopLast().(string)
			t = append(t, c)
		}
	}
	stdout.Println(strings.Join(t, ""))
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

type Deque struct {
	head []interface{}
	tail []interface{}
}

func NewDeque() *Deque {
	return &Deque{
		head: []interface{}{},
		tail: []interface{}{},
	}
}

func (d *Deque) AppendLast(v interface{}) {
	d.tail = append(d.tail, v)
}

func (d *Deque) AppendFirst(v interface{}) {
	d.head = append(d.head, v)
}

func (d *Deque) PopLast() interface{} {
	if len(d.tail) == 0 {
		v := d.head[0]
		d.head = d.head[1:]
		return v
	} else {
		v := d.tail[len(d.tail)-1]
		d.tail = d.tail[:len(d.tail)-1]
		return v
	}
}

func (d *Deque) PopFirst() interface{} {
	if len(d.head) == 0 {
		v := d.tail[0]
		d.tail = d.tail[1:]
		return v
	} else {
		v := d.head[len(d.head)-1]
		d.head = d.head[:len(d.head)-1]
		return v
	}
}

func (d *Deque) IsEmpty() bool {
	return len(d.head) == 0 && len(d.tail) == 0
}

func (d *Deque) PeekFirst() interface{} {
	if len(d.head) == 0 {
		return d.tail[0]
	} else {
		return d.head[len(d.head)-1]
	}
}

func (d *Deque) PeekLast() interface{} {
	if len(d.tail) == 0 {
		return d.head[0]
	} else {
		return d.tail[len(d.tail)-1]
	}
}


Measured memory_bytes: 116608
#include<bits/stdc++.h>
#define ll long long
#define pi acos(-1.0)
#define sf(a)                scanf("%lld",&a)
#define sff(a,b)             scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)          scanf("%lld %lld %lld",&a,&b,&c)
#define case(a,b)            printf("Case %lld: %lld\n",a,b)
#define pf(a)                printf("%lld\n",a)
#define pff(a,b)             printf("%lld %lld\n",a,b)
#define pb                   push_back
#define cln(x)               memset(x, 0, sizeof(x))
#define nl                   printf("\n");
const int N=123456;
ll arr[N], i, j;
using namespace std;
int main()
{
    string s;
    while(cin>>s)
    {
        ll ans=700, cnt=0;
        for(i=0; i<3; i++)
        {
            if(s[i]=='o') cnt++;
        }
        ans+=(100*cnt);
        pf(ans);
    }
    return 0;
}


/*
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
*/








Measured memory_bytes: 256
#include <bits/stdc++.h>
#define re return
#define ll long long
#define ull unsigned ll
#define ld long double
#define f first
#define s second
#define pi acos(-1)
#define oo (ll)1e9
#define OO 1e18
#define EPS 1e-6
#define Endl '\n'
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int maxn=100005;

int main()
{
    IO;
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i=0;i<n;++i)cin >> a[i];
    ll ans=accumulate(a.begin(),a.end(),0ll);
    vector<ll> arkam;
    vector<int> num,asle;
    for(int idx=0;idx<=40;++idx){
        ll fade=0;
        ll mlyan=0;
        for(auto i:a){
            if(i&(1ll<<idx))++fade;
            else ++mlyan;
        }
        if(mlyan>fade)num.push_back(1);
        else num.push_back(0);
        if(k&(1ll<<idx))asle.push_back(1);
        else asle.push_back(0);
        mlyan-=fade;
        arkam.push_back(mlyan*(1ll<<idx));
    }
    bool ok=false;
    for(int i=40;i+1;--i){
        if(ok){
            if(num[i])ans+=arkam[i];
            continue;
        }
        if(num[i]==1&&asle[i]==1)ans+=arkam[i];
        if(num[i]==0&&asle[i]==1)ok=true;
    }
    cout<<ans<<endl;
    re 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}
int N;

int main(){
	cin >> N;
	int ans = 0;
	for(int i = 1; i <= N; i++){
		int base = 1;
		int cnt = 0;
		while(true){
			if(i % base == i) break;
			base *= 10;
			cnt++;
		}
		if(cnt % 2 == 1) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
sn = [input() for _ in range(n)]

ls = [0, 0, 0, 0]

for s in sn:
    if s == 'AC':
        ls[0] += 1
    elif s == 'WA':
        ls[1] += 1
    elif s == 'TLE':
        ls[2] += 1
    else:
        ls[3] += 1

l = ['AC', 'WA', 'TLE', 'RE']
for i in range(4):
    print(l[i], 'x', ls[i])



Measured memory_bytes: 16188
#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(), 

int n,k;
string s;

signed main(){
    vi v;
    cin>>n>>k>>s;
    int sum=0;
    for(int i=0;i<n;i++){
        v.push_back(s[i]=='R');
        while(i+1<n && s[i]==s[i+1])i++,sum++;
    }
    
    if(v.front()==v.back()){
        cout<<sum+2*min((int)(v.size()-1)/2,k);
    }else{
        if(k>=v.size()/2){
            cout<<sum+(v.size()/2-1)*2+1;
        }else cout<<sum+2*k;
    }
    
}


Measured memory_bytes: 4388
module UnionFind_i32 = struct
  let init n = Array.make n (-1)
  let is_root i a = a.(i) < 0
  let rec root_destructive x a =
    if a.(x) < 0 then x
    else (a.(x) <- root_destructive a.(x) a; a.(x))
  let size_destructive i a = let r = root_destructive i a in -r
  let same_destructive x y a = root_destructive x a = root_destructive y a
  let connect_destructive x y a =
    let p,q = root_destructive x a,root_destructive y a
    in if p = q then () else (
      let p,q = if a.(p) > a.(q) then q,p else p,q
      in
      a.(p) <- a.(p) + a.(q); a.(q) <- p)
end;;
Scanf.(Array.(scanf " %d %d" @@ fun h w ->
  let m = init h (fun _ -> scanf " %s" @@ fun v -> v) in
  let enc i j = i*w+j in
  UnionFind_i32.(
    let uf = init (h*w) in
    let k0,k1 = make (h*w) 0,make (h*w) 0 in
    iteri (fun i -> String.iteri (fun j c ->
      (if c='#' then k0 else k1).(enc i j) <- 1)) m;
    iteri (fun i ->
      String.iteri (fun j _ ->
        for k=0 to 1 do
          let s,t = i+k,j+1-k in
          if
            0<=s && s<=h-1 &&
            0<=t && t<=w-1 &&
            m.(s).[t] <> m.(i).[j] &&
            not @@ same_destructive (enc i j) (enc s t) uf
          then (
            (* Printf.printf " %d %d (%d) -- %d %d (%d)\n" i j (enc i j) s t (enc s t) ; *)
            let u,v =
              root_destructive (enc i j) uf,
              root_destructive (enc s t) uf in
            let w = k0.(u) in
            k0.(u) <- k0.(u) + k0.(v);
            k0.(v) <- k0.(v) + w;
            let w = k1.(u) in
            k1.(u) <- k1.(u) + k1.(v);
            k1.(v) <- k1.(v) + w;
            connect_destructive (enc i j) (enc s t) uf
          )
        done;
      )
    ) m;
    fold_left (fun (sum,i) _ ->
      if is_root i uf then (
        let u,v = k0.(i),k1.(i) in
        (sum + u*v, i+1)
      ) else (sum, i+1)
    ) (0,0) uf
    |> fst |> print_int)))

Measured memory_bytes: 7296
import math

N, D = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(N)]
counter = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        temp = 0
        for k in range(D):
            temp += ((x[i][k] - x[j][k]) ** 2)
        temp = math.sqrt(temp)
        if temp.is_integer():
            counter += 1
print(counter)


Measured memory_bytes: 9032
//by xiqiao
#include<bits/stdc++.h>
#define maxn 1000005
using namespace std;
char s[maxn],t[maxn];
int n,pre[maxn],q[maxn];
int b[maxn],ans;
int lowbit(int x){return x&(-x);}
int add(int x){
	//cout<<x<<endl;
	for(int i=x;i<=n;i+=lowbit(i))b[i]++;
}
int query(int x){
	int ret=0;
	for(int i=x;i;i-=lowbit(i))ret+=b[i];
//	cout<<x<<" "<<ret<<endl;
	return ret;
}
int main(){
//	freopen("game.in","r",stdin);
//	freopen("game.out","w",stdout);
	scanf("%d",&n);
	scanf("%s",s+1);scanf("%s",t+1);
	bool flag=1;
	for(int i=1;i<=n;i++)if(s[i]!=t[i])flag=0;
	if(flag){
		puts("0");return 0;
	}
	for(int i=n,j=n;i;i--){
		if(j>i)j=i;
		while(j && s[j]!=t[i])j--;
		if(!j){
			puts("-1");return 0;
		}
		pre[i]=j;
	}
	int l=1,r=0;ans=1;
	for(int i=n;i>=1;i--)if(pre[i]>pre[i-1]){
		while(l<=r && q[l]-(r-l)>i)l++;
		if(i!=pre[i])q[++r]=pre[i],ans=max(ans,r-l+2);
	}
	printf("%d\n",ans);
	return 0;
}

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

int main() {

  int A, B, C;
  cin >> A >> B >> C;

  string answer = "NO";

  for (int i = 1; i <= A; i++) {
    int v = B * i + C;
    if (v % A == 0) {
      answer = "YES";
      break;
    }
  }
  
  cout << answer << endl;

}

Measured memory_bytes: 256
#include "stdio.h"
int main(void)
{
	/* code */
	int a,b,c;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	if (a<b && b < c)
	{
		printf("Yes\n");
	}
	else
		printf("No\n");
	return 0;
}


Measured memory_bytes: 580
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=5010;
ll f[N][N<<1];
int n,a[N],x;
ll A,B;
ll pan(int x,int y)
{
	if (x<y) return B;
	else if (x>y) return A;
	else return 0;
}
ll pan1(int x,int y)
{
	if (x-1>=y) return A;
	else return B;
}
int main() {
	scanf("%d",&n);
	scanf("%lld%lld",&A,&B);
	for (int i=1;i<=n;i++) scanf("%d",&x),a[x]=i;
	for (int i=1;i<=n;i++) {
		for (int j=1;j<=n*2+1;j++) 
		 if (j%2==0) f[i][j]=f[i-1][j-1]+pan(j/2,a[i]);
		 else f[i][j]=f[i-1][j]+pan1(j/2+1,a[i]);
		for (int j=2;j<=n*2+1;j++) f[i][j]=min(f[i][j],f[i][j-1]); 
	}
	ll ans=10000000000000000;
	for (int i=1;i<=n*2+1;i++) ans=min(ans,f[n][i]);
	cout << ans << endl;
} 

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define INF 1e15
ll Q;
ll f, x,xa,bb,al,ah;
ll i, j, k,l;
vector<ll> anss;
priority_queue<ll,vector<ll>,greater<ll>> aqh;
priority_queue<ll> aql;

int main(){
    scanf("%lld", &Q);
    j = 0;
    f = 0;
    x = 0;
    aql.push(-INF);
    aqh.push(INF);
    fornum(i,0,Q){
        ll q;
        scanf("%lld", &q);
        if(q==1){
            ll a, b;
            scanf("%lld%lld", &a, &b);
            bb += b;
            if(aql.size()==aqh.size()){
                ll qa = aqh.top();
                if(qa<a){
                    aqh.pop();
                    aqh.push(a);
                    aql.push(qa);
                    ah -= qa - x;
                    al += x - qa;
                    ah += a - x;
                }else{
                    aql.push(a);
                    al += x - a;
                }
            }else{
                ll qa = aql.top();
                if(a<qa){
                    aql.pop();
                    aql.push(a);
                    aqh.push(qa);
                    al -= x - qa;
                    ah += qa - x;
                    al += x - a;
                }else{
                    aqh.push(a);
                    ah += a-x;
                }
            }
            ll nx = aql.top();
            al += (aql.size() - 1) * (nx - x);
            ah -= (aqh.size() - 1) * (nx - x);
            x = nx;
            j++;
        }else{
            if(j==0){
                printf("-1000000000 0\n");
            }else{
                printf("%lld %lld\n", x, al + ah + bb);
            }
        }
        //printf("b%lld %lld\n", aql.top(), aqh.top());
    }
    return 0;
}

Measured memory_bytes: 3828
#include<iostream>
#include<iomanip>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  cout << setprecision(10);
  const long M = 1e9+7;
  int N;
  cin >> N;
  string S;
  cin >> S;
  long ret=S[0]=='B'?1:0;
  long c=1;
  for(int i=1; i<2*N; i++){
    if(i%2==1 ^ S[i]=='B'){
      c++;
    }else{
      c--;
      ret=(ret*(c+1))%M;
    }
  }
  if(c!=0) ret=0;
  for(int i=2; i<=N; i++) ret=(ret*i)%M;
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 640
fun main(args: Array<String>) {
  val (m1, d1) = readInts()
  val (m2, d2) = readInts()
  println(if (m1 == m2) 0 else 1)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(' ')
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }



Measured memory_bytes: 38040
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int n;
  cin>>n;
  map<string,int>m;
  m["AC"]=0;
  m["WA"]=0;
  m["TLE"]=0;
  m["RE"]=0;
  while(n--){
    string s;
    cin>>s;
    m[s]++;
  }
  cout<<"AC x "<<m["AC"]<<'\n';
  cout<<"WA x "<<m["WA"]<<'\n';
  cout<<"TLE x "<<m["TLE"]<<'\n';
  cout<<"RE x "<<m["RE"]<<'\n';
  return 0;
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

ll X, Y;

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

  cin >> X >> Y;
  ll ans  = 0ll;
  ll tmp = Y;
  while(tmp >= X) {
    tmp >>= 1;
    ans++;
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    int a, b; cin >> a >> b;
    if (max(a, b) > 8) out(":(");
    else out("Yay!");
}


Measured memory_bytes: 256
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    



int main(){
   IOS

    int x; cin>>x;
    if(x >= 30){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }





}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1) res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e3+7;
const ll mod = 1e9+7;
const int sz = 62;
#define afdafafafdafaf y1;
int n,m;

int main()
{
    scanf("%d", &n);
    int ans = 0;
    ans += n*(n-1)*(n-2);
    ans += n*(n-1)*3;
    printf("%d\n", ans+n);

    return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll a, b;cin >> a >> b;
	if(a < 10 && b < 10)cout << a * b << endl;
	else cout << -1 << endl;

	return 0;
}


Measured memory_bytes: 764
def inpl(): return [int(i) for i in input().split()]
def nextin(nwin,prin):
    if not prin[1] == nwin[1]+1 and nwin[1] != W-1:
        return [nwin[0],nwin[1]+1]
    if not prin[1] == nwin[1]-1 and nwin[1] != 0:
        return[nwin[0],nwin[1]-1]
    else:
        return[nwin[0]+1,nwin[1]]

H, W = inpl()
HW = []
Ans = []
ctr = 0
for i in range(H):
    gyou = inpl()
    for j in gyou:
        if j%2 != 0:
            ctr += 1
    HW.append(gyou)
ctr = ctr//2
ans = 0
previn = [0,-1]
nowin = [0,0]
while ctr != 0:
    a,b = nowin
    c,d = nextin(nowin,previn)
    if HW[a][b]%2 == 1:
        HW[c][d] += 1
        if HW[c][d]%2 == 0:
            ctr -=1
        Ans.append([a+1,b+1,c+1,d+1])
    previn = [a,b]
    nowin = [c,d]
print(len(Ans))
for i in Ans:
    print(*i)

Measured memory_bytes: 30120
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
int d;
int main()
{
	cin>>d;
	if(d==22) cout<<"Christmas Eve Eve Eve"<<endl;
	else if(d==23) cout<<"Christmas Eve Eve"<<endl;
	else if(d==24) cout<<"Christmas Eve"<<endl;
	else cout<<"Christmas"<<endl;
	return 0;
}

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

int main() {
  string s; cin >>s;
  rep(i,0,s.size()) {
    if (!(i%2)) cout <<s[i];
  }
  cout <<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 0, 4) ans += s[i] == '+' ? 1 : -1;
    cout << ans << endl;
}

Measured memory_bytes: 256