akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-9;
const double INFD = numeric_limits<double>::infinity();
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)n; i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
bool nearlyeq(double x, double y) { return abs(x - y) < eps; }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vll xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

/*******************************************************/

int main() {
	int n, k; cin >> n >> k; k--;
	string s; cin >> s;
	s[k] -= 'A' - 'a';
	cout << s << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
using namespace std;
typedef long long LL;
const int N=1e5;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
const int mo=1e7+9;
int head[mo],nxt[N],w[N],v[N],tot;LL to[N];
int c[N][4];
//有旋转同构，我们强制其中标号最小的方块向前方正方
//然后枚举最小的方块和最小的方块相对的方块，这样每个方块的四个角的颜色都确定了，用哈希求剩下四个面的方案数即可
//有个小trick，四个角的颜色可能有循环节，注意到哈希值相同的方块循环节也一定相同，所以求值时同时乘上循环节大小
inline void ins(LL s,int t) {
	int h=s%mo;
	for (int i=head[h];i;i=nxt[i])
		if (to[i]==s) { w[i]+=t; return; }
	to[++tot]=s,nxt[tot]=head[h],head[h]=tot,w[tot]=t;
	v[tot]=s%1000000==s/1000000?(s%1000==s/1000000000?4:2):1;
}
inline int find(LL s) {
	for (int i=head[s%mo];i;i=nxt[i])
		if (to[i]==s) return w[i]*v[i];
	return 0;
}
inline LL get(int k,int t) { LL s=0; for (int i=0;i<4;i++) s=s*1000+c[k][(t+i)&3]; return s; }
inline void Add(LL s,int t) {
	LL p[4];
	for (int i=0;i<4;i++) p[i]=s,s=s/1000+s%1000*1000000000;
	sort(p,p+4);
	for (int i=0;i<4;i++) if (!i||p[i]!=p[i-1]) ins(p[i],t);
}
inline void add(int k,int t) { Add(get(k,0),t); }
int main()
{
	int n=gi(),i,j,k,t;LL s,ans=0,pi;
	for (i=0;i<n;add(i++,1))
		for (j=0;j<4;j++)
			c[i][j]=gi();
	for (i=0;i<n;i++) {
		add(i,-1);
		for (j=i+1;j<n;j++) {
			add(j,-1);
			reverse(c[j],c[j]+4);
			for (k=0;k<4;k++) {
				pi=1;
				for (t=0;t<4;t++) {
					s=((c[j][(k+t)&3]*1000LL+c[j][(k+t+1)&3])*1000+c[i][(t+1)&3])*1000+c[i][t];
					pi*=find(s);
					if (!pi) break;
					Add(s,-1);
				}
				while (t--) {
					s=((c[j][(k+t)&3]*1000LL+c[j][(k+t+1)&3])*1000+c[i][(t+1)&3])*1000+c[i][t];
					Add(s,1);
				}
				ans+=pi;
			}
			reverse(c[j],c[j]+4);
			add(j,1);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 39424
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long start = System.nanoTime();
        while (true) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int t = sc.nextInt();
            int p = sc.nextInt();
            if (n == 0 && m == 0 && t == 0 && p == 0)
                break;

            int[][] paper = initializeArray(n, m);

            for (int i=0; i < t; i++) {
                int d = sc.nextInt();
                int c = sc.nextInt();
                int[][] newPaper;
                if (d == 1) {
                    int newWidth = paper.length > 2 * c ? paper.length - c : c;
                    newPaper = new int[newWidth][paper[0].length];

                    for (int w=c; w < paper.length; w++) {
                        for (int h=0; h < paper[0].length; h++) {
                            newPaper[w - c][h] = paper[w][h];
                        }
                    }

                    for (int w=0; w < c; w++) {
                        for (int h=0; h < paper[0].length; h++) {
                            newPaper[c - w - 1][h] += paper[w][h];
                        }
                    }
                } else {
                    int newHeight = paper[0].length > 2 * c ? paper[0].length - c : c;
                    newPaper = new int[paper.length][newHeight];

                    for (int w=0; w < paper.length; w++) {
                        for (int h=c; h < paper[0].length; h++) {
                            newPaper[w][h - c] = paper[w][h];
                        }
                    }

                    for (int w=0; w < paper.length; w++) {
                        for (int h=0; h < c; h++) {
                            newPaper[w][c - h - 1] += paper[w][h];
                        }
                    }
                }

                paper = newPaper;
                // System.out.println(Arrays.deepToString(paper));
            }

            for (int i=0; i < p; i++) {
                int x = sc.nextInt();
                int y = sc.nextInt();

                System.out.println(paper[x][y]);
            }
        }

        long time = System.nanoTime() - start;
        // System.out.printf("Took %s ms.\n", time/1_000_000d);
    }

    private static int[][] initializeArray(int n, int m) {
        int[][] ret = new int[n][m];
        for (int i=0; i < n; i++) {
            for (int j=0; j < m; j++)
                ret[i][j] = 1;
        }
        return ret;
    }


}


Measured memory_bytes: 42044
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, int num=0){
  if(num == 0) num = (int)v.size();
  if(is_reverse) for(int i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<" ";}
  else for(int i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<" ";}
  cout << endl;
}

