akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stack>
using namespace std;

int main(){
	int n,a,flag;
	stack<int> b,c;
	cin >> n;
	for (int i = 0; i < n; i++){
		while (b.size()) b.pop();
		while (c.size()) c.pop();
		flag = 0;
		b.push(0);
		c.push(-1);
		for (int j = 0; j < 10; j++) {
			cin >> a;
			if (b.top() > c.top()){
				if (c.top() > a) flag = 1;
				else if (b.top() > a) c.push(a);
				else b.push(a);
			}
			else {
				if (b.top() > a) flag = 1;
				else if (c.top() > a) b.push(a);
				else c.push(a);
			}
		}
		if (flag) cout << "NO" << endl;
		else cout << "YES" << endl;
	}
}

Measured memory_bytes: 1192
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};

const int NMAX=200010; // we can calculate nCk until n is equal to NMAX
mint fact[NMAX],infac[NMAX];
void Make_Fact(){
  fact[0]=fact[1]=1;
  for(int i=2;i<=NMAX-1;++i){
    fact[i]=fact[i-1]*(mint)i;
  }
}
void Make_InvFact(){
  infac[0]=infac[1]=1;
  for(int i=2;i<=NMAX-1;++i){
    infac[i]=infac[i-1]/(mint)i;	
  }
}
mint Comb(int n,int k){
  if(n<0||k<0||n-k<0) return 0;
  return fact[n]*infac[k]*infac[n-k];
}



int main()
{
  int n; cin >> n;
  vector<int> a(n+1);
  rep(i,n+1) cin >> a[i];

  vector<int> st(n+1, 0);
  int piv;
  rep(i,n+1) {
    if(st[a[i]] == 1) piv = i;
    st[a[i]]++;
  }
  int m = n - piv;  
  rep(i,n+1) {
    if(st[a[i]] == 2) {
      piv = i;
      break;
    }
  }
  int k = piv;
  
  Make_Fact();
  Make_InvFact();
  rep1(i,n+1) {
    mint res = Comb(n+1, i) - Comb(k+m, i-1);
    cout << res.x << "\n";
  }
  
  
  return 0;
}


Measured memory_bytes: 5120
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const in inf=1e9+7;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};

//a^n (mod)
in modpow(in a, in n, in mod) {
    in res = 1ll;
    while (n > 0ll) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//ax+by=gcd(a,b)の解(x,y)を求める
//返り値はgcd(a,b)
//|x|<b ,|y|<aとなる解
in extgcd(in a,in b,in &x,in &y){
    in g=a;
    x=1,y=0;
    if(b!=0) g=extgcd(b,a%b,y,x),y-=(a/b)*x;
    return g;
}
// 1/n (mod)
in mod_inv(in n){
    in x,y,z;
    z=extgcd(n,MOD,x,y);
    x=(x%MOD+MOD)%MOD;
    return x;
}

in n;

in nC(in a){
    in ret=1ll;
    REP(i,1ll,a+1ll){
        ret *=mod_inv(i);
        ret %=MOD;
    }
    REP(i,n-a+1ll,n+1ll){
        ret *=i;
        ret %=MOD;
    }
    return ret;
}

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in a,b;
    cin>>n>>a>>b;
    in ans=modpow(2ll,n,MOD)-1ll;
    ans -=nC(a);
    ans =(ans+MOD)%MOD;
    ans -=nC(b);
    ans =(ans+MOD)%MOD;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
  vector<ll> A,B,C,D;
  ll N,T,sum=0,dsum=0;cin>>N;
  rep(i,N){
    cin >> T;
    A.push_back(T);
  }
  rep(i,N){
    cin >> T;
    B.push_back(T);
  }
  rep(i,N){
    cin >> T;
    C.push_back(T);
  }
  sort(ALL(A));
  sort(ALL(B));
  sort(ALL(C));
  for(int i=N-1;i>=0;i--){
    dsum+=C.end()-upper_bound(ALL(C),B[i]);
    D.push_back(dsum);
  }
  reverse(ALL(D));
  rep(i,N){
    sum+=D[upper_bound(ALL(B),A[i])-B.begin()];
  }
  cout << sum << endl;
}

