akhauriyash/Code-Regression huggingface dataset:
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	vi d(n);
	rep(i,n)d[i]=i+1;
	rep(i,21){
		int t=-1,tt=-1;
		rep(j,n){
			if((1<<i)&in[j]){
				tt=t;
				t=j;
			}
			d[j]=min(d[j],(ll)j-tt);
		}
	}
	ll out=0;
	rep(i,n)out+=d[i];
	cout<<out<<endl;
}










Measured memory_bytes: 3328
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //Aの倍数秒後にB毎生産
            //T+0.5秒後までに生産されるビスケット
            int[] q = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int cnt = 0;
            for (int i = 1; i < q[2]+0.5; i++)
            {
                if (i % q[0] == 0) cnt += q[1];
            }
            Console.WriteLine(cnt);
        }

    }
}


Measured memory_bytes: 13140
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    
    divisors.sort()
    return divisors

n, m = map(int, input().split())

div = make_divisors(m)
ans = 0
for d in div:
    if d * n <= m:
        ans = max(ans, d)

print(ans)


Measured memory_bytes: 3064
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}

ll dp[3010][3010]={};

const int MAX = 10000000;//設定して

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

long long modpow(long long a, long long n, long long MOD) {//a^n(MOD)を求める
    long long res = 1%MOD;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;//次の準備
        n >>= 1;
    }
    return res;
}

signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  COMinit();

  ll a,b,c,d;cin>>a>>b>>c>>d;

  dp[a][b]=1;
  rep(i,a,c+1){
    rep(j,b,d+1){
      /*if(i>a && j>b)(dp[i][j]=dp[i-1][j-1]*COM(i+j-1,2))%=mod;
      else if(i>a)(dp[i][j]+=dp[i-1][j]*j)%=mod;
      else if(j>b)(dp[i][j]+=dp[i][j-1]*i)%=mod;*/

      if(i>a)(dp[i][j]+=dp[i-1][j]*j)%=mod;
      if(j>b)(dp[i][j]+=dp[i][j-1]*i)%=mod;
      if(i>a && j>b){
        ll tmp=dp[i-1][j-1]*(i-1);
        tmp%=mod;
        tmp*=j-1;
        tmp%=mod;
        (dp[i][j]+=mod-tmp)%=mod;
      }



    }
  }

  cout<<dp[c][d]<<ENDL;
  
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 308428
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;

int main(){
	ll N;
	cin >> N;
	vector<ll> P(N+1,0);
	for(ll i=1;i<=N;i++){
		cin>>P[i]
	;}
	ll counter=0;
	for(ll i=1;i<=N;i++){
		if(P[i]!=i)counter++
	;}
	if(counter<=2)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

return 0;
}  



Measured memory_bytes: 256
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Atcoder_Answer
{
    class Program
    {
        const int mod = 1000000007;

        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            string[] Reader = ReadLine().Split(' ');

            string RetValue = "APPROVED";
            for (int loop = 0; loop < N; loop++) 
            {
                if (int.Parse(Reader[loop]) % 2 == 0 && (int.Parse(Reader[loop]) % 5 != 0 && int.Parse(Reader[loop]) % 3 != 0) ) RetValue = "DENIED";
            }

            WriteLine(RetValue);
        }

    }

    public static class Extension
    {
        #region 拡張:bool
        #region キャスト関連
        public static int ToInt(this bool Bool)
        {
            if (Bool) return 1;
            else return 0;
        }

        public static string ToString(this bool Bool, string TrueStr, string FalseStr)
        {
            if (Bool) return TrueStr;
            else return FalseStr;
        }
        #endregion
        #endregion

        #region 拡張:int
        #region キャスト関連
        public static char ToAlphaBets(this int Base) => (char)Base;
        #endregion
        #endregion

        #region 拡張:char
        #region 変換関連
        public static char NextAlpha(this char Char) => (char)((Char) + 1); //次の文字を取得
        #endregion
        #endregion

        #region 拡張:int[]
        public static long Sum(this int[] Array)
        {
            int Ret = 0;
            for (int loop = 0; loop < Array.Length; loop++) Ret += Array[loop];
            return Ret;
        }
        #endregion

        #region 拡張: string
        public static string Multi(this string THIS, int Value) 
        {
            string RetValue = "";

            for (int loop = 0; loop < Value; loop++) RetValue += THIS;

            return RetValue;
        }
        #endregion
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
	if (b==0) return a;
    else{
    	return gcd(b,a%b);
    }
}
 
