akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

int n;
set <int> S;

int main()
{
	scanf("%d", &n);
	while (n--) {
		int x; scanf("%d", &x);
		if (S.find(x) != S.end()) S.erase(x);
		else S.insert(x);
	}
	printf("%d\n", S.size());
	return 0;
}

Measured memory_bytes: 4864
//-------------------------------------------
//-               Train Fare                -
//-                                         -
//-       autumn_eel niha katemasen!        -
//-------------------------------------------



#include<iostream>
#include<functional>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;

void reader(int *x) {
	int k = getchar_unlocked(); *x = k - '0';
	while (true) {
		k = getchar_unlocked();
		if (k < '0' || k > '9') break;
		*x = ((*x) << 1) + ((*x) << 3) + k - '0';
	}
}
void writeln(int x) {
	int s = 0; char f[10];
	while (x) {
		f[s++] = x % 10;
		x /= 10;
	}
	if (!s) f[s++] = 0;
	while (s--) putchar_unlocked(f[s] + '0');
	putchar_unlocked('\n');
}
#pragma warning(disable:4996)
int n, m, q, a[200003], b[200003], c[200003], d[200003], e[100003], dist[100003], E[200003];
vector<pair<int, int> > z[100003]; vector<int> x[100003];
vector<int>D[100003];
int main() {
	reader(&n); reader(&m); reader(&q);
	fill(d, d + m + 1, 1 << 30);
	for (int i = 1; i <= m; i++) reader(&a[i]), reader(&b[i]);
	for (int i = 1; i <= q; i++) reader(&c[i]), d[c[i]] = i;
	for (int i = 1; i <= m; i++) {
		x[a[i]].push_back(b[i]);
		x[b[i]].push_back(a[i]);
	}
	fill(dist, dist + n + 1, -1); dist[1] = 0;
	queue<int> Q1; Q1.push(1);
	while (!Q1.empty()) {
		int a1 = Q1.front(); Q1.pop();
		for (int i : x[a1]) {
			if (dist[i] == -1) {
				dist[i] = dist[a1] + 1;
				Q1.push(i);
			}
		}
	}
	for (int i = 1; i <= m; i++) {
		if (dist[a[i]] > dist[b[i]]) z[a[i]].push_back(make_pair(b[i], d[i]));
		if (dist[b[i]] > dist[a[i]]) z[b[i]].push_back(make_pair(a[i], d[i]));
	}
	for (int i = 1; i <= n; i++) D[dist[i]].push_back(i);
	e[1] = (1 << 30);
	for (int i = 1; i < n; i++) {
		for (int j : D[i]) {
			for (pair<int, int>k : z[j]) {
				e[j] = max(e[j], min(e[k.first], k.second));
			}
		}
	}
	for (int i = 2; i <= n; i++) {
		if (e[i] < 300000) E[e[i]]++;
	}
	for (int i = 1; i <= q; i++) {
		E[i] += E[i - 1];
		writeln(E[i]);
	}
	return 0;
}

Measured memory_bytes: 23288
#define DEBUG1
using System;
namespace HelloWorldApplication
{
   class HelloWorld
   {
     public static void Main(string[] args)
	{
            int[] volume;
            Boolean[] isRed;
            int N, M, x, y,i,k,count;
            String[] input;
            input=Console.ReadLine().Split(' ');
            N = Convert.ToInt32(input[0]);
            volume = new int[N];
            isRed = new bool[N];
            isRed[0] = true;
            volume[0]=1;

            for(i=1;i<N;i++)
            {
                volume[i] = 1;
                isRed[i] = false;
            }

            M = Convert.ToInt32(input[1]);
            for(i=0;i<M;i++)
            {
                input = Console.ReadLine().Split(' ');
                x = Convert.ToInt32(input[0])-1;
                y = Convert.ToInt32(input[1])-1;

                volume[x] -= 1;
                volume[y] += 1;
                if(isRed[x]==true)
                {
                    isRed[y] = true;
                }
                if (volume[x] == 0)
                {
                    isRed[x] = false;
                }
#if DEBUG
                for(k=0;k<N;k++)
                {
                    Console.Write(isRed[k]+"\t");
                }
                Console.WriteLine();
                for(k=0;k<N;k++)
                {
                    Console.Write(volume[k]+"\t");
                }
                Console.WriteLine();   
                Console.WriteLine();             
#endif                
            }
            count=0;
            for(i=0;i<N;i++)
            {
                if(isRed[i]==true)
                    count+=1;
            }
            Console.WriteLine(count);

        }
   }
}

Measured memory_bytes: 17360
#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; }

int main() {
  int N, K;
  cin >> N >> K;
  cout << N-K+1 << endl;
  return 0;
}

Measured memory_bytes: 256
require 'pp'

