akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int a, b, c; cin >> a >> b >> c;
    
    cout << (a+b+c+max(a,max(b,c))*9) << ln;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main(){
    int n,m;
    cin>>n>>m;
    UnionFind uf(n);
    for(int i=0;i<m;++i){
        int a,b;
        cin>>a>>b;
        --a,--b;
        uf.merge(a,b);
    }
    
    int res=0;
    for(int i=0;i<n;++i) res=max(res,uf.size(i));

    cout<<res<<endl;
}

Measured memory_bytes: 4040
#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 per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) int64 x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(a);
    cii(b);
    int emin = (a%2==0)?a * 12.5:a * 12.5 + 0.5;
    int emax = (a%2==0)?(a+1) * 12.5:(a+1) * 12.5 - 1;
    int tmin = b * 10;
    int tmax = tmin + 9;

    auto ans = (max(emin, tmin) <= min(emax, tmax))?max(emin, tmin):-1;

    co(ans);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
int main() {
	int a,b,c,x;
	int count = 0;
	std::cin >> a;
	std::cin >> b;
	std::cin >> c;
	std::cin >> x;
	for (int i = 0; i <= a; i++) {
		if (500 * i > x)continue;
		for (int j = 0; j <= b; j++) {
			if (500 * i + 100 * j > x)continue;
			for (int k = 0; k<= c; k++) {
				if (500 * i + 100 * j + 50 * k == x) {
					count++;
					break;
				}
			}
		}
	}
	std::cout << count;
	return 0;
}

Measured memory_bytes: 256
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

vector<int> gen_primes(int m) {
	vector<int> primes;
	primes.push_back(2);
	for (int i = 3; i <= m; i += 2) {
		for (int prime : primes) {
			if (i < prime * prime) {
				primes.push_back(i);
				break;
			}
			if ((i % prime) == 0) {
				break;
			}
		}
	}
	return primes;
}

