akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define INF 1LL<<60

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int X;
    cin >> X;
    
    int last_two = X % 100, num = 0;
    

    for(int i=5; i>0; i--) {
        while(last_two >= i) {
            num++;
            last_two -= i;
        }
    }

    if(num*100 > X) {
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

int main() {
	vector<vector<int>> A(3, vector<int>(3));
	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < 3; ++j)
			cin >> A[i][j];
	vector<vector<bool>> bingo(3, vector<bool>(3, false));
	int N; cin >> N;
	while (N--) {
		int b; cin >> b;
		for (int i = 0; i < 3; ++i)
			for (int j = 0; j < 3; ++j)
				if (b == A[i][j])
					bingo[i][j] = true;
	}
	// 横方向ビンゴを確認
	for (int i = 0; i < 3; ++i) {
		bool ok = true;
		for (int j = 0; j < 3; ++j)
			ok = ok && bingo[i][j];
		if (ok) {
			cout << "Yes" << endl;
			goto FIN;
		}
	}
	// 縦方向ビンゴを確認
	for (int j = 0; j < 3; ++j) {
		bool ok = true;
		for (int i = 0; i < 3; ++i)
			ok = ok && bingo[i][j];
		if (ok) {
			cout << "Yes" << endl;
			goto FIN;
		}
	}
	// 斜めビンゴを確認
	if (bingo[0][0] && bingo[1][1] && bingo[2][2]) {
		cout << "Yes" << endl;
		goto FIN;
	}
	else if (bingo[2][0] && bingo[1][1] && bingo[0][2]) {
		cout << "Yes" << endl;
		goto FIN;
	}
	// ビンゴ不成立
	cout << "No" << endl;
FIN:;
	return 0;
}

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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

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

ll modpow(ll a, ll b){

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

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);


    string s;
    cin>>s;

    long long k;
    cin>>k;

    long long ans = 0;

    long long totcnt = 0;

    int cnt = 1;

    for(int i = 1; i < s.size(); i++) {
        if(s[i] == s[i-1]) {
            cnt++;
        } else {
            totcnt += (cnt/2);
            cnt = 1;
        }
    }

    totcnt += (cnt/2);

    if(s[0] != s[s.size()-1]) {
        ans = ans + totcnt*k;
    } else {
        int fcnt = 1;
        for(int i = 1; i < s.size(); i++) {
            if(s[i] == s[0]) fcnt++;
            else break;
        }

        int rcnt = 1;
        for(int i = (int)s.size()-2; i >= 0; i--) {
            if(s[i] == s[s.size()-1]) rcnt++;
            else break;
        }

        if(fcnt == (int)(s.size())) {
            ans = ans + (k*fcnt)/2;
        } else {
            totcnt -= (fcnt/2);
            totcnt -= (rcnt/2);

            ans = ans + totcnt*k;
            ans = ans + ((fcnt+rcnt)/2)*(k-1);
            ans = ans + (fcnt/2);
            ans = ans + (rcnt/2);
        }

    }

    cout<<ans<<endl;
    


}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cerr << (*begin) << " ";
    *begin++;
  }
  cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cerr << " " << Array[i][j];
    }
    cerr << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

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

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

    if (n % k == 0) {
      cout << 0 << endl;
    } else {
      cout << 1 << endl;
    }

  return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){ T x; cin >> x; return (x); }
template<typename T=int,typename C=vector<T>>
C vecin(int N){ C x(N);REP(i,N){ x[i]=in<T>(); }return move(x); }

void vout(){ cout << endl; }
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){ cout << ' ' << h;vout(forward<Tail>(t)...); }
void out(){ cout << endl; }
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){ cout << h;vout(forward<Tail>(t)...); }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in(),R=in();
	out(N>=10 ? R : R+100*(10-N));
	return 0;
}


Measured memory_bytes: 256
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

p = L()
a,b = I()
u = s()
if u == p[0]:
    a -=1
else:
    b-=1

print("{} {}".format(a,b))


Measured memory_bytes: 10456
#include <iostream>

using namespace std;

