akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int N, a[212345], c[212345];

vector< int64_t > divisor(int64_t n) {
	vector< int64_t > ret;
	for (int64_t i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return (ret);
}

int main() {

	scanf("%d", &N);
	rep(i, N) scanf("%d", &a[i]);

	vector<int> ans;

	rep(i, N) {
		if ((c[N - 1 - i] % 2) != a[N - 1 - i]) {
			ans.push_back(N - i);
			auto d = divisor(N - i);
			for (auto dd : d) {
				c[dd - 1]++;
			}
		}
	}

	printf("%d\n", ans.size());
	for (auto aa : ans) printf("%d ", aa);


	return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
	using namespace std;
	#define IOS ios::sync_with_stdio(false), cin.tie(0)
	#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()
	#define dump(x) cout << (x) << endl
	#define LMAX 9223372036854775807LL
	#define LMIN -9223372036854775807LL

	using ll = long long;
	template<typename T>
	using vec = vector<T>;
	using P = pair<ll, ll>;

	template <typename A, size_t N, typename T>
	void Fill(A (&array)[N], const T &val){
		fill((T *)array, (T *)(array + N), val);
	}
	
	const ll INF = 1e18;
	const ll mod = 1e9 + 7;

	//int dx[4] = {1,0,-1,0};
	//int dy[4] = {0,1,0,-1};
	//ll pas[51][52];
	
	ll powm(ll a, ll b, ll c) {
		if (b == 0)return 1;
		else if (b % 2 == 0) {
			ll d = powm(a, b / 2, c);
			return (d * d) % c;
		}
		else return (a * powm(a, b - 1, c)) % c;
	}

	signed main(){
		IOS;
		ll h,w,n;
		cin >> h >> w >> n;
		map<P,ll> mp;
		REP(i,n){
			ll x, y;
			cin >> y >> x;
			for(int dx = -1;dx <= 1;dx++){
				for(int dy = -1;dy <= 1;dy++){
					int nx = x + dx, ny = y + dy;
					if(nx >= 2 && nx <= w - 1 && ny >= 2 && ny <= h - 1) //中央のマスはx:2~w-1かつy:2~h-1
						mp[P(nx,ny)]++;
				}
			}
		}
		vec<ll> cnt(10,0);
		ll sum = 0;
		for(auto it = mp.begin();it != mp.end();it++){
			cnt[it->second]++;
			sum++;
		}
		cnt[0] = (h - 2) * (w - 2) - sum;
		REP(i,10){
			dump(cnt[i]);
		}
	}

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

using namespace std;

int main() {
    int n,k,x,y;
    cin >> n >> k >> x >> y;
    if (n==k){
        cout << x*k;
    }
    else {
        if(n<k){
            cout << x*n;
        }
        else {
            cout << x*k+y*(n-k);
        }
    }
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

class edge{
public:
	Int cost;
	size_t from, to;
	edge(Int c, size_t f, size_t t){
		cost = c;
		from = f;
		to = t;
	}
};
using edges = vector<edge>;
using graph = vector<edges>;
void readgraph(graph &g, size_t E, bool D, bool C, bool Z){ // E:num_of_edges, D:directed, C:costed, Z:already 0-indexed
	for(size_t i=0; i<E; ++i){
		edge e(1, 0, 0);
		if(!C) cin >> e.from >> e.to;
		else cin >> e.from >> e.to >> e.cost;
		if(!Z){
			--e.from;
			--e.to;
		}
		g[e.from].push_back(e);
		if(!D){
			swap(e.from, e.to);
			g[e.from].push_back(e);
		}
	}
}
class tree{
public:
	Int n;
	Int root;
	graph g;
	vector<Int> parent;
	vector<vector<Int>> child;

	tree(Int _n) : n(_n) {root = -1; parent.resize(n, -1); child.resize(n);}
	tree(Int r, vector<Int> p) : n(p.size()), root(r), parent(p) {}
	tree(graph _g) : n(_g.size()), g(_g) {}

	void set_root(Int r){
		root = r;
		parent.resize(n, -1);
		parent[r] = r;
		child.resize(n, vector<Int>());
		queue<Int> q;
		q.push(r);
		while(!q.empty()){
			Int p = q.front(); q.pop();
			for(auto i:g[p]){
				Int t = i.to;
				if(parent[t] == -1){
					parent[t] = p;
					child[p].push_back(t);
					q.push(t);
				}
			}
		}
	}
	void find_children(Int r){
		root = r;
		child.resize(n, vector<Int>());
		for(int i=0; i<n; ++i)
			if(parent[i] != i)
				child[parent[i]].push_back(i);
	}
};
class graph_util{
public:
	static void rec_dfs(graph &g, tree &t, vector<Int> &ord, vector<Int> &low, Int &cnt, Int v, Int p){
		t.parent[v] = p;
		ord[v] = cnt;
		++cnt;
		low[v] = ord[v];
		for(auto i:g[v]){
			Int to = i.to;
			if(ord[to] == -1){
				rec_dfs(g, t, ord, low, cnt, to, v);
				low[v] = min(low[v], low[to]);
			}else if(p != to){
				low[v] = min(low[v], ord[to]);
			}
		}
	}
	static tree build_dfs_tree(graph &g, Int s, vector<Int> &ord, vector<Int> &low){
		tree t(g.size());
		ord.resize(g.size(), -1);
		low.resize(g.size(), g.size());
		Int cnt = 0;
		rec_dfs(g, t, ord, low, cnt, s, s);
		t.find_children(s);
		return t;
	}
	static vector<Int> find_articulation_point(tree &dfs_tree, vector<Int> &ord, vector<Int> &low){
		vector<Int> res;
		if((Int)dfs_tree.child[dfs_tree.root].size() > 1) res.push_back(dfs_tree.root);
		for(Int i=0; i<(Int)ord.size(); ++i){
			if(i == dfs_tree.root) continue;
			for(auto j:dfs_tree.child[i]){
				if(ord[i] <= low[j]){
					res.push_back(i);
					break;
				}
			}
		}
		return res;
	}
	static vector<pair<Int, Int>> find_bridge(tree &dfs_tree, vector<Int> &ord, vector<Int> &low){
		vector<pair<Int, Int>> res;
		for(Int i=0; i<(Int)ord.size(); ++i){
			if(i == dfs_tree.root) continue;
			Int p = dfs_tree.parent[i];
			if(ord[p] < low[i]) res.push_back(make_pair(p, i));
		}
		return res;
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int v, e; cin >> v >> e;
	graph g(v);
	readgraph(g, e, false, false, true);
	vector<Int> ord, low;
	tree dfs_tree(graph_util::build_dfs_tree(g, 0, ord, low));
	vector<Int> ap(graph_util::find_articulation_point(dfs_tree, ord, low));
	sort(ap.begin(), ap.end());
	for(auto i:ap) cout << i << "\n";
}


Measured memory_bytes: 7376
import std.stdio, std.math;

double third_root(int n) {
  double x = n / 2.0;
  while ((pow(x, 3).abs - n) > (n * 1e-6)) {
    x = x - (pow(x, 3) - n) / (3 * x * x);
  }
  return x;
}

void main() {
  for(int n; readf("%d\n", &n), n != -1;)
    writefln("%2.6f", third_root(n));
}

Measured memory_bytes: 1128
H, W = map(int, input().split())
sh, sw = map(int, input().split())
gh, gw = map(int, input().split())

sh += 1
sw += 1
gh += 1
gw += 1
s = sh*(W+4)+sw
g = gh*(W+4)+gw
S = [0]*(H+4)
S[0] = '*'*(W+4)
S[1] = '*'*(W+4)
S[-2] = '*'*(W+4)
S[-1] = '*'*(W+4)
for h in range(2,H+2):
  S[h] = '**' + input() + '**'

visited = [10**7]*((W+4)*(H+4))
dh1 = [0,1,0,-1]
dw1 = [1,0,-1,0]
dh2 = [2,2,2,2,2,1,1,1,1,0,0,-1,-1,-1,-1,-2,-2,-2,-2,-2]
dw2 = [-2,-1,0,1,2,-2,-1,1,2,-2,2,-2,-1,1,2,-2,-1,0,1,2]

from collections import deque

d = deque()
visited[s] = 0
d.append(s)
ans = 10**8
while len(d)>0:
  a = d.popleft()
  h,w = divmod(a,W+4)
  cnt = visited[a]
  if ans<=cnt:
    continue
  for i in range(4):
    h1 = h+dh1[i]
    w1 = w+dw1[i]
    a1 = h1*(W+4)+w1
    if (h1,w1)==(gh,gw):
      ans = min(ans,cnt)
    if S[h1][w1]=='.':
      if visited[a1]>cnt:
        visited[a1]=cnt
        d.appendleft(a1)
  for i in range(20):
    h2 = h+dh2[i]
    w2 = w+dw2[i]
    a2 = h2*(W+4)+w2
    if (h2,w2)==(gh,gw):
      ans = min(ans,cnt+1)
    if S[h2][w2]=='.':
      if visited[a2]>cnt+1:
        visited[a2]=cnt+1
        d.append(a2)
if ans==10**8:
  ans = -1
print(ans)

Measured memory_bytes: 87912
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
#include <utility>
#include <bitset>
#include <queue>

using namespace std;

using ll = long long;

int main()
{
	int H, W, h, w;
	cin >> H >> W >> h >> w;

	cout << ((H - h) * (W - w)) << endl;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

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

    cout << x+y/2 <<"\n";

    return 0;
}

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

int main() {
    string S;
    cin >> S;
    int A = S[0] - '0', B = S[1] - '0', C = S[2] - '0', D =S[3] - '0';
    vector<int> v{1, -1};

    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++){
                if (A + B * v[i] + C * v[j] + D * v[k] == 7) {
                    char op1 = v[i] == 1 ? '+' : '-';
                    char op2 = v[j] == 1 ? '+' : '-';
                    char op3 = v[k] == 1 ? '+' : '-';
                    cout << A << op1 << B << op2 << C << op3 << D << "=7" << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
d = input().split(" ")
h = int(d[0])
w = int(d[1])
if h == 1 or w == 1:
	p = 1
elif h % 2 == 1 and w % 2 == 1:
	p = int(h * w / 2) + 1
else:
	p = int(h * w / 2)
print(p)

Measured memory_bytes: 2940
#include <iostream>
using namespace std;
int main(){
	int n,k;
	while(cin>>n>>k,n){
		int A[100001]={0},tmp,flag=0,ans=0;
		for(int i=0;i<k;i++){
			cin>>tmp;
			if(tmp==0)flag=1;
			else A[tmp]=1;
		}
		for(int i=1;i<=n;i++)A[i]+=A[i-1];
		for(int i=1;i<=n;i++){
			for(int j=i+ans;j<=n;j++){
				if(A[j]-A[i-1]+flag<j-i+1)break;
				if((j-i+1)>ans)ans=(j-i+1);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


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

int main()
{
  int n; scanf("%d", &n);
  long long a[n];
  for(long long &x:a) scanf("%lld", &x);
  long long counter=0;
  for(int i=1; i<n; ++i){
    if(a[i]>=a[i-1]) continue;
    else{
      counter += a[i-1]-a[i];
      a[i]=a[i-1];
    }
  }
  printf("%lld\n", counter);
}

Measured memory_bytes: 5384
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <type_traits>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define all(n) std::begin(n), std::end(n)
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;


void calc() {

	Int K, A, B; std::cin >> K >> A >> B;
	bool flag = false;
	for (Int i = A; i <= B; ++i){
		if (i % K == 0)flag = true;
	}
	if (flag)std::cout << "OK";
	else std::cout << "NG";

}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 2e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
const ll mod = 998244353ll;
// const ll mod = 1000000007ll;
  
ll mypow(ll number1,ll number2, ll mod){
    if(number2 == 0){
        return 1ll;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
bool multicase = false;

ll n,m,num,a,b,c,d,e,h,q;
ll w, k;

void solve(){
    cin >> m;
    n = 100;
    ll cnt = 0;
    while(true){
        cnt ++;
        n = n + n / 100;
        if(n >= m){
            p(cnt);
            return;
        }
    }
    return;
}


int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















Measured memory_bytes: 3656
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

from bisect import bisect_right, bisect_left

def main():
    N, X = LI()
    b_l_u = []
    for i in range(N):
        b_l_u.append(LI())

    sum_of_test = [ (b_l_u_i[1]*b_l_u_i[0]+b_l_u_i[2]*(X-b_l_u_i[0]), i) for i,b_l_u_i in enumerate(b_l_u)]
    sum_of_test.sort(reverse=True)  # O(nlogn)

    cumsum_of_test = []
    tmp = 0
    for i in sum_of_test:  # O(n)
        tmp += i[0]
        cumsum_of_test.append(tmp)

    B = sum([l*b for b, l, u in b_l_u])  # O(n)
    head = bisect_right(cumsum_of_test, B)-1
    cumsum = cumsum_of_test[head]


    take_li = []
    for j, (sum_, i) in enumerate(sum_of_test):  # O(N)
        # cumsum の中に入っていたら、引く。
        if j <= head:
            new_head = bisect_right(cumsum_of_test, B+sum_)-1  # O(log N)
            new_cumsum = cumsum_of_test[new_head] - sum_
            left = B - new_cumsum
            take_1 = X * new_head
        else:
            left = B - cumsum
            take_1 = X*(head+1)

        if head==-1:  # i番目を下からとっていくコードのみでOK.
            left = B
            take_1 = 0

        b, l, u = b_l_u[i]
        from math import ceil
        if left/l <= b:
            take = ceil(left/l)
        else:
            take = b + ceil((left - b*l)/u)

        if take > X: continue

        take_li.append(take+take_1)

    print(min(take_li))

main()

Measured memory_bytes: 47884
N = int(input())
if N < 105:
    print(0)
else:
    cnt = 0
    for i in range(105, N+1):
        cnt2 = 0
        if i % 2 != 0:
            for j in range(1, i+1):
                if i % j == 0:
                    cnt2 += 1
            if cnt2 == 8:
                cnt += 1
    print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <bitset>
#include <math.h>
#include <numeric>
#include <stack>

using namespace std;
 
#define rep(i,m,n) for(int i=m;i<(int)(n);i++)
#define endl '\n'
typedef long long ll;

int gcd(int x,int y){
    return y ? gcd(y,x%y) : x;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    for(int i=0;i<n+1;i++){
        int a = i*1.08;
        if(a == n){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
}

Measured memory_bytes: 256
/*
  Id: ak260901
  Task: a
  Lang: C++
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

const int maxn = 1e5 + 5;

int n, a[maxn], b[maxn];
int cnta, cntb;

int main() {
  //freopen("a.in", "r", stdin);
  scanf("%d", &n);
  for(int i = 1; i <= n; i++) {
    int input;
    scanf("%d", &input);
    if(input >= 0) a[++cnta] = input;
    else b[++cntb] = input;
  }
  sort(a + 1, a + cnta + 1);
  sort(b + 1, b + cntb + 1);
  if(!cnta) {
    int tmp = b[cntb];
    for(int i = 1; i < cntb; i++) tmp -= b[i];
    printf("%d\n", tmp);
    for(int i = 1; i < cntb; i++) {
      printf("%d %d\n", b[cntb], b[i]);
      b[cntb] -= b[i];
    }
  } else if(!cntb) {
    int tmp = a[1];
    for(int i = 3; i <= cnta; i++) tmp -= a[i];
    tmp = a[2] - tmp; printf("%d\n", tmp);
    for(int i = 3; i <= cnta; i++) {
      printf("%d %d\n", a[1], a[i]);
      a[1] -= a[i];
    } printf("%d %d\n", a[2], a[1]);
  } else {
    int ans = 0;
    for(int i = 1; i <= cnta; i++) ans += a[i];
    for(int i = 1; i <= cntb; i++) ans -= b[i];
    printf("%d\n", ans);
    for(int i = 1; i < cnta; i++) {
      printf("%d %d\n", b[1], a[i]);
      b[1] -= a[i];
    }
    for(int i = 1; i <= cntb; i++) {
      printf("%d %d\n", a[cnta], b[i]);
      a[cnta] -= b[i];
    }
  }
  return 0;
}


Measured memory_bytes: 2304
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    //文字列から10進数に変換するときはparseIntを使います
    var f = input[0];
    var w = input[1];
    var correctNum = 0;
    for (var i = 0; i < 3; i++) {
        if (f[i] == w[i])
            correctNum++;
    }
    //出力
    console.log('%d', correctNum);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22080
#include<unistd.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<stdint.h>
#include<time.h>
#include<tgmath.h>
inline int max(int a, int b){return a>b?a:b;}
inline int min(int a, int b){return a>b?b:a;}
long gcd(long a, long b){return b?gcd(b, a%b):a;}

//fast(?) Input
#define buf_sz 1<<24
char buf[buf_sz];
unsigned int nextint(){
	static int idx = 0;
	if(idx == 0)read(0, buf, buf_sz);
	unsigned int res = 0;
	while(idx<buf_sz && buf[idx]<'0' || '9'<buf[idx])idx++;
	while(idx<buf_sz && '0'<=buf[idx] && buf[idx]<='9'){
		res *= 10;
		res += buf[idx++] - '0';
	}if(idx>=buf_sz)exit(1);
	return res;
}

const long mod = 1e9 + 7;
long modpow(long x, long y, long m){
    long res = 1, tmp = x;
    while(y){
        if(y&1) res = res * tmp % m;
        tmp = tmp * tmp % m;
        y >>= 1;
    }
    return res;
}
long pom(long x, long y){return modpow(x, y, mod);}
long COM(long x, long y){
    if(x < y) return 0;
    if(x < 0 || y < 0) return 0;
    long res = 1;
    for(int i=0; i<y; i++){
        res = res * (x-i) % mod * pom(y-i, mod-2) % mod;
    }
    return res;
}
int main(){
	int N = nextint();
	int maxi[2] = {INT32_MIN, INT32_MIN}, mini[2] = {INT32_MAX, INT32_MAX};
	for(int i=0; i<N; i++){
		int x = nextint();
		int y = nextint();
		maxi[0] = max(maxi[0], x-y);
		maxi[1] = max(maxi[1], x+y);
		mini[0] = min(mini[0], x-y);
		mini[1] = min(mini[1], x+y);
	}
	printf("%d\n", max(maxi[0]-mini[0], maxi[1]-mini[1]));
	return 0;
}


Measured memory_bytes: 5452
#include <bits/stdc++.h>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;

signed main() {
    int A, B, C;
    cin >> A >> B >> C;
    if(A==B && B==C){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int S;
	int h,m,s;
	scanf("%d",&S);

	h=S/3600;
	m=S%3600/60;
	s=S%3600%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  string ans = "Three";
  char x;
  for(int i=0; i<N; i++){
    cin >> x;
    if(x == 'Y'){
      ans = "Four";
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<int> x(n);
	for (int i = 0; i < n; i++)
	{
		cin >> x.at(i);
	}

	sort(rall(x));

	int a = 0, b = 0;
	for (int i = 0; i < n; i++)
	{
		if (i % 2 == 0)
		{
			a += x.at(i);
		}
		else
		{
			b += x.at(i);
		}
	}

	println(a - b);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdlib>
 
using namespace std;
 
int min(int a,int b){
  return a<b?a:b;
}
int main(){
	int n;
  	cin>>n;
  	int wt[n];
  	for(int i=0;i<n;i++){
    	cin>>wt[i];
    }
  	int mn[n];
  	for(int i=0;i<n;i++){
    	if(i==0) mn[i]=0;
      	else if(i==1) mn[i]=abs(wt[i]-wt[i-1]);
      	else mn[i]=min(abs(wt[i]-wt[i-1])+mn[i-1],abs(wt[i]-wt[i-2])+mn[i-2]);
    }
  cout<<mn[n-1];
  	return 0;
}

Measured memory_bytes: 1024
S = input()
T = input()
Q = int(input())
qs = [tuple(map(int,input().split())) for i in range(Q)]

sas = [0]
sbs = [0]
for c in S:
    a = int(c=='A')
    sas.append(sas[-1] + a)
    sbs.append(sbs[-1] + (a^1))

tas = [0]
tbs = [0]
for c in T:
    a = int(c=='A')
    tas.append(tas[-1] + a)
    tbs.append(tbs[-1] + (a^1))

ans = []
for a,b,c,d in qs:
    sa = sas[b] - sas[a-1]
    sb = sbs[b] - sbs[a-1]
    ta = tas[d] - tas[c-1]
    tb = tbs[d] - tbs[c-1]
    s = (sb-sa)%3
    t = (tb-ta)%3
    ans.append('YES' if s==t else 'NO')
print(*ans, sep='\n')

Measured memory_bytes: 43680
fun main(args: Array<String>) {
    val s = readLine()!!.toCharArray()
    val r = IntArray(s.size)
    var c = 0
    for (i in 0 until s.size) {
        if (s[i] == 'R') {
            c += 1
            if (s[i+1]  == 'L') {
                r[i+1] += c/2
                r[i] += (c+1)/2
            }
        } else c = 0
    }
    c = 0
    for (i in s.size-1 downTo 0) {
        if (s[i] == 'L') {
            c += 1
            if (s[i-1] == 'R') {
                r[i-1] += c/2
                r[i] += (c+1)/2
            }
        } else c = 0
    }
    println(r.joinToString(" "))
}

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

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

    t.erase(--t.end());
    if(s == t){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

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

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		String ans = "";

		if ( A + B >= C ) {
			ans = "Yes";
		} else {
			ans = "No";
		}
		System.out.println( ans );
	}
}

Measured memory_bytes: 21972
#include<stdio.h>
#include<string.h>
#define R 10000
int dp[501][11][500][3][2];//[今の桁][今の数字][mod][上下][flag]
int func(int v[],int vn,int m){
	int i,j,k,l,w,x,y,z,ans;
	memset(dp,0,sizeof(dp));
	ans=0;
	if(vn==1){
		for(i=1;i<=v[0];i++)if(i%m==0)ans++;
		return ans;
	}
	for(i=0;i<=v[0];i++){
		if(i==v[0])z=1;
		else z=0;
		if(i==0){
			dp[0][10][0][2][0]=1;
		}
		else{
			dp[0][i][i%m][0][z]++;
			dp[0][i][i%m][1][z]++;
		}
	}
	for(i=1;i<vn;i++){
		for(l=0;l<m;l++){
			for(j=0;j<10;j++){
				if(j==0){
					dp[i][10][0][2][0]=dp[(i-1)][10][0][2][0];
				}
				if(j!=v[i-1]){
					if(v[i-1]<j)x=1,y=0;
					else if(v[i-1]>j)x=0,y=1;
					if(j==v[i]){
						dp[i][j][(l*10+j)%m][x][1]+=dp[(i-1)][v[i-1]][l][y][1];
						dp[i][j][(l*10+j)%m][x][1]%=R;
					}
					else if(j<v[i]){
						dp[i][j][(l*10+j)%m][x][0]+=dp[(i-1)][v[i-1]][l][y][1];
						dp[i][j][(l*10+j)%m][x][0]%=R;
					}
				}
				for(k=0;k<10;k++){
					if(j==k)continue;
					else if(k<j)x=1,y=0;
					else x=0,y=1;
					if(k==0){
						//dp[i][j][(l*10+j)%m][1][0]+=dp[i-1][0][l][2][2];
						//dp[i][j][(l*10+j)%m][1][0]%=R;
						//dp[i][j][(l*10+j)%m][0][0]+=dp[i-1][0][l][2][2];
						//dp[i][j][(l*10+j)%m][0][0]%=R;
						dp[i][j][(l*10+j)%m][2][0]+=dp[(i-1)][10][l][2][0];
						dp[i][j][(l*10+j)%m][2][0]%=R;
					}
					dp[i][j][(l*10+j)%m][x][0]+=dp[(i-1)][k][l][y][0]+dp[(i-1)][k][l][2][0];
					dp[i][j][(l*10+j)%m][x][0]%=R;
				}
				//dp[i%2][j][(l*10+j)%m][2][0]%=R;
				//dp[i%2][j][(l*10+j)%m][1][0]%=R;
				//dp[i%2][j][(l*10+j)%m][0][0]%=R;
				
				//if(dp[i][j][(l*10+j)%m][1][0]>0)printf("dp[%d][%d][%d][1][0]=%d\n",i,j,(l*10+j)%m,dp[i][j][(l*10+j)%m][1][0]);
				//if(dp[i][j][(l*10+j)%m][0][0]>0)printf("dp[%d][%d][%d][0][0]=%d\n",i,j,(l*10+j)%m,dp[i][j][(l*10+j)%m][0][0]);
				//if(dp[i][j][(l*10+j)%m][1][1]>0)printf("dp[%d][%d][%d][1][1]=%d\n",i,j,(l*10+j)%m,dp[i][j][(l*10+j)%m][1][1]);
				//if(dp[i][j][(l*10+j)%m][0][1]>0)printf("dp[%d][%d][%d][0][1]=%d\n",i,j,(l*10+j)%m,dp[i][j][(l*10+j)%m][0][1]);
				//printf("\n");
			}
		}
	}
	for(i=0;i<10;i++){
		for(j=0;j<2;j++){
			//if(dp[vn-1][i][0][2][j]>0)printf("dp[%d][%d][0][2][%d]=%d\n",vn-1,i,j,dp[vn-1][i][0][2][j]);
			//if(dp[vn-1][i][0][1][j]>0)printf("dp[%d][%d][0][1][%d]=%d\n",vn-1,i,j,dp[vn-1][i][0][1][j]);
			//if(dp[vn-1][i][0][0][j]>0)printf("dp[%d][%d][0][0][%d]=%d\n",vn-1,i,j,dp[vn-1][i][0][0][j]);
			ans+=dp[(vn-1)][i][0][2][j]+
			     dp[(vn-1)][i][0][1][j]+
			     dp[(vn-1)][i][0][0][j];
			ans%=R;
		}
	}
	return ans;
}
int main(){
	int i,j,k,l,m,x[510],y[510],z,xn,yn,ans,c;
	char a[510],b[510];
	
	scanf("%s%s",a,b);
	scanf("%d",&m);
	xn=strlen(a);
	yn=strlen(b);
	for(i=0;i<xn;i++)x[i]=a[i]-'0';
	for(i=0;i<yn;i++)y[i]=b[i]-'0';
	c=1;
	for(i=xn-1;i>=0;i--){
		x[i]=x[i]-c;
		c=0;
		if(x[i]<0){
			c=1;
			x[i]+=10;
		}
	}
	
	ans=(10000+func(y,yn,m)-func(x,xn,m))%R;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 63000
#include<bits/stdc++.h>
using namespace std;
int n,m,a[310][310];
int c[310],u[310],ans;

int main(){
    scanf("%d %d",&n,&m);
    ans=n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(int x=1;x<=m;x++){
    	memset(u,0,sizeof(u));
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                if(c[a[i][j]]) continue;
                u[a[i][j]]++;
                break;
            }
        }
        int maxn=0,p;
        for(int i=1;i<=m;i++){
            if(u[i]>maxn)  maxn=u[i],p=i;
        }
        c[p]=1;
        ans=min(ans,maxn);
    }
    printf("%d\n",ans);
    
    return 0;
}

Measured memory_bytes: 640
# coding: utf-8
# Your code here!

import bisect

N, Q = map(int, input().rstrip().split(' '))
S = input()

i = 0
ac_indices = []
while True:
    index = S[i:].find('AC')
  
    if index == -1:
        break
    else:
        ac_indices.append(i + index)
        i +=  index + 1

for _ in range(Q):
    start, end = map(int, input().rstrip().split(' '))
    start -= 1
    end -= 1
    
    start_index = bisect.bisect_left(ac_indices, start)
    end_index = bisect.bisect_left(ac_indices, end)
        
    print(end_index - start_index)

        

Measured memory_bytes: 5776
S=input()
flg=0
if len(S)%2==1:
  flg=1
else:
  for i in range(len(S)//2):
    if not(S[i*2]=="h" and S[i*2+1]=="i"):
      flg=1
if flg==0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < (n);i++)
#define lint long long
const lint mod=1e9+7;
const lint inf=2.19e15+1;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}

signed main(){
    int n, d;
    int cnt = 0;
    cin >> n >> d;
    double df = d;
    REP(i, n){
        double x,y;
        cin >> x >> y;
        //cout << "dist = " << x * x + y * y << endl;
        if (x * x + y * y <= df * df) {
            cnt += 1;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3780
#include <stdio.h>

int main(void) {
	int suuretu[100000];
	int sum;
	int maxsum;
	int n,k;
	int i;
	while(1) {
		scanf("%d %d",&n,&k);
		if(n==0 && k==0)break;
		for(i=0;i<n;i++)scanf("%d",&suuretu[i]);
		sum=0;
		for(i=0;i<k;i++)sum+=suuretu[i];
		maxsum=sum;
		for(i=0;i<n-k;i++) {
			sum-=suuretu[i];
			sum+=suuretu[i+k];
			if(sum>maxsum)maxsum=sum;
		}
		printf("%d\n",maxsum);
	}
	return 0;
}

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

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

    }
    else{
        cout << "No";
    }
}

Measured memory_bytes: 3624
from collections import defaultdict

n = int(input())
a = list(map(int, input().split()))
ans = 0
cnt_free = sum(x >= 3200 for x in a)
for i in range(8):
    if sum(x >= 400 * i and x < 400 * (i + 1) for x in a) >= 1:
        ans += 1
print(max(1, ans))
print(ans + cnt_free)

Measured memory_bytes: 3316
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

void Calculate_Depth(vector<vector<int>>&edge, vector<int>&depth, int stnode) {
	depth[stnode] = 0;
	queue<int>Q;
	Q.push(stnode);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (depth[i] > depth[cn] + 1) {
				depth[i] = depth[cn] + 1;
				Q.push(i);
			}
		}
	}
	return;
}

void TopDown(vector<int>&depth, vector<int>&l, vector<int>&r, vector<vector<int>>&edge, int node) {
	for (auto i : edge[node]) {
		if (depth[i] > depth[node]) {
			if (l[i] == l[node])l[i]++;
			l[i] = max(l[i], l[node] - 1);
			if (r[i] == r[node])r[i]--;
			r[i] = min(r[i], r[node] + 1);
			TopDown(depth, l, r, edge, i);
		}
	}
	return;
}

void BottomUp(vector<int>&depth, vector<int>&l, vector<int>&r, vector<vector<int>>&edge, int node) {
	for (auto i : edge[node]) {
		if (depth[i] > depth[node]) {
			BottomUp(depth, l, r, edge, i);
			if (l[node] == l[i])l[node]++;
			l[node] = max(l[node], l[i] - 1);
			if (r[node] == r[i])r[node]--;
			r[node] = min(r[node], r[i] + 1);
		}
	}
	return;
}

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

	cin >> N;
	vector<vector<int>>edge(N);
	for (int i = 1; i < N; i++) {
		cin >> L >> R;
		L--;
		R--;
		edge[L].push_back(R);
		edge[R].push_back(L);
	}
	vector<int>l(N,-MOD);
	vector<int>r(N,MOD);
	cin >> K;
	for (int i = 0; i < K; i++) {
		cin >> L >> M;
		L--;
		l[L] = M;
		r[L] = M;
	}
	vector<int>depth(N,MOD);
	Calculate_Depth(edge, depth, L);
	TopDown(depth, l, r, edge, L);
	BottomUp(depth, l, r, edge, L);
	TopDown(depth, l, r, edge, L);
//	BottomUp(depth, l, r, edge, L);
	for (int i = 0; i < N; i++) {
		if (l[i] > r[i]) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	for (auto i : l)cout << i << endl;
	return 0;
} 

Measured memory_bytes: 15360
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl


void solve(long long a, long long b){
  int minN  = min(a, b);
  int maxN = max(a, b);
  REP(i, maxN){cout << minN;}
  cout << endl;
}

signed main(){
  long long a;
  scanf("%lld",&a);
  long long b;
  scanf("%lld",&b);
  solve(a, b);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  string s;
  cin >> n >> s;
  vector<int> bl(n+1, 0), wh(n+1, 0);
  REP(i,n){
    bl[i+1] = bl[i] + (s[i]=='#' ? 1 : 0);
    wh[i+1] = wh[i] + (s[i]=='.' ? 1 : 0);
  }
  int ans = 1e9;
  REP(i,n+1){
    ans = min(ans, (bl[i]-bl[0]) + (wh[n]-wh[i]));
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 2196
m,n=map(int,input().split())
products=list(map(int,input().split()))
products.sort()
products.reverse()
s=0
y=0
maru=0
batu=0
for x in products:
    y=y+x
for i in range(n):
    if y<=products[i]*4*n:
        maru=maru+1
    else:
        batu=batu+1
if batu==0:
    print('Yes')
else:
    print('No')
    
        


Measured memory_bytes: 9136
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(){
string str = "Christmas";
string add = " Eve";
int n,i=0;
cin>>n;
while(1){
  if(n+i==25)
  break;
  i++;
}
for(int j=0;j<i;j++){
  str+=add;
}

cout<<str<<endl;


}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int r; cin >> r;
    if(r < 1200)cout << "ABC" << ln;
    else if(r<2800)cout << "ARC" << ln;
    else cout << "AGC" << ln;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};


int main() {
    string s; cin >> s;
    deque<char> que;
    for (char c : s) que.pb(c);
    bool flip = false;
    int q; cin >> q;
    rep(i,q) {
        int ty; cin >> ty;
        if (ty == 1) {
            flip = !flip;
        }
        else {
            int f; char c;
            cin >> f >> c;
            if (flip) f = 3-f;
            if (f==1) que.push_front(c);
            else que.push_back(c);
        }
    }
    if (flip) reverse(all(que));
    for (char c : que) cout << c;
    cout << endl;
}

Measured memory_bytes: 3996
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main () {
	double t1,t2;
	
	while(scanf("%lf %lf",&t1,&t2)!=EOF){
		if(t1<35.50&&t2<71.0)
		printf("AAA\n");
		else if(t1<37.50&&t2<77.0)
		printf("AA\n");
		else if(t1<40.0&&t2<83.0)
		printf("A\n");
		else if(t1<43.0&&t2<89.0)
		printf("B\n");
		else if(t1<50.0&&t2<105.0)
		printf("C\n");
		else if(t1<55.0&&t2<116.0)
		printf("D\n");
		else if(t1<70.0&&t2<148.0)
		printf("E\n");
		else
		printf("NA\n");
	}
}

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

int main() {
	
	int a[10005];
	int n,num;
	cin>>n;
	for(int i=0;i<10005;i++){
		a[i]=0;
	}
	for(int i=0;i<n;i++){
		cin>>num;
		a[num]++;
	}
	int flag=0;
	for(int i=0;i<10005;i++){
		for(int j=0;j<a[i];j++){
			if(flag) cout<<" "; 
			cout<<i;
			flag=1;
		}
	}
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define pb push_back
#define vi vector<int>
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;
int main() {
				fast
				ll n=1000000;
				ll prime[n];
				for(ll i=0;i<n;i++)
				prime[i]=1;
				
				for(ll i=2;i*i<n;i++)
				{
					for(ll j=i*i;j<n;j+=i)
					prime[j]=0;
				}
			ll x;
			cin>>x;
			for(ll i=x;i<n;i++)
			{
				if(prime[i]!=0)
				{
					cout<<i<<endl;
					break;
				}
				}	
			
	return 0;
}

Measured memory_bytes: 8064
#include "bits/stdc++.h"
using namespace std;
int a[50],b[50];
int c[50],d[50];
int dist(int x1,int y1,int x2,int y2) {
	return abs(x1-x2)+abs(y1-y2);
}
int main() {
	int N,M;
	scanf("%d %d",&N,&M);
	for(int i=0;i<N;i++) {
		scanf("%d %d",&a[i],&b[i]);
	}
	for(int i=0;i<M;i++) {
		scanf("%d %d",&c[i],&d[i]);
	}
	for(int i=0;i<N;i++) {
		int idx=M-1;
		for(int j=M-1;j>=0;j--) {
			if(dist(a[i],b[i],c[idx],d[idx])>=dist(a[i],b[i],c[j],d[j])) idx=j;
		}
		printf("%d\n",idx+1);
	}
}

Measured memory_bytes: 256
def inpl(): return [int(i) for i in input().split()]

mod = 10**9+7
H, W, A, B = inpl()
fac = [1 for _ in range(H+W-1)]
for i in range(H+W-2):
    fac[i+1] = (i+1)*fac[i]%mod

inv = [1 for _ in range(H+W-1)]
for i in range(2,H+W-2):
    inv[i] = (-(mod//i) * inv[mod%i]) %mod    

facinv = [1 for _ in range(H+W-1)]
for i in range(H+W-2):
    facinv[i+1] = inv[i+1]*facinv[i]%mod


ans = 0
for i in range(W-B):
    ans += (fac[H+B-A-1+i] * fac[W+A-B-2-i] * facinv[H-A-1] * facinv[B+i]\
    * facinv[A-1] * facinv[W-B-1-i] )%mod
print(ans%mod)

Measured memory_bytes: 26800
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set> 
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue> 
using namespace std;
int n; 
int main() 
{cin>>n;
 int a[n],m=0,ans=0;
 for (long long i=0;i<n;i++)
 cin>>a[i];

 for (long long j=0;j<n;j++)
 ans+=a[j]-1;

 cout<< ans; 
  
 
 system("pause");
 return 0;
}        


Measured memory_bytes: 504
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cstdio>
using namespace std;
#define NIN(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define NINJ(i,n) for((i)=1;(i)<=(int)(n);(i)++)
#define pb push_back
#define LL long long
#define ff first
#define ss second
#define pp pair<double,double>
#define pt pair<double,pair<int,int>>

int pr[200005];
vector<int>v;
int fnd(int r)
{
    return (pr[r]==r) ? r :  pr[r]=fnd(pr[r]);
}
int mn=99999999;
void dfs(int x,int y,int n)
{
    if(x>=n)
    {
        mn = min(mn,x);
        return;
    }
   for(int c:v)
   {
       if(!c && !y)
        continue;
       dfs(x * 10 + c , y + 1 , n);
   }
}
int main()
{
    int n,l;
    cin>>n>>l;
    map<int,int>mp;
    for(int i=0; i<l; i++)
    {
        int p;
        cin>>p;
        mp[p]++;
    }

    for(int i=0;i<=9;i++)
    {
        if(mp.find(i) == mp.end())
            v.push_back(i);
    }
    dfs(0,0,n);
    cout<<mn<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
n, k = map(int, input().split())

mod = 10 ** 9 + 7
f = [1]
for i in range(1,2*n+1):
    f.append((f[-1] * i) % mod)
def comb(n,r):
    return f[n] * (pow(f[r], mod-2, mod) * pow(f[n-r], mod-2, mod) % mod) % mod

ans = comb(2*n-1, n)
if n-1 <= k:
    print(ans)
    sys.exit()

j = 0
for i in range(k+1,n)[::-1]:
    ans -= (comb(n,n-i) * comb(n-1,j)) % mod
    ans %= mod
    j += 1

print(ans)

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

ll digits(ll n)
{
    ll c =0 ;
    while(n)
    {
        c++;
        n/=10;
    }
    return c;
}

int main() {
    ll n;
    cin >> n;
    
    ll c=0;
    
    for(ll i=1;i<=n;i++ ){
        int d = digits(i);
        if(d%2==1)
        c++;
    }
    
    cout << c << endl;
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<map>
using namespace std;
int a[100010];
map<int,int>mp;
int main()
{
    int m=1;
    int n,i,t;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>t;
        mp[t]++;
    }
    if(n%2==0)
    {
        for(t=1;t<n;t+=2)
        {
            if(m>1000000007)
            {
                m-=1000000007;
            }
            if(mp[t]==2)
            {
                m*=2;
            }
            else
            {
                cout<<0;
                return 0;
            }
        }
    }
    else
    {
        if(mp[0]!=1)
        {
            cout<<0;
            return 0;
        }
        for(t=2;t<n;t+=2)
        {
            if(m>1000000007)
            {
                m-=1000000007;
            }
            if(mp[t]==2)
            {
                m*=2;
            }
            else
            {
                cout<<0;
                return 0;
            }
        }
    }
    cout<<m%1000000007;
    return 0;
}


Measured memory_bytes: 3328
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <functional>
#include <map>

#define ll long long
#define $1 first
#define $2 second
#pragma warning(disable : 4996)

using namespace std;

void solve_case();

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

	solve_case();

	return 0;
}

void solve_case() {
	string s;
	int ans = 0, count = 0;
	
	cin >> s;

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C') {
			count++;
			ans = max(ans, count);
		}
		else
			count = 0;
	}

	cout << ans << "\n";
}

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

using namespace std;

int main()
{
	long long A,X,i,I,years;
	A=100;
	cin>>X;
	i=1;
	years=0;
	while(i)
	{
		if(A>=X)
		{
			break;
		}
		I=A/100;
		A+=I;
		years++;
	}
	cout<<years;
	return 0;
}

Measured memory_bytes: 3672
from collections import deque
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n, k, t, u, v, l = MI()
    hp = []
    # (位置、イベントの種類、時間)として、ヒープに突っ込んでいく
    # イベントの種類は　
    # 0 ゴールする
    # 1 ニンジン効果終わる（+食べる）
    # 2 ニンジン拾う（+食べる）　
    # 時間が必要なのは1番だけで他のイベントの時は-1を突っ込んである
    heappush(hp, (l, 0, -1))
    for _ in range(n):
        d = int(input())
        heappush(hp, (d, 2, -1))
    # 「最後に速さが変わった時間、位置」と「ニンジンの数」
    time = pos = caro_n = 0
    # ニンジン効果中ならTrue
    boost = False
    cancel=deque()
    while hp:
        here, e, now = heappop(hp)
        if e == 2:
            if boost:
                if caro_n==k:
                    cancel.append(pos+v*t)
                    time += (here - pos) / v
                    pos=here
                    heappush(hp, (here + v * t, 1, time + t))
                else:
                    caro_n += 1
            else:
                time += (here - pos) / u
                pos = here
                boost = True
                heappush(hp, (here + v * t, 1, time + t))
        if e == 1:
            if cancel and here==cancel[0]:
                cancel.popleft()
                continue
            if caro_n:
                pos=here
                time=now
                caro_n -= 1
                heappush(hp, (here + v * t, 1, now + t))
            else:
                time = now
                pos = here
                boost = False
        if e == 0:
            uv = v if boost else u
            print(time + (l - pos) / uv)
            exit()

main()



Measured memory_bytes: 6036
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int d[200][200];
int const inf=1<<28;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)d[i][j]=inf;
    for(int i=0;i<=n;i++)d[i][i]=0;
    vector<pair<bool,string>> v;
    for(int i=0;i<n;i++){
        string s;cin>>s;
        bool b;
        if(s=="goto"){
            cin>>s;
            s.back()=':';
            b=true;
        }else{
            b=false;
        }
        v.push_back(make_pair(b,s));
    }
    for(int i=0;i<n;i++){
        if(v[i].first){
            d[i][i+1]=1;
            for(int j=0;j<n;j++){
                if(!v[j].first && v[j].second==v[i].second){
                    d[i][j]=0;
                    break;
                }
            }
        }else{
            d[i][i+1]=0;
        }
    }
    // Worshall-Floyd
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            for(int k=0;k<=n;k++){
                d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
            }
        }
    }
    cout<<d[0][n]<<endl;
}

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

int main()
{
  int n,m;
  cin>>n>>m;
  int ar[n+1];
  for(int i=1;i<=n;i++)
	cin>>ar[i];
 vector<int>g[n+1];
  while(m--)
 {
   int x,y;
    cin>>x>>y;
    g[x].push_back(y);
    g[y].push_back(x);
 }
  int count=0;
  for(int i=1;i<=n;i++)
  {
    bool flag=false;
    for(auto x:g[i])
    {
      if(ar[i]<=ar[x])
      {
        flag=true;
      }
    }
    if(!flag)
    {
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 9136