int main() {
	ll a,b;
  	cin >> a >> b;
      cout << (a-1)*(b-1) << endl;
}


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

#define DEBUG

#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

//#define int long long
typedef long long ll;
//constexpr int INF = 1e9;
//constexpr int MOD = 1000000007;

decltype(1) main()
{
    //cin.tie(nullptr);
    //ios_base::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        sum += a[i];
    }
    sort(a.begin(), a.end(), greater<int>());
    if (static_cast<double>(a[m - 1]) >= (sum / (4.0 * m)))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)

ans = 0
n.times do |i|
  ans += [a[i], b[i]].min
  if b[i] > a[i]
    ans += [a[i+1], b[i]-a[i]].min
    a[i+1] -= [a[i+1], b[i]-a[i]].min
  end
end

puts ans

Measured memory_bytes: 19612
#include <cmath>
#include <cstdio>
#include <vector>
#pragma warning(disable : 4996)
using namespace std;
int N, Q;
int main() {
	scanf("%d%d", &N, &Q);
	vector<int> tp(Q), s(Q), t(Q), x(Q);
	for (int i = 0; i < Q; i++) {
		scanf("%d%d", &tp[i], &s[i]), s[i]--;
		if (tp[i] == 0) scanf("%d%d", &t[i], &x[i]);
	}
	int B = sqrt(Q);
	vector<int> d(N);
	for (int i = 0; i < B; i++) {
		int l = 1LL * i * Q / B, r = 1LL * (i + 1) * Q / B;
		for (int j = l; j < r; j++) {
			if (tp[j] == 1) {
				int sum = 0;
				for (int k = l; k < j; k++) {
					if (tp[k] == 0 && s[k] <= s[j] && s[j] < t[k]) sum += x[k];
				}
				printf("%d\n", d[s[j]] + sum);
			}
		}
		vector<int> imos(N + 1);
		for (int j = l; j < r; j++) {
			if (tp[j] == 0) {
				imos[s[j]] += x[j];
				imos[t[j]] -= x[j];
			}
		}
		int sum2 = 0;
		for (int j = 0; j < N; j++) {
			sum2 += imos[j];
			d[j] += sum2;
		}
	}
	return 0;
}

Measured memory_bytes: 4816
import java.util.*;

public class Main {
    final static int MOD = 1000000007;
    
    public static void main(String[] args) {
        MyScanner in = new MyScanner();
        double a = in.nextDouble();
        double b = in.nextDouble();
        double x = in.nextDouble();
        double ans = 0;
        
        if (x <= b * a * a / 2) {
            double c = x / (b * a) * 2;
            //double d = Math.sqrt(Math.pow(b,2) + Math.pow(c,2));
            double radian = Math.atan2(c, b);
            ans = 90 - radian * 180 / Math.PI;
        
        } else {
            double e = ((2 * x) / Math.pow(a,2)) - b;
            double f = b - e;
            double radian = Math.atan2(a, f);
            ans = 90 - radian * 180 / Math.PI;
        }
        
        System.out.println(ans);
        
        
    }
    
    static class MyScanner {
        static Scanner sc = new Scanner(System.in);
        
        String next() {
            return sc.next();
        }
        
        String nextLine() {
            return sc.nextLine();
        }
        
        int nextInt() {
            return Integer.parseInt(sc.next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextInt();
            }
            return array;
        }
        
        double[] nextDoubleArray(int n) {
            double[] array = new double[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextDouble();
            }
            return array;
        }
        
        long[] nextLongArray(int n) {
            long[] array = new long[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextLong();
            }
            return array;
        }
        
        String[] nextLineArray(int n) {
            String[] array = new String[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextLine();
            }
            return array;
        }
        
        int[][] nextIntMatrix(int n, int m) {
            int[][] matrix = new int[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    matrix[i][j] = nextInt();
                }
            }
            return matrix;
        }
        
        double[][] nextDoubleMatrix(int n, int m) {
            double[][] matrix = new double[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    matrix[i][j] = nextDouble();
                }
            }
            return matrix;
        }
        
        long[][] nextLongMatrix(int n, int m) {
            long[][] matrix = new long[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    matrix[i][j] = nextLong();
                }
            }
            return matrix;
        }
    }
}

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

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

    for(int i = 1;i <= n;i++) {
        //cout << i << " " << (int)(i * 1.08) << endl;
        if((int)(i * 1.08) == n) {

            cout << i << endl;
            return 0;
        }

    }
    cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7;
