akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        long d[] = new long[n*2];
   
        
        
        for (int i = 0; i < n; i++) {
        	d[i] = sc.nextLong()*2;
        }
        for (int i = 0; i < n; i++) {
        	d[i+n] = sc.nextLong()*2;
        	d[i+n] += 1;
        }
        sort(d);
        
        int p=0,q=0;
        long ans=1;
        for (int i = 0; i < n*2; i++) {
        	if(d[i]%2==1) {if(q>0) {ans*=q;ans%=mod;q--;} else p++; }
        	else {
        		if(p>0) {ans*=p; ans%=mod; p--;} else q++;
        	}
        }

        out.println(ans);
        out.flush();
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return d-p.d; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 44936
def insertionSort(A, N):
    print(*A)
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        print(*A)
n = int(input())
A = list(map(int, input().split()))
insertionSort(A, n)


Measured memory_bytes: 5980
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

ll MOD = 1e9 + 7;
// a^b O(log b)
template<typename T>
T mypow(T a, T b){
    if (b == 0)
        return 1;
    T tmp = mypow(a, b / 2);
    if (b % 2)
        return (((tmp * tmp) % MOD) * a) % MOD;
    else
        return (tmp * tmp) % MOD;
}

// nCk O(n + klogMOD)
long long comb(int n, int k){
    long long res = 1;
    k = std::min(n - k, k);
    for (int i = n - k + 1; i <= n; i++)
        res = (res * i) % MOD;
    for (int i = 1; i <= k; i++)
        res = (res * mypow(static_cast<long long>(i), static_cast<long long>(MOD - 2))) % MOD;
    return res;
}

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

    ll n, k;
    cin >> n >> k;
    for(ll i = 1; i <= k; i++){
        if(n - k + 1 < i || k - 1 < i - 1){
            cout << 0 << endl;
            continue;
        }
        ll res = comb(n - k + 1, i) * comb(k - 1, i - 1);
        res %= MOD;
        cout << res << endl;
    }
    return 0;
}

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

const int N_MAX = 1e6;
bool is_prime[N_MAX+1];
int like_num[N_MAX+1];

