akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

signed main(){
    
    int n, m; cin >> n >> m;
    vector<pair<int, int> > p;
    
    for(int i = 0; i < m; i++){ 
        int x, y; cin >> x >> y;
        y--;
        p.push_back({x, y});
    }
    
    sort(p.begin(), p.end());
    
    vector<int> L(n);
    vector<int> R(n);
    for(int i = 0; i < n; i++) L[i] = R[i] = i;
    
    for(int i = 0; i < m; i++){
        int y = p[i].second;
        L[y + 1] = L[y];
        R[y] = R[y + 1];    
    }

    for(int i = 0; i < n; i++){
        if(i != n - 1) cout << R[i] - L[i] + 1 << " ";
        else cout << R[i] - L[i] + 1 << endl;
    }

    return 0;
}



Measured memory_bytes: 7540
#include <iostream>
using namespace std;
int main(void){
    int n, a, b; cin >> n >> a >> b;
    if (n >= a + b){
        cout << min(a, b) << " " << 0 << endl;
    }else{
        cout << min(a,b) << " " << a + b - n << endl;
    }
    
}

Measured memory_bytes: 256
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
ans = [0]*N

for i in range(N):
    for j in range(i+1, N):
        d = min(abs(i-j), abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-j))
        ans[d] += 1

for i in range(1, N):
    print(ans[i])

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

using namespace std;


struct Node{
  int key, pri;
  Node* right;
  Node* left;
};


Node* RightRotate(Node* t){
  Node* s = t->left;
  t->left = s->right;
  s->right = t;
  return s;
}

Node* LeftRotate(Node* t){
  Node* s = t->right;
  t->right = s->left;
  s->left = t;
  return s;
}

Node* Insert(Node* t, int key, int pri){

  if(t == NULL){
    Node* t = new Node;
    t->left=NULL;
    t->right=NULL;
    t->key=key;
    t->pri=pri;
    return t;
  }
  if(key == t->key) return t;

  if(key < t->key){
    t->left = Insert(t->left, key, pri);
    if(t->pri < t->left->pri) t = RightRotate(t);
  }
  else{
    t->right = Insert(t->right, key, pri);
    if(t->pri < t->right->pri) t = LeftRotate(t);
  }
  return t;
}

Node* Erase(Node* t, int key){
  if(t == NULL) return NULL;

  if(key == t->key){
    if(t->left  == NULL && t->right == NULL) return NULL;
    else if(t->left == NULL) t = LeftRotate(t);
    else if(t->right == NULL) t = RightRotate(t);
    else{
      if(t->left->pri > t->right->pri) t = RightRotate(t);
      else t = LeftRotate(t);
    }
    return Erase(t, key);
  }
  if(key < t->key) t->left = Erase(t->left, key);
  else t->right = Erase(t->right, key);
  return t;
}

void Find(Node* t, int key){
  while(t != NULL && key != t->key){
    if(key < t->key) t = t->left;
    else t = t->right;
  }
  if(t == NULL) cout << "no" << endl;
  else cout << "yes" << endl;
}

void Inorder(Node* t){
  if(t == NULL) return;
  Inorder(t->left);
  cout << " " << t->key;
  Inorder(t->right);
}

void Preorder(Node* t){
  if(t == NULL) return;
  cout << " " << t->key;
  Preorder(t->left);
  Preorder(t->right);
}

