akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n, m;
	cin >> n >> m;
	vector<vector<int>> gr(n, vector<int>());
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--; b--;
		gr.at(a).push_back(b);
		gr.at(b).push_back(a);
	}
	queue<pair<int, vector<bool>>> q;
	vector<bool> c(n, false);
	c.at(0) = true;
	q.push(make_pair(0, c));
	int ans = 0;
	while(!q.empty()){
		int n_i;
		vector<bool> n_c;
		tie(n_i, n_c) = q.front(); q.pop();
		bool flag = true;
		for(int j : gr.at(n_i)){
			if(n_c.at(j) == false){
				flag = false;
				vector<bool> nxc = n_c;
				nxc.at(j) = true;
				q.push(make_pair(j, nxc));
			}
		}
		if(flag == true){
			bool add = true;
			rep(i, n){
				if(n_c.at(i) == false){
					add = false;
					break;
				}
			}
			if(add == true) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  double a, b, c, d, e, f, x, y; //連立方程式の各係数

  while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
    x = (b * f - c * e) / (b * d - a * e);
    y = (c * d - a * f) / (b * d - a * e);

    if(x == -0){
      x = 0.0;
    }
    if(y == -0){
      y = 0.0;
    }

    printf("%.3f %.3f\n", x, y);
  }

  return 0;
}

Measured memory_bytes: 1236
class Dice():

    def __init__(self, label):
        self.label = label

    def north(self):
        self.change([2, 6, 3, 4, 1, 5])

    def west(self):
        self.change([3, 2, 6, 1, 5, 4])

    def east(self):
        self.change([4, 2, 1, 6, 5, 3])

    def south(self):
        self.change([5, 1, 3, 4, 6, 2])

    def change(self, convert):
        num = []
        for i in range(6):
            num.append(self.label[convert[i] - 1])
        self.label = num


def main():
    dice = Dice([int(x) for x in input().split()])
    cmd = list(input())
    for c in cmd:
        if c == 'N':
            dice.north()
        elif c == 'W':
            dice.west()
        elif c == 'E':
            dice.east()
        elif c == 'S':
            dice.south()
    print(dice.label[0])


if __name__ == '__main__':
    main()

