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

#define IOS {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define ll long long 
ll powermod(ll x,ll ex,ll md){ll ans=1ll;while(ex>0){if(ex&1ll) ans=(ans*x)%md; ex>>=1ll;x=(x*x)%md;}return ans;}

int main(){
    IOS;
    ll n;
    cin>>n;
    // vector<ll> factor;

    // for(ll i=1;i*i<=n;++i){
    //     if(n%i==0){
    //         ll div1=i,div2=n/i;
    //         factor.push_back(div1);
    //         if(div1 != div2) factor.push_back(div2);
    //     }
    // }

    // for(ll i=0;i<(int)(factor.size());i++) cout << factor[i] <<" ";

    ll ans=-1;
    if(n==7){
        cout<<1<<"\n";
        return 0;
    }
    else if(n%2==0){
        cout<<-1<<"\n";
        return 0;
    }

    n*=9;
    for(ll i=1;i<=1e6;i++){
        ll b=3;
        ll a= powermod(10,i,n);
        a%=n;
        (a)=(a-1+n)%n;
        
        a=((a%n)*7)%n;
        if(a==0){
            ans=i;
            break;
        }
    }
    if(ans!=-1)cout << ans<<"\n";
    else cout<<-1<<"\n";
}


Measured memory_bytes: 3596
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int main()
{
    int n, a, cnt=0;
    cin>>n;
    for (int i=0; i<n; i++)
    {
        cin>>a;
        bool ok=true;
        for (int j=2; j<=sqrt(a); j++)
        {
            if (a%j==0) ok=false;
        }
        if (ok) cnt++;
    }
    cout<<cnt<<'\n';
    return 0;
}



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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv){vprint(v)};

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

    ll N;
    cin >> N;

    ll total = 0;
    REP(a, 1, N) REP(b, 1, N){
        if(a*b>=N) break;
        ++total;
    }
    cout << total << endl;
}


Measured memory_bytes: 3648
list = [chr(ord('A') + i) for i in range(26)]

N = int(raw_input())
S = map(str,raw_input())
for i in range(0,len(S)):
  for j in range(0,26): 
    if S[i] == list[j]:
      if j+N >= 26:
        S[i] = list[j+N-26]
        break
      else:
        S[i] = list[j+N]
        break
print(''.join(S)) 

Measured memory_bytes: 2948
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }


float sum;
float sugar;
float con;


int main() {
  float a,b,c,d,e,f;
  scanf("%f%f%f%f%f%f", &a,&b,&c,&d,&e,&f);
  a *= 100;
  b *= 100;
  
  int anssum = -1;
  int anssugar = -1; 
  float anscon = -1;

  for(int i=0;i*a<=5200;++i){
    for(int j=0;j*b<=6000;++j){
      for(int k=0;k*c<=1500;++k){
        for(int l=0;l*d<=1500;++l){
          if(i*a+j*b>3000) continue;
          bool sumok=false;
          bool conok=false;
          sum = a*i+b*j+k*c+l*d;
          sugar = c*k+l*d;
          if(sum<=f) sumok = true;
          con = sugar/sum;
          // if(sum == 200) cout << con << " " << e/(100+e) << endl;
          if(con>anscon && con<=e/(100+e) && sumok){
            anssum = sum;
            anssugar = sugar;
            anscon = con;
            // if(sum == 190) cout << con << " " << e/(100+e) << endl;
          }
        }
      }
    }
  }

  cout << anssum << " " << anssugar << endl;

}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
  ll a, b;
  string op;
  cin >> a >> op >> b;
  if(op == "+") cout << a + b << endl;
  else cout << a - b << endl;
}



Measured memory_bytes: 256
// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
#include <random>
// }}}

// debug(...) {{{
#ifdef LOCAL_DEBUG
#include "./debug.h"
#else
#define debug(...)
#define debugn(...)
#define debug_reset()
#endif

#include <cstdio>

template<class T>
std::string bin(int bits, const T& x) {
  char buf[bits + 1];
  buf[bits] = '\0';
  for(int i = 0; i < bits; i++) {
    if((x >> i) & 1) {
      buf[bits - i - 1] = '1';
    } else {
      buf[bits - i - 1] = '0';
    }
  }
  return std::string(buf);
}
std::string bin(int x) {
  if(x < 0) return bin(32, x);
  for(int i = 4; i < 31; i++) {
    int y = 1 << i;
    if(x < y) return bin(i, x);
  }
  return bin(32, x);
}
// }}}