void prime(int n){
  for(int i = 0; i <= n; i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for(int i = 2; i <= n; i++){
    if(is_prime[i]){
      for(int j = 2 * i; j <= n; j += i) is_prime[j] = false;
    }
  }
}

int main(){
  int x;
  cin >> x;
  prime(999999);
  while(true) {
    if(is_prime[x]) {
      cout << x << endl;
      return 0;
    }
    x++;
  }
  return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
long double n,arr[51],brr[51];
long double dist(long double a,long double b,long double c,long double d){
    long double x=(a-c)*(a-c);
    long double y=(b-d)*(b-d);
    return sqrt(x+y);
}
long double maxdist(long double a,long double b){
    long double res=0;
    for (int i=1;i<=n;i++){
        res=max(res,dist(a,b,arr[i],brr[i]));
    }
    return res;
}
long double prevx,prevy,x,y,minr;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for (int i=1;i<=n;i++) cin>>arr[i]>>brr[i];
    cout<<fixed<<setprecision(20);
    if (n==2){
        cout<<dist(arr[1],brr[1],arr[2],brr[2])/2;
        return 0;
    }
    minr=1000000;
    long double divide[20];
    divide[0]=100;
    for (int i=1;i<20;i++) divide[i]=divide[i-1]/5;
    for (int att=0;att<12;att++){
        for (int i=-100;i<=100;i++){
            for (int j=-100;j<=100;j++){
                long double curx=prevx+i*divide[att];
                long double cury=prevy+j*divide[att];
                long double radius=maxdist(curx,cury);
                if (radius<minr){
                    minr=radius;
                    x=curx;
                    y=cury;
                }
            }
        }
        prevx=x;
        prevy=y;
    }
    cout<<minr;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
const ll mod = 998244353;
using namespace std;
int main()
{
    ll n,k;
    cin>>n>>k;
    vector<pair<ll,ll>> v;
    for(int i=0;i<k;i++)
    {
        ll l,r;
        cin>>l>>r;
        v.push_back(make_pair(l,r));
    }
    sort(v.begin(),v.end());
    ll dp[n+1]={0};
    for(int i=0;i<v.size();i++)
    {
        dp[v[i].first]++;
        dp[min(n,v[i].second+1)]--;
    }
    for(int i=1;i<n;i++)
    {   
        dp[i] = (dp[i] + dp[i-1])%mod;
        for(int j=0;j<v.size();j++)
        {
            if(i+v[j].first>=n)
            continue;
            dp[i+v[j].first] = (dp[i+v[j].first] + dp[i]) % mod;
            dp[min(n,i+v[j].second+1)] = ((((dp[min(n,i+v[j].second+1)] - dp[i]) % mod) + mod)%mod);
        }        
    }
    cout<<dp[n-1];

}

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

int main(){
  int n,m;
  cin >> n >> m;
  int left = -1,right =1000000;
  for (int i=0;i<m;i++){
    int l,r;
    cin >> l >> r;
    left = max(left,l);
    right =min(right,r);
  }
  if (right >= left) cout << right - left + 1 << endl;
  else cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 256
class Main{
    public static void main(String[] a){
    	int i,n;
    	
    	for(i = 1;i < 10;i++){
    		for(n = 1;n < 10;n++){
    			System.out.println(i + "x" + n + "=" + n*i);
    		}
    	}
    }
}

Measured memory_bytes: 24184
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int inverse(int x){
    return binpow(x, MOD - 2, MOD);
}

void solve()
{
    int s;
    cin >> s;
    int dp[s + 1]; 
    memset(dp, 0, sizeof(dp));
    dp[0] = 1;
    for(int i = 3; i <= s; i++)
        dp[i] = (dp[i - 1] + dp[i - 3]) % MOD;
    cout << dp[s] << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

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

#define ll long long int

int H[200005], R[200005], A[200005];
ll tree[800005];

ll max(ll a, ll b)
{
    if (a >= b) return(a);
    return(b);
}

void update(int node, int start, int end, int idx, ll v)
{
    if (start == end)
    {
        tree[node] = v;
        return;
    }
    int mid = (start + end) / 2;
    if (start <= idx && idx <= mid) update(2 * node, start, mid, idx, v);
    else update(2 * node + 1, mid + 1, end, idx, v);
    tree[node] = max(tree[2 * node], tree[2 * node + 1]);
}

ll query(int node, int start, int end, int l, int r)
{
    if (r < start || end < l) return(0);
    if (l <= start && end <= r) return(tree[node]);
    int mid = (start + end) / 2;
    ll p1 = query(2 * node, start, mid, l, r), p2 = query(2 * node + 1, mid + 1, end, l, r);
    return(max(p1, p2));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    for (int i = 1; i <= N; i++)
    {
        cin >> H[i];
        R[H[i]] = i;
    }
    for (int i = 1; i <= N; i++) cin >> A[i];
    for (int i = 1; i <= N; i++)
    {
        int c = R[i];
        ll p = query(1, 1, N, 1, c - 1);
        update(1, 1, N, c, p + A[c]);
    }
    cout << tree[1] << '\n';
    return(0);
}

Measured memory_bytes: 8960
#include <stdlib.h>
#include <assert.h> //assert
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <string.h>
#include <string>
#include <queue>
#include <sstream>
#include <iomanip> //precision
using namespace std;
#define precision(x) setprecision(x) << fixed
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<vector<ll > > matrix;
const ll mod = 1000000007LL;

const int MAX_N = 1001;

int N, M;
vector<pair<ll, ll>> cards;
ll x, y, sum;
vector<ll> card;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	cin >> N >> M;
	for (int i = 0; i < N; ++i) {
		cin >> x;
		card.push_back(x);
	}

	for (int i = 0; i < M; ++i) {
		cin >> x >> y;
		cards.push_back({ y, x });
	}

	sort(cards.rbegin(), cards.rend());
	sort(card.begin(), card.end());
	int idx = 0;
	for (int i = 0; i < M; ++i) {
		if (card[idx] > cards[i].first) break;
		for (int j = 0; j < cards[i].second && idx < N && card[idx] < cards[i].first; ++j)
			card[idx++] = cards[i].first;
	}

	for (int i = 0; i < N; ++i) {
		sum += card[i];
	}

	cout << sum;
}



Measured memory_bytes: 3188
# -*- coding: utf-8 -*-

import itertools

N = int(input())
F = []
for i in range(N):
    F.append(list(map(int, input().split())))
P = []
for i in range(N):
    P.append(list(map(int, input().split())))

# 重複順列で自分の店の全パターンを出す
me_list = list(itertools.product([0, 1], repeat=10))

# 初期値は利益の最小値
me_p = -1000000000
# 自分の店の全パターンループ
for i in range(len(me_list)):

    # 一度も営業しないパターンを除く
    if i == 0:
        continue

    tmp_p = 0
    # 他店の数でループ
    for j in range(N):

        cnt = 0
        # 月～金のAMPMループ
        for k in range(10):

            # 他店との営業重複カウント
            if me_list[i][k] == 1 and F[j][k] == 1:
                cnt += 1
        
        # 各店舗との重複数に応じた利益を合算していく
        tmp_p += P[j][cnt]

    # 合算した利益を現状の最高値と比較して置き換えていく
    me_p = max(me_p, tmp_p)   

print(me_p)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef pair<ll,ii> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 55

struct Edge{
	int v; ll c,t;
	Edge(int v,ll c,ll t): v(v), c(c), t(t){}
};

int n,m;
ll S;
ll C[MAXN],D[MAXN];
vector<Edge> adj[MAXN];
ll dist[MAXN][5005];

void dijkstra(int src)
{
	pqueue<iii,viii,greater<iii>> q;
	forn(i,0,n)	forn(j,0,5005) dist[i][j]=INF;
	dist[src][S]=0;
	q.push({dist[src][S],{src,S}});
	
	while(!q.empty()){
		int u=q.top().S.F, c=q.top().S.S; q.pop();
		for(auto tmp: adj[u]){
			int v=tmp.v; ll w=tmp.t;
			if(c-tmp.c<0) continue;
			if(dist[v][c-tmp.c]>dist[u][c]+w){
				dist[v][c-tmp.c]=dist[u][c]+w;
				q.push({dist[v][c-tmp.c],{v,c-tmp.c}});
			}
		}
		if(c+C[u]<=5000){
			if(dist[u][c+C[u]]>dist[u][c]+D[u]){
				dist[u][c+C[u]]=dist[u][c]+D[u];
				q.push({dist[u][c+C[u]],{u,c+C[u]}});
			}
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin>>n>>m>>S;
	S=min(S,5000LL);
	for(int i=0;i<m;i++){
		int u,v; ll c,t; cin>>u>>v>>c>>t; u--; v--;
		adj[u].pb(Edge(v,c,t));
		adj[v].pb(Edge(u,c,t));
	}
	for(int i=0;i<n;i++){
		cin>>C[i]>>D[i];
	}
	
	dijkstra(0);
	
	ll ans[MAXN];
	for(int i=1;i<n;i++){
		ans[i]=INF;
		for(int j=0;j<=5000;j++){
			ans[i]=min(dist[i][j],ans[i]);
		}
	}
	
	for(int i=1;i<n;i++) cout<<ans[i]<<'\n';
	
	return 0;
}


Measured memory_bytes: 11396
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
#include  <cstdio>
#include  <sstream>
#include  <bitset>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Pli = pair<ll, int>;
using VPi = vector<Pi>;
using VPl = vector<Pl>;
using VPli = vector<Pli>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };

const ll M = 998244353;

int main()
{
	ll n, x, m;
	cin >> n >> x >> m;


	if (n <= m) {
		ll z = x;
		ll ans = x;
		for (int i = 0; i < n - 1; i++) {
			z = z * z;
			z %= m;
			ans += z;
			//cout << ans << endl;
		}
		cout << ans << endl;
		return 0;
	}

	Vi R;
	ll r = x;
	bool f = true;
	int t = 0;
	bool h = true;
	while (1) {
		r = r % m;
		for (int i = 0; i < R.size(); i++) {
			if (R[i] == r) {
				f = false;
				t = i;
				break;
			}
		}
		if (f) {
			if (h) {
				h = false;
				R.push_back(x);
				r = x * x;
			}
			else {
				R.push_back(r);
				r = r * r;
			}
		}
		else {
			break;
		}
	}

	ll ans = 0;
	for (int i = 0; i < t; i++) {
		ans += R[i];
	}
	ll cirsum = 0;
	for (int i = t; i < R.size(); i++) {
		cirsum += R[i];
	}
	ll numcir = (n - t) / (R.size() - t);
	ll numcirr = (n - t) % (R.size() - t);
	ans += cirsum * numcir;
	for (int i = 0; i < numcirr; i++) {
		ans += R[i + t];
	}
	cout << ans << endl;
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{

   int a,b;
   cin>>a>>b;
   int s=0;

   if(b<a){s=2*a-1;}
   else if(a==b){s=a+b;}
   else{s=2*b-1;}

   cout<<s<<endl;

}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/21  Problem: ABC 058 A / Link: http://abc058.contest.atcoder.jp/tasks/abc058_a  ----- */


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

	LL a, b, c; cin >> a >> b >> c;
	LL ans = (b - a == c - b);

	auto print_yesno = [](LL yes, int mode = 0) {
		if (mode == 0) {
			cout << (yes ? "yes" : "no") << endl;
		}
		else if (mode == 1) {
			cout << (yes ? "Yes" : "No") << endl;
		}
		else if (mode == 2) {
			cout << (yes ? "YES" : "NO") << endl;
		}
		else assert(0);
	};
	print_yesno(ans, 2);

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main (void)
{
    
int A,B,C,X;
int i,j,k,r=0;
    scanf("%d",&A);/*500yen*/
    scanf("%d",&B);/*100yen*/
    scanf("%d",&C);/*50yen*/
    scanf("%d",&X);



    for(i=0;i<=A;i++)
    {
        for(j=0;j<=B;j++)
        {
            for(k=0;k<=C;k++)
            {
                if(500*i+100*j+50*k==X)
                {
                    r=r+1;
                }
            }
        }
    }
    printf("%d\n",r);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
int a =sc.nextInt();
int b=sc.nextInt();
if(a==0&&b==0) break;
if(a>b) System.out.println(b+" "+a);
else System.out.println(a+" "+b);
        }
    }
}


Measured memory_bytes: 36316
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





string S;
int N;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> S;
    N = S.length();

    if (S.front() == '0' or S.back() == '1') {
        printf("-1\n");
        return;
    }

    rep(i, 0, (N - 1) / 2) if (S[i] != S[N - 2 - i]) {
        printf("-1\n");
        return;
    }

    vector<pair<int, int>> ans;
    ans.push_back({ 0, 1 });
    int top = 1;
    rep(i, 1, N - 1) {
        ans.push_back({ top, i + 1 });

        if (S[i] == '1') top = i + 1;
    }

    fore(p, ans) printf("%d %d\n", p.first + 1, p.second + 1);
}


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

int main(void){
	int H,W,N,a,b,dx[9]={-1,-1,-1,0,0,0,1,1,1},dy[9]={-1,0,1,-1,0,1,-1,0,1};
	cin>>H>>W>>N;
	ll cnt[10]={(ll)(H-2)*(W-2)};
	map<pair<int,int>,int> mp;
	rep(i,N){
		cin>>a>>b;
		rep(j,9){
			int x=a+dx[j],y=b+dy[j];
			if(x<=1 || x>=H || y<=1 || y>=W)continue;
			cnt[mp[{x,y}]++]--;
			cnt[mp[{x,y}]]++;
		}
	}
	rep(k,10)cout<<cnt[k]<<endl;
	return 0;
}


Measured memory_bytes: 56448
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=1e5+5;
char s[N];int a,b,n,c,cc;
int main(){
	scanf("%d%d%d%s",&n,&a,&b,s+1),a+=b;
	fp(i,1,n){
		switch(s[i]){
			case 'c':puts("No");break;
			case 'a':puts(c+1<=a?(++c,"Yes"):"No");break;
			case 'b':puts(c+1<=a&&cc+1<=b?(++c,++cc,"Yes"):"No");break;
		}
	}
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main() {
  char C;
  cin >> C;
  string s = "abcdefghijklmnopqrstuvwxyz";
  // 26 letters at total
  for (int i = 0; i < 25; i++){
    if (C == s.at(i)){
      cout << s.at(i+1) << endl;
      break;
    }
    else {
    }
    
  }
  
}
  
  


Measured memory_bytes: 384
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int confirm = (n - m) * 100;
        int half = m * 1900;
        int result = (confirm + half) * (int) Math.pow(2, m);

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <sstream>

using namespace std;


int main(int argc, const char * argv[]) {
    int A, B;
    cin >> A >> B;
    int *push = (A > B) ? &A : &B;
    int count = *push;
    (*push)--;
    push = (A > B) ? &A : &B;
    count += *push;
    
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,a,b,c,d;
  cin >> N;
  a = N / 1000;
  N = N % 1000;
  b = N / 100;
  N = N % 100;
  c = N / 10;
  N = N % 10;
  d = N;
  
  if(a == b && b == c){
    cout << "Yes" << endl;
  }else if (b == c && c == d){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#define M 1000000007
#define M 998244353
const int inf=4e18;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n,x,y;cin>>n>>x>>y;
	map<int,int> mp;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			int d;
			if(j<=x)
				d=j-i;
			else if(i<=x&&j<=y)
				d=min(j-i,x-i+1+y-j);
			else if(i<=x&&j>y)
				d=x-i+1+j-y;
			else if(i>x&&j<=y)
				d=min(j-i,i-x+1+y-j);
			else if(i>x&&j>y)
				d=min(j-i,i-x+1+j-y);
			else
				d=j-i;
			mp[d]++;
		}
	}
	for(int i=1;i<n;i++)
		cout<<mp[i]<<'\n';
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
#define fir first
#define sec second
typedef long long ll;
////////////////////////////////////////////////////////////
int main(){
	ll n , k;
	cin >> n >> k;
	string s;
	cin >> s;

	vector<ll> v;
	if( s[0] == '0' ) v.push_back(-1);
	else v.push_back(1);

	for( ll i = 1 ; i < s.size() ; i++ ){
		ll l = v.size() - 1;
		if( v[l] > 0 && s[i] == '1' ) v[l]++;
		else if( v[l] > 0 && s[i] == '0' ) v.push_back(-1);
		else if( v[l] < 0 && s[i] == '0' ) v[l]--;
		else v.push_back(1);
	}

	ll len = v.size();
	ll sum0 = 0;
	rep(i,0,len) if( v[i] < 0 ) sum0++;

	if( sum0 <= k ) cout << n << endl;
	else{
		ll start = 0;
		if( v[0] < 0 ) start = 1;

		ll maxAns = 0;
		ll ans = 0;
		for( ll i = start ; i < k * 2 + 1 + start && i < len ; i++ ) ans += abs(v[i]);
		maxAns = ans;

		for( ll i = start + 2 ; i + k * 2  < len ; i+=2 ){
			ans -= abs(v[i-1]);
			ans -= abs(v[i-2]);
			ans += abs(v[i+k*2]);
			ans += abs(v[i+k*2-1]);
			maxAns = max( maxAns , ans );
			//cout << i << " " << i+k*2 << endl;
		}

		if( v[0] < 0 ){
			ans = 0;
			rep(i,0,k*2) ans += abs(v[i]);
			maxAns = max( maxAns , ans );
		}

		if( v[len-1] < 0 ){
			ans = 0;
			for( ll i = 0 ; i < k*2 ; i++ ) ans += abs(v[len-1-i]);
			maxAns = max( maxAns , ans );
		}

		cout << maxAns << endl;

	}


	ret 0;
}

Measured memory_bytes: 1528
#include <iostream>

using namespace std;
typedef long long ll;
ll dp[200010] = {},sum[200010] = {},l[20],r[20],mod = 998244353;
int main(){
    int i,j,n,k; cin >> n >> k;
    for(i=0;i<k;i++) cin >> l[i] >> r[i];
    dp[1] = 1; sum[1] = 1;
    for(i=2;i<=n;i++){
        for(j=0;j<k;j++){
            (dp[i] += (sum[max(0LL,i - l[j])] - sum[max(0LL,i - r[j] - 1)] + mod)%mod) %= mod;
        }
        sum[i] = (sum[i - 1] + dp[i])%mod;
    }
    cout << dp[n] << endl;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> cnt(M);

  for (int i = 0; i < N; i++) {
    int K;
    cin >> K;
    for (int j = 0; j < K; j++) {
      int A;
      cin >> A;
      --A;
      ++cnt.at(A);
    }
  }
  int ans;
  for (int i = 0; i < M; i++) {
    if(cnt.at(i)==N){
      ++ans;
    }
  }
  cout << ans << endl;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<string> N(n);
  rep(i,n){cin >> N.at(i);}
  vector<string> M(m);
  rep(i,m){cin >> M.at(i);}
  int tmp;
  bool flag=false;
  tmp = n-m+1;
  rep(i,tmp){
    rep(j,tmp){
      rep(k,m){if(M.at(k)==N.at(i+k).substr(j,m)){flag=true;}
               else{flag=false;break;}
              }
      
      if(flag){cout <<"Yes" << endl;return 0;}
    }
  }
  cout << "No" << endl;
    
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int i;
 string s;
 cin >> s;
 //>> m1 >> h2 >> m2 >> k;
 for(i=0;i<s.length();i++)
 {
  if(s[i]=='?')
  s[i]='D';
 }
 cout << s;
 return 0;
}

Measured memory_bytes: 3680
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in)) {
			long n = sc.nextLong();
			long a = sc.nextLong();
			long b = sc.nextLong();
			// 端数
			long mod = n % (a + b);
			if(mod <= a) {
				System.out.println(a * (n / (a + b)) + mod);
			} else {
				System.out.println(a * (n / (a + b)) + a);
			}
		}

	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

vi to[200005];
vi ans;

void dfs(int v, int p = -1) {
  for (int u : to[v]) {
    if (u == p) continue;
    ans[u] += ans[v];
    dfs(u,v);
  }
}

int main () {
  int N, Q; cin >> N >> Q;
  REP(i,N-1) {
    int a, b; cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  ans.resize(N);
  REP(i,Q) {
    int p, x; cin >> p >> x;
    --p;
    ans[p] += x;
  }

  dfs(0);
  REP(i,N) {
    cout << ans[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 23552
N = int(input())
t = [0];x = [0]
for _ in range(N):
    a,b,c = map(int,input().split())
    t.append(a)
    x.append(b+c)
flg = 1
for i in range(N):
    if ((x[i+1]-x[i])-(t[i+1]-t[i]))%2==1 or x[i+1]>t[i+1]:
        print("No")
        flg = 0
        break
if flg: print("Yes")

Measured memory_bytes: 10940
(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let n = Scanf.sscanf (read_line ()) "%d" (
        fun n -> 
                n
)

let array = Str.split (Str.regexp " ") (read_line ())
            |> List.map int_of_string 
            |> List.sort compare
            |> Array.of_list

let () =
        (
                let lmax = Array.max (Array.sub array 0 (n / 2)) in
                let rmin = Array.min (Array.sub array (n / 2) (n / 2)) in
                        if lmax = rmin then
                                0
                        else
                                List.range lmax `To (rmin - 1)
                                |> List.length
        ) |> Printf.printf "%d\n"


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

int main(){    
  string S;
  cin >> S;
  
  if(S.at(0) == S.at(1)|| S.at(1) == S.at(2)){
    cout << "Bad" << endl;
  }
  else if(S.at(2) == S.at(3)){
    cout << "Bad" << endl;
  }
  else cout << "Good" << endl;
}


Measured memory_bytes: 256
n = gets.to_i
d = gets.split.map(&:to_i)
cnt = 0
(1..(d.length-2)).each {|i| cnt+=1 if d[i] > d[i-1] && d[i] < d[i+1] or d[i] < d[i-1] && d[i] > d[i+1]}
p cnt

Measured memory_bytes: 1788
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  int N;in(N);
  out((N+1)/2);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();

	int A[100000];
	rep(i, N) A[i] = getint() ^ ((i & 1) << 30);

	const int b = 8;
	int tmp[100001];
	int kazu[1 << b] = {}, kazu2[1 << b] = {}, kazu3[1 << b] = {}, kazu4[1 << b] = {};
	rep(i, N) kazu[A[i] & ((1 << b) - 1)]++;
	rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
	for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] & ((1 << b) - 1)]] = A[i];
	rep(i, N) kazu2[tmp[i] >> b & ((1 << b) - 1)]++;
	rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
	for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> b & ((1 << b) - 1)]] = tmp[i];
	rep(i, N) kazu3[A[i] >> 2 * b & ((1 << b) - 1)]++;
	rep(i, (1 << b) - 1) kazu3[i + 1] += kazu3[i];
	for (int i = N - 1; i >= 0; i--) tmp[--kazu3[A[i] >> 2 * b & ((1 << b) - 1)]] = A[i];
	rep(i, N) kazu4[tmp[i] >> 24 & ((1 << 6) - 1)]++;
	rep(i, (1 << 6) - 1) kazu4[i + 1] += kazu4[i];
	for (int i = N - 1; i >= 0; i--) A[--kazu4[tmp[i] >> 24 & ((1 << 6) - 1)]] = tmp[i];

	int kotae = 0;
	for (int i = 0; i < N; i += 2) {
		kotae += A[i] >> 30 & 1;
	}
	printf("%d\n", kotae);

	Would you please return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define rep(x, a, b) for(int x = (a); x <= (b); ++x)
#define rop(x, a, b) for(int x = (a); x < (b); ++x)
#define per(x, a, b) for(int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
int n, a[3005];
struct tree {
	int hd[3005], vr[6005], nt[6005], tt;
	void push(int x, int y) {
		vr[++tt] = y; nt[tt] = hd[x]; hd[x] = tt;
	}
	int dfs(int nw) {
		for(int i = hd[nw]; i; i = nt[i]) {
			if(a[vr[i]] >= a[nw]) continue;
			if(!dfs(vr[i])) return 1;
		}
		return 0;
	}
}T;
int x, y;
int main() {
	scanf("%d", &n);
	rep(i, 1, n) scanf("%d", &a[i]);
	rop(i, 1, n) {
		scanf("%d%d", &x, &y);
		T.push(x, y);
		T.push(y, x); 
	}
	rep(i, 1, n) {
		if(T.dfs(i)) printf("%d ", i);
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split(" ")))

two = 0
one = 0
zero = 0
for a in A:
	if a%4 == 0:
		two += 1
	elif a%2 == 0:
		one += 1
	else:
		zero += 1

print("Yes" if zero <= two+(one==0) else "No") 


Measured memory_bytes: 15020
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

//Main
var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	S, T := nextStr(), nextStr()
	ans := "Yes"
	lenS, lenT := len(S), len(T)
	if lenS < 1 && lenS > 10 {
		ans = "No"
	}
	if lenT != lenS+1 {
		ans = "No"
	}
	if S != T[:lenS] {
		ans = "No"
	}

	fmt.Println(ans)

}


Measured memory_bytes: 1756
import java.util.*;
class Main{
  public static void main(String[]z){
    Scanner x=new Scanner(System.in);
    int i=0;
    while(x.hasNext()){
      String s=x.nextLine();
      if(s.equals(new StringBuffer(s).reverse().toString()))i++;
    }
    System.out.println(i);
  }
}

Measured memory_bytes: 11000
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    vector<int> numbers;
    cin >> n;
    for(int i =0; i < n; i++){
        int k;
        cin >> k;
        numbers.push_back(k);            
    }
    sort(numbers.begin(),numbers.end());
    float result = numbers[0];
    for(int i = 1; i < n;i++){
        result = (result + numbers[i]) / 2.0;
    }
    cout << result;
}

Measured memory_bytes: 256
fn main() {
    let mut buf = String::new();
    let _ = std::io::stdin().read_line(&mut buf).ok();
    let _: usize = buf.trim().parse().unwrap();
    let mut buf = String::new();
    let _ = std::io::stdin().read_line(&mut buf).ok();
    let buf: Vec<&str> = buf.split_whitespace().collect();
    let v: Vec<i64> = buf.iter().map(|&x| x.parse().unwrap()).collect();
    for (i, e) in v.iter().enumerate() {
        print!("node {}: ", i + 1);
        print!("key = {}, ", e);
        if i != 0 {
            print!("parent key = {}, ", v[(i + 1) / 2 - 1]);
        }
        if 2 * (i + 1) - 1 <= v.len() - 1 {
            print!("left key = {}, ", v[2 * (i + 1) - 1]);
        }
        if 2 * (i + 1)  <= v.len() - 1 {
            print!("right key = {}, ", v[2 * (i + 1)]);
        }
        println!();
    }

}



Measured memory_bytes: 5028
#include<bits/stdc++.h>
using ll = int_fast64_t;

struct UnionFind {
        std::vector<ll> data;

        UnionFind(ll size): data(size, -1){};

        ll root(ll x){
                if(data[x]<0) return x;
                return data[x] = root(data[x]);
        }

        void unite(ll x, ll y){
                x = root(x);
                y = root(y);
                if(x==y) return;

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

        bool find(ll x, ll y){
                return root(x)==root(y);
        }
};


int main(){
        int n, m;
        scanf("%d %d", &n, &m);

        UnionFind tree(n);
        for(int i=0; i<m; i++){
                int x, y, z;
                scanf("%d %d %d", &x, &y, &z);
                tree.unite(x-1, y-1);
        }

        int ans = 0;
        for(auto i: tree.data) ans += (i<0);
        printf("%d\n", ans);
        return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=2001;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
int main()
{
    std::ios::sync_with_stdio(false);
    int n,sum=0;
    cin>>n;
    bitset<N*N> bi;
    bi[0]=1;
    for(int i=1;i<=n;i++)
    {
        /* Make sum=all input [ a1,a2,,,,aN]...  S^2N−1=sum. Now, set{ a1,sum-a1} , {  a2,sum-a2} ,,,,,,
        . let Xi be { a1,a2,..aN } and the remaining numbers (sum-a1 or sum-a2 or.  ...) are recorded as Yi; And make P=min (Xi,Yi), Q=max (Xi,Yi); available: P≤q,p+q=s2n−1=sum,
        from which P≤12sum,q≥12sum is introduced and can be P∈{S1,S2,⋯,S2N−1−1},Q∈{S2N−1,⋯,
        also min( of Xi's) and max(Yi's) difference is constant (for any arbitrary i/o) , it is the median /answer here .....
        */
        int c;
        cin>>c;
        sum+=c;

        /*cout<<" bef : "<<bi<<" | "<<(bi<<c)<<" -- ";/*here are 3 digits: "1 3 2", now to the ' 2 ' number,
        the front ' 1 ', ' 3 ' can be composed and has {0, 1, 3, 4}; So Bitset is now in a state of "11011"
        (the rightmost is No. 0), and if you do not use the number ' 2 ', the state is still "11011"; if the
        number of ' 2 ' is used, the status is "1101100" (i.e., previously available and all +2), and finally
        the two States or (∣) are put up , You get the new state "11111111" (that is, the 0~6 can be made up).*//*
        https://blog.csdn.net/XzzF1024/article/details/79181725 */
        bi|=bi<<c;
        ////cout<<bi<<endl;
    }
    if(n==1) return cout<<sum,0;
    for(int i=(sum+1)/2;i<=sum;i++)
    {
        if(bi[i])
        {
            cout<<i<<endl; 
return 0;
        }
    }

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define emp emplace
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
const ll MAXN = 200100;
const ll INF = 1e9;
const ll MOD = 1e9+7;

ll N,Q,a,b,c,d,e,T;
vi V;
ll A[MAXN];
ll B[MAXN];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll C = 100;
	ll T = 0;
	cin>>a;
	while (C<a){
		C = (ld)C * (ld)1.01;
		++T;
	}
	cout<<T;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main(void)
{
	int h, m, s;
	int t;
	
	while (scanf("%d %d %d", &h, &m, &s), h != -1 || m != -1 || s != -1){
		
		t = 7200 - (h * 3600 + m * 60 + s);
		
		printf("%02d:%02d:%02d\n", t / 3600, t % 3600 / 60,  t % 3600 % 60);
		
		t *= 3;
		
		printf("%02d:%02d:%02d\n", t / 3600, t % 3600 / 60,  t % 3600 % 60);
		
	}
	
	return (0);
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}
bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された

    if(n%2 == 0) return false;
    if(n%3 == 0) return false;
    // 2と3の倍数でないので6の倍数ではないことが保証された

    if(n%6 != 1 && n%6 != 5) return false;
    // 6の倍数前後の数(素数かもしれない数)であることが保証された

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i=5;i*i<=n;i+=6){
        if(n%i     == 0) return false; // 6n-1
        if(n%(i+2) == 0) return false; // 6n+1
    }

    return true;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  I n;
  cin >> n;
  I t=n;
  while (true){
    if(is_prime(t)){
      cout << t << endl;
      return 0;
    }else{
      t++;
    }
  }
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
ll power(ll x,ll y,ll p) 
{ 
    ll res=1;  
    x=x%p;
    while (y > 0) 
    { 
        if(y&1) 
            res=(res*x)%p; 
        y=y>>1;
        x=(x*x)%p;   
    } 
    return res; 
}
const ll L = 1e5 + 5;
ll dp[101][L];
ll w[101];
ll v[101];
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll i,j,n,w1;
 	cin >> n >> w1;
	for(i=0;i<n;i++)
		cin >> w[i] >> v[i];
	ll ans = -1;
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=1e5;j++)
		{
			if(j == 0)
				dp[i][j] = 0;
			else if(i == 0)
				dp[i][j] = 1e18;
			else
			{
				ll v1 = 1e18,v2 = 1e18;
				if(j >= v[i-1])
					v1 = dp[i-1][j-v[i-1]] + w[i-1];
				v2 = dp[i-1][j];
				dp[i][j] = min(v1,v2);
			}
		}
	}
	for(i=0;i<=1e5;i++)
	{
		if(dp[n][i] <= w1)
			ans = max(ans,i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

void solve(istream& cin, ostream& cout) {
  int l, r, d;
  cin >> l >> r >> d;
  int ans = 0;
  FOR(i, l, r) {
    if (i % d == 0) ans++;
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    string S;cin>>S;
    cout<<((S[0]==S[2])?"Yes":"No")<<endl;
}

Measured memory_bytes: 3576