const ll LINF=1e18;
using namespace std;
#define int long long
//template
int M;
int pw(int n,int k){
  int res=1;
  while(k){
    if(k%2)res*=n;res%=M;
    k/=2;
    n*=n;n%=M;
  }
  return res;
}

std::vector<int> v(1000000);
std::vector<int> w(1000000);
int nCk(int n,int k){
  int res=v[n];
  res*=w[k];res%=M;
  res*=w[n-k];res%=M;
  return res;
}

int frac(int N,int i){
  int res=0;
  for(int j=0;j<N-i;j++){
    int b=nCk(N-i,j)*pw(pw(2,N-i-j)-1,i)%M;
    if(j%2)b*=-1;
    res+=b;
  }
  res%=M;res+=M;res%=M;
  return res;
}
//main
signed main(){
  int N;cin>>N>>M;
  int ans=0;
  v[0]=1;for(int i=1;i<1000000;i++)v[i]=v[i-1]*i%M;
  for(int i=0;i<1000000;i++)w[i]=pw(v[i],M-2);
  for(int i=1;i<N;i++){
    int res=pw(2,i*(i-1)/2);
    res*=pw(2,(N-i)*(N-i-1)/2);res%=M;
    res*=frac(N,i);res%=M;
    res*=nCk(N,i);
    ans+=res;ans%=M;
    //cout<<pw(2,i*(i-1)/2)<<" "<<pw(2,(N-i)*(N-i-1)/2)<<" "<<frac(N,i)<<endl;
  }
  cout<<ans<<endl;
  //cout<<pw(3,5)<<" "<<nCk(7,3)<<endl;
}



Measured memory_bytes: 18252
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;

void solve(void){
    ll x;
    cin >> x;
    if(x == 2){
        cout << x << endl;
        return;
    }
    bool flag = true;
    while(flag){
        flag = false;
        for(int i = 2;i < sqrt(x)+1;i++){
            if(x%i == 0) flag = true;
        }
        x++;
    }
    cout << x-1 << endl;
}

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


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

A = [0] * N
ans = B[0]
A[0] = B[0]
for n in range(1, N-1):
    if B[n] < B[n-1]:
        A[n] = B[n]
    else:
        A[n] = B[n-1]
    ans += A[n]
ans += B[-1]
print(ans)


Measured memory_bytes: 3060
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int H, W;
  while (cin >> H >> W) {
    vector<string> board(H);
    for (int i = 0; i < H; i++) cin >> board[i];
    int N = H + W - 1;
    vec<int, 2> grid = make_v(N, N, 0);
    for (int y = 0; y < H; y++) {
      for (int x = 0; x < W; x++) {
        if (board[y][x] == '.') continue;
        // (x, y) -> (x + y, x - y)
        int u = x - y;
        int v = x + y;
        grid[u + (H - 1)][v] = 1;
      }
    }
    vec<int, 2> sumR = make_v(N, N + 1, 0);
    vec<int, 2> sumC = make_v(N, N + 1, 0);
    for (int y = 0; y < N; y++) {
      for (int x = 0; x < N; x++) {
        sumR[y][x + 1] = sumR[y][x] + grid[y][x];
        sumC[x][y + 1] = sumC[x][y] + grid[y][x];
      }
    }
    ll res = 0;
    for (int y = 0; y < N; y++) {
      vector<int> xs;
      for (int x = 0; x < N; x++)
        if (grid[y][x]) xs.push_back(x);
      for (int i = 0; i < xs.size(); i++) {
        for (int j = i + 1; j < xs.size(); j++) {
          int d = xs[j] - xs[i];
          if (y - d >= 0) res += sumR[y - d][xs[j] + 1] - sumR[y - d][xs[i]];
          if (y + d < N) res += sumR[y + d][xs[j] + 1] - sumR[y + d][xs[i]];
        }
      }
    }
    for (int x = 0; x < N; x++) {
      vector<int> ys;
      for (int y = 0; y < N; y++)
        if (grid[y][x]) ys.push_back(y);
      for (int i = 0; i < ys.size(); i++) {
        for (int j = i + 1; j < ys.size(); j++) {
          int d = ys[j] - ys[i];
          if (x - d >= 0) res += sumC[x - d][ys[j] + 1] - sumC[x - d][ys[i]];
          if (x + d < N) res += sumC[x + d][ys[j] + 1] - sumC[x + d][ys[i]];
        }
      }
    }
    for (int y = 0; y < N; y++) {
      for (int x = 0; x < N; x++) {
        if (grid[y][x] == 0) continue;
        for (int d = 1; y - d >= 0 && x - d >= 0; d++)
          if (grid[y - d][x] && grid[y][x - d]) --res;
        for (int d = 1; y - d >= 0 && x + d < N; d++)
          if (grid[y - d][x] && grid[y][x + d]) --res;
        for (int d = 1; y + d < N && x - d >= 0; d++)
          if (grid[y + d][x] && grid[y][x - d]) --res;
        for (int d = 1; y + d < N && x + d < N; d++)
          if (grid[y + d][x] && grid[y][x + d]) --res;
      }
    }
    cout << res << endl;
  }
  return 0;
}


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