Measured memory_bytes: 4084
#include <bits/stdc++.h>
#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 FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll N;
  cin >> N;
  ll A[N];
  REP(i, N) { cin >> A[i]; }
  sort(A, A + N);
  ll ans = 0;
  REP(i, N) {
    ll cnt = 0;
    while (A[i] == A[i + 1]) {
      cnt++;
      i++;
    }
    if (cnt % 2 == 0) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}

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

using ll = long long;

int main() {
    ll x, y;
    cin >> x >> y;

    ll ans = 1LL << 60;
    if (x <= y) {
        ans = min(ans, y - x);
    }
    if (x <= -y) {
        ans = min(ans, (-y - x) + 1);
    }
    if (-x <= y) {
        ans = min(ans, y + x + 1);
    }
    if (- x <= -y) {
        ans = min(ans, -y + x + 2);
    }

    cout << ans << endl;
}


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

int a,b,la,ra,lb,rb;

int main()
{
	cin >> a >> b;
	la = ceil(a*12.5);
	ra = ceil((a+1)*12.5);
	lb = b*10;
	rb = (b+1)*10;
	if(ra<=lb or la>=rb)cout << -1;
	else cout << max(la,lb);
	return 0;
}

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

#define fi first
#define se second

const int N = 100100;
const int Q = 1000100;
const int mod = 1e9 + 7;

using namespace std;

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

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        int n;
        cin >> n;
        long long res = 0;
        map < pair < int, int >, int > c;
        for(int i = 1; i <= n; i++){
                string s;
                cin >> s;
                long long x = 0;
                pair < int, int > A = {0, 0};
                bool shit = false;
                for(char c: s){
                        if(c == '.'){
                                shit = true;
                        } else{
                                x = x * 10 + c - '0';
                                if(shit){
                                        A.fi -= 1;
                                        A.se -= 1;
                                }
                        }
                }
                while(x % 2 == 0){
                        x /= 2;
                        A.fi += 1;
                }
                while(x % 5 == 0){
                        x /= 5;
                        A.se += 1;
                }
                c[A] += 1;
        }
        for(auto A: c){
                for(auto B: c){
                        if(A.fi == B.fi) continue;
                        if(A.fi.fi + B.fi.fi >= 0 && A.fi.se + B.fi.se >= 0){
                                res += 1ll * A.se * B.se;
                        }
                }
                if(A.fi.fi >= 0 && A.fi.se >= 0){
                        res += 1ll * A.se * (A.se - 1);
                }
        }
        cout << res / 2 << "\n";
}


