akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define ll long long int
#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1e9
#define MOD 1e9 + 7
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mt make_tuple
#define fi first
#define se second
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define sum(v) accumulate(all(v), 0)
#define cinv(v, n) rep(i, n) cin >> v[i]
#define prec(n) fixed << setprecision(n)
#define odd(n) ((n) % 2)
#define even(n) (!((n) % 2))
#define main int main()
#define die return 0

using namespace std;

main {
  int a, b;
  cin >> a >> b;
  if (0 <= a) {
    cout << "Positive" << endl;
    die;
  }
  if (a < 0 && 0 <= b) {
    cout << "Zero" << endl;
    die;
  }
  cout << (odd(b - a) ? "Positive" : "Negative") << endl;
  die;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    if (c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

int main()
{
    int a, b;
    cin >> a >> b;
    ((a + b) % 2 == 0) ? (cout << ((a + b) / 2) << endl) : (cout << "IMPOSSIBLE" << endl);
}


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


struct vertex {
	string name;
	int sc;
	int id;
};
const int maxn = 120;
vertex arr[maxn];


bool cmp(const vertex& a, const vertex& b) {
	if (a.name == b.name) return a.sc > b.sc;
	return a.name < b.name;
}

int main() {
	int N;
	cin >> N;
	for (int cas = 0; cas < N; cas++) {
		cin >> arr[cas].name >> arr[cas].sc;
		arr[cas].id = cas + 1;
	}
	sort(arr, arr + N,cmp);
	for (int i = 0; i < N; i++) {
		cout << arr[i].id << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
 
using namespace std;
 
bool is_prime(int n, int k = 3)
{
    if(n < k * k) { return true; }
     
    if(n % k == 0) { return false; }
     
    return is_prime(n, k + 2);
}
 
int main()
{
    vector<int> prime = {2};
     
    for(int i = 3; i < 101300; i += 2)
    {
        if(is_prime(i))
        {
            prime.push_back(i);
        }
    }
     
    int n, m;
     
    while(true)
    {
        scanf("%d", &n);
        scanf("%d", &m);
         
        if(n == -1 && m == -1) { break; }
         
        int ptr = distance(prime.begin(), lower_bound(prime.begin(), prime.end(), n + 1));
         
        vector<int> c; int r = min(50, m) - 1;
        
        for(int i = ptr + r; i >= ptr; i--)
        {
            for(int j = ptr + r; j >= i; j--)
            {
                c.push_back(prime[i] + prime[j]);
            }
        }
        
        sort(c.begin(), c.end());
         
        printf("%d\n", c[m - 1]);
    }
     
    return 0;
}

Measured memory_bytes: 3364
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
LL a[101010], b[101010];

int main(){
    cin >> n;
    REP(i, n + 1)cin >> a[i];
    REP(i, n)cin >> b[i];
    LL ans = 0;
    REP(i, n){
        if(a[i] <= b[i]){
            ans += a[i];
            b[i] -= a[i];
            a[i] = 0;
            if(a[i + 1] <= b[i]){
                ans += a[i + 1];
                b[i] -= a[i + 1];
                a[i + 1] = 0;
            }else{
                ans += b[i];
                a[i + 1] -= b[i];
                b[i] = 0;
            }
        }else{
            ans += b[i];
            a[i] -= b[i];
            b[i] = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sync ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD  1000000007 
int powm(int base,int exp,int mod=MOD) {int ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
int32_t main()
{
  	sync
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	//bigger number on right side
	int ans=0;
	int count=1;
	for(int i=0;i<n;i++)
	{
		if(a[i]==count)
		{
			count++;
			ans++;
		}
	}
	if(ans == 0)
		cout<<"-1"<<endl;
	else
		cout<<n-ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#define PI 3.141592
using namespace std;

int main() {
int a,b,c,tyo=0,hishi=0;
char d,e;
while(cin>>a>>d>>b>>e>>c){
	if(a*a+b*b==c*c){
		tyo=tyo+1;
	}
	if(a==b){
		hishi=hishi+1;
	}
}
cout<<tyo<<endl;
cout<<hishi<<endl;
}

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

using namespace std;
#define int long long


signed main(){
    int N;
    string S;
    cin >> N >> S;
    
    int x = 0;
    int mx = 0;
    for(int i=0;i<S.length();i++){
        if(S[i] == 'I'){
            x++;
            mx = max(x,mx);
        }else{
            x--;
            mx = max(x,mx);
        }
    }
    cout << mx << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

string s;
string t;

int main(void) {
  cin >> s >> t;
  int n = s.size();
  int n2 = t.size();
  string res = "~";
  REP(i, n-n2+1) {
    bool possible = true;
    REP(ii, n2) {
      if(s[i+ii] != '?' && s[i+ii] != t[ii]) {
        // cerr << "> " << i << " " << ii << endl;
        possible = false;
        break;
      }
    }
    if(possible) {
      string tmp = s;
      REP(ii, n2) {
        tmp[i+ii] = t[ii];
      }
      REP(i, n) {
        if(tmp[i] == '?') {
          tmp[i] = 'a';
        }
      }
      if(tmp < res) {
        res = tmp;
      }
    }
  }
  if(res == "~") {
    cout << "UNRESTORABLE" << endl;
  } else {
    cout << res << endl;
  }
  
  return 0;
}


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

int main(void){
	int cou = 0, mount[10];
	
	for(int i = 0; i < 10; i++){
		cin >>mount[i];
	}
	
	while(cou < 9){
		for(int i = cou; i < 10; i++){
			if(mount[cou] < mount[i]) swap(mount[cou], mount[i]);
		}
		cou++;
	}
	
	for(int i = 0; i < 3; i++){
		cout <<mount[i]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
# coding: utf-8
# Your code here!
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))

S = sum(A)
A.sort(reverse= True )

flag = 1
for i in range(M):
    if A[i] < S/(4*M) :
        flag = 0

if flag == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> t(N+1), x(N+1), y(N+1);
	t[0] = 0;
	x[0] = 0;
	y[0] = 0;
	for (int i = 1; i < N+1; i++)
		cin >> t[i] >> x[i] >> y[i]; 
	for (int i = 0; i < N; i++)
	{
		int dt = t[i + 1] - t[i];
		int dx = abs(x[i + 1] - x[i]);
		int dy = abs(y[i + 1] - y[i]);
		if (dt<dx+dy || (dt%2)!=((dx+dy)%2))
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int a,b,c,k;

int32_t main()
{
    IOS
    cin>>a>>b>>c>>k;
    if (k<=a) cout<<k<<endl;
    else if (k<=a+b) cout<<a<<endl;
    else cout<<a-(k-a-b)<<endl;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
ll rand_int(ll l, ll r) //[l, r]
{
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
    return uniform_int_distribution<ll>(l, r)(gen);
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
int a[105];
ll dp[105][5];
int k;
ll dfs(int pos,int cnt,bool limit=1)
{
    if(pos==-1) return cnt==k;
    if(cnt>k) return 0;
    if(!limit&&dp[pos][cnt]!=-1) return dp[pos][cnt];
    int up=limit?a[pos]:9;
    ll ret=0;
    for(int i=0;i<=up;i++)
        ret+=dfs(pos-1,cnt+(i!=0),limit&&i==up);
    if(!limit) dp[pos][cnt]=ret;
    return ret;
}
ll solve(string s)
{
    int pos=0;
    for(int i=s.length()-1;i>=0;i--)
        a[pos++]=s[i]-'0';
    return dfs(pos-1,0);
}
int main()
{
    memset(dp,-1,sizeof(dp));
    string n;
    cin>>n>>k;
    cout<<solve(n)<<'\n';
}

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

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

    int A, B;
    A = 0;
    B = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') A++;
        else B++;
    }

    if (A > B) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
using namespace std;

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

	int cnt=0;
	int cnt2=0;
	for(int i=0;i<a.size();i++){
		if(a[i]=='C'){
			cnt++;
		}
		if(cnt>=1){
			if(a[i]=='F'){
				cnt2++;
				break;
			}
		}
	}
	if(cnt>=1&&cnt2==1){
		cout<<"Yes"<<endl;
	}
	else {
		cout<<"No"<<endl;
	}
	return 0;
}
	






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e9;

signed main() {
    int N;
    cin >> N;

    vi arr;
    arr.pb(1); arr.pb(6); arr.pb(9);
    int t = 6;
    while(t*6 <= N) {
        t *= 6;
        arr.pb(t);
    }
    t = 9;
    while(t*9 <= N) {
        t *= 9;
        arr.pb(t);
    }
    SORT(arr);

    vi dp(2*N+50, INF);
    dp[0] = 0;

    rep(i, N) {
        rep(j, arr.size()) {
            dp[i+arr[j]] = min(dp[i+arr[j]], dp[i]+1);
        }
    }

    cout << dp[N] << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{ int n;
  cin>>n;
  int h[n],dp[n];
  for(int i=0;i<n;i++)cin>>h[i];
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  int s,t;
  for(int i=2;i<n;i++)
  {
  	s=dp[i-2]+abs(h[i]-h[i-2]);
  	t=dp[i-1]+abs(h[i]-h[i-1]);
  	dp[i]=min(s,t);
  }
  cout<<dp[n-1];
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,k,n) for (ll i = k; i < n; ++i)
#define inputar(a,n) ll a[n];rep(i,0,n)cin>>a[i]
#define PI 3.14159265
const int MOD=1e9+7;
const int N=2e5+10;


#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a)  (a).begin(),(a).end()


#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    for (int i = 2; i < n; i++) 
        if (n % i == 0) 
            return false; 
  
    return true; 
} 
int binomialCoeff(int n, int k)  
{
    if (k == 0 || k == n)  
        return 1;  

    return binomialCoeff(n - 1, k - 1) +  
                binomialCoeff(n - 1, k);  
}  
long long power(ll a, ll b)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%MOD;
        b/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

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

vector<int>v[N];
ll sum[N];

void dfs(int n,int vis)
{
    for(int i=0;i<v[n].size();i++)
    {
        if(v[n][i]!=vis)
        {
            sum[v[n][i]]+=sum[n];
            dfs(v[n][i],n);
        }
    }
}


int main()
{
    IOS;
    string s,t;
    cin>>s;
    cin>>t;
    int c=0;
    for(int i=0;i<3;i++)
    {
        if(s[i]==t[i]) c++;
    }
    cout<<c<<endl;

}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(t) (t).begin(),(t).end()
typedef long long ll;

int main() {
  int Ans=0;
  int N; cin>>N;
  vector<int> a(N);
  REP(i,N){
    cin>>a.at(i);
    a.at(i)--;
  }
  REP(i,N){
    if (i==a.at(a.at(i)))  Ans++;
  }
  cout << Ans/2 << '\n';
  return 0;
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define INF 10000000
int dp(int i,int cnt);
int h,w;
int c[19][19];
int a[209][209];
int memo[19][19];

int main(){
  memset(memo,-1,sizeof(memo));
  cin>>h>>w;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      cin>>c[i][j];
    }
  }

  int ans=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a[i][j];
      if(a[i][j]>=0){
	ans+=dp(a[i][j],0);
      }
    }
  }

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

int dp(int i,int cnt){
  int rec=INF;
  if(memo[i][cnt]!=-1)return memo[i][cnt];
  if(i==1)return 0;
  if(cnt>9)return INF;
  for(int j=0;j<10;j++){
    rec=min(rec,dp(j,cnt+1)+c[i][j]);
  }
  return memo[i][cnt]=rec;
}


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

int main(){
string s;
int JOI=0,IOI=0,l;
while(cin>>s){JOI=0; IOI=0;
l=s.size();
for(int i=0;i<l;i++){
if(s[i]=='J'&&s[i+1]=='O'&&s[i+2]=='I')JOI++;
if(s[i]=='I'&&s[i+1]=='O'&&s[i+2]=='I')IOI++;}
cout<<JOI<<endl<<IOI<<endl;
s="";
}}

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

using namespace std;

vector<string> s;
vector<vector<char> > ss;
int N;
int a[100000][26];

int main(){
    cin >> N;
    s.resize(N);
    ss.resize(N);
    for(int i=0;i<N;i++) ss[i].resize(10);
    for(int i=0;i<N;i++) cin >> s[i];
    for(int i=0;i<N;i++){
        const char* cc = s[i].c_str();
        for(int j=0;j<10;j++){
            ss[i][j] = cc[j];
        }
        sort(ss[i].begin(),ss[i].end());
    }
    sort(ss.begin(),ss.end());
    long long count = 0;
    bool flag;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            flag = true;
            for(int k=0;k<10;k++){
                if(ss[i][k] != ss[j][k]){
                    flag = false;
                    break;
                }
            }
            if(!flag){
                if(j==i+1) break;
                long long n = j-i-1;
                count += (n*(n+1))/2;
                i = j-1;
                break;
            }
            if(j == N-1){
                long long n = j-i;
                count += (n*(n+1))/2;
                i = j-1;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 12800
n = int(input())
s = input()

r = s.count("R")
g = s.count("G")
b = n - r - g

rest = 0
for gap in range(1, n//2 +1):
    for i in range(n-2):
        try:
            arr = sorted([s[i],s[i+gap],s[i+gap*2]])
            if arr == ["B","G","R"] : rest += 1
        except: continue

ans = r*g*b - rest
print(ans)


Measured memory_bytes: 69132
Scanf.sscanf (read_line ()) "%d %d" (fun h w ->
    let a = Array.init h (fun _ -> Bytes.of_string @@ read_line ()) in
    let rec loop_y y acc =
        let rec loop_x x acc =
            if x < 0 then acc else loop_x (x - 1) (if Bytes.get a.(y) x = '#' then (x, y) :: acc else acc)
        in
        if y < 0 then acc else loop_y (y - 1) (loop_x (w - 1) acc)
    in

    let rec bfs step next = function
        | [] -> if next = [] then step - 1 else bfs (step + 1) [] next
        | (x, y) :: tl ->
                let next = if x > 0     && Bytes.get a.(y) (x - 1) = '.' then (Bytes.set a.(y) (x - 1) '#'; (x - 1, y) :: next) else next in
                let next = if y > 0     && Bytes.get a.(y - 1) (x) = '.' then (Bytes.set a.(y - 1) (x) '#'; (x, y - 1) :: next) else next in
                let next = if x < w - 1 && Bytes.get a.(y) (x + 1) = '.' then (Bytes.set a.(y) (x + 1) '#'; (x + 1, y) :: next) else next in
                let next = if y < h - 1 && Bytes.get a.(y + 1) (x) = '.' then (Bytes.set a.(y + 1) (x) '#'; (x, y + 1) :: next) else next in
                bfs step next tl
    in
    bfs 1 [] (loop_y (h - 1) []) |> Printf.printf "%d\n"
)


Measured memory_bytes: 54524
#include<bits/stdc++.h> 
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,0x3f,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define MEMx(a,b) memset(a,b,sizeof(a));
#define INF (0x3f3f3f3f)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
#define gmax(a,b) a=max(a,b);
#define gmin(a,b) a=min(a,b);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
	while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
	return x*f;
} 
int main()
{
//	freopen("B.in","r",stdin);
//	freopen(".out","w",stdout);
	int n,m,k;
	cin>>n>>m>>k;
	
	Rep(i,n+1) Rep(j,m+1) {
		if (i*j+(n-i)*(m-j)==k) {
		cout<<"Yes"<<endl;
			return 0;
		}
	}
		cout<<"No";cout<<endl;	
	
	
	return 0;
}


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

#define 	ll 						long long int
#define 	pb 						push_back
#define 	mp 						make_pair
#define 	fast 					ios_base::sync_with_stdio(false);cin.tie(NULL);
#define 	ff 						first
#define 	ss 						second
#define 	nil 					-10e+9
#define 	initial 				0
#define 	waiting 				1
#define 	visit 					2
#define 	inf  					10e+9
#define 	mx   					200005
#define 	mxx  					1000005
#define 	mod  					1000000007
#define 	pr   					pair<ll,ll>
#define 	pp_queue 			priority_queue<pr,vector<pr>, greater<pr> >
#define 	dp_queue 			priority_queue<int,vector<int>, greater<int> >
#define 	sp_queue 			priority_queue<int>
#define 	fr(i,p,q)			for(int i=p;i<q;++i)
#define 	frr(i,p,q) 		for(int i=p;i<=q;++i)
#define 	mem(a,b) 			memset(a,b,sizeof(a))
#define 	len(a)   			(int)a.size()
#define 	input  				freopen("input.txt", "r", stdin);
#define 	output 				freopen("output.txt", "w", stdout);
#define 	debug(arr,j,n) fr(i,j,n) cout<<arr[i]<<" ";

ll power(ll a,ll b){ll aa=1;while(b){if(b&1){aa=aa*a;aa%=mod;}a=a*a;a%=mod;b/=2;}return aa;}

using namespace std;

int main()
{
  int n,k,q;
	cin>>n>>k>>q;

  unordered_map<int,int> mpp;

	fr(i,0,q){
		int x;
		cin>>x;
		mpp[x]++;
	}

	fr(i,1,n+1){
		int x=k-q+mpp[i];

		if(x>0) cout<<"Yes\n";
		else
		cout<<"No\n";
	}
  return 0;
}


Measured memory_bytes: 4772
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	while(true) {
		int x, y;
		cin>>x>>y;
		if(x == 0 && y == 0) break;
		if(x > y) swap(x, y);
		cout<<x<<" "<<y<<endl;
	}
}

Measured memory_bytes: 3060
void main() {
    dchar[] s = readln.chomp.to!(dchar[]);
    dchar[] t = readln.chomp.to!(dchar[]);
    s.sort!"a < b";
    t.sort!"a > b";
    writeln(s < t ? "Yes" : "No");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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];
    }
    ll counter=0;
    REP(i,n){
        if(a[i] == counter+1){
            counter += 1;
        }
    }
    if(counter == 0){
        cout << -1 << endl;
    }
    else{
        cout << n - counter << endl;
    }
}

Measured memory_bytes: 1792
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		String S = s.next();
		long target = Long.valueOf(S);
		long result = target;
		
		for(int i = 1; i < (1<<(S.length() - 1)); i++) {
			long tmp = target;
			int keta = 1;
			for(int j = 0; j < S.length(); j++) {
				if(((i>>j)&1) == 1) {
					result += tmp%(Math.pow(10, keta));
					tmp /= Math.pow(10, keta);
					keta = 1;
				}else {
					keta++;
				}
			}
			result += tmp%(Math.pow(10, keta));
			
		}
		
		System.out.println(result);
    }
}


Measured memory_bytes: 21844
import itertools

N, M = map(int, input().split())
ab = [[int(i) for i in input().split()] for j in range(M)]

G = [[] for i in range(N)]
for i in range(M):
    a, b = ab[i]
    G[a-1].append(b-1)
    G[b-1].append(a-1)

ls = [i for i in range(1, N)]
ans = 0
for route in itertools.permutations(ls, N-1):
    pre = 0
    for i in range(N-1):
        next_v = route[i]
        if next_v not in G[pre]:
            break
        pre = next_v
    else: ans += 1

print(ans)

Measured memory_bytes: 3064
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int  num = Integer.parseInt(br.readLine());
	String s = br.readLine();
	int left = 0;
	for (int i = 0; i < num; i++) {
	    if(s.charAt(i) == '(') left++;
	    else left--;
	    if (left < 0) {
		s = "(" + s;
		num++;
		i++;
		left++;
	    }
	}
	for (int i = left ; i > 0; i--) {
	    s = s + ")";
	}
	System.out.println(s);
    }
}


Measured memory_bytes: 21460
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    m = N // 2
    dp = [defaultdict(lambda: -INF)] * 2
    dp[0][0] = 0
    for i, a in enumerate(A):
        ndp = [defaultdict(lambda: -INF)] * 2
        l = m - ((N-i) // 2)
        ndp[0] = dp[1]
        for k, v in dp[0].items():
            if k+1 >= l:
                ndp[1][k+1] = max(ndp[1][k+1], v+a)
            if k+2 >= l:
                ndp[0][k] = max(ndp[0][k], v)
        dp = ndp
    return max(dp[0][m], dp[1][m])


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))

if __name__ == '__main__':
    main()


Measured memory_bytes: 117792
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <cmath>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define INF 1000000000+10
using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	int a[100000+10];
	int b[100000+10];
	memset(b, 0, sizeof(b));
	FOR(i, 1, n+1) scanf("%d", a+i);
	int k = 1;
	int ans = 0;
	while(k != 2){
		b[k] = 1;
		k = a[k];
		if(b[k]) {cout << "-1" << endl; return 0;}
		ans ++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
s = input()

a = -1
z = -1
for i in range(0, len(s)):
   if (a < 0 and s[i] == 'A'):
      a = i
   elif (s[i] == 'Z'):
      z = i

if (a >= 0 and z >= 0):
   print(z - a + 1)
else:
   print(0)


Measured memory_bytes: 3516
#define  _USE_MATH_DEFINES

#define  rep(i, n) for(int i = 0; i < n; i++)
#define  repx(i, a, n) for(int i = a; i < n; i++)
#define  loop while(1)
#define  lli long long int
 
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <utility>
#include <set>

using namespace std;
  
int main() {
  
  //Initialize
  int h, w;
  cin >> h >> w;
  
  vector<string> grid(h, string());
  rep (i, h) cin >> grid[i];
  
  //Look horizontally
  rep (i, h) {
    int cnt = 0;
    rep (j, w) if (grid[i][j] == '#') cnt += 1;
    if (cnt == 0) rep (j, w) grid[i][j] = 'x';
  } 
  
  //Look vertically
  rep (i, w) {
    int cnt = 0;
    rep (j, h) if (grid[j][i] == '#') cnt += 1;
    if (cnt == 0) rep (j, h) grid[j][i] = 'x';
  }   
  
  //Output
  rep (i, h) {
    int cnt = 0;
    rep (j, w) {
      if (grid[i][j] != 'x') {
        cout << grid[i][j];
        cnt += 1;
      }
    }
    if (cnt > 0) cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int par[100010];
int depth[100010];
void init(int n){
  for(int i=0;i<=n;i++){
      par[i]=i;
      depth[i]=0;
  }
}
int root(int x){
  return par[x]==x?x:par[x]=root(par[x]);
}
bool same(int x,int y){
  return root(x)==root(y);
}
void unite(int x,int y){
  x=root(x);
  y=root(y);
  if(x==y)return;
  if(depth[x]<depth[y]){
      par[x]=y;
  }else{
      par[y]=x;
      if(depth[x]==depth[y])depth[x]++;
  }
}
int main(){
    string s;cin>>s;
    string t="";
    rep(i,s.size()){
        if(s[i]!='x')t+=s[i];
    }
    string rt=t;
    reverse(all(rt));
    if(rt==t){
        ll cnt=0;
        int l=0,r=s.size()-1;
        while(r-l>0){
            if(s[l]==s[r]){
                l++,r--;
            }else if(s[l]=='x'){
                cnt++;
                l++;
            }else if(s[r]=='x'){
                cnt++;
                r--;
            }
        }
        cout<<cnt<<endl;
    }else{
        cout<<-1<<endl;
    }
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
class Program
{
 static void Main(string[] args)
 {
  List<int> A = new List<int>();
  int N = int.Parse(Console.ReadLine()); string[] S = Console.ReadLine().Split(' ');
  for (int i = 0; i < N; i++) { A.Add(int.Parse(S[i])); }
  int R = 0; for (int i = 0; i < N; i++) { int Y = A[i]; while (Y % 2 == 0) { Y /= 2; R += 1; } }
  Console.WriteLine(R.ToString());
 }
}


Measured memory_bytes: 13920
import java.util.Arrays;
import java.util.Scanner;

// ref https://atcoder.jp/contests/abc143/submissions/8034843
public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); // num-city
    int M = sc.nextInt(); // num-load
    int L = sc.nextInt(); // litter
    int[] A = new int[M]; // city1
    int[] B = new int[M]; // city2
    int[] C = new int[M]; // distance
    for (int i = 0; i < M; i++) {
      A[i] = sc.nextInt();
      B[i] = sc.nextInt();
      C[i] = sc.nextInt();
    }
    int Q = sc.nextInt();

    long[][] fuel = new long[N + 1][N + 1];
    long[][] dist = new long[N + 1][N + 1];
    long LARGE_VAL_L = Long.MAX_VALUE / 4;
    for (int i = 0; i <= N; i++) {
      Arrays.fill(fuel[i], LARGE_VAL_L);
      Arrays.fill(dist[i], LARGE_VAL_L);
      fuel[i][i] = 0;
      dist[i][i] = 0;
    }
    for (int i = 0; i < M; i++) {
      fuel[A[i]][B[i]] = C[i];
      fuel[B[i]][A[i]] = C[i];
    }
    for (int k = 1; k <= N; k++) {
      for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
          fuel[i][j] = Math.min(fuel[i][j], fuel[i][k] + fuel[k][j]);
        }
      }
    }

    for (int i = 1; i <= N; i++) {
      for (int j = 1; j <= N; j++) {
        if (fuel[i][j] <= L) {
          dist[i][j] = 1;
        }
      }
    }
    for (int k = 1; k <= N; k++) {
      for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
          dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);
        }
      }
    }

    while (Q-- > 0) {
      int s = sc.nextInt();
      int t = sc.nextInt();
      if (dist[s][t] == LARGE_VAL_L) {
        System.out.println(-1);
        continue;
      }
      System.out.println(dist[s][t] - 1);
    }
  }
}


