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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <class T, T op(T, T)>
class segtree {
    public:
    int n, size_;
    vector<T> dat;
    T id_;
    segtree() = default;
    segtree(int size, T id, T initial_value) { init(size, id, initial_value); }
    void init(int size, T id, T initial_value) {
        size_ = size;
        id_ = id;
        n = 1;
        while (n < size) n *= 2;
        dat.assign(2 * n - 1, id);
        for (int i = 0; i < size; ++i) update(i, initial_value);
    }
    int size() const { return size_; }
    void update(int k, T a) {
        k += n - 1;  // leaf
        dat[k] = a;
        while (k > 0) {
            k = (k - 1) / 2;
            dat[k] = op(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }
    T at(int index) { return dat[index + n - 1]; }
    void add(int k, T a) { update(k, at(k) + a); }
    T query(int a, int b) { return query(a, b, 0, 0, n); }
    T query(int a, int b, int k, int l, int r) {
        if (r <= a or b <= l) return id_;
        if (a <= l and r <= b) return dat[k];
        int m = (l + r) / 2;
        return op(query(a, b, k * 2 + 1, l, m), query(a, b, k * 2 + 2, m, r));
    }
};

i64 sum(i64 a,i64 b){
    return a+b;
}

void solve(){
    i64 N;
    cin >> N;

    vector<i64> a(N);
    rep(i,0,N) cin >> a[i];

    if(N==1){
        cout << a[0] << endl;
        return;
    }

    auto count=[&](i64 x){
        // 中央値がx以下となる連続部分列の数

        i64 s=0;
        vector<i64> vals;
        vals.push_back(0);
        rep(i,1,N+1){
            if(a[i-1]<=x) ++s;
            else --s;
            vals.push_back(s);
        }

        sort(begin(vals),end(vals));
        vals.erase(unique(begin(vals),end(vals)),end(vals));

        unordered_map<i64,i64> idx;
        rep(i,0,vals.size()) idx[vals[i]]=i;

        segtree<i64,sum> seg(vals.size(),0,0);
        s=0;
        i64 res=0;
        seg.add(idx[0],1);
        rep(i,0,N){
            if(a[i]<=x) ++s;
            else --s;
            res+=seg.query(0,idx[s]);
            seg.add(idx[s],1);
        }

        return res;
    };

    i64 lb=0,ub=inf;
    while(ub-lb>1){
        i64 m=(lb+ub)/2;
        if(count(m)>=N*(N+1)/2/2+1) ub=m;
        else lb=m;
    }

    cout << ub << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 8292
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
#define ALL(X) X.begin(), X.end()
using lint = long long;
template <typename T>
void print_container(std::vector<T> vec)
{
    for (auto iter = vec.begin(); iter != vec.end(); ++iter)
    {
        std::cout << *iter << " ";
    }
    std::cout << std::endl;
}

int main()
{
    lint n;
    scanf("%lld", &n);

    std::vector<lint> a(n);

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

    std::vector<lint> cumsum(n + 1);

    std::partial_sum(ALL(a), cumsum.begin());
    cumsum[n] = 0;
    std::sort(ALL(cumsum));

    lint prev = 1e16;
    lint stream = 0;

    lint ans = 0;

    for (auto num : cumsum)
    {
        if (num != prev)
        {
            ans += stream * (stream - 1) / 2;
            stream = 1;
        }
        else
        {
            stream++;
        }
        prev = num;
    }
    ans += stream * (stream - 1) / 2;

    std::cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3328
#include "bits/stdc++.h"
#include<random>
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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 T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

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

lint arr[500], N, K;
int main() {
	cin >> N >> K;
	lint sum = 0;
	REP(i, N) {
		cin >> arr[i];
		sum += arr[i];
	}
	auto vec = divisor(sum);
	IREP(x, SZ(vec)) {
		if (vec[x] == 1) {
			cout << 1 << endl;
			return 0;
		}
		lint _arr[500], d = vec[x], minv = INF;
		lint sum_p = 0, sum_m = 0;
		REP(i, N) {
			_arr[i] = arr[i] % d;
			sum_m -= _arr[i];
		}
		sort(_arr, _arr + N);
		chmin(minv, max(-sum_m, sum_p));
		IREP(i, N) {
			sum_m += _arr[i];
			sum_p += (d - _arr[i]);
			chmin(minv, max(-sum_m, sum_p));
		}
		if (minv <= K) {
			cout << d << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int maxn=(2e5)+10;
int n; ll s;
struct node {
	int a,b;
} d[maxn];
bool cmp(node x,node y) {
	return x.b<y.b;
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++)
		read(d[i].a),read(d[i].b);
	sort(d+1,d+n+1,cmp);
	for (int i=1;i<=n;i++) {
		s+=d[i].a;
		if (s>d[i].b) {
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 21000;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct TwoSat {
    int N;
    vector<vi> gr;
    vi values; // 0 = false, 1 = true
 
    TwoSat(int n = 0) : N(n), gr(2*n) {}
 
    int add_var() { // (optional)
        gr.emplace_back();
        gr.emplace_back();
        return N++;
    }
 
    void either(int f, int j) {
        f = max(2*f, -1-2*f);
        j = max(2*j, -1-2*j);
        gr[f^1].push_back(j);
        gr[j^1].push_back(f);
    }
    void set_value(int x) { either(x, x); }
 
    void at_most_one(const vi& li) { // (optional)
        if (sz(li) <= 1) return;
        int cur = ~li[0];
        rep(i,2,sz(li)) {
            int next = add_var();
            either(cur, ~li[i]);
            either(cur, next);
            either(~li[i], next);
            cur = ~next;
        }
        either(cur, ~li[1]);
    }
 
    vi val, comp, z; int time = 0;
    int dfs(int i) {
        int low = val[i] = ++time, x; z.push_back(i);
        trav(e, gr[i]) if (!comp[e])
            low = min(low, val[e] ?: dfs(e));
        ++time;
        if (low == val[i]) do {
            x = z.back(); z.pop_back();
            comp[x] = time;
            if (values[x>>1] == -1)
                values[x>>1] = !(x&1);
        } while (x != i);
        return val[i] = low;
    }
 
    bool solve() {
        values.assign(N, -1);
        val.assign(2*N, 0); comp = val;
        rep(i,0,2*N) if (!comp[i]) dfs(i);
        rep(i,0,N) if (comp[2*i] == comp[2*i+1]) return 0;
        return 1;
    }
};

int N;
pair <int, int> pp[MAXN];

bool works (int d)
{
    TwoSat sat(2*N);
    for (int i = 0; i < N; i++)
    {
        int cv = pp[i].second;
        sat.either(cv, ~(i+N));
        if (i > 0 && pp[i-1].first / d == pp[i].first / d)
        {
            sat.either(i-1+N, ~(i+N));
            sat.either(i-1+N, cv);
        }
    }

    int hi = N - 1;
    for (int i = N - 1; i >= 0; i--)
    {
        int cv = pp[i].second;
        while (hi > i && pp[hi].first >= pp[i].first + d)
            hi--;
        if (pp[hi].first / d > pp[i].first / d)
        {
            sat.either(hi+N, cv);
        }
    }
    return sat.solve();
}

int main()
{
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int x, y;
        cin >> x >> y;
        pp[2*i] = make_pair (x, ~i);
        pp[2*i+1] = make_pair (y, i);
    }
    N *= 2;

    sort (pp, pp + N);
    int lo = 0, hi = 1e9;
    while (lo < hi)
    {
        int mid = (lo + hi + 1) / 2;
        if (works (mid))
            lo = mid;
        else
            hi = mid - 1;
    }
    cout << lo << "\n";
}

Measured memory_bytes: 7480
main(){double a,b,c,d,e,f,g,h;for(;~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f,&g,&h);)puts((a-c)*(e-g)+(b-d)*(f-h)?"NO":"YES");return 0;}

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

int main(){
  long long int N,X;
  cin >> N >> X;
  
  long long int burger, p;
  burger=1;
  p=1;
  
  for(int i=0;i<N;i++){
    burger=burger*2+3;
    p=p*2+1;
  }
  
  long long int a=0;
  while(X!=0){
    if(X==1){X=0;}
    else if(X<=(burger-3)/2+1){burger=(burger-3)/2;p=(p-1)/2;X-=1;}
    else if(X==(burger-3)/2+2){a+=1+(p-1)/2;X=0;}
    else if(X<=2+(burger-3)){a+=1+(p-1)/2;burger=(burger-3)/2;p=(p-1)/2;X=X-2-burger;}
    else{a+=p;X=0;}
  }
  if(burger==1 && N>=2){a++;}
  
  cout << a << endl;
  
  return 0;
}

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

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

int N;
int A[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	
	FOR(i,N) {
		cin>>A[i];
		if(A[i]%2) return _P("first\n");
	}
	_P("second\n");
	
}


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


Measured memory_bytes: 640
/*
 * 	Just close your eyes
 * 		The sun is going down
 * 			You'll be alright...
 * 				No one can hurt you now
 * 					Come, morning light...
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#ifndef rd
#define endl '\n'
#endif
#define deb cout<<"Line: "<<__LINE__<<" plz "
#define pb push_back
#define fi first
#define se second
//#define int long long
typedef long long ll;
#define pii pair<int,int>
#define sz(x) ((int)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define all(con) con.begin(),con.end()
const ll inf=1e18;
const int mod=1e9+7;
typedef vector<int> vi;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve()
{
	int n;
	cin>>n;
	string a,b,c;
	cin>>a>>b>>c;
	int ans=0;
	for(int i=0; i<n; i++) {
		if(a[i]!=b[i]&&a[i]!=c[i]&&b[i]!=c[i])
			ans+=2;
		else if(a[i]==b[i]&&a[i]==c[i]) {

		}
		else
			ans++;
	}
	cout<<ans<<endl;
}
signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());
	auto clk=clock();
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
const int N = 100;
int n;
int a[N];
long long dp[N];
int main(){
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    long long gold = 1000 , promissory_note = 0 , val_ed = 1e18;
    int sell = 0 , buy = 1;
    long long ans = 1000;
    for (int i = 1; i <= n; i++){
        if (val_ed > a[i]){
            sell = 0;
            if (buy >= 1) gold = gold + promissory_note * val_ed;
            promissory_note = gold / a[i];
            gold = gold % a[i];
            val_ed = a[i];
            buy++;
            dp[i] = gold;
        }
        else{
            buy = 0;
            if (sell >= 1){
                promissory_note = gold / val_ed;
                gold -= promissory_note * val_ed;
            }
            gold = gold + promissory_note * a[i];
            promissory_note = 0;
            val_ed = a[i];
            sell++;
            dp[i] = gold;
        }
        ans = max(ans,dp[i]);
    }
    cout << ans;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const string YES = "YES";
const string NO = "NO";

void solve(long long X){
    if(X == 7 || X == 5 || X == 3) { cout << YES << endl; }
    else { cout << NO << endl; }
}

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<iostream>
using namespace std;
int n,c;
int a[40][100010];
int main(void)
{
     int i,j,k,m;
     scanf("%d%d",&n,&c);
     memset(a,0,sizeof(a));
     while(n--)
     {
          int s,t,x;
          scanf("%d%d%d",&s,&t,&x);
          for(i=s-1;i<t;i++)
               a[x][i]=1;
     }
     int sum=0;
     for(i=0;i<=100010;i++)
     {
          k=0;
          for(j=0;j<=c;j++)
          {
              k=k+a[j][i];
          }
          sum=max(sum,k);
     }
     printf("%d\n",sum);
     return 0;
}


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

int main(){
    long N,defPt,ans;
    cin >> N >> defPt >> ans;
    int sub = ans - defPt;
    int index;
    vector<int> A(N,0);
    for(int i = 0;i < ans;i++){
        cin >> index;
        A[index-1] += 1;
    }
    for(int i = 0;i < N;i++){
        if(A[i] > sub){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
typedef long long ll;
const long long llinf=LLONG_MAX;
const int inf=LONG_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
int n,m,i,x,y,viz[nmax];
vector<int>a[nmax],ans;
void dfs(int x)
{
	if(!viz[x])ans.pb(x);
	viz[x]=1;
	for(i=0;i<a[x].size();i++)
	 if(!viz[a[x][i]])
	 {
	 	dfs(a[x][i]);
	 	break;
	 }
}
int main()
{
	//freopen("sol.in","r",stdin);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>m;
	while(m--)
	{
		cin>>x>>y;
		a[x].pb(y);
		a[y].pb(x);
	}
	dfs(1);
	reverse(ans.begin(),ans.end());
	dfs(1);
	cout<<ans.size()<<endl;
	for(i=0;i<ans.size();i++)cout<<ans[i]<<" ";cout<<endl;
	return 0;
}

Measured memory_bytes: 8312
import java.util.*;

public class Main
{

	public static void main(String[] args) 
	{
		Scanner sc = new java.util.Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int k = sc.nextInt();
		
		int distance[] = new int[10];
		
		distance[0] = b - a;
		distance[1] = c - a;
		distance[2] = d - a;
		distance[3] = e - a;
		distance[4] = c - b;
		distance[5] = d - b;
		distance[6] = e - b;
		distance[7] = d - c;
		distance[8] = e - c;
		distance[9] = e - d;
		
		int flag = 1;

  		for(int i = 0; i < 10; i++)
		{
			if(k < distance[i])
			{
				flag = 0;
				break;
			}
		}
  		
  		if(flag == 1)
  		{
  			System.out.println("Yay!");
  		}
  		else 
  		{
			System.out.println(":(");
		}

	}

}


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

typedef long long ll;

int main()
{
    ll x, y, ans;
    cin >> x;
    y = x / 11 * 2;
    x = x % 11;
    ans = 0;
    while (x > 0)
    {
        if (ans % 2)
            x = x - 5;
        else
            x = x - 6;
        ans++;
    }
    cout << y + ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define int long long

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

int A[100010], D[100010];

vector<int> kabe;

signed main()
{
	omajinai;

	int N, T, Q; cin >> N >> T >> Q;

	rep(i, N) {
		cin >> A[i] >> D[i];
	}

	rep(i, N - 1) {
		if (D[i] == 1 && D[i + 1] == 2) {
			kabe.PB((A[i] + A[i + 1]) / 2);
		}
	}

	rep(i, Q) {
		int x; cin >> x;
		-- x;

		if (D[x] == 1) {
			vi::iterator itr = upper_bound(all(kabe), A[x]);
			if (itr == kabe.end()) {
				cout << A[x] + T << endl;
			} else {
				cout << min(A[x] + T, *itr) << endl;
			}
		} else {
			vi::iterator itr = lower_bound(all(kabe), A[x]);

			if (itr == kabe.begin()) {
				cout << A[x] - T << endl;
			} else {
				itr -= 1;
				cout << max(A[x] - T, *itr) << endl;
			}
		}
	}
}

Measured memory_bytes: 2988
#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 std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N, K; cin >> N >> K;
    vl data(N); F0R(i, N) cin >> data[i];
    sort(all(data)); reverse(all(data));
    ll ans = 0;
    FOR(i, K, N) {
        ans += data[i];
    }
    cout << ans << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include <set>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <stack>
#include <queue>
#include <cstring>
#include <iterator>

#define FOR(n) for(int i=0;i<(n);++i)
#define FOR_R(it,cont) for(auto it=rbegin(cont);it!=rend(cont);++it)
#define FOR_F(it,cont) for(auto it=begin(cont);it!=end(cont);++it)
#define ALL(cont) begin(cont), end(cont)
#define LB(b,e,v) lower_bound(b,e,v)
#define UB(b,e,v) upper_bound(b,e,v)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define MODDING(a,b) (a) = AS_MOD(a,b)
#define MAXIMIZE(a, b) (a) = max((a),(b))
#define MINIMIZE(a, b) (a) = min((a),(b))

using namespace std;
typedef pair<int,int> P;
typedef pair<P, P> PP;
typedef long long ll;
int N,M,K;
int main() {
  scanf("%d%d%d", &N, &M, &K);
  bool ok=false;
  for(int i=0;i<=N;++i) {
    for(int j=0;j<=M;++j) {
      int ans = i*(M-j)+j*(N-i);
      if (ans==K) {
        ok=true;
      }
    }
  }
  if (ok) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(){
  int H,W;
  int h,w;
  scanf("%d %d",&H,&W);
  scanf("%d %d",&h,&w);

  int all = H * W;
  int cut = h*W + w*H - h*w;
  int result = all - cut;

  printf("%d",result);

  return 0;

}


Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    const long Mod = (long)1e9 + 7;

    public static void Main()
    {
        var nab = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
        var n = nab[0];
        var a = nab[1];
        var b = nab[2];

        var k = Power(Mod, 2, n) - 1;
        var ca = Combination(Mod, n, a);
        var cb = Combination(Mod, n, b);
        k -= ca + cb - Mod * 2;
        k %= Mod;

        Console.WriteLine(k);
    }

    static long Power(long m, long n, long a)
    {
        var x = 1L;
        while (a > 0)
        {
            if ((a & 1) > 0)
            {
                x *= n; x %= m;
            }
            n *= n; n %= m;
            a >>= 1;
        }
        return x;
    }

    static long Combination(long m, long n, long k)
    {
        k = Math.Min(k, n - k);
        var x = 1L;
        var d = 1L;
        while (k > 0)
        {
            x *= n--; x %= m;
            d *= k--; d %= m;
        }
        return x * Inverse(m, d) % m;
    }

    static long Inverse(long m, long a)
    {
        long b = m;
        long x = 1, y = 0;
        long u = 0, v = 1;
        while (b > 0)
        {
            var k = a / b;
            Trans(out a, ref b, a - k * b);
            Trans(out x, ref u, x - k * u);
            Trans(out y, ref v, y - k * v);
        }
        return x < 0 ? x + m : x;
    }

    static void Trans(out long x, ref long y, long t)
    {
        x = y;
        y = t;
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<math.h>
#include<string>
using namespace std;
#define int long long
#define ll long long
#define vel vector<ll>
#define vvel vector<vel>
#define sor(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define rep(i,n) for(ll i=0;i<n;i++)
#define upperbound(v,val) upper_bound(v.begin(),v.end(),val)
#define lowerbound(v,val) lower_bound(v.begin(),v.end(),val)
#define pin pair<ll,ll>
int ze = 0;
signed main(){
	int n; cin >> n;
	vel d(n);
	vector<pin> md(n);
	rep(i, n) { cin >> d[i]; md[i] = make_pair(d[i], i); }
	sor(md);
	vel pa(n, -1);
	vel all_chi(n, 1); vel all_dist(n, 0);
	for(int i=n-1;i>0;i--) {
		pin q = md[i];
		int num = q.second;
		if (all_chi[num] * 2 >= n) { cout << -1 << endl; return 0; }
		int next_val = q.first + 2 * all_chi[num] - n;
		auto next_itr = lowerbound(md, make_pair(next_val, ze));
		if ((*next_itr).first != next_val) { cout << -1 << endl; return 0; }
		int next_num = (*next_itr).second;
		pa[num] = next_num;
		all_chi[next_num] += all_chi[num];
		all_dist[next_num] += all_dist[num] + all_chi[num];
	}
	if(md[0].first!=all_dist[md[0].second]) { cout << -1 << endl; return 0; }
	rep(i, n) {
		if (pa[i] != -1) {
			cout << i+1 << " " << pa[i]+1 << endl;
		}
	}
	return 0;
}

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

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

    int N;
    cin >> N;
    vector<int> x(N), y(N), h(N);
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i] >> h[i];
    for (int cx = 0; cx <= 100; cx++) {
        for (int cy = 0; cy <= 100; cy++) {
            int H = -1;
            bool ok = true;
            for (int i = 0; i < N; i++) {
                if (h[i] > 0) {
                    int tmp = h[i] + abs(x[i] - cx) + abs(y[i] - cy);
                    if (H == -1) H = tmp;
                    else if (H != tmp) {
                        ok = false;
                        break;
                    }
                }
            }
            if (!ok) continue;
            if (H == -1) H = 1;
            for (int i = 0; i < N; i++) {
                if (h[i] == 0) {
                    if (H - abs(x[i] - cx) - abs(y[i] - cy) > 0) {
                        ok = false;
                        break;
                    }
                }
            }
            if (ok) {
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }
        }
    }
}

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

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int grid[4][4];
  for(int i=1; i<=3; i++)
    for(int j=1; j<=3; j++)
      cin >> grid[i][j];
  int a[4], b[4];
  for(int a1=0; a1<=100; a1++){
    for(int a2=0; a2<=100; a2++){
      for(int a3=0; a3<=100; a3++){
        a[1] = a1;
        a[2] = a2;
        a[3] = a3;
        b[1] = grid[1][1] - a[1];
        b[2] = grid[1][2] - a[1];
        b[3] = grid[1][3] - a[1];
        bool ok = true;
        for(int i=1; i<=3; i++){
          for(int j=1; j<=3; j++){
            if(a[i] + b[j] != grid[i][j]){
              ok = false;
              break;
            }
            if(!ok) break;
          }
        }
        if(ok){
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
    char a;
    for(int i = 0; i < 1200; i++){
        scanf("%c", &a);
        if(a >= 'a' && a <= 'z'){
            a -= 32;
        } else
        if(a >= 'A' && a <= 'Z'){
            a += 32;
        }
        cout << a;
        if(a == '\n') break;
    }
    return 0;
}


Measured memory_bytes: 3140
#include<stdio.h>
int main(){
    int n,k,i,j,a,sum=0;
    scanf("%d%d",&n,&k);
    int porosh[n];
    for(i=0;i<n;i++){
        scanf("%d",&porosh[i]);
    }
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if(porosh[i]<porosh[j]){
                a=porosh[i];
                porosh[i]=porosh[j];
                porosh[j]=a;
            }
        }
    }
    for(i=0;i<k;i++){
        sum+=porosh[i];
    }
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 128
n = int(input())

if n == 1:
    print('a')
    exit()

lst = ['a']
for i in range(n-1):
    new_lst = []
    for string in lst:
        num = ord(sorted(string)[-1])
        for j in range(ord('a'), num+2):
            new_lst.append(string+chr(j))
    lst = new_lst

for string in lst:
    print(string)

Measured memory_bytes: 56412
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdio.h>
#include <cstdio>
#include<cstdlib>
#include<cstring>

using namespace std;

struct list {
	int key;
	list *next,*prev;
};

list *head, *tail, *p;

void insert_x(int key) {
	list *make = new list;
	make->key = key;
	if (head == NULL) {
		head = tail = make;
		make->next = make->prev = NULL;
	}
	else {
		head->prev = make;
		make->next = head;
		head = make;
	}
}

void deleteFirst() {
	list* tmp = head;
	if (head == tail) {
		head = tail = NULL;
	}
	else {
		head = head->next;
		head->prev = NULL;
	}
	delete tmp;
}
void deleteLast() {
	list* tmp = tail;
	if (tail == head) {
		head =  tail = NULL;
	}
	else {
		tail = tail->prev;
		tail->next = NULL;
	}
	delete tmp;
}
void delete_x(int key) {
	p = head;
	while (p->key != key) {
		if (p->next == NULL)
			return;
		p = p->next;
	}
	if (p == head)
		deleteFirst();
	else if (p == tail)
		deleteLast();
	else {
		p->prev->next = p->next;
		p->next->prev = p->prev;
		delete p;
	}
}

int main() {
	head = tail = p = NULL;
	int n=0;
	char command[12];
	int key =0;
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++) {
		scanf("%s", command);
		if (strcmp(command, "insert") == 0) {
			scanf("%d", &key);
			insert_x(key);
		}
		else if (strcmp(command, "delete") == 0) {
			scanf("%d", &key);
			delete_x(key);
		}
		else if (strcmp(command, "deleteFirst") == 0) {
			deleteFirst();
		}
		else if (strcmp(command, "deleteLast") == 0) {
			deleteLast();
		}
	}

	while(true){
		if (head->next != NULL) {
			cout << head->key << " ";
			head = head->next;
		}
		else {
			cout << head->key << endl;
			break;
		}
	}

	return 0;
}

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

mod = 10**9 + 7
l = 2*10**6
fac = [1]*l
facr = [1]*l

for i in range(l-1):
    fac[i+1] = fac[i]*(i+1)%mod
facr[l-1] = pow(fac[l-1],mod - 2,mod)
for i in range(1,l)[::-1]:
    facr[i-1] = facr[i]*i%mod

def combi(N,K):
    return fac[N]*facr[N-K]%mod*facr[K]%mod

dp = [[0] * (n + 1) for i in range(n + 1)]

dp[0][0] = 1

for i in range(n):
    for j in range(n+1):
        dp[i + 1][j] += dp[i][j]
        dp[i + 1][j] %= mod
        if not a <= i+1 <= b: continue
        for m in range(c, d + 1):
            if j + m * (i+1) > n: break
            dp[i + 1][j + m * (i+1)] += dp[i][j] * fac[(i + 1) * m] * pow(facr[(i + 1)], m, mod) * facr[m] * combi(n-j,(i+1)*m)
            dp[i + 1][j + m * (i+1)] %= mod
print(dp[n][n] % mod)
# print(dp)


Measured memory_bytes: 195804
#include <iostream>

using namespace std;

void Solution()
{
    // notice the typing !!
    int n;
    
    int times = 0; // save the data in here about most frequently times
    
    int a[101] = {0};// the array which saves the mode value, at the beginning is all "0"
    
    while(cin>>n)
    {
        a[n]++; //after input some value, array's value can be added by 1 (0 -> 1), repeat this part.
    }
    
    
    for(int i = 0; i < 101; i++) // the data is less than 100
    {
        if(a[i] > times) //check the  a[] value for ensuring the mode value
        {
            times = a[i]; //repeat this part, at the last, can find mode value
        }
    }
    
    for(int i = 0; i < 101; i++) //output mode value
    {
        if(a[i] == times)
        {
            cout<<i<<endl;
        }
    }
    
    return;
}

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

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
    int n ,m;
    cin >> n >> m;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    
    
    int sum=0;
    rep(i,n) sum += v[i];
    //cout << " sum=" << sum;
    double base;
    base = (double)sum/4.0/(double)m;
    //cout << "base=" << base;
    int cnt=0;
    rep(i,n){
        if(v[i] >= base){
            cnt++;
        }
    }
    
    if(cnt >= m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAX = 1000000;
const int MOD = 1000000007;
//
int fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
signed main() {
  COMinit() ;
  
int x,y;
cin>>x>>y;
if((x+y)%3!=0){
  cout<<0;
  return 0;
}
if(abs(x-y)%2!=((x+y)/3)%2){
  cout<<0;
  return 0;
}
cout<<COM((x+y)/3,((x+y)/3 -(x-y))/2);

return 0;



}


Measured memory_bytes: 23808
#include<bits/stdc++.h>
using namespace std;
const long long INF=1000000000;
typedef long long ll;
int main(){
    int n, X;
    cin >> n >> X;
    int x[n+1];
    for (int i = 0; i < n;i++){
        cin >> x[i];
    }
    x[n]=X;
    sort(x,x+n+1);
    int ans=x[1]-x[0];
    for (int i = 1; i < n+1;i++){
        ans = __gcd(ans, x[i] - x[i - 1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import copy
N,M = map(int,input().split())
ls = [[] for i in range(N+1)]
for i in range(M):
    a,b = map(int,input().split())
    ls[a].append(b)
    ls[b].append(a)
cnt = 0
q = []
q.append([1,1,[False for i in list(range(N+1))]])
while len(q) > 0:
    [x,n,path] = q.pop()
    path[x] = True
    # print(x,n,path)
    if path.count(True) == N:
        cnt += 1
        continue
    for j in ls[x]:
        if path[j] == False:
            q.append([j,n+1,path.copy()])
print(cnt)

Measured memory_bytes: 68816
#include<cstdio>

int n;
char s[101], t[101];

int main() {
    scanf("%d", &n);
    scanf("%s %s", s, t);
    for (int i = 0; i < n; i++) printf("%c%c", s[i], t[i]);
    printf("\n");
    return 0;
}    


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define FOR(itr, v) for (auto itr = (v).begin(); itr != (v).end(); ++itr)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
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> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    string s, t, r; cin >> s >> t;
    s += s;
    int i = s.find(t);
    if (i >= 0) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;

#define int int64_t
#define REP(i, s, n) for (signed i = (s); i < signed(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(c) begin(c), end(c)

#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

signed main() {
	VV data(1000, V(1000));
	vector<P> nums(1000001);
	P center = P(500, 499);
	P now = center;
	data[center.first][center.second] = 1;
	nums[1] = now;

	int length = 1;
	int x = 1;
	while (x < 1000000) {
		if (length & 1) {
			rep(j, length) {
				data[now.first][++now.second] = ++x;
				nums[x] = now;
			}
			rep(j, length) {
				data[--now.first][now.second] = ++x;
				nums[x] = now;
			}
		} else {
			rep(j, length) {
				data[now.first][--now.second] = ++x;
				nums[x] = now;
				if (x == 1000000) {
					goto out;
				}
			}
			rep(j, length) {
				data[++now.first][now.second] = ++x;
				nums[x] = now;
			}
		}
		length++;
	}
out:
	vector<bool> isprime(1000001, true);
	isprime[0] = isprime[1] = false;
	for (int i = 2; i*i <= 1000000; i++) if (isprime[i]) {
		for (int j = 2; i * j <= 1000000; j++) {
			isprime[i * j] = false;
		}
	}

	int m, n;
	while (cin >> m >> n && m) {
		map<P, P> memo;
		function<P(int, int)> dp = [&](int r, int c) {
			if (r < 0 || r >= data.size() || c < 0 || c >= data[0].size()
				|| data[r][c] > m) return P(0, 0);
			if (memo.count(P(r, c))) return memo[P(r, c)];
			P ret;
			maxup(ret, dp(r + 1, c - 1));
			maxup(ret, dp(r + 1, c));
			maxup(ret, dp(r + 1, c + 1));
			if (isprime[data[r][c]]) {
				ret.first++;
				if (ret.second == 0) ret.second = data[r][c];
			}
			return memo[P(r, c)] = ret;
		};
		P ans = dp(nums[n].first, nums[n].second);
		cout << ans.first << " " << ans.second << endl;
	}
}

Measured memory_bytes: 74064
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int query(int y1, int x1, int y2, int x2)
{
    int ans;
    cout << "? " << y1 << ' ' << x1 << ' ' << y2 << ' ' << x2 << endl;
    cin >> ans;
    return ans;
}

void solve(int y1, int x1, int y2, int x2, int n, vector<vector<bool> >& isBomb)
{
    if(n == 0)
        return;

    int h = y2 - y1 + 1;
    int w = x2 - x1 + 1;
    if(h * w == n){
        for(int y=y1; y<=y2; ++y){
            for(int x=x1; x<=x2; ++x){
                isBomb[y][x] = true;
            }
        }
        return;
    }

    if(h > w){
        int y3 = y1 + h / 2;
        int m = query(y1, x1, y3 - 1, x2);
        solve(y1, x1, y3 - 1, x2, m, isBomb);
        solve(y3, x1, y2, x2, n - m, isBomb);
    }
    else{
        int x3 = x1 + w / 2;
        int m = query(y1, x1, y2, x3 - 1);
        solve(y1, x1, y2, x3 - 1, m, isBomb);
        solve(y1, x3, y2, x2, n - m, isBomb);
    }
}

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

    vector<vector<bool> > isBomb(h, vector<bool>(w, false));
    solve(0, 0, h - 1, w - 1, n, isBomb);

    long long ans = 0;
    long long tmp = 1;
    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            if(isBomb[y][x]){
                ans += tmp;
                ans %= k;
            }
            tmp *= 2;
            tmp %= k;
        }
    }
    cout << "! " << ans << endl;

    return 0;
}


Measured memory_bytes: 720
(let ((a (read))
      (b (read))
      (c (read))
      (d (read)))
  (format t "~a~%"
          (if (loop
                do (decf c b)
                if (<= c 0) do (return t)
                do (decf a d)
                if (<= a 0) do (return nil))
              "Yes"
              "No")))



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

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

class ECandyPiles {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n;
        in>>n;
        vector<int> a(n);
        for(auto&i:a) in>>i;
        sort(a.rbegin(),a.rend());
        a.emplace_back(0);
        Fr(i,n){
            if(a[i]<=i){
                for(int j=i;j<=n;++j){
                    if(a[j]<=i-1){
                        out<<(((a[i-1]+i)&1)|((j+i)&1)?"First":"Second")<<endl;
                        return;
                    }
                }
            }
        }
    }
};

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


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < n; i++)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, M;
    cin >> N >> M;

    vector<bool> flags(N+1, false);
    rep (i, M) {
        ll a;
        cin >> a;
        flags[a] = true;
    }

    vector<ll> dp(N+2, 0);
    dp[N] = 1;
    for (ll i = N-1; i >= 0; i--) {
        if (flags[i]) {
            dp[i] = 0;
            continue;
        }
        dp[i] = (dp[i+1] + dp[i+2]) % MOD;
    }

    cout << dp[0] << endl;
    return 0;
}

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

int main() {
    string s = "ACL";
    int k;
    cin >> k;
    for(int i=0; i<k; i++) {
        cout << s;
    }
     cout << endl;
    return 0;
}

Measured memory_bytes: 3620
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		// ?????????????????\????????????
		Scanner sc = new Scanner(System.in);

		// ??°????????°????????????????????°
		int n = sc.nextInt();

		// ??°??????????´?????????????
		ArrayList<Integer> list = new ArrayList<>();

		// ?????????????????°
		int cnt;

		// ?????°?????????
		long sum = 0;

		// ??\??????????????°?????????????????\??????
		for (cnt = 0; cnt < n; cnt++) {

			int matrix = sc.nextInt();
			list.add(matrix);
			sum += ((Integer)list.get(cnt)).intValue();

		}

		int min = list.get(0);
		int max = list.get(0);

		for (cnt = 0; cnt < n; cnt++) {

			//????°?????????????
			if(min > list.get(cnt)){
				min = list.get(cnt);
			} else {}

			//?????§????????????
			if(max < list.get(cnt)){
				max = list.get(cnt);
			} else {}

	    }

		System.out.println(min + " " + max + " " + sum);

		sc.close();
	}
}

Measured memory_bytes: 41124
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int H,W;
    cin >> H >> W;
    vector<vector<char>> C(H,vector<char>(W));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++) cin >> C[i][j];
    }
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++) cout << C[i][j];
        cout << endl;
        for(int j = 0; j < W; j++) cout << C[i][j];
        cout << endl;
    }
}


Measured memory_bytes: 256
# include "iostream"
# include "cstdio"

using namespace std;

int a,b; 

int main(){
	scanf("%d%d",&a,&b); 
	if(a<=8 && b<=8){
		printf("Yay!"); 
	}else{
		printf(":("); 
	}
	return 0; 
} 

Measured memory_bytes: 256
#include<stdio.h>
int main(){
        int a,b,c;
        scanf("%d %d %d",&a,&b,&c);
         if(a<=b&&b<=c){
         printf("%d %d %d\n",a,b,c);
   }else if(a<=c&&c<=b){
         printf("%d %d %d\n",a,c,b);
   }else if(b<=a&&a<=c){
         printf("%d %d %d\n",b,a,c);
   }else if(b<=c&&c<=a){
         printf("%d %d %d\n",b,c,a);
   }else if(c<=a&&a<=b){
         printf("%d %d %d\n",c,a,b);
   }else if(c<=b&&b<=a){
         printf("%d %d %d\n",c,b,a);
   }
         return 0;
}


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

using namespace std;

int x,a,b;

int f(int x)
{
	if (x<0)return -x;
	else return x;
}

int main()
{
	cin>>x>>a>>b;
	int disa=f(x-a);
	int disb=f(x-b);
	if (disa<disb)cout<<'A'<<endl;
	else cout<<'B'<<endl;
	return 0;
}

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

int main(){
    int n,flg=0,flag=0;
    cin >> n;
    vector<vector<int>> kusa(n,vector<int>(2));
    for(int i=0;i<n;i++){
        for(int ii=0;ii<2;ii++){
            cin >> kusa.at(i).at(ii);
        }
    }
    for(int i=0;i<n;i++){
        if(kusa.at(i).at(0)==kusa.at(i).at(1)&&flg==0){
            flg=1;
            flag = i;
        }else if(kusa.at(i).at(0)==kusa.at(i).at(1)&&flg>=1){
            if(flag == i-1){
              flg++;
              flag = i;
            }
        }else{
          flag = 0;
          flg =0;
        }
        if(flg>=3){
            break;
        }
    }
    if(flg>=3){
        cout << "Yes";
    }else{
        cout <<"No";
    }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	ll N,M,K,P; cin >> N >> M >> K >> P;
	V<ll> A(N); rep(i,N) cin >> A[i];
	sort(all(A),greater<ll>());

	auto can = [&](int i){
		if(i<P) return true;
		ll t = A[i]+M;
		ll f = 0;
		for(int j=P-1;j<N;j++) if(j != i){
			if(t < A[j]) return false;
			f += min(t-A[j],M);
		}
		return f >= M*(K-P);
	};
	int lb = -1, ub = N;
	while(ub-lb>1){
		int m = (lb+ub)/2;
		if(can(m)) lb = m;
		else ub = m;
	}
	cout << lb+1 << endl;
}


Measured memory_bytes: 1024