Measured memory_bytes: 3612
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
int main(){
  int k,x;
    cin >> k >> x;
    if(k%x==0) cout << k/x << endl;
    else cout << (k/x)+1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int n, q;
string s;
vector<char> t, d;

void input()
{
    cin >> n >> q >> s;
    t.resize(q);
    d.resize(q);
    for (int i = 0; i < q; i++)
        cin >> t[i] >> d[i];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    int right = n-1;
    int left = 0; 
    for (int i = q - 1; i >= 0; i--)
    {
        if (left < n && d[i] == 'L' && t[i] == s[left])
            left++;
        if (left > 0 && d[i] == 'R' && t[i] == s[left - 1])
            left--;
        if (right >= 0 && d[i] == 'R' && t[i] == s[right])
            right--;
        if (right < n - 1 && d[i] == 'L' && t[i] == s[right + 1])
            right++;
    }
    cout << max(0, right - left + 1) << "\n";
}

Measured memory_bytes: 976
#include <bits/stdc++.h>
typedef long long int ll;
#define rep(i,n) for (int i = 0; i< (n); i++)
#define Rep(i,n,m) for (int i = (n); i< (m); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
using namespace std;


int main() {
    bool fl = false;
    string s, t;
    
    cin>>s;
    
    if(s[2]==s[3] && s[4]==s[5]) t = "Yes";
    
    else t = "No";
    
    cout<<t<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std; // 575
const int MAX = 100000;

int main() {
	int N, M, A, B;
	cin >> N >> M;
	static pair<int, vector<int>> node[MAX]; // 向かってくる辺の数、向かう辺の行き先
	for (int i = 0;i < N;++ i) node[i].first = 0;
	for (int i = 0;i < N + M - 1;++ i) {
		cin >> A >> B;
		node[A - 1].second.push_back(B - 1);
		++ node[B - 1].first;
	}
    static int search, ans[MAX];
	for (int i = 0;i < N;++ i) if (node[i].first == 0) search = i;
	queue<pair<int, int> > que; // 確定頂点とその親
	que.push(make_pair(search, 0));
	while(!que.empty()) {
		search = que.front().first;
		ans[search] = que.front().second;
		que.pop();
		for (int i = 0;i < node[search].second.size();++ i) if (-- node[node[search].second[i]].first <= 0) que.push(make_pair(node[search].second[i], search + 1));
	}
	for (int i = 0;i < N;++ i) cout << ans[i] << endl;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、必ず増えた辺は子孫に向かってる→ショートカットである
よって、とりあえず根はO(N)で確定、どれからも辺が来てないはず
すると次の辺はその根からのみ矢印が来てるのでやっぱ確定
以下同様

各頂点について
1. 繋がってる全ての辺を調べる O(N+M)
2. その辺は、確定親以外から辺が来てないか調べる O(N+M)
はい
*/

Measured memory_bytes: 7424
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)

















int main(){
    string s;
    cin >> s;
    if(s[0] == '7' || s[1] == '7' || s[2] == '7'){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+100;
const int maxc=26;
const int mod=998244353;
int C(int x){
    if(x<2)
        return 0;
    return x*(x-1)/2;
}
int main()
{
    int x,y;
    cin>>x>>y;
    ll sum=0;
    printf("%d",C(x)+C(y));
    return 0;
}
/*

*/


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

public class Main
{
    public  static  void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int total = sc.nextInt();
        int arr[] = new int[total];
        arr[0]= 0 ;

        for(int i=1;i<total;i++)
        {
            arr[i] = sc.nextInt();
        }
        int temp =0;
        //Arrays.sort(arr);
        int arrNew[] = new int[total];
        for(int i =1;i<total;i++)
        {
            arrNew[arr[i]-1] = arrNew[arr[i]-1]+1;
        }

        for(int i=0;i<total;i++)
        {
            System.out.println(arrNew[i]);
        }




    }
}


Measured memory_bytes: 69344
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000ll
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stuuu()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  
///////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n,x;
	cin>>n>>x;
	int ans=1;
	int pr=0;
	for(int i=0;i<n;++i)
	{
		int d;
		cin>>d;
		pr+=d;
		if(pr<=x)
			++ans;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int i,x,n;
	cin >> n >> x;
	int a[200010];
	if(x==1 || x==2*n-1){
		cout << "No" << endl;
	}else if(x==2 || x==2*n-2){
		for(i=0;i<2*n-1;i++){
			if((x+i)==2*n-1){
				a[(n-1+i)%(2*n-1)] = 2*n-1;
			}else{
				a[(n-1+i)%(2*n-1)] = (x+i)%(2*n-1);
			}
		}
		cout <<"Yes" << endl;
		for(i=0;i<2*n-1;i++){
			cout << a[i] << endl;
		}
	}else{
		for(i=0;i<2*n-1;i++){
			if((x+i)==2*n-1){
				a[(n-1+i)%(2*n-1)] = 2*n-1;
			}else{
				a[(n-1+i)%(2*n-1)] = (x+i)%(2*n-1);
			}
		}
		int y = a[n+1];
		a[n+1] = a[n-3];
		a[n-3] = y;
		cout << "Yes" << endl;
		for(i=0;i<2*n-1;i++){
			cout << a[i] << endl;
		}
	}
}
					


Measured memory_bytes: 2304
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   char a,b;
   cin >> a >> b;

   if(a<b) cout << "<" << endl;
   else if(a>b) cout << ">" << endl;
   else cout << "=" << endl;  



   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll W[100005], B[100005];
vvc<ll> G;

void dfs(ll now, ll p){
    repa(to,G[now]){
        if (to == p) continue;
        dfs(to, now);
    }
    (W[p] *= W[now] + B[now]) %= MOD;
    (B[p] *= W[now]) %= MOD;
}

int main() {
    init();
    ll N;
    cin >> N;
    G.resize(N);
    rep(i,N-1){
        ll a, b;
        cin >> a >> b;
        a--, b--;
        G[a].eb(b), G[b].eb(a);
    }

    fill(W, W + N, 1), fill(B, B + N, 1);
    dfs(0, -1);

    cout << (W[0] + B[0]) % MOD << endl;
}

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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

	lnt N, A[200000]; cin >> N;
	REP(i, N) cin >> A[i];
	sort(A, A+N);
	reverse(A, A+N);

	lnt ans = A[0];
	lnt nokori = N-2;
	RANGE(i, 1, N){
		ans += min(2ll, nokori) * A[i];
		nokori -= 2;
		if(nokori <= 0) break;
	}
	cout << ans << ln;
}

Measured memory_bytes: 5172
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        a, b, x = map(int, input().split())
        fa = (a - 1) // x + 1 if a - 1 >= 0 else 0
        fb = b // x + 1 if b >= 0 else 0
        print(fb - fa)


# Run main
if __name__ == '__main__':
    AtCoder().main()


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <string>
#include <array>

using namespace std;

int main(){
    string S, T; cin >> S >> T;
    array<int, 26> Scount, Tcount; Scount.fill(0), Tcount.fill(0);
    for (size_t i = 0; i < S.size(); i++) ++Scount[S[i]-'a'];
    for (size_t i = 0; i < T.size(); i++) ++Tcount[T[i]-'a'];
    sort(Scount.begin(), Scount.end()), sort(Tcount.begin(), Tcount.end());
    (Scount == Tcount) ? cout << "Yes" << endl : cout << "No"  << endl;
    return 0;
}


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

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

int L;
int from[66], to[66], cost[66];
int edgecnt;

int bitlen(int x) {
    int res = 0;
    while (x) {
        res++;
        x /= 2;
    }
    return res;
}

void e1(int N) {
    int k = 1;
    for (int i = N; i >= 3; --i) {
        from[edgecnt] = i - 1;
        to[edgecnt] = i;
        cost[edgecnt] = k;
        from[edgecnt + 1] = i - 1;
        to[edgecnt + 1] = i;
        cost[edgecnt + 1] = 0;
        k *= 2;
        edgecnt += 2;
    }
}

int leftbit(int x) {
    if (x == 0)return 0;
    int res = 1 << 30;
    while (res) {
        if (x & res)return res;
        res >>= 1;
    }
    return -1;
}

int e2(int x) {
    int res = 0;
    rep(res, 100) {
        if (x == (1 << res))return res;
    }
}

signed main() {
    cin >> L;
    int N = bitlen(L) + 1;
    e1(N);
    L ^= leftbit(L);
    int c = (1 << (N - 2));
    while (L) {
        int l = leftbit(L);
        L ^= l;
        from[edgecnt] = 1;
        to[edgecnt] = N - e2(l);
        cost[edgecnt] = c;
        c += l;
        edgecnt++;
    }
    rep(i, edgecnt) {
        if (from[i] > 1)from[i]--;
        if (to[i] > 1)to[i]--;
    }
    cout << N-1 << " " << edgecnt << endl;
    rep(i, edgecnt) {
        cout << from[i] << " " << to[i] << " " << cost[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)
 
a = s == s[::-1]
s1 = s[:(n-1)//2]
b = s1 == s1[::-1]
s2 = s[(n+3)//2 - 1:]
c = s2 == s2[::-1]
 
print(['No', 'Yes'][a and b and c])

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while ( sc.hasNext() ) {
			int n = sc.nextInt();
			System.out.println( solve(n) );
		}
	}

	public static int solve(int n) {
		int count = 0;

		for (int a=0; a < 10; a++) {
			for (int b=0; b < 10; b++) {
				for (int c=0; c < 10; c++) {
					for (int d=0; d < 10; d++) {
						if (a+b+c+d == n) count++;
					}
				}
			}
		}
		return count;
	}
}

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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		int N = nextInt();
		int K = nextInt();
		int X = nextInt();
		int Y = nextInt();

		long ans =Math.min(N,K)*X;
		N-=Math.min(N, K);
		ans+=N*Y;
		System.out.println(ans);

	}

	public static boolean isPalindromicStr(String s) {
		int h = 0;
		int t = s.length() - 1;
		while (h <= t) {
			if (s.charAt(h) != s.charAt(t)) {
				break;
			}
			h++;
			t--;
		}
		if (h > t) {
			return true;
		}
		return false;
	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21204
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;
 
template<typename T1, typename T2>
ostream& operator << (ostream& os, const pair<T1, T2>& p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}
 
template<typename T>
ostream& operator << (ostream& os, const vector<T>& v) {
    os << "{";
    for(int i = 0; i < v.size(); i++)
        os << v[i] << (i+1<v.size()?", ":"");
    os << "}";
    return os;
}
 
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }
 
void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
}
//}}}
 
int main(){
    iostream_init();
    int N, W, H;
    cin >> N >> W >> H;
    vector<pair<int, int>> xs(N);
    vector<pair<int, int>> ys(N);
    REP(i, N){
        int x, y, w;
        cin >> x >> y >> w;
        xs[i] = make_pair(2*x, 2*w);
        ys[i] = make_pair(2*y, 2*w);
    }
 
    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());
 
    bool ans = false;
    W *= 2;
    H *= 2;
    {
        int cur = 0;
        bool ok = true;
        REP(i, W+1) {
            while(cur < N && abs(xs[cur].first - i) > xs[cur].second) {
                cur++;
            }
            if(cur == N){
                ok = false;
                break;
            }
        }
        ans = ans || ok;
    }
    {
        int cur = 0;
        bool ok = true;
        REP(i, H+1) {
            while(cur < N && abs(ys[cur].first - i) > ys[cur].second) {
                cur++;
            }
            if(cur == N){
                ok = false;
                break;
            }
        }
        ans = ans || ok;
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}
 
/* vim:set foldmethod=marker: */

Measured memory_bytes: 2580
# -*- coding: utf-8 -*-
h = int(input())
w = int(input())
n = int(input())

ans = []
black = 0
if h >= w:
    for i in range(h * w):
        black = h * i
        if black >= n:
            ans.append(i)
    print(min(ans))
else:
    for i in range(h * w):
        black = w * i
        if black >= n:
            ans.append(i)
    print(min(ans))


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    cout << min(min(a + b, a + c), b + c) << endl;
    return 0;
}

Measured memory_bytes: 256
// God put a smile upon your face <3

#include <bits/stdc++.h>`

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

#define mod 958585860497

#define base 2001487

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

bool solve(ll n, ll m)
{
	if(m & 1) return 0;

	if(m < (2 * n)) return 0;

	if(m > (4 * n)) return 0;

	return 1;
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n >> m)
    {
		if(solve(n,m)) printf("Yes\n");
		else printf("No\n");
    }


}



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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, m;
	cin >> n >> m;
	bool like[m];
	rep(i, m) like[i] = true;
	
	rep(i, n) {
		int k;
		cin >> k;
		bool a[m];
		rep(i, m) a[i] = false;
		rep(j, k) {
			int num;
			cin >> num;
			num--;
			a[num] = true;
		}
		rep(i, m) like[i] = like[i] and a[i];
	}
	
	int cnt = 0;
	rep(i, m) {
		if (like[i]) cnt++;
	}
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