Measured memory_bytes: 88776
#include <bits/stdc++.h>
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
typedef long long ll;

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

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

  vector<ll> L(M), R(M);
  for(int i=0; i<M; i++)
    cin >> L[i] >> R[i];

  sort(L.begin(), L.end());
  reverse(L.begin(), L.end());
  
  sort(R.begin(), R.end());
  //reverse(R.begin(), R.end());
  
  ll count=0;
  for(ll i=L[0]; i<=N && i<=R[0]; i++)
    count++;
  
  cout << count << endl;
  


  return 0;
}


//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N), cnt(N);
  for (int &x: A) {
    std::cin >> x;
    --x;
    ++cnt[x];
  }
  long long sum = 0;
  for (int i: range(0, N)) {
    sum += (long long) cnt[i] * (cnt[i] - 1) / 2;
  }
  for (int i: range(0, N)) {
    int tmp = cnt[A[i]];
    std::cout << sum - (long long) tmp * (tmp - 1) / 2 + (long long) (tmp - 1) * (tmp - 2) / 2 << '\n';
  }
  return 0;
}


Measured memory_bytes: 4096
#include "bits/stdc++.h"
using namespace std;
typedef  long long ll;
const int MAX_N=2e5+1,OO=0x3f3f3f3f;
int main(){
 int x,y; cin>>x>>y;
 for(int i=0;i<=y;i+=2){
     for(int j=0;j<=y;j+=4){
         if(i+j==y&&i/2+j/4==x)
             return cout<<"Yes",0;
     }
 }
 cout<<"No";
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
long long a[200010];
int main()
{
    int n;
    while(cin>>n)
    {
        long long s=0,b,sum=0;
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
            a[i]=a[i]-i;
            s+=a[i];
        }
        sort(a+1,a+n+1);
        b=a[n/2+1];
        for(int i=1;i<=n;i++)
            sum+=abs(a[i]-b);
        cout<<sum<<endl;
    }
    return 0;
}


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

