akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//万合以致，向阳而生——背叛时代，忠于时间//
#pragma GCC optimize(3,"Ofast","inline")
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef unsigned long long ull;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(register int i=0; i<n; i++)
#define Forn(i, n) for(register int i=1; i<=n; i++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)
#define mid l+r>>1
#define lid id<<1|1
#define rid (id<<1)+2
#define lson lid, l, mid
#define rson rid, mid, r

inline int in()
{
    char c=getchar();
    int neg=1, x=0;
    while(!isdigit(c)) (c=='-')?neg=-1, c=getchar():c=getchar();
    while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48), c=getchar();
    return neg*x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}

const int MAX=20e5+5;

int N, M, ret, ptr, mark[MAX], fail[MAX], cnt[MAX];
char tt[MAX];
set<int> tmp;
string s, t;
vi v;

inline void kmp()
{
    fail[0]=ptr=-1;
    Forn(i, M)
    {
        while(ptr>-1&&t[ptr]!=t[i-1]) ptr=fail[ptr];
        fail[i]=++ptr;
    }
    
    ptr=0;
    forn(i, s.size())
    {
        while(ptr>-1&&s[i]!=t[ptr])
            ptr=fail[ptr];
        ptr++;
        if(ptr>=M) mark[i-M+1]=1;
    }
}

int main()
{
    memset(cnt, -1, sizeof(cnt));
    scanf("%s", tt); s=tt;
    scanf("%s", tt); t=tt;
    while(s.size()<t.size()) s+=s;
    N=s.size(), M=t.size();
    s+=s;
    
    kmp();
    forn(i, N) if(cnt[i]==-1)
    {
        int p=i, c=0;
        tmp.clear();
        while(mark[p])
        {
            if(tmp.count(p))
            {
                puts("-1");
                return 0;
            }
            if(~cnt[p])
            {
                c=cnt[p];
                break;
            }
            v.pb(p), tmp.insert(p);
            p=(p+M)%N;
        }
        if(!v.size()) cnt[i]=0;
        else
        {
            c++;
            while(v.size())
                cnt[v.back()]=c,
                c++, v.pop_back();
            ret=max(ret, c-1);
        }
    }
    printf("%d\n", ret);
    return 0;
}
// baaab
//abaaba


Measured memory_bytes: 47036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;

struct BIT {
    int N;
    vector<ll> bit;

    void init(int _n){
        N = _n;
        bit.resize(_n+1, 0LL);
    }
    ll getSum(int i) {  // i番目までの要素の和を求める(1-index)
        ll sum = 0;
        while (i > 0) {
            sum += bit[i];
            i -= i & -i;
        }
        return sum;
    }
    void add(int i, ll x) {  // i番目の要素にxを加算
        while (i <= N) {
            bit[i] += x;
            i += i & -i;
        }
    }
};

struct SegmentTree {
    int N;
    vector<int> node;
    const int INF = INT_MAX;

    SegmentTree(){}
    SegmentTree(int n_){
        init(n_);
    }
    void init(int siz){
        N = 1;
        while (N < siz) N *= 2;  // 最下段の要素数を2のべき乗にする
        node.resize(2*N-1, INF);
    }
    void build(vector<int> &dat){
        int siz = dat.size();
        init(siz);
        for(int i=0; i<siz; i++){
            node[i+N-1] = dat[i];
        }
        for(int i=N-2; i>=0; i--){  // 最下段に値を入れたあと下から順に更新
            node[i] = min(node[2*i+1], node[2*i+2]);
        }
    }
    void update(int k, int a) {
        k += N - 1; // 最下段最左の節点の番号
        node[k] = a;
        while (k > 0) { //登りながら上の要素を更新
            k = (k-1)/2;
            node[k] = min(node[k*2+1], node[k*2+2]);
        }
    }
    int getMin(int a, int b) {return getMin(a, b, 0, 0, N);}
    int getMin(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l)
            return INF;  //[a,b)と[l,r)に共通区間がないならINF
        if (a <= l && r <= b)
            return node[k];  //[a,b)が[l,r)を完全に含むならその節点kの値
        else {
            int vl = getMin(a, b, k*2+1, l, (l+r)/2);
            int vr = getMin(a, b, k*2+2, (l+r)/2, r);
            return min(vl, vr);
        }
    }
};

ll n, k;
vector<int> x, pos, ans;
BIT rsq;
SegmentTree rmq;