int main() {
    int X, Y; cin >> X >> Y;
    if (Y % 2 != 0) {
        cout << "No" << endl;
        return 0;
    }

    int a = 2 * X - Y / 2;
    int b = Y / 2 - X;
    // cout << a << ", " << b << endl;

    if(a < 0 || b < 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 3632
N = input()

dp0 = 0  
dp1 = 1  
 
for n in N:
    n = int(n)
    dp0_new = min(dp0 + n, dp1 + (10 - n))
    n = n + 1 #繰り上げさせてる
    dp1_new = min(dp0 + n, dp1 + (10 - n))
    dp0, dp1 = dp0_new, dp1_new

print(dp0)

Measured memory_bytes: 5492
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans[10001]={0};
  for(int i=1; i<100; i++) {
    for(int j=1; j<100; j++) {
      for(int k=1; k<100; k++) {
        int cnt=i*i+j*j+k*k+i*j+j*k+k*i;
        if(cnt<=10000) {
          ans[cnt]++;
        }
      }
    }
  }
  for(int i=1; i<=n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> cnt(m);
  for(int i=0;i<n;i++){
      int k;
      cin>>k;
      for(int i=0;i<k;i++){
          int a;
          cin>>a;
          a--;
          cnt[a]++;
      }
  }
  int ans=0;
  for(int i=0;i<m;i++){
      if(cnt[i]==n) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main() {

    char s1[11];
    char s2[11];
    char s3[11];
    
    scanf("%s %s %s", s1, s2, s3);
    
    printf("%c%c%c",s1[0]-32,s2[0]-32,s3[0]-32);


    return 0;

}


Measured memory_bytes: 128
X = int(input())
if 400<=X<600:
    print(8)
elif 600<=X<800:
    print(7)
elif 800<=X<1000:
    print(6)
elif 1000<=X<1200:
    print(5)
elif 1200<=X<1400:
    print(4)
elif 1400<=X<1600:
    print(3)
elif 1600<=X<1800:
    print(2)
elif 1800<=X<2000:
    print(1)

Measured memory_bytes: 61620
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

void process(vector<vi> &v){
	rep(i, v.size()) rep(j, v[i].size()){
		if(j) v[i][j] += v[i][j - 1];
		if(i) v[i][j] += v[i - 1][j];
		if(i && j) v[i][j] -= v[i - 1][j - 1];
	}
}
int calc(vector<vi> &v, int y, int x, int Y, int X){
	return v[Y][X] - v[y][X] - v[Y][x] + v[y][x];
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int h, w, q; cin >> h >> w >> q;
	vector<vi> tate(h + 1, vi(w + 1)), yoko(h + 1, vi(w + 1)), sum(h + 1, vi(w + 1));
	vector<string> s(h);
	rep(i, h){
		cin >> s[i];
		rep(j, w){
			sum[i + 1][j + 1] = s[i][j] == '1';
			if(i) tate[i + 1][j + 1] = s[i][j] == s[i - 1][j] && s[i][j] == '1';
		}
		rep(j, w - 1) yoko[i + 1][j + 2] = s[i][j] == s[i][j + 1] && s[i][j] == '1';
	}
	process(tate);
	process(yoko);
	process(sum);
	
	while(q--){
		int y, x, Y, X; cin >> y >> x >> Y >> X; y--; x--;
		int ans = calc(sum, y, x, Y, X);
		ans -= calc(tate, y + 1, x, Y, X);
		ans -= calc(yoko, y, x + 1, Y, X);
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 53248
#include<stdio.h>

void keybord(char s[]){
    char k[11] = {'\0'};
    int i;
    int j = 0;

    for(i = 0; s[i]; i++){
        if(s[i] == '0'){
            k[j] = s[i];
            j++;
        }

        if(s[i] == '1'){
            k[j] = s[i];
            j++;
        }

        if(s[i] == 'B' && j > 0){
            j--;
            k[j] = '\0';
        }
    }

    printf("%s", k);
}

int main(void){
    char s[11];

    scanf("%s", s);

    keybord(s);

    return 0;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define pb push_back

using namespace std;
using ll=long long;
using pii= pair<int, int>;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... T> void rd(T&... args) {((cin>>args), ...);}
template<typename... T> void wr(T... args) {((cout<<args<<" "), ...);cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    const int mod=1e9+7;
    int n;
    cin>>n;
    vector a(n,vector(n,0));
    for(auto& v:a) for(auto& it:v) cin>>it;
    vector<int> dp(1<<n);
    dp[0]=1;
    for(int mask=1;mask<(1<<n);mask++){
        int ones=__builtin_popcount(mask);
        for(int bit=0;bit<n;bit++){
            if(mask>>bit&1 && a[ones-1][bit]){
                (dp[mask]+=dp[mask^(1<<bit)])%=mod;
            }
        }
    }
    cout<<dp[(1<<n)-1];
    return 0;
}



Measured memory_bytes: 11400
#include "iostream"
using namespace std;

int main()
{
	int a, b, c, i , count=0;
	cin >> a >> b >> c;
	for (i = a; i <= b; i++)
	{
		if (c%i == 0)
		{
			count++;
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <numeric>
#include <climits>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm> 

/*
	メモ
	#inlucde <string>
	memset(配列,初期化値,sizeof(配列));//配列初期化

	#include <queue>
	push(),back(),front()
	pop()//最初の要素削除

	#inclue <stack>
	pop(),push(),top(),empty()

	__builtin_popcount(unsigned int);

*/

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{"; for(auto nth : list){ cout << nth << " ";}cout << "}" << endl;

using namespace std;

int main() {

	while(1){
		int n;
		cin >> n;
		
		if(n==0) break;

		vector<int> list;
		rep(i,n){
			int tmp;
			cin >> tmp;
			list.push_back(tmp);	
		}
		sort(list.begin(),list.end());
		
		int ans=0;
		for(int k=1;k<list.size()-1;k++){
			ans+=list[k];
		}
		cout << ans/(list.size()-2) << endl;
	}
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
typedef long long D;
const int maxn=530003,mod=1000000007;
int Plus(int x,int y){return (x+=y)>=mod?x-mod:x;}
void Pluseq(int &x,int y){if((x+=y)>=mod)x-=mod;}
int Minus(int x,int y){return Plus(x,mod-y);}
void Minuseq(int &x,int y){Pluseq(x,mod-y);}
int mul(D x,int y){return x*y%mod;}
void muleq(int &x,int y){x=mul(x,y);}
int inv[maxn],n,p[maxn],ver[maxn],tot,pre[maxn],a[maxn],preinv[maxn],dp[maxn],RES,ANS;
bool vis[maxn];
void init(int u){
	if((u<<1)>n){ver[++tot]=u;return;}
	init(u<<1),init(u<<1|1);
}
void dfs(int u){
	if(u>n)return;
	int son=vis[u<<1]+vis[u<<1|1],v=vis[u<<1]*(u<<1)+vis[u<<1|1]*(u<<1|1);
	if(!son)dp[u]=a[u];
	if(son==1)dfs(v),dp[u]=dp[v];
	if(son==2){
		dfs(u<<1),dfs(u<<1|1);
		dp[u]=Plus(dp[u<<1],dp[u<<1|1]);
		Pluseq(RES,mul(mul(mul(dp[u<<1],dp[u<<1|1]),preinv[u]),preinv[u>>1]));
	}
}
int solve(int i){
	if(i>n)return 0;
	tot=0;
	init(i);
	for(int j=1;j<=tot;j++){
		int u=p[ver[j]];
		a[u]=mul(pre[ver[j]],pre[u]);
		for(;u&&!vis[u];u>>=1)vis[u]=1;
	}
	RES=0;
	dfs(1);
	for(int j=1;j<=tot;j++){
		int u=p[ver[j]];
		for(;u&&vis[u];u>>=1)vis[u]=0;
	}
	return RES;
}
int main(){
	inv[1]=1;
	for(int i=2;i<maxn;i++)inv[i]=mul(mod-mod/i,inv[mod%i]);
	scanf("%d",&n);
	n=(1<<n)-1;
	for(int i=(n>>1)+1;i<=n;i++)scanf("%d",p+i),p[i]+=(n>>1);
	pre[0]=preinv[0]=1;
	for(int i=1;i<=n;i++)pre[i]=mul(pre[i>>1],i),preinv[i]=mul(preinv[i>>1],inv[i]);
	for(int i=1;i<=n;i++){
		Pluseq(ANS,mul(mul(Minus(solve(i),Plus(solve(i<<1),solve(i<<1|1))),preinv[i]),preinv[i>>1]));
	}
	printf("%d\n",ANS);
	return 0;
}

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

int main(){
	
	int A, B, C, D;
	int time;
	cin >> A >> B >> C >> D;
	
	if( B <= C or D <= A ){
		time = 0;
	}else{
		time = min( B, D ) - max( A, C );
	}
	
	cout << time << endl;
	
	return 0;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 60, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  ;
  cin >> N;
  va.resize(N);
  rep(i, 0, N - 1) { cin >> va[i]; }
}
void solve() {
  sort(all(va));
  // にぶたん？

  // debugv(va);
  int ans = 0;
  rep(i, 0, N - 1) {
    rep(j, i + 1, N - 1) {
      rep(k, j + 1, N - 1) {
        if (va[i] + va[j] > va[k] && va[i] + va[k] > va[j]) {
          ans++;
        }
        if (va[k] >= va[i] + va[j]) {
          break;
        }
      }
    }
  }
  cout << ans << endl;
}
signed main() {
  input();
  solve();
  return 0;
}


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

int main(){
	int n;
	int a;
	long int sum=0,min=1000000,max=-1000000;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		sum+=a;
		max=max<a?a:max;
		min=min>a?a:min;
		
	}
	cout<<min<<" "<<max<<" "<<sum<<endl;
	return 0;
}
	

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 200001;

int N,K,dat[MX];
bool flip = 0;

template<class T, int SZ> struct Seg {
    T seg[2*SZ], MN = 0;
    
    Seg() {
        memset(seg,0,sizeof seg);
    }
    
    T comb(T a, T b) { return a+b; } // easily change this to min or max
    
    void upd(int p, T value) {  // set value at position p
        for (seg[p += SZ] = value; p > 1; p >>= 1)
            seg[p>>1] = comb(seg[(p|1)^1],seg[p|1]); // non-commutative operations
    }
    
    void build() {
        F0Rd(i,SZ) seg[i] = comb(seg[2*i],seg[2*i+1]);
    }
    
    T query(int l, int r) {  // sum on interval [l, r]
        T res1 = MN, res2 = MN; r++;
        for (l += SZ, r += SZ; l < r; l >>= 1, r >>= 1) {
            if (l&1) res1 = comb(res1,seg[l++]);
            if (r&1) res2 = comb(seg[--r],res2);
        }
        return comb(res1,res2);
    }
};

Seg<int,1<<18> Z;
int st = 0;

void finish() {
    F0R(i,N) cout << char('A'+(flip^dat[(i+st)%N]));
    exit(0);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> K;
    string S; cin >> S;
    F0R(i,sz(S)) if (S[i] == 'B') dat[i] = 1;
    
    FOR(i,1,2*N+3) {
        if ((dat[st]^flip) == 0) dat[st] ^= 1;
        else {
            flip ^= 1;
            st = (st+1)%N;
        }
        if (K == i || ((K-i) % 2 == 0 && i > 2*N)) finish(); 
    }
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace::std;
#define all(x) (x).begin(),(x).end()
#define sax(x) cout << #x << '=' << x << endl
#define int long long

template <class T> istream& operator>>(istream &I, pair<T,T>& p) {return I >> p.first >> p.second;}
template <class T> ostream& operator<<(ostream &O, const pair<T,T>& p) {return O << p.first << ' ' << p.second;}
template <class T> istream& operator>>(istream &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void MAIN() {
        int n; cin >> n;
        set<string> sim;
        while (n--) {
                string str; cin >> str;
                sim.insert(str);
        }

        cout << sim.size();
}


signed main() { /*[J][O][L][S][K][E][Y]*/
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int t = 1;
//        cin >> t;
        while (t--) MAIN();
        return 0;
}

Measured memory_bytes: 19288
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
 
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
 
using namespace std;
 
typedef long long ll;

int main(int argc, char const *argv[])
{
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n){
    cin >> a[i];
  }
  sort(ALL(a));
  cout << a[n-1]-a[0] << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[2][3];

int main(){
    int n;
    scanf(" %d",&n);
    for(int i = 0; i < 3;++i) scanf(" %d",&dp[0][i]);
    for(int i = 1; i < n;++i){
        for(int j = 0; j < 3;++j){
            ll va; scanf(" %lld",&va);
            int bef = j - 1, af = j + 1;
            if(bef < 0) bef += 3;
            if(af == 3) af = 0;
            dp[1][j] = max(dp[0][bef],dp[0][af]);
            dp[1][j] += va;
        }
        memcpy(dp[0],dp[1],sizeof(dp[0]));
        memset(dp[1],0,sizeof(dp[1]));
    }
    printf("%lld\n",max(dp[0][0],max(dp[0][1],dp[0][2])));
    return 0;
}


Measured memory_bytes: 256
open System.Collections.Generic

type Scanner() = class
    let mutable hold = [||]
    let mutable index = 0
    member public this.Next() =
        if hold.Length > index
        then 
            index <- index + 1
            hold.[index - 1]
        else
            let mutable st = stdin.ReadLine()
            while st = "" do st <- stdin.ReadLine()
            hold <- st.Split(' ')
            if hold.Length = 0
            then
                this.Next()
            else
                index <- 1
                hold.[index - 1]
            
    member public this.NextI32() =
        this.Next() |> int

    member public this.ArrayI32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI32()|]

    member public this.NextI64() =
        this.Next() |> int64
    
    member public this.ArrayI64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI64()|]

    member public this.NextF32() =
        this.Next() |> float32
    
    member public this.ArrayF32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF32()|]

    member public this.NextF64() =
        this.Next() |> double
    
    member public this.ArrayF64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF64()|]

    member public __.Tuple2Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 2 |> fun x -> x.[0], x.[1]|]
    
    member public __.Tuple3Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 3 |> fun x -> x.[0], x.[1], x.[2]|]

    member public __.CountDic n (f : unit -> 'a) =
        let seqs = seq {for _ in 0 .. n - 1 -> f()}
        let dic = new Dictionary<'a, int64>();
        for i in seqs do
            if dic.ContainsKey(i)
            then dic.[i] <- dic.[i] + 1L
            else dic.Add(i, 1L)
        dic

end

[<EntryPoint>]
let main _ =
    let scanner = Scanner()
    let n = scanner.NextI32()
    let k = scanner.NextI32()
    let dicAdd (dic:Dictionary<int, int>) x =
        if dic.ContainsKey(x)
        then
            dic.[x] <- dic.[x] + 1
        else
            dic.Add(x, 1)
        dic

    let ar = 
        seq {for _ in 1..n -> scanner.NextI32()}
        |> Seq.fold dicAdd (new Dictionary<int, int>())
        |> Seq.map (fun x -> x.Value)
        |> Seq.sortDescending
        |> Seq.toArray
    if Array.length ar < k
    then
        0
    else
        ar
        |> Array.skip k
        |> Array.sum
    |> printfn "%i"
    0


Measured memory_bytes: 42484
#include <bits/stdc++.h>
using namespace std;
 
const int width=100001;
int main(){
  int n;
  cin >> n;
  vector<int>ans(width,0);
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    ans.at(a)++;
  }
  long long answer=0;
  for(int i=0;i<width;i++){
    answer+=i*ans.at(i);
  }
  int q;
  cin >> q;
  for(int i=0;i<q;i++){
    int b,c;
    cin >> b >> c;
    int dif=0;
    if(ans.at(b)>0){
      ans.at(c)+=ans.at(b);
      dif=(c-b)*ans.at(b);
      ans.at(b)=0;
    }
    answer+=dif;
    cout << answer << endl;
  }
}


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

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

using namespace std;

int main() {
	int n,b;
	int cnt = 1;
	int ans = 0;
	cin >> n >> b;
	vector<int> N(n);
	
	rep(i, n) {
		cin >> N.at(i);
	}

	rep(i, n) {
		
		ans += N[i];
		if (ans <= b) {
			cnt++;
		}
	}
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 256
from sys import stdin
from collections import Counter
N = int(stdin.readline().rstrip())
S = []
for i in range(N):
    s = (stdin.readline().rstrip())
    S.append(s)

c = Counter(S)
print("AC x " + str(c["AC"]))
print("WA x " + str(c["WA"]))
print("TLE x " + str(c["TLE"]))
print("RE x " + str(c["RE"]))

Measured memory_bytes: 16496
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin>>n;
  
  int a,b;
  if(n==1) cout<<"Hello World"<<endl;
  else{
    cin>>a>>b;
    cout<<a+b<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define int long long
 
int32_t main()
{
  int a;int v1;
  int b;int v2;
  cin>>a>>v1;
  cin>>b>>v2;
  int tim;
  cin>>tim;
  
  int fina=a+v1*tim;
  int finb=b+v2*tim;
  int fina1=a-v1*tim;
  int finb1=b-v2*tim;
  
  if((a<=b && fina>=finb)||(a>=b && fina1<=finb1))
  cout<<"YES"<<endl;
  else
  cout<<"NO"<<endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

template <class T>
T mult(T n,T m){
	if(m==0) return 1;
	if(m==1){
		return n%mod;
	}else if(m%2==0){
		T t=mult(n,m/2);
		return (t*t)%mod;
	}else{
		T t=mult(n,m-1);
		return (t*n)%mod;
	}
}

vector<ll> d1(200010),d2(200010);
template <class T>
void make_table(T N){
	for(ll i=0;i<=N;i++){
		if(i==0){
			d1[i]=1;
			d2[i]=1;
		}else{
			d1[i]=(i*d1[i-1])%mod;
			d2[i]=mult(d1[i],mod-2);
		}
	}
}

template <class T>
T comb_mod_2(T n,T k){
	if(n<k) return 0;
	return (((d1[n]*d2[n-k])%mod)*d2[k])%mod;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<int> a(n+2);
	map<int,int> cnt;
	int tar;
	FOR(i,1,n+2){
		cin>>a[i];
		cnt[a[i]]++;
	}
	for(auto itr:cnt){
		if(itr.se==2){
			tar=itr.fi;
			break;
		}
	}
	ll l=-1,r;
	FOR(i,1,n+2){
		if(a[i]==tar){
			if(l==-1) l=i;
			else r=i;
		}
	}
	make_table(200010);
	FOR(k,1,n+2){
		ll ans=comb_mod_2(n+1,k)-comb_mod_2(n+l-r,k-1);
		ans=(ans+mod)%mod;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 11388
# -*- coding: utf-8 -*-
import copy
n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
orig_a = copy.copy(a)
a.sort(reverse=True)
max_a = a[0]
semi_max_a = a[1]

if max_a == semi_max_a:
    for i in range(n):
        print(semi_max_a)
else:
    for i in range(n):
        if orig_a[i] == max_a:
            print(semi_max_a)
        else:
            print(max_a)

Measured memory_bytes: 14588
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#define ll long long
using namespace  std;
int gcd(int a,int b)
{
	int r,t;
	if(a<b)
	{
		t=a;
		a=b;
		b=t;
	}
	while(r=a%b,r!=0)
	{
		a=b;
		b=r;
	}
	return b;
}
int main()
{
	int n;
	int w,ans,sum=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			for(int k=1;k<=n;k++)
			{
				w=gcd(i,j);
				ans=gcd(w,k);
				sum+=ans;
			}
		}
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    ll n; cin >> n;
    string s;
    cin >> s;
    ll  ans = 0;
    rep(i, n-1)
    {
        map<char, ll> mp; ll a = 0;
        for(ll j = 0; j <= i; j++) mp[s[j]]++;
        for(ll j = i+1; j < n; j++) if(mp[s[j]]) a++, mp[s[j]] = 0;
        ans = max(ans, a);
    }
    cout << ans;
}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int n, m;
	cin >> n >> m;
	if (n >= 3 && m >= 3) {
		print((n - 2)*(m - 2));
		return 0;
	}
	else if (n == 2 || m == 2) {
		print("0");
		return 0;
	}
	else if (n == 1 || m == 1) {
		int maxx = max(n, m);
		if (maxx == 1) {
			print("1");
			return 0;
		}
		else print(maxx - 2);
	}
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;

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

Node *root, *NIL;

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;
	
	z = (Node *)malloc(sizeof(Node));
	z->key   = k;
	z->left  = NIL;
	z->right = NIL;
	
	while(x != NIL) {
		y = x;
		if(z->key < x->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
	
	z->parent = y;
	if(y == NIL) {
		root = z;
	} else {
		if( z->key < y->key) {
			y->left = z;
		} else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if(u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(Node *u) {
	if(u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}
	
int main(void) {
	int n, i, x;
	string com;
	scanf("%d",&n);
	
	for(i=0;i<n;i++) {
		cin >> com;
		if(com == "insert") {
			scanf("%d",&x);
			insert(x);
		} else if(com == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}

	return 0;
}

/*
8
insert 30
insert 88
insert 12
insert 1
insert 20
insert 17
insert 25
print
*/


Measured memory_bytes: 26764
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  vector<tuple<string, int, int>> v;
  for(int i = 0; i < n; i++) {
    string s; int p;
    cin >> s >> p;
    v.emplace_back(s, -p, i);
  }
  sort(begin(v), end(v));
  for(int i = 0; i < n; i++) {
    cout << get<2>(v[i]) + 1 << "\n";
  }

  return 0;
}


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

class Main{
    public static void main(String args[])throws IOException{
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
          double X = Double.parseDouble(br.readLine());
          double tmp = 100.0;
          int count = 0;

          do{
            tmp = tmp * 1.01;
            tmp = Math.floor(tmp);
            count++;
          }while(X > tmp);
          
          System.out.println(count);

        }
    }
}

Measured memory_bytes: 33188
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define all(x) x.begin(),x.end()
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define sll set<ll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define endl "\n"
const ll maxn = 2e5+2;

int main()
{
    fastio;
    ll i, j, k, n, u, v, t=0;
    ll a[maxn];
    memset(a,0,sizeof(a));

    cin>>n;
    for ( i = 1; i < 101; i++)
    {
        for ( j = 1; j < 101; j++)
        {
            for ( k = 1; k < 100; k++)
            {
                a[i*i+j*j+k*k+i*j+j*k+i*k]++;
            }
        }
    }
    for ( i = 1; i <= n; i++)
    {
        cout<<a[i]<<endl;
    }
        

        
    return 0;
}

Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n), D(n);
  for (size_t i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (size_t i = 0; i < n; i++) {
    cin >> y[i];
    D[i] = abs(x[i] - y[i]);
  }

  cout << fixed << setprecision(10);

  cout << accumulate(D.begin(), D.end(), 0L) << endl;
  cout << sqrt(accumulate(D.begin(), D.end(), 0L, [&](long acc, int elem) {
    return acc + pow(elem, 2);
  })) << endl;
  cout << pow(accumulate(D.begin(), D.end(), 0L,
                         [&](long acc, int elem) { return acc + pow(elem, 3); }),
              1.0 / 3.0)
       << endl;
  cout << *max_element(D.begin(), D.end()) << endl;
}



Measured memory_bytes: 3472
#include<stdio.h>
#define MAX 100000

 typedef struct {
  int parent;
  int left;
  int right;
}Tree;

Tree a[MAX];

int getDepth(int);

int main(){
  int i,j,n;
  int num,deg,child,k = 0;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    a[i].parent = -1;
    a[i].left = -1;
    a[i].right = -1;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&num,&deg);

    for(j=0;j<deg;j++){
      scanf("%d",&child);
      if(j==0) a[num].left=child;
      else a[k].right=child;
      k=child;
      a[child].parent=num;
    }
  }

  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, depth = %d",i,a[i].parent,getDepth(i));

    if(getDepth(i) == 0){
      printf(", root, [");
    }
    else if(a[i].left == -1){
      printf(", leaf, [");
    }
    else{
      printf(", internal node, [");
    }

    j=a[i].left;

    while(j != -1){
      printf("%d", j);
      j = a[j].right;

      if(j != -1){
    printf(", ");
      }
    }
    printf("]\n");
  }

  return 0;
}
int getDepth(int num){
   int depth = 0;

  while(a[num].parent != -1){
    num = a[num].parent;
    depth++;
  }
return depth;
}



Measured memory_bytes: 2900
// 

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

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

    vector< pair<int, int> > W(n);

    for (int i = 0; i < n; i++) {
        cin >> W[i].second >> W[i].first;
    }

    sort(W.begin(), W.end());
    
    int time = 0;
    for (int i = 0; i < n; i++) {
        time += W[i].second;
        if (time > W[i].first) {
            cout << "No" << endl;
            return 0;
        }
        //cout << W[i].second << " " << W[i].first << endl;
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 1920
using System;
using System.Linq;
using System.Collections.Generic;

class Program {
  static void Main(string[] args) {
    int n = int.Parse(Console.ReadLine());
    int ans = 0, hb = 0, ta = 0, ab = 0;
    
    for (int i = 0; i < n; i++) {
      var t = Console.ReadLine();

      for (int j = 0; j < t.Length - 1; j++) {
        if (t[j] == 'A' && t[j + 1] == 'B') {
          ans++;
        }
      }

      if (t[0] == 'B' && t[t.Length - 1] == 'A') {
        ab++;
      } else if (t[0] == 'B') {
        hb++;
      } else if (t[t.Length - 1] == 'A') {
        ta++;
      }
    }

    /*if (ab > 1) {
      ans += (ab - 1);
      ab = 1;
    }

    int m = Math.Min(hb, ta);
    ans += m;
    hb -= m;
    ta -= m;

    if (hb > 0 && ab == 1) {
      ans++;
    } else if (ta > 0 && ab == 1) {
      ans++;
    }*/

    int t2 = Math.Min(ab, hb);
    ans += t2;
    ab -= t2;

    t2 = Math.Min(ab, ta);
    ans += t2;
    ab -= t2;

    if (ab > 1) {
      ans += (ab - 1);
      ab = 1;
    }

    int m = Math.Min(hb, ta);
    ans += m;
    hb -= m;
    ta -= m;

    if (hb > 0 && ab == 1) {
      ans++;
    } else if (ta > 0 && ab == 1) {
      ans++;
    }

    Console.WriteLine(ans);
  }
}


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int s, w; cin>>s>>w;
    printf(w >= s ? "unsafe\n" : "safe\n");
}



Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Registration | diff Registration.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Registration.cpp && ./a.out

/*
 
 5/10/2020
 
 5:00-
 
 */

string S,T;
void solve() {
  bool res=T.substr(0,SZ(S))==S;
  cout<<(res?"Yes":"No")<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>S>>T;
  solve();
  
  return 0;
}


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


int main(){

  ll a,b;
  cin>>a;
	
  cout<<(a+a*a+a*a*a)<<endl;

}


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

int main(void){
    int n;
    cin >> n;
    vector<int> prob(n);
    for(int i=0;i<n;i++) cin >> prob[i];
    sort(prob.begin(),prob.end());

    cout << prob[n/2] - prob[n/2-1] << endl;
}

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

using namespace std;

typedef long long ll;

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


	int n;
	cin >> n;

	vector<int> p(n);

	int cnt = 0;
	rep(i, n){
		cin >> p[i];
		if(p[i] != (i+1)) cnt++;
	}

	if(cnt == 0 || cnt == 2){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
program abc159f
  integer :: n, s, i, ans=0, m=998244353, a(3000), dp(0:3000)=0
  read *, n, s, a(:n)
  do i = 1,n
     dp(0) = i
     dp(a(i):s) = mod(dp(a(i):s)+dp(:s-a(i)),m)
     ans = mod(ans+dp(s),m)
  end do
  print *, ans
end program abc159f


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $n);
$inputs = explode(' ', trim(fgets(STDIN)));
#var_dump([$n, $inputs]);

$even = [];
foreach ($inputs as $input) {
    if ($input % 2 === 0) {
        $even[] = $input;
    }
}

#var_dump($even);
$tmp = array_filter($even, function ($v) { return $v % 3 !== 0;});
#var_dump($tmp);
$tmp = array_filter($tmp, function ($v) { return $v % 5 !== 0;});
#var_dump($tmp);

echo count($tmp) == 0 ? "APPROVED" : "DENIED";

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    string ans = "No";
    if (N == M)
        ans = "Yes";
    cout << ans << endl;
 //   system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll a[3][3];
int main(){
	rep(i,0,3)rep(j,0,3)scanf("%lld",&a[i][j]);
	rep(i,0,2)rep(j,0,3)a[i][j]-=a[i+1][j];
	rep(i,0,3)rep(j,0,2)a[i][j]-=a[i][j+1];
	puts(!a[0][0]&&!a[0][1]&&!a[1][0]&&!a[1][1]?"Yes":"No");
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

vector<int> v[100001];
int c[100001], s[100001];
map<int, map<int, int> > mp;

int solve(int p, int cost) {
  if(s[p] && c[p] != cost) {
    return 0;
  }
  if(s[p]) return 1;
  s[p] = 1;
  c[p] = cost;
  rep(i, 0, v[p].size()) {
    if(!solve(v[p][i], cost + mp[p][v[p][i]])) return 0;
  }
  return 1;
}

signed main() {
  int n, m;
  cin >> n >> m;
  rep(i, 0, m) {
    int l, r, d;
    cin >> l >> r >> d;
    v[l].pb(r);
    v[r].pb(l);
    mp[l][r] = d;
    mp[r][l] = -d;
  }
  rep(i, 0, n) {
    if(!s[i]) {
      if(!solve(i, 0)) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 50432
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define all(x) x.begin(),x.end()
#define rep(i,m,n) for(int i=m ; i<n ; i++)
#define forr(i,m,n) for(int i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define pff push_front
#define re return
const int N = 1e5 + 5;
const ll mod=int(1e9)+7;
using namespace std;
int main()
{
    IO;
    ll x,y,a[210]={};
    a[0]=300000,a[1]=200000,a[2]=100000;
    cin>>x>>y;
    x--,y--;
    if(x==y && y==0){
        cout<<a[x]+a[y]+400000;
    }
    else{
        cout<<a[x]+a[y];
    }



}


Measured memory_bytes: 256