int main(){
  Node* root=NULL;
  int n, key, pri;
  string s;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> s;
    if(s == "insert"){
      cin >> key >> pri;
      root = Insert(root, key, pri);
    }
    else if(s == "delete"){
      cin >> key;
     root = Erase(root, key);
    }
    else if(s == "find"){
      cin >> key;
      Find(root, key);
    }
    else {
      Inorder(root);
      cout << endl;
      Preorder(root);
      cout << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 9368
#include <vector>
#include <cstdio>
#define SIZ 10
using namespace std;

const vector<pair<
	pair<int,int>,
	vector<vector<int> >
> >pattern={
	{{13,3},{
		{0,0,1,0,0},
		{0,1,1,1,0},
		{1,1,1,1,1},
		{0,1,1,1,0},
		{0,0,1,0,0},
	}},
	{{9,2},{
		{1,1,1},
		{1,1,1},
		{1,1,1},
	}},
	{{5,1},{
		{0,1,0},
		{1,1,1},
		{0,1,0},
	}},
};

int m[SIZ][SIZ];
vector<pair<pair<int,int>,int> >v;
bool dfs(int pat,int y,int x,int N,int d,int s){
	if(d==N)return s==0;
	if(s<(N-d)*5 || (N-d)*pattern[pat].first.first<s)return false;
	for(;pat<pattern.size();pat++,y=x=0)if(pattern[pat].first.first<=s){
		int nrow=pattern[pat].second.size(),ncol=pattern[pat].second[0].size();
		for(;y<=SIZ-nrow;y++,x=0){
			for(;x<=SIZ-ncol;x++){
				for(int dy=0;dy<nrow;dy++)for(int dx=0;dx<ncol;dx++){
					if(m[y+dy][x+dx]<pattern[pat].second[dy][dx])goto fail;
				}
				for(int dy=0;dy<nrow;dy++)for(int dx=0;dx<ncol;dx++){
					m[y+dy][x+dx]-=pattern[pat].second[dy][dx];
				}
				v[d]=make_pair(
					make_pair(x+ncol/2,y+nrow/2),
					pattern[pat].first.second
				);
				if(dfs(pat,y,x,N,d+1,s-pattern[pat].first.first))return true;
				for(int dy=0;dy<nrow;dy++)for(int dx=0;dx<ncol;dx++){
					m[y+dy][x+dx]+=pattern[pat].second[dy][dx];
				}
				fail:;
			}
		}
	}
	return false;
}

int main(){
	int N,y,x,s=0;
	scanf("%d",&N);
	v.resize(N);
	for(y=0;y<SIZ;y++)for(x=0;x<SIZ;x++)scanf("%d",m[y]+x),s+=m[y][x];
	dfs(0,0,0,N,0,s);
	for(x=0;x<N;x++)printf("%d %d %d\n",v[x].first.first,v[x].first.second,v[x].second);
}

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

int main(){
  double d, t, s;
  cin >> d >> t >> s;
  double time = d/t;
  if(time <= s) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3692
#include<stdio.h>

int main(void){
char ch;
	while(1){
		scanf("%c", &ch);
		if( ch == '\n') break;
		
		if('a'<=ch && ch<='z'){
		ch-=32;
		}
		else if('A'<=ch && ch<='Z'){
		ch+=32;
		}
		printf("%c", ch);
	}
	printf("\n");
return 0;
}



Measured memory_bytes: 2044
#include <iostream>
    #include <vector>
    #include <algorithm>
    #include <stdio.h>
    #include <sstream>
    #include <string>
    #include <map>
    #include <set>
    #include <stdlib.h>
    #include <cmath>
    #include <math.h>
    #include <fstream>
    #include <bitset>
    #include <time.h>
    #define int long long
    using namespace std;
    struct Edge{int to; bool can;};
    int n, m, ai, bi;
    vector<Edge> edges;
    vector<vector<int> >  data, ans;
    vector<bool> used;
    bool dfs(int vertex, int e){
        used[vertex] = true;
        vector<int> vertexes;
        for (int i=0; i < data[vertex].size(); i++){
            int to = data[vertex][i];
            if (used[edges[to].to]) continue;
            edges[to].can = false;
            edges[to^1].can = false;
            bool res = dfs(edges[to].to, to^1);
            if (res) vertexes.push_back(edges[to].to);
        }
        for (int i=0; i < data[vertex].size(); i++){
            int to = data[vertex][i];
            if (!edges[to].can) continue;
            edges[to].can = false;
            edges[to^1].can = false;
            vertexes.push_back(edges[to].to);
        }
        bool ret = true;
        if (vertexes.size() % 2 != 0 && e != -1){
            vertexes.push_back(edges[e].to);
            ret = false;
        }
        for (int i=0; i+1 < vertexes.size(); i+=2){
            vector<int> h;
            h.push_back(vertexes[i]);
            h.push_back(vertex);
            h.push_back(vertexes[i+1]);
            ans.push_back(h);
        }
        return ret;
    }
    int32_t main(){
        cin >> n >> m;
        if (m%2!=0){
            cout << -1;
            return 0;
        }
        for (int i=0; i < n; i++){
            vector<int> help;
            data.push_back(help);
            used.push_back(false);
        }
        for (int i=0; i < m; i++){
            cin >> ai >> bi;
            Edge e1 = {bi-1, true};
            Edge e2 = {ai-1, true};
            edges.push_back(e1);
            edges.push_back(e2);
            data[ai-1].push_back(edges.size() - 2);
            data[bi-1].push_back(edges.size() - 1);
        }
        for (int i=0; i < n; i++){
            if (!used[i]){
                dfs(i,-1);
            }
        }
        for (int i=0; i < ans.size(); i++){
            cout << ans[i][1] + 1 << " " << ans[i][0] + 1 << endl;
            cout << ans[i][1] + 1 << " " << ans[i][2] + 1 << endl;
        }
        return 0;
    }

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

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

  int count = 1;
  int64_t now = 7%k;
  while(count<=k) {
    if(now==0) {
      cout<<count<<endl;
      break;
    }

    // int64_t add = (now*10)%k;
    // now = (now+add)%k;
    now = ((now*10)+7)%k;
    count++;
  }

  if(now!=0) cout<<-1<<endl;
  

  return 0;
}

Measured memory_bytes: 3632
#pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize ("Ofast")
        #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
         
         
        #include <iostream>
        #include <iomanip>
        #include <sstream>
        #include <cstring>
        #include <vector>
        #include <deque>
        #include <queue>
        #include <set>
        #include <map>
        #include <valarray>
        #include <iterator>
        #include <functional>
        #include <limits>
        #include <algorithm>
        #include <numeric>
        #include <cmath>
        #include <cassert>
        #include <unordered_map>
        #include <unordered_set>
        #include <stack>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
         #define trace(x) cerr << #x << ": " << x << " " << endl;
     
        typedef int64_t ll;
     
        #define endl '\n'
        #define int ll
        ll mod=1e9+7;
        ll mod1=1e9+5;
        ll power(ll a,ll b)
        {
            if(b==0) return 1;
            else if(b%2==0)
                return power((((a%mod)*(a%mod))%mod),b/2)%mod;
            else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
        }
        #define PI 3.14159265
     int32_t main()
        {
            IOS
      
        int n;
        cin>>n;
        for(int i=1;i<=9;++i)
        {
            for(int j=1;j<=9;++j)
            {
                if(i*j==n)
                {
                    cout<<"Yes";
                    return 0;
                }
            }
        }
        cout<<"No";
        }

Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int a,n, m,t=0;
	cin >> n >> m;
	vector<int>vec(n);
	rep(i, n) {
		cin >> vec[i];
		t += vec[i];
	}
	sort(all(vec));
	reverse(all(vec));
	rep(i, n) {
		if (vec[i] < t / 4.0 / m) {
			a = i;
			break;
		}
	}
	if (m <= a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,tot;
ll d (ll n) {
	ll ans=1;
	for (ll i=2;i*i<=n;i++) {
		if (n%i==0) {
			int cnt=0;
			while (n%i==0) {cnt++,n/=i;}
			ans*=(cnt+1);
		}
	}
	if (n>1) {ans*=2;}
	return ans;
}
bool chk (ll x,ll n) {
	if (x==1) {return 0;}
	while (n%x==0) {n/=x;}
	if ((n-1)%x==0) {return 1;}
	return 0;
}
int main () {
	scanf("%lld",&n);
	ll copn=n;
	ll res=d(n-1)-1;
	for (ll i=1;i*i<=copn;i++) {
		if (copn%i==0) {
			if (chk(i,copn)) {res++;}
			if (i*i!=copn&&chk(copn/i,copn)) {res++;}
		}
	}
	printf("%lld\n",res);
	return 0;
}

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

using ll = long long;
using namespace std;

#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define FORR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define REPR(i,n) FORR(i,(int)(n)-1,0)

#define LFOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define LFORR(i,a,b) for(ll i = (int)(a); i >= (ll)(b); i--)
// #define LREP(i,n) LFOR(i,0,(ll)(n)-1)
// #define LREPR(i,n) LFORR(i,(ll)(n)-1,0)

#define SIZ(v) int(v.size())
const int INF = 1e8;
const ll LINF = 1e15;
const int MOD = 1e9+7;



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  vector<pair<int,int> > a;
  cin >> n;
  REP(i,n){
    int k;
    cin >> k;
    a.push_back(make_pair(k,i+1));
  }
  sort(a.begin(),a.end());
  REP(i,n){
    cout << a[i].second;
    if(i!=n)cout << " ";
  }
  cout << endl;
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF=1e9+7;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	int N,A;
	cin >> N;
	vector<int> r(N,0);

	rep(i,N-1) {
		cin >> A;
		++r.at(A-1);
	}

	rep(i,N)
		cout << r.at(i) << endl;
}

Measured memory_bytes: 4052
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右攜下昴 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };


// 敘大公約摧
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 敘擣公倍摧
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}


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

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

	// cの倍数の個数
	// dの倍数の個数

	ll canum = 0;
	ll cbnum = 0;
	ll danum = 0;
	ll dbnum = 0;

	canum = (a - 1) / c;
	danum = (a - 1) / d;
	cbnum = b / c;
	dbnum = b / d;

	ll cdanum = 0;
	ll cdbnum = 0;
	cdanum = (a - 1) / lcm(c, d);
	cdbnum = b / lcm(c, d);

	ll ans = cbnum + dbnum - canum - danum - (cdbnum - cdanum);

	cout << b - a + 1 -  ans << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long X = long.Parse(str[0]);
		long A = long.Parse(str[1]);
		long ans = 0;
		if(X>=A){
			ans = 10;
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13140
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll fastexp(ll x,ll a){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n){
    return fastexp(n,mod-2);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	ll n,k;
	cin>>n>>k;
	ll ans = 1;
	if(k >= n){
		// 2n-1Cn-1
		ll num = 1;
		ll den = 1;
		rep(i,2*n-1){
			ans *= (1+i);
			ans %= mod;
		}
		rep(i,n){
			den *= (i+1);
			den %= mod;
		}
		rep(i,n-1){
			num *= (i+1);
			num %= mod;
		}
		ans *= inverse(num);
		ans %= mod;
		ans *= inverse(den);
		ans %= mod;
		cout<<ans<<"\n";
		return 0;
	}
	ll fac[n+1];
	fac[0] = 1;
	fac[1] = 1;
	repa(i,2,n+1){
		fac[i] = fac[i-1]*i;
		fac[i] %= mod;
	}	
	repa(i,1,k+1){
		ll temp = fac[n-1];
		temp *= inverse(fac[i]);
		temp %= mod;
		temp *= inverse(fac[n-1-i]);
		temp %= mod;
		temp *= fac[n];
		temp %= mod;
		temp *= inverse(fac[i]);
		temp %= mod;
		temp *= inverse(fac[n-i]);
		temp %= mod;
		ans += temp;
		ans %= mod;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

vector<bool> eratosthenes(int n) {
  vector<bool> isPrime(n + 1, true);
  if(n >= 0) isPrime[0] = false;
  if(n >= 1) isPrime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!isPrime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      isPrime[j] = false;
    }
  }
  return isPrime;
}

int main(){
  int Q;
  cin >> Q;
  vector<int> l(Q), r(Q);
  rep(i, Q) cin >> l[i] >> r[i];
  vector<bool> table = eratosthenes(1e5);
  vector<int> num(1e5+2);
  for(int i=1; i<=1e5+1; i++) {
    num[i] = num[i-1];
    if(table[i-1] && table[i/2])
      num[i]++;
  }
  rep(i, Q)
    cout << num[r[i]+1]-num[l[i]] << endl;
  return 0;
}

Measured memory_bytes: 1792
/* author : akshatjai258 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define int ll
#define mod int(1e9 + 7)
#define inf int(1e9)
#define endl "\n"
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define fi first
#define mem0(a) memset(a, 0, sizeof(a))
#define mem1(a) memset(a, -1, sizeof(a))
#define memf(a) memset(a, false, sizeof(a))
#define all(v) v.begin(), v.end()
#define se second
#define mp make_pair
#define pb push_back
#define w(x)  \
	int x;    \
	cin >> x; \
	while (x--)
#define ps(x, y) fixed << setprecision(y) << x
void prep()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
}
int32_t main()
{
	prep();
	int n;
	cin>>n;
	int k=n%10;
	if(k==2||k==4||k==5||k==7||k==9)
	{
		cout<<"hon";
	}
	else if(k==0||k==1||k==6||k==8)
	{
		cout<<"pon";
	}
	else
	{
		cout<<"bon";
	}
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int n;
int dfs(ll x,int a=0,int b=0,int c=0){
    if(x>n){
        return 0;
    }
    if(!x){
        return dfs(3,1,0,0)+dfs(5,0,1,0)+dfs(7,0,0,1);
    }
    return (a&&b&&c)+dfs(x*10+3,1,b,c)+dfs(x*10+5,a,1,c)+dfs(x*10+7,a,b,1);
}
int main(){
    cin>>n;
    cout<<dfs(0)<<endl;
    return 0;
}

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

bool dx[]{ 1,1,0,0 }, dy[]{ 0,1,0,1 };
int main() {
	int m; scanf("%d", &m);
	rep(k, m) {
		set<string>se;
		string s; cin >> s;
		rep(i, s.size() - 1) {
			string s1, s2;
			rep(j, i + 1)s1 += s[j];
			for (int j = i + 1; j < s.size(); j++)s2 += s[j];
			rep(i, 4) {
				string s3 = s1, s4 = s2;
				if (dx[i])reverse(s3.begin(), s3.end());
				if (dy[i])reverse(s4.begin(), s4.end());
				se.insert(s3 + s4);
				se.insert(s4 + s3);
			}
		}
		printf("%d\n", se.size());
	}
}

Measured memory_bytes: 3360
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 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:
                ans += 1

print(ans)


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
ll GCD(ll a, ll b) {
  if (b == 0)
    return a;
  return GCD(b, a % b);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll A, B;
  cin >> A >> B;
  cout << ((A * B) / GCD(A, B)) << endl;

  return 0;
}


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

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

	vector<int> x(N);
	vector<int> y(M);
	for (int i = 0; i < N; i++){
		cin >> x[i];
	}
	for (int i = 0; i < M; i++){
		cin >> y[i];
	}

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	int xMax = x[N - 1];
	int yMin = y[0];

	if (xMax < yMin && xMax > X && yMin <= Y){
		cout << "No War";
	}
	else{
		cout << "War";
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<sstream>
#include<fstream>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
#include<iomanip>
using namespace std;
/*freopen{"input.txt","r",stdin};
freopen{"output.txt","w",stdout};*/
#define mp make_pair
#define pb push_back
const int INF=1000*1000*1000;
const int maxn=2e5; 
typedef long long ll;
typedef long double ld;
typedef pair<int,int>PII;
//priority_queue <int,vector<int>,greater<int> > q1;  //从小到大 
//priority_queue <int,vector<int>,less<int> >q2;  //从大到小 

//set multiset vector queue priority_queue map multimap pair string structure 

//枚举 思维 贪心 搜索 模拟 预处理 二分 排序 
map<string,int>m; 
int main(){
	//ios_base::sync_with_stdio(0);
    //cin.tie(0);
    //cout.tie(0);
	string a,b;
	cin>>a>>b;
	cin>>m[a]>>m[b];
	string t;
	cin>>t;
	m[t]--;
	cout<<m[a]<<' '<<m[b];
	
	
	
	
	
	
	
	
	return 0;
}



Measured memory_bytes: 256
// This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

const int maxn=100111;
int n,m,v,p,a[maxn];

bool check(int id)
{
	vector<int> vs;
	int have=m+a[id];
	for(int i=n;i>=1;i--)
	{
		if(i==id)continue;
		if(a[i]>have)return false;
		vs.pb(have-a[i]);
		if(vs.size()==n-p)break;
	}
	if(v<=p)return true;
	reverse(vs.begin(),vs.end());
	LL sum=0;
	for(int i=0;i<(int)vs.size();i++)
	{
		sum+=vs[i];
		int least=v-p-(int)vs.size()+i+1;
		if(least<0)continue;
		if((LL)least*m>sum)return false;
	}
	return true;
}

int main()
{
	get2(n,m);get2(v,p);
	for(int i=1;i<=n;i++)get1(a[i]);
	sort(a+1,a+n+1,greater<int>());
	
	int lb=1,rb=n+1,mid;
	while(lb<rb-1)
	{
		mid=(lb+rb)>>1;
		if(check(mid))lb=mid;
		else rb=mid;
	}
	printendl(lb);
	return 0;
}

Measured memory_bytes: 1596
// Karm Karta ja, Phal Ki Chinta na Kar:)
#include <bits/stdc++.h>
using namespace std;
#include<stdio.h>
typedef long long int ll;
#define INF 1e18+3
#define M 1000000007
#define PI 3.14159265358979323846
ll po2[62];
int main()
{
   int n;
   cin>>n;
   int A[n];
   int x,y;
   int i;
   map<int,vector<int> > ans,kes;
   for(i=0;i<n;i++)
   {
       cin>>A[i];
       for(int j=0;j<A[i];j++)
       {
           cin>>x>>y;
           if(y==0)
           {
               ans[i+1].push_back(x);
           }
           else
           {
               kes[i+1].push_back(x);
           }
       }
   }
   int res=0;
   for(i=0;i<(1<<n);i++)
   {
       int b[n+1]={0},f=0;
       for(int j=0;j<n;j++)
       {
         if(((i&(1<<j)))!=0)
         {
             f++;
             b[j+1]=1;
         }
       }
       int d=1;
       for(int k=1;k<=n;k++)
       {
           if(b[k]==1)
           {
               int ok=1;
               for(int u=0;u<ans[k].size();u++)
               {
                   if(b[ans[k][u]]==1)
                   {
                       ok=0;
                       break;
                   }
               }
               if(ok==0)
               {
                   d=0;
                   break;
               }
               else
               {
                   for(int u=0;u<kes[k].size();u++)
                   {
                       if(b[kes[k][u]]==0)
                       {
                           ok=0;
                           break;
                       }
                   }
                   if(ok==0)
                   {
                       d=0;
                       break;
                   }
               }
           }
       }
       if(d==1)
       {
           res=max(res,f);
       }
   }
   cout<<res;




}


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


int main(){
  int n;
  cin >> n;
  vector<int> v(26, 100);
  for(int i = 0; i < n; i++){
    string s;
    cin >> s;
    vector<int> res(26, 0);
    for(int j = 0; j < s.size(); j++){
      for(int k = 0; k < 26; k++){
        if(s[j] == k +97){ res[k]++; break;}
      }
    }
    for(int j = 0; j < 26; j++){
      if(res[j] < v[j]){v[j] = res[j];}
    }
  }

  for(int i = 0; i < 26; i++){
    if(v[i] == 100){ v[i] = 0;}
    while(v[i] > 0){
      char c = i + 97;
      cout << c;
      v[i]--;
    }
  }

  cout << endl;



}       

Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))
s = sum(x)
xx = 0
for i in x:
    xx += i**2