template <typename T>
void print_pairvec(const vector<T> &v, int num=0){
  if(num == 0) num = (int)v.size();
  cout << endl;
  for(int i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
}


template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
  int N;
  cin >> N;
  using P = pair<int, int>;
  vector<P> ba(N);
  for(int i=0; i<N; i++){
    int a, b;
    cin >> a >> b;
    ba[i] = P(b, a);
  }
  sort(ba.begin(), ba.end());

  int t = 0;
  for(int i=0; i<N; i++){
    t += ba[i].second;
    if(t > ba[i].first){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 4824
a,b=map(int,input().split())
c=0
d=0
for i in range(a,b+1):
  i =str(i)
  d=1
  for j in range(len(i)//2):
    if i[j]!=i[len(i)-j-1]:
      d=0
  if d==1:
    c+=1

print(c)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
vector<long long int>vec;
void primeFactors(long long int n)
{
while(n%2==0)
{
vec.push_back(2);
n/=2;
}
for(int i=3; i<=sqrt(n); i+=2)
{
while(n%i==0)
{
vec.push_back(i);
n/=i;
}
}
if(n>2)
vec.push_back(n);
}
int main()
{
long long int n;
cin>>n;
primeFactors(n);
map<long long int,int> freq,vis;
for(int i=0; i<vec.size(); ++i)
++freq[vec[i]];
long long int sum(0);
for(int i=0; i<vec.size(); ++i)
{
if(vis[vec[i]]==0)
sum+=(long long)(-1+sqrt(8*freq[vec[i]]+1))/2;
vis[vec[i]]=1;
}
cout<<sum;
}


Measured memory_bytes: 3720
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//#define int long long

void solve() {
	char a; cin >> a;
    int k = a - 'a';
    ++k;
    char b = 'a' + k;
    cout << b << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
const int N=3e3+5,MAX=3e7,MOD=1e9+7;
 
using namespace std;
 
int n;
int a[N];

ll memo[N][N][2];

ll solve(int l ,int r,int turn){

	 if(l>r)return 0;
     
     ll &ret = memo[l][r][turn];

     if(ret != -1e18)return ret;
     
     if(turn == 0){

     	 
     	 	ret = a[l]+solve(l+1,r,!turn);
     	
     	 	ret = max(ret,a[r]+solve(l,r-1,!turn));
     }
     else{

     	 ret = -a[l]+solve(l+1,r,!turn);

     	 ret = min(ret , -a[r]+solve(l,r-1,!turn));
     }

     return ret;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //#ifndef ONLINE_JUDGE
      //freopen("test.txt","r",stdin);
    //#endif

      scanf("%d",&n);


      for(int i=0;i<n;i++)scanf("%d",&a[i]);

      for(int i=0;i<N;i++)for(int j=0;j<N;j++)for(int k=0;k<2;k++)memo[i][j][k]=-1e18;


      printf("%lld\n",solve(0,n-1,0));

      
   
     
}

Measured memory_bytes: 141568
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define inf 1000000007
#define coc g[node][i]
#define N 5005
using namespace std;

int n, a[N], b[N], dp[N][N];
vector < int > g[N];

void dfs(int node){
	int sz = g[node].size();
	for(int i = 1; i < sz; i++)
		dfs(coc);
	// for(int i = 1; i < N; i++)
	// 	dp[0][i] = inf;
	for(int i = 1; i < sz; i++)
		for(int j = 0; j < N; j++){
			dp[i][j] = inf;
			if(j >= b[coc])
				dp[i][j] = dp[i - 1][j - b[coc]] + a[coc];
			if(j >= a[coc])
				dp[i][j] = min(dp[i][j], dp[i - 1][j - a[coc]] + b[coc]);
			// if(node == 2)
			// 	printf("dp[%d][%d] = %d\n", i, j, dp[i][j]);
		}
	int mn = inf;
	for(int i = 0; i <= a[node]; i++)
		mn = min(mn, dp[sz - 1][i]);
	if(mn >= inf){
		printf("IMPOSSIBLE\n");
		exit(0);
	}
	b[node] = mn;
	// cout << node << " " << a[node] << " " << b[node] << endl;
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("outt.txt", "w", stdout);
	scanf("%d",&n);
	for(int i = 1; i <= n; i++)
		g[i].pb(0);
	for(int i = 2; i <= n; i++){
		int x;
		scanf("%d",&x);
		g[x].pb(i);
	}
	for(int i = 1; i <= n; i++)
		scanf("%d",a + i);
	dfs(1);
	printf("POSSIBLE\n");
	return 0;
}

Measured memory_bytes: 20736
/*---> 12 April 2020 <--- > 23:49:31 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e5+5;

int32_t main(){__
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        if(i%15==0 || i%3==0 || i%5==0)
            continue;
        ans+=i;
    }
    cout<<ans<<"\n";
return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
  int N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  int minimum;
  minimum=min({A,B,C,D,E});
  int count=(N+minimum-1)/minimum;
  cout << count+4 << endl;
}

Measured memory_bytes: 384
#include <stdio.h>
int H,W,i,j;
int main(){
  for(;;){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0){
      return 0;
    }
    for(i=0;i<H;i++){
      for(j=0;j<W;j++){
        if(i%2==0&&j%2==0){
          printf("#");
        } else if(i%2==0&&j%2==1){
          printf(".");
        } else if(i%2==1&&j%2==0){
          printf(".");
        } else if(i%2==1&&j%2==1){
          printf("#");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
}

Measured memory_bytes: 2576
p = [True for _ in xrange(1000000)]
p[0] = False
p[1] = False
for i in xrange(1000000):
    if p[i]:
        for j in xrange(i+i, 1000000, i):
            p[j] = False
ans = [0 for _ in xrange(1000000)]
for i in xrange(2, 1000000):
    ans[i] = ans[i-1] + p[i]
        
import sys
for line in sys.stdin:
    N = int(line)
    print ans[N]

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

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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

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

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
default_random_engine generator;
// mt19937 rnd(1);

int main() {
#ifdef LOCAL
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);  
#endif 

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0); 
    cout << setprecision(12) << fixed;
    cerr << setprecision(12) << fixed;      

    string s;
    cin >> s;
    int n = sz(s) + 1;

    vector<int> arr(n);

    int cur = 0;
    for (int i = 1; i < n; ++i) {
        if (s[i - 1] == '<') {
            ++cur;
        } else {
            cur = 0;
        }
        arr[i] = cur;
    }

    cur = 0;
    for (int i = n - 2; i >= 0; --i) {
        if (s[i] == '>') {
            ++cur;
        } else {
            cur = 0;
        }
        arr[i] = max(arr[i], cur);
    }


    ll res = 0;
    for (int el : arr) {
        res += el;
    }
    cout << res << endl;


#ifdef LOCAL
    cerr << "Time: " << double(clock()) / CLOCKS_PER_SEC << endl;
#endif
}

 

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

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

  vector<int> buka(n + 1, 0);

  for (int i = 2; i <= n; i++) {
    int num;
    cin >> num;
    buka[num] += 1;
  }

  for (int i = 1; i <= n; i++) {
    printf("%d\n", buka[i]);
  }
}


Measured memory_bytes: 3920
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ll N, K;
    cin >> N >> K;
    vector<pair<ll, ll>> p(N);
    for (int i = 0; i < N; ++i) {
        int a, b;
        cin >> a >> b;
        p[i] = make_pair(a, b);
    }
    sort(p.begin(), p.end());
    for (int i = 0; i < N; ++i) {
        K -= p[i].second;
        if(K <= 0){
            cout << p[i].first << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	ll n, c, k;
	cin >> n >> c >> k;
	vector<ll> t(n);
	rep(i,n) cin >> t[i];
	int ans = 0;
	sort(ALL(t));
	for(int i = 0; i < n;) {
		ll limT = t[i] + k;
		ll cnt = 0;
		while (i < n && cnt < c && t[i] <= limT) {
			i++;
			cnt++;
		}
		ans++;
	}
	cout << ans << endl;
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 3988
N = int(input())
l = []
for i in range(N):
    s,p = input().split()
    l.append([s,int(p),i+1])

l = sorted(l,key = lambda x:x[1],reverse=True)
l = sorted(l,key = lambda x:x[0])

for i in range(N):
    print(l[i][2])

Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
signed main(){
	int n;cin>>n;
	int m;cin>>m;

	vi to[200200];
	map<pii,int> mp;
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		int x=min(a,b);
		int y=max(a,b);
		if(mp[make_pair(x,y)]>0) continue;
		to[x].pb(y);
		to[y].pb(x);
		mp[make_pair(x,y)]=1;
	}
	int ans=-1;
	vi visit(n,0);
	rep(i,n){
		if(visit[i])continue;
		queue<int> q;
		q.push(i);
		visit[i]=1;
		int cnt=1;
		while(!q.empty()){
			int p=q.front();
			q.pop();
			for(auto v:to[p]){
				if(visit[v]) continue;
				q.push(v);
				cnt++;
				visit[v]=1;
			}
		}
		chmax(ans,cnt);	
	}
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 31056
package main

import (
	"fmt"
	"sort"
)

func main() {
	v := make([]int, 3)

	for i := range v {
		t := 0
		fmt.Scan(&t)
		v[i] = t
	}
	sort.Ints(v)

	for i, vi := range v {
		if i != 0 {
			fmt.Print(" ")
		}
		fmt.Print(vi)
	}
	fmt.Println()
}



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

int main() {
  int N,M;
  cin>>N>>M;
  
  vector<int> bkt(M);
  
  for(int i=0;i<N;++i){
    int K;
    cin>>K;
    
    for(int j=0;j<K;++j){
      int A;
      cin>>A;
      --A;
      ++bkt[A];
    }
  }
  
  int ans=0;
  for(int i=0;i<M;++i){
    if(bkt[i]==N)
      ++ans;
  }
  
  cout<<ans<<endl;
}


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

int main(){
  int n;
  cin >> n;
  vector<int>b(n);
  vector<int>a(n);
  int ans=0; 
  for(int i=0; i<n-1; i++){
    cin >> b.at(i);
  }
  for(int i=0; i<n; i++){
    if(i==0){
      a.at(i)=b.at(i);
    }
    else if(i==n-1){
      a.at(i)=b.at(i-1);
    }
    else{
      a.at(i)=min(b.at(i-1),b.at(i));
    }
  }
  for(int i=0; i<n; i++){
    ans+=a.at(i);
  }
    
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	int h,w,p; cin>>h>>w>>p;
	vi a(h),b(w);
	vector<string> s(h);
	rep(i,0,h){
		string t; cin>>t;
		s[i]=t;
		rep(j,0,w){
			if(s[i][j]=='#'){
				a[i]++; b[j]++;
			}
		}
	}
	
	int ans=0;
	rep(i,0,1<<h){
		rep(j,0,1<<w){
			int cnt=0;
			rep(k,0,h){
				if(i>>k&1)continue;
				rep(l,0,w){
					if(j>>l&1)continue;
					if(s[k][l]=='#')cnt++;
				}
			}
			if(cnt==p)ans++;
		}
	}
	cout<<ans<<endl;	
	
	return 0;
}

Measured memory_bytes: 3612
package main

import (
	"fmt"
)

func main() {
	var a,b int
	fmt.Scan(&a,&b)

	if a<6 {
		fmt.Println(0)
	} else if a<13 {
		fmt.Println(b/2)
	} else {
		fmt.Println(b)
	}
}


Measured memory_bytes: 512
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, C = input().split()
    ans = A[0] + B[0] + C[0]
    print(ans.upper())



if __name__ == '__main__':
    main()


Measured memory_bytes: 9000
import java.util.Scanner;

class Main{
	static final long MOD = 1000000007;

	static int H, W, K;
	static long[][] dp = new long[110][10];
	static int ans = 0;
	static long n = 0;
	




	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		 n = sc.nextLong();
		dfs(0);
		System.out.println(ans);

	}

	static void dfs(long x){
		if(x > n){
			return;
		}
		if(check(x)){
			ans++;
		}
		
		dfs(10*x + 3);
		dfs(10*x + 5);
		dfs(10*x + 7);



	}
	
	static boolean check(long x){
		String mozi = String.valueOf(x);
		if(mozi.contains("3") && mozi.contains("5" )&& mozi.contains("7")){
			return true;
		}else{
			return false;
			 
		}
	}

}







class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}


Measured memory_bytes: 24148
#include<iostream>
using namespace std;
int main(void){
	
	int n,h,w,i,ans=0,a,b;
	cin>>n>>h>>w;
	for(i=0;i<n;i++){
		cin>>a>>b;
		if(h<=a&&w<=b)ans++;
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  vector<int> T(N);
  int Tsum = 0;
  for (int i = 0; i < N; i++)
  {
    cin >> T.at(i);
    Tsum += T.at(i);
  }
  
  int M;
  cin >> M;
  vector<int> P(M), X(M);
  for (int i = 0; i < M; i++) cin >> P.at(i) >> X.at(i);
  
  for (int i = 0; i < M; i++)
  {
    int ans = Tsum - T.at(P.at(i) - 1) + X.at(i);
    cout << ans << endl;
  }
}

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

using namespace std;
typedef long long ll;

bool comp(pair<int, int> a, pair<int, int> b) {
        return a.first > b.first;
}
int main() {
    int N; cin >> N;
    vector<pair<int, int>> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }

    sort(a.begin(), a.end(), comp);

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (a[j].second == i) continue;
            else {
                cout << a[j].first << endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 3200
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);
 
#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(){
    string s;
    cin >> s;
    bool leng, beg_en;
    leng = s.size()%2;
    beg_en = s[0]==s[s.size()-1];
    if(leng ^ beg_en)
        cout << "First" << endl;
    else
        cout << "Second" << endl;

}


Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

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-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 2000020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;


void solve() {
	int N, K; cin >> N >> K;
	vector<int>A(N);
	REP(i, N)cin >> A[i];
	vector<int>zero, mi, pl;
	VSORT(A);
	REP(i, N) {
		if (A[i] == 0)zero.push_back(A[i]);
		else if (A[i] > 0)pl.push_back(A[i]);
		else mi.push_back(-A[i]);
	}
	VSORT(mi);
	ll ok = 1e18, ng = -1e18-1;
	while (abs(ok - ng) > 1) {
		ll mid = (ok + ng) / 2;
		//print(mid);
		ll cnt = 0;
		if (mid >= 0) {
			cnt += zero.size()*(mi.size() + pl.size());
			cnt += zero.size()*(zero.size() - 1) / 2;
			cnt += mi.size()*pl.size();
			REP(i, pl.size()) {
				auto itr = ub(pl, mid / pl[i]);
				int id = itr - pl.begin();
				//pe(i); print(id);
				if (id <= i+1)break;
				cnt += id - i-1;
			}
			REP(i, mi.size()) {
				auto itr = ub(mi, mid / mi[i]);
				int id = itr - mi.begin();
				if (id <= i+1)break;
				cnt += id - i-1;
			
			}
		}
		else {
			REP(i, mi.size()) {
				auto itr = lb(pl, (abs(mid)+mi[i]-1) / mi[i]);
				cnt += (pl.end() - itr);
			}
		}
		//DEBUG(cnt);
		if (cnt >= K)ok = mid;
		else ng = mid;
	}
	print(ok);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}


Measured memory_bytes: 4468
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class M>
struct DualSegmentTree{
    using T = typename M::T;
    int sz, height{};
    vector<T> lazy;
    explicit DualSegmentTree(int n) {
        sz = 1; while(sz < n) sz <<= 1, height++;
        lazy.assign(2*sz, M::e());
    }

    void eval(int k){
        if(lazy[k] == M::e()) return;
        lazy[(k<<1)|0] = M::f(lazy[(k<<1)|0], lazy[k]);
        lazy[(k<<1)|1] = M::f(lazy[(k<<1)|1], lazy[k]);
        lazy[k] = M::e();
    }
    void thrust(int k){ for (int i = height; i; --i) eval(k>>i); }
    void update(int a, int b, const T &x){
        thrust(a += sz); thrust(b += sz-1);
        for (int l = a, r = b+1;l < r; l >>=1, r >>= 1) {
            if(l&1) lazy[l] = M::f(lazy[l], x), l++;
            if(r&1) --r, lazy[r] = M::f(lazy[r], x);
        }
    }

    T operator[](int k){
        thrust(k += sz);
        return lazy[k];
    }
};

struct Monoid{
    using T = int;
    static T f(T a, T b) { return min(a, b); }
    static T e() { return INF<int>; }
};


int main() {
    ll n, q;
    cin >> n >> q;
    n -= 2;
    DualSegmentTree<Monoid> seg1(n), seg2(n);
    seg1.update(0, n, n);
    seg2.update(0, n, n);
    ll ans = n*n;
    for (int i = 0; i < q; ++i) {
        int a, x;
        cin >> a >> x;
        x -= 2;
        if(a == 1){
            int val = seg1[x];
            ans -= val;
            seg2.update(0, val, x);
        }else {
            int val = seg2[x];
            ans -= val;
            seg1.update(0, val, x);
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 7364
#include<bits/stdc++.h> 
#define ll                 long long                            
#define ra                 return a;                                          
#define pb                 push_back                                                     
#define sti                stack<ll>
#define spi                stack<pair<ll,ll>>
#define S                  second
#define msi                map<string,ll >
#define msi                map<string,ll >
#define mii                map<ll ,ll >
#define dbg(x)             { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y)          { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z)        { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define mis                map<ll , string>
#define rep(i,a,b)         for(ll  i=a;i<b;i++)
#define mpi                map<pair<ll ,ll >,ll >                                                
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define F                  first 
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define pqi                priority_queue<ll>
#define si                 set <ll>
#define vs                 vector<string>
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define hell               1000000007
#define bs                 binary_search
#define mp                 make_pair
#define qi                 queue<ll>
#define qs                 queue<string>
#define qpi                queue<pair<ll,ll>>
#define qps                queue<pair<ll,string>> 
#define endl               '\n' 
#define itr(a,it)          for(typeof(a.begin()) it=a.begin();it!=a.end();it++)// This will produce const_iterator for const object and normal iterator for non-const object
#define ss                 set<string>
using namespace std;
#define N  300005
ll dp[N];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
//    cin>>t;
    while(t--)
{
    ll n;
    cin>>n;
    ll a[n];
    rep(i,0,n)
    cin>>a[i];
//    cout<<dp[0]<<endl;
    dp[1]=abs(a[1]-a[0]);
    rep(i,2,n)
    {
    	dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }


    cout<<dp[n-1];
}
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i=0,a,tt=0,n;
	cin>>n;
	if(n%1000==0)
	{
		cout<<0;
		return 0;
	}
	while(i*1000<n)
	{
		i++;
		if(i*1000>n)
		{
			cout<<i*1000-n;
		}
	}
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}

struct edge
{
    long long to, cost;
};
using P = pair<int, int>;
int V;
const int MAX_V = 201;

vector<edge> G[MAX_V];


vll dijkstra(int start)
{
    vector<long long> d(MAX_V, INT_MAX);
    priority_queue<P, vector<P>, greater<P>> que;
    d[start] = 0;
    que.push(P(0, start));
    while (!que.empty())
    {
        P p = que.top();
        que.pop();
        long long v = p.second;
        if (d[v] < p.first)
        {
            continue;
        }
        for (int i = 0; i < G[v].size(); i++)
        {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost)
            {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
    return d;
}
int main()
{
    int N, M, R;
    cin >> N >> M >> R;
    vint r(R);
    int perm[R];
    for (size_t i = 0; i < R; i++)
    {
        cin >> r[i];
        perm[i] = i;
        r[i]--;
    }
    int a, b, c;
    for (size_t i = 0; i < M; i++)
    {
        cin >> a >> b >> c;
        a--;
        b--;
        G[a].emplace_back(edge{b, c});
        G[b].emplace_back(edge{a, c});
    }
    ll ans = INF;
    vvll dist = make_v<ll>(N,N); // dist [{a,b}] := aからbへの距離
    for (size_t i = 0; i < R; i++)
    {
        auto d = dijkstra(r[i]);
        for (size_t j = 0; j < R; j++)
        {
            dist[r[i]][r[j]]=d[r[j]];
        }
        
    }
    
    do
    {
        ll d = 0;
        for (size_t i = 0; i < R-1; i++)
        {
            d += dist[r[perm[i]]][r[perm[i+1]]];
        }
        chmin(ans,d);
    } while (next_permutation(perm,perm+R));
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

#define MAX 200000

int max(int a,int b) { return a>b ? a: b;}
int min(int a,int b) { return a<b ? a: b;}

int main(void) {
    int R[MAX], i, n;
    
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for(int i=1; i<n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    
    printf("%d\n",maxv);

    return 0;
}



Measured memory_bytes: 2568
using System;
using System.Collections.Generic;

class Program {
    static int Main(string[] args) {
        string v = Console.ReadLine();
        List<int> list = new List<int>();

        list.Add(int.Parse(v.Split(' ')[0]));
        list.Add(int.Parse(v.Split(' ')[1]));
        list.Add(int.Parse(v.Split(' ')[2]));

        list.Sort();

        string msg = string.Format("{0} {1} {2}", list[0], list[1], list[2]);
        Console.WriteLine(msg);
        return 0;
    }
}

Measured memory_bytes: 9384
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vll p(a), q(b), v(x+y+c);
	rep(i, a) cin >> p[i];
	rep(i, b) cin >> q[i];
	rep(i, c) cin >> v[i];
	sort(p.begin(), p.end(), greater<ll>());
	sort(q.begin(), q.end(), greater<ll>());
	rep(i, x) v[i+c] = p[i];
	rep(i, y) v[i+c+x] = q[i];
	sort(v.begin(), v.end(), greater<ll>());
	ll ans = 0;
	rep(i, x+y) ans += v[i];
	cout << ans << endl;
}


Measured memory_bytes: 3968
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]

# 0-index
for i in range(q):
    for j in range(2):
        lr[i][j] -= 1

# 'AC'のカウントの累積和
ac_cnt = [0 for i in range(n)]
for i in range(n-1):
    ac_cnt[i+1] = ac_cnt[i] + (1 if s[i:i+2] == 'AC' else 0)

for i in range(q):
    print(ac_cnt[lr[i][1]] - ac_cnt[lr[i][0]])

Measured memory_bytes: 32272
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define rep(i,a,b) for(ll (i)=a;(i)<(ll)(b);(i)++)
using ipair = pair<ll,ll>;
#define INF 10000000

int main(){
    ll N,Q,a,b,c,tmp=0;
    cin >> N;
    vector<ll> arr(1000000,0);
    rep(i,0,N){
        cin >> a;
        arr[a]+=1;
        tmp+=a;
    }

    cin >> Q;
    vector<ll> ans(Q+1,0);
    ans[0] = tmp;

    rep(i,1,Q+1){
        cin >> b >> c;
        ans[i] = ans[i-1] - arr[b]*b + arr[b]*c;
        arr[c] = arr[c] + arr[b];
        arr[b] = 0;
    }
    rep(i,1,Q+1) cout << ans [i] << endl;
}

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

B = []
ind = N - 1
for i in range(N - 1, -1, -2):
    B.append(A[i])

if N % 2 == 0:
    start = 0
else:
    start = 1

for i in range(start, N, 2):
    B.append(A[i])

print(" ".join(map(str, B)))


Measured memory_bytes: 29604
#include <bits/stdc++.h>
#ifdef DBP
#define deb(...) fprintf(stderr,__VA_ARGS__)
#else
#define deb(...) 0
#endif
#define fst first
#define snd second
#define fore(x,a,b) for(int x=(a), qwerty=(b); x<qwerty; x++)
#define pb push_back
#define mset(a,v) memset((a),(v),sizeof(a))
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) int((a).size())
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

typedef ll tc;
struct Line{tc m,h;};
struct CHT { // for minimum (for maximum just change the sign of lines)
	vector<Line> c;
	int pos=0;
	tc in(Line a, Line b){
		tc x=b.h-a.h,y=a.m-b.m;
		return x/y+(x%y?!((x>0)^(y>0)):0); // ==ceil(x/y)
	}
	void add(tc m, tc h){ // m's should be non increasing
		Line l=(Line){m,h};
		if(c.size()&&m==c.back().m){
			l.h=min(h,c.back().h);c.pop_back();if(pos)pos--;
		}
		while(c.size()>1&&in(c.back(),l)<=in(c[c.size()-2],c.back())){
			c.pop_back();if(pos)pos--;
		}
		c.pb(l);
	}
	inline bool fbin(tc x, int m){return in(c[m],c[m+1])>x;}
	tc eval(tc x){
		// O(log n) query:
		/*int s=0,e=c.size();
		while(e-s>1){int m=(s+e)/2;
			if(fbin(x,m-1))e=m;
			else s=m;
		}
		return c[s].m*x+c[s].h;*/
		// O(1) query (for ordered x's):
		while(pos>0&&fbin(x,pos-1))pos--;
		while(pos<c.size()-1&&!fbin(x,pos))pos++;
		return c[pos].m*x+c[pos].h;
	}
};

const int N=2e5+5;
int n;
ll c, hs[N],dp[N];

int main(){FIN;
	CHT cht;
	cin >> n >> c;
	fore(x,0,n)cin>>hs[x];
	cht.add(-2LL*hs[0],c+hs[0]*hs[0]);
	fore(x,1,n){
		dp[x] = cht.eval(hs[x])+hs[x]*hs[x];
		cht.add(-2LL*hs[x],c+hs[x]*hs[x]+dp[x]);
	}
	cout << dp[n-1] << "\n";
}

Measured memory_bytes: 9072
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <cstdlib>
typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
 
using namespace std;
 
int main(){

    int n;
    cin >> n;

    vector<int> l(2*n);
  	for(int i=0;i<2*n;i++) cin >> l[i];
    SORT(l);

    int ans = 0;
    for(int i=0;i<2*n;i += 2) ans += l[i];

    cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    while(1){
        c-=b;
        if(c <= 0){
            puts("Yes");
            return 0;
        }
        a-=d;
        if(a <= 0){
            puts("No");
            return 0;
        } 
    }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
// using ll = boost::multiprecision::int128_t;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;


int main() {
  ll n; cin >> n;
  Vll a(n), b(n); 
  rep(i, n) cin >> a[i] >> b[i];

  sort(all(a));
  sort(all(b));

  ll l, u;
  ll ans;
  if (n%2 == 1) {
    l = a[(n+1)/2-1];
    u = b[(n+1)/2-1];
    ans = u - l + 1;
  }
  else {
    l = a[n/2-1] + a[n/2];
    u = b[n/2-1] + b[n/2];
    ans = u - l + 1;
  }

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


Measured memory_bytes: 6364
a, b, c, d = map(int, input().split())

distanceAC = abs(c - a)
distanceAB = abs(b - a)
distanceBC = abs(c - b)

if distanceAC <= d:
    print("Yes")

else:
    if a < c:
        if b < a or c < b:
            print("No")
        else:
            if distanceAB <= d and distanceBC <= d:
                print("Yes")
            else:
                print("No")

    else:
        if b < c or a < b:
            print("No")
        else:
            if distanceAB <= d and distanceBC <= d:
                print("Yes")
            else:
                print("No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define mod 1000000007
#define mk make_pair
#define sz size
#define inf 1e9+5


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll a1,a2,a3;
    cin>>a1>>a2>>a3;
    if(a1+a2+a3>=22)cout<<"bust";
    else
      cout<<"win";

    return 0;  
}

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

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

bool include3(int x) {
    while(x) {
        if (x % 10 == 3) return true;
        else x /= 10;
    }
    return false;
}

int main() {
    int n;
    cin >> n;
    For(i,1,n+1) {
        if (i % 3 == 0 || include3(i)) cout << " " << i;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1160