using namespace std;

int main(){
    int X;
    int flag = 0;
    int ct = 0;
    cin >> X;
    while(flag == 0){
        for(int i=1; i<X;i++){
            if(X%i == 0){
                ct++;
            }
        }
        if(ct == 1){
            cout << X << endl;
            return 0;
        }
        else{
            X+=1;
            ct = 0;
        }
    }
}

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

# In[71]:


s = input()
t = input()


# In[74]:


s_list = "".join(sorted(s))
t_list = "".join(sorted(t, reverse=True))
if s_list < t_list:
    print("Yes")
else:
    print("No")


# In[ ]:






Measured memory_bytes: 9100
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };



signed main() {
	string s;


	cin >> s;

	if (s.length() <= 4) {
		cout << "NO" << endl;
		return 0;
	}

	while (s.length() >= 5)
	{
		string s1 = s.substr(0, 5);
		string s2 = s.substr(0, 6);
		string s3 = s.substr(0, 7);


		if (s2 == "eraser") {
			s.erase(0, 6);
			if (s.length() == 0)break;
		}
		else if (s1 == "dream") {
			if (s3 == "dreamer") {
				if (s[s3.length()] == 'a') {
					s.erase(0, 5);
				}
				else {
					s.erase(0, 7);
				}
			}
			else {
				s.erase(0, 5);
			}

			if (s.length() == 0)break;
		}
		else if (s1 == "erase") {
			s.erase(0, 5);
			if (s.length() == 0)break;
		}
		else {
			cout << "NO" << endl;
			return 0;
		}

		if (s.length() <= 4) {
			cout << "NO" << endl;
			return 0;
		}
	

	}
	
	cout << "YES" << endl;



	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(void){
    int n,i,count=0,p[51];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
        if(p[i]!=i+1){
            count++;
        }
    }
    //printf("%d\n",count);
    if(count>2){
        printf("NO\n");
    }else{
        printf("YES\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
const int INF = 100000000;
using namespace std;

double dis(vector<pair<pair<double, double>,double>> v){
    double ret = 0;
    rep(i,v.size()){
        for(int j = i + 1; j < v.size(); j++){
            double a, b, c;
            a = v[i].first.first - v[j].first.first;
            b = v[i].first.second - v[j].first.second;
            c = v[i].second - v[j].second;
            ret += a * a + b * b + c * c;
        }
    }
    return ret;
}

int main(){
    int n, m;
    double a[21][3];
    double ans = 0;
    cin >> n >> m;
    rep(i,n) rep(j,3) cin >> a[i][j];

    rep(i,(1 << n)){
        vector<pair<pair<double, double>,double>> v;
        int cnt = 0;
        rep(j,n){
            if(((i >> j) & 1) == 1){
                cnt++;
            }
        }
        if(cnt != m) continue;
        rep(j,n){
            if(((i >> j) & 1) == 1){
                v.emplace_back(make_pair(make_pair(a[j][0], a[j][1]), a[j][2]));
            }
        }
        ans = max(ans, dis(v));
    }
    cout << fixed << setprecision(5) << ans << endl;
}

Measured memory_bytes: 3308
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
struct edge {
    int to; 
    int weight;
    edge(int t, int w) : to(t),weight(w) {}
};
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;
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; }

int main(){

    int n,h; cin >> n >> h;
    vector<int> b(n);
    int a_max = 0;
    rep(i,n){
        int x,y; cin >> x >> b.at(i);
        chmax(a_max,x);
    }
    sort(all(b));
    reverse(all(b));
    ll cnt = 0;
    int i = 0;

    while(i < n && b.at(i) >= a_max){
        h -= b.at(i);
        cnt++;
        i++;
        if(h <= 0) break;
    }
    while(h > 0){
        h -= a_max;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 768
#include<iostream>

using namespace std;

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

int main(){
  int N, K;
  string S, ans;
  cin >> N >> K >> S;
  
  rep(i,N){
    if(i == K-1){
      ans += tolower(S[i]);
    }else{
      ans += S[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
//---------------------------

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int N;cin>>N;
  char buf[N];
  string flag("Three");
  REP(i,N){
    cin>>buf[i];
    if(buf[i] == 'Y') flag="Four";
  }
  P(flag);
  return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
n = int(input())
alst = list(map(int, input().split()))
cnt = 0
pos = 0
rev = False
for i in range(h):
    ans = [0 for _ in range(w)]
    for j in range(w):
        if rev:
            ans[w - 1 - j] = pos + 1
        else:
            ans[j] = pos + 1
        cnt += 1
        if alst[pos] == cnt:
            cnt = 0
            pos += 1
    print(*ans)
    if rev:
        rev = False
    else:
        rev = True

Measured memory_bytes: 9280
/* ALDS1_10_A:FibonacciNumber */
/* 20181130 AOJ */

#define _CRT_SECURE_NO_WARNINGS
#define N 45
#include <stdio.h>

int fib(int n);
int F[N];

int main(void) {
	int n, i;

	scanf("%d", &n);
	for(i = 0; i <=n; i++) F[i] = 0;
	printf("%d\n", fib(n));

	return 0;
}

int fib(int n) {
	if(n == 0 || n == 1) {
		F[n] = 1;
    } else if(F[n] == 0) {
		F[n] = fib(n - 1) + fib(n - 2);
	}

	return F[n];
}


Measured memory_bytes: 2040
N = int(input())

A = list(map(int,input().split()))

flg = 1
for i in range(N):
    if (A[i] % 2 == 0):
        if(A[i] % 3 == 0 or A[i] % 5 == 0):
            flg = 1
        else:
            flg = 0
            break

if(flg == 1):
    print('APPROVED')
else:
    print('DENIED')
        


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

int main(void){
 int a, b;
 cin >> a >> b;
 if(a < b){
   cout << "a < b\n";
 }else if(a > b){
   cout << "a > b\n";
 }else if(a == b){
   cout << "a == b\n";
 }
  return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <utility>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  multiset<string> s;
  for (int i = 0; i < N; i++) {
    string tmp; cin >> tmp;
    s.insert(tmp);
  }
  int M; cin >> M;
  multiset<string> t;
  for (int i = 0; i < M; i++) {
    string tmp; cin >> tmp;
    t.insert(tmp);
  }
  int ans = 0;
  for (auto it = s.begin(); it != s.end(); ++it) {
    int sc = s.count(*it); int tc = t.count(*it);
    //cout << *it << " s:" << sc << " t:" << tc <<
    //  " s-t:" << sc-tc << endl;
    if (ans < sc-tc)
      ans = sc-tc;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;
int main(){
    int n;
    cin>>n;
    int A[100];
    for(int i=0;i<n;i++) cin>>A[i];
    set<int> C;
    for(int i=0;i<n;i++) C.insert(A[i]);
    cout<<C.size();
}

Measured memory_bytes: 256
N,M=map(int,input().split())
X=list(map(int,input().split()))
X.sort()
sa=[]
for i in range(M-1):
  sa.append(X[i+1]-X[i])
sa.sort()
if N > M:
  print(0)
else:
  print(sum(sa[:M-N]))

Measured memory_bytes: 13968
#include"bits/stdc++.h"
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20)
#define ll long long
#define endl '\n'
//       Author
//        ::
//    (  NOBODY  )
//   No Copyright .....You can copy and paste it without my permission...................................
// !!!!!!!!!!!!!!!
#define pb push_back
#define N 300009
int a[N],b[N],c[N];
int dp[100009][4];
int main()
{
    FAST_IO;
    int n,k;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i]>>b[i]>>c[i];
    dp[1][1]=a[1];
    dp[1][2]=b[1];
    dp[1][3]=c[1];
    for(int i=2;i<=n;i++)
    {
      dp[i][1]+=max(dp[i-1][2],dp[i-1][3])+a[i];
      dp[i][2]+=max(dp[i-1][1],dp[i-1][3])+b[i];
      dp[i][3]+=max(dp[i-1][2],dp[i-1][1])+c[i];
    }
    cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));
    return 0;
}


Measured memory_bytes: 4480
use std::io;
use std::str::FromStr;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
                assert!(_it.next().is_none());
        }
    };
}

fn main() {

    from_line!(n: u64);
    let mut v = Vec::new();
    for _ in 0..n {
        let stdin = io::stdin();
        let mut buf = String::new();
        stdin.read_line(&mut buf).ok();
        let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
        v.push(it.next().unwrap());
    }

    let mut max: i64 = -1000000000;
    let mut min = v[0] as i64;
    for i in 1..n {
        if max < v[i as usize] as i64 - min {
            max = v[i as usize] as i64 - min;
        }
        if min > v[i as usize] as i64 {
            min = v[i as usize] as i64;
        }

    }
    println!("{}", max);

}



Measured memory_bytes: 6968
import numpy as np

class UnionFind:
    def __init__(self,n):
        self.par=[i for i in range(n+1)]
        self.rank=[0]*(n+1)
        self.dame=[0]*(n+1)
        self.size=[1]*(n+1)

    def find(self,x):#根を探す
        if self.par[x]==x:
            return x
        else:
            self.par[x]=self.find(self.par[x])
            return self.par[x]
    def same_check(self,x,y):
        return self.find(x)==self.find(y)

    def union(self,x,y):
        x=self.find(x)
        y=self.find(y)

        if self.rank[x]>=self.rank[y]:
            self.par[y]=x
        else:
            self.par[x]=y
        if self.rank[x]==self.rank[y]:
            self.rank[x]+=1
        self.size[x]=self.size[y]=self.size[x]+self.size[y]
    
    def rev_size(self,n):
        for i in range(n+1):
            self.size[i]=self.size[self.find(i)]

    def dame_cnt(self,a,b):
        if a!=b:
            self.dame[a]+=1
            self.dame[b]+=1

N,M,K=map(int,input().split())#N：人の数、M：友達関係の数　：

UF=UnionFind(N)

for _ in range(M):
    A,B=map(int,input().split())
    UF.dame_cnt(A,B)
    if UF.same_check(A,B)==0:
        UF.union(A,B)

for _ in range(K):
    C,D=map(int,input().split())
    if UF.same_check(C,D):
        UF.dame_cnt(C,D)

UF.rev_size(N)

print(*list(np.array(UF.size[1:])-np.array(UF.dame[1:])-np.array([1]*(N))))


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



bool search(int x, string & str){
    char pos1 = (x / 100) + '0';
    char pos2 = (x % 100) / 10 + '0';
    char pos3 = (x % 10) + '0';
    string tar = "";
    tar += pos1;
    tar += pos2;
    tar += pos3;
    bool flag = true;
    int i = 0;
    string::size_type position = 0;
    while(i < 3 && position++ != str.npos){
        if(i == 0) position = 0;
        position = str.find(tar[i], position);
        i ++;
    }
    if(i != 3 || position == str.npos) return false;
    return true;
}

int main(){
    int n;
    string str;
    cin >> n >> str;
    int cnt = 0;
    for(int i = 0; i < 1000; i ++){
        if(search(i, str)){
            cnt ++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int n;
  cin >> n;
  string ans = "ABC" + to_string(n);
  cout << ans << endl;
  return 0;
}

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

int main() {
  int n,k,d,s=0;

  cin >> n >> k;

  vector<int> a(n);
  rep(i,n) a[i]=0;
  rep(i,k) {
    cin >> d;
    rep(j,d){
      int t;
      cin >> t;
      a[t-1]++;
    } 
  }
  rep(i,n){
    if (a[i]==0) s++;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>

using namespace std ;

void lsb(vector<long long> *v, long long a)
{
    int i;
    
    for(i=0; i<60; i++)
    {
        if(a & 1LL<<i)
        {   
            if((*v)[i])
                a ^= (*v)[i];
            else
            {
                (*v)[i] = a;
                break;
            }
        }
    }
}

bool test(vector<long long> *v, long long a)
{
    int i;
    
    for(i=0; i<60; i++)
    {
        if(a & 1LL<<i)
        {   
            if((*v)[i])
                a ^= (*v)[i];
            else
                break;
        }
    }
    
    if(i == 60)
        return true;
    else
        return false;
}

int main(void)
{
    int i, j;
    int t, n;
    long long a[200];
    char s[201];
    vector<long long> v;
    bool ans;
    
    
    scanf("%d", &t);
    while(t--)
    {
        scanf("%d", &n);
        for(i=0; i<n; i++)
            scanf("%lld", &a[i]);
        scanf("%s", s);
        
        v.clear();
        v.resize(60);
        ans = true;
            
        for(i=n-1; i>=0; i--)
        {
            if(s[i] == '0')
                lsb(&v, a[i]);
            else
                if(!test(&v, a[i]))
                {
                    ans = false;
                    break;
                }
        }
        
        printf("%d\n", 1-ans);
    }
    
    //system("pause");
    
    return 0;
}


Measured memory_bytes: 3708
import bisect
n,m=map(int,input().split())
a=dict()
b=[]
for i in range(m):
    p,y=map(int,input().split())
    b.append((p,y))
    if p not in a:
        a[p]=[y]
    else:
        a[p]+=[y]
for i,l in a.items():
    a[i]=sorted(l)
for p,y in b:
    index=bisect.bisect_left(a[p],y)+1
    a1=str(p).zfill(6)
    a2=str(index).zfill(6)
    print(a1+a2)


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

int main(){
  int K,S,count = 0;
  cin >> K >> S;
  for (int i = 0;i <= K ;i++)
    for (int l = 0; l <= K;l++)
      if (0 <=S - (i + l) && S- (i + l) <= K) count++;
  cout << count << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
    final static long MOD = 1000000007;
    FastScanner sc = new FastScanner();

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

    void solve(){

        int n = sc.nextInt();
        String s = sc.next();
        char[] c = s.toCharArray();

        for(int i = 0; i < c.length; i++){
            if((c[i] + n) <= (int) 'Z') System.out.print((char)(c[i] + n));
            else System.out.print((char)((c[i] + n) % (int) 'Z' + (int) 'A' - 1));
        }

        System.out.println();

    }

    long gcd(long a, long b){ // return aとbの最大公約数
        if(b == 0){
          return a;
        }
        return gcd(b, a % b);
    }

    long pow_mod(long a, long r){ // return a^r (mod MOD)
        long sum = 1;
        while(r > 0){
            if((r & 1) == 1){
                sum *= a;
                sum %= MOD;
            }
            a *= a;
            a %= MOD;
            r >>= 1;
        }
        return sum;
    }



}



class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte(){
        if(ptr < buflen){
            return true;
        }else{
            ptr = 0;
            try{
                buflen = in.read(buffer);
            }catch(IOException e){
                e.printStackTrace();
            }
            if(buflen <= 0){
                return false;
            }
        }
        return true;
    }
    private int readByte(){ if(hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c){ return 33 <= c && c <= 126;}
    public boolean hasNext(){ while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next(){
        if(!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong(){
        if(!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        if(b < '0' || '9' < b){
            throw new NumberFormatException();
        }
        while(true){
            if('0' <= b && b <= '9'){
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt(){
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble(){ return Double.parseDouble(next());}
}


Measured memory_bytes: 25684
function abc100_a()

	# STEP.01
	# get the number of the slice of cake
	A, B = Base.parse.( Base.split( Base.readline( Base.STDIN ) ) )

	# STEP.02
	# output the result
	if A <= 8 && B <= 8
		Base.println( Base.STDOUT, "Yay!")
	else
		Base.println( Base.STDOUT, ":(" )
	end

	# STEP.TRUE_END
	return Base.nothing

end

#==================================================================================================#

Main.abc100_a()


Measured memory_bytes: 120224
#include <cstdint>
#include <iostream>

using namespace std;

int32_t main()
{
  uint32_t a, b, c;
  cin >> a >> b >> c;

  if ((c - b) == (b - a)) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <memory.h>
#include <string>

using namespace std;

typedef long long ll;

int N;
double A[1005];
int main() {
  double res = 0;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%lf", &A[i]);
    res += 1.0 / A[i];
  }
  printf("%.15lf\n", 1.0 / res);
  return 0;
}


Measured memory_bytes: 256
k, n = list(map(int, input().split()))
x = list(map(int, input().split()))
y = [] * len(x)

max_dist = 0
for i in range(len(x)):
  now_dist = 0
  if i == 0:
    now_dist = k - (x[len(x)-1] - x[0])
  else:
    now_dist = x[i] - x[i-1]
  if now_dist > max_dist:
    max_dist = now_dist
print(k - max_dist)



Measured memory_bytes: 77388
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
#define ll                  long long int
#define ull                 unsigned long long int
#define ld                  long double
#define fi                  first
#define se                  second
#define pb                  push_back
#define pbb                 pop_back
#define mp                  make_pair
#define popcount            __builtin_popcountll
#define pii     	        pair<int,int>
#define all(x)              x.begin(), x.end()
#define uniq(x)             x.erase(unique(x.begin(),x.end()),x.end())
#define mem(array, value)   memset(array, value, sizeof(array))
#define lcm(a,b)            (abs(a)/gcd(a,b))*abs(b)
#define random(a, b)        ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))
#define PI      	        2*acos(0.0)
#define INF     	        1e9
#define EPS     	        1e-8
#define line                cout << "\n==========\n"
#define fastRead 	        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

//int dx[] = {1, -1, 0, 0},                  dy[] = {0, 0, 1, -1};                  // 4 Direction
//int dx[] = {1, -1, 0, 0, 1, 1, -1, -1},    dy[] = {0, 0, 1, -1, 1, -1, 1, -1};    // 8 Direction
//int dx[] = {1, -1, 1, -1, 2, 2, -2, -2},   dy[] = {2, 2, -2, -2, 1, -1, 1, -1};   // Knight Direction

inline ll gcd(ll a, ll b){
    a = abs(a);
    b = abs(b);
    while (b){
        a = a % b;
        swap (a, b);
    }
    return a;
}
inline ll power(ll a, ll p){
    ll res = 1, x = a;
    while (p){
        if (p & 1){
            res = (res * x);
        }
        x = (x * x);
        p >>= 1;
    }
    return res;
}
inline ll bigmod(ll a, ll p, ll m){
    ll res = 1 % m, x = a % m;
    while (p){
        if (p & 1){
            res = (res * x) % m;
        }
        x = (x * x) % m;
        p >>= 1;
    }
    return res;
}

map<int, int> M;

int main ()
{
    #ifdef Lollipop
    //freopen ("input.txt", "r", stdin);
    //freopen ("output.txt", "w", stdout);
    #endif
    int n, m;
    cin >> n >> m;
    for (int i = 0; i<n; i++){
        int k;
        cin >> k;
        int x;
        while (k--){
            cin >> x;
            M[x]++;
        }
    }
    int ans = 0;
    for (int i = 1; i<=m; i++){
        if (M[i] == n){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main(void){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(a * b, c * d) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> v;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        v.push_back(x);
    }
    int q;
    cin >> q;
    for(int i = 0; i < q; i++)
    {
        int k;
        cin >> k;
        auto itr = lower_bound(v.begin(), v.end(), k);
        cout << itr - v.begin() << endl;
    }
    return 0;
}




Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b;
  	cin >> a >> b;
  	if(a==1 || b==1)cout << 1;
  	else if(a&1 && b&1)cout << a*b/2 + 1;
 	else cout << a*b/2;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef long long ll;
#define loop(n)      for(int i=0;i<(n);i++)
#define lp(x,s,e)    for(int x=(s);x<(e);x++)
#define lpe(x,s,e)    for(int x=(s);x<=(e);x++)
#define MP make_pair
#define PB push_back
#define all(a)  a.begin(),a.end()
#define clr(x,val) memset((x),(val),sizeof(x))
#define endl '\n'

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    string s;
    cin>>s;
    int n=s.size();
    for(int i=0;i<n-1;i++){
      if(s[i]==s[i+1]){
       cout<<i+1<<" "<<i+2;
       return 0;
      }
      if(i<n-2&&s[i]==s[i+2]){
        cout<<i+1<<" "<<i+3;
        return 0;
      }
    }
    cout<<"-1 -1";
    return 0;}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
using namespace std;
int main(void){
  int x,y,z;
  while(cin >> x >> y){
    if(x<y) swap(x,y);
    while((z=x%y)!=0){
      x=y;
      y=z;
    }
    cout << y << endl;
  }
}


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

using namespace std;
using lint = long long;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<int>;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
using pqi = priority_queue<int>;
using pql = priority_queue<lint>;
#define mii = map<int, int>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define repf(i, f, n) for (int i = (f); i < (n); i++)
#define mp(x, y) make_pair((x), (y))
#define pb(x) push_back((x))
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define foreach(it, x) for (auto it = (x).begin(); it != (x).end(); it++)
#define space (char)0x20
#define yes "Yes"
#define no "No"

constexpr lint MOD = 1e9 + 7;
const double PI = acos(-1);
int A, B, C, D, E, F, G, H, I, J, K, L, M, N;
int O, P, Q, R, S, T, U, V, W, X, Y, Z;
// string s;
int ans;
int sum = 0;
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	cin >> N >> M;
	rep(i, M) {
		cin >> A;
		sum += A;
	}
    
    cout << (N >= sum ? N - sum : -1) << endl;
    return 0;
}

Measured memory_bytes: 3656