def f(p):
    return n * p**2 - 2 * p * s + xx
ans = f(1)
for i in range(2, 101):
    ans = min(ans, f(i))
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
using namespace std;


signed main(){
    unordered_map<string,int> cnt;
    cnt["RE"] = 0; cnt["TLE"] = 0;  cnt["WA"] = 0;cnt["AC"] = 0;   
    int n; cin>>n; string s;
    for(int i=0; i<n; i++){
        cin>>s;
        cnt[s]++;
    }

    for(auto x : {"AC", "WA", "TLE", "RE"})
    cout<<x<<" x "<<cnt[x]<<endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
int a, b, c;
int main() {
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << ' ' << b << ' ' << c << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void youso(int A[], int N)
{
	int i;

	for(i = 0; i < N; i++){
		if(i > 0){printf(" ");}
			printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N)
{
	int i, j, v;

	for(i = 1; i < N; i++){
		v = A[i];
		j = i-1;
		while(j >= 0 && A[j] > v){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		youso(A, N);
	}
}


int main(void)
{

	int i, N, A[1000];

	scanf("%d", &N);

	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}

	youso(A, N);
	insertionSort(A, N);

	return 0;
}



Measured memory_bytes: 2040
from bisect import bisect_right
p = 10**9+7
N,M = map(int,input().split())
A = list(map(int,input().split()))
CA = {}
for i in range(N):
    if A[i] not in CA:
        CA[A[i]] = 0
    CA[A[i]] += 1
indA = [0 for _ in range(N*M+1)]
for i in range(N):
    indA[A[i]] = 1
A1 = sorted(A[:])
B = list(map(int,input().split()))
CB = {}
for j in range(M):
    if B[j] not in CB:
        CB[B[j]] = 0
    CB[B[j]] += 1
indB = [0 for _ in range(N*M+1)]
for j in range(M):
    indB[B[j]] = 1
B1 = sorted(B[:])
flag = 0
if N*M not in CA or CA[N*M]!=1:flag=1
if N*M not in CB or CB[N*M]!=1:flag=1
for a in CA:
    if CA[a]>1:
        flag = 1
        break
for b in CB:
    if CB[b]>1:
        flag = 1
        break
if flag==1:
    print(0)
else:
    dp = [0 for _ in range(N*M+1)]
    dp[N*M] = 1
    for k in range(N*M-1,0,-1):
        if indA[k]==1 and indB[k]==1:
            dp[k] = dp[k+1]
        elif indA[k]==1 and indB[k]==0:
            cnt = bisect_right(B1,k)
            cnt = M-cnt
            dp[k] = (dp[k+1]*cnt)%p
        elif indA[k]==0 and indB[k]==1:
            cnt = bisect_right(A1,k)
            cnt = N-cnt
            dp[k] = (dp[k+1]*cnt)%p
        else:
            cnt1 = bisect_right(A1,k)
            cnt1 = N-cnt1
            cnt2 = bisect_right(B1,k)
            cnt2 = M-cnt2
            cnt = cnt1*cnt2-(N*M-k)
            dp[k] = (dp[k+1]*cnt)%p
    print(dp[1])

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

int main(void) {
    string a,b,c;
    cin >>a;
    cin>>b;
    cin>>c;

    cout<<"A"<<b[0]<<"C"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define m long long
#define d(s,i,n) for(m i=s;i<n;i++)
m l[90][90],r[90][90];
signed main(){m n;cin>>n;d(0,i,89){l[i][0]=1,r[i][0]=1;d(1,j,90){if(i==j)r[i][j]=r[i][j-1]*2+l[i][j-1];else r[i][j]=r[i][j-1]+l[i][j-1];l[i][j]=r[i][j-1];}}d(0,i,n){m a,b; cin>>a>>b;if(b>a)swap(a,b);m k=0;d(0,j,90)if(a>=r[0][j]&&b>=l[0][j])k=j;m g;if(k==0)k=1,g=1;else if(k==1)if(b==1)g=a;else g=4;else{g=1;if(b>=r[0][k]&&a>=l[0][k]&&l[0][k]!=r[0][k])g++;d(1,j,k+1)if(r[j][k]<=a&&l[j][k]<=b)g+=1+(a-r[j][k])/l[j][k];d(1,j,k+1)if(r[j][k]<=b&&l[j][k]<=a)g+=1+(b-r[j][k])/l[j][k];}cout<<k<<" "<<g%1000000007<<" ";}}	

Measured memory_bytes: 4420
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    char t= s[0];
    int cnt=1;
    for(int i=0; i<n; i++){
        if(s[i]!=t){
            t=s[i];
            cnt++;
        } 
    }
    cout << cnt << endl;
}

Measured memory_bytes: 512
using System;

class Program
{
    static void Main()
    {
        string s = Console.ReadLine();

        int ans = int.Parse(s.Substring(0, 3));

        for (int i = 1; i < s.Length - 2; i++)
        {
            int tmp = int.Parse(s.Substring(i, 3));
            if (Math.Abs(753 - tmp) < Math.Abs(753 - ans)) ans = tmp;
        }

        Console.WriteLine(Math.Abs(753 - ans));
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int parse(string &s){
    int n = s.size(), ans = 0, cur = 0;
    string t = "mcxi";
    int x[] {1000, 100, 10, 1};
    while(cur < n){
        int a = 1;
        if('0' <= s[cur] && s[cur] <= '9'){
            a = s[cur]-'0';
            cur++;
        }
        for (int i = 0; i < 4; ++i) {
            if(t[i] == s[cur]){
                a *= x[i];
            }
        }
        ans += a;
        cur++;
    }
    return ans;
}

int main() {
    int n;
    cin >> n;
    while(n--){
        string s, t;
        cin >> s >> t;
        int a = parse(s)+parse(t);
        string ans;
        if(a/1000){
            if(2 <= a/1000){
                ans += to_string(a/1000);
            }
            ans += 'm';
            a -= a/1000*1000;
        }
        if(a/100){
            if(2 <= a/100){
                ans += to_string(a/100);
            }
            ans += 'c';
            a -= a/100*100;
        }
        if(a/10){
            if(2 <= a/10){
                ans += to_string(a/10);
            }
            ans += 'x';
            a -= a/10*10;
        }

        if(a){
            if(2 <= a){
                ans += to_string(a);
            }
            ans += 'i';
            a -= a;
        }
        cout << ans << "\n";
    }
    return 0;
}



Measured memory_bytes: 3068
#include <stdio.h>

int main(void)
{
	int a[4], b[4], total;
	scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]);
	scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
	
	if(a[0] + a[1] + a[2] + a[3] > b[0] + b[1] + b[2] + b[3])
		total = a[0] + a[1] + a[2] + a[3];
	else
		total = b[0] + b[1] + b[2] + b[3];
	
	printf("%d\n", total);
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, k;
  cin >> n >> k;
  vl a(n);
  rep(i, n) cin >> a[i];
  rep2(i, k, n) cout << (a[i - k] < a[i] ? "Yes" : "No") << '\n';
}

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

int main() {
	int N,K;
	cin>>N>>K;
	int ans=K;
	rep(i,N-1){
		ans*=(K-1);
	}
	cout<<ans<<endl;
}

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

using namespace std;

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

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

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

    ll x, d;

    while(cin >> x >> k >> d)
    {
		x = abs(x);

		ll down = x / d;

		x -= min(k, down) * d;

		k -= min(k, down);

		k %= 2;

		if(k & 1) x -= d;

		x = abs(x);

		cout << x << "\n";
    }


}






Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<pair<int, int>> req(M);
  for (int m = 0; m < M; ++m) {
    int a, b;
    cin >> a >> b;
    req[m] = {a, b};
  }
  sort(req.begin(), req.end(), 
       [](const pair<int, int>& lhs, const pair<int, int>& rhs) {
         if (lhs.second != rhs.second) {
           return lhs.second < rhs.second;
         }
         return lhs.first < rhs.first;
       });
  int pre = -1;
  int result = 0;
  for (const pair<int, int>& p : req) {
    if (p.first <= pre && pre < p.second) {
      continue;
    }
    pre = p.second - 1;
    ++result;
  }
  cout << result << endl;
  
  return 0;
}


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

struct Block {
  int w, s;
  long long v;
  Block(int w, int s, int v) : w(w), s(s), v(v) {}
  bool operator<(const Block& oth) const { return w + s < oth.w + oth.s; }
};

long long dp[1<<16] = {0};
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  vector<Block> Bs;
  for (int i = 0; i < n; ++i) {
    int w, s, v; cin >> w >> s >> v;
    Bs.emplace_back(w, s, v);
  }
  sort(Bs.begin(), Bs.end());
  for (auto B : Bs) {
    int W = B.w, s = B.s;
    for (int w = s; w >= 0; --w) {
      dp[w + W] = max(dp[w] + B.v, dp[w + W]);
    }
  }
  cout << *max_element(dp, dp + (1<<16)) << '\n';
}


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

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

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(void){
   // Your code here!
   int h, w; cin >> h >> w;
   vector<vector<char>> mas(h+2, vector<char>(w+2));
   
   for(int i = 0; i < h+2; i++){
      if(i==0 || i== h+1){
         for(int j = 0; j < w+2; j++){ mas.at(i).at(j) = '-'; }
      }
      else{
         string line; cin >> line;
         line += "-"; line = "-" + line;
         for(int j = 0; j < w+2; j++){ mas.at(i).at(j) = line.at(j); }
      }
   }
   
   for(int i = 1; i < h+1; i++){
      for(int j = 1; j < w+1; j++){
         if(mas.at(i).at(j) == '.'){
            int count = 0;
            if(mas.at(i-1).at(j-1)=='#')//LU
               count++;
            if(mas.at(i-1).at(j)  =='#')
               count++;
            if(mas.at(i-1).at(j+1)=='#')
               count++;
            if(mas.at(i).at(j-1)  =='#')
               count++;
            if(mas.at(i).at(j+1)  =='#')
               count++;
            if(mas.at(i+1).at(j-1)=='#')
               count++;
            if(mas.at(i+1).at(j)  =='#')
               count++;
            if(mas.at(i+1).at(j+1)=='#')
               count++;
            cout << count;
         }
         else if(mas.at(i).at(j) == '#'){
            cout << "#";
         }
      } cout << endl;
   }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll n, k,a,b;
	std::cin >> n >> k;

	map<ll, ll> m;
	rep(i, 0, n) {
		std::cin >> a >> b;
		m[a] += b;
	}
	
	for (auto itr = m.begin(); itr != m.end(); itr++) {
		k -= itr->second;
		if (k <= 0) {
			outn(itr->first);
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdint>

using namespace std;

int main(void){
	int A, B;
	cin >> A >> B;
	cout << A * B - (A + B - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main() {
    string C[2];
    cin >> C[0];
    cin >> C[1];
 
    for(int i = 0; i < 3; i++)
        if(C[0][i] != C[1][3 - i - 1]){
            cout << "NO" << endl;
            return 0;
        }
    cout << "YES" << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 3003, M = N << 2;
const string s = "RYGB";

int h, w, d;

int main()
{
	h = gi(), w = gi(), d = gi();
	for (int i = 1; i <= h; i+=1)
	{
		for (int j = 1; j <= w; j+=1)
		{
			int x = i + j + w, y = i - j + w;
			cout << s[((x / d) & 1) * 2 + ((y / d) & 1)];
		}
		puts("");
	}
	return 0;
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;

int main(int argc, char *argv[])
{
	int n,n2;

	cin >> n;

	n2=n/2;
	double nd=n;
	double ret=(nd-n2)/nd;

	cout << ret << endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

struct Node {int p,l,r;};

struct Node T[100005];
int n,D[100005];

void print(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if(T[u].p==-1) printf("root, ");
  else if(T[u].l==-1) printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  c=T[u].l;
  for(i=0;c!=-1;i++){
    if(i!=0) printf(", ");
    printf("%d",c);
    c=T[c].r;
  }
  printf("]\n");
  
}

int re(int u,int p){
  D[u]=p;
  if(T[u].r!=-1) re(T[u].r,p);
  if(T[u].l!=-1) re(T[u].l,p+1);
}

int main(){
  int i,j,a,b,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p=T[i].l=T[i].r=-1;

  for(i=0;i<n;i++){
    scanf("%d%d",&a,&b);
    for(j=0;j<b;j++){
      scanf("%d",&c);
      if(j==0) T[a].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=a;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p==-1) r=i;
  }

  re(r,0);

  for(i=0;i<n;i++)print(i);

  return 0;
}



Measured memory_bytes: 6408
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
		String s=bu.readLine();
		if(s.charAt(2)==s.charAt(3) && s.charAt(4)==s.charAt(5)) System.out.print("Yes");
		else System.out.print("No");
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll ans = 0;
    rep(i,n) cin >> a[i];
    rep(i,60) {
        ll one = 0;
        rep(j,n){
            if(a[j]>>i & 1) one++;
        }
        ll temp = one*(n-one)%mod;
        rep(j, i) temp = temp*2%mod;
        ans+=temp;
        ans%=mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560