vector<int> G[1010];
ll x[1010];
ll sum[1010] = {};

ll dfs1(int v, int p){
	sum[v] += x[v];
	REP(i, G[v].size()){
		if(G[v][i] == p) continue;
		sum[v] += dfs1(G[v][i], v);
	}
	return sum[v];
}

pair<ll, ll> dfs2(int v, int p){
	if(G[v].size() == 1 && p != -1){
		return {x[v], 0};
	}else if(G[v].size() == 0){
		return {x[v], 0};
	}
	vector<pair<ll, ll> > vs;
	REP(i, G[v].size()){
		if(G[v][i] == p) continue;
		vs.push_back(dfs2(G[v][i], v));
	}
	vector<ll> dp(5050, INF_LL);
	dp[0] = 0;
	REP(i, vs.size()){
		vector<ll> dp2(5050, INF_LL);
		REP(j, 5050){
			if(j >= vs[i].first)
				dp2[j] = min(dp2[j], dp[j-vs[i].first]+vs[i].second);
			if(j >= vs[i].second)
				dp2[j] = min(dp2[j], dp[j-vs[i].second]+vs[i].first);
		}
		dp = dp2;
	}

	ll ret = INF_LL;
	REP(i, dp.size()){
		if(i <= x[v])
			ret = min(ret, dp[i]);
	}
	if(ret == INF_LL)
		return {INF_LL, INF_LL};
	return {x[v], ret};
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	REP(i, N-1){
		int p;
		cin >> p;
		G[i+1].push_back(p-1);
		G[p-1].push_back(i+1);
	}
	REP(i, N){
		cin >> x[i];
	}

	dfs1(0, -1);
	pair<ll, ll> res = dfs2(0, -1);
	if(min(res.first, res.second) <= x[0]){
		cout << "POSSIBLE" << endl;
	}else{
		cout << "IMPOSSIBLE" << endl;
	}
}


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