typedef struct shirakami {
    ll pos, c, x;
} fbk;

int main(){
    ll n, q;
    cin >> n >> q;
    vector<fbk> a(2*n);
    rep(i, 0, n){
        ll s, t, x;
        cin >> s >> t >> x;
        a[2*i] = {s-x, 1, x};
        a[2*i+1] = {t-x, 0, x};
    }
    vector<ll> d(q);
    rep(i, 0, q) cin >> d[i];
    sort(a.begin(), a.end(), [](fbk lhs, fbk rhs) {
        return (lhs.pos < rhs.pos);
    });
    ll k = 0;
    multiset<ll> st;
    rep(i, 0, q) {
        for(; k < 2*n && a[k].pos <= d[i]; k++) {
            if(a[k].c) st.insert(a[k].x);
            else st.erase(st.find(a[k].x)); 
        }
        if(st.empty()) cout << -1 << endl;
        else cout << *st.begin() << endl;
    }
    return 0;
}

Measured memory_bytes: 17924
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


#A
def A():
    a,b = LI()
    if not (a*b)%2:
        print("Even")
    else:
        print("Odd")
    return

#B
def B():
    s = S()
    print(s.count("1"))
    return

#C
def C():
    n = I()
    a = LI()
    f = 0
    for j in range(100000):
        for i in range(n):
            if a[i]%2:
                f = 1
                break
            a[i] //= 2
        if f:break
    print(j)
    return

