akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
using namespace std;

struct jobs {
    int day, job;
    jobs(int a, int b) : day(b), job(a) {}
    bool operator<(const jobs &a) const { return day < a.day; }
};

int main() {
    int n, m;
    cin >> n >> m;
    vector<jobs> v;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        v.push_back(jobs(b, m - a));
    }
    sort(v.rbegin(), v.rend());
    int idx = 0, ans = 0;
    priority_queue<int> que;
    for (int day = m; day >= 0; day--) {
        while (idx < n && v[idx].day >= day) {
            que.push(v[idx].job);
            idx++;
        }
        if (que.size()) {
            ans += que.top();
            que.pop();
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1908
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
ll y[10101010];

ll judge(ll x){
  ll count=0;
  for(int i=1;i<=sqrt(x);i++){
    if(x%i==0)count++;
  }
  return count;
}

bool judge_2(ll x){
  ll y = sqrt(x);
  if(y*y==x)return true;
  else return false;
}

int main(){
  ll n;
  cin>>n;
  ll ans=0;
  for(ll i=1;i<3200;i++){
    ll big=i;
    while(big<10101010){
      if(i<=sqrt(big)) y[big]++;
      big+=i;
    }
  }

  rep(i,n){
    if(judge_2(i+1)){
      ans+=(2*y[i+1]-1)*(i+1);
      //cout<<(2*judge(i+1)-1)*(i+1)<<endl;
    }else{
      //cout <<"false"<<endl;
      ans+=2*y[i+1]*(i+1);
      //cout<<2*judge(i+1)*(i+1)<<endl;
    }
  }
  /*rep(i,50){
    cout<<y[i+1]<<endl;
  }*/
  cout << ans;
}


Measured memory_bytes: 82568
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

int main(void){
    int n,m,l,k,a,h;
    while (cin>>n>>m>>l>>k>>a>>h && n) {
        vector<int> d(l);
        for (int i = 0; i < l; i++) cin >> d[i];
        l += 2;
        d.push_back(a);
        d.push_back(h);
        
        vector<vector<int> > e(n, vector<int>(n, 101010));
        for (int i = 0; i < n; i++) e[i][i] = 0;
        for (int i = 0; i < k; i++) {
            int x,y,z;
            cin>>x>>y>>z;
            e[x][y] = z;
            e[y][x] = z;
        }
        
        for (int k = 0; k < n; k++) {
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    e[i][j] = min(e[i][j], e[i][k]+e[k][j]);
                    e[j][i] = e[i][j];
                }
            }
        }
        for (int i = 0; i < l-1; i++) {
            for (int j = i+1; j < l; j++) {
                int x = d[i];
                int y = d[j];
                if (e[x][y] > m) e[x][y] = 101010, e[y][x] = 101010;
            }
        }
        
        for (int k = 0; k < l; k++) {
            for (int i = 0; i < l; i++) {
                for (int j = 0; j < l; j++) {
                    int x = d[i];
                    int y = d[j];
                    int z = d[k];
                    e[x][y] = min(e[x][y], e[x][z]+e[z][y]);
                    e[y][x] = e[x][y];
                }
            }
        }
        
        if (e[a][h] >= 101010) cout << "Help!" << endl;
        else if (e[a][h] > m) cout << e[a][h]*2-m << endl;
        else cout << e[a][h] << endl;
    }
}

Measured memory_bytes: 3048
def is_evenstr(s):
    if len(s)%2 != 0:
        return False
    else:
        k = len(s)//2
        s1 = s[:k]
        s2 = s[k:]
        if s1 == s2:
            return True
        else:
            return False

s = input()
while s:
    s = s[:-1]
    if is_evenstr(s):
        print(len(s))
        break
    

Measured memory_bytes: 3060
#pragma GCC optimize(2)
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cmath>
#include<bitset>
#include<map>
#include<bitset>
#include<time.h>
#include<set>
#include <random>
#include<bitset>
#include<string>
#define pb push_back
#define ll long long
#define sf scanf
#define pf printf
#define maxx 1000050
#define maxn 305
#define dbg(x) cout<<#x<<" = "<<x<<endl;
#define mod (ll)1000000007
#define mm 505
#define debug 0
#define INF 1e18
#define eps 1e-10
#define pll pair<ll,ll>
#define For(i,a,b) for(ll i=(a);i<(b);i++)
#define all(a) a.begin(),a.end()
using namespace std;
ll n, m, t, k,p;

int main() {
    ios::sync_with_stdio(0);

        map<string, int> mp;
        cin >> n;
        For(i, 0, n) {
            string s;
            cin >> s;
            mp[s]++;
        }
        cout << "AC x " << mp["AC"]<<endl;
        cout << "WA x " << mp["WA"] << endl;
        cout << "TLE x " << mp["TLE"] << endl;
        cout << "RE x " << mp["RE"] << endl;

    

}
/*
3
7
7
7
7
3
5
6
*/

Measured memory_bytes: 3524
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9+7;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	int l = s.length();
	for(int i=0;i<l;i++)
		cout<<"x";
	
	return 0;
}
	
	
	
	
	
	
	
	
	
	
	

























Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;

int bitCount(int bits) {
    int cnt = 0;
    for(int mask = 1; mask != 0; mask<<=1) {
        if( (bits & mask) != 0 )
            ++cnt;
    }
    return cnt;
}

