akhauriyash/Code-Regression huggingface dataset:
listn = list(input())
while listn != []:
    last_letter = listn[-1]
    if last_letter == "r":
        if "".join(listn[-6:]) == "eraser":
            del listn[-6:]
            continue
        elif "".join(listn[-7:]) == "dreamer":
            del listn[-7:]
            continue
        else:
            print("NO")
            exit()            
    elif last_letter == "m":
        if "".join(listn[-5:]) == "dream":
            del listn[-5:]
            continue
        else:
            print("NO")
            exit()   
    elif last_letter == "e":
        if "".join(listn[-5:]) == "erase":
            del listn[-5:]
            continue
        else:
            print("NO")
            exit()   
    else:
        print("NO")
        exit()
print("YES")

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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

#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
//#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
ll ceil(ll a,ll b){
    return ((a+b-1)/b);
}
const int INF = 1000000000;
const ll INF64 = 9223372036854775807ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
//mapは、if関数などで覗いただけで構成されるので注意しよう！
int main(){
    int n;
    std::cin >> n;
    VEC(int,a,n);
    sort(all(a));
    int ma=a[n-1];
    //a.pop_back();
    int d=*lb(all(a),(ma+1)/2);
    int dd=*(lb(all(a),(ma+1)/2)-1);
    if(d==a[n-1])d=a[n-2];
    if(abs(ma/2-d)<=abs(ma/2-dd)){
        ppri(ma,d);
    }
    else ppri(ma,dd);
}

Measured memory_bytes: 640
#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <numeric>
#include <bitset>
#include <cassert>
#include <random>
#include <unordered_set>
#include <unordered_map>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

int32_t main() {
	ios::sync_with_stdio(0), cin.tie(0);
	string s;
	cin >> s;
	int n = sz(s);
	const int inf = 1e9 + 228;
	vector<vi> dp(2, vi(n, -inf));
	vector<vi> pre(2, vi(n, -1));
	const string kek = "PD";
	map<char, int> re;
	re['P'] = 0;
	re['D'] = 1;
	if (s[0] == '?') {
		dp[0][0] = 0;
		dp[1][0] = 1;
	}
	else {
		dp[re[s[0]]][0] = re[s[0]];
	}
	for (int i = 1; i < n; i++) {
		for (int cur = 0; cur < 2; cur++) {
			if (s[i] != '?' && cur != re[s[i]]) {
				continue;
			}
			for (int p = 0; p < 2; p++) {
				if (dp[p][i - 1] == -inf) {
					continue;
				}
				int stonks = dp[p][i - 1] + cur + (!p) * cur;
				if (stonks > dp[cur][i]) {
					dp[cur][i] = stonks;
					pre[cur][i] = p;
				}
			}
		}
	}
	string t;
	int pos = n - 1;
	int cur = 0;
	if (dp[1][n - 1] > dp[0][n - 1]) {
		cur = 1;
	}
	while (pos >= 0) {
		t.pb(kek[cur]);
		cur = pre[cur][pos];
		pos--;
	}
	reverse(all(t));
	cout << t;
}


Measured memory_bytes: 7372
#include <iostream>
using namespace std;
int main ()
{
    int a, b, c, x;
    cin >> a>> b >>c;
    if (a>b) {
        x=a;
        a=b;
        b=x;
    }
       if(b > c){
      x = b;
      b = c;
      c = x;

   }
   
   if(a > b){
      x = a;
      a = b;
      b = x;
      
   }
   
   cout << a << " " << b << " " << c << endl;
   
   return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }

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

	string s, t; cin >> s >> t;
	t.pop_back();
	if (s == t) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define INF (1ll<<60)
#define mod 1000000007
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
 