names={
	"M"=>0,
	"R"=>0,
	"A"=>0,
	"C"=>0,
	"H"=>0
}
N,d=gets.chomp.split(' ').map{|n| n.to_i}
0.upto(N-1){|i|
	name=gets.chomp.split('').map{|n| n}
	n = name[0]
	names[n].nil? ? names[n]=1 : names[n]+=1
}
names_num = [
	names["M"],
	names["R"],
	names["A"],
	names["C"],
	names["H"]
]
sum = 0
0.upto(4){|i|
	(i+1).upto(4){|j|
		(j+1).upto(4){|k|
			sum += names_num[i]*names_num[j]*names_num[k]
		}
	}
}
puts sum



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
vector<string> v[11];
int main(){
    cin>>n;
    v[1].push_back("a");
    FOR(i,2,n+1){
        REP(j,v[i-1].size()){
            char t='a';
            REP(k,v[i-1][j].size()){
                t=max(v[i-1][j][k],t);
            }
            for(char s='a';s<=t+1;s++){
                v[i].push_back(v[i-1][j]+s);
                //cout<<i<<" "<<j<<" "<<s<<" "<<v[i-1][j]+s<<endl;
            }
        }
    }
    sort(v[n].begin(),v[n].end());
    REP(i,v[n].size())cout<<v[n][i]<<endl;
    return 0;
}

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

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds; 
 
typedef long long int ll;
typedef long int li;

const ll mod = 1000000007;
const ll inf = 1000000000000000000;

typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vli> vvli;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef map<ll, ll> mll;
typedef map<ll, string> mls;
typedef map<string, ll> msl;
typedef pair<ll, ll> pll;

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#pragma GCC optimize ("-O3")
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(), v.end()
#define mini(a) *min_element(all(a))
#define maxi(a) *max_element(all(a))
#define tol(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define tou(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define FOR(i, j, k, in) for(li i=j; i<k; i+=in)
#define RFOR(i, j, k, de) for(li i=j; i>=k; i-=de)
#define rep(i,j,k) FOR(i, j, k, 1)
#define rrep(i,j,k) RFOR(i, j, k, 1)
#define repc(v) for(auto it=v.begin(); it!=v.end(); it++)
#define rrepc(v) for(auto it=v.rbegin(); it!=v.rend(); it--)
#define T ll t; cin>>t; while(t--)

ll gen(){
    ll temp;
    cin>>temp;
    return temp;
}

ll power(ll a, ll b, ll m){    
    ll res=1;
    while(b>0){
        if(b&1){
            res=(res*a)%m;
            b--;
        }
        a=(a*a)%m;
        b=b>>1;
    }
    return res;
}

ll gcd(ll a, ll b){if(a==0)return b; else return gcd(b%a, a);}
ll lcm(ll a, ll b){return (a*b)/gcd(a,b);}

#define inpt(v) generate(all(v),gen)
#define sum(v) accumulate(all(v),0LL)
#define vpll vector<pll>
#define umap unordered_map
#define uset unordered_set
#define print(v) rep(i,0,n) cout<<v[i]<<" ";

int32_t main(){
  FAST

    ll n;
    cin>>n;
    vll v(n); inpt(v);

    ll stool = 0;
    rep(i,1,n){
        if(v[i] < v[i-1]){
            stool += v[i-1] - v[i];
            v[i] = v[i-1];
        }
    }    
    cout<<stool;

  
  return 0;
}

Measured memory_bytes: 4764
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());

	if (s < t) cout << "Yes" << "\n";
	else cout << "No" << "\n";

	return 0;
}

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

using namespace std;


#define PI 3.14159265
#define int long long