#D
def D():
    a,b,c,x = IR(4)
    su = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                if 500*i+100*j+50*k == x:su += 1
    print(su)
    return

#E
def E():
    n,y = LI()
    for i in range(n+1):
        for j in range(n+1-i):
            k = n-i-j
            if 10000*i+5000*j+1000*k == y:
                print(i,j,k)
                quit()
    print(-1,-1,-1)
    return

#F
def F():
    s = input()
    while s:
        if s[:11] == "dreameraser":
            s = s[11:]
        elif s[:10] == "dreamerase":
            s = s[10:]
        elif s[:7] == "dreamer":
            s = s[7:]
        elif s[:6] == "eraser":
            s = s[6:]
        elif s[:5] == "dream":
            s = s[5:]
        elif s[:5] == "erase":
            s = s[5:]
        else:
            print("NO")
            quit()
    print("YES")
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    F()


Measured memory_bytes: 135596
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=3.1415926535897932384626433832795;
const ll INF = 1LL<<62;
const ll MINF = -1LL<<62;

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


int main() {
	IO;
	ll n,cnt;
	cin>>n;
	ll ans=0;
	cnt=1;
	while(n>0) {
		n/=2;
		ans+=cnt;
		cnt*=2;
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ll long long
#define MOD 1000000007
#define MAX 100010
#define aout(a) REP(i,sizeof(a)) cout << a[i] << " "; cout << endl;
#define vout(v) REP(i,v,size()) cout << v[i] << " "; cout << endl;
using namespace std;
using Graph = vector<vector<int>>;
#define PI 3.1415926535897932384
 
int main(){
  double a,b,h; cin>>a>>b>>h;
  double m; cin>>m;
  double shi1,shi2;
  double hh = h + (m / 60);
  shi1 = 360 * hh / 12;
  shi2 = 360 * m / 60;
  double shi = abs(shi1 - shi2);
  if(shi > 180) shi = 360-shi;
  double ans = a*a + b*b - 2*a*b*cos(2*PI*shi/360);
  cout << fixed << setprecision(11) << sqrt(ans);
}

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

typedef long long ll;

int main(){
 ll H,W;
 cin >> H >> W;

 if(H == 1 || W == 1){
 cout << 1 << endl;
 } else {
 cout << (H * W + 1) / 2 << endl;
 }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,mx;
map<string,int>mp;
string s;
int main(){
	cin>>n;
	while(n--)cin>>s,mp[s]++;
	for(map<string,int>::iterator i=mp.begin();i!=mp.end();i++)mx=max(mx,i->second);
	for(map<string,int>::iterator i=mp.begin();i!=mp.end();i++)if(mx==i->second)cout<<i->first<<endl;
	return 0;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <numeric>
using namespace std;

int main(){
	int x, y;
	cin >> x >> y;
	int ans = 0;
	if(x == 1){
		ans += 300000;
	}else if(x == 2){
		ans += 200000;
	}else if(x == 3){
		ans += 100000;
	}
	if(y == 1){
		ans += 300000;
	}else if(y == 2){
		ans += 200000;
	}else if(y == 3){
		ans += 100000;
	}
	if(x == 1 && y == 1){
		ans += 400000;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double pi = Math.PI;
        double area = pi * r * r;
        double length = 2 * pi * r;
        System.out.printf("%f %f",area,length);
        sc.close();
    }
}


Measured memory_bytes: 28408
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int n,s; cin >> n >> s;
    vector<vector<int> > ki(n);
    map<P,int> m;
    rep(i,s){
        int l,r,d; cin >> l >> r >> d;
        l--; r--;
        ki[l].push_back(r);
        ki[r].push_back(l);
        m[P(l,r)]=d;
        m[P(r,l)]=-d;
    }

    vector<int> value(n,INF);
    queue<P> q;

    rep(i,n){
        if(value[i]!=INF) continue;
        q.emplace(i,-1);
        value[i]=0;
        while(!q.empty()){
            int now=q.front().first;
            int par=q.front().second;
            q.pop();
            for(int x : ki[now]){
                if(x==par) continue;
                if(value[x]==INF){
                    value[x]=value[now]+m[P(now,x)];
                    q.emplace(x,now);
                }
                if(value[x]!=value[now]+m[P(now,x)]){
                    cout << "No" << endl;
                    return 0;
                }
            }
        } 
    }

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

Measured memory_bytes: 35496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846
#define fi first
#define se second

ll mod = 1e9+7;

ll max(ll a, ll b ) {
	if(a>b)
		return a;
	else return b;
}
ll min(ll a, ll b ) {
	if(a<b)
		return a;
	else return b;
}

int main() {
	ll ttt;
	//cin>>ttt;
	ttt = 1;
	while(ttt--) {
		ll n,k; cin>>n>>k;
		ll p[n], c[n];
		ll mmax = -1e10;
		for(int i=0; i<n; i++) {ll x; cin>>x; x--; p[i] = x; }
		for(int i=0; i<n; i++) { cin>>c[i]; mmax = max(mmax,c[i]); }
		ll ans = mmax;

		for(int i=0; i<n; i++) {
			int vis[n];
			for(int i=0; i<n; i++) vis[i] = 0;
			ll turn = 0, r=i , sum = 0;
			while(turn < k && vis[r]==0) {
				vis[r] = 1;
				ll ccy = r;
				r = p[ccy];
				sum += c[r];
				ans = max(sum,ans);
				turn++;
			}
			if(turn < k && sum >= 0) {
				ll rem = k - turn;
				ll rrr = rem/turn;
				ll test = rem%turn;
ll temp = rrr*sum;
				sum += rrr*sum;
				ans = max(ans,sum);
      
				for(int i=0; i<n; i++) vis[i] = 0;
				r = i;
				turn = 0;
				while(turn < test && vis[r]==0) {
					vis[r] = 1;
					ll vvp = r;
					r = p[vvp];
					sum += c[r];
					ans = max(sum,ans);
					turn++;
				}	
for(int i=0; i<n; i++) vis[i] = 0;
				r = i;
				turn = 0;
    
				while(turn < n && vis[r]==0) {
					vis[r] = 1;
					ll vvp = r;
					r = p[vvp];
					temp+= c[r];
					ans = max(temp,ans);
					turn++;
				}	

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



Measured memory_bytes: 3676
#include<bits/stdc++.h>
#define ll  long long
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;

int main(){

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

   if(n==0){
       cout << m*(m-1)/2;
   }else{

       if(m==1)cout << (n*(n-1)/2);
       else
       cout << (m*(m-1)/2) + (n*(n-1)/2);
   }

}


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

#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define debug(x) cerr << #x << " = " << x << endl;
#define SET(c, v) memset(c, v, sizeof c)
#define pi 3.14159265358979323846264338
#define all(S) (S).begin(), (S).end()
#define INF 0x3f3f3f3f
#define mod 1000000007
#define pf push_front
#define pb push_back
#define mk make_pair
#define MAX 100000
#define MA1 10000

#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef unsigned long long int ull;
int v[MAX], pd[MAX], N;

int solve(int i) {
	int &ans = pd[i];
	if(i == N-1) return 0;
	if(i >= N) return 1 << 30;
	if(ans != -1) return ans;
	return ans = min(solve(i+1) + abs(v[i] - v[i+1]), solve(i+2) + abs(v[i] - v[i+2]));
}

int main(int argc, char** argv) {
	scanf("%d", &N);
	rep(i, 0, N) scanf("%d", &v[i]);
	memset(pd, -1, sizeof pd);
	printf("%d\n", solve(0));
	return 0;
}


Measured memory_bytes: 2560