Measured memory_bytes: 7776
#include <stdio.h>
int main(){
  char txt;
 
  while(1){
    scanf("%c",&txt);
 
    if(txt>96 && txt<123)txt-=32;
    else  if(txt>64 && txt<91)txt+=32;
 
    printf("%c",txt);
   if(txt=='\n')break;
  }
  return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n; cin >> n;
    vector<vector<int>> a(n, vector<int>(n-1));
    rep(i,n) {
        rep(j,n-1) {
            cin >> a[i][j];
            a[i][j]--;
        }
        reverse(a[i].begin(), a[i].end());
    }
    typedef pair<int, int> P;
    vector<P> que;

    auto add = [&](int i) -> void {
        if (!a[i].size()) return;
        int j = a[i].back();
        if (a[j].back() == i) {
            que.emplace_back(i,j);
            if (que.back().first > que.back().second) {
                swap(que.back().first, que.back().second);
            }
        }
    };

    rep(i,n) add(i);

    int ans = 0;
    while (que.size()) {
        ans++;
        sort(que.begin(), que.end());
        que.erase(unique(que.begin(), que.end()), que.end());
        vector<P> copy;
        swap(copy, que);
        for (auto v : copy) {
            int i = v.first, j = v.second;
            a[i].pop_back();
            a[j].pop_back();
        }
        for (auto v : copy) {
            int i = v.first, j = v.second;
            add(i);
            add(j);
        }
    }

    rep(i,n) {
        if (a[i].size()) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
using namespace std;
int main(){
    int num;
    cin >> num;
    int x[num];
    for(int i=0; i<num; i++){
        cin >> x[i];
    }
    for(int j=0; j<num-1; j++){
        for(int k=1; k<num; k++){
            if(x[j]>x[k]){
                int tmp=x[j];
                x[j]=x[k];
                x[k]=tmp;
            }
        }
    }
    cout << x[0]  << " ";
    for(int j=0; j<num-1; j++){
        for(int k=1; k<num; k++){
            if(x[j]<x[k]){
                int tmp=x[j];
                x[j]=x[k];
                x[k]=tmp;
            }
        }
    }
    cout << x[0] << " ";
    long long int sum=0;
    for(int l=0; l<num; l++){
        sum+=x[l];
    } 
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
 
#define fir first
#define sec second
using namespace std;
typedef long long LL;
typedef unsigned long long u64;
 
template <typename T> inline bool cmin(T & a, const T & b) { return a > b ? a = b, 1 : 0;}
template <typename T> inline bool cmax(T & a, const T & b) { return a < b ? a = b, 1 : 0;}
int inp() {
	int x = 0, f = 1;char ch;
	for(ch = getchar(); !isdigit(ch); ch = getchar())
		if(ch == '-') f = -1;
	for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	return x * f;
}
 
const int MaxN = 2333;
 
char a[MaxN], b[MaxN];
int n, ans = ~0U >> 1, x[MaxN], y[MaxN];
int A[MaxN], B[MaxN];
 
void solve() {
    int i, j;
    for(i = 0; i < n; i++) {
        for(A[i] = 0; b[(i + A[i]) % n] != '1'; ++A[i]);
        for(B[i] = 0; b[(i + B[i] + n) % n] != '1'; --B[i]);
    }
    for(int d = 0; d < n; d++) {
        for(i = 0; i < n; i++) x[i] = 0;
        for(i = j = 0; i < n; i++)
            if(a[i] != b[(i + d) % n]) {
                cmax(x[-B[i]], A[i] - d);
                ++j;
            }
        int L, R, res = 1e9;
        for(L = 0, R = n - 1; ~R; R--) cmin(res, L + R), cmax(L, x[R]);
        cmin(ans, 2 * res + d + j);
    }
}
 
int main() {
	int i;
	scanf("%s%s", a, b); n = strlen(a);
	if(*max_element(b, b + n) != '1') {
	    cout << (*max_element(a, a + n) != '1' ? 0 : -1) << endl;
	    return 0;
	}
	solve();
	reverse(a, a + n);
	reverse(b, b + n);
	solve();
	
	cout << ans << endl;
	return 0;
}
 

Measured memory_bytes: 256
#連想配列（Ｄｉｃｔを使った配列操作）
N = int(input())
li = []
dict1 = {}
for _ in range(N):
  li.append(int(input()))



for i in range(N):
  if str(li[i]) in dict1:
    #print("delete",li[i])
    del dict1[str(li[i])]
  else:
    #print("add",li[i])
    dict1[str(li[i])] = '0'

print(len(dict1))

Measured memory_bytes: 97652
#include<bits/stdc++.h>
	using namespace std;
	#define ll        long long
	#define  sci(x)   scanf("%d", &x)
	#define  scl(x)   scanf("%lld", &x)
	#define  scd(x)   scanf("%lf", &x)
	#define l0(i,n)   for(ll i=0; i<n; i++)
	
	int main ()
	{
		ios::sync_with_stdio(0);
		cin.tie(0);
		//CODE TONOY
		int n;
		cin>>n;
		long long ans=0;
		for(int i=1;i<=n;i++){
		if(i%3!=0 && i%5!=0)ans+=i;
		}
		cout<<ans<<endl;
	
	
		return 0;
	}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
using namespace std;

int n;

signed main() {
	cin >> n;
	cout << 180 * (n - 2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

int N, K;
string S;

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

    cin >> N >> K >> S;
    string t = S;
    S += string(S.rbegin(), S.rend());
    FOR(i, 1, N + 1) chmin(t, S.substr(i, N));
    int l = 1;
    while(l < t.size() && t[0] == t[l])
        l++;
    int k = l;
    if(--K > 15)
        k = N;
    else
        k <<= K;
    string ans;
    rep(i, min(k, N)) ans.push_back(t[0]);
    ans += t.substr(l, N - ans.size());
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)

inline void read(int &x) {
	x = 0; char c = getchar();
	while (c <= 32) c = getchar();
	while (c > 32) x = x * 10 + (c & 15), c = getchar();
}

const int maxn = 1 << 19;
int mx[maxn << 1], siz;

void init(int n) {
	for (siz = 1; siz < n; siz <<= 1) ;
	memset(mx, 0, sizeof(mx));
}

void upd(int i, int a, int b, int x, int v) {
	if (a + 1 == b) {mx[i] = v; return ;}
	int m = (a + b) >> 1;
	if (x < m) upd(i << 1, a, m, x, v);
	else upd(i << 1 | 1, m, b, x, v);
	mx[i] = max(mx[i << 1], mx[i << 1 | 1]);
}

int qry(int i, int a, int b, int v, vector <int> &vec) {
	if (mx[i] < v) return v;
	if (a + 1 == b) {vec.pb(a); return mx[i];}
	int m = (a + b) >> 1;
	if (v < mx[i << 1]) v = qry(i << 1, a, m, v, vec);
	if (v < mx[i << 1 | 1]) v = qry(i << 1 | 1, m, b, v, vec);
	return v;
}

struct T {
	int val, fix;
	T *ls, *rs;
	T(int v) {val = v; fix = rand(); ls = rs = NULL;}
};

void split(T *x, int v, T *&a, T *&b) {
	if (!x) {a = b = NULL; return ;}
	if (x->val <= v) a = x, split(x->rs, v, a->rs, b);
	else b = x, split(x->ls, v, a, b->ls);
}

T *merge(T *a, T *b) {
	if (!a || !b) return a ? a : b;
	if (a->fix < b->fix) {a->rs = merge(a->rs, b); return a;}
	else {b->ls = merge(a, b->ls); return b;}
}

int mxv(T *x) {while (x && x->rs) x = x->rs; return x ? x->val : 0;}
void prt(T *x) {if (x) prt(x->ls), printf("%d ", x->val), prt(x->rs);}

int n, a[maxn];
T *rt[maxn];

int main() {
//	freopen("in", "r", stdin);
	srand(200);
	read(n);
	for (int i = 0; i < n; ++ i) read(a[i]);
	int m = 0;
	for (int i = 0; i < n; ++ i) {
		if (a[i] < a[i - 1]) m ++;
		rt[m] = merge(rt[m], new T(a[i]));
	}
	int n2 = n + m; init(n2);
	for (int i = 0; i <= m; ++ i) upd(1, 0, n2, i, mxv(rt[i]));
	int nw = n;
	for (int i = 0; i <= n; ++ i) {
		vector <int> vec;
		qry(1, 0, n2, 0, vec);
		++ m;
		int v = 0;
		for (int j = 0; j < vec.size(); ++ j) {
			T *a, *b;
			split(rt[vec[j]], v, a, b);
			rt[vec[j]] = a;
			upd(1, 0, n2, vec[j], mxv(a));
			v = mxv(b);
			rt[m] = merge(rt[m], b);
		}
		while (nw && mxv(rt[m]) == nw) {
			T *d; split(rt[m], nw - 1, rt[m], d); -- nw;
		}
		if (!nw) {printf("%d\n", i); break;}
		upd(1, 0, n2, m, mxv(rt[m]));
//		for (int j = 0; j <= m; ++ j)
//			prt(rt[j]); puts("");
	}
//	printf("%.3f\n", clock() * 1.0 / CLOCKS_PER_SEC);
	return 0;
}


Measured memory_bytes: 16768
import math
def is_prime(number):
  ans = 0
  for i in range(2, int(math.sqrt(number))+1):
    if number%i == 0:
      ans = 1
      break
  return ans

for i in range(int(input()), 10 ** 6):
  if is_prime(i) == 0:
    print(i)
    break

Measured memory_bytes: 9112
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 998244353;

signed main() {
  int n,m,l;
  cin>>n>>m>>l;
  int d[n][n],hen[n][n];
  int a,b,c;
  for(int i=0;i<n;i++)for(int j=0;j<n;j++){d[i][j]=MOD*MOD;hen[i][j]=MOD*MOD;}
  for(int i=0;i<m;i++){
    cin>>a>>b>>c;
    d[a-1][b-1]=c;
    d[b-1][a-1]=c;
  }
  for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
  //vector<int> hen[n];
  for(int i=0;i<n;i++)for(int j=0;j<n;j++)if(i!=j&&d[i][j]<=l)hen[i][j]=1;
    for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++)hen[i][j]=min(hen[i][j],hen[i][k]+hen[k][j]);
  int q,s,t,bi=0;

  //int used[n]={};
  cin>>q;
  for(int i=0;i<q;i++){
    //for(int j=0;j<n;j++)used[j]=MOD;
    cin>>s>>t;
    s--;t--;
    if(hen[s][t]==MOD*MOD)cout<<-1<<endl;
    else cout<<hen[s][t]-1<<endl;
  }
  



  return 0;
}


Measured memory_bytes: 1920
// Contest: AtCoder Beginner Contest 166 (https://atcoder.jp/contests/abc166)
// Problem: C: Peaks (https://atcoder.jp/contests/abc166/tasks/abc166_c)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion }}}

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

    int n, m; cin >> n >> m;
    vi h(n);
    trav(hi, h) cin >> hi;
    vvi adj(n);
    rep(_, m) {
        int u, v; cin >> u >> v, --u, --v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int cnt = 0;
    rep(i, n) {
        bool good = true;
        trav(j, adj[i])
            good &= h[i] > h[j];
        cnt += good;
    }
    cout << cnt << '\n';

    return 0;
}

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

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)

using namespace std;

/*long C(long n, long r){
    if(n < r) return 0;
    long p[n+1][n+1];
    p[0][0] = 1;
    for(int i = 1; i <= n; i++){
        p[i][0] = 1;
        p[i][i] = 1;
        for(int j = 1; j <= i-1; j++){
            p[i][j] = p[i-1][j] + p[i-1][j-1];
        }
    }
    return p[n][r];
}*/

 
void solve() {
    int N;
    cin >> N;
    if(N / 100 == N % 10){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}
 
int main() {
    solve();
    return 0;
}

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

int main(){
    char s; cin >> s;
    if(s=='A') cout << 'T' << endl;
    else if(s=='T') cout << 'A' << endl;
    else if(s=='G') cout << 'C' << endl;
    else cout << 'G' << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    int a[100];
    cin >> n;
    for(int i = 0;i < n;i++)
        cin >> a[i];
    for(int i = n - 1;i >= 0;i--) {
        cout << a[i];
        if(i != 0)
            cout << " ";
    }
    cout << endl;
    return 0;
}


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

int main() {
  char c;
  string V="vowel",C="consonant";
  cin >> c;
  if (c=='a' or c=='i' or c=='u' or c=='e' or c=='o') {
    cout<<V<<endl;
  }
  else {
    cout<<C<<endl;
  }
}




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

typedef long long ll;

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

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

    ll cnt = 0;
    for(int i=0; i<N-2; i++){
        for(int j=i+1; j<N-1; j++){
            for(int k=j+1; k<N; k++){
                //cout<<i<<" "<<j<<" "<<k<<endl;
                if(L[i]==L[j] || L[j]==L[k] || L[k]==L[i]){ continue;   }
                if(L[i]+L[j]+L[k]-2*max(L[i], max(L[j], L[k]))>0){
                   // cout<<"ok : "<<L[i]<<" "<<L[j]<<" "<<L[k]<<endl;
                   // cout<<"in : "<<i+1<<" "<<j+1<<" "<<k+1<<endl;
                   // cout<<endl;
                    cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<stdlib.h>
  
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
  
Node root;
  
Node treeMinimum(Node x){
  
  while(x->left!=NIL){
    x = x->left;
  }
    return x;

}
  
Node treeMaximum(Node x){
  
  while(x->right!=NIL){
    x = x->right;
  }
  return x;
  
}
  
Node treeSearch(Node u, int k){
  
  if(u==NIL || k==u->key){
    return u;
  }
  if(k<u->key){
    return treeSearch(u->left,k);
  }
  else{
    return treeSearch(u->right,k);
  }
}
  
Node treeSuccessor(Node x){
  Node y;
  
  if(x->right !=NIL){
    return treeMinimum(x->right);
  }
  y=x->parent;
  
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
  
}
  
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  
  if(z->left == NIL || z->right == NIL){
    y = z;
  }
  else{
    y = treeSuccessor(z);
  }
  if(y->left != NIL){
    x = y->left;
  }
  else{
    x = y->right;
  }
  if(x != NIL){
    x->parent = y->parent;
  }
  if(y->parent == NIL){
    root = x;
      }
  else if( y == y->parent->left ){
    y->parent->left = x;
  }
  else{
    y->parent->right = x;			   
  }

  if( y != z){
    z->key = y->key;
  }
}
  
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
  
  z = malloc(sizeof(struct 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){
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
 }
}
   
    
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left!=NIL)preorder(u->left);
  if(u->right!=NIL) preorder(u->right);
}
  
  
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  
  return 0;
}

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



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	int N; scanf("%d", &N);

	long long int l[87] = {0};
	l[0] = 2;
	l[1] = 1;

	FOR(i,2,N+1){
		l[i] = l[i-1] + l[i-2];
	}
	
	printf("%lld\n",l[N]);


	return 0;

}


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

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

  int x, y, z;
  cin >> x >> y >> z;

  int total = z;
  int count = 0;
  for (;x >= total + z + y;) {
    total += z + y;
    count++;
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
ll f[22];

int main()
{
//	cut here before submit 
//	freopen ("testcase.dat", "r", stdin );
	memset (f, 0LL, sizeof (f ) );
	f[0] = 1LL;
	f[1] = 1LL;
	for (int i = 2; i <= 20; i++ ){
		f[i] = (ll)i*f[i-1];
	} // end for
/*
	rep (i, 21 ){
		cout << f[i] << endl;
	} // end rep
*/
	string str = "";
	while (getline (cin, str ) ){
		stringstream ss (str );
		int n;
		ss >> n;
		cout << f[n] << endl;
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1216
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class CGoToSchool {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> ans(n);
      rep(i, n) {
        int a; cin >> a;
        a--;
        ans[a] = i+1;
      }
      rep(i, n) {
        cout << ans[i] << ' ';
      }
      cout << endl;
    }
};

signed main() {
  CGoToSchool solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>

int main(){
	long a,b,c,d,C,D;
    long r,x,tmp;
    long all;
    long count;
    scanf("%ld %ld %ld %ld",&a,&b,&c,&d);
   
    x = c * d;
    C = c;
    D = d;
	if(c < d){
    	tmp = c;
    	c = d;
    	d = tmp;
	}
 	r = c % d;
  	while(r!=0){
    	c = d;
    	d = r;
    	r = c % d;
  	}
   
    all = b - a + 1;
    count = all - (b/C - (a-1)/C) - (b/D - (a-1)/D) + (b/(x/d) - (a-1)/(x/d));
    
    printf("%ld",count);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007
#define iP pair<int,int>
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define inf 1e15
#define mod1 998244353
#define pi 3.141592653589793238
bool isPal(string &str){
    bool f=1;
    for(int i=0;i<str.size()/2;i++){
        if(str[i]!=str[str.size()-1-i]){
            f=0;
            break;
        }
    }
    return f;
}
int32_t main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);cout<<fixed;cerr.tie(NULL);cout.precision(20);
    string str;
    cin>>str;
    string s=str.substr(((str.size()+1)/2),(str.size()-1)/2),t=str.substr(0,(str.size()-1)/2);
    if(isPal(str)&&isPal(t)&&isPal(s))
    cout<<"Yes";
    else cout<<"No";
}

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

int main(){
	int t = 0,h = 0,n = 0;
	string taro,hanako;

	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> taro >> hanako;
		if (taro == hanako){t++;h++;}
		else if(taro < hanako)h = h+3;
		else if(taro > hanako)t = t+3;
	}
	cout << t << " " << h << endl;
	return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;

	vvl a(n,vl(n));
	
	FOR(k,0,12) {
		FOR(i,0,n) FOR(j,0,i) if (!a[i][j]) {
			if ((i & (1 << k)) != (j & (1 << k))) a[i][j] = k+1;
		}
	}
	FOR(i,0,n) FOR(j,i+1,n) cout << a[j][i] << " \n"[j+1==n];
}



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

using namespace std;
typedef long long ll;
typedef pair<int,ll> pil;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int maxN = 100010;
const int maxC = 1e6 + 10;
const int INF = 1e9; 
int n,m;
vector<int> v[maxN];
int in[maxN];
vector<pii> w[maxN];
int pre[maxN];
void bfs(int x)
{
	queue<int> Q;
	Q.push(x);
	while(!Q.empty())
	{
		int y = Q.front();
		Q.pop();
		for(auto z:v[y])
		{
			in[z]--;
			if(in[z] == 0)
			{
				Q.push(z);
				pre[z] = y;
			}
		}
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<n+m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].push_back(y);
		in[y] ++;
	}
	int root = 0;
	for(int i=1;i<=n;i++)
	{
		if(in[i] == 0)
		{
			root = i;
			break;
		}
	}
	pre[root] = 0;
	bfs(root);
	for(int i=1;i<=n;i++)
		cout<<pre[i]<<endl;
	return 0;
}

Measured memory_bytes: 9472
#include <stdio.h>

int main(void) {
  
  int n, k;
  scanf("%d %d", &n, &k);
  int A[101] = {1};
  for(int i = 0;i < k;i++) {
    int d;
    scanf("%d", &d);
    for(int j = 0;j < d;j++) {
      int a;
      scanf("%d", &a);
      A[a]++;
    }
  }
  int ret = 0;
  for(int i = 1;i <= n;i++) {
    if(A[i] == 0) ret++;
  }
  printf("%d\n", ret);
  
  
  return 0;
}

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

#define all(v) v.begin(), v.end()
typedef long long ll;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    unordered_map<string,ll> um;
    for(i = 0;i < n;++i){
        string s;
        cin >> s;
        if(um.count(s)){
            ++um[s];
        }else{
            um[s] = 1;
        }
    }
    vector<pair<ll,string>> ans;
    for(auto c: um){
        ans.emplace_back(-c.second,c.first);
    }
    sort(all(ans));
    ll tmp = ans.front().first;
    vector<string> ans2;
    for(i = 0;i < ans.size();++i){
        if(ans.at(i).first == tmp){
            ans2.push_back(ans.at(i).second);
        }else{
            break;
        }
    }
    sort(all(ans2));
    for(i = 0;i < ans2.size();++i){
        cout << ans2.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 30784
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;


const int M_N=1000000;
bool prime[M_N+1];
 
void Sieve(){
    int i,j;
    prime[1]=false;
    for (i=2;i*i<=M_N;i++){
        if (prime[i]==true){
            for (j=2;i*j<=M_N;j++){
                prime[i*j]=false;
            }
        }
    }
}
 
int main(){
    memset(prime,true,sizeof(prime));
    Sieve();
    int N;
    cin >> N;
    int t=0;
    for(int i=2;i<=55555;i++){
        if(prime[i]&&i%5==1){
            cout << i << (t==N-1?"\n":" ");
            t++;
        }
        if(t==N) break;
    }
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int num[1010101];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	for(x=1;x<=1000000;x++) {
		for(y=x;y<=1000000;y+=x) num[y]++;
	}
	
	cin>>N;
	int ret=0;
	FOR(i,N) ret+=num[i];
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 7560
//#include "rainbow.h"
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
//#define dprintf(...)
#define hash _hash
#define next _next
//#define dprintf(...) fprintf(outFile,__VA_ARGS__)
 
#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 100010
 
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}
 
//FILE* outFile;
//inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}
 
 
int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=ans*(ll)a%mod;
        a=(ll)a*a%mod;b>>=1;
    }
    return ans;
}



int main(){
    int T,i,j,k,m=0,K,n;
    scanf("%d%d",&n,&K);
    int d=0;
    rep(i,0,n)scanf("%d",&k),Max(m,k),d=__gcd(d,k);
    if(K<=m&&K%d==0)puts("POSSIBLE");
    else puts("IMPOSSIBLE");
}

Measured memory_bytes: 256
(n, x, y) = map(int, input().split())

cs = [0 for i in range(n)]

for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        d = min(abs(j - i), abs(x - i) + 1 + abs(j - y))
        cs[d] += 1

for i in range(1, n):
    print(cs[i])

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

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

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

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

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

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

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

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

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

class LazySegTree{
private:
	int n;
	vector<ll> node, lazy;
	vector<bool> lazyFlag;
public:
	LazySegTree(vector<ll> v){
		int sz = v.size();
		n = 1; while(n < sz) n *= 2;
		node.resize(2*n-1, 0);
		lazy.resize(2*n-1, 0);
		lazyFlag.resize(2*n-1, false);
		REP(i, sz) node[i+n-1] = v[i];
		for(int i = n-2;i >= 0;i--) node[i] = node[2*i+1]+node[2*i+2];
	}

	void eval(int k, int l, int r){
		if(lazyFlag[k]){
			node[k] += lazy[k] * (r-l);
			if(r-l > 1){
				lazy[2*k+1] += lazy[k];
				lazy[2*k+2] += lazy[k];
				lazyFlag[2*k+1] = lazyFlag[2*k+2] = true;
			}
			lazy[k] = 0;
			lazyFlag[k] = false;
		}
	}

	void add(int a, int b, ll x, int k=0, int l=0, int r=-1){
		if(r < 0) r = n;
		eval(k, l, r);
		if(b <= l || r <= a) return;

		if(a <= l && r <= b){
			lazy[k] += x;
			lazyFlag[k] = true;
			eval(k, l, r);
		}else{
			add(a, b, x, k*2+1, l, (l+r)/2);
			add(a, b, x, k*2+2, (l+r)/2, r);
			node[k] = node[k*2+1] + node[k*2+2];
		}
	}

	ll query(int a, int b, int k=0, int l=0, int r=-1){
		if(r < 0) r = n;
		eval(k, l, r);

		if(b <= l || r <= a) return 0;
		if(a <= l && r <= b) return node[k];

		return query(a, b, k*2+1, l, (l+r)/2) + query(a, b, k*2+2, (l+r)/2, r);
	}
};

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	ll a[314514];
	cin >> N;
	REP(i, 3*N){
		cin >> a[i];
	}
	sort(a, a+3*N, greater<ll>());
	ll res = 0;
	REP(i, N){
		res += a[i*2+1];
	}
	cout << res << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
const ll MOD = 998244353;
const ll INF = 1e18;
using namespace std;

struct Line {
	mutable ll k, m, p;
	bool operator<(const Line& o) const { return k < o.k; }
	bool operator<(ll x) const { return p < x; }
};

struct LineContainer : multiset<Line, less<>> {
	// (for doubles, use inf = 1/.0, div(a,b) = a/b)
	const ll inf = LLONG_MAX;
	ll div(ll a, ll b) { // floored division
		return a / b - ((a ^ b) < 0 && a % b); }
	bool isect(iterator x, iterator y) {
		if (y == end()) { x->p = inf; return false; }
		if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
		else x->p = div(y->m - x->m, x->k - y->k);
		return x->p >= y->p;
	}
	void add(ll k, ll m) {
		auto z = insert({k, m, 0}), y = z++, x = y;
		while (isect(y, z)) z = erase(z);
		if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
		while ((y = x) != begin() && (--x)->p >= y->p)
			isect(x, erase(y));
	}
	ll query(ll x) {
		assert(!empty());
		auto l = *lower_bound(x);
		return l.k * x + l.m;
	}
};

main(){    
    #ifdef XOX
        freopen("D:\\V S Code\\cpp\\competitiveProgramming\\Input.txt", "r", stdin);
        freopen("D:\\V S Code\\cpp\\competitiveProgramming\\OPT.txt", "w", stdout);
    #endif

    ios::sync_with_stdio(!cin.tie(NULL));
    
    ll n, c;
    cin >> n >> c;

    LineContainer obj;
    ll dp[n + 1];
    dp[0] = 0;
    ll ans = 0;

    ll h[n];
    for(int i = 0; i < n; i++)  cin >> h[i];

    // The function is for querying maximum values.
    // You need minimum so push in -ve values of everything.

    obj.add(2*h[0], -dp[0] - h[0]*h[0]);

    for(int i = 1; i < n; i++){
        dp[i] = h[i] * h[i] + c - obj.query(h[i]);
        obj.add(2*h[i], -h[i]*h[i] - dp[i]);
    }

    cout << dp[n - 1];

}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
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 main()
{
  int x ;
  cin >> x ;
  int sum = 0 ;
  
  
  FOR(i,1,x+1){
    sum += i ;
    if(sum>=x){
      cout << i <<endl ;
      return 0 ;
    }
  }
    


  return 0 ;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <utility>
#include <tuple>
#include <queue>

using namespace std;

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



Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 1000005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9+7;
ll pm(int n,int p){
    ll ret = 1;
    ll now = n;
    while(p){
        if(p & 1){
            ret *= now;
            ret %= mod;
        }
        now *= now;
        now %= mod;
        p >>= 1;
    }
    return ret;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll ans = 0;
    int n, k;
    cin >> k >> n;
    ll cnt[n + 5] = {};
    for (int i = n ; i >= 1 ; i--) {
        ll Cnt = n / i;
        cnt[i] = pm(Cnt,k);
        for (int j = i * 2 ; j <= n ; j+=i) {
            cnt[i] -= cnt[j];
        }
        cnt[i] %= mod;
        cnt[i] += mod;
        cnt[i] %= mod;
        //cout << cnt[i] << endl;
    }
    f1(n) {
        ans += cnt[i] * i % mod;
        ans %= mod;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 4372
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    for (int i = 1; i < 10; i++){
        for (int j = 1; j < 10; j++){
            if (i*j == n){
                printf("Yes");
                return 0;
            }
        }
    }
    printf("No");
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <algorithm>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
#include <cmath>
#include <stack>
#include <limits>
#include <ctime>

using namespace std;

#define ll long long
#define sc(n) static_cast<ll>(n)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {
	IO;
#ifdef _DEBUG
	ifstream cin("In.txt");
#endif	
	ll x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vector<ll>va(a),vb(b),vc(c);
	for (auto& i : va) {
		cin >> i;
	}
	for (auto& i : vb) {
		cin >> i;
	}
	for (auto& i : vc) {
		cin >> i;
	}
	sort(va.rbegin(), va.rend());
	sort(vb.rbegin(), vb.rend());
	sort(vc.rbegin(), vc.rend());
	ll ans = 0;
	ll ia = x - 1, ib = y - 1, ic = 0;
	while (ia >= 0 && ib >= 0 && ic < c) {
		if (va[ia] < vb[ib]) {
			if (vc[ic] > va[ia]) {
				ans += vc[ic++];
				ia--;
			}
			else {
				ans += va[ia--];
				ans += vb[ib--];
			}
		}
		else {
			if (vc[ic] > vb[ib]) {
				ans += vc[ic++];
				ib--;
			}
			else {
				ans += va[ia--];
				ans += vb[ib--];
			}
		}
	}
	while (ia >= 0 && ic < c) {
		if (vc[ic] > va[ia]) {
			ans += vc[ic++];
			ia--;
		}
		else {
			ans += va[ia--];
		}
	}
	while (ib >= 0 && ic < c) {
		if (vc[ic] > vb[ib]) {
			ans += vc[ic++];
			ib--;
		}
		else {
			ans += vb[ib--];
		}
	}
	while (ia >= 0) {
		ans += va[ia--];
	}
	while (ib >= 0) {
		ans += vb[ib--];
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
    int a, b;
    int t8, t10, ans;

    ans = -1;
    cin >> a >> b;

    for (int i = 0; i < 100000; i++)
    {
        t8 = (i * 8) / 100;
        t10 = (i * 10) / 100;

        if (t8 == a && t10 == b)
        {
            ans = i;
            break;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (abs(a - b) <= k && abs(a - c) <= k && abs(a - d) <= k && abs(a - e) <= k
			&& abs(b - c) <= k && abs(b - d) <= k && abs(b - e) <= k
			&& abs(c - d) <= k && abs(c - e) <= k && abs(d - e) <= k) {
		cout << "Yay!" << endl;
	} else {
		cout << ":(" << endl;
	}
	return 0;

}


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

typedef long long ll;
const long long LINF = 1LL << 60;
const long long LMINF = 1LL << 63;
const int INF = 1 << 30;

#define REP(i,n) for(int i = 0;i < n;++i)
#define REPS(i,x) for(int i = 1;i <= (int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i >= 0;i--)
#define RREPS(i,x) for(int i=((int)(x));i > 0;i--)
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << x << "\n"

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}



int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n)cin >> a[i];
    
    ll ans = 0;
    REP(i,n - 1){
        if(a[i] > a[i + 1]){
            ans += a[i] - a[i + 1]; 
            a[i + 1] = a[i];
            //debug(ans);
        }
    }

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

Measured memory_bytes: 4780
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define FOR(i, i0, n) for(int i = (i0); i < (n); i ++)
#define COUT(val) cout << (val) << "\n";
using namespace std;
using ll = long long int;

int n;
double dp[301][301][301];

double solve(int n1, int n2, int n3){
    if(dp[n1][n2][n3] != -1) return dp[n1][n2][n3];
    dp[n1][n2][n3] = 1.0 * n / (n1+n2+n3);
    if(n1 > 0) dp[n1][n2][n3] += solve(n1-1, n2  , n3  ) * n1 / (n1+n2+n3);
    if(n2 > 0) dp[n1][n2][n3] += solve(n1+1, n2-1, n3  ) * n2 / (n1+n2+n3);
    if(n3 > 0) dp[n1][n2][n3] += solve(n1  , n2+1, n3-1) * n3 / (n1+n2+n3);
    return dp[n1][n2][n3];
}

int main(void){
    cin >> n;
    int ns[4] = {0};
    FOR(i, 0, n){
        int tmp;
        cin >> tmp;
        ns[tmp] ++;
    }
    FOR(i, 0, n+1) FOR(j, 0, n+1) FOR(k, 0, n+1) dp[i][j][k] = -1;
    dp[0][0][0] = 0;
    
    printf("%.14f", solve(ns[1], ns[2], ns[3]));
}

Measured memory_bytes: 213376
//#pragma GCC optimize("Ofast")
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define bql 2147483647
#define ll long long
#define ull unsigned long long
using namespace std::tr1;
using namespace std;
const int N=2e5+5;
const int mod=998244353;
const int fx[5]={0,-1,0,1,0};
const int fy[5]={0,0,-1,0,1};
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while (ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0' && ch<='9'){x=(x<<3)+(x<<1);x+=(ch-'0');ch=getchar();}
    return x*f;
} 

void write(int x)
{
    if (x<0) putchar('-'),x=-x;
    if (x>10) write(x/10);
    putchar(x%10+'0');
}

int a,b,c;
int main()
{
  cin>>a>>b>>c;
  if (a==b && a!=c || a==c && a!=b || b==c && b!=a)
      cout<<"Yes\n";
  else
      cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
use std::io;
use std::cmp;


// read a line(without line feed)
fn read_line() -> String {
    let mut in_str = String::new();
    io::stdin().read_line(&mut in_str).unwrap();
    return in_str.trim().to_string();
}

// read wods on a line
pub fn read_words_in_line() -> Vec<String> {
    let s = read_line();
    return s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}

// read type t on a line
pub fn read_t_in_line<T : std::str::FromStr>() -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for e in read_words_in_line().iter().map(|x| x.parse::<T>()) {
        if let Ok(r) = e {
            v.push(r);
        }
        else{
            return Vec::new();
        }
    }
    return v;
}

// sort slice
pub fn sort<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort();
}
// sort slice by reverse order
pub fn sort_rev<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort_by(|x, y| y.cmp(x));
}

pub fn min<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::min(a, b);
}

pub fn max<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::max(a, b);
}