int main() {
    cin >> n >> k;
    x.resize(n);
    pos.resize(n+1);
    ans.resize(n, -1);
    for(int i=0;i<n;i++){
        cin >> x[i];
        pos[x[i]] = i;
    }
    ll inv = 0;  // 転倒数
    rsq.init(n);
    for(int i=n;i>=1;i--){
        inv += rsq.getSum(pos[i]+1);
        rsq.add(pos[i]+1, 1);
    }
    k = max(0LL, inv - k);
    if(k == 0) ans = x;
    else{
        rmq.build(x);
        for(int i=0;i<n;i++){
            int j = rmq.getMin(0, n);  // 貪欲に最小の数を先頭に持っていく
            while(rsq.getSum(pos[j]) > k){  // 不可能ならばその前方の最小値
                j = rmq.getMin(0, pos[j]);
            }
            ans[i] = j;
            k -= rsq.getSum(pos[j]);
            rsq.add(pos[j]+1, -1);
            rmq.update(pos[j], rmq.INF);
            if(k==0)break;
        }
        for(int i=0,j=0;i<n;i++){
            if(ans[i] < 0){
                while(rmq.getMin(j,j+1)==rmq.INF) j++;
                ans[i] = rmq.getMin(j,j+1);
                rmq.update(j, rmq.INF);
            }
        }
    }
    for(int i=0;i<n;i++){
        cout << ans[i] << endl;
    }
    return 0;
}



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

int64_t ryuka (int n) {
  if (n == 0) {
    return 2;
  } else if (n == 1) {
    return 1;
  } else {
    int64_t r, r0, r1;
    r0 = 2;
    r1 = 1;
    for (int i = 2; i < n + 1; i++) {
      r = r1 + r0;
      r0 = r1;
      r1 = r;
    }
    return r;
  }
}

int main() {
  int N;
  cin >> N;
  cout << ryuka(N) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 1000;

class Insertion_Sort {
public:
	int i, v, j, element;

	void Sort(int A[], int N) {
		for (int i = 1; i < N; i++) {
			v = A[i];
			j = i-1;
			while (j >= 0 && A[j]>v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			trace(A, N);
		}
	}

	void trace(int A[],int N) {
		int i;
		for (i = 0; i < N; i++) {
			if (i > 0) {
				cout << " ";
			}
			cout << A[i]; 
		}
		cout << endl;

	}
};

	int main() {
		int N;
		int A[MAX];

		cin >> N;

		int element;

		for (int i = 0; i < N; i++) {
			cin >> element;
			A[i] = element;
		}
		

		Insertion_Sort is;
		
		is.trace(A, N);
		
		is.Sort(A, N);


		return 0;

	}

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

int main(int argc, char *argv[]){
  int i;
  int dim;
  int *data;
  int min,max;
  long long int sum;
  //get data
  scanf("%d", &dim);
  data=(int *)malloc(sizeof(int)*dim);
  for(i=0; i<dim; i++){
    scanf("%d", &data[i]);
  }
  //init
  sum=0;
  min=data[0];
  max=data[0];
  //calc
  for(i=0; i<dim; i++){
    sum+=data[i];
    if(min>data[i]){
      min=data[i];
    }
    if(max<data[i]){
      max=data[i];
    }
  }
  printf("%d %d %lld\n", min, max, sum);
  free(data);
  return(0);
}


Measured memory_bytes: 2104
#include<iostream>
#include<algorithm>
using namespace std;
const int MAX_N=1e3*5;
const int INF=1e8;
int a[MAX_N];
int main(){
	int n;
	while(cin>>n && n!=0){
		for(int i=0;i<n;i++)cin>>a[i];
		sort(a,a+n);
		int ans=INF;
		for(int i=0;i<n-1;i++){
			ans=min(ans,a[i+1]-a[i]);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,long long> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n,d,a;
pii x[200005];
int main(){
    scanf("%d %d %d",&n,&d,&a);
    for(int i=0;i<n;i++)
        scanf("%d %d",&x[i].fi,&x[i].se),x[i].se=(x[i].se+a-1)/a;
    sort(x,x+n);
    ll ans=0;
    for(int i=n-1;i>=1;i--) x[i].se=x[i].se-x[i-1].se;
    for(int i=0;i<n;i++){
        if(i!=0) x[i].se+=x[i-1].se;
        ans+=max(x[i].se,0ll);
        int ha1=upper_bound(x,x+n,mp(x[i].fi+2*d,1000000001ll))-x;
        ll now=x[i].se;
        x[i].se-=max(now,0ll);
        x[ha1].se+=max(now,0ll);
    }
    printf("%lld\n",ans);
    return 0;
}

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

int main(void) {
  int N;
  cin >> N;
  bool flag = true;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    if (A % 2 == 0) {
      flag &= (A % 3 == 0 || A % 5 == 0);
    }
  }
  cout << (flag ? "APPROVED" : "DENIED") << endl;
  return 0;
}

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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

int N, M, L;
int d[305][305];
int d2[305][305];

int main(){
    cin >> N >> M >> L;

    rep(i, N) {
        rep(j, N) {
            d[i][j] = INF;
        }
    }
    rep(i, N) d[i][i] = 0;

    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        d[a][b] = d[b][a] = c;
    }

    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    rep(i, N) {
        rep(j, N) {
            d2[i][j] = INF;
        }
    }
    rep(i, N) d2[i][i] = 0;

    rep(i, N) {
        rep(j, N) {
            if (d[i][j] <= L) d2[i][j] = 1;
        }
    }

    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
            }
        }
    }

    int Q;
    cin >> Q;
    rep(i, Q) {
        int s, t;
        cin >> s >> t;
        s--, t--;
        if (d2[s][t] != INF) {
            cout << d2[s][t] - 1 << endl;
        } else {
            cout << -1 << endl;
        }
    }
}