int main(){
	ll n;cin>>n;
	vector<ll> a(n);
	rep(i,n) cin>>a[i];
	vector<ll> candiv(1000010,0); 
	sort(a.begin(),a.end());
 
	ll ans=0;
	for(ll i=0;i<n;i++){
		for(ll j=a[i];j<=a[n-1];j+=a[i]){
			candiv[j]++;
		}
	}

	rep(i,n){
		if(candiv[a[i]]==1) ans++;
	}
 
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 12684
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<(int)(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;

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

  int n;
  cin >> n;
  vi p(n);
  rep(i ,n)cin >>p[i];

  int cnt=0;
  rep(i, n-2){
    if(p[i]==max(p[i], max(p[i+1], p[i+2]))&&p[i+2]==min(p[i], min(p[i+1], p[i+2])))cnt++;
    if(p[i+2]==max(p[i], max(p[i+1], p[i+2]))&&p[i]==min(p[i], min(p[i+1], p[i+2])))cnt++;
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<algorithm>

using namespace std;

int main() {
	int n, d[100000];
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &d[i]);
	}
	sort(d, d + n);
	printf("%d\n", d[n / 2] - d[n / 2 - 1]);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

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

signed main() {
  int n;
  cin >> n;
  
  int s = 0;
  rep(i,n) {
    int j = i + 1;
    s += j * (n/j) * (n/j + 1) / 2;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3144
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
int main(void)
{
    ll x;
    cin>>x;

    ll  now =100;

    ll ans = 0;


    while(now<x)
    {
        now *=1.01;
        ans ++;
    }
    
    cout<<ans<<endl;
}

Measured memory_bytes: 3160
#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>

using namespace std;
const int LEN = 1e4 + 10;
int A[LEN];

int main() {
    int N, M, sum = 0;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> A[i];
        sum += A[i];
    }
    if (sum > N) {
        cout << -1 << endl;
    } else {
        cout << N - sum << endl;
    }
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
int solve(vector<int> X, vector<int> &R) {
	int N = X.size();
	R.resize(N);
	R.back() = 0;
	int last = N - 1;
	for (int i = N - 2; i >= 0; i--) {
		R[i] = R[i + 1];
		for (int j = i + 1; j <= last; j++) {
			if (X[j - 1] <= X[j])break;
			if (j == last) {

				while (X[j - 1] > X[j]) {
					X[j] *= 4;
					R[i] += 2 * (N - j);
				}
				last = i;
				break;
			}
			while (X[j - 1] > X[j]) {
				X[j] *= 4;
				R[i] += 2;
			}
		}
	}
	
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	vector<int> R;
	vector<int> L;
	solve(A, R);
	vector<int> B = A;
	/*for (int i = 0; i < N; i++) {
		B[i] *= 2;
	}*/
	reverse(B.begin(), B.end());
	solve(B, L);
	reverse(L.begin(), L.end());
	int res = (int)1 << 60;
	
	res = R[0];
	for (int i = 1; i < N; i++) {
		res = min(res, i + L[i - 1] + R[i]);
	}
	res = min(res, N + L[N - 1]);

	cout << res << endl;
}

Measured memory_bytes: 8164
#include<stdio.h>
#include<stdlib.h>
#include<stack>
#include<queue>
#include<vector>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define F(i,L,R) for(int i=L;i<R;i++)
#define FE(i,L,R) for(int i=L;i<=R;i++)
#define RF(i,l,r) for(int i=r;i>l;i--)
#define RFE(i,l,r) for(int i=r;i>=l;i--)
#define getI(i) scanf("%d",&i)
#define getII(i,j) scanf("%d%d",&i,&j)
#define getIII(i,j,k) scanf("%d%d%d",&i,&j,&k)
#define VgetI(i) int (i);scanf("%d",&(i));
#define VgetII(i,j) int (i),(j);scanf("%d%d",&(i),&(j));
#define VgetIII(i,j,k) int (i),(j),(k);scanf("%d",&(i),&(j),&(k));
#define EoF(n) int(n);while(~getI(n))
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define abs(n) (n>0?n:(-n))
#define INF 2147483647
#define nINF -2147483648
int main(){
	VgetI(n);
	long long card[n],sum[n],min=1000000000000000;
	F(i,0,n) scanf("%lld",&card[i]);
	sum[0]=card[0];
	F(i,1,n) sum[i]=sum[i-1]+card[i];
	F(i,1,n-1){
		long long val=sum[i]-(sum[n-1]-sum[i]);
		val>0?val=val:val=-val;
		if(val<min) min=val;
	}
	if(n==2) min=card[0]-card[1]>0?card[0]-card[1]:card[1]-card[0];
	printf("%lld\n",min);
}


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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const ll mod = 1e9 + 7;


int main(){

  ll s;cin>>s;
  ll v=10e8;

  ll x=(v-s%v)%v;
	ll y=(s+x)/v;

	cout<<"0 0 "<<v<<" 1 "<<x<<" "<<y<<endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.D
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (A, B, N) = Read3Longs();

            if (A == 1 || B == 1) return 0;
            if (B - 1 <= N) return GetFloorResult(A, B, B - 1);
            return GetFloorResult(A, B, N);
            var l = 1L;
            var r = N;
            var lF = GetFloorResult(A, B, l);
            var rF = GetFloorResult(A, B, r);
            var max = Math.Max(lF, rF);
            while (true)
            {

            }

            return max;
        }

        private static long GetFloorResult(long A, long B, long x)
        {
            return (long)Math.Floor((double)A * x / B) - A * (long)Math.Floor((double)x / B);
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 28204
//FIRST THINK THEN CODE.

  #include <bits/stdc++.h>


  using namespace std;

  typedef long long ll;

  #define rep(i,a,b) for(ll i=a;i<b;++i)
  #define rrep(i,a,b) for(ll i=a;i>b;--i)
  #define FOR(i,n)  for(ll i=0;i<n;i++)
  #define vi vector<int>
  #define vl vector<ll>
  #define ld long double
  #define vld vector<ld>
  #define vvi vector<vector<int>>
  #define vvl vector<vector<long long>>
  #define vvld vector<vector<ld>>
  #define pii pair<int,int>
  #define pll pair<long,long>
  #define vpii vector<pii>
  #define vpll vector<pll>
  #define ff first
  #define ss second
  #define pb push_back
  #define pf push_front
  #define mp make_pair
  #define lb lower_bound
  #define ub upper_bound
  #define bs binary_search
  #define d1(x) cout<<(x)<<endl
  #define d2(x,y) cout<<(x)<<" "<<(y)<<endl
  #define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
  #define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
  #define PI 3.1415926535897932384626433832795
  #define fix(f,n) fixed<<setprecision(n)<<f
  #define all(x) x.begin(),x.end()
  #define rev(p) reverse(p.begin(),p.end());
  #define endl "\n"
  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  #define popcount(x) __builtin_popcountll(x)
  #define sz(x) ((ll)x.size())
  const ll M=1000000007;
  const ll MM=998244353;
  ll begtime = clock();
  #define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
  //#define _Find_next 
  //#define _Find_first 



  ll newmod(ll a,ll b)
  {
  return ((a%b)+b)%b;
  }


  ll powM(ll a,ll b,ll m )
  { 
  if(a<=0)return 0;
  a%=m;
  if(!b)return 1;
  ll ans=1LL;
  while(b)
  {
  if(b&1)ans=ans*a%m;
  a=a*a%m;
  b>>=1;
  }

  return ans;
  }



  ll poww(ll a,ll b)
  { 

  ll ans=1;
  while(b)
  {
  if(b&1)ans=ans*a;
  a=a*a;
  b>>=1;
  }

  return ans;

  }

  template<typename T,typename F>
  void chmax( T &a,F b){
  if(b>a)a=b;
  }

  template<typename T,typename F>
  void chmin( T &a,F b){
  if(b<a)a=b;
  }



  const ll N=1e5+5;



  int main()
  { 

  IOS;

ll n;cin>>n;

vl a(n);
FOR(i,n)cin>>a[i];

ll s=0;

for(int i=0;i<n-1;i++){
if(a[i]>a[i+1]){
  s+=a[i]-a[i+1];
  a[i+1]=a[i];
}
}
cout<<s;

  return 0;

  }

Measured memory_bytes: 4824
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;

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

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

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

  if(s[0] != s[1] || s[1] != s[2]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
  }

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    char a, b, c;
    int A, B, C;
    scanf("%c%c%c" , &a , &b, &c);
    A = a - '0';
    B = b - '0';
    C = c - '0';
    printf("%d\n", A + B + C);
    return 0;
}


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

int main(){

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);

	int cnt=0 ,n;

	cin>>n;
	string s;
	cin>>s;

	int i=0;
	while( s.find("ABC",i) != string::npos ){
		cnt++;
		i = s.find("ABC",i) + 1;
	}

	cout<<cnt;
	cout<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
 
 
 
 
 
 
typedef long long ll;
#define INF 1LL<<60
ll count(vector<ll> A) {
    int n = A.size();
    ll ans = 0;
    while (1) {
        ll mi = INF, ma = 0;
        rep(i, 0, n) {
            mi = min(mi, A[i]);
            ma = max(ma, A[i]);
        }
 
        if (ma < n) return ans;
 
        if (n <= mi) {
            ll d = mi - n + 1;
            ans += 1LL * d * n;
            rep(i, 0, n) A[i] -= d;
        } else {
            ll d = ma / n;
            ans += d;
            int id = -1;
            rep(i, 0, n) if (A[i] == ma) id = i;
            rep(i, 0, n) {
                if (i == id) A[i] -= d * n;
                else A[i] += d;
            }
        }
    }
}
//---------------------------------------------------------------------------------------------------
void _main() {
    int N; cin >> N;

    vector<ll> A;
    rep(i, 0, N) {
        ll x; cin >> x; A.push_back(x);
    }

    ll ans = count(A);
    cout << ans << endl;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        x: i64
    };
    let min_a = -118;
    let max_a = 119;
    for a in min_a..=max_a {
        for b in min_a - 1..=max_a - 1 {
            if a * a * a * a * a - b * b * b * b * b == x {
                println!("{} {}", a, b);
                return;
            }
        }
    }
}


Measured memory_bytes: 2060
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
    int u, v, i = 0;
    char c=getchar_unlocked();
    while(c<='9'&&c>='0') {i=(i<<1)+(i<<3)+c-'0'; c=getchar_unlocked();}
    long n = i + 1, ans = i;
    while(--i)
    {
        u = v ^= v;
        c=getchar_unlocked();
        while(c<='9'&&c>='0') {u=(u<<1)+(u<<3)+c-'0'; c=getchar_unlocked();}
        c=getchar_unlocked();
        while(c<='9'&&c>='0') {v=(v<<1)+(v<<3)+c-'0'; c=getchar_unlocked();}
        switch(u > v)
        {
            case 1: ans += i * (n - i) - v * (n - u); break;
            default: ans += i * (n - i) - u * (n - v);
        }
    }
    printf("%ld", ans);
    exit(0);
}


Measured memory_bytes: 1592
//Coded by tzc_wk
/*
数据不清空，爆零两行泪。
多测不读完，爆零两行泪。
边界不特判，爆零两行泪。
贪心不证明，爆零两行泪。
D P 顺序错，爆零两行泪。
大小少等号，爆零两行泪。
变量不统一，爆零两行泪。
越界不判断，爆零两行泪。
调试不注释，爆零两行泪。
溢出不 l l，爆零两行泪。
忘文件操作，爆零两行泪。
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y_chenxiaoyan_1
#define y0			y_chenxiaoyan_0
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
int a[2],b[2];
signed main(){
	int cur=1;
	cin>>a[1]>>b[1]>>a[0]>>b[0];
	while(1){
		if(a[cur^1]-b[cur]<=0){
			if(cur==1)	puts("Yes");
			else		puts("No");
			break;
		}
		a[cur^1]-=b[cur];
		cur^=1;
	}
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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; }

int main(){
	int n;cin>>n;
	vector<int> b(n);
	vector<int> ans(n);
	for(int i = 0; i < n; i++) {
		cin>>b[i];b[i]--;
	}
	for(int i = 0; i < n; i++) {
		int x = -1;
		for(int j = 0; j < b.size(); j++) {
			if (b[b.size() - j - 1] == b.size() - j - 1){
				x = b.size() - 1 - j;
				b.erase(b.begin() + b.size() - j - 1);
				break;
			}
		}
		if (x == -1){
			cout << x << endl;
			return 0;
		}
		ans[n - i - 1] = x;
	}
	for(int i = 0; i < n; i++) {
		cout << ans[i] + 1 << endl;
	}



	return 0;
}

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

int main(){
  int N, X;
  cin >> N >> X;
  vector<int> mapp(N);
  for(int i=0; i<N; i++){
    int x;
    cin >> x;
    mapp.at(i)=abs(x-X);
  }
  int r;
  for(int i=1; i<N; i++){
    if(mapp.at(0)>mapp.at(i)){
      int tmp=mapp.at(i);
      mapp.at(i)=mapp.at(0);
      mapp.at(0)=tmp;
    }
    r=mapp.at(i)%mapp.at(0);
    while(r!=0){
      mapp.at(i)=mapp.at(0);
      mapp.at(0)=r;
      r=mapp.at(i)%mapp.at(0);
    }
  }
  cout << mapp.at(0) << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main() {
	int n, m;
	unsigned long long ans = 0;
	cin >> n >> m;
	vector<int> a(n);
	vector<pair<int, int>> p(m);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		ans += a[i];
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < m; ++i)
		cin >> p[i].second >> p[i].first;
	sort(p.begin(), p.end());
	for (int i = 0; i < n; ++i) {
		if (p.empty()) break;
		if (a[i] < p.back().first) {
			ans += p.back().first - a[i];
			p.back().second--;
		}
		else break;
		if (!p.back().second) p.pop_back();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
    char S[6];
    scanf("%s", S);

    if (S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
struct revran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { --i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr revran(const i64 e) noexcept: b(0), e(e) {}
  constexpr revran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(e - 1); }
  constexpr iter end() const noexcept { return iter(b - 1); }
};

struct ran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { ++i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr ran(const i64 e) noexcept: b(0), e(e) {}
  constexpr ran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(b); }
  constexpr iter end() const noexcept { return iter(e); }
  constexpr revran rev() const noexcept { return revran(b, e); }
};

constexpr ran rin(const i64 e) noexcept { return ran(1, e + 1); }
constexpr ran rin(const i64 b, const i64 e) noexcept { return ran(b, e + 1); }

#include <vector>
#include <set>
using namespace std;

struct union_find {
  vector<int> par;
  vector<int> rank;
  union_find(int n) : par(n) , rank(n) {
    for(int i = 0;i < n;i++) par[i] = i;
  }
  int root(int i) {
    return par[i] == i ? i : par[i] = root(par[i]);
  }
  pair<int,int> unite(int x,int y) {
    x = root(x);
    y = root(y);
    if(x == y) return pair<int,int>(-1,-1);
    if(rank[x] < rank[y]) {
      par[x] = y;
      return {y , x};
    }
    else {
      par[y] = x;
      if(rank[x] == rank[y]) rank[x]++;
      return {x,y};
    }
  }
  bool same(int x,int y) {
    return root(x) == root(y);
  }
};

int main() {
  map<i64, i64> xm, ym;
  i64 N;
  cin >> N;
  vector<i64> tag(N);
  vector<i64> X, Y;
  i64 t = 1;
  union_find uf(N + 1);
  for(int i = 0;i < N;i++) {
    i64 x, y;
    cin >> x >> y;
    X.push_back(x);
    Y.push_back(y);
    i64 a = xm[x];
    i64 b = ym[y];
    a = uf.root(a);
    b = uf.root(b);
    if(a == 0 && b == 0) {
      xm[x] = t;
      ym[y] = t;
      tag[i] = t;
      t++;
    }
    else if(a == 0) {
      xm[x] = b;
      tag[i] = b;
    }
    else if(b == 0) {
      ym[y] = a;
      tag[i] = a;
    }
    else {
      uf.unite(a, b);
      tag[i] = a;
    }
  }

  vector<i64> ss(t, 0);
  vector<set<i64>> Xs(t);
  vector<set<i64>> Ys(t);


  for(int i = 0;i < N;i++) {
    i64 x = X[i];
    i64 y = Y[i];
    i64 ta = uf.root(tag[i]);
    ss[ta]++;
    Xs[ta].insert(x);
    Ys[ta].insert(y);
  }
  i64 sum = 0;
  for(int i = 1;i < t;i++) {
    i64 xx = Xs[i].size();
    i64 yy = Ys[i].size();
    sum += xx * yy - ss[i];
  }
  cout << sum << endl;
 }


Measured memory_bytes: 17768
#include<bits/stdc++.h>
using namespace std;
int c[100005],p[100005];
int main(){
    long long n,m,num1=0,num2=0;
    cin>>n>>m;
    for(long long i=1;i<=m;i++){
        long long x;string s;
        cin>>x>>s;
        if(c[x]) continue;
        if(s=="AC") c[x]++;
        if(s=="WA") p[x]++; 
    }
    for(int i=1;i<=n;i++){
        if(c[i]){
            num1++;
            num2+=p[i];
        }
    }
    cout<<num1<<" "<<num2<<endl;
}

Measured memory_bytes: 1024
open Batteries
open Printf

let scan fmt f =
  Scanf.sscanf (read_line ()) fmt f

let scan_list cnv =
  read_line ()
  |> BatString.split_on_char ' '
  |> List.map cnv

let id a = a
let tup2 a b = (a, b)
let tup3 a b c = (a, b, c)

let n = scan "%d" id
let an = scan_list int_of_string

let rec zip x y =
  match x with
  | [] -> []
  | a::xs ->
    match y with
    | [] -> []
    | b::ys -> (a, b) :: zip xs ys

let () =
  let l = List.sort compare an in
  zip l @@ List.tl l
  |> List.fold_left (fun b (x, y) -> if x = y then false else b ) true
  |> fun b -> printf @@ if b then "YES\n" else  "NO\n"


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

int gcd(int a, int b)
{
	if (a < b)
	{
		swap(a,b);
	}

	if (a % b == 0)
	{
		return b;
	}
	else
	{
		return(gcd(b,a%b));
	}
}

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

	cin >> N;

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

	int leftGcd[100000],rightGcd[100000];

	//左から添え字まで
	for (int i = 0; i < N; ++i)
	{
		if (i == 0)
		{
			leftGcd[i] = A[i];
		}
		else
		{
			leftGcd[i] = gcd(A[i],leftGcd[i-1]);
		}
	}

	//右から添え字まで
	for (int i = 0; i < N; ++i)
	{
		if (i == 0)
		{
			rightGcd[N-1-i] = A[N-1-i];
		}
		else
		{
			rightGcd[N-1-i] = gcd(A[N-1-i],rightGcd[N-i]);
		}
	}


	int temp;
	int ans = 0;
	for (int i = 0; i < N; ++i)
	{
		if (i == 0)
		{
			temp = rightGcd[1];
		}
		else if(i == N-1)
		{
			temp = leftGcd[N-2];
		}
		else
		{
			temp = gcd(leftGcd[i-1],rightGcd[i+1]);
		}

		ans = max(ans,temp);
	}

	int entireGcd = rightGcd[0];
	ans = max(entireGcd,ans);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
//#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define sll                     set<ll>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define umcl                    um<char,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif
}

int main()
{
	fastIO
	//inp_out();
	string s;
	cin>>s;
	ll flag=1;
	string temp=s;
	reverse(all(temp));
	if(s!=temp)
	{
		flag=0;
	}

	temp=s.substr(0,(ll)s.size()/2);
	string temp1=temp;

	reverse(all(temp1));
	if(temp!=temp1)
	{
		flag=0;
	}

	temp=s.substr((ll)s.size()/2+1,(ll)s.size()/2);

	temp1=temp;

	reverse(all(temp1));
	if(temp!=temp1)
	{
		flag=0;
	}

	cout<<(flag==0?"No":"Yes");
	return 0;
}



Measured memory_bytes: 256
const insertionSort = input => {
  let list = input
    .split("\n")[1]
    .split(" ")
    .map(x => parseInt(x));
  console.log(list.join(" "));

  for (let i = 1; i < list.length; i++) {
    let el = list[i];
    let j;

    for (j = i - 1; j >= 0 && list[j] > el; j--) {
      list[j + 1] = list[j];
    }
    list[j + 1] = el;
    console.log(list.join(" "));
  }
};

insertionSort(require("fs").readFileSync("/dev/stdin", "UTF-8"));



Measured memory_bytes: 16528
A,B,Q = map(int, input().split())
s = [-(10**11)]+[int(input()) for _ in range(A)]+[10**11]
t = [-(10**11)]+[int(input()) for _ in range(B)]+[10**11]
s.sort()
t.sort()

import bisect
import itertools
for _ in range(Q):
    pos = int(input())
    s_near_id = bisect.bisect_left(s, pos)-1
    t_near_id = bisect.bisect_left(t, pos)-1
    print(min( min(abs(pos-s_pos)+abs(s_pos-t_pos), abs(pos-t_pos)+abs(t_pos-s_pos)) for s_pos, t_pos in itertools.product(s[s_near_id:s_near_id+2],t[t_near_id:t_near_id+2]) ))


Measured memory_bytes: 12800
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_map>
# include <unordered_set>
# include <thread>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ui32 = unsigned int;
constexpr ll INFLL = 1e18;

#define CHECK_IMPL1(cond)              \
if (!(cond)) {                         \
    DEBUG("expected cond: " << #cond); \
    assert(cond);                      \
}

#define CHECK_IMPL2(cond, message)                                            \
if (!(cond)) {                                                                \
    DEBUG("expected cond: " << #cond << " failed with message: " << message); \
    assert(cond);                                                             \
}
#define CHECK_IMPL(_1, _2, NAME, ...) NAME
#define CHECK(...) CHECK_IMPL(__VA_ARGS__, CHECK_IMPL2, CHECK_IMPL1, CHECK_IMPL0)(__VA_ARGS__)

#ifdef __APPLE__
#define DEBUG(message) std::cerr << message << "\n";
#else
#define DEBUG(message)
#endif

int dfs(int v, const vector<vector<int>>& g) {
  vector<int> depths;
  for (auto u : g[v]) {
    depths.push_back(dfs(u, g));
  }
  sort(depths.begin(), depths.end());
  int mx = 0;
  for (int i = (int)depths.size() - 1; i >= 0; i--) {
    mx = max(mx, depths[i] + (int)depths.size() - i);
  }
  return mx;
}

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<vector<int>> g(n);
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    --a[i];
    g[a[i]].push_back(i);
  }
  cout << dfs(0, g) << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
#ifdef __APPLE__
  freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
#endif
  int t = 1;
//  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 13952
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long int ll;

long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

int main(){
	int n,k; cin >> n >> k;
	vector<int> a(n);
	int M=0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		M=max(a[i],M);
	}
	int m=a[0];
	for(int i=1;i<n;i++){
		m=GCD(m,a[i]);
	}
	for(int i=M;i>=0;i-=m){
		if(i==k){
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

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

int main(void){
  int quest;
  int *dat;
  int sum = 0;
  int min = 150;

  scanf("%d",&quest);

  dat = (int*)malloc(sizeof(int) * quest);
 
  int i;
  for(i = 0; i < quest;i++){
    scanf("%d",&dat[i]);
    sum += dat[i];
    if(dat[i] < min && dat[i] % 10 != 0){
      min = dat[i];
    }
  }
/*
  for(i = 0; i < quest;i++){
    printf("%d\n",dat[i]);
  }
*/
    if(sum % 10 == 0){
      if(min != 150){
        sum = sum - min;
        printf("%d",sum);
      }else{
         printf("0");
      }
    }else{
      printf("%d",sum);
    }
    


  free(dat);

  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC120B
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = ReadInt;
            var B = ReadInt;
            var K = ReadInt;

            int ans = 0;
            int count = 0;
            for (int i = 100; i > 0; i--)
            {
                if (A % i == 0 && B % i == 0) count++;
                if (count == K) { ans = i; break; }
            }

            Console.WriteLine(ans);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        static public void Draw2D(int[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            int[,] map2 = new int[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0;
                    else if (i == 0) map2[i, j] = j - 1;
                    else if (j == 0) map2[i, j] = i - 1;
                    else map2[i, j] = map[i - 1, j - 1];
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j] % 10);
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        static void Draw1D(int[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
lint N;
set<lint> SET;
vector<lint> ans;

void dfs( lint num ){
  if(num >= N){
    ans.push_back(num);
    return;
  }
  if(num == 0){
    for(auto value : SET){
      if(value != 0) dfs(10 * num + value);
    }
  }
  else{
    for(auto value : SET) dfs(10 * num + value);
  }
}

signed main(){
  cin >> N; 
  lint K; cin >> K;
  for(lint i = 0; i < 10; i++) SET.insert(i);
  for( lint i = 0; i < K; i++ ){
    lint x; cin >> x; SET.erase(x);
  }
  for( auto value : SET ) dfs(value);
  sort(ans.begin(), ans.end());
  cout << ans[0] << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>

using namespace std;

int N,K,S;

int MAX = 1000000000;

int out_num = 0;

void out(int x){
    if(out_num == 0){
        out_num = 1;
    }else{
        cout << " ";
    }

    cout << x;
}

int main(){
    int N;
    cin >> N >> K >> S;

    int x = S;
    int y = S + 1;

    if(x == MAX){
        y = 1;
    }

    for(int i=0;i<K;i++){
        out(x);
    }
    for(int i=0;i<N-K;i++){
        out(y);
    }

    return 0;
}


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

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

int main(){
    int n;
    int d[100005]={};
    scanf("%d",&n);
    REP(i,n)scanf("%d",&d[i]);

    int mat[100005]={};
    int max=0;
    REP(i,n){
        mat[d[i]]++;
        if(max<d[i])max=d[i];
    }
    ll ans=1;
    if(mat[0]!=1 || d[0]!=0){
        printf("0\n");
        return 0;
    }
    for(int i=1;i<max+1;i++){
        if(mat[i]==0){
            printf("0\n");
            return 0;
        }
        REP(j,mat[i])ans=ans*mat[i-1]%mod;
    }
    printf("%lld\n",ans);
    return 0;
}

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

int main()
{
  int64_t n, c, k ;
  cin >> n >> c >> k ;
  std::vector<int64_t> data(n) ;
  for(int i = 0 ; i < n ; i++)
  {
    cin >> data.at(i) ;
  }
  sort(data.begin(), data.end()) ;
  reverse(data.begin() , data.end()) ;

  int count = 0 ;
  int judge = 1 ;
  for(int i = 0 ; i < n; i++)
  {
    while(judge <= c)
    {
      if(judge == c || i + judge >= n)
      {
        i += judge - 1 ;
        judge = 1 ;
        count++ ;
        break ;
      }

      if(data.at(i) > data.at(i + judge) + k)
      {
        count++ ;
        i += judge - 1 ;
        judge = 1 ;
        break ;
      }
      judge++ ;
    }
  }

  cout << count << endl; 
}


Measured memory_bytes: 1024
#include <iostream>
#include <string> 
#include <iomanip>
#include <cstdio>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <queue>
using namespace std;






int main()
{
	int N, K;
	cin >> N >> K;

	long long count = 0;


	for (int b = K+1; b <= N;b++) {
		count += N / b *max(b - K, 0);
		count += max(0, N % b + 1 - K);
	}

	if (K == 0) {
		count -= N;
	}

	cout << count;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
h_list = list(map(int,input().split()))
count = 0
ans = 0
for i in range(0,n-1):
    if h_list[i] >= h_list[i+1]:
        count += 1
        #print(count)
    else:
        ans = max(ans,count)
        count = 0
ans = max(ans,count)
print(ans)


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

int dp[45][405][405];

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

void Main()
{
    arrayFill(dp, INF);
    int n = in(), ma = in(), mb = in();
    vint a(n), b(n), c(n);
    rep(i, n)
    {
        cin >> a[i] >> b[i] >> c[i];
    }

    dp[0][0][0] = 0;

    rep(i, n) rep(j, 402) rep(k, 402)
    {
        chmin(dp[i + 1][j][k], dp[i][j][k]);
        chmin(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
    }

    int ans = INF;
    REP(i, 1, 20)
    {
        if (ma * i >= 402 || mb * i >= 402)
            break;
        chmin(ans, dp[n][ma * i][mb * i]);
    }
    if (ans == INF)
        ans = -1;
    cout << ans << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 29184
a, b, c,d = map(int, input().split())
import math
min = int(c*d/math.gcd(c,d))
x = b-b//c - b//d + b//min
y = a-1-(a-1)//c - (a-1)//d + (a-1)//min

print(int(x-y))

Measured memory_bytes: 9040
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;


int main(){
    int N,a,b;
    cin >>N;

    vector <vector <int>> vec(N, vector<int>(2));
    for(int i = 0;i<N;i++)
    {
        cin >>vec.at(i).at(0) >>  vec.at(i).at(1);
    }

    int count = 0;

    for(int i = 0;i<N;i++)
    {
        if(vec.at(i).at(0) == vec.at(i).at(1))
        {
            count ++;
        }else
        {
            count =0;
        }

        if(count == 3)
        {
            cout << "Yes";
            return 0;
        }
    }

    cout << "No";
    return  0;
}

Measured memory_bytes: 3600
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}




int main(){
    ll n,l;
    cin>>n>>l;
    vector<ll> A(n,l);
    for(int i=1;i<n;i++){A[i]=A[i-1]+1;}
    ll sum=0;
    ll mi=E;
    for(auto &I:A){
        sum+=I;
        if(abs(mi)>abs(I)){
            mi=I;
        }
    }
    cout<<sum-mi<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
using namespace std;
int dtoi(char c) { // direction to index
    return c == 'N' ? 0 :
           c == 'S' ? 1 :
           c == 'E' ? 2 :
           c == 'W' ? 3 : -1;
}
int itoyl[] = { 1, -1, 1, -1 }; // direction index to difference of y of left edge
int itoxl[] = { -1, 1, 1, -1 };
int itoyr[] = { 1, -1, -1, 1 };
int itoxr[] = { 1, -1, 1, -1 };
int proj_ix(int y, int x, int h, int w) {
    if (x == 0) return y;
    if (y == h) return h + x;
    if (x == w) return h + w + (h-y);
    if (y == 0) return h + w + h + (w-x);
    return -1;
}
int proj(int y, int x, int dy, int dx, int h, int w) {
    while (proj_ix(y, x, h, w) == -1) {
        y += dy;
        x += dx;
    }
    return proj_ix(y, x, h, w);
}
bool proj_in(int i, int l, int r, int len) {
    if (l <= i and i <= r) return true;
    if (r < l and l <= i) return true;
    if (r < l and i <= r) return true;
    return false;
}
int greedy(int initial, int n, int len, vector<int> const & l, vector<int> const & r) {
    vector<pair<int,int> > intervals;
    repeat (i,n) {
        if (not proj_in(initial, l[i], r[i], len)) {
            intervals.push_back(make_pair((l[i] - initial + len) % len,
                                          (r[i] - initial + len) % len));
        }
    }
    sort(intervals.begin(), intervals.end());
    int result = 1 + not intervals.empty();
    int q = 1000000007;
    for (auto p : intervals) {
        if (q < p.first) {
            result += 1;
            q = p.second;
        } else {
            q = min(q, p.second);
        }
    }
    return result;
}
int main() {
    int n, w, h; cin >> n >> w >> h;
    vector<int> l(n), r(n); // [l, r]
    repeat (i,n) {
        int x, y; char c; cin >> x >> y >> c;
        int d = dtoi(c);
        l[i] = proj(y, x, itoyl[d], itoxl[d], h, w);
        r[i] = proj(y, x, itoyr[d], itoxr[d], h, w);
    }
    int result = 1000000007;
    repeat (i,n) {
        result = min(result, greedy(l[i],n,2*(w+h),l,r));
        result = min(result, greedy(r[i],n,2*(w+h),l,r));
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3112