main(){


	int n; cin >> n;

	vector <long double> v(n);

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

	sort(v.begin(), v.end());


	long double current = v[0];

	for(int i = 1; i < n; i++){
		current = (current + v[i]) / 2;
	}


	cout << fixed << setprecision(8) << current << endl;
	

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int a[100010];
    rep(i, N) cin >> a[i];
    int ans = 0;
    rep(i, N) {
        if (a[i] == i + 1) {
            ans++;
            i++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int r;
    cin >> r;
    double p = 3.1415926535;
    double ans = 2 * r * p;
    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}


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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

class CumulativeSum {
    vector<ll> numbers;
    vector<ll> sums;

public:
    CumulativeSum(int n) {
        numbers.resize(n);
        sums.resize(n);
    }

    void set(int i, ll value) {
        numbers[i] = value;
    }

    ll getSum(int i) {
        if (i == -1) return 0;
        if (i == sums.size()) return 0;
        return sums[i];
    }

    ll getSectionSum(int start, int end) {
        return getSum(end) - getSum(start - 1);
    }

    void calculate() {
        for (int i = 0; i < numbers.size(); i++) {
            sums[i] = getSum(i - 1) + numbers[i];
        }
    }

};


int main() {
    vector<bool> fact(100001, true);
    fact[0] = false;
    fact[1] = false;
    for (int i = 2; i <= 100000; i++) {
        if (!fact[i]) continue;
        for (int j = 2; i * j <= 100000; j++) {
            fact[i * j] = false;
        }
    }

    auto is_like2017 = [&](ll i) {
        return fact[i] && fact[(i + 1) / 2];
    };

    CumulativeSum cs(100001);
    rep(i, 100001) if (is_like2017(i)) cs.set(i, 1);
    cs.calculate();

    int q;
    cin >> q;
    rep(i, q) {
        int l, r;
        cin >> l >> r;
        cout << cs.getSectionSum(l, r) << endl;
    }


}

Measured memory_bytes: 2176
data Place = Place Int Int Int deriving (Eq,Ord,Show)
data Data = Data Place Int deriving (Eq,Show)
instance Ord Data where
	compare (Data a b) (Data c d) = compare a c

readData :: String -> Data
readData = (\[b,f,r,v] -> Data (Place b f r) v).map (read :: String->Int).words

quickSort :: (Ord a) => [a]->[a]
quickSort [] = []
quickSort xs = (smallerOrEqual xs) ++ [head xs] ++ (larger xs)
	where
	smallerOrEqual xs = quickSort $ filter (<= head xs) (tail xs)
	larger xs = quickSort $ filter (> head xs) xs

addData :: Data->Data->Data
addData (Data x a) (Data y b) = Data x (a+b)

takePlace :: Data->Place
takePlace (Data x _) = x

calcData :: [Data]->[Data]
calcData [] = []
calcData [x] = [x]
calcData (x:y:xs)
	|(takePlace x)/=(takePlace y) = x : calcData (y:xs)
	|(takePlace x)==(takePlace y) = calcData $ (addData x y):xs

placem :: [Place]
placem = [Place b f r|b<-[1..4],f<-[1..3],r<-[1..10]]

punct :: Place->String
punct (Place f b r)
	|r==1&&b==1&&f>1 = "\n" ++ (take 20 $ repeat '#') ++ "\n"
	|r==1&&f>1 = "\n"
	|r==1&&b>1 = "\n"
	|otherwise = ""

printData :: [Place]->[Data]->String
printData [] _ = []
printData (x:xs) [] = (punct x) ++ " " ++ "0" ++ printData xs []
printData (x:xs) yys@((Data y v):ys)
	|x==y = (punct x) ++ " " ++ (show v) ++ printData xs ys
	|x/=y = (punct x) ++ " " ++ "0" ++ printData xs yys
	
main = getContents >>= putStrLn.(printData placem).calcData.quickSort.map readData.tail.lines

Measured memory_bytes: 4236
#include<iostream>
#include <vector>
using namespace std;
const int INVALID = -2;
enum node_type {
	root=0,
	internal_node,
	leaf
};
const char * typemsg[3] = {"root","internal node","leaf"};
class tree{
public:
	vector<int> children;
	int parent;
	int depth;
	int type;	//0:root,1:internal node, 2:leaf
	tree():parent(-1),depth(INVALID),type(1){
	}
	void print(){
		//parent = -1, depth = 0, root, [1, 4, 10]
		//parent = 1, depth = 2, leaf, []
		cout << "parent = " << parent << ", depth = " << depth << ", " << typemsg[type]
		 << ", [";
		for(int i=0;i<(int)children.size();++i) {
			if (i>0){ 
				cout << ", ";
			}
			cout  << children.at(i);
		}
		cout << "]";
	}
};

void InputSet(std::vector<int> & a) {
	int n;
	cin >> n;
	a.resize(n,0);
	for(int i=0;i<n;++i) {
		cin >> a.at(i);
	}
}
void TraverseSetDepth(vector<tree> & T,int idx,int depth){
	vector<int> & children = T[idx].children;
	for(int i=0;i<(int)children.size();++i){
		T[children[i]].depth = depth;
		TraverseSetDepth(T,children[i],depth+1);
	}
}

int main(){
	vector<tree> T;
	int n,k;
	cin >> n;
	T.resize(n);
	for(int i=0;i<n;++i) {
		cin >> k;
		InputSet(T[k].children);
		vector<int>&children = T[k].children;
		if (children.size()==0) {
			T[k].type = leaf;
		}
		else {
			for(int j=0;j<(int)children.size();++j){
				T[children[j]].parent = k;
			}
		}
	}
	for(int i=0;i<n;++i) {
		if (T[i].parent == -1){
			T[i].type = root;
			T[i].depth = 0;
			TraverseSetDepth(T,i,1);
			break;
		}
	}
	for(int i=0;i<n;++i) {
		//node 0: parent = -1, depth = 0, root, [1, 4, 10]
		cout << "node " << i << ": ";
		T[i].print();
		cout << std::endl;
	}
}

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

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

	int a[100010],b[100010];
	for(int i=0;i<n;++i){
		cin>>a[i];
		cin>>b[i];
	}

	int Max = 0;
	for(int i=0;i<n;++i){
		Max = max(a[i],Max);
	}
	int rec;
	for(int i=0;i<n;++i){
		if(a[i] == Max)rec = b[i];
	}

	//全部でかい順に投げてみる
	long long sum = 0;
	int x;
	sort(b,b+n,greater<int>());
	for(x=0;x<n;++x){
		if(Max >= b[x])break;
		sum += b[x];
		if(sum >= h){
			++x;
			break;
		}
	}
	//cout<<sum<<" "<<x<<"  ";
	//さて、剣が足りないようだ
	if(sum < h){
		while(true){
			sum += Max;
			++x;
			if(sum >= h)break;
		}
		//cout<<Max<<" "<<rec<<" "<<x<<endl;
		cout<<x<<endl;
	}
	//else cout<<Max<<" "<<rec<<" "<<x<<endl;
	else cout<<x<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
#define lld  double
#define pb push_back
#define mp make_pair
#define Maxn 1007
#define ff first
#define ss second
#define inf 100000000
using namespace std;
vector <ll> vi;
int main(){
    ll x,y,k,i,cnt=0,a,z;
    cin>>x>>y>>k;
    a=min({x,y});
    for(i=a;i>=0;i--){
        if((x%i==0) && (y%i==0)){
            cnt=cnt+1;
        }
        if(cnt==k){
             z=i;
            break;
            
        }
    }
    cout<<z;
}


Measured memory_bytes: 256
// Winners don't quit and Quitters don't win
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mod 998244353
#define MAX 100005
int spf[10000005];
 
ll fac_(ll n){
	ll i,c,j,s=1;
	map <ll,ll> m;
	map <ll,ll> :: iterator it;
	while(n!=1){
		m[spf[n]]++;
		n/=spf[n];
	}
 
	for(it=m.begin();it!=m.end();++it){
		s*=(it->second+1);
	}
	return s;
}
 
void colse(ll n){
	ll i,j;
	for(i=1;i<=n;++i){
		spf[i]=i;
	}
	for(i=4;i<=n;i+=2){
		spf[i]=2;
	}
	for(i=3;i*i<=n;i+=2){
		if(spf[i]==i){
			for(j=i*i;j<=n;j+=i){
				if(spf[j]==j){
					spf[j]=i;
				}
			}
		}
	}
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,j,p,ans=0;
    cin>>n;
    colse(n);
    for(i=1;i<=n;++i){
    	p = fac_(i);
    	ans += i*p;
    	//cout<<i<<" "<<p<<'\n';
	}
    cout<<ans;
}

Measured memory_bytes: 42708
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define F first
#define S second
#define MP make_pair
#define PB push_back
 
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)
int main(){
	int n,l;
	rd2(n,l);
	string str;
	vector<string> ar;
	fr(i,0,n){
		cin>>str;
		ar.PB(str);
	}
	sort(ar.begin(),ar.end());
	string ans="";
	fr(i,0,ar.size())
		ans+=ar[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N,A;
    cin >> N >> A;
    N %= 500;

    cout << ( N <= A ? "Yes" : "No" ) << endl;

    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
flags = [0 for _ in range(N)]

ans = 0
pena = 0
for p, s in [input().split() for _ in range(M)]:
    p = int(p)
    if flags[p-1] is not False:
        if s == "WA":
            flags[p-1] += 1
        else:
            pena += flags[p-1]
            flags[p-1] = False
            ans += 1

print(ans, pena)

Measured memory_bytes: 32960
a, b = map(int, input().split())
# a, b = 1, 5

if int(a) < int(b):
    A = ''
    for _ in range(b):
        A += str(a)
    print(A)
else:
    B = ''
    for _ in range(a):
        B += str(b)
    print(B)


Measured memory_bytes: 2940
import itertools 

def minus(n):
    return int(n)-1

num=int(input())
p=tuple(list(map(minus,input().split())))
q=tuple(list(map(minus,input().split())))

list = list(itertools.permutations(range(num)))

print(abs(list.index(p) - list.index(q)))

Measured memory_bytes: 8052
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}

int n,k,a[202020],ans;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
	
	
		cin >> n >> k;
		for(int i=1;i<=n;i++){
			cin >> a[i];
			a[i+n]=a[i];
		}
		for(int i=1;i<=n;i++){
			int cur = 0, cnt = 0;
			for(int j=1;j<i;j++){
				if( a[j]>a[i] )cur++;
			}
			for(int j=1;j<=n;j++){
				if( a[j]>a[i] )cnt++;
			}
			int kk = (k*(k-1)/2)%mod;
			ans = ( ans + (k*cur%mod + kk*cnt%mod)%mod )%mod;
		}

		cout << ans << 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;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<string> vec(n);
    rep(i,n){
        cin >> vec[i];
    }
    bool ans=true;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(vec[i]==vec[j]){
                ans=false;
            }
        }
        string a=vec[i],b=vec[i+1];
        if(a[a.size()-1]!= b[0] ) ans=false;
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

int main(){
  int t;
  cin>> t ;
  for(int i=0;i<t;i++){
    int n,k,s;
    cin>> n >> k;
    int a[n];
    for(int j=0;j<n;j++){
      cin>> a[j];
    }

    int b[n-1];
    for (int j=0;j<n-1;j++){
      b[j]=a[j+1]-a[j];
    }
    
    sort(b,b + n-1);
    s=a[n-1]-a[0];
    
    if(k>=n){
      s = 0;
    }else{
      for(int j=1;j<=k;j++){
	if(j!=1){
	  s-=b[n-j];
	}
      }
    }

    if(n!=0 && k!=0){
      cout << s << endl;
    }
  }
}
    

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 200005;

int k, n, tab[N], res, i;

int main() {
scanf("%d %d", &k, &n);
for (i=0;i<n;i++) scanf("%d", &tab[i]);
res = k;
for (i=0;i<n - 1;i++) res = min(res, k - (tab[i + 1] - tab[i]));
res = min(res, tab[n - 1] - tab[0]);
printf("%d\n", res);
return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define inf 0x3fffffff
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n,m,a[10];
int main(){
	cin>>n>>m;
	int x,y;
	memset(a,-1,sizeof a);
	int flg=0;
	for(int i=1;i<=m;i++){
		cin>>x>>y;
		if(a[x]==-1)a[x]=y;
		else if(a[x]!=y)flg=1;
	}
	if(flg||n>1&&a[1]==0)puts("-1");
	else{
		if(n==1&&a[1]==-1)puts("0");
		else{
			if(a[1]==-1)a[1]=1;
			if(a[2]==-1)a[2]=0;
			if(a[3]==-1)a[3]=0;
			for(int i=1;i<=n;i++)cout<<a[i];
			puts("");
		}
	}
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<long long,long long> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1LL<<59)

#define int ll

signed main(){
    int n;
    cin>>n;
    vector<pii> v(n);
    rep(i,n){
        int a,b;
        cin>>a>>b;
        if(a>b)swap(a,b);
        v[i] = pii(a,b);
    }
    
    sort(all(v));
    int mini = v[0].first;
    int maxi = 0;
    rep(i,n)maxi = max<ll>(maxi,v[i].second);
    
    int ans = INF;
    
    multiset<int> ms1,ms2;
    rep(i,n){
        ms1.insert(v[i].first);
        ms2.insert(v[i].second);
    }
    
    int l1 = *(ms1.begin()), r1 = *(ms1.rbegin());
    int l2 = *(ms2.begin()), r2 = *(ms2.rbegin());
    ans = (r1-l1)*(r2-l2);
    
    
    rep(i,n-1){
        ms1.erase(ms1.find(v[i].first));
        ms1.insert(v[i].second);
        
        ms2.erase(ms2.find(v[i].second));
        ms2.insert(v[i].first);
        
        l1 = *(ms1.begin()), r1 = *(ms1.rbegin());
        l2 = *(ms2.begin()), r2 = *(ms2.rbegin());
        ans = min(ans,(r1-l1)*(r2-l2));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 22144
def myAnswer(W:int,H:int,N:int,X:list,Y:list,A:list) -> int:
   startX = 0
   endX = W
   startY = 0
   endY = H
   for x,y,a in zip(X,Y,A):
      if(a == 1 and startX < x):
         startX = x
      elif(a == 2 and endX > x):
         endX = x
      elif(a == 3 and startY < y):
         startY = y
      elif(a == 4 and endY > y):
         endY = y
   # print(startX,endX,startY,endY)
   # return (endX - startX) * (endY - startY)
   return 0 if(startX > endX or startY > endY) else (endX - startX) * (endY - startY)

def modelAnswer():
   return
def main():
   W,H,N = map(int,input().split())
   X = []
   Y = []
   A = []
   for _ in range(N):
      x,y,a = map(int,input().split())
      X.append(x)
      Y.append(y)
      A.append(a)
   print(myAnswer(W,H,N,X,Y,A))
if __name__ == '__main__':
   main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int c=0;
 int main()
 {
 	int n,k;
 	cin>>n>>k;
 	int a[n],b[n],ans=0;
 	for(int i=0;i<n;i++)
 	{
 		cin>>a[i];
 	}
 	for(int i=0;i<n;i++)
 	{
 		b[i]=INT_MAX;
 	}
 	if(n==1)
    {
      cout<<0<<endl;
      return 0;
    }
 	b[0]=0;
 	//b[1]=abs(a[1]-a[0]);
 	for(int i=1;i<n;i++)
 	{
 		int p=max(0,i-k);
      	for(int j=p;j<i;j++)
        {
          b[i]=min(abs(a[j]-a[i])+b[j],b[i]);
        }
 	}
 	cout<<b[n-1]<<endl;
   return 0;
 }


Measured memory_bytes: 1024
#include <stdio.h>
int asiap(int x){
	if(x < 0){
		x *= -1;
	}
	return x;
}
int main(){
	
	int a,b,x;
	scanf("%d %d %d" , &x, &a, &b);
	if(asiap (x-a) > asiap (x-b)){
		printf("B");
	} 
	else{
		printf("A");
	}
	return 0;
}

Measured memory_bytes: 1648
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;

int n;
double p[3005];
double dp[3005][3005];

double solve(int k, int l) {
    if (dp[k][l] >= 0) return dp[k][l];
    
    if (k < l) dp[k][l] = 0.0;
    else if (k == 0) dp[k][l] = 1.0;
    else if (l == 0) {
        dp[k][l] = solve(k - 1, l) * (1 - p[k]);
    }
    else {
        dp[k][l] = solve(k - 1, l - 1) * p[k] + solve(k - 1, l) * (1 - p[k]);
    }
    
    return dp[k][l];
}


int main(void){
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> p[i];
    }
    
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            dp[i][j] = -1.0;
        }
    }
    
    double ans = 0.0000000000;
    for (int i = n / 2 + 1; i <= n; i++) ans += solve(n, i);
    
    cout << setprecision(10) << ans << endl;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;

/*DP使ったほうがよくない？？WOWWOW*/

int main(){
  string S; cin>>S;
  if(S.at(2)==S.at(3) && S.at(4)==S.at(5)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int a,b;
    cin>>a>>b;
    int ans = a+b;
    if(ans>23) ans-=24;
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,W,count=0;cin>>H>>W;
  char a;
  for(int i=0;i<H*W;i++){
    cin>>a;
    if(a=='#')count++;
  }
  if(count==H+W-1)cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

use std::collections::HashMap;

fn main() {
    let n: usize = read();
    let m: usize = read();
    let q: usize = read();
    let mut map: Vec<Vec<usize>> = vec![vec![0; n + 1]; n + 1];

    for _ in 0..m {
        let l: usize = read();
        let r: usize = read();
        map[l][r] += 1;
    }

    let mut acc_map: Vec<Vec<usize>> = vec![vec![0; n + 1]; n + 1];

    for i in 0..n + 1 {
        let mut sum = 0;
        for j in 0..n + 1 {
            sum += map[i][j];
            acc_map[i][j] = sum;
        }
    }

    let mut anss: Vec<usize> = vec![];
    for _ in 0..q {
        let l: usize = read();
        let r: usize = read();
        let mut ans = 0;
        for i in l..r + 1 {
            ans += acc_map[i][r] - acc_map[i][l - 1];
        }
        anss.push(ans);
    }
    for i in 0..anss.len() {
        println!("{}", anss[i]);
    }
}


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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 58;

int main() {
  int A, B, Q;
  cin >> A >> B >> Q;
  set< int64 > st, ts;
  st.emplace(INF);
  st.emplace(-INF);
  ts.emplace(INF);
  ts.emplace(-INF);

  for(int i = 0; i < A; i++) {
    int64 x;
    cin >> x;
    st.emplace(x);
  }
  for(int i = 0; i < B; i++) {
    int64 x;
    cin >> x;
    ts.emplace(x);
  }
  while(Q--) {
    int64 x;
    cin >> x;

    int64 cost = INF;

    for(int i = 0; i < 4; i++) {
      auto p = st.lower_bound(x);
      if(i & 1) --p;
      auto q = ts.lower_bound(*p);
      if(i & 2) --q;
      cost = min(cost, llabs(*p - x) + llabs(*p - *q));
    }

    for(int i = 0; i < 4; i++) {
      auto p = ts.lower_bound(x);
      if(i & 1) --p;
      auto q = st.lower_bound(*p);
      if(i & 2) --q;
      cost = min(cost, llabs(*p - x) + llabs(*p - *q));
    }
    cout << cost << endl;
  }
}


Measured memory_bytes: 10752
#include <iostream>
#include <string>
#include <vector>
#include <map>

using namespace std;

int main(){
    string s;
    cin >> s;
    map<string, string> mp;
    mp["A"] = "T";
    mp["T"] = "A";
    mp["C"] = "G";
    mp["G"] = "C";
    cout << mp[s] << endl;
    return 0;
}

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


int main(){
    int n,k;
    cin>>n>>k;
    long long a[n],sum[n+1]={},msum[n+1]={};
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum[i+1]+=sum[i]+max((long long)0,a[i]);
        msum[i+1]+=msum[i]+min((long long)0,a[i]);
    }
    long long t=-1e18,r=0;
    for(int i=0;i<k;i++){
        r+=a[i];
    }
    if(r>=0) t=max(t,msum[k]);
    else{
        t=max(t,-sum[k]);
    }
    for(int i=k;i<n;i++){
        r-=a[i-k];
        r+=a[i];
        if(r>=0) t=max(t,msum[i+1]-msum[i-k+1]);
        else{
            t=max(t,-sum[i+1]+sum[i-k+1]);
        }
    }
    cerr<<sum[n]<<" "<<t<<endl;
    cout<<sum[n]+t;
    
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
using namespace std;

int main() {
  double x1, y1, x2, y2, x, y;
  cin >> x1 >> y1 >> x2 >> y2;
  x = abs(x2 - x1);
  y = abs(y2 - y1);
  printf("%f\n", sqrt(x * x + y * y));

  return 0;
}

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

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    int na = F / (100 * A);
    double maxcon = 0.0;
    int ansW = A * 100;
    int ansS = 0;
    for (int a=0; a<=na; ++a) {
        int nb = (F - (100 * a * A)) / (100 * B);
        for (int b=0; b<=nb; ++b) {
            int nc = (a * A + b * B) * E / C;
            for (int c=0; c<=nc; ++c) {
                int nd = ((a * A + b * B) * E - (c * C)) / D;
                for (int d=0; d<=nd; ++d) {
                    int W = 100 * (a * A + b * B);
                    int S = (c * C + d * D);
                    if (W + S <= F) {
                        double con;
                        if (W+S==0) con = 0.0;
                        else con = 100.0 * S / (W+S);
                        if (maxcon < con) {
                            maxcon = con;
                            ansW = W;
                            ansS = S;
                        }
                    }
                }
            }
        }
    }
    cout << ansW + ansS << " " << ansS << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
ans=0
c=[]
x=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        c.append(i)
for i in range(len(c)-2):
    if c[i]==c[i+1]-1 and c[i+1]==c[i+2]-1:
        print('Yes')
        x=1
        break
if x==0:
    print('No')


Measured memory_bytes: 9156
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  int n;
  string s;
  cin >> n >> s;
  for (int i = 0; i < s.size(); i++) {
    int x = s[i] - 'A';
    s[i] = 'A' + (x + n) % 26;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c;
	
	scanf("%d %d %d",&a,&b,&c);
	
	if((b-a)==(c-b)){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
    int a,b;
    cin>>a>>b;
    if(a>=13)
    cout<<b;
    else if((a>5)&&(a<13))
    cout<<b/2;
    
    else cout<<0;
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main()
{
	int N;
	scanf("%d",&N);
	int ans=N;
	for(int i=0;i<=N;i++)
	{
		int num=0,t=i;
		while(t) num+=t%6,t/=6;
		t=N-i;
		while(t) num+=t%9,t/=9;
		if(num<ans) ans=num;
	}
	printf("%d\n",ans);
	return 0;
}
/*#include<cstdio>
int N,C;
int t[3][35],d[35][35];
//t[i][j]:余数为i,颜色为j的数量
int main()
{
	int ans=0x3f3f3f3f;
	scanf("%d %d",&N,&C);
	for(int i=1;i<=C;i++)
		for(int j=1;j<=C;j++)
			scanf("%d",&d[i][j]);
	for(int i=1;i<=N;i++)
		for(int j=1;j<=N;j++)
		{
			int x;
			scanf("%d",&x);
			t[(i+j)%3][x]++;
		}
	int res=0;
	for(int i=0;i<=2;i++)
		for(int j=1;j<=C;j++)//余数为i的格子全部变成颜色j
			for(int k=1;k<=C;k++)
				res+=t[i][k]*d[k][i];
}*/

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>

int n;

int main()
{
	scanf("%d",&n);
	for (int i = n ; i <= 999 ; i++) 
	{
		int ret = i,now = i % 10,flag = 0;
		while (ret)
		{
			int R = ret % 10;
			if (R != now) {flag = 1;break;}
			now = ret % 10;
			ret /= 10;
		}
		if (!flag) {printf("%d\n",i);return 0;}
	}
	return 0;
}


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

#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; 0 <= i; i--)
#define CIN(A) int A; cin >> A;
#define CIN2(A, B) int A, B; cin >> A >> B;
#define CIN3(A, B, C) int A, B, C; cin >> A >> B >> C;
#define CINVEC(A, N) vector<int> A; REP(i, N) { int a; cin >> a; A.emplace_back(a); }
#define ANS(ans) cout << (ans) << endl
#define SORT(V) sort(V.begin(), V.end())
#define RSORT(V) sort(V.rbegin(), V.rend())

#define DEBUGV(V) REP(i, V.size()) cout << V.at(i) << " "; cout << endl 

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

  int start = 0;
  REP(i, S.size()) if (S[i] == 'A') { start = i; break; }
  int end = 0;
  RREP(i, S.size()) if (S[i] == 'Z') { end = i; break; }

  ANS(end - start + 1);

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cstring>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

using namespace std;

const int N_MAX = 1000000;
int a[N_MAX];

int main(){
  int n;
  cin >> n;
  memset(a, -1, N_MAX * sizeof(a[0]));
  rep(i, 0, n) cin >> a[i];
  const int max = 2000000001;
  // node id: key = k, parent key = pk, left key = lk, right key = rk,
  rep(i, 0, n){
    int node_num = i+1;
    int key = a[i];
    int pk = a[(i-1)>>1];
    int lk = max;
    int rk = max;
    if(2*i+1 < n) lk = a[2*i+1];
    if(2*i+2 < n) rk = a[2*i+2];
    printf("node %d:", node_num);
    printf(" key = %d", key);
    if(i != 0) printf(", parent key = %d", pk);
    if(lk != max) printf(", left key = %d", lk);
    if(rk != max) printf(", right key = %d", rk);
    cout << ", " << endl;
  }
  return 0;
}



Measured memory_bytes: 7076
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

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

    int n;
    cin>>n;
    vector<vector<int>> a(4,vector<int>(13));
    vector<string> kind={"S","H","C","D"};
    for(int i=0;i<n;i++){
        string s;
        int num;
        cin>>s>>num;
        vector<string>::iterator itr= find(kind.begin(),kind.end(),s);
	    int index = distance(kind.begin(), itr);
        a[index][num-1]=1;
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(a[i][j]==0)cout<<kind[i]<<" "<<j+1<<endl;
        }
    }
    //cout<<endl;
    return 0;
}


Measured memory_bytes: 3100
from _collections import deque
from _ast import Num


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor
# https://atcoder.jp/contests/abc107/tasks/arc101_a
# C - Candles
"""
need to consider the case that ticket is not enough to lower everything
"""

H = gi()
W = gi()
m = [[0 for x in range(W)] for i in range(H + 5)]

for i in range(H):
    #print(len(m[i]), W)
    for j in range(W):
        o = gi()
        #    print(i, j, o)
        m[i][j] = o

move = 0
ops = []
for i in range(1, H):
    for j in range(0, W):
        if m[i - 1][j] % 2:
            m[i - 1][j] -= 1
            m[i][j] += 1
            move += 1
            ops.append((i, j + 1, i + 1, j + 1))

for i in range(1, W):
    if m[H - 1][i - 1] % 2:
        m[H - 1][i - 1] -= 1
        m[H - 1][i] += 1
        move += 1
        ops.append((H, i, H, i + 1))

print(move)
for op in ops:
    print(op[0], op[1], op[2], op[3])

Measured memory_bytes: 33624
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
using namespace std;
int n,E[300005],W[300005];
string s;
int main()
{
	cin>>n;
	cin>>s;
	int e=0,w=0;
	for(int i=0;i<s.size();i++)
	{
		W[i]=w;
		if(s[i]=='W')
		    w++;
	}
	for(int i=s.size()-1;i>=0;i--)
	{
		E[i]=e;
		if(s[i]=='E')
		    e++;
	}
	int ans=-1;
	for(int i=0;i<s.size();i++)
	    if(ans==-1)
	        ans=E[i]+W[i];
	    else
	        ans=min(ans,E[i]+W[i]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 2948
#1,2,3,4..... の数列を作って、それをnからひく
n = int(input())
L = list(map(int, input().split()))

j=1
for i in range(n):
  if j==L[i]:
    j+=1
 
if j==1:
  print(-1)
else:
  print(n-j+1)

Measured memory_bytes: 24744
#include <stdio.h>
int main()
{
	long long A,B;
	scanf("%ld %ld",&A,&B) ;
	long long M[][4]={{B^0,B^A,B^1,B^(A-1)},{A,1,A-1,0}};
	printf("%ld\n",M[B%2][(B-A)%4]) ;
	return 0 ;
}

Measured memory_bytes: 128
n,m,l = map(int,input().split())
n_list=[] 
m_list = []
c=[[0 for i in range(l)] for j in range(n)]
for i in range(n):
    n_list.append([int(i) for i in input().split()])
for j in range(m):
    m_list.append([int(i) for i in input().split()])
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j]+=n_list[i][k]*m_list[k][j]

for i in range(n):
    print(' '.join(str(i) for i in c[i]))


Measured memory_bytes: 6876
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        long t = scanner.nextInt();
        long a = scanner.nextInt();

        for (int i = 0; i < n - 1; i++) {
            final long tTmp = scanner.nextInt();
            final long aTmp = scanner.nextInt();

            if (t * aTmp == a * tTmp) {
                continue;
            }

            final long tDiv = (t + tTmp - 1) / tTmp;
            final long aDiv = (a + aTmp - 1) / aTmp;

            if (aTmp * tDiv > a) {
                t = tTmp * tDiv;
                a = aTmp * tDiv;
            } else {
                t = tTmp * aDiv;
                a = aTmp * aDiv;
            }
        }

        System.out.println(t + a);
    }

}


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

int line(int A[],int n,int key){
	int i = 0;
	A[n] = key;
	while(A[i]!=key){
		i++;
	}
	return i != n;
}

int main(){
	int n,A[10001],q,key,sum = 0;

	cin >> n;

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

	cin >> q;

	for(int i = 0;i < q;i++){
		cin >> key;
		if(line(A,n,key) )sum++;
	}

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 3120
N, L = gets.split.map(&:to_i)

apples = []

N.times do |i|
  apples << L + i
end

if apples[0] < 0 && apples[N-1] < 0
  ans = apples[0..-2].inject(:+)
elsif apples[0] < 0 && apples[N-1] >= 0
  ans = apples[0..-1].inject(:+)
else
  ans = apples[1..-1].inject(:+)
end

puts ans

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

#define pb push_back
#define ff first
#define ss second

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

string s;
ll ans, cnt;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> s;
	for (int i = s.size() - 1; ~i; i--)
		cnt += (s[i] == 'W'), ans += cnt * (s[i] == 'B');
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 720
N, A, B = list(map(int, input().split()))

num_ball = A + B
sets = N // (A + B)

# print(f"N:{N} A:{A} B:{B} num_ball:{num_ball} sets:{sets}")

last_balls = min(A, N % num_ball)

result = sets * A + last_balls

print(result)

Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0160
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int n = RInt();
                if (n == 0) break;

                int sum = 0;
                for (int i = 0 ; i < n ; i++)
                {
                    int[] items = RIntAr();
                    int l = items[0] + items[1] + items[2];
                    int w = items[3];

                    if (l > 160 || w > 25) continue;
                    else if (l > 140 || w > 20) sum += 1600;
                    else if (l > 120 || w > 15) sum += 1400;
                    else if (l > 100 || w > 10) sum += 1200;
                    else if (l > 80 || w > 5) sum += 1000;
                    else if (l > 60 || w > 2) sum += 800;
                    else sum += 600;
                }
                Console.WriteLine(sum);
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 22028
X,Y=map(int,input().split())

mod=10**9+7
def nCr(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

if (X+Y)%3 != 0:
      print(0)
      exit()
 
n=((2*X)-Y)//3

m=((X+Y)//3)-n

if n<0 or m<0:
    print(0)
    exit()

ans = nCr(n+m,n,mod)
print(ans)


Measured memory_bytes: 3064