Measured memory_bytes: 1280
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

typedef long long ll; //64bit型
using namespace std;
const ll INF = 1LL << 20;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main()
{
        string S, T;
        cin >> S;
        for (int i = 0; i < S.size(); i++)
        {
                if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T')
                {
                        T += '1';
                }
                else
                {
                        T += '0';
                }
        }

        int ans = 0;
        for (int i = 0; i < T.size(); i++)
        {
                if (T[i] == '1')
                {
                        int cnt = 0;
                        for (int j = i; j < T.size(); j++)
                        {
                                if (T[j] == '1')
                                {
                                        cnt++;
                                }
                                else
                                {
                                        break;
                                }
                        }
                        ans = max(ans, cnt);
                }
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
	string s; cin >> s;
	int sz = s.length();
	string t; cin >> t;
	cout << (t.substr(0, sz) == s ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <map>
using namespace std;
typedef long long ll;
#define GG puts("FUCK")
#define N 500050
#define mr(x,y) make_pair(x,y)
int mod1=998244353,base1=19260817,inv1;
int mod2=353448299,base2=20000003,inv2;
int h1[N],mi1[N],imi1[N],p[N],n,C;
int h2[N],mi2[N],imi2[N];
char str[N];
map<pair<int,int>,int>mp;
int qp(int x,int y,int p) {
	int re=1;
	for(;y;y>>=1,x=ll(x)*x%p) if(y&1) re=ll(re)*x%p;
	return re;
}
int main() {
	inv1=qp(base1,mod1-2,mod1);
	inv2=qp(base2,mod2-2,mod2);
	scanf("%d%s",&n,str+1);
	int i;
	for(mi1[0]=imi1[0]=mi2[0]=imi2[0]=i=1;i<=(n<<1);i++) {
		mi1[i]=ll(mi1[i-1])*base1%mod1;
		imi1[i]=ll(imi1[i-1])*inv1%mod1;
		mi2[i]=ll(mi2[i-1])*base2%mod2;
		imi2[i]=ll(imi2[i-1])*inv2%mod2;
	}
	p[0]=n;
	for(i=1;i<=n;i++) {
		if(str[i]=='+') {
			p[i]=p[i-1];
			h1[i]=(h1[i-1]+mi1[p[i]])%mod1;
			h2[i]=(h2[i-1]+mi2[p[i]])%mod2;
		}else if(str[i]=='-') {
			p[i]=p[i-1];
			h1[i]=(h1[i-1]-mi1[p[i]]+mod1)%mod1;
			h2[i]=(h2[i-1]-mi2[p[i]]+mod2)%mod2;
		}else if(str[i]=='>') {
			p[i]=p[i-1]+1;
			h1[i]=h1[i-1]; h2[i]=h2[i-1];
		}else {
			p[i]=p[i-1]-1;
			h1[i]=h1[i-1]; h2[i]=h2[i-1];
		}
		mp[mr(h1[i],h2[i])]++;
	}
	ll ans=0;
	for(i=1;i<=n;i++) {
		int d=p[i-1]-n,t1=h1[n],t2=h2[n];
		if(d>=0) t1=ll(t1)*mi1[d]%mod1,t2=ll(t2)*mi2[d]%mod2;
		else t1=ll(t1)*imi1[-d]%mod1,t2=ll(t2)*imi2[-d]%mod2;
		t1=(t1+h1[i-1])%mod1;
		t2=(t2+h2[i-1])%mod2;
		ans+=mp[mr(t1,t2)];
		mp[mr(h1[i],h2[i])]--;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 44416
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << endl;
#else
#define DBG(X)
#define endl '\n'
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

const int N = 100;

ll p[N][N];

inline bool is_square(ll x)
{
	for(ll y = 1; y * y <= x; ++y)
	{
		if(y * y == x)
			return true;
	}

	return false;
}

void solve()
{
	int n, d;
	cin >> n >> d;

	for(int i = 0; i < n; ++i)
		for(int j = 0; j < d; ++j)
			cin >> p[i][j];

	int cnt = 0;

	for(int i1 = 0; i1 < n; ++i1)
	{
		for(int i2 = i1 + 1; i2 < n; ++i2)
		{
			ll dist = 0;

			for(int j = 0; j < d; ++j)
				dist += (p[i1][j] - p[i2][j]) * (p[i1][j] - p[i2][j]);

			cnt += is_square(dist);
		}
	}

	cout << cnt << endl;
}

int main()
{
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
// while (clock()<=69*CLOCKS_PER_SEC)
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define erase_duplicates(x) sort(all(x)); (x).resize(distance((x).begin(), unique(all(x))));


using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<
T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<" = "<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<" = "<<h<<", "; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#define cerr if(0)cout
#endif

const int maxn = (1e6)+7;
const int maxk = 20;
const int inf = (1e9)+7;
const LL LLinf = ((LL)1e18)+7LL;
const LD eps = 1e-9;
const LL mod = 1e9+7;

// ***************************** CODE ***************************** //

int main()
{
	_upgrade
  string s;
  cin>>s;
  cout<<s[0]<<s[1]<<s[2];

	return 0;
}


Measured memory_bytes: 3648
x,n=map(int,input().split())
a=list(map(int,input().split()))
if n==0:
  ans=x
else:
  ans=0
  for i in range(101):
    y=x-i
    if y not in a:
      ans=y
      break
    z=x+i
    if z not in a:
      ans=z
      break
print(ans)


Measured memory_bytes: 9108
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

int N, B[101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 1, N) cin >> B[i];

    int ans = 0;
    ans += B[1]; // A[1]
    rep(i, 2, N) ans += min(B[i - 1], B[i]); // A[2]～A[N-1]
    ans += B[N-1]; // A[N]
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <map>
#include <fstream>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define INF 1e9 
typedef long long ll;
typedef long double ld;
int main(){
    ll n, m;
    cin>>n>>m;
    vector<pair<int,int>> v(m);
    REP(i,m){
        int a,b;
        cin>>a>>b;
        v[i].first=b, v[i].second=a;
    }
    sort(ALL(v));
    vector<bool> bridge(n);
    int brk=-1;
    REP(i,m){
        int from=v[i].second, to=v[i].first;
        if(from<=brk&&brk<to){
            continue;
        }else{
            bridge[to-1]=true;
            brk=to-1;
        }
    }
    int ans=0;
    REP(i,n)if(bridge[i])ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4028
#![allow(non_snake_case)]
use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let mut vec: Vec<usize> = vec![];
    for _ in 0..N {
        vec.push(read());
    }
    let mut min = 1_000_000;
    for p in 1..101 {
        let mut now = 0;
        for &v in &vec {
            let diff = std::cmp::max(p, v) - std::cmp::min(p, v);
            now += diff * diff;
        }
        min = std::cmp::min(min, now);
    }
    println!("{}", min);
}


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

int main(){
  int n, k;
  long long a[200005];
  cin >> n >> k;
  rep(i, n)cin >> a[i];

  auto candivide = [&](int nagasa){
    int kai = 0;
    if(nagasa==1)return true;
    for(int i=0;i<n;i++){
      if(a[i]<=nagasa-1)continue;
      kai += (a[i]+nagasa-2)/(nagasa-1)-1;
    }
    // cout << "(" << nagasa << "," << kai << ")";
    if(k>=kai)return true;
    else return false;
  };

  long long mn = 1;
  long long mx = 1000000001;
  rep(i, 1000){
    long long mid = (mn+mx)/2;
    if(candivide(mid))mx=mid;
    else mn = mid;
    // cout << "(" << mn << "," << mx << ")";
  }
  cout << mn << endl;
  
  return 0;
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll a;
    cin >> a;
    cout << a + a * a + a * a * a << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007
 
using namespace std;
  
typedef long long int ll;
 
const ll INF=(ll)1e18;
 
int main(){
    int N;
    cin >> N;
 
    map<ll, int> m;
    vector<ll> a;
 
    REP(i,N){
        ll tmp;
        cin >> tmp;
        m[tmp]++;
        if(m[tmp] % 2 == 0){
            a.push_back(tmp);
        }
    }
    if(a.size() > 1){
        sort(a.begin(),a.end());
        cout << a[a.size()-1] * a[a.size()-2] << endl;
    }else{
        cout << 0 << endl;
    }
 
}

Measured memory_bytes: 9752
#include<bits/stdc++.h>
#define fint register int
#define h 5001
#define p 834534
#define int long long
using namespace std;
int a[p];
signed main()
{
	int n;
	cin>>n;
	for(fint i=1;i<=n;i++)
	cin>>a[i];
	int tic=0,mon=1000;
	for(fint i=1;i<=n;i++)
	{
		if(a[i]>a[i-1])
		mon+=a[i]*tic,tic=0;
		if(a[i+1]>a[i])//后一天比这一天价格高，就在这一天狂买
		tic+=(mon/a[i]),mon=mon%a[i];
	}
	cout<<mon;
	return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()
const int INF = 1e9;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;

int cost[100][100];
int main()
{
	int N, M;
	while (cin>>N>>M, N) {
		rep(i, N) rep(j, N) cost[i][j] = (i==j?0:INF);
		
		rep(i, M) {
			int q; cin>>q;
			if (q==0) {
				int a, b;
				cin>>a>>b; a--, b--;
				
				cout << (cost[a][b] < INF ? cost[a][b] : -1) << endl;
			} else {
				int a, b, c;
				cin>>a>>b>>c; a--, b--;
				
				for (int i=0; i<N; i++) {
					for (int j=0; j<N; j++) {
						cost[i][j] = min({cost[i][j], cost[i][a] + cost[j][b] + c, cost[i][b]+ cost[j][a] + c});
					}
				}
			}
		}
	}
}

Measured memory_bytes: 1200
import sys
def input():return sys.stdin.readline().strip()
from collections import deque

def main():
    N = int(input())
    info = [tuple(map(int, input().split())) for _ in range(N-1)]
    Q, K = map(int, input().split())
    queries = [tuple(map(int, input().split())) for _ in range(Q)]

    to = [[] for _ in range(N)]
    for a, b, c in info:
        a -= 1
        b -= 1
        to[a].append((b, c))
        to[b].append((a, c))
    
    INF = 10**18
    dist = [INF]*N
    def dfs(s):
        stack = deque()
        push = stack.append
        pop = stack.pop

        dist[s] = 0
        push(s)

        while stack:
            now = pop()
            now_cost = dist[now]

            for nv, c in to[now]:
                if dist[nv] != INF:
                    continue
                dist[nv] = now_cost + c
                push(nv)


    # query
    K -= 1
    dfs(K)
    ans = []
    for x, y in queries:
        x -= 1
        y -= 1
        xy = dist[x] + dist[y]
        ans.append(xy)

    print(*ans, sep="\n")
if __name__ == "__main__":
    main()

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

int main(){
	ll aI, aO, aT, aJ, aL, aS, aZ;
	cin >> aI >> aO >> aT >> aJ >> aL >> aS >> aZ;
	if(aI%2 == aJ%2 && aJ%2 == aL%2){ cout << aI + aJ + aL + aO << endl; }
	else{
		if((aI + aJ + aL) % 2 == 0 && min(min(aI, aJ), aL) == 0){
			cout << aI + aJ + aL + aO - 2 << endl;
		}else{ cout << max(0LL, aI + aJ + aL + aO - 1) << endl; }
	}
	return 0;
}

Measured memory_bytes: 256
S = input()

oklist = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

s1 = S[0:2]
s2 = S[2:4]
ok1 = s1 in oklist
ok2 = s2 in oklist

if ok1 and ok2:
    print('AMBIGUOUS')
elif ok1:
    print('MMYY')
elif ok2:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {
    int A, B, K;
    int a, b, mid;

    cin >> A >> B >> K;
    a = A;
    b = B;
    mid = (A + B) / 2;
    for (int i = 0; i < K; i++) {
        if (A + i >= a && A + i <= b && A + i <= mid) {
            cout << A + i << endl;
        }
    }
    for (int i = K - 1; i >= 0; i--) {
        if (B - i >= a && B - i <= b && B - i > mid) {
            cout << B - i << endl;
        }
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, spf[N];

void sieve() {
	for (int i = 1; i < N; i++) {
		spf[i] = i;
	}

	for (int i = 2; i * i < N; i++) {
		if (spf[i] != i) continue;
		for (int j = i * i; j < N; j += i) {
			spf[j] = min(spf[j], i);
		}
	}
}

int divisors(int x) {
	int ans = 1;

	while (x > 1) {
		int d = spf[x];
		int cnt = 0;

		while (x % d == 0) {
			cnt += 1;
			x /= d;
		}
		
		ans *= (cnt + 1);
	}

	return ans;
}

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

	cin >> n;

	int ans = 0;
	for (int c = 1; c < n; c++) {
		int nn = n - c;
		ans += divisors(nn);
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 7552
#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 N,Y;
    
    cin>>N>>Y;
    rep(i,N){
      for(int t=0;t<=N-i;t++)
      {
        if((9*i+4*t+N)==(Y/1000)){
          cout<<i<<" "<<t<<" "<<N-i-t<<endl;
          return 0;
        }
      }
    }
    cout<<"-1 -1 -1"<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	int n;
	cin >> n;
	int res = 0, target = n;
	while (target) {
		res += target % 10;
		target /= 10;
	}
	if (n % res == 0)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int MOD=1e9+7,MAX=1e6;
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
typedef struct{int SPF[1000001];int Primes[1000001];int sz;}Template;
struct T{int fact[1000001],inv[1000001];};
Template P;struct T MODINV;
static inline int MPow(int a,int b){return b?1l*MPow(1l*a*a%MOD,b>>1)*(b&1?a:1)%MOD:1;}
static inline void ready(void)
{
  *P.SPF=1,*P.Primes=2,P.sz=1;
  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;
  rep(i,MAX/2-1)
  {
    int x=2*(i+1)+1;if(P.SPF[x]==x){P.Primes[P.sz++]=x;}if(x*x>MAX)break;
    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}
  }
}
static inline void init(void)
{
  MODINV.fact[0]=1;rep(i,MAX)MODINV.fact[i+1]=1l*MODINV.fact[i]*(i+1)%MOD;
  MODINV.inv[MAX]=MPow(MODINV.fact[MAX],MOD-2);
  rep(i,MAX)MODINV.inv[MAX-1-i]=1l*MODINV.inv[MAX-i]*(MAX-i)%MOD;
}
int main(void)
{
  int N=IN(),A=0,flag=0,invsum=0,k=0,lcm=1,x=0,unique[10000],box[168]={0};ready();init();
  rep(i,N)
  {
    A=IN();invsum=(invsum+1l*MODINV.fact[A-1]*MODINV.inv[A]%MOD)%MOD;
    rep(j,168){x=0;while(A%P.Primes[j]==0){A/=P.Primes[j];if(box[j]<++x)box[j]=x;}}
    if(A!=1){rep(j,k){if(unique[j]==A)flag=1;continue;}if(!flag)unique[k++]=A;}flag=0;
  }
  rep(i,168){rep(j,box[i]){lcm=1l*lcm*P.Primes[i]%MOD;}}
  rep(i,k){lcm=1l*lcm*unique[i]%MOD;}
  x=1l*lcm*invsum%MOD;return printf("%d\n",x),0;
}

Measured memory_bytes: 13324
l, r = map(int,input().split())

if r-l > 2017 or l%2019 > r%2019:
  print(0)
else:
  ans = 2018
  for i in range(l%2019, r%2019):
    for j in range(i+1, r%2019+1):
      if ans > (i*j)%2019:
        ans = (i*j)%2019
  print(ans)

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

using namespace std;

int main(){
    int n;
    cin >> n;
    if (n == 1){
            double ans = 1.0;
                printf("%.10f\n", ans);
        return 0;

    }
    if (n % 2 == 0){
        double ans = 0.5;
        printf("%.10f\n", ans);
        return 0;
    }
    int x = (n + 1) / 2;
    double ans = x * 1.0 / (n * 1.0);
    printf("%.10f\n", ans);
    return 0;
}


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

using namespace std;
using ll = long long;

ll f(ll n, ll d) {
    return (d + (n / d) * d) * (n / d) / 2;
}

void solve() {
    ll n;
    cin >> n;
    cout << f(n, 1) - f(n, 3) - f(n, 5) + f(n, 15);
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);

    solve();
}


Measured memory_bytes: 3652
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())



void init() {

}

void input() {

}

void solve() {
  int x, a;
  cin >> x >> a;
  if (x < a) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }
}

int main() {
	init();
	input();
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,T;
  cin >> N;
  T=0;
  vector<long long> p(N);
  for (int i=0;i<N;i++) {cin >> p[i];}
  sort(p.begin(),p.end());
  for (int i=0;i<N-1;i++) {T+=p[i];}
  cout << T+p[N-1]/2 << endl;
  
}

Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (N, M) = read!(usize, usize);

    let ee = if N == 0 { 0 } else { N * (N - 1) / 2 };
    let oo = if M == 0 { 0 } else { M * (M - 1) / 2 };

    println!("{}", ee + oo)
}


Measured memory_bytes: 4352
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def solve(inp):
    A = list(map(int, inp.readline().strip().split(' ')))
    A += list(map(int, inp.readline().strip().split(' ')))
    A += list(map(int, inp.readline().strip().split(' ')))
    N = int(inp.readline().strip())
    B = [int(inp.readline().strip()) for i in range(N)]

    for b in B:
        for i in range(9):
            if A[i] == b:
                A[i] = 0

    for a, b, c in [
        [0, 1, 2],
        [3, 4, 5],
        [6, 7, 8],
        [0, 3, 6],
        [1, 4, 7],
        [2, 5, 8],
        [0, 4, 8],
        [2, 4, 6],
    ]:
        if A[a] == A[b] == A[c] == 0:
            return "Yes"

    return "No"


def main():
    import sys
    result = solve(sys.stdin)
    if result is not None and result != '':
        print(result)


if __name__ == '__main__':
    main()


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

#ifdef LOCAL
#define DEBUG(...) cerr << #__VA_ARGS__ << ": ", debug(__VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator << (ostream &os, const vector<T> &v) {os << "["; for (int i=0; i<(int)v.size(); i++) {if (i) os << ", "; os << v[i];} return os << "]";}
void debug() {cerr << "\n";} template<typename T, typename... Args> void debug(T x, Args... args) {cerr << x << "; "; debug(args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int x, y, z;
    cin >> x >> y >> z;

    swap(x, y);
    swap(x, z);

    cout << x << " " << y << " " << z << "\n";

    return 0;
}


Measured memory_bytes: 256
def solve(s):
    return 7 - ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"].index(s)


def main():
    s = input()
    print(solve(s))


def test():
    assert solve("SAT") == 1
    assert solve("SUN") == 7


if __name__ == "__main__":
    main()


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for(int i = a; i < b; i++)
#define fastio ios::sync_with_stdio(0); cin.tie(0);

int main() {
	fastio;
	int n;
	string s;
	cin >> n >> s;
	if (n%2 == 1) 
		cout << "No\n";
	else {
		if (s.substr(0, n/2) == s.substr(n/2, n))
			cout << "Yes\n";
		else
			cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<utility>
using namespace std;

int main(){
    int n;cin >> n;
    string s;cin >> s;
    int ans = 0;
    for(int i=1;i<s.size();i++){
        if(s[i] != s[i-1]){
            ans ++;
        }
    }
    ans ++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int M = scan.nextInt();
    String result = "No";
   	if(N==M) {
   		result = "Yes";
   	}
    System.out.println(result);
  }
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int a, b, c, d;

  cin >> a >> b >> c >> d;

  if((a + b) == (c + d)){
      cout << "Balanced" << endl;
  }
  if((a + b) > (c + d)){
      cout << "Left" << endl;
  }
  if((a + b) < (c + d)){
      cout << "Right" << endl;
  }

}


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

int main()
{
    //自作関数の宣言
    vector<unsigned long long> next_p_mod(unsigned, long long);
    unsigned long long modpow(unsigned long long , unsigned long long , unsigned long long);
    void comb(vector<vector<long long int>>, unsigned long long);
    unsigned long long modinv(unsigned long long , unsigned long long);
    //
    ll A, B, L;
  cin>>A>>B;
  L=A-B*2;
  if(L<0){
  L=0;
  }
	cout<<L<<endl;
    return 0;
}

vector<unsigned long long> next_p_mod(unsigned N, long long mod)
{ //next_permutation
    vector<unsigned long long> Next_p(N);
    unsigned long long Next_p_buff = 1;
    for (int i = 0; i < N; i++)
    {
        Next_p_buff *= (i + 1) % mod;
        Next_p.at(i) = Next_p_buff % mod;
    }
    return Next_p;
}
unsigned long long modpow(unsigned long long a, unsigned long long n, unsigned long long mod)
{
    unsigned long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
void comb(vector<vector<long long int>> &v, unsigned long long mod)
{
    //vector<入れたい型> v(配列の個数(x),vector<入れたい型> (配列の個数,初期値));
    for (int i = 0; i < v.size(); i++)
    {
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for (int k = 1; k < v.size(); k++)
    {
        for (int j = 1; j < k; j++)
        {
            v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]) % mod;
        }
    }
}
// a^{-1} mod を計算する
unsigned long long modinv(unsigned long long a, unsigned long long mod)
{
    return modpow(a, mod - 2, mod);
}

// modinv
/*void modinv(unsigned long long N, unsigned long long mod,unsigned long long *inv) {
 // unsigned long long inv[N] ;
  for (unsigned long long i = 1; i < N; i++) {
    inv[i] = (i == 1) ? 1 : (mod - (mod / i) * inv[mod % i] % mod);
    assert(inv[i] * i % mod == 1);
  }
  //return 0;
}*/




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

#define ll  long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define per(i , j , n) for(ll i = j ; i >= n ; i--)


int main(){
    ll n; 
    cin >> n;
    ll a[n];
    ll dp[n] = {0};
    rep(i,0,n){
        cin >> a[i];
    }
    dp[0] = 0;
    dp[1] = abs(a[1] - a[0]);
    rep(i,2,n){
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]),dp[i - 2] + abs(a[i] - a[i - 2]));
    }
    cout << dp[n - 1];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;
 
#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif

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

#define int long long
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (a>b) { a=b; return 1; } return 0; }

//*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)


void solve(){
    string S;
    cin >> S;
    
    int N = S.size();
    if(S[N-1]!='s') S = S+'s';
    else S=S+"es";
    cout << S << endl;
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed;
    solve();
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;

typedef long long LL;
typedef vector<LL> vi;
typedef pair<int,int> pii;

const LL mod = 1e9+7;

LL fastpow(LL b, LL e){
    if (!e) return 1;
    LL u = fastpow(b,e/2);
    return (e&1 ? ((((b%mod)*(u%mod))%mod)*u)%mod : ((u%mod)*(u%mod))%mod);
}
vi primes;
bool isP[100005];

void sieve(){
    memset(isP,1,sizeof(isP));
    isP[0] = isP[1] = 0;
    for (LL i = 2; i < 100000; i++){
        if (isP[i]){
            primes.pb(i);
            for (LL j = i*i; j < 100000; j *= i){
                isP[j] = 0;
            }
        }
    }
}

LL fac[100500];
LL inv[100500];
void computeFac(){
    fac[0] = inv[0] = 1;
    for (LL i = 1; i < 100300; i++){
        fac[i] = (fac[i-1] * i) % mod;
        inv[i] = fastpow(fac[i], mod-2);
    }
}

LL n, m;
vector<LL> factors;

int main(){
    cin >> n >> m;
    sieve();
    computeFac();
    LL product = 1LL;
    for (int i = 0; i < primes.size(); i++){
        if (primes[i] > m) break;
        if (m % primes[i] == 0){
            LL cnt = 0;
            while (m%primes[i] == 0){
                cnt++;
                m /= primes[i];
            }
            factors.pb(cnt);
            //cout << primes[i] << ' ' << cnt << '\n';
        }
    }
    if (m > 1){
        factors.pb(1);
    }
    for (int i = 0 ;i < factors.size(); i++){
        LL u = factors[i];
        product *= (fac[u + n - 1] % mod);
        product %= mod;
        product *= ((inv[n-1] % mod) * (inv[u] % mod))%mod;
        product %= mod;
    }
    cout << product << '\n';

    return 0;
}


Measured memory_bytes: 2804
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    string s, t;
    cin >> s >> t;
    ll ans = 0;
    rep(i, s.size()){
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3916