int main() {
  int n, m, ml = 0, mr = INT_MAX;
  cin >> n >> m;
  vector<int> l(m), r(m);
  for(int i = 0; i < m; i++) {
    cin >> l.at(i) >> r.at(i);
    ml = max(ml, l.at(i));
    mr = min(mr, r.at(i));
  }
  cout << max(0, min(mr, n) - ml + 1) << endl;
}

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

int main()
{
    string youbi[] = {"MON","TUE","WED","THU","FRI","SAT","SUN"};
    string S;
    cin>>S;
    if(S=="SUN"){
        cout<<7<<endl;
        return 0;
    }
    for(int i=0; i<7; i++){
        if(youbi[i]==S){
            cout<<7-(i+1)<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A,B,K;
        A = sc.nextInt();
        B = sc.nextInt();
        K = sc.nextInt();
        int count = 0;
        for(int i = 0; i < K; i++){
            if(count%2 == 0){
                A /= 2;
                B += A;
            }else{
                B /= 2;
                A += B;
            }
            count++;
        }
        System.out.println(A);
        System.out.println(B);
    }
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int n; cin >> n;
  vector<int> l(n);
  for(int i = 0; i < n; i++) cin >> l[i];
  sort(l.rbegin(),l.rend());

  int ans = 0;
  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      auto f = [&](int mid){
        if(l[i] >= l[j] + l[mid]) return 1LL;
        return 0LL;
      };

      int left = j,right = n;
      while(right - left > 1){
        int mid = (left + right) / 2;

        if(f(mid)) right = mid;
        else left = mid;
      }
      ans += right - j - 1;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type point struct {
	x, y int
}
type byx []point

func (a byx) Len() int           { return len(a) }
func (a byx) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a byx) Less(i, j int) bool { return a[i].x < a[j].x }

func solve() {
	n := getInt()
	getPoints := func() []point {
		ret := make([]point, n)
		for i := range ret {
			ret[i].x = getInt()
			ret[i].y = getInt()
		}
		return ret
	}
	reds := getPoints()
	blues := getPoints()

	sort.Sort(byx(blues))

	ans := 0
	m := make(map[point]bool)
	for _, b := range blues {
		friend := -1
		now := -1
		for i, r := range reds {
			if b.x <= r.x || b.y <= r.y {
				continue
			} else if _, exist := m[r]; exist {
				continue
			}

			if now < r.y {
				now = r.y
				friend = i
			}
		}
		if friend == -1 {
			continue
		}
		ans++
		m[reds[friend]] = true
	}

	fmt.Fprintln(wr, ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


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

int main() {
  string s, a = "";
  cin >> s;

  for (int i = 0; i < s.size(); i++) {
    if (s[i] != 'B') {
      a.push_back(s[i]);
      continue;
    }
    if (a != "") a.pop_back();
  }
  cout << a << endl;
}


Measured memory_bytes: 256
/*PM 問題１０*/
#include <stdio.h>

int main()
{
	int i = 1;
	int x = 0;

	while (1)
	{
		scanf("%d", &x);
		if (x== 0) break;
		

		printf("Case %d: %d\n", i, x);
			i = i + 1;
	}
	return 0;
}



Measured memory_bytes: 2132
#include <iostream>
// #include <cassert>
#include <vector>
#include <algorithm>
#include <climits>

#include <stack>
#include <queue>
// #include <deque>
// #include <set>
// #include <map>
// #include <string>
// #include <unordered_set>
// #include <unordered_map>

#include <tuple>
// #include <cmath>
// #include <numeric>

using namespace std;


typedef long long ll;
typedef pair<long,long> pll;
typedef pair<int,int> pii;
typedef pair<int,long> pil;
typedef pair<long,int> pli;
typedef pair<long long, long long> pllll;
typedef pair<long long, int> plli;
typedef pair<int,long long> pill;
typedef vector<vector<long long>> vvll;
typedef vector<vector<long>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<long long> vll;

#define emplace_back pb
const char el = '\n';

/*
Edge cases:


*/

int leader[100001];
int rk[100001];
int numfriends[100001];
int ret[100001];

void compresspath(int i, int ileader) {
    int j = i;
    while (j!=ileader) {
        int temp = leader[j];
        leader[j] = ileader;
        j = temp;
    }
}

int getleader(int i) {
    int orig_i = i;
    while ( leader[i]!= i ) {
        i = leader[i];
    }
    compresspath(orig_i, i);
    return i;
}

void join(int i, int j) {
    int ileader = getleader(i);
    int jleader = getleader(j);

    if (ileader==jleader) return;
    
    if (rk[ileader]>=rk[jleader]) {
        leader[jleader]=ileader;
        

        rk[ileader] += rk[jleader];
        return;
    } else {
        leader[ileader] = jleader;
        rk[jleader] += rk[ileader];
    }
}

int getrank(int i) {
    return rk[getleader(i)];
}

int main() {
    // ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int n,m,k; cin>>n>>m>>k; cin.ignore();

    fill_n(rk,n+1,1);

    for (int i = 1; i<=n; ++i) {
        leader[i]=i;
    }


    for (int i = 0; i<m; ++i) {
        int u,v; cin>>u>>v;
        join(u,v);
        ++numfriends[u];
        ++numfriends[v];
    }


    for (int i=1; i<=n; ++i) {
        //its connected component size, minus itself, minus its friends;
        ret[i] = getrank(i);
        ret[i] -= (1+numfriends[i]);
    }

    for (int i = 0; i<k; ++i) {
        int u,v; cin>>u>>v;

        if (getleader(u)==getleader(v)) {

            --ret[u], --ret[v];
        }


    }

    for (int i =1; i<=n; ++i) {
        cout<<ret[i]<<" ";
    } cout<<el;









}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
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; }

const ll INF = 1e16;

int main(){
    int n;
    cin >> n;
    vector<ll> h(n);
    rep(i,n){
        cin >> h[i];
    }
    reverse(h.begin(),h.end());
    ll m=INF;
    rep(i,n){
        m=min(m,h[i]);
        if(h[i]-m>1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

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

  rep(i,0,s.size()-8){
    cout << s[i];
  }
  cout << endl;
  ret 0;
}

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

int main(int argc,char* argv[]){
  int N,sum=0;
  cin >> N;
  int d[N];
  for(int i=0;i<N;i++) cin >> d[i];
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      sum += d[i]*d[j];
    }
  }
  cout << sum << endl;
  return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    for(i = 1;i <= 9;++i){
        if(n%i == 0 && n/i <= 9){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 2*1e13;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,m;
ll a,b;

struct union_find{
    vector<int> par;
    int par_siz;
    union_find(int n) : par(n){
        par_siz = n;
        for(ll i=0;i<n;i++)par[i]=-1; //init
    }
    void clear(int n){
        par_siz = n;
        rep(i,n)par[i]=-1;
    }
    int root(int x){
        if(par[x]<0)return x;
        else return par[x] = root(par[x]);
    }
    void unite(int p1,int p2){
        int pa1 = root(p1),pa2 = root(p2);
        if(pa1==pa2)return;
        if(par[pa1]>par[pa2]){ // |pa1| < |pa2|
            par[pa2] += par[pa1];
            par[pa1] = pa2;
        }else{ // |pa1| >= |pa2|
            par[pa1] += par[pa2];
            par[pa2] = pa1;
        }
        par_siz--;
    }
    int size(int x){ return (-1)*par[root(x)]; }
    int par_size(){return par_siz;}
    bool same(int p1,int p2){ return root(p1) == root(p2); }
};

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n>>m;
    union_find uf(n);
    ll ans = 0;
    vector<PLL> p;
    rep(i,m){
        cin>>a>>b;
        p.pb(mp(a-1,b-1));
    }
    rep(i,m){
        uf.clear(n);
        rep(j,p.size()){
            if(i==j)continue;
            uf.unite(p[j].first,p[j].second);
        }
        if(uf.par_size()!=1)ans++;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
   
fn read<T: FromStr>() -> T {
	let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
	let n: u8 = read();
    let s: String = read();

	let result = s
		.chars()
		.map(|c| {
			let ascii_c: u8 = c as u8;
			let ascii_result: u8 = ascii_c + n;
			if ascii_result > 90 {
				return (ascii_result - 26) as char;
			}
			return ascii_result as char
		})
		.collect::<String>();

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


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int a[200010],f[200010],c[200010];
int n;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	f[0]=1;
	for (int i=1;i<=n;i++)
	{
		f[i]=f[i-1];
		if (c[a[i]]&&c[a[i]]!=i-1) f[i]=(f[i]+f[c[a[i]]])%mod;
		c[a[i]]=i; 
	}
	cout << f[n] << endl;
}

Measured memory_bytes: 2560
N=input()
s=input()
#ABCXYZ
L=[]
L.append('A')
L.append('B')
L.append('C')
L.append('D')
L.append('E')
L.append('F')
L.append('G')
L.append('H')
L.append('I')
L.append('J')
L.append('K')
L.append('L')
L.append('M')
L.append('N')
L.append('O')
L.append('P')
L.append('Q')
L.append('R')
L.append('S')
L.append('T')
L.append('U')
L.append('V')
L.append('W')
L.append('X')
L.append('Y')
L.append('Z')

answer=[]
for l in s:
  num=L.index(l)
  #print(type(num))
  #print(type(int(N)))
  newN=L.index(l)+int(N)
  n=newN%26
  answer.extend(L[n])  
  
answer="".join(answer)
print(answer)

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }

int main() {
  ll N, X, D; cin >> N >> X >> D;
  if (D<0) { X*=-1; D*=-1; }
  if (D==0) { 
    if (X==0) cout << 1 << endl;
    else cout << N+1 << endl; 
    return 0; 
  }

  ll g = min(N, D/gcd(abs(X),D));
  vector<p_ll> m[g]; m[0].push_back(make_pair(0,0));
  ll mi = 0, ma = 0;
  rep(i,N) {
    mi += X+D*i; ma += X+D*((N-1)-i);
    ll mod = (i+1)%g;
    m[mod].push_back(make_pair(mi,ma));
  }
  // rep(i,g) { for (auto x: m[i]) cout << x.first << "->" << x.second << " "; cout << endl; }
  ll result = 0;
  rep(i,g) {
    sort(m[i].begin(),m[i].end(), [](const p_ll &x, const p_ll &y){return x.first<y.first;});
    ll l = m[i][0].first, r = m[i][0].second;
    for (auto x: m[i]) {
      if (r>=x.first) r = max(r, x.second);
      else {
        result += (r-l)/D+1;
        l = x.first; r = x.second;
      }
    }
    result += (r-l)/D+1;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 11136