int main(){
  int n; cin>>n;
  vector<int> f(n);
  vector<vector<int>> p(n,vector<int>(11));
  rep(i,n){
    int F=0;
    rep(j,10){
      int a; cin>>a;
      if(a==1)
      F|=(1<<(9-j));
    }
    f[i]=F;
  }
  rep(i,n){
    rep(j,11){
      cin>>p[i][j];
    }
  }

  int ans=-INF;
  for(int bit=1;bit<(1<<10);bit++){
    int cnt=0;
    rep(i,n){
      int c=bitCount(bit&f[i]);
      cnt+=p[i][c];
    }
    ans=max(ans,cnt);
  }
  cout<<ans<<endl;
  // rep(i,n)
  // cout<<bitset<16>(f[i])<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<array>
#include<vector>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <utility>
#include <set>

using llint = long long int;
using namespace std;

namespace CsF {
#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define nfor(I,J,K) for(int I = 0;I < J;I+=K)

	string ConvertBit(int N, int e) {
		string s = "";
		int r = 0;
		while (N != 0) {
			r = N % e;
			s = to_string(r) + s;
			N -= r;
			N /= e;
		}
		return s;
	}

	int GCD(int a, int b) {
		if (a < b)swap(a, b);
		int r = a % b;
		while (r != 0) {
			a = b;
			b = r;
			r = a % b;
		}
		return b;
	}

	int LCM(int a, int b) {
		int n = a * b;
		return (n / GCD(a, b));
	}

	int Count(string s, char c) {
		int cou = 0;
		nfor(i, s.length(), 1) {
			if (s[i] == c)cou++;
		}
		return cou;
	}

	vector<int> SieveOfEratosthenes(int N) {
		vector<bool> memo(N + 1);
		vector<int> ret;
		memo[0] = true;
		memo[1] = true;
		for (int i = 2; i < N; i++) {
			if (memo[i])continue;
			ret.push_back(i);
			for (int b = 2; true; b++) {
				if (i*b <= N) {
					memo[i*b] = true;
				}
				else break;
			}
		}
		return ret;
	}

	vector<int> SpInput(int N) {
		vector<int> ret(N);
		nfor(i, N, 1) { cin >> ret[i]; }
		return ret;
	}
}

using namespace CsF;


int main() {
	int N, K;
	cin >> N >> K;
	vector<int> x = SpInput(N);
	int xr, xl;
	int ans = MAX_INT;
	int cost = 0;
	for (int i = 0; i < (N - K + 1); i++) {
		xl = x[i];
		xr = x[i + K - 1];
		cost = min(abs(xr) + abs(xl - xr), abs(xl) + abs(xr - xl));
		ans = min(ans, cost);
	}
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll w,h,x,y;
    cin>>w>>h>>x>>y;
    cout<<(double)w*h/2<<' '<<(x==(double)w/2 && y==(double)h/2?1:0)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<vector>
#include<iostream>
using namespace std;
typedef long long int ll;
#define MOD 1000000007
ll n,k;
bool flag = false;
vector<vector<int>> v(100005);
vector<bool> c(100005);
ll ans = 1;

int func(int node, ll x){
  c[node] = true;
  if(flag) return 0;
  if(k-x <= 0){flag = true; return 0;}
  ans = (ans * (k-x)) % MOD;
  ll deg = 0;
  ll cnt = 0;
  vector<int> tonode;
  for(auto vt: v[node]){
    if(!c[vt]) tonode.push_back(vt);
    if(c[vt]) cnt++;
  }
  if(cnt == 0) cnt = 1;
  else cnt = 2;
  for(auto vt: tonode){
  	func(vt, deg+cnt); deg++;
  }
  return 0;
}


int main(){
   cin >> n >> k;
  for(int i=0;i<n-1;i++){
  	int f,t; cin >> f >> t;
  	v[f-1].push_back(t-1);
    v[t-1].push_back(f-1);
  }
  func(0,0);
  if(flag) cout << 0 << endl;
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15104
#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;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
vector<int> xs,ys;
void add(int x,int y){
	xs.pb(x);
	ys.pb(y);
}
int main(){
	int N,a[50];
	cin>>N;
	rep(i,N) cin>>a[i];
	int mx = -1e9, mn = 1e9,amx=-1,amn=-1;
	rep(i,N){
		if(mx<a[i]) mx=a[i],amx=i;
		if(mn>a[i]) mn=a[i],amn=i;
	}
	if(mx > -mn){
		rep(i,N) add(amx,i);
		rep(i,N-1) add(i,i+1);
	}else{
		rep(i,N) add(amn,i);
		rep(i,N-1) add(N-1-i,N-2-i);
	}
	cout<<xs.size()<<endl;
	rep(i,xs.size()){
		cout<<xs[i]+1<<" "<<ys[i]+1<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ld long double
#define fr first
#define se second
#define pb push_back
using namespace std;
long long a , b , n , cnt  , mx = 1e9;
string s , s1;
int main(){
    ios_base::sync_with_stdio( false );
    cin >> n;
    long long arr[n + 1];
    for( int i = 1;i <= n;i ++ )
        cin >> arr[i];
   for( int i = 1;i <= n;i ++ ){
        if( arr[i] <= mx )
        cnt ++;
   mx = min( mx, arr[i] );
   }
   cout << cnt;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MAX=100005;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,q;
    string s;
    cin>>n>>q>>s;
    Vec c(n);
    ll cnt =0;
    REP(i,1,n){
        if(s[i]=='C'&&s[i-1]=='A') {
            cnt++;
        }
        c[i] = cnt;
    }
   // dbg(c);
    ll l,r;
    rep(i,q){
        cin>>l>>r;
        l--;
        r--;
        cout<<c[r]-c[l]<<endl;
    }

    return  0;
}


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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(12);
    }
} fast;

/* template */
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;
}

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) (x).erase(unique(all(x)), (x).end())
#define int long long

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;

/* main */
signed main(void)
{
    string s;
    cin >> s;
    string o;
    rep(i, s.size())
    {
        switch (s[i])
        {
        case '0':
            o.push_back(s[i]);
            break;

        case '1':
            o.push_back(s[i]);
            break;

        case 'B':
            if (!o.empty())
            {
                o.pop_back();
            }
            break;

        default:
            break;
        }
    }
    cout << o << endl;
    return 0;
}

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

long long lcd(long long a,long long b){
	if(a<b) swap(a,b);
	while(b){
		long long t = a%b;
		a = b;
		b = t;
	}
	return a;
}
long long f(long long a,long long b){
	return a*b/lcd(a,b);
}
int main(){
	long long n,m;
	cin>>n>>m;
	vector<long long>arr(n);
	for(int i=0; i<n; i++){
		cin>>arr[i];
		arr[i]/=2;
	}
	long long LCM = arr[0];
	for(int i=1; i<n; i++) LCM = f(LCM,arr[i]);
	bool qualified = true;
	for(int i=0; i<n; i++){
		if((LCM/arr[i])%2==0) qualified = false;
	}
	if(!qualified) cout<<0;
	else{
		long long ret = m/LCM;
		if(ret%2) cout<<ret/2+1;
		else cout<<ret/2;
	}
}

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

using namespace std;

typedef long long LL;

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define fin "\n"


#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

template <typename T>
inline void chmin(T &l,T r){l=min(l,r);}

template <typename T>
inline void chmax(T &l,T r){l=max(l,r);}

template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}