int main(int argc, char* argv[]) {
	vector<int> primes = gen_primes(100005);
	int x;
	cin >> x;
	for (int n : primes) {
		if (n >= x) {
			cout << n << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 384
s=input()
x,y=map(int,input().split())
XY=[[]for i in range(2)]
a=0
b=0
for i in range(len(s)):
  if s[i]=="T":
    XY[b].append(a)
    a=0
    b=(b+1)%2
  else:
    a=a+1
XY[b].append(a)
xx=sum(XY[0])
yy=sum(XY[1])
dpx=[[0]*(2*xx+5) for i in range(len(XY[0])+1)]#x=0とj=xx+2を対応させる
dpy=[[0]*(2*yy+5) for i in range(len(XY[1])+1)]#y=0とj=yy+2を対応させる
dpx[1][xx+XY[0][0]+2]=1
for i in range(1,len(XY[0])):
  for j in range(2*xx+5):
    if dpx[i][j]==1:
      dpx[i+1][j-XY[0][i]]=1
      dpx[i+1][j+XY[0][i]]=1
dpy[0][yy+2]=1
for i in range(len(XY[1])):
  for j in range(2*yy+5):
    if dpy[i][j]==1:
      dpy[i+1][j-XY[1][i]]=1
      dpy[i+1][j+XY[1][i]]=1
if x+xx+2<0 or 2*xx+4<x+xx+2 or y+yy+2<0 or 2*yy+4<y+yy+2:
  print("No")
  exit()
if dpx[-1][x+xx+2]==1 and dpy[-1][y+yy+2]==1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 166492
#include <stdio.h>

int main(int argc, char** argv)
{
	int i, j, k, h, l, cnt, n, x, result[1000];

	cnt = 0;
	
	memset(result, 0, sizeof(result));
	while (scanf("%d %d", &n, &x) != EOF) {
		int list_cnt = 0;
		int list[1500][3] = { { 0 } };
		for (i = 1; i <= n; i++) {
			for (j = 1; j <= n; j++) {
				if (i == j) {
					continue;
				}

				int sum = i + j;
				if (sum > x) {
					break;
				}

				for (k = 1; k <= n; k++) {
					if (i == k || j == k) {
						continue;
					}

					int sum = i + j + k;
					if (sum > x) {
						break;
					}
					else if (sum == x) {
						int ins_f = 1;
						for (h = 0; h < list_cnt; h++) {
							int match_cnt = 0;
							for (l = 0; l < 3; l++) {
								if (list[h][l] == i || list[h][l] == j || list[h][l] == k) {
									match_cnt++;
								}
							}

							if (match_cnt == 3) {
								ins_f = 0;
								break;
							}
						}

						if (ins_f) {
							list[list_cnt][0] = i;
							list[list_cnt][1] = j;
							list[list_cnt][2] = k;
							list_cnt++;
						}
						break;
					}
				}
			}
		}

		result[cnt] = list_cnt;

		if (n == 0 && x == 0) {
			break;
		}
		cnt++;
	}

	for (i = 0; i < cnt; i++) {
		printf("%d\n", result[i]);
	}
	return 0;
}

Measured memory_bytes: 628
#include "bits/stdc++.h"

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	int n, m;
	cin >> n >> m;

	vi ax(n), ay(n);
	for (int i = 0; i < n; i++) {
		cin >> ax[i] >> ay[i];
	}
	vi bx(m), by(m);
	for (int i = 0; i < m; i++) {
		cin >> bx[i] >> by[i];
	}

	for (int i = 0; i < n; i++) {
		int mi = INF, ans = 0;
		for (int j = 0; j < m; j++) {
			int t = abs(ax[i] - bx[j]) + abs(ay[i] - by[j]);

			if (mi > t) {
				mi = min(mi, t);
				ans = j + 1;
			}
		}

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

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

//template
#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 ALL(v) (v).begin(),(v).end()
typedef long long int 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; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
//template end

template<typename M,typename O=M>struct SegmentTree{
    using F=function<M(M,M)>; using G=function<M(M,O)>;
    int sz; vector<M> data; const F f; const G g; const M m1;
    SegmentTree(int n,const F f,const G g,const M &m1):f(f),g(g),m1(m1){
        sz=1; while(sz<n)sz<<=1; data.assign(2*sz,m1);
    }
    void build(vector<M> v){
        rep(i,0,v.size())data[i+sz]=v[i];
        rrep(k,sz-1,0)data[k]=f(data[2*k],data[2*k+1]);
    }
    void update(int k,const O &x){
        k+=sz; data[k]=g(data[k],x);
        while(k>>=1)data[k]=f(data[2*k],data[2*k+1]);
    }
    M query(int a,int b){
        M L=m1,R=m1;
        for(a+=sz,b+=sz;a<b;a>>=1,b>>=1){
            if(a&1)L=f(L,data[a++]);
            if(b&1)R=f(data[--b],R);
        } return f(L,R);
    }
    M operator[](const int &k)const{return data[k+sz];}
};

int main(){
    int n; scanf("%d",&n);
    vector<P> r(n);
    rep(i,0,n)scanf("%d%d",&r[i].first,&r[i].second),r[i].first--;
    int lmax=0,idx,rmin=inf,idx2;
    rep(i,0,n){
        if(chmax(lmax,r[i].first))idx=i;
        if(chmin(rmin,r[i].second))idx2=i;
    }
    int ans=0;
    int rangemax=0;
    rep(i,0,n)if(i!=idx)chmax(rangemax,r[i].second-r[i].first);
    ans=rangemax+max(0,rmin-lmax);
    sort(ALL(r));
    SegmentTree<int> minn(n,
    [](int a,int b){return min(a,b);},[](int a,int b){return b;},inf);
    rep(i,0,n)minn.update(i,r[i].second);
    rep(i,0,n-1){
        int lmax2=r[i].first,rmin2=minn.query(i+1,n);
        cerr<<lmax2<<rmin2<<endl;
        chmax(ans,max(0,rmin-lmax2)+max(0,rmin2-lmax));
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 2048
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

int main() {
  ll N;
  string S, T;
  cin >> N >> S >> T;

  string ans;
  for (auto i = 0; i != N; ++i) {
    ans += S[i];
    ans += T[i];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,x[200005],y[200005],ans;
int mx1=0x3f3f3f3f,my1=0x3f3f3f3f,mx2=1,my2=1;
int dis(int x1,int y1,int x2,int y2)
{
	return abs(x1-x2)+abs(y1-y2);
}
signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>x[i]>>y[i];
	for(int i=1;i<=n;i++)
	{
		if(dis(x[i],y[i],1,1)<dis(mx1,my1,1,1)) mx1=x[i],my1=y[i];
		if(dis(x[i],y[i],0x3f3f3f3f,0x3f3f3f3f)<dis(mx2,my2,0x3f3f3f3f,0x3f3f3f3f)) mx2=x[i],my2=y[i];
	}
	ans=dis(mx1,my1,mx2,my2);
	//cout<<ans<<endl;
	mx1=0x3f3f3f3f,my1=1,mx2=1,my2=0x3f3f3f3f;
	for(int i=1;i<=n;i++)
	{
		if(dis(x[i],y[i],1,0x3f3f3f3f)<dis(mx1,my1,1,0x3f3f3f3f)) mx1=x[i],my1=y[i];
		if(dis(x[i],y[i],0x3f3f3f3f,1)<dis(mx2,my2,0x3f3f3f3f,1)) mx2=x[i],my2=y[i];
	}
	ans=max(ans,dis(mx1,my1,mx2,my2));
	cout<<ans;
	return 0;
}


Measured memory_bytes: 6740
N=gets.to_i;v=$<.map{|e|Complex(*e.split.map(&:to_i))};h={};r=2**N+~N;[*0...N].combination(2){|i,j|h[x=[i,j]]||(x+=(j+1...N).select{|k|((v[j]-v[k]).conj*(v[i]-v[k])).imag==0};r-=2**(l=x.size)+~l;x.combination(2){|e|h[e]=1})};p r%998244353

Measured memory_bytes: 4860
#include<iostream>
#include<string>
using namespace std;
struct HauntedHouse{
  int beforenoon;
  int afternoon;
  string name;
  int getTotalCustmor(){
    return beforenoon + afternoon;
  }
  int getAward(){
    return beforenoon * 200 + afternoon * 300;
  }
};
int main(){
  HauntedHouse hh[9];
  for(int i = 0; i < 9; ++i){
    cin >> hh[i].name >> hh[i].beforenoon >> hh[i].afternoon;
  }
  for(int i = 0; i < 9; ++i){
    cout << hh[i].name << ' ' <<
      hh[i].getTotalCustmor() << ' ' <<
      hh[i].getAward() << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;


int main() {
    ios_base::sync_with_stdio(false); 

    int n;
    cin >> n;
    bool flag=0;
    repr(i,1,1000) {
        if (i*(i+1)/2==n) {
            flag=1;
            cout << "Yes" << endl;
            cout << i+1 << endl;
            int sum=0;
            rep(j,i+1) {
                int s=0;
                cout << i << ' ';
                rep(k,j) {
                    cout << j+s << ' ';
                    s+=i-1-k;
                }
                rep(k,i-j) cout << sum+k+1 << ' ';
                sum+=i-j;
                cout << endl;
            }
        }
    }
    if (!flag) cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  ll ans=0;
  rep(i,n-1){
    if(a[i]>a[i+1]){
      ans+=a[i]-a[i+1];
      a[i+1]=a[i];
    }
  }
  COUT(ans);
}

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

int main(){
	long A,B,C,K;
	cin>>A>>B>>C>>K;
	
	if(K>A){
	    int res=A;
	    K=K-A;
	    if(K>B){
	        K=K-B;
	        res=res-K;
	        cout<<res<<"\n";
	    }
	    else{
	        cout<<res<<"\n";
	    }
	}
	else{
	    cout<<K<<"\n";
	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	int n,m;
	cin>>n>>m;
	cout<<(((n-1) * n) + ((m-1) * m)>>1)<<"\n";
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

max_ans = M // N

ans = 1

for n in range(1, int(M ** 0.5) + 1):
    if M % n != 0:
        continue

    if n <= max_ans:
        ans = max(ans, n)
    if M // n <= max_ans:
        ans = max(ans, M // n)

print(ans)

Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	int a,b;
	cin >> a >> b;
	int count = 0;
	for(int i=a ; i<=b ; i++)
	{
		int temp = i;
		int rev = 0;
		while(temp > 0)
		{
			rev = rev*10 + (temp%10);
			temp = temp / 10;
		}

		if(i == rev)
			count++;
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define mod 1000000007

const int sz=1e5+5;
ll inf=1e15;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        cout<<s;
        int n=s.length();
        if(s[n-1]=='s'){
            cout<<"es";
        }
        else{
            cout<<"s";
        }
    }

    return 0;
}

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

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

const long long INF = 1LL << 60;

int main(){
  using vi = vector<int>;
  using vvi = vector<vi>;  
  int N;
  cin >> N;  
  vvi vec(N, vi(3));  
  for (int i = 0; i < N; i++) {
      for(int j = 0; j < 3; j++){
        cin >> vec.at(i).at(j);
      }
  }
  vvi dp(N, vi(3));
  for(int i = 0; i < 3; i++){
    dp.at(0).at(i) = vec.at(0).at(i);
  }
  for(int i = 1; i < N; i++){
    for(int j = 0; j < 3; j++){
        int res = 0;
        if(j != 0) chmax(res, dp.at(i-1).at(0) + vec.at(i).at(j));
        if(j != 1) chmax(res, dp.at(i-1).at(1) + vec.at(i).at(j));
        if(j != 2) chmax(res, dp.at(i-1).at(2) + vec.at(i).at(j));
        dp.at(i).at(j) = res;
    }
  }  
  cout << max( dp.at(N-1).at(0) , max( dp.at(N-1).at(1) , dp.at(N-1).at(2) ) ) << endl;
}

Measured memory_bytes: 11136
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<cstdio>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<stack>
#include<iterator>
#include<functional>
#include<string.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//namespace mp = boost::multiprecision;


int main() {
	int n; 
	scanf("%d",&n);
	
	deque<unsigned long long int>ans;
	for (int i = 0; i < n; i++) {
		char s[12];
		scanf("%s", s);
		if (!strcmp(s, "insert")) {
				unsigned long long int k;
				scanf("%lld", &k);
				ans.insert(ans.begin(), k);
		}
		else if (!strcmp(s, "delete")) {
				unsigned long long int k;
				scanf("%lld", &k);
				if (find(ans.begin(), ans.end(), k) - ans.begin() < ans.size())
					ans.erase(find(ans.begin(), ans.end() - 1, k));
		}
		else if (!strcmp(s, "deleteLast")) {
				ans.pop_back();
		}
		else if (!strcmp(s, "deleteFirst")) {
			    ans.pop_front();
		}
		

	
	}
	for (int i = 0; i <ans.size(); i++) {
		printf("%lld", ans[i]);
		if (i != ans.size()-1) {
			printf(" ");
		}
		else {
			printf("\n");
		}
	}
}






Measured memory_bytes: 11012
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc=new Scanner(System.in);
		int r=sc.nextInt();
		int c=sc.nextInt();
        int[][] h=new int[r+1][c+1];
		StringBuilder sb1=new StringBuilder();
		StringBuilder sb2=new StringBuilder();
		String b=" ",n="\n";
        for(int i=0;i<r;i++){
        	for(int j=0;j<c;j++){
        		h[i][j]=sc.nextInt();
        		h[i][c]+=h[i][j];
        		h[r][j]+=h[i][j];
        		h[r][c]+=h[i][j];
        		sb1.append(h[i][j]+b);
        		if(i==r-1) sb2.append(h[r][j]+b);
        	}
        	sb1.append(h[i][c]+n);
        }
        sb2.append(h[r][c]);
        System.out.print(sb1);
        System.out.println(sb2);
	}
}

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

int main(void)
{
  std::string s;
  std::cin >> s;

  int cnt = 0;
  bool flag = false;
  for (int i = 0; i < 3; i++) {
    if (s[i] == 'S') {
      flag = false;
    }
    else {
      if (flag) {
        cnt++;
      }
      else {
        cnt = 1;
      }
      flag = true;
    }
  }

  std::cout << cnt << std::endl;

  return 0;
}

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

const int Nmax=200010;

int main() {
	ll N;
	cin >> N;
	for(ll i=N;i >= 1;i--){
		if(i == pow((ll)sqrt(i),2)){
			cout << i << endl;
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

int rec (int , int);
void print(int);

struct Node {int p, l, r; };
Node T[MAX];
int n, D[MAX];

int main(){
    int i, j, d, v, c, l, r;
    
    cin >> n;
    for(i=0 ; i<n ; i++) T[i].p = T[i].l = T[i].r = NIL;
    for(i=0 ; i<n ; i++){
         cin >> v >> d;
        for(j=0 ; j<d ; j++){
            cin >> c;
            if(j==0) T[v].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = v;
        }
    }
    
    for(i=0 ; i<n ; i++){
        if(T[i].p==NIL){r = i;}
    }
    
    rec(r, 0);
    
    for(i=0 ; i<n ; i++){
        print(i);
    }
    
    return 0;
}

void print(int u){
    int i, c;
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "depth = " << D[u] << ", ";
    
    if(T[u].p == NIL) cout << "root, ";
    else if (T[u].l == NIL) cout << "leaf, ";
    else cout << "internal node, ";
    
    cout << "[";
    
    for(i=0 , c=T[u].l ; c!=NIL ; i++, c=T[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

int rec(int u, int p){
    D[u] = p;
    if(T[u].r!=NIL)rec(T[u].r, p);
    if(T[u].l!=NIL)rec(T[u].l, p + 1);
}


Measured memory_bytes: 7812
S = input()

left = int(S[:2])
right = int(S[2:])

a = (1 <= left <= 12)
b = (1 <= right <= 12)

if a and b:
    ans = 'AMBIGUOUS'
elif a:
    ans = 'MMYY'
elif b:
    ans = 'YYMM'
else:
    ans = 'NA'

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

int main(){
    ll n;
    cin>>n;
    vector<ll>v(n+1);
    rep(i,n+1){
        cin>>v[i];
    }
    vector<ll>y(n);
    rep(i,n){
        cin>>y[i];
    }
    ll tmp;
    ll sum=0;
    rep(i,n){
        if(v[i]<=y[i]){
           tmp=v[i] ;
           v[i]=0;
           y[i]-=tmp;
           sum+=tmp;
        }else{
        tmp=y[i] ;
           v[i]-=tmp;
           y[i]=0;
           sum+=tmp;
        }
        if(y[i]==0)continue;
        tmp=min(y[i],v[i+1]);
        y[i]-=tmp;
        v[i+1]-=tmp;
        sum+=tmp;
    }
    
   cout<<sum<<endl;
}


Measured memory_bytes: 4852
#include <iostream>
#include <algorithm>
#include <string>

std::string s,t;
int main(){
  std::cin>>s>>t;
  if(s.size()<t.size()){
    std::cout<<"UNRESTORABLE"<<std::endl;
    return 0;
  }
  
  bool check=false;
  size_t ans=0;
  std::string cnt{'z',55};
  std::string temp;
  for(size_t i=0;i+t.size()<s.size()+1;++i){
    temp.clear();
    for(size_t j=0;j<t.size();++j){
      if(s[i+j]=='?'){
        if(j==t.size()-1){
          check=true;
          ans=i;
          
          for(size_t k=0;k<s.size();++k)
            if(s[k]=='?')
              if(k>=ans&&k-ans<t.size())
                temp+=t[k-ans];
              else
                temp+='a';
            else
              temp+=s[k];
          cnt=std::min(cnt,temp);
        }
        continue;
      }
      else if(s[i+j]!=t[j])
        break;
      if(j==t.size()-1){
        check=true;
        ans=i;
        
        for(size_t k=0;k<s.size();++k)
          if(s[k]=='?')
            if(k>=ans&&k-ans<t.size())
              temp+=t[k-ans];
            else
              temp+='a';
          else
            temp+=s[k];
        
        cnt=std::min(cnt,temp);
        break;
      }
    }
  }
  
  if(!check){
    std::cout<<"UNRESTORABLE"<<std::endl;
    return 0;
  }
  else
    std::cout<<cnt<<std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd>> Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod

const ll MAXN=(1<<18);
const ll MAXL=100001;
const ll MAXK=(1<<9);

ll ruijou(ll n, ll k){
    if(!k) return 1;
    ll a=ruijou(n,k/2);
    a=(a*a)%mod;
    return k%2 ? (a*n)%mod : a;
}
ll Sqrt(ll x){
    if(x<=2) return 1;
    ll kari=1;
    while(kari*kari<x){
        kari*=2;
    }
    return kari;
}


ll dp[MAXK][MAXL];
ll N;
ll d[MAXN][2];

int main(){
    rep(i,MAXK) rep(j,MAXL) dp[i][j]=-INF;
    cin>>N;
    rep(i,N) rep(j,2) cin>>d[i][j];
    ll K=Sqrt(N);
    //cout<<K<<endl;
    dp[0][0]=0;
    dp[0][d[0][1]]=d[0][0];
    rep(i,MAXL-1) dp[0][i+1]=max(dp[0][i+1],dp[0][i]);
    REP(i,1,K){
        rep(j,MAXL){
            dp[i][j]=max(dp[i][j],dp[(i-1)/2][j]);
            if(j>=d[i][1]) dp[i][j]=max(dp[i][j],dp[(i-1)/2][j-d[i][1]]+d[i][0]);
        }
    }
    vec ans;
    ll Q; cin>>Q;
    rep(i,Q){
        ll v,L; cin>>v>>L; v--;
        if(v<K) ans.pb(dp[v][L]);
        else{
            ll A=v;
            vec x;
            while(A>=K){
                x.pb(A);
                A--; A/=2;
            }
            ll M=x.size();
            ll kari=-INF;
            rep(j,(1<<M)){
                ll value=0, weigh=0;
                rep(k,M) if(j&(1<<k)){
                    value+=d[x[k]][0];
                    weigh+=d[x[k]][1];
                }
                //cout<<v<<':'<<A<<":"<<j<<' '<<value<<' '<<weigh<<' '<<L<<endl;
                if(weigh<=L) {
                    //cout<<value+dp[A][L-weigh]<<endl;
                    kari=max(kari,value+dp[A][L-weigh]);
                }
            }
            ans.pb(kari);
        }
    }
    rep(i,Q) cout<<ans[i]<<endl;

}

Measured memory_bytes: 408344
/**
 *      ABC 75 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-04 17:18:58
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int H, W; cin >> H >> W;
    char field[H + 10][W + 10] = {};

    vector<string> S;
    for (int i = 0; i < H; ++i) {
        string x; cin >> x;
        S.push_back(x);
    }

    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
             field[i][j] = S[i - 1][j - 1]; 
        }
    }

    char answer[H + 10][W + 10] = {};

    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            if (field[i][j] == '#') answer[i - 1][j - 1] = '#';
            else {
                int count = 0;
                for (int k = i - 1; k <= i + 1; ++k){
                    for (int l = j - 1; l <= j + 1; ++l){
                        if (field[k][l] == '#'){
                            ++count;
                        }
                    }
                }
                string str = to_string(count); // char to int
                char const *pchar = str.c_str();
                answer[i - 1][j - 1] = *pchar;
            }
        }
    }

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cout << answer[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
s=str(input())
t=str(input())
def gcd(x, y):
    if x % y == 0:
        return(y)
    else:
        return gcd(y,x%y)
def lcm(a,b):
    return a*b//gcd(a,b)
a=n//gcd(n,m)
b=m//gcd(n,m)
for i in range(gcd(n,m)):
    if s[a*i]!=t[b*i]:
        print("-1")
        exit()
print(lcm(n,m))

Measured memory_bytes: 3316
import std.stdio;
import std.string;
import std.array;
import std.range;
import std.random;
import std.algorithm;
import std.conv;

void main(){
    auto input = readln().chomp();
    solve(input).writeln();
}

int solve(string input){
    auto result = 0;
    foreach(s; input){
        if(s == '+'){
            result++;
        }else{
            result--;
        }
    }
    return result;
}

Measured memory_bytes: 256
N = int(input())
A = input().split()

i = 0
ans = 0

even_count = N

while even_count == N:
  even_count = 0
  i = 0

  while i < N:
    a = int(A[i])
    if a % 2 == 0:
      even_count += 1
      A[i] = a // 2
      i += 1
    else:
      break

  if even_count == N:
    ans += 1
  else:
    break

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)


int main()
{
    char s[100005]={};
    scanf("%s",s);
    std::stack<char> stack;
    int ans=0;
    REP(i,strlen(s)){
        if(!stack.empty())
        {
            if(stack.top()!=s[i]){
            ans++;
            stack.pop();
            }
            else{
                stack.push(s[i]);
            }
        }
        else{
            stack.push(s[i]);
        }
    }
    printf("%d\n",ans*2);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <string>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())

using namespace std;


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

    string s;
    cin >> s;
    if(s.length() == 2){
        cout << s;
    }else{
        for(int i=2; i >= 0;i--){
            cout << s[i];
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  stringstream ss;
  while(true){
    int h,w,i,j;
    cin>>h>>w;
    if(h+w==0)break;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
        ss<<"#";
      }
      ss<<endl;
    }
    ss<<endl;
  }
  cout<<ss.str();
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1000000
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n + 1);
    vector<string> vec;
    rep(i, n)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            vec.push_back(to_string(a[i] * a[j]));
        }
    }
    //rep(i, vec.size()) cout << vec[i] << endl;
    int ans = -1;
    rep(i, vec.size())
    {
        bool flag = false;
        rep(j, vec[i].size() - 1)
        {
            //cout << vec[i][j] << " " << vec[i][j + 1] << endl;
            if (vec[i][j] != (int)(vec[i][j + 1] - 1))
                flag = true;
        }
        if (flag == false)
        {
            int tmp = stoi(vec[i]);
            //cout << tmp << endl;
            if (tmp > ans)
                ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 30064
N = int(input())
plans = [list(map(int,input().split())) for i in range(N)]

ans = "Yes"
before = [0, 0, 0]
for plan in plans:
    #print(plan)
    dt = plan[0] - before[0]
    dx = abs(plan[1] - before[1])
    dy = abs(plan[2] - before[2])

    if dt >= (dx+dy) and ((dt % 2 == 0 and (dx+dy) % 2 == 0) or (dt % 2 == 1 and (dx+dy) % 2 == 1)):
        pass
    else:
        ans = "No"
        break
    before = plan[:]
    
print(ans)

Measured memory_bytes: 27380
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>
#include<sstream>

using namespace std;

void Solution()
{
    double r;
    
    cin>>r;
   
    cout<<fixed<<setprecision(6)<<M_PI * r * r<<" "<<M_PI * r * 2<<endl;
      //M_PI = pi , need include math.h
}

int main()
{
    Solution();
    return 0;
}

Measured memory_bytes: 1284
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto a = readln.split.to!(int[]), mi = a.reduce!min, ma = a.reduce!max;

  auto ans = int.max;
  foreach (x; mi..ma+1)
    ans = min(ans, a.map!(ai => (ai - x) ^^ 2).sum);

  writeln(ans);
}


Measured memory_bytes: 256
/**
 *    author:  tourist
 *    created: 09.01.2020 16:09:17       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> p(n);
  vector<int> pos(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    --p[i];
    pos[p[i]] = i;
  }
  int ans = 0;
  int f = -1;
  for (int i = n - 2; i >= 0; i--) {
    if (ans == 0) {
      if (pos[i] > pos[i + 1]) {
        ++ans;
        f = i + 1;
      } else {
        f = i;
      }
    } else {
      int d2 = (pos[i + 1] - pos[i] + n) % n;
      int df = (pos[f] - pos[i] + n) % n;
      if (d2 > df) {
        ++ans;
        f = i + 1;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1792
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

k = readint()
a = 0
flag = -2
for i in range(10**6):
    a = (a + 7*pow(10,i,k)) % k
    if a==0:
        flag = i
        break
print(flag+1)        
    



Measured memory_bytes: 63556
n = int(input())
li = []
for _ in range(n):
  li.append(input())
print(f'AC x {li.count("AC")}')
print(f'WA x {li.count("WA")}')
print(f'TLE x {li.count("TLE")}')
print(f'RE x {li.count("RE")}')



Measured memory_bytes: 16292
# -*- coding: utf-8 -*-

def main():
    n = int(input())

    if(n < 10):
        print(n)
    elif(10 <= n < 100):
        print(9)
    elif(100 <= n < 1000):
        print(9 + n - 99)
    elif(1000 <= n < 10000):
        print(999 - 99 + 9)
    elif(10000 <= n < 100000):
        print(9 - 99 + 999 - 9999 + n)
    else:
        print(9 - 99 + 999 - 9999 + 99999)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
  int a,b;
  char c,trash;
  while(1){
    scanf("%d",&a);
    scanf("%c",&trash);
    scanf("%c",&c);
    scanf("%c",&trash);
    scanf("%d",&b);
    if(c == '?')
      break;
    switch(c){
    case '+':
      printf("%d\n",a+b);
      break;
    case '-':
      printf("%d\n",a-b);
      break;
    case '*':
      printf("%d\n",a*b);
      break;
    case '/':
      printf("%d\n",a/b);
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 600
#include <string>
#include <stdlib.h>
#include<iostream>

using namespace std;
#define FILE_BUFFER_LENGTH 30000
long m;

typedef struct Betree {
	long long item;
	Betree* left = NULL;
	Betree* right = NULL;
}Betree;
Betree *root;

void insert(long long ite) {
	Betree *p = root, *p1;
	p1 = p;
	while (p != NULL) {
		p1 = p;
		if (p->item > ite) {
			p = p->left;
		}
		else {
			p = p->right;
		}
	}
	p = (Betree *)malloc(sizeof(Betree));
	p->item = ite;
	p->left = NULL;
	p->right = NULL;
	if (p1 == NULL) {
		root = p;
	}
	else {
		if (ite > p1->item)
			p1->right = p;
		else
			p1->left = p;
	}

}

void finds(Betree * p, long long ite) {
	if (p == NULL||p->item == NULL) {
		cout << "no"<<endl;
	}
	else if (p->item == ite) {
		cout << "yes" << endl;
	}
	else if (ite < p->item) {
		finds(p->left, ite);
	}
	else {
		finds(p->right, ite);
	}
}

void printinorder(Betree *p) {

	if (p == NULL) {
		return;
	}
	printinorder(p->left);
	cout <<' ' <<p->item;
	printinorder(p->right);	

}

Betree * findnextinorder(Betree *p) {
	Betree *p1 = p->right;
	Betree *p2 = p1;
	while (p1->left != NULL) {
		p2 = p1;
		p1=p1->left;
	}
	return p2;
}

void printpreorder(Betree *p) {
	if (p == NULL) {
		return;
	}
	cout <<' '<< p->item ;

		printpreorder(p->left);
	

		printpreorder(p->right);
	
}

void deletes(Betree *p, long long ite) {
	if (p == NULL||p->item == NULL)
		return;
	Betree *p1, *p2, *p3;
	p1 = p2 = p;
	while (p1->item != ite&&p1 != NULL) {
		p2 = p1;
		if (p1->item > ite) {
			p1 = p1->left;
		}
		else {
			p1 = p1->right;
		}
	}

	if (p1 == NULL) {
		return;
	}

	if (p1->left == NULL && p1->right == NULL) {
		if (p2 == p1) {
			root = NULL;
		}
		if (p2->left == p1) {
			p2->left = NULL;
		}
		else {
			p2->right =NULL;
		}
		free(p1);
	}
	else if (p1->left == NULL) {
		if (p2 == p1) {
			root = p1->right;
		}
		if (p2->left == p1) {
			p2->left = p1->right;
		}
		else {
			p2->right = p1->right;
		}
		free(p1);
	}
	else if (p1->right == NULL) {
		if (p2 == p1) {
			root = p1->left;
		}
		if (p2->left == p1) {
			p2->left = p1->left;
		}
		else {
			p2->right = p1->left;
		}
		free(p1);
	}
	else {
		p2 = findnextinorder(p1);
		if (p2->left == NULL) {
			p3 = p2;
			p1->right = p2->right;
		}
		else 
			p3 = p2->left;
		p1->item = p3->item;
		p2->left = p3->right;
		free(p3);
	}
	return;
}

int main() {
	cin >> m;
	string com;
	long long ite;
	for (int i=0; i < m; ++i) {
		cin >> com;
		switch (com[0]) {
		case 'i': cin >> ite; insert(ite); break;
		case 'f': cin >> ite; finds(root, ite); break;
		case 'd': cin >> ite; deletes(root, ite); break;
		case 'p':  
			printinorder(root);
			cout << endl;
			printpreorder(root);
			cout << endl; 
			break;
		};
	}
	return 0;
}


Measured memory_bytes: 15656
#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b && n>=a)
using namespace std;
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,b) for(i=0;i<b;i++)
#define rep1(i,b) for(i=1;i<=b;i++)
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;
#define MOD 1000000007
LL mpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}
#define MAXK 100000
#define MAXN 1000000000
int ar[MAXK];
typedef unsigned long long int ULL;
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
bool isSafe(int r, int c, vector<vector<int> > arr) {
	int n = arr.size();
	int m = arr[0].size();
	return (r>=0 && r<n && c>=0 && c<m);
}
LL gcd(LL a,LL b){if(b==0) return a;a%=b;return gcd(b,a);} 
/////////////////////////////////////////////////////////////

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int i,j,k,l,n,m,q,d,a,b,c,ans,tot,mx=INT_MIN,mn=INT_MAX;
    
    string s,t;
    cin>>s;
    cin>>t;
    int ls = s.length();
    int lt = t.length();
    if(lt != ls+1) cout<<"No";
    else {
    	bool isSame = true;
    	rep(i,ls) {
    		if(s[i]!=t[i]) {
    			isSame = false;
    			break;
    		}
    	}
    	if(isSame) cout<<"Yes";
    	else cout<<"No";
    }
    
    return 0;
}



Measured memory_bytes: 3616
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,W;
    cin >> N >> W;
    vl w(N),v(N);
    rep(i,N){
        cin >> w[i] >> v[i];
    }
    ll dp[N+1][N+1][3*N+1];
    rep(i,N+1){
        rep(j,N+1){
            rep(k,3*N+1){
                dp[i][j][k]=0;
            }
        }
    }
    FOR(i,1,N+1){
        rep(j,N+1){
            rep(k,3*N+1){
                dp[i][j][k]=dp[i-1][j][k];
                if(k>=w[i-1]-w[0]&&j>=1)chmax(dp[i][j][k],dp[i-1][j-1][k-(w[i-1]-w[0])]+v[i-1]);
            }
        }
    }
    ll ans=0;
    rep(i,N+1){
        rep(j,3*N+1){
            if(j+w[0]*i<=W)chmax(ans,dp[N][i][j]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 27640
#copipe-benkyo
h, w = map(int, input().split())
a = [''] * h
#print(a)
for i in range(h):
	a[i] = input()
#print(a)

row = [False] * h
col = [False] * w
#print(row)
#print(col)
for i in range(h):
	for j in range(w):
		if a[i][j] == '#':
			row[i] = True
			col[j] = True
#print(row)
#print(col)
for i in range(h):
	if row[i]:
		for j in range(w):
			if col[j]:
				print(a[i][j], end = '')
		print()


Measured memory_bytes: 4468
#include <iostream>
#include <string>

using namespace std;

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

    bool flag = false;
    for (int i = 0; i < s.size(); i++) {
        for (int j = 0; j < s.size(); j++) {
            if (i != j && s[i] == s[j]) {
                flag = true;
            }
            if (flag == true) break;
        }
        if (flag == true) break;
    }

    if (flag == true) cout << "no" << endl;
    else cout << "yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <numeric>
#include <iterator>

#define repAll(n) (n).begin(), (n).end()
#define repConAll(n) (n).cbegin(), (n).cend()

using namespace std;


namespace {

}


int main()
{
	int N;
	//vector<string> S;
	set<string> setS;
	set<char> h1{ 'M', 'A', 'R', 'C', 'H' };
	map<char, long long> countS;

	cin >> N;

	countS['M'] = 0;
	countS['A'] = 0;
	countS['R'] = 0;
	countS['C'] = 0;
	countS['H'] = 0;
	vector<char> vctHeader{ 'M', 'A', 'R', 'C', 'H' };

	for (int i = 0; i < N; ++i){
		string s;
		cin >> s;
		for (auto elem : vctHeader){
			if (s[0] == elem){
				++countS[elem];
			}
		}
	}

	long long allCount = 0;
	for (int i = 0; i < 5; ++i){
		for (int j = i + 1; j < 5; ++j){
			for (int k = j + 1; k < 5; ++k){
				if (i != j && j != k && i != k){
					allCount += countS[vctHeader[i]] * countS[vctHeader[j]] * countS[vctHeader[k]];
				}
			}
		}
	}

	cout << allCount << endl;

	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	int n, m;
	cin >> n >> m;
	int tmp = n * (n - 1) / 2;
	int tmp2 = m * (m - 1) / 2;
	cout << tmp + tmp2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main()
{
  ll N;
  cin >> N;
  vector<pair<string, ll> > S(N+1);

  rep(i, N)
  {
    cin >> S.at(i).first;
  }

  sort(S.begin(), S.end());
  ll tmp = 0;
  rep(i, N)
  {
    if (S.at(i).first == S.at(i + 1).first)
    {
      if (tmp == 0)
      {
        tmp = i;
      }
      S.at(tmp).second++;
    }
    else
    {
      tmp = 0;
    }
  }
  ll ans = 0;
  rep(i, N)
  {
    ans = max(ans, S.at(i).second);
  }
  sort(S.begin(), S.end());
  // cout << endl;
  rep(i, N+1)
  {
    if (ans == S.at(i).second)
    {
      cout << S.at(i).first << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 15872