pub fn gcd(a : i32, b : i32) -> i32 {
    if b == 0 {
        return a;
    }
    return gcd(b, a % b);
}

fn main() {

    let n_k = read_t_in_line::<i32>();
    let (n, k) = (n_k[0], n_k[1]);
    let mut a = read_t_in_line::<i32>();
    a.sort();
    
    if n == 1 {
        if k == a[0] {
            println!("POSSIBLE");
        }
        else{
            println!("IMPOSSIBLE");
        }
    }
    else{
        let mut g = a[0];
        for i in 1..n {
            g = gcd(g, a[i as usize]);
        }
        if k % g == 0 && k <= a[n as usize - 1] {
            println!("POSSIBLE");
        }
        else{
            println!("IMPOSSIBLE");
        }
    }
}


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

int N;
const int MAX_N = 100 + 10;
int a[MAX_N];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> a[i];

    int rate[9];
    for (int i = 0; i < 9; i++) rate[i] = 0;

    for (int i = 0; i < N; i++) {
        if (a[i] <= 399) rate[0]++;
        else if (a[i] <= 799) rate[1]++;
        else if (a[i] <= 1199) rate[2]++;
        else if (a[i] <= 1599) rate[3]++;
        else if (a[i] <= 1999) rate[4]++;
        else if (a[i] <= 2399) rate[5]++;
        else if (a[i] <= 2799) rate[6]++;
        else if (a[i] <= 3199) rate[7]++;
        else rate[8]++;
    }

    int min_color = 0;
    for (int i = 0; i <= 7; i++) {
        if (rate[i] > 0) min_color++;
    }

    cout << max(min_color, 1) << " " << min_color + rate[8] << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
const int INF = 999999999;
using namespace std;
void chmin(int &a,int b) {if(a>b) a=b;}
int N,A,B,C;
vector<int> l;

int rec(int i,int a,int b,int c){
  if(i==N){
    if(!a || !b || !c) return INF;
    return abs(a-A)+abs(b-B)+abs(c-C);
  }
  int res = rec(i+1,a,b,c);

  chmin(res,rec(i+1,a+l[i],b,c)+(a?10:0));
  chmin(res,rec(i+1,a,b+l[i],c)+(b?10:0));
  chmin(res,rec(i+1,a,b,c+l[i])+(c?10:0));

  return res;
}

int main(){
  cin >> N >> A >> B >> C;
  l.resize(N);
  for(int i=0;i<N;i++) cin >> l[i];
  cout << rec(0,0,0,0) << endl;
}

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

int main(){
  int h,w,n;
  cin>>h>>w>>n;
  h=max(h,w);
  int ans=0;
  int black=0;
  while(black<n){
    ans++;
    black+=h;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3584