// misc {{{
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

template<class T>
void sort(T& arr) {
  std::sort(arr.begin(), arr.end());
}
template<class T, class By>
void sort_by(T& arr, By by) {
  std::sort(arr.begin(), arr.end(), [by](auto l, auto r){return  by(l) < by(r); });
}

template<class T>
void reverse(T& arr) {
  std::reverse(arr.begin(), arr.end());
}

// }}}

// main {{{
void solve();
int main() {
  solve();
}
// }}}

void solve() {
  int N;
  cin >> N;
  vector<int> H(N);
  rep(i, N) {
    cin >> H[i];
  }
  int prev = H[0];
  int ans  = 0;
  int cur = 0;
  rep2(i, 1, N) {
    if(H[i] <= prev) cur++; 
    else {
      ans = max(cur, ans);
      cur = 0;
    }
    prev = H[i];
  }
  ans = max(ans, cur);
  cout << ans << endl;
}


Measured memory_bytes: 888
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int ne[100100], po[100100];

signed main() {
    int N, K;
    cin >> N >> K;
    int n = 0, p = 0;
    rep(i, N) {
        int a;
        cin >> a;
        if (a < 0)ne[n++] = -a;
        else if (a == 0) {
            --K;
            if (K == 0) {
                cout << 0 << endl;
                return 0;
            }
        } else po[p++] = a;
    }
    int ans = INF;
    sort(ne, ne + n);
    if (p >= K)ans = min(ans, po[K - 1]);
    if (n >= K)ans = min(ans, ne[K - 1]);
    for (int l = 1; l <= K - 1; ++l) {
        if (l > n)break;
        if (K - l > p)continue;
        ans = min(ans, ne[l - 1] * 2 + po[K - l - 1]);
        ans = min(ans, ne[l - 1] + po[K - l - 1] * 2);
    }
    cout << ans << endl;
    return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

// Mod int
const int mod = 1000000007;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
typedef vector<vm> vvm;
//

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,m;
  cin >> n >> m;
  vvm board(n+1,vm(m+1,0));
  VI s(n), t(m);
  rep(i,n) cin >> s[i];
  rep(i,m) cin >> t[i];

  rep(i,n) rep(j,m){
    if(s[i] == t[j]) board[i+1][j+1] = 1;
  }

  //dpと累積和を同時に作成
  FOR(i,1,n+1) FOR(j,1,m+1){
    // dpの遷移が起こる場合
    if(board[i][j] == 1){
      board[i][j] += board[i-1][j-1];
    }
    // 通常の累積和の値を取得
    board[i][j] += board[i][j-1] + board[i-1][j] - board[i-1][j-1];
  }
  // // 空文字の部分列分を追加
  board[n][m] += 1;
  cout << board[n][m] << endl;
  return 0;
}


Measured memory_bytes: 31616
use std::io;
use std::process;

fn main() {
    let mut s = String::new();

    io::stdin().read_line(&mut s)
        .expect("Read Error");
    
    let mut flag = true;
    for c in s.chars(){
        if flag {
            if c == 'L' {
                print!("No\n");
                process::exit(0);
            }
        }else{
            if c == 'R' {
                print!("No\n");
                process::exit(0);
            }
        }
        flag = !flag;
    }

    print!("Yes\n");
    process::exit(0);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

void solve()
{
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
		--a[i];
	}
	int ans = 0;
	for (int i = 0; i < N; ++i)
	{
		if (a[a[i]] == i)
		{
			++ans;
		}
	}
	cout << ans / 2 << endl;
}

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

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