typedef pair<int,int> P;
#define X first
#define Y second
const LL MOD=1e9+7;
int main(){
    int N,M;
    cin>>N>>M;
    string s;
    cin>>s;
    vector<P> sum(N);
    sum[0].X=(s[0]=='0');
    sum[0].Y=1-sum[0].X;
    FOR(i,1,N)sum[i].X=(s[i]=='0')+sum[i-1].X;
    FOR(i,1,N)sum[i].Y=(s[i]=='1')+sum[i-1].Y;
    vector<int> ub(N);
    iota(ub.begin(),ub.end(),0);
    REP(i,M){
        int l,r;cin>>l>>r;l--;r--;
        chmax(ub[l],r);
    }
    FOR(i,1,N)chmax(ub[i],ub[i-1]);
    //REP(i,N)cout<<sum[i].X<<sum[i].Y<<" ";cout<<endl;
    vector<LL> dp(N+1,0);
    dp[0]=1;
    REP(i,N){
        vector<LL> nxt(N+1,0);
        REP(j,N+1)if(dp[j]){
            const int x=sum[ub[i]].X-j;
            const int y=sum[ub[i]].Y-(i-j);
            if(x)(nxt[j+1]+=dp[j])%=MOD;
            if(y)(nxt[j]+=dp[j])%=MOD;
        }
        swap(dp,nxt);
    }
    cout<<dp[sum.back().X]<<endl;
    return 0;
}


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

