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


int main(){
  int n,i;
  cin >> n;
  bool ha=true;
  map<string,int> mp;
  char saigo;
  for(i=0;i<n;++i){
    string w;
    cin >> w;
    if(i==0){
      mp[w]++;
      int si=w.size()-1;
      saigo=w[si];
    }else{
      if(saigo!=w[0]){
        ha=false;
      }else{
        mp[w]++;
        int si=w.size()-1;
        saigo=w[si];
      }
    }
  }
  for(auto p : mp){
    if(p.second>=2){
      ha=false;
    }
  }
  if(ha==false){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

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

struct perm{
private:
    int sz;
    vector<ll> p,invp;
public:
    perm(int n){
        sz=n+1;
        p.resize(sz),invp.resize(sz);
        p[0]=1;
        for(int i=1;i<=sz-1;i++){
            p[i]=p[i-1]*i%mod;
        }
        invp[sz-1]=mod_pow(p[sz-1],mod-2);
        for(int i=sz-2;i>=0;i--){
            invp[i]=invp[i+1]*(i+1)%mod;
        }
    }
    ll comb(ll x,ll y){
        if(x<y||y<0)return 0;
        return (p[x]*invp[x-y]%mod)*invp[y]%mod;
    }
};
perm p(1<<20);
class Solution {
public:
    int countOrders(int n) {
        ll ans=1;
        for(int i=0;i<n;i++){
            ans*=p.comb(2*n-i*2,2);
            ans%=mod;
        }
        return ans;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,k; cin >> k >> n;
    for(int i=2;i<=2*k;i++){
        ll ans=0;
        if(i%2){
            ll ans=0;
            ll cnt=0;
            for(int j=1;j<=k;j++){
                if(1<=i-j&&i-j<=k){
                    if(i-j<j)cnt++;
                }
            }
            for(int j=0;j<=cnt;j++){
                if(j>n)continue;
                ans+=p.comb(cnt,j)*mod_pow(2,j)%mod*p.comb(k-(cnt-j)*2-j-1+n-j,n-j)%mod;
                ans%=mod;
            }
            cout << ans << endl;
        }else{
            ll ans=0;
            ll cnt=0;
            for(int j=1;j<=k;j++){
                if(1<=i-j&&i-j<=k){
                    if(i-j<j)cnt++;
                }
            }
            for(int j=0;j<=cnt;j++){
                if(j>n)continue;
                ans+=p.comb(cnt,j)*mod_pow(2,j)%mod*p.comb(k-(cnt-j)*2-j-1-1+n-j,n-j)%mod;
                ans%=mod;
            }
            for(int j=0;j<=cnt;j++){
                if(j>n)continue;
                ans+=p.comb(cnt,j)*mod_pow(2,j)%mod*p.comb(k-(cnt-j)*2-j-1-1+n-1-j,n-1-j)%mod;
                ans%=mod;
            }
            cout << ans << endl;
        }
    }
}


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

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF ((1<<30)-1)
#define LLINF ((1LL<<62)-1)
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME ((1ll<<61)-1)

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

inline void out() {
	cout<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

bool isout(int h, int w, int H, int W) {
	return ( h<0 || h>=H || w<0 || w>=W );
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}


ll N,Q,B;
llvec H,W;
ll nowX,nowY;

void input() {
	cin>>N>>Q;
	B = (N-2)*(N-2);
	H.resize(N-2,-1);
	W.resize(N-2,-1);
	nowX=nowY=N-2;
}

void solve() {
	for(int i=0; i<Q; i++) {
		int mode; cin>>mode;
		switch(mode) {
			case 1: {
				int x; cin>>x; x-=2;
				int dep = (H[x]==-1 ? nowY : H[x]);
				chmin(nowX,ll(x));
				for(int j=x+1; j<N-2&&H[j]==-1; j++) H[j]=nowY;
				B-=dep;
				break;
			}
			case 2: {
				int x; cin>>x; x-=2;
				int dep = (W[x]==-1 ? nowX : W[x]);
				chmin(nowY,ll(x));
				for(int j=x+1; j<N-2&&W[j]==-1; j++) W[j]=nowX;
				B-=dep;
				break;
			}
			default:
				break;
		}
	}

	cout<<B<<endl;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 6308
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
static const double EPS = 1e-10;
static const double PI  = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const int INF = 1 << 30;
// static const ll INF = 1LL << 62;
// --------------------------------------------------------


ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    if (n > 0) {
        res = mod_pow(x, n / 2, mod);
        if (n % 2 == 0) res = (res * res) % mod;
        else res = (((res * res) % mod) * x) % mod;
    }
    return res;
}


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

    ll N, X, M; cin >> N >> X >> M;

    VLL A(M);
    REP(i, M) {
        A[i] = mod_pow((ll)i, 2, M);
    }

    VLL B;
    B.push_back(X);
    VB found(M, false);
    ll l = 0;
    REP(_, M) {
        ll C = A[B.back()];
        if (found[C]) {
            l = find(ALL(B), C) - B.begin();
            break;
        }
        found[C] = true;
        B.push_back(C);
    }

    ll loop_len = (SZ(B) - l);
    ll ans = 0;
    if (N <= l) {
        REP(i,N) ans += B[i];
    } else {
        REP(i,l) ans += B[i];
        ll q = (N - l) / loop_len;
        ll r = (N - l) % loop_len;
        ll sum_B = 0;
        FOR(i, l, SZ(B)) {
            sum_B += B[i];
        }
        ans += sum_B * q;
        FOR(i,l,l+r) ans += B[i];
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 4572
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc146/tasks/abc146_a>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    map<string,int> mp;
    mp["SUN"] = 7;
    mp["MON"] = 6;
    mp["TUE"] = 5;
    mp["WED"] = 4;
    mp["THU"] = 3;
    mp["FRI"] = 2;
    mp["SAT"] = 1;
    
    string S; cin >> S;
    res = mp[S];
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

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

  vector<pair<string, int> > p(n);
  map<pair<string, int>, int> idx;
  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> x;
    p[i].second = -x;
    idx[p[i]] = i + 1;
  }

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

  for (int i = 0; i < n; i++) {
    cout << idx[p[i]] << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define rep(i,n) for(int i=0;i<n;i++) 
#define reps(i,a,n) for(int i=a;i<n;i++) 
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
/*v(int) adj[200001];
void dfs(int i,int p){
    rep(j,adj[i].size()){
        if(p!=adj[i][j])
            dfs(adj[i][j],i);
    }
}*/
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  int n;
  int a[100],b[100];
  cin>>n;
  rep(i,n){
      cin>>a[i]>>b[i];
  }
  rep(i,n-2){
      bool ok=true;
      rep(j,3){
          if(a[i+j]!=b[i+j]) {ok=false;break;}
      }
      if(ok){cout<<"Yes"<<endl;return 0;}
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3648
//
//  ITP1_2.cpp
//  
//
//  Created by anthony on 2015/06/15.
//
//

#include <stdio.h>
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
using namespace std;

int main(){
    int a;
    cin >> a;
    a = a * a * a;
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct data{
	int bit,v;
	double cost;
	data(){}
	data(int bb,int vv,double cc){
		bit=bb;
		v=vv;
		cost=cc;
	}
	bool operator<(const data &d)const{
		return d.cost<cost;
	}
};

int n,m;
P za[201][2];
P factory[15];
double dist[1<<15][15];
double dp[15][15];
double stf[201][2][15];

struct graph_scc{
	int V;
	vector<int> G[501];
	vector<int> rG[501];
	vector<int> vs;
	bool used[501];
	int cmp[501];
	void init(int n){
		V=n;
		for(int i=0;i<V;i++){
			G[i].clear();
			rG[i].clear();
		}
		vs.clear();
		memset(cmp,0,sizeof(cmp));
	}
	void add_edge(int from,int to){
		G[from].push_back(to);
		rG[to].push_back(from);
	}

	void dfs(int v){
		used[v]=true;
		for(int i=0;i<G[v].size();i++){
			if(!used[G[v][i]])dfs(G[v][i]);
		}
		vs.push_back(v);
	}
	void rdfs(int v,int k){
		used[v]=true;
		cmp[v]=k;
		for(int i=0;i<rG[v].size();i++){
			if(!used[rG[v][i]])rdfs(rG[v][i],k);
		}
	}

	int scc(){
		memset(used,0,sizeof(used));
		vs.clear();
		for(int v=0;v<V;v++){
			if(!used[v])dfs(v);
		}
		memset(used,0,sizeof(used));
		int k=0;
		for(int i=vs.size()-1;i>=0;i--){
			if(!used[vs[i]]){
				rdfs(vs[i],k++);
			}
		}
		return k;
	}
};

graph_scc sc;

bool C(double v){
	sc.init(n*2);
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			for(int k=i+1;k<n;k++){
				for(int l=0;l<2;l++){
					bool flag=false;
					for(int a=0;a<m;a++){
						for(int b=0;b<m;b++){
							double diss=stf[i][j][a];
							diss+=stf[k][l][b];
							diss+=dp[a][b];
							if(diss<=v)flag=true;
						}
					}
					if(!flag){
						sc.add_edge(i+j*n,k+(1-l)*n);
						sc.add_edge(k+l*n,i+(1-j)*n);
					}
				}
			}
		}
	}
	int k=sc.scc();
	for(int i=0;i<n;i++){
		if(sc.cmp[i]==sc.cmp[i+n])return false;
	}
	return true;
}

int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d%d%d%d",&za[i][0].first,&za[i][0].second,&za[i][1].first,&za[i][1].second);
	}
	for(int i=0;i<m;i++){
		scanf("%d%d",&factory[i].first,&factory[i].second);
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<(1<<m);j++){
			for(int k=0;k<15;k++){
				dist[j][k]=1e9;
			}
		}
		dist[(1<<i)][i]=0.0;
		priority_queue<data> que;
		que.push(data(1<<i,i,0.0));
		while(que.size()){
			data d=que.top();
			que.pop();
			if(dist[d.bit][d.v]<d.cost)continue;
			for(int j=0;j<m;j++){
				int valx=(factory[j].first-factory[d.v].first);
				int valy=(factory[j].second-factory[d.v].second);
				double ncost=sqrt(valx*valx+valy*valy)+d.cost;
				if(dist[d.bit|(1<<j)][j]>ncost){
					dist[d.bit|(1<<j)][j]=ncost;
					que.push(data(d.bit|(1<<j),j,ncost));
				}
			}
		}
		for(int j=0;j<m;j++){
			dp[i][j]=dist[(1<<m)-1][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			for(int k=0;k<m;k++){
				int valx=(za[i][j].first-factory[k].first);
				int valy=(za[i][j].second-factory[k].second);
				stf[i][j][k]=sqrt(valx*valx+valy*valy);
			}
		}
	}
	double l=0.0,r=114514.0;
	for(int i=0;i<50;i++){
		double mid=(l+r)/2.0;
		if(C(mid))r=mid;
		else l=mid;
	}
	printf("%.9f\n",r);
	return 0;
}

Measured memory_bytes: 13004
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
    A--; B--; C--; D--;
    string S; cin >> S;

    string ans = "Yes";
    regex re1("##");

    if (regex_search(S.substr(A,C-A+1), re1) || 
        regex_search(S.substr(B,D-B+1), re1)) ans = "No";

    regex re2(R"(\.\.\.)");

    if (D < C) {
        if (!regex_search(
            S.substr(B - 1, (D + 1) - (B - 1) + 1), re2)) ans = "No";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 720
#include <stdio.h>

int main(void) {
	int count[26]={};
	char c;
	int i;
	while ((c=getchar())!=EOF)
	{
		for (i=0; i<26; i++)
		{
			if (c==65+i || c==97+i)
			{
				count[i]++;
			}
		}
	}
	for (i=0; i<26; i++)
	{
		printf("%c : %d\n", 97+i, count[i]);
	}
	return 0;
}

Measured memory_bytes: 524
// In the Name of Allah. Ya Ali!
#include<bits/stdc++.h>
#define bp __builtin_popcount
typedef long long ll;
const ll MAX_N = 55;
const ll MOD = 1e9+7;
using namespace std;

ll ans[MAX_N][MAX_N];
ll mat[MAX_N][MAX_N];
ll n,k;

void mul(ll (&m1)[MAX_N][MAX_N],ll (&m2)[MAX_N][MAX_N])
{
    ll temp[MAX_N][MAX_N];
    memset(temp , 0 , sizeof temp);
    for(int i = 1;i<=n;++i)
    {
        for(int j = 1;j<=n;++j)
        {
            for(int t = 1;t<=n;++t)
            {
                temp[i][j] += (m1[i][t] * m2[t][j]) %MOD;
                temp[i][j] %= MOD;
            }
        }
    }
    memcpy(m1 , temp , sizeof m1);
}

void pw(ll l)
{
    if (l == 1)
    {
        memcpy(ans , mat , sizeof mat);
        return;
    }
    pw(l/2);
    mul(ans,ans);
    if (l&1)
        mul(ans,mat);
}

int main()
{
    cin >> n >> k;
    for(int i = 1;i<=n;++i)
        for(int j = 1;j<=n;++j)
            cin >> mat[i][j];
    pw(k);
    ll res = 0;
    for(int i = 1;i<=n;++i)
        for(int j = 1;j<=n;++j)
            res += ans[i][j] , res %= MOD;
    cout << res;
    return 0;
}


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

#ifndef __TOPCYBERFLOWER
#define debug(...) 0
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif

#define TYPEMAX(type)   numeric_limits<type>::max()
#define TYPEMIN(type)   numeric_limits<type>::min()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
double PI=3.14159265;
int main(void){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	cout.precision(10);
	cout<<fixed;
	cout<<2*PI*(double)n;
    return 0;
}

Measured memory_bytes: 3804
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string a;
    cin >> a;
    cout << "ABC" << a;
}




Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top,S[1000];

void push(int);
int pop();

int main() {
  int a;
  top=0;
  char s[100];

  while(scanf("%s",s)!=EOF){
    if(s[0]=='+'){
      push(pop()+pop());
  }
    else if(s[0]=='-'){
      a=pop();
      push(pop()-a);
    }
    else if(s[0]=='*'){
      push(pop()*pop());
    }
    else{
      push(atoi(s));
    }
  }

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

  return 0;
}

void push(int x){
  S[++top]=x;
}

int pop(){
  top--;

  return S[top+1];

}


Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
bool m[205]={0};
int main(){
	int a,b;
	cin>>a>>b;
	int ans1=INT_MAX,ans2=INT_MAX;
	for(int i=1;i<=b;i++){
		int c;
		cin>>c;
		m[c]=1;
	}
	for(int i=a;;i--)
		if(m[i]==0){
			ans1=a-i;
			break;
		}
	for(int i=a;;i++)
		if(m[i]==0){
			ans2=i-a;
			break;
		}
	if(ans1<=ans2)
		cout<<a-ans1;
	else
		cout<<a+ans2;
	return 0;
}

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

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


int main(){
	int N;
	string S;
	cin >> N;
	cin >> S;
	
	unsigned long int cnt=0;
	unsigned long int r=0,g=0,b=0;
	unsigned long int ans=0;
	
	rep(i,N){
		if(S.at(i)=='R') r++;
		if(S.at(i)=='G') g++;
		if(S.at(i)=='B') b++;
	}
	ans=r*g*b;
	
	repn(i,N){
		repa(i+1,j,N){
			int k=j+(j-i);
          	if(k>N)continue;
			if(S.at(i-1)!=S.at(j-1) && S.at(j-1)!=S.at(k-1) && S.at(k-1)!=S.at(i-1)) cnt++;
		}
	}
	
	
	cout << ans-cnt << endl;
}

Measured memory_bytes: 3632
s = str(input())
n = len(s)+1
a = [0]*n
a_2 = [0]*n
tmp = 1
ems = list(enumerate(s))
for i,c in ems:
    if c == "<":
        a[i+1] = tmp
        tmp += 1
    else:
        tmp = 1

for i,c in reversed(ems):
    if c == ">":
        a[i] = max(a[i],tmp)
        tmp += 1
    else:
        tmp = 1

print(sum(a))


Measured memory_bytes: 81448
#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>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }

inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }



int main()
{
int n,m;
cin  >> n >> m;
cout<<n*m<<endl;    
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  string S,T;
  cin>>S>>T;
  
  bool CAN=true;
  for(int i=0; i<S.size(); ++i){
    CAN=true;
    for(int j=0; j<S.size(); ++j){
      if(j+i<S.size()){
        if(S.at(j+i)!=T.at(j)) CAN=false;
      }
      else{
        if(S.at(j+i-S.size())!=T.at(j)) CAN=false;
      }
    }
    if(CAN) break;
  }
  
  if(CAN) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
using namespace std;

typedef long long ll;

#define MOD 1000000007
#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    int g, r;
    cin >> g >> r;

    int ans = (2 * r) - g;

    p(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <numeric>


int main() {
	int n;

	std::cin >> n;

	int ans = 0;
	for (size_t i = 1; i <= n; i++)
	{
		int temp = i;
		int count = 0;
		while (temp != 0) {
			count++;
			temp /= 10;
		}
		if (count % 2 == 1) {
			ans++;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

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

int main()
{
    char ch;
    
    while(1){
        scanf("%c",&ch);

        if('a'<=ch&&ch<='z'){
            ch-=32;
        }else if('A'<=ch&&ch<='Z'){
            ch+=32;
        }
        
        cout<<ch;

        if ( ch == '\n' ) break;
    }


    return 0;
}


Measured memory_bytes: 3144
N,X=map(int,input().split())
List = list(map(int, input().split()))
height = 0
res = 1
def checkF(k,x):
  if k>x:
    return True
  else:
    return False
    
for i in range(N):
  height += List[i]
  res +=1
  if checkF(height,X):
    res = res-1
    break
print(res)

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

int main()
{
    int n;
    cin >> n;
    int target = 1;
    int num = 0;
    bool isHit = false;
    for(int i = 0; i < n; ++i)
    {
        int t;
        cin >> t;
        if(target == t)
        {
            isHit = true;
            target += 1;
        }
        else
        {
            ++num;
        }
    }
    if(!isHit)
    {
        num = -1;
    }
    cout << num << endl;
    
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "cycle"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

pii pp[MAXN];

map<int, int> segs;

void solve(){
	int n;
	scanf("%d", &n);
	REPN(i, 1, n){
		scanf("%d", &pp[i]._1);
		pp[i]._2 = i;
	}
	sort(pp + 1, pp + n + 1);
	ll ans = 0ll;
	segs[n] = 1;
	REPN(i, 1, n){
		int ind = pp[i]._2;
		pii cur_seg = *segs.lower_bound(ind);
		ans += (ll)pp[i]._1 * (ll)(ind - cur_seg._2 + 1) * (ll)(cur_seg._1 - ind + 1);
		segs.erase(cur_seg._1);
		if (cur_seg._1 > ind){
			segs[cur_seg._1] = ind + 1;
		}
		if (ind > cur_seg._2){
			segs[ind - 1] = cur_seg._2;
		}
	}
	printf("%lld\n", ans);
}	

int main(){

	//freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();	
	}
}

Measured memory_bytes: 4096
use proconio::input;

fn main()
{
    input! {
    m:i64,
    k:i64,
    }

    let mx = (1i64 << m) - 1;

    let ans =
        if k > mx || (mx <= 1 && k > 0) {
            vec![-1]
        } else if k > 0 {
            vec![k].into_iter()
                .chain((0..=mx).filter(|&i| i != k))
                .chain(vec![k])
                .chain((0..=mx).filter(|&i| i != k).rev())
                .collect::<Vec<i64>>()
        } else {
            (0..=mx).chain((0..=mx).rev()).collect::<Vec<i64>>()
        };

    for &i in ans.iter()
    {
        print!("{} ", i);
    }
    println!("");
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    int n,m,k;
    while(cin >> n >> m >> k,n){
        vector<vector<double>> dp(n+1,vector<double>(n*m+1,0));
        dp[0][0]=1.0;
        for (int i=0;i<n;++i){
            for (int j=0;j<=n*m;++j){
                for (int k=1;k<=m&&j+k<=n*m;++k){
                    dp[i+1][j+k]+=dp[i][j]/m;
                }
            }
        }
        double ans=0;
        for (int i=1;i<=m*n;++i){
            ans+=dp[n][i]*max(i-k,1);
        }
        cout << ans << '\n';
    }
}


Measured memory_bytes: 3384
#include <cstdio>
#include <cmath>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
int n, in;
ll m;
stack<int> s[3], temp[3];
void input(stack<int>& s) {
    int num; scanf("%d",&num);
    for (int i=0; i<num; i++) {
        int x; scanf("%d",&x);
        s.push(x);
    }
}
void clear(stack<int>& s) {
    while (!s.empty()) s.pop();
}
// 0-a 1-b 2-c
ll dfs(int from, int to) {
    ll res=1;
    bool con=true;
    while (s[0].size()!=n&&s[2].size()!=n&&res<=m) {
        con=true;
        for (int i=0; i<3&&con; i++) {
            for (int j=0; j<3&&con; j++) {
                if (i==to&&j==from) continue;
                if (s[i].empty()) continue;
                if (abs(i-j)!=1) continue;
                if (!s[j].empty()&&s[i].top()<s[j].top()) continue;
                s[j].push(s[i].top()); s[i].pop();
                from=i; to=j;
                con=false;
            }
        }
        res++;
    }
    return res;
}
int main() {
    while (scanf("%d%lld",&n,&m)) {
        if (!n&&!m) break;
        clear(s[0]); clear(s[1]); clear(s[2]);
        input(s[0]); input(s[1]); input(s[2]);
        ll res=m+1;
        if (s[0].size()==n||s[2].size()==n) {
            puts("0");
            continue;
        }
        for (int i=0; i<3; i++) temp[i]=s[i];
        for (int i=0; i<3; i++) {
            for (int j=0; j<3; j++) {                               // iツつゥツづァj
                if (s[i].empty()) continue;                         // ツづづィツつスツつ「ツづつアツづォツつェツ凝ウ
                if (abs(i-j)!=1) continue;                          // ツ療猟静堋つオツづづ按つ「
                if (!s[j].empty()&&s[i].top()<s[j].top()) continue; // ツ置ツつォツつスツつ「ツづつアツづォツづ可置ツつッツづ按つ「
                s[j].push(s[i].top()); s[i].pop();
                res=min(res, dfs(i,j));
                for (int k=0; k<3; k++) s[k]=temp[k];
            }
        }
        printf("%lld\n",res==m+1?-1:res);
    }
    return 0;
}

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

long long mod = 1e9+7;

long long inv(long long x){
  long long res = 1;
  long long k = mod - 2;
  long long y = x;
  while(k){
    if(k&1)res = (res*y)%mod;
    y = (y*y) % mod;
    k /= 2;
  }
  return res;
}

int N = 1e+5;

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

  vector<int> s(n);
  vector<int> t(m);
  for(int i = 0;i < n;i++){
    cin >> s[i];
  }
  for(int i = 0;i < m;i++){
    cin >> t[i];
  }

  long long ret = 1;
  vector<long long> cnt(m);
  for(int i = 0;i < n;i++){
    long long cur = 0;
    for(int j = 0;j < m;j++){
      long long tmp = cnt[j];
      cnt[j] += cur;
      cnt[j] %= mod;
      if(s[i] == t[j]){
        cur++;
        cur += tmp;
        cur %= mod;
      }
    }
    ret += cur;
    ret %= mod;
  }

  cout << ret << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,e,f,g=0;
	cin>>a>>b>>c;
	d=a;
	e=b;
	f=c;
	if(a==b&&b==c&&b%2==0)
	{
		cout<<"-1"<<endl;
	}
	else
	{
		while(a%2==0&&b%2==0&&c%2==0)
		{
			a=e/2+f/2;
			b=d/2+f/2;
			c=d/2+e/2;
			g++;
			d=a;
			e=b;
			f=c;
		}
		cout<<g<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys
N = int(input())
job = []
for _ in range(N):
  job.append(list(map(int,input().split())))
  
job.sort(key=lambda x:x[1])
b = 0
for i in range(N):
  if job[i][1]-job[i][0]< 0:
    print('No')
    sys.exit()
  if i < N-1:
    b += job[i][0]
    job[i+1][1] -= b
print('Yes')

Measured memory_bytes: 53724
#include<bits/stdc++.h>
using namespace std;
struct masivs{long long val;long long poz;};
masivs r1[110005],g[110005];
long long i,j,n,m,mas[110005][2],x1[110005],d1[110005],d2,r2,x2,rez,liel,x,y,p1,p2;
bool c1(masivs maz,masivs liel)
{
    if (maz.val==liel.val)
    {
        return maz.poz>liel.poz;
    }
    return maz.val>liel.val;
}
int main()
{
    std::cin.sync_with_stdio(false);
    std::cin.tie(0);
    cin >> n >> m;
    i=1;
    while (i<=n)
    {
        cin >> mas[i][0] >> mas[i][1];
        i++;
    }
    j=1;
    mas[0][0]=0;
    mas[0][1]=0;
    while (j<=n)
    {
        d1[j]=mas[j][0]-mas[j-1][0]+d1[j-1];
        x1[j]=mas[j][1]+x1[j-1];
        r1[j].val=x1[j]-d1[j];
        r1[j].poz=j;
        g[j].val=x1[j]-2*d1[j];
        g[j].poz=j;
        rez=max(rez,r1[j].val);
        //cout << j << " " << r1[j] << "\n";
        j++;
    }
    r1[0].val=-1;
    r1[0].poz=-1;
    g[0].val=-1;
    g[0].poz=-1;
    sort(r1,r1+n+1,c1);
    sort(g,g+n+1,c1);
    x=r1[0].poz;
    p1=1;
    y=g[0].poz;
    p2=1;
    //cout << x << " " << y << "  " << x1[x] << " " << d1[x] << " " << x1[y] << " " << d1[y] << "\n";
    i=0;
    mas[n+1][0]=m;
    while (n-i<=x)
    {
        x=r1[p1].poz;
        p1++;
    }
    while (n-i<=y)
    {
        y=g[p2].poz;
        p2++;
    }
    while (i<n)
    {
        //cout << i << " " << x << " " << y << " " << n-i << "  ";
        d2+=mas[n-i+1][0]-mas[n-i][0];
        x2+=mas[n-i][1];
        rez=max(rez,x1[x]-d1[x]+x2-2*d2);
        rez=max(rez,x1[y]-2*d1[y]+x2-d2);
        //cout << d2 << " " << x2 << " " << x1[x] << " " << d1[x] << " " << d1[y] << " " << x1[y] << "\n";
        i++;
        while (n-i<=x)
        {
            x=r1[p1].poz;
            p1++;
        }
        while (n-i<=y)
        {
            y=g[p2].poz;
            p2++;
        }
    }
    cout << rez;
    return 0;
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int N,M,a[100000];
int main(){
	cin>>N>>M;
	rep(i,M) cin>>a[i];
	int ans=0;
	rep(i,M-1) chmax(ans,(a[i+1]-a[i])/2);
	chmax(ans,a[0]-1);
	chmax(ans,N-a[M-1]);
	cout<<ans<<endl;
}

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

int main()
{
	int a, b,first=0;
	while (cin>>a>>b)
	{
		if ((a == 0) && (b == 0)) break;
		int flg = 0;
		if (first!=0)
		{
			cout << endl;
		}
		while (a<=b)
		{
			if ((a % 4 == 0) && (a % 100 != 0 || a%400==0))
			{
				cout << a << endl;
				flg = 1;
			}
			a++;
		}
		if (flg==0)
		{
			cout << "NA" << endl;
		}
		first = 1;
	}
	return 0;
}

Measured memory_bytes: 1160
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, h = IR(3)
    print((a+b)*h//2)
    return

#B
def B():
    d = defaultdict(int)
    d["a"] = deque(S())
    d["b"] = deque(S())
    d["c"] = deque(S())
    tern = "a"
    while d[tern]:
        tern =  d[tern].popleft()
    print(str.capitalize(tern))
    return

#C
def C():
    n, x = LI()
    a = LI()
    ans = 0
    for i in range(n-1):
        if a[i] + a[i + 1] > x:
            if x > a[i]:
                ans += a[i] + a[i + 1] - x
                a[i + 1] = x - a[i]
            else:
                ans += a[i] + a[i + 1] - x
                a[i + 1] = 0
    print(ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 60144
N, K = map(int, input().split())
A = []
for i in range(1, N+1):
    tmp = i
    cnt = 0
    while tmp<K:
        tmp *= 2
        cnt += 1
    A.append(cnt)
pro = []
for i in A:
    pro.append(1/N*(1/2)**i)
print(sum(pro))

Measured memory_bytes: 7064
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr ll INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld PI = acos(-1);
constexpr ld EPS = 1e-11;

bool match(char a, char b){
	return a == '?' || b == '?' || a == b;
}

int main(void){
	string a, b, c;
	cin >> a >> b >> c;
	ll A = a.size(), B = b.size(), C = c.size();
	constexpr ll SHIFT = 10000;

	Vec ab(20000, true), bc(20000, true), ac(20000, true);
	rep(i, A) rep(j, B) if(!match(a[i], b[j])) ab[i - j + SHIFT] = false;
	rep(i, A) rep(j, C) if(!match(a[i], c[j])) ac[i - j + SHIFT] = false;
	rep(i, B) rep(j, C) if(!match(b[i], c[j])) bc[i - j + SHIFT] = false;

	ll ans = LINF;
	REP(i, -5000, 5000){
		REP(j, -5000, 5000){
			if(ab[i + SHIFT] && ac[j + SHIFT] && bc[j - i + SHIFT]){
				ll l = min({0LL, i, j});
				ll r = max({A, i + B, j + C});
				chmin(ans, r - l);
			}
		}
	}
	co(ans);

	return 0;
}


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

int main() {
    int i, j;
    int h, w;
    string tmp;
    cin >> h >> w;

    int mp[h][w];
    int dp[h][w];

    for (i=0; i<h; i++) {
        cin >> tmp;
        for (j=0; j<w; j++) {
            mp[i][j] = dp[i][j] = tmp[j] - '0';
        }
    }

    for (i=0; i<w-1; i++) {
        dp[0][i+1] += dp[0][i];
    }

    for (i=0; i<h-1; i++) {
        dp[i+1][0] += dp[i][0];
    }

    for (i=1; i<h; i++) {
        for (j=1; j<w; j++) {
            dp[i][j] += min(dp[i-1][j], dp[i][j-1]);
        }
    }

    cout << dp[h-1][w-1] << endl;
    return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <iomanip>
#include <algorithm>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    int n,l;
    cin >> n >> l;
    string s[n];
    repi(i,n,0){
        cin >> s[i];
    }
    sort(s,s+n);
    repi(i,n,0){
        cout << s[i];
    }
    cout << endl;
    return 0;
}

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

int c(const void *a, const void *b){
    return *(int *)b-*(int *)a;
}
int main(){
    int i,m[10];
    for(i=0;i<10;i++){
        scanf("%d",m+i);
    }
    qsort(m,10,sizeof(int),c);
    for(i=0;i<3;i++){
        printf("%d\n",m[i]);
    }
    return 0;
}

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

int main() {
  int N,ans=0;
  string S;
  cin >> N >> S;
  
  for(int i=0;i<=999;i++){
    vector<int> V(3);
    V[0] = i/100;
    V[1] = (i%100)/10;
    V[2] = i%10;
    
    int x=0;
    for(int j=0;j<N;j++){
      if(S[j]-'0'==V[x]) x++;
      if(x==3){
        ans++;
        break;
      }
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	char nn[5];
	int n[4],l[4],s[4],ls[4];
	int i,j,wk;
	int ll,ss,lsls;
	int cnt;

	while(1)	{
		scanf("%s",nn);
		for(i=0;i<4;i++)	{
			n[i]=nn[i]-'0';
		}
		if(n[0]==0 && n[1]==0 && n[2]==0 && n[3]==0)	{
			break;
		}
		if(n[0]==n[1] && n[0]==n[2] && n[0]==n[3])	{
			printf("NA\n");
		}
		else {
			cnt=0;
			lsls=n[0]*1000+n[1]*100+n[2]*10+n[3];
//			printf("lsls=%d\n",lsls);
			if(lsls==6174)	{

				printf("%d\n",cnt);
			}
			else	{
				while(1)	{
					cnt++;
					for(i=0;i<4;i++)	{
						l[i]=n[i];
						s[i]=n[i];
					}
					for(i=0;i<4-1;i++)	{
						for(j=i+1;j<4;j++)	{
							if(l[i]<l[j])	{
								wk=l[i];
								l[i]=l[j];
								l[j]=wk;
							}
							if(s[i]>s[j])	{
								wk=s[i];
								s[i]=s[j];
								s[j]=wk;
							}
						}
					}
					ll=l[0]*1000+l[1]*100+l[2]*10+l[3];
					ss=s[0]*1000+s[1]*100+s[2]*10+s[3];
					lsls=ll-ss;
					if(lsls==6174)	{
						break;
					}
					n[3]=lsls%10;
					lsls=lsls/10;
					n[2]=lsls%10;
					lsls=lsls/10;
					n[1]=lsls%10;
					n[0]=lsls/10;
					
				}
				printf("%d\n",cnt);
			}
		}
	}
	return 0;
}


Measured memory_bytes: 552
import sys
from pprint import pprint

def solve(n, a):
    exists = set()
    for a_i in a:
        if a_i in exists:
            return "NO"
        exists.add(a_i)
    return "YES"

if __name__ == '__main__':
    n = sys.stdin.readline().strip()
    a = list(map(int,sys.stdin.readline().strip().split(" ")))
    
    print(solve(n, a))

Measured memory_bytes: 90080
long a[3001],p[3001][3001];i,j;
main(n){
	for(;~scanf("%d",a+i++);)for(j=i;--j;)p[i-1][j-1]=fmax(a[i-1]-p[i-2][j-1],a[j]-p[i-1][j]);
	printf("%ld",*p[*a]);
}

Measured memory_bytes: 68864
import math
a,b,c,d = map(int, input().split())
e = c*d//math.gcd(c,d)
# CでもDでも割り切れない -> Cで割り切れない＋Dで割り切れない - CとDで割り切れない
xa = math.ceil(a/c)-1
xb = b//c
ya = math.ceil(a/d)-1
yb = b//d
za = math.ceil(a/e)-1
zb = b//e
ans = (b-a+1)-(xb-xa)-(yb-ya)+(zb-za)
if ans >=0:
    print(ans)
else:
    print(0)

Measured memory_bytes: 9140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return 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; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, x;
    cin >> n >> x;
    V<> sum(n + 1, 0);
    rep(i, n) {
        int a;
        cin >> a;
        sum[i + 1] = sum[i] + a;
    }
    int ans = 0;
    repn(i, n) ans += sum[i] <= x;
    printf("%d\n", ans);
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 	int n, count=0;
 	cin >> n;

 	for(int i=0;i<n;i++){
 		int l,r;
 		cin >> l >> r;
 		count += r-l+1;
 	}
 	cout << count << endl;
}

Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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

    string S;  cin >> S;
    int N = S.size();

    int zero = 0, one = 0;
    REP(i,N) {
        if (S[i] == '0') zero++;
        else one++;
    }

    int ans = N - abs(zero - one);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
pub fn read_parameters<T>() -> Result<Vec<T>, String>
where
    T: std::str::FromStr,
{
    let mut line = String::new();
    std::io::stdin()
        .read_line(&mut line)
        .map_err(|err| format!("{:?}", err))?;

    let xs = line.trim().split_whitespace();
    let mut result = Vec::new();

    for x in xs {
        let ans = x.parse::<T>().map_err(|_| format!("{}", "parse error"))?;
        result.push(ans);
    }
    Ok(result)
}

fn main() {
    // let (a, b) = read_parameters::<usize>().map(|xs| (xs[0], xs[1])).unwrap();
    let _n = read_parameters::<usize>().unwrap();
    let a = read_parameters::<isize>().unwrap();

    println!(
        "{} {} {}",
        a.iter().min().unwrap(),
        a.iter().max().unwrap(),
        a.iter().sum::<isize>()
    );
}



Measured memory_bytes: 5036
N = int(input())
S = list(input())
ans = 0
for i in range(1,N+1):
    ANS = []
    ANSB = []
    b = 0
    for k in range(i):
        ANS.append(S[k])
    ANS = list(set(ANS))
    for k in range(i,N):
        ANSB.append(S[k])
    ANSB = list(set(ANSB))
    for k in ANSB:
        if k in ANS:
            b += 1
    ans = max(ans,b)
print(ans)
            


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



int main() {
	long long int n,d;
	long long int hantei;
	long long int i, j;
	scanf("%llu", &n);
	hantei = n - 1;
	for (i = 1; i < 10000000; i++) {
		if (n%i == 0) {
			d = n / i;
			if (hantei > (i - 1) + (d - 1)) {
				hantei = (i - 1) + (d - 1);
			}
		}
	}

	
	printf("%llu\n",hantei);

	return 0;
}

Measured memory_bytes: 128