int main() {
    constexpr int64_t M = 3;
    vector<vector<int64_t>> A(M, vector<int64_t>(M));
    for (int64_t i = 0; i < M; i++) {
        for (int64_t j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }

    int64_t N;
    cin >> N;
    for (int64_t _ = 0; _ < N; _++) {
        int64_t b;
        cin >> b;
        for (int64_t i = 0; i < M; i++) {
            for (int64_t j = 0; j < M; j++) {
                if (A[i][j] == b) {
                    A[i][j] = -1;
                }
            }
        }
    }

    bool ok = false;
    for (int64_t i = 0; i < M; i++) {
        if (A[i][0] == -1 && A[i][1] == -1 && A[i][2] == -1) {
            ok = true;
        }
        if (A[0][i] == -1 && A[1][i] == -1 && A[2][i] == -1) {
            ok = true;
        }
    }

    if (A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1) {
        ok = true;
    }
    if (A[2][0] == -1 && A[1][1] == -1 && A[0][2] == -1) {
        ok = true;
    }

    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
n=int(input())
a=[int(i) for i in input().split()]
ans=0
for i in range(1,len(a)-1):
    if((a[i]>a[i-1] and a[i]<a[i+1]) or (a[i]<a[i-1] and a[i]>a[i+1])):
        ans+=1
print(ans)


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    Rep(i, N, 1000){
        int tmp = i;
        bool flg = true;
        while(tmp){
            if(tmp % 10 != i % 10){
                flg = false;
                break;
            }
            tmp /= 10;
        }
        if(flg){
            cout << i << endl;
            break;
        }
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int           ll;
typedef unsigned long long int  llu;


int main(void)
{
    //READ_IN

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

  int n; cin >>n;
  cout << n*n << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod  = 1e9 + 7;
const ll N = 3e3 + 5;

ll f[N],n;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    f[3]=1;
    if(n>3) for(int i=4;i<=n;i++) f[i]=(f[i-1]+f[i-3])%mod;
    cout<<f[n];
    return 0;
}

Measured memory_bytes: 3656
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class A
{
	public static void Main()
	{
		string[] args = Console.ReadLine().Split(' ');
		int N = Int32.Parse(args[0]);
		int A = Int32.Parse(args[1]);
		int B = Int32.Parse(args[2]);

		Console.WriteLine(Math.Min(A * N, B));
	}
}





Measured memory_bytes: 11092
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iterator>
//#include<math.h>

using namespace std;
#define int long long
/*                      */    //#undef int
#define INF 1000000009
#define INFL 1000000000000000018ll
#define mod 1000000007ll
#define pb push_back
#define fi first
#define se second
#define mk make_pair
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef priority_queue<PA, vector<PA>, greater<PA> >PQG;

int n, v[100005], a[2][100005], sum[2], sum2[2], ans[2], ans2[2];

signed main()
{
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> v[i];
        if(i % 2 == 0){
            a[0][v[i]]++;
        }
        else {
            a[1][v[i]]++;
        }
    }
    for(int i = 0; i < 2; i++){
        for(int j = 1; j <= 100000; j++){
            if(sum[i] <= a[i][j]){
                sum2[i] = sum[i];
                sum[i] = a[i][j];
                ans2[i] = ans[i];
                ans[i] = j;
            }
            else if(sum2[i] <= a[i][j]){
                sum2[i] = a[i][j];
                ans2[i] = j;
            }
        }
    }
    if(ans[0] == ans[1]){
        if(sum[0] == sum2[0]){
            ans[0] = ans2[0];
        }
        else if(sum[1] == sum2[1]){
            ans[1] = ans2[1];
        }
    }
    if(ans[0] != ans[1]){
        printf("%lld\n", n - sum[0] - sum[1]);
    }
    else {
        printf("%lld\n", n - max(sum[0] + sum2[1], sum[1] + sum2[0]));
    }

    return 0;
}
/*


*/


Measured memory_bytes: 2560
n, m = map(int, input().split())
a = set()

for i in range(m):
    a.add(int(input()))

p = [0 for i in range(n)]

if 1 not in a:
    p[0] = 1

if n >= 2 and 2 not in a:
    p[1] = p[0] + 1

for i in range(2, n):
    if i + 1 not in a:
        p[i] = p[i - 1] + p[i - 2]

print(p[n - 1] % 1000000007)

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

typedef long long ll;
using namespace std;
const long long int divisor = 2019; // not prime!!!!

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll L, R;
    cin >> L >> R;
    ll ans = 2020;
    if (R - L >= 2019) {
        ans = 0;
    } else {
        for (ll i = L; i <= R - 1; ++i) {
            for (ll j = i + 1; j <= R; ++j) {
                long long int residual = i * j % divisor;
                if (!residual) {
                    ans = 0;
                    break;
                }
                ans = min(ans, residual);
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    int a,b,c;
    a=sc.nextInt();
    b=sc.nextInt();
    c=sc.nextInt();
    if(a+b+c<22)
      System.out.println("win");
    else
      System.out.println("bust");
  }
}

Measured memory_bytes: 22612
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}
	
	public void solve(Scanner sc) {
		String s = sc.next();
		if(s.matches("^(dream|dreamer|erase|eraser)*$")){
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved

int main(){
    string s,t;
    cin>>s>>t;
    long long ans=t.size();
    rep(i,s.size()-t.size()+1){
        long long  now=t.size();
        rep(k,t.size()){
            if(s[i+k]==t[k]){
                now--;
            }
        }
    ans=min(now,ans);
    }
    cout<<ans<<endl;
    return 0;

}
/*


*/


Measured memory_bytes: 3624
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll MOD=100000007;
const ll INF=1000000101001;
int main(){
int n;cin>>n;
int d[n];
rep(i,n)cin>>d[i];
int sum=0;
rep(i,n){
    for(int j=i+1;j<n;j++){
       sum+=d[i]*d[j];
    }
}
cout << sum << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)

	As := make([]int, N)
	for i := range As {
		fmt.Scan(&As[i])
	}
	
	approved := true
	for _, A := range As {
		if A % 2 == 0 {
			if !(A % 3 == 0 || A % 5 == 0) {
				approved = false
				break
			}
		}
	}
	
	if approved {
		fmt.Println("APPROVED")
	} else {
		fmt.Println("DENIED")
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int w,c[]={125,140,160};

int main(){
	while(cin>>w){
		if(w==-1)return 0;
		if(w<=10)cout<<3130<<endl;
		else{
			w-=10;
			int p=0,C=1150;
			while(p<2&&w>10){C+=c[p]*10;p++;w-=10;}
			C+=c[p]*w;
			cout<<4280-C<<endl;
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include<cstdio>
using namespace std;
#define rep(i,a,n) for (long long  i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
ll mod = 2e18;
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll n;
ll d[100010];
ll total = 1;
bool check() {
	rep(i, 0, n + 1) {
		if (d[i] > total)return false;
		total = (total - d[i]) * 2;
		if (total > (int)1e8)return true;
	}
	return true;
}
void solve() {
	cin >> n;
	rep(i, 0, n + 1)cin >> d[i];
	if (!check()) {
		cout << -1 << endl;
		return;
	}
	vector<ll> most(n + 1);
	most[n] = d[n];
	for (int i = n-1; i >= 0; i--) {
		if(i<60)most[i] = min((1LL << i), most[i+1] + d[i]);
		else most[i] = most[i + 1] + d[i];
	}
	ll ans = 0, lo = 1;
	rep(i, 0, n + 1) {
		lo = min(most[i], 2 * lo);
		ans += lo;
		lo -= d[i];
	}
	cout << ans << endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}







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

int main() {
  int N;
  cin >> N;
  string A[100];
  int p=0,i=0;
  
  for(i=0;i<N;i++){
    cin >> A[i];
  if(A[i]=="Y"){
    p=1;
  }
  }
  
  if(p==1){
    cout << "Four"<<endl;
  }else{
    cout << "Three"<<endl;
    }
    
  }


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

int main(void)
{
    double a, b, x;

    scanf("%lf %lf %lf", &a, &b, &x);
    x /= a;
    if(a * b / 2 >= x)
        printf("%.10f\n", atan2(b, x * 2 / b) / acos(-1) * 180);
    else
        printf("%.10f\n", atan2(b - (x * 2 / a - b), a) / acos(-1) * 180);

    return 0;
}


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

int main(){
	int n, l;
	string in;
	cin >> n >> l;
	map<string, int> m;
	rep(i, n){
		cin >> in;
		m[in]++;
	}
	
	for(auto p : m){
		rep(i, p.second)cout << p.first;
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int h,m,s,x;
  scanf("%d %d", &x);
  h=x/3600;
  m=(x-h*3600)/60;
  s=x%60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
} 


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



int main()
{
	string s;
	int sLength;
	cin >> s;
	sLength = s.size();
	long long ans = 0;
	for(int t = 0; t < (1 << (sLength-1)); t++){
		long long cur = s[0] - '0';
		for(int i = 0; i < sLength-1; i++){
			if(t & (1 << i)){
				ans += cur;
				cur = s[i+1] - '0';
			}else{
				cur = cur * 10 + s[i+1] - '0';
			}
		}
		ans += cur;
	}

	cout << ans << "\n";

	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  long long humi=0;
  for(int i=0; i<N-1; i++){
    if(A.at(i)>A.at(i+1)){
      humi+=A.at(i)-A.at(i+1);
      A.at(i+1)+=A.at(i)-A.at(i+1);
    }
  }
  cout << humi << endl;
}

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

using namespace std;

int main() {
  int N;
  string S;
  cin >> N >> S;
  int result = 0;
  for (int i = 0; i + 3 <= N; ++i) {
    result += (S.substr(i, 3) == "ABC");
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
import sys


def query(num):
    # output
    print("?", num)
    sys.stdout.flush()

    # input
    res = input()
    return res

"""
def query(num):
    print(num)
    if num == "":
        num = "0"
    if int(num) <= N and num <= str(N):
        return "Y"
    if int(num) > N and num > str(N):
        return "Y"
    return "N"
"""

def solve():
    ans = ""
    while len(ans) < 20:
        if len(ans) == 0:
            # 最上位桁のときは1からスタート
            min_lim = 1
        else:
            min_lim = 0
        ok = 10
        ng = min_lim
        if query((ans + str(min_lim) + 9 * "9")[:17]) == "Y":
            # 見ている桁の値がmin_lim, もしくは桁が存在せず
            if query(ans + "2") == "N":
                ans += str(min_lim)
                continue
            # 見ている桁の値が最後のmin_lim, もしくは桁が存在せず
            if query("1" + len(ans) * "0") == "Y":
                ans += str(min_lim)
                print("!", ans)
                return
            else:
                print("!", ans)
                return
        
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if query((ans + str(mid) + 9 * "9")[:17]) == "Y":
                ok = mid
            else:
                ng = mid
        ans += str(abs(ok))

N = 1000000000
solve()


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

int N, M;
#define MAX_N 100000
#define MAX_M 100000
int P[MAX_N];
int X[MAX_M], Y[MAX_M];

int Rank[MAX_N], Par[MAX_N];
map<int, set<int>> G;
int R;

int find(int v) {
  if(Par[v] == v) return v;
  else return Par[v] = find(Par[v]);
}
void unite(int v, int w) {
  v = find(v); w = find(w);
  if(v == w) return;
  if(Rank[v] > Rank[w]) swap(v, w);
  Par[v] = w;
  if(Rank[v] == Rank[w]) ++Rank[w];
}
int main() {
  cin >> N >> M;
  for(int v = 0; v < N; ++v) { Par[v] = v; cin >> P[v]; --P[v]; }
  for(int i = 0; i < M; ++i) {
    int x, y; cin >> x >> y; --x; --y; unite(x, y);
  }
  for(int v = 0; v < N; ++v) {
    G[find(v)].insert(P[v]);
  }
  for(int v = 0; v < N; ++v) {
    R += G[find(v)].count(v);
  }
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 15360
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_bacm
#define mp mame_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    int a, b;
    cin >> a >> b;
    int ans;
    if (b%a) ans = b-a;
    else ans = a+b;
    cout << ans << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}


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

using namespace std;

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    if ((2 * x) > (a * a * b)) {
        double ta = 2 * (b - ((x) / (a * a)));
        ta /= a;
        ta = ((atan(ta) * 180) / M_PI);
        printf("%.10lf", ta);
    } else {
        double ta = ((2 * x) / (a * b));
        ta = ((atan(b / ta) * 180) / M_PI);
        printf("%.10lf", ta);
    }

    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vi a(n);
    rep(i,n) cin>>a[i];
    sort(all(a));
    cout<<a.back()-a.front()<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int x,y;
  scanf("%d%d",&x,&y);
  if(y%2)printf("No");
  else{
    if(y<=(4*x)&&y>=(2*x))printf("Yes");
    else printf("No");
  }
  printf("\n");
  //nl;
  return 0;
}


Measured memory_bytes: 3716
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const long long INF = 1LL << 60;

int MOD = 1000000007;


/*
 * 3 -> 1 -> 3 
 *
 * 2 3 1 | -1 2 -1 | 0 3 0
 * 3 5 4 | -2 1  1 | 0 3 3
 * 5 8 5 | -3 3  0 | 0 6 3
 */

int main(){
    std::ios_base::sync_with_stdio(false);
    int n; cin >> n;
    std::vector<int> a(n);
    rep(i,n) cin >> a[i];

    ll s=0; rep(i,n) s+=a[i];
    ll k=0; rep(i,n) k+=i+1LL;

    if(s%(k+0LL) != 0LL){cout << "NO" << '\n'; return 0;}
    ll d=s/k;

    std::vector<int> diff(n);
    rep(i,n-1) diff[i]=a[i]-a[i+1];
    diff[n-1] = a[n-1]-a[0];

    // rep(i,n) cout << diff[i] << " ";
    // cout << '\n';

    rep(i,n) diff[i]+=d;

    // rep(i,n) cout << diff[i] << " ";
    // cout << '\n';

    rep(i,n){
        if(diff[i]%n!=0 || diff[i]<0){cout << "NO" << '\n'; return 0;}
        diff[i]/=n;
    }

    cout << "YES" << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n;
    cin >> n;
    vector<ll> a(n), b(n), c(n);
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> b[i];
    REP(i, n) cin >> c[i];

    sort(ALL(a));
    sort(ALL(b));
    sort(ALL(c));

    ll ans = 0;
    REP(i, n) {
        auto it_a = upper_bound(ALL(a), b[i]-1);
        auto it_c = lower_bound(ALL(c), b[i]+1);
        ans += (it_a - a.begin()) * (c.end() - it_c);
    }

    // ll ans = 0;
    // REP(i, n) {
    //     ll tmp = 0;    
    //     auto it_b = lower_bound(ALL(b), a[i]+1LL);
    //     RREP(j, it_b - b.begin(), n) {
    //         auto it_c = lower_bound(ALL(c), b[j]+1LL);
    //         tmp += (c.end() - it_c);
    //         // cout << tmp << endl;
    //     }
    //     ans += tmp;
    //     // cout << ans << endl;
    // }

    cout << ans << endl;

    return 0;
}

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!

//

void solve(std::string S, std::string T) {
  // hamming dist
  ll hd = 0;
  rep(i,S.size()){
    if(S[i]!=T[i]) hd++;
  }
  cout << hd << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
  solve(S, T);
  return 0;
}


Measured memory_bytes: 4140
N = gets.chomp.to_i
Fs = [] 
N.times{
    tmp = gets.chomp.split.map(&:to_i)
    Fs << tmp
}
Ps = []
N.times{
    tmp = gets.chomp.split.map(&:to_i)
    Ps << tmp
}

mux = "hoge"
(1..1024).each{ |x|
    # business_times = x.to_s(2).split("").map(&:to_i)
    business_times = "%010b" % x
    business_times = business_times.split("").map(&:to_i)

    butting_nums = []
    Fs.each { |f|
        butting_num = 0
        10.times { |i|
            butting_num = butting_num + 1 if f[i] == 1 && business_times[i] == 1
        }
        butting_nums << butting_num
    }

    # p butting_nums
    tmp = 0
    Ps.each{ |p|
        tmp += p[butting_nums.shift]
    }
    mux = tmp if mux == "hoge" || tmp > mux
}

puts mux


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
    
int main(){
    int n;
    cin >> n;
    
    long long tmp = 0;

    vector <int> a(100010,0);
    rep(i,n){
        int d;
        cin >> d;
        a[d-1] ++;
        tmp += d;
    }

    int q;
    cin >> q;
    rep(i,q){
        int b,c;
        cin >> b >> c;
        long long countb = a[b-1];
        long long countc = a[c-1];
        tmp = tmp - countb * b + countb * c;
        cout << tmp << endl;

        a[c-1] += a[b-1];
        a[b-1] = 0;
    }
    
}


Measured memory_bytes: 3780
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using ll = long long; using ull = unsigned long long; using pii = pair<int, int>;
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD = 1e9 + 7;
static const bool DEBUG = false;

signed main() {
	string s; cin >> s;
	string ans = "";
	rep(i, 0, s.size()) {
		if (s[i] == 'B') { if (!ans.empty())ans.pop_back(); }
		else ans.push_back(s[i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
/*
   * * * * *       *        * * * * * * * * * * * * * * * * * * * * * * * *     * * * * * * *               * *               * * * * * * * * * *
   * * * * *      * *       * * * * * * * * * * * * * * * * * * * * * *    *    * * * * * * *              * * *             * ** * * * * * * * * *
   * *           * * *            * *     * *     * *      * *          * * *   * * *       *             * * * *           * * * *       * *    * *
   * * * * *    * * * *           * *     * *     * *       * * * * * * *  * *  * * * * * * *            * * * * *         * *  * *       * * * * *
   * * * * *   * * * * *          * *     * *     * *        * * * * ** *   * * * * * * * * *           * * * * * *       * *   * * * *   * * * *
         * *  * * * * * *   * *   * *     * *     * *       * * * * * * *    * ** *     * * *          * * * * * * *     * *    * * * *   * *  * *
         * * * *       * *  * *   * *     * *     * *      * *          *     * * *     * * *         * *       * * *   * *     * *       * *   * *
   * * * * ** *         * * * * * * * * * * * * * * * * * * * * * * * * *      *  * * * * * * * * * ** *         * * * * *      * * * * * * *    * *
   * * * * * *           * ** * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * * * * *           * * * *       * * * * * * *     * *
*/
 
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <set>
#define ll long long
#define rep(i, a, b) for (int i = int(a); i <= int(b); i++)
#define sz(a) int((a).size())
#define shit while(t--)
#define fr for(int i=0;i<n;i++)
int maxo=1e9+7;
using namespace std;
int arr[95];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll x;
    cin>>x;
    if(x==0)
    {
        cout<<"1"<<endl;
    }
    else if(x==1)
    {
        cout<<"0"<<endl;
    }
 
    return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

void print(){ std::cout << std::endl; }
template <typename H> void print(H head) { std::cout << head << std::endl; }
template <typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

ll H, W, V;

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

  std::cin >> H >> W;
  std::vector< std::string > grid(H, std::string(W, 'x'));
  for (ll y = 0; y < H; y++) {
    std::cin >> grid[y];
  }

  std::vector< std::string > grid1;
  std::string check(W, '.');
  for (ll y = 0; y < H; y++) {
    if (grid[y] != check) grid1.push_back(grid[y]);
  }

  ll H1 = (ll)grid1.size();
  std::vector< std::string > grid2(H1);
  for (ll x = 0; x < W; x++) {
    bool judge = false;
    for (ll y = 0; y < H1; y++) {
      if (grid1[y][x] == '#') judge = true;
    }
    if (judge == true) {
      for (ll y = 0; y < H1; y++) {
	grid2[y].push_back(grid1[y][x]);
      }
    }
  }

  for (ll y = 0; y < H1; y++) {
    print(grid2[y]);
  }
  return 0;
}


Measured memory_bytes: 384
people,time = (int(n) for n in input().split(" "))
turn = [int(n) for n in input().split(" ")]
answer = 0
for i,t in enumerate(turn):
    if i == people - 1:
        answer += time
    else:
        if turn[i + 1] - turn[i] >= time:
            answer += time
        else:
            answer += (turn[i + 1] - turn[i])
print(answer)

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

int main()
{
	int n,m,x,j,sum,maxv=10000000;//n行 m列 x目标 
	cin>>n>>m>>x;
	int a[n+1][m+1],b[n+1],c[m+1],d[m+1];
	for(int i=0;i<=n;i++)
	b[i]=0;
	for(int i=1;i<=n;i++)
	for(int p=0;p<=m;p++)
	cin>>a[i][p];
	while(b[0]==0)
	{
		j=n;
		while(b[j]==1)
		{
			b[j]=0;
			j--; 
		}
		b[j]=1;
		for(int i=0;i<=m;i++)
		{
			c[i]=0;
			d[i]=1;
		}
		for(int i=1;i<=n;i++)
		{
			for(int k=0;k<=m;k++)
			c[k]+=a[i][k]*b[i];
		}
		for(int i=1;i<=m;i++)
		if(c[i]>=x)
		d[i]=0;
		for(int i=1;i<=m;i++)
		d[1]+=d[i];
		if(d[1]==0&&c[0]<maxv)
		maxv=c[0];
	}
	if(maxv==10000000) maxv=-1;
	cout<<maxv;
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    string X; cin >> X;

    int popbase = 0;
    REP(i,n) if (X[i] == '1') popbase++;
    int mp = 0, mm = 0; // あまり
    int popp = popbase+1, popm = popbase-1;

    REP(i,2) {
        int p = (i == 0) ? popp:popm; 
        if (p == 0) continue;
        ull a = 0;
        int j = 0;
        while(j < X.size()) {
            string s = X.substr(j,32);
            a = (a << s.size()) + bitset<32>(s).to_ullong();
            a %= p;
            j += s.size();
        }
        if (i == 0) {
            mp = a;
        } else {
            mm = a;
        }
    }


    auto calc = [](int x,int m){
        int ret = 0;
        while (x > 0) {
            x %= m;
            bitset<32> bs(x);
            m = bs.count();
            ret++;
        }
        return ret;
    };

    int powp = 1,powm = 1;
    vector<int> ans(n);
    RREP(i,n-1) {
        int a=0;
        if (X[i] == '0') {
            a = mp + powp;

            if (a == 0) ans[i] = 1;
            else ans[i] = calc(a,popp);
        } else {
            if (popm == 0) continue;

            a = mm - powm;
            if (a < 0) a += popm;

            if (popm == 0) ans[i] = 0;
            else if (a == 0) ans[i] = 1;
            else ans[i] = calc(a,popm);
        }
        powp = powp * 2 % popp;
        if (popm != 0) powm = powm * 2 % popm;
    }

    REP(i,n) cout << ans[i] << '\n';

    return 0;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli n,m;
	cin>>n>>m;

	lli num=0;
	lli data[3];
	data[0]=INF;
	data[1]=INF;
	data[2]=INF;

	REP(i,0,m){
		lli s,c;
		cin>>s>>c;
		s--;
		if(s>n){
			cout<<-1<<endl;
			return 0;
		}
		if(data[s]==INF || data[s]==c){
			data[s]=c;
		}
		else
		{
			cout<<-1<<endl;
			return 0;
		}
	}

	if(data[0]==0){
		if(n==1)cout<<0<<endl;
		else cout<<-1<<endl;
		return 0;
	}

	REP(i,0,n){
		if(data[i]==INF){
			if(i!=0)data[i]=0;
			else if(n==1){
				data[i]=0;
			}
			else data[i]=1;
		}
		cout<<data[i];
	}
	cout<<endl;

	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SZ(x) (int)(x).size()
#define mset(a,x) memset(a,x,sizeof(a))
#define dbg(x) cout<<#x<<": "<<(x)<<"\n"
#define pb push_back
#define mp make_pair

int n, k;
vector<int> d;

bool ng(int x){
    while(x > 0){
        int a = x % 10;
        rep(i,k) if(a == d[i]) return true;
        x /= 10;
    }
    return false;
}

int main() {
    cin >> n >> k;
    d.resize(k);
    rep(i,k) cin >> d[i];

    for(int i=n; ; ++i) if(!ng(i)) {
        cout << i << endl;
        return 0;
    }

    return 0;
}


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

int main() {
  int n, a, b;
  string str;
  cin >> n >> a >> b >> str;
  int tmp = 0;
  int foreign = 0;
  for (int i = 0; i < n; i++) {
    string ans;
    if (str.at(i) == 'a') {
      if (tmp < a+b) {
        tmp++;
        ans = "Yes";
      } else {
        ans = "No";
      }
    } else if (str.at(i) == 'b') {
      foreign++;
      if (tmp < a+b) {
        if (foreign <= b) {
          tmp++;
          ans = "Yes";
        } else {
          ans = "No";
        }
      } else {
        ans = "No";
      }
    } else {
      ans = "No";
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 896
// Problem : A - Fighting over Candies
// Contest : AtCoder - AtCoder Beginner Contest 047
// URL : https://atcoder.jp/contests/abc047/tasks/abc047_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

#define spc ' '
#define endl '\n'

using namespace std;


int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	vector<int> v(3);
	for(auto &it:v){
	    cin >> it;
	}
	sort(v.begin(),v.end());
	(v[0]+v[1]==v[2] && cout << "Yes") || cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;

int main(){
	int n, m;
	int place[110];
	int array[110];
	int input;
	bool isStart = true;

	while(cin >> n >> m, n || m){
		isStart = true;
		for(int i=0; i < 110; i++){
			place[i] = 0;
			array[i] = 0;
		}

		for(int i=0; i < n; i++){
			for(int j=0; j < m; j++){
				cin >> input;
				if(input){
					place[j]++;
					array[j]++;
				}
			}
		}
		sort(array, array+m, greater<int>());

		for(int i=0; i < m; i++){
			for(int j=0; j < m; j++){
				if(array[i] == place[j]){
					if(isStart) isStart = false;
					else cout << " ";
					cout << j+1;
					place[j] += 100000;
				}
			}
		}
		cout << endl;
	}


}

Measured memory_bytes: 1180
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

string S;
int cnt=0;

void solve(){
    rep(i,S.size()-1)
        if(S[i]!= S[i+1]) cnt++;
    
    cout << cnt << endl;
}

int main(){
    cin >> S;

    solve();
}


Measured memory_bytes: 512
n,*a=map(int,open(0).read().split())
ans=n; s=a[0]; r=0
for l in range(n-1):
    while r<n-1 and not(s&a[r+1]):
        s^=a[r+1];r+=1
    ans+=r-l;s^=a[l]
print(ans)


Measured memory_bytes: 91172