int main() {
  string str;
  cin >> str;
  int x, y;
  cin >> x >> y;
  int dis = 0;
  int axis = 0;
  vector<set<int>> st(2);
  for(int i = 0; i < str.size(); i++){
    if(str.at(i) == 'F') {
      dis++;
    } 
    if(str.at(i) == 'T' || i == str.size() - 1) {
      if(st.at(axis).empty()) {
        if(axis == 0) {
          st.at(axis).insert(dis);
        } else {
          st.at(axis).insert(dis);
          st.at(axis).insert(-dis);
        }
      } else {
        set<int> temp;
        for(auto itr = st.at(axis).begin(); itr != st.at(axis).end(); ++itr) {
          temp.insert(*itr + dis);
          temp.insert(*itr - dis);
        }
        st.at(axis).swap(temp);
      }
      axis = (axis + 1) % 2;
      dis = 0;
    }
  }
  if(st.at(1).empty()) st.at(1).insert(0);
  if(st.at(0).count(x) == 1 && st.at(1).count(y) == 1){
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 768
#include <algorithm>
#include <array>
#include <deque>
#include <functional>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#define ll long long int
#define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n)

using namespace std;

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


Measured memory_bytes: 3584
def resolve():
    s = input()
    s = s[::-1]
    c = [0]*2019
    # why?
    c[0] = 1
    r = 0
    d = 1
    for i in s:
        num = int(i) * d % 2019 + r
        num %= 2019
        c[num] += 1
        r = num
        d *= 10
        d %= 2019
    ans = 0
    for i in c:
        ans += i*(i-1)//2
    print(ans)
resolve()

Measured memory_bytes: 68364
N = int(input())
A = list(map(int,input().split()))

A.sort()
from collections import Counter
L = dict(Counter(A))

Xs = list(L.keys())
NX = len(Xs)

B = [0]*(10**6+1)

if NX!=1:
    cnt = 0
    for X in Xs:
        if B[X]>0:
            continue
        else:
            if L[X]==1:
                cnt += L[X]
            check = X
            t = 2
            while check*t<10**6+1:
                B[check*t]=1
                t+=1
    print(cnt)
else:
    if N==1:
        print(1)
    else:
        print(0)

Measured memory_bytes: 151976
N,T=map(int,input().split())
C=[]
time=[]
for i in range(N):
    c,t=map(int, input().split())
    C.append(c)
    time.append(t)
cost=[]
for k in range(N):
    if time[k]<=T:
        cost.append(C[k])

if cost==[]:
    print('TLE')
else:
    print(min(cost))


Measured memory_bytes: 3060
#include <iostream>
typedef long long ll; 
const ll mod = 1e9+7;
#define fo(i, n) for (int i = 0; i < n; i++)
#define sc(n) scanf("%d", &n) 
using namespace std;

int n;

void solve() {
    sc(n);
    int ans[200005] = {0};
    int x;
    fo(i, n-1) {
        sc(x);
        ans[x]++;       
    }
    fo(i, n) {
        printf("%d\n", ans[i+1]);
    }

}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4016
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define pb push_back

int main() {
  int N, M, b, c;
  cin >> N >> M;
  int n_min = 0, n_max = N;
  
  rep(i, M){
    cin >> b >> c;
    n_min = max(b, n_min);
    n_max = min(c, n_max);
  }
  int ans = n_max - n_min + 1;
  if (ans < 0) ans = 0;
  
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
void solve(int n, int k) {
	if (n == 0 && k == 0) return;
	std::vector<int> dealed(n, 0);
	bool dealed_blank_card{ false };
	for (auto i = 0; i < k; ++i) {
		int card;
		std::cin >> card;
		if (card != 0) dealed[card - 1] = 1;
		else dealed_blank_card = true;
	}
	for (auto i = 1; i < n; ++i) {
		if (dealed[i] == 1) dealed[i] += dealed[i - 1];
	}
	for (auto i = n - 1; i > 0; --i) {
		if (dealed[i] > 0 && dealed[i - 1] > 0) dealed[i - 1] = dealed[i];
	}
	int max_length{ 0 };
	if (dealed_blank_card) {
		for (auto i = 0; i < n; ++i) {
			if (dealed[i] == 0) {
				int temp_length{ 0 };
				if (i > 0) temp_length += dealed[i - 1];
				if (i < n - 1) temp_length += dealed[i + 1];
				if (max_length <= temp_length) max_length = temp_length + 1;
			}
		}
	}
	else {
		for (auto i = 0; i < n; ++i) {
			if (max_length < dealed[i]) max_length = dealed[i];
		}
	}
	std::cout << max_length << std::endl;
	std::cin >> n >> k;
	solve(n, k);
}
int main() {
	int n, k;
	std::cin >> n >> k;
	solve(n, k);
}



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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if((a==b && c==d)||(a==c && b==d)||(a==d && c==b)) cout<<"yes"<<endl;
  else cout<<"no"<<endl;
  return 0;
}
  



Measured memory_bytes: 3076
import java.util.Scanner;

public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;
	private int n;

	private char[][] Num = {
			{'1','i','j','k'},
			{'i','-','k','J'},
			{'j','K','-','i'},
			{'k','j','I','-'}
		};

	public void mainrun() {
		scan = new Scanner(System.in);

		while(true) {
			n = Integer.parseInt(scan.nextLine());

			if(n == 0) {
				break;
			}

			while(n-- != 0) {
				int[] dataA = new int[4];
				int[] dataB = new int[4];
				int num,i,j,k;

				num = i = j = k = 0;

				int A = 0;
				for(String d : scan.nextLine().split(" ")) {
					if(A < 4) {
						dataA[A++] = Integer.parseInt(d);
					}else {
						dataB[(A++) - 4] = Integer.parseInt(d);
					}
				}


				for(int a = 0 ; a < 4 ; a++) {
					for(int b = 0 ; b < 4 ; b++) {
						int add = dataA[a] * dataB[b] * (Character.isUpperCase(Num[a][b]) ? -1 : 1 );

						switch(Character.toLowerCase(Num[a][b])) {
						case '1':
						case '-':
							num += add * (Num[a][b] == '-' ? -1 : 1);
							break;
						case 'i':
							i += add;
							break;
						case 'j':
							j += add;
							break;
						case 'k':
							k += add;
							break;
						default:
							break;
						}
					}
				}

				System.out.println(num + " " + i + " " + j + " " + k);
			}
		}



		scan.close();
	}
}


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

vector<int> prime;

void getprime(){
  prime.push_back(2);
  for (int i = 3; i <= 2000; i += 2) {
    for (int j = 0; j < prime.size(); j++) {
      if (i % prime[j] == 0) break;
      if (j == prime.size()-1) prime.push_back(i);
    }
  }
  return;
}

int main(){
  int n; cin >> n;
  getprime();
  int count = 0;
  for (int i = 0; i < prime.size(); i++) {
    if (prime[i] % 5 == 1) {
      if (count != 0) printf(" ");
      printf("%d", prime[i]);
      count++;
    }
    if (count == n) break;
  }
  cout << endl;
  return 0;
}

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

int main() {
  int a[5];
  for(int i=0;i<5;i++){
    cin >> a[i];
  }
  int k;
  cin >> k;
  if(a[4]-a[0] <= k) cout << "Yay!" << endl;
  else cout << ":(" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
#define fir first
#define sec second
#define rep(i,a,b) for (int i = (a) ; i <= (b) ; ++ i)
#define rrp(i,a,b) for (int i = (a) ; i >= (b) ; -- i)
#define gc() getchar()
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc() ; !isdigit(tmp) ; tmp = gc())
    key = (tmp == '-');
  for ( ; isdigit(tmp) ; tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

const int N = 200010;
int n, val[N], num;
ll ans;
int main() {
  string str;
  cin >> str;
  n = (int)str.size();
  rep (i, 1, n) val[i] = str[i-1] - '0';
  rep (i, 1, n) num += val[i];
  rep (i, 1, num) ans += (i + 1) / 2;
  int rec = 0;
  rep (i, 1, n) {
    if (val[i] == 0) {
      ++ rec;
      continue;
    }
    int j = i;
    while (j + 1 <= n && val[j+1] == 1) ++ j;
    ans += (ll)((j - i + 1) / 2) * (n - num);
    if ((j - i + 1)&1) {
      int tmp = i / 2 - (i - rec) / 2;
      ans += n - num - tmp;
    }
    i = j;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4500
a,b,c,x,y = map(int, input().split())
if (a+b) / 2 <= c:
    print(x*a + y*b)
else:
    if x >= y:
        if a / 2 >= c:
            print(2*x*c)
        else:
            print(2*y*c + (x-y)*a)
    else:
        if b / 2 >= c:
            print(2*y*c)
        else:
            print(2*x*c + (y-x)*b)


Measured memory_bytes: 3060
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cstring>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
struct edge { int u, v; ll w; };

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

int compress(int w, vector<int>& x1, vector<int>& x2) {
	int n = x1.size();
	vector<int> x;
	x.push_back(0);
	x.push_back(w);
	for (int i = 0; i < n; i++) {
		x.push_back(x1[i]);
		x.push_back(x2[i]);
	}
	sort(x.begin(), x.end());
	x.erase(unique(x.begin(), x.end()), x.end());
	for (int i = 0; i < n; i++) {
		x1[i] = lower_bound(x.begin(), x.end(), x1[i]) - x.begin();
		x2[i] = lower_bound(x.begin(), x.end(), x2[i]) - x.begin();
	}
	return x.size() - 1;
}

int main() {
	for (;;) {
		int w, h; cin >> w >> h;
		if (w == 0) break;
		int n; cin >> n;
		vector<int> x1(n), y1(n), x2(n), y2(n);
		for (int i = 0; i < n; i++)
			cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
		w = compress(w, x1, x2);
		h = compress(h, y1, y2);
		vector<vector<bool> > a(h);
		for (int y = 0; y < h; y++)
			a[y] = vector<bool>(w);
		for (int i = 0; i < n; i++)
			for (int y = y1[i]; y < y2[i]; y++)
				for (int x = x1[i]; x < x2[i]; x++)
					a[y][x] = true;
		int ans = 0;
		for (int y = 0; y < h; y++)
			for (int x = 0; x < w; x++) {
				if (a[y][x]) continue;
				ans++;
				a[y][x] = true;
				stack<int> sx, sy;
				sx.push(x); sy.push(y);
				while (!sx.empty()) {
					int x = sx.top(); sx.pop();
					int y = sy.top(); sy.pop();
					for (int k = 0; k < 4; k++) {
						int _x = x + dx[k], _y = y + dy[k];
						if (_x >= 0 && _y >= 0 && _x < w && _y < h && !a[_y][_x]) {
							a[_y][_x] = true;
							sx.push(_x); sy.push(_y);
						}
					}
				}
			}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1692
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<functional>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<set>
#include<map>

#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 2e9
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const double PI = acos(-1);

using namespace std;
int A[1000001];

int main(void) {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//	freopen("input.txt", "r", stdin);

	int N; cin >> N;
	ll ans = 1;
	ll temp = 1;
	for (int i = 1; i <= N; i++) {
		ans *= 10;
		ans %= MOD;
		temp *= 8;
		temp %= MOD;
	}
	ans += temp;
	temp = 1;
	for (int i = 1; i <= N; i++) {
		temp *= 9;
		temp %= MOD;
	}
	temp *= 2;
	temp %= MOD;
	ans = (ans + MOD - temp) % MOD;
	cout << ans;
}


Measured memory_bytes: 3652
n = int(input())
h_li = list(map(int, input().split()))
cnt_li =[0] * n
ans = 0
temp = 0
for i in range(n - 1):
    if h_li[i] >= h_li[i + 1]:
        cnt_li[i] += 1
        temp += 1
        if ans < temp:
            ans = temp
    else:
        temp = 0
print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printaa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ for(int j = 0; j < (sizeof(x[0])/sizeof(x[0][0])); j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int bit_count[35] = {};
    ll plus_sum[20] = {0};
    ll minus_sum[20] = {0};
    rep(i,1,20){
        plus_sum[i] = plus_sum[i-1] + pow(2, 2*i - 2);
        minus_sum[i] = minus_sum[i-1] + pow(-2, 2*i - 1);
    }
    ll n = N;
    while(1){
        // print(n);
        if(n == 0) break;
        int pos = -1;
        if(n > 0){
            rep(i,0,20){
                if(plus_sum[i] >= n){
                    pos = i;
                    break;
                }
            }
            int tt = (pos-1)*2;
            bit_count[tt] = 1;
            n -= pow(2, tt);
        }else{
            rep(i,0,20){
                if(minus_sum[i] <= n){
                    pos = i;
                    break;

                }
            }
            int tt = (pos - 1)*2 + 1;
            bit_count[tt] = 1;
            n -= pow(-2, tt);
        }
    }
    bool flg = false;
    if(N == 0){
        print("0");
        return 0;
    }
    rep(i,0,35){
        if(flg){
           cout << bit_count[34-i]; 
        }else if(bit_count[34-i] == 1){
            cout << bit_count[34-i];
            flg = true;
        }
    }
    cout << endl;



    // ll n = N;
    // while(1){
    //     if(n == 0) break;
    //     int min_pos = -1;
    //     ll min_val = 1e12;
    //     rep(i,0,35){
    //         ll val = pow(-2, i);
    //         if(abs(n - val) < min_val){
    //             min_val = abs(n-val);
    //             min_pos = i;
    //         }
    //     }
    //     print(pow(-2, min_pos));
    //     bit_count[min_pos] = 1;
    //     n -= pow(-2, min_pos);
    // }
    // rep(i,0,35){
    //     cout << bit_count[34-i];
    // }
    // print("");

}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <queue>

using namespace std;

int n, m;
long long sum;
priority_queue<int> pq;

int main()
{
    //freopen("input.txt", "r", stdin);
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; i++)
    {
        int t;
        scanf("%d", &t);
        pq.push(t);
    }
    while(m--)
    {
        int t = pq.top();
        pq.pop();
        pq.push(t / 2);
    }
    for(int i = 0; i < n; i++)
    {
        int t = pq.top();
        pq.pop();
        sum += t;
    }
    printf("%lld", sum);
    return 0;
}


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

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

    if (n%2==0)
        cout << (double)n/2/n;
    else
        cout << (double)(n/2+1)/n;
    return 0;
}


Measured memory_bytes: 256
A, B, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
X = [list(map(int, input().split())) for i in range(M)]

ans = [min(a) + min(b)]
for x in X:
    a_idx, b_index, c = x
    ans.append(a[a_idx - 1] + b[b_index - 1] - c)

print(min(ans))

Measured memory_bytes: 42624
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;
ll const MAX_N = 100;
ll const MAX_M = 100;

typedef pair<ll, ll> P;

char maze[MAX_N][MAX_M + 1];  // 迷路を表す文字列の配列
ll H, W;
ll sx, sy;  // スタートの座標
ll gx, gy;  // ゴールの座標

ll d[MAX_N][MAX_M];

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

int bfs() {
    queue<P> que;

    rep(i, H) rep(j, W) d[i][j] = INF;

    que.push(P(sx, sy));
    d[sy][sx] = 0;

    while (que.size()) {
        P p = que.front();
        que.pop();

        // 取り出してきた状態がゴールなら探索をやめる
        if (p.first == gx && p.second == gy) break;

        for (int i = 0; i < 4; i++) {
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];

            if (0 <= nx && nx < W && 0 <= ny && ny < H && maze[ny][nx] != '#' &&
                d[ny][nx] == INF) {
                que.push(P(nx, ny));
                d[ny][nx] = d[p.second][p.first] + 1;
            }
        }
    }

    return d[gy][gx];
}

int main() {
    INIT;

    // ll R, C;
    cin >> H >> W;
    rep(i, H) rep(j, W) { cin >> maze[i][j]; }

    ll ans = 0;
    for (sy = 0; sy < H; sy++) {
        for (sx = 0; sx < W; sx++) {
            if (maze[sy][sx] == '#') continue;

            for (gy = 0; gy < H; gy++) {
                for (gx = 0; gx < W; gx++) {
                    if (maze[gy][gx] == '#') continue;
                    ll dist = bfs();
                    chmax(ans, dist);

                    // rep(y, H) {
                    //     rep(x, W) {
                    //         if (d[y][x] == INF) {
                    //             cout << "# ";
                    //         } else {
                    //             cout << d[y][x] << " ";
                    //         }
                    //     }
                    //     cout << endl;
                    // }
                    // cout << "---" << endl;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
//
#include <iostream>
#include <cmath>
using namespace std;
long long a[100001];
 
int main(){
	long long n,ans=0,min=1000000001;
	cin>>n;
	for (int i=0;i<n;i++){
		cin>>a[i];
		if (abs(a[i])<min) min=abs(a[i]);
	}
	for (int i=0;i<n-2;i++){
		if (a[i]<0){
			a[i]*=-1;
			a[i+1]*=-1;
		}
		ans+=a[i];
	}
	long long x=abs(a[n-2]),y=abs(a[n-1]);
	if (a[n-2]*a[n-1]<0){
		ans+=x+y-2*min;
	}else ans+=x+y;
	cout<<ans<<endl;
	return 0;
} 

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

int main()
{

    char ch[5];
    int cost,i;
    while(cin>>ch){
        cost=700;
        for(i=0;i<3;i++)
            if(ch[i]=='o')
            cost+=100;
        cout<<cost<<endl;
    }
    return 0;
}


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

using namespace std;

int main(void) {
    int n;
    cin >> n;
    vector<int> h(n);
    vector<int> dp(n);
    for (int i = 0; i < n; i++) cin >> h[i];
    dp[0] = 0;
    for (int i = 1; i < n; i++) dp[i] = INT32_MAX;

    for (int i = 0; i < n; i++)
        for (int j = i; j < min(n, i + 3); j++)
            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));


    cout << dp[n - 1] << endl;

    return 0;
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
)

func main() {
	var w string
	fmt.Scanf("%s", &w)
	m := make(map[rune]int, 0)
	for _, v := range w {
		m[v] += 1
	}
	answer := "Yes"
	for _, v := range m {
		if v%2 != 0 {
			answer = "No"
		}
	}
	fmt.Print(answer)
}


Measured memory_bytes: 1844
n = int(input())
plst = list(map(int,input().split()))
ans = 0
for i in range(1,len(plst)-1):
    if plst[i-1] < plst[i] <plst[i+1]\
       or plst[i-1] > plst[i] > plst[i+1]:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef pair< int64 , int64 > Pi;
 
int N, W, H, x[100000], y[100000];
int cpx[100000], cpy[100000];

 
int main()
{
  scanf("%d %d", &W, &H);
  scanf("%d", &N);
  for(int i = 0; i < N; i++){
    scanf("%d %d", &x[i], &y[i]);
    cpx[i] = x[i], cpy[i] = y[i];
  }
  int lowx = 0, highx = 1 << 30;

  sort( x, x + N);
  sort( y, y + N);

  int center = (N - 1) / 2;
  int64 ret = 1LL << 60, xx, yy;
  for(int i = center; i < center + 3; i++){ // 一緒になりそうなところ
    for(int j = center; j < center + 3; j++){ // 一緒になりそうなところ
      int64 dist = 0LL, big = 0LL, cost;
      for(int k = 0; k < N; k++){
        cost = llabs( x[i] - cpx[k]) + llabs( y[j] - cpy[k]);
        dist += cost * 2;
        big = max( cost, big);
      }
      dist -= big;
      if(ret > dist){
        ret = dist;
        xx = x[i];
        yy = y[j];
      }
    }
  }
  cout << ret << endl;
  cout << xx << " " << yy << endl;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

vvl a;
vl c;
vb pick;
ll n,m,x,res = L_INF;
void dfs(ll cnt){
    if(cnt == n){
        ll sum = 0;
        vl r(m);
        rep(i,n){
            if(pick[i]){
                sum+=c[i];
                rep(j,m){
                    r[j] += a[i][j];
                }
            }
        }
        rep(i,m) if(r[i] < x) return;
        res = min(res,sum);
        return;
    }
    pick[cnt] = true;
    dfs(cnt+1);
    pick[cnt] = false;
    dfs(cnt+1);
}
signed main()
{   
    gearup;
    cin >> n >> m >> x;
    a.resize(n,vl(m));
    c.resize(n);
    pick.resize(n);
    rep(i,n){
        cin >> c[i];
        rep(j,m)cin >> a[i][j];
    }
    dfs(0);
    cout << ((res == L_INF)?-1:res) << endl;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define mod 1000000007
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
int main(){
	string s;
	cin>>s;
	if(s[s.size()-1]=='s'){
		cout<<s<<"es";
	}
	else cout<<s<<"s";
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
typedef long long i64;
const int P=1e9+7;
int n,m,pw2[337],mx,e1,e2,f[8207][3],c1[8207],e[17];
int main(){
	scanf("%d%d",&n,&m);
	n-=2;
	mx=1<<n;
	pw2[0]=1;
	for(int i=1;i<mx;++i)c1[i]=c1[i>>1]+(i&1);
	for(int i=1;i<=300;++i)pw2[i]=pw2[i-1]*2%P;
	for(int i=1,a,b;i<=m;++i){
		scanf("%d%d",&a,&b);
		if(a!=1||b!=2)(a==1?e1:a==2?e2:e[a-3])|=1<<b-3;
	}
	f[0][0]=f[0][2]=1;
	for(int i=1,mi=1;i<mx;++i){
		if(!(mi&i))mi<<=1;
		for(int s0=i;s0;s0=s0-1&i)if(s0&mi){
			int s1=i^s0;
			i64 e10=1;
			int ce=0;
			for(int j=0;j<n;++j)if(s1>>j&1)e10=e10*(pw2[c1[s0&e[j]]]-1)%P;
			else if(s0>>j&1)ce+=c1[s1&e[j]];
			f[i][0]=(f[i][0]+e10*pw2[ce]%P*f[s1][0])%P;
			f[i][2]=(f[i][2]+e10*pw2[ce+c1[s1&e1]+c1[s1&e2]]%P*f[s1][0])%P;
			e10=e10*(pw2[c1[s0&e1]]-1)%P*(pw2[c1[s0&e2]]-1)%P;
			f[i][1]=(f[i][1]+e10*pw2[ce]%P*(f[s1][2]+f[s1][1]))%P;
		}
	}
	printf("%d\n",((pw2[m]-(f[mx-1][2]+f[mx-1][1])%P)%P+P)%P);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
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;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a;
    double b; 
    cin>>a>>b;
    ll t = b * 100 + 0.1;
    ll ans = a*t/100;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3644
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
    int a,b;
    char op;
    while (1) {
        scanf("%d %c %d", &a, &op, &b);
        if (op == '+')printf("%d\n", a + b);
        else if (op== '-')printf("%d\n", a - b);
        else if (op== '*')printf("%d\n", a * b);
        else if (op == '/')printf("%d\n", a / b);
        else if (op == '?')break;
    }
    return 0;
}


Measured memory_bytes: 2060
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Int
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
import qualified Data.ByteString.Char8 as BS
import Data.Array.Unboxed
import Data.Array.ST
import Control.Monad.ST

asSTUArray :: ST s (STUArray s i x) -> ST s (STUArray s i x)
asSTUArray x = x

-- Input: s
-- Output: arr
--   forall i x. let j = arr!(i,x) in j == -1 || (s `BS.index` j == x && all (\k -> s `BS.index` k /= x) [i..j-1])
indexTable :: BS.ByteString -> UArray (Int,Char) Int
indexTable s = runSTUArray $ do
  let !n = BS.length s
  arr <- newArray ((0,'a'),(n - 1,'z')) (-1)
  t <- asSTUArray $ newArray ('a','z') (-1)
  forM_ [n-1,n-2..0] $ \i -> do
    let x = BS.index s i
    writeArray t x i
    forM_ ['a'..'z'] $ \y -> do
      j <- readArray t y
      writeArray arr (i,y) j
  return arr

-- Input: s t t_tbl
--   t_tbl == indexTable t
-- Output: arr
--   arr ! (i,j) == length of lcs of (drop i s, drop j t)
lcsTable :: BS.ByteString -> BS.ByteString -> UArray (Int,Char) Int -> UArray (Int,Int) Int
lcsTable s t t_tbl = runSTUArray $ do
  let !m = BS.length s
      !n = BS.length t
  arr <- newArray ((0,0),(m,n)) 0
  forM_ [m-1,m-2..0] $ \ !i -> do
    let !x = BS.index s i
    forM_ [n-1,n-2..0] $ \ !j -> do
      l0 <- readArray arr (i+1, j)
      let k = t_tbl ! (j,x)
      if k /= -1
        then do l1 <- readArray arr (i+1, k+1)
                writeArray arr (i,j) $ max l0 (l1 + 1)
        else writeArray arr (i,j) l0
  return arr

-- Input: s t
-- Output: arr
--   arr ! (i,j) == length of lcs of (drop i s, drop j t)
lcsTable2 :: BS.ByteString -> BS.ByteString -> UArray (Int,Int) Int
lcsTable2 s t = runSTUArray $ do
  let !m = BS.length s
      !n = BS.length t
  arr <- newArray ((0,0),(m,n)) 0
  forM_ [m-1,m-2..0] $ \ !i -> do
    let !x = BS.index s i
    forM_ [n-1,n-2..0] $ \ !j -> do
      let !y = BS.index t j
      l <- if x == y
           then do l2 <- readArray arr (i+1, j+1)
                   return (l2 + 1)
           else do l0 <- readArray arr (i+1, j)
                   l1 <- readArray arr (i, j+1)
                   return (max l0 l1)
      writeArray arr (i,j) l
  return arr

main = do
  s <- BS.getLine
  t <- BS.getLine
  -- BS.length s <= 3000, BS.length t <= 3000, BS.all isAsciiLower s, BS.all isAsciiLower t
  let -- !t_tbl = indexTable t
      -- !table = lcsTable s t t_tbl
      !table = lcsTable2 s t
      !m = BS.length s
      !n = BS.length t
      reconstruct !i !j | i >= m || j >= n = ""
                        | x == y = x : reconstruct (i+1) (j+1)
                        | table ! (i+1,j) >= table ! (i,j+1) = reconstruct (i+1) j
                        | otherwise = reconstruct i (j+1)
        where x = BS.index s i
              y = BS.index t j
  let result = reconstruct 0 0
  if length result == table ! (0,0)
    then putStrLn result
    else error "length mismatch"


Measured memory_bytes: 71804
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
#define __LOCAL

#ifdef __LOCAL
#define DBG(X) cout << #X << " = " << (X) << endl;
#define SAY(X) cout << (X) << endl;
#else
#define DBG(X)
#define SAY(X)
#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>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
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; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int n,m,x;
vector<int> V,W;

ull gcd(ull const& a,ull const& b){
    if(a==1) return 1;
    if(a==0) return b;
    if(a>b) return gcd(a%b,b);
    else return gcd(a,b%a);
}

int main()
{
    fast_io();
    ull A,B,ans;
    cin >> A >> B;
    // ull d = gcd(A,B);
    // ull ans = (ull)A*(B/d);
    ull X = A*B;
  /* 自然数 a > b を確認・入替 */
    if(A<B){
        ull tmp = A;
        A = B;
        B = tmp;
    }
 
  /* ユークリッドの互除法 */
  ull r = A % B;
  while(r!=0){
    A = B;
    B = r;
    r = A % B;
  }
 
    ans = X/B;


    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e8
#define MOD 1000000007
typedef long long ll;

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

      int a,b,c,d; cin >> a >> b >> c >> d;
      int i = 0;
      while(a>0 && c>0){
          if(i%2==0){
              c-=b;
          }else{
              a-=d;
          }
          i++;
      }

      if(a<=0) cout <<"No" << endl;
      else cout << "Yes" << endl;

      return 0;
}


Measured memory_bytes: 3656