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

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef pair<int, int> pi;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h, w, k, ans = 0;
    cin >> h >> w >> k;
    vector<string> a(h);
    fr(i, 0, h)
            cin >>
        a[i];
    int ph = pow(2, h), pw = pow(2, w);
    for (int i = 0; i < ph; i++)
    {
        for (int j = 0; j < pw; j++)
        {
            int cnt = 0;
            bitset<10> p(i), q(j);
            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if (!p[i] && !q[j] && a[i][j] == '#')
                    {
                        cnt++;
                    }
                }
            }
            if (cnt == k)
            {
                ans++;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
#define pb push_back
#define INF 1e5
#define REP(i,a,b) for(int i=a;i<b;++i)
#define REPN(i,a,b) for(int i=a;i<=b;++i)

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);   
    
    int n;
    cin>>n;
    map<string,int> m;
    REP(i,0,n)
	{
	  string a;
	  cin>>a;
	  m[a]+=1;
    }

    int Mx=-1;
    for(auto p:m)
	Mx=max(Mx,p.second);
	for(auto p:m)
	{
		if(Mx==p.second)
		cout<<p.first<<"\n";
	}

	
	return 0;
    
}


Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main()
{ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

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

    ll min1=a[0];
    ll ans=0;
    for (int i = 1; i < n; ++i)
    {
        if(a[i]<min1){
            ans+=(min1-a[i]);
        }
        else{
            min1=a[i];
        }
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define F first
#define S second
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;}
#define OUT(x) cout << x << endl
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 100000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main() {
  IN(ll,X);
  IN(ll,Y);
  ll count = 0;
  while(X <= Y){
    X *= 2;
    count++;
  }
  OUT(count); 
}

Measured memory_bytes: 256
n=int(input())
bit=[[1,1,1,1,1,1,1,1,1,1]]
for i in range(1,1023):
  num=i
  l1=[]
  while num!=0:
    l1.append(num%2)
    num=num//2
  while len(l1)<len(bit[-1]):
    l1.append(0)
  bit.append(l1)
f=[]
p=[]
for i in range(n):
  f.append(list(map(int,input().split())))
for i in range(n):
  p.append(list(map(int,input().split())))
max=-10**10
for i in range(1023):
  count=[0 for i in range(n)]
  b=bit[i]
  ben=0
  for j in range(10):#各時間帯
    if b[j]==0:#自分の店は開いていない
      pass
    else:
      for k in range(n):#各店
        if f[k][j]==1:
          count[k]+=1
  for j in range(n):
    ben+=p[j][count[j]]
  if max<ben:
    max=ben
print(max)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define     FAST            ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0);
int main()
{

        ll n;
        cin>>n;
        map<string,int>mp;
        map<string,int>::iterator it;


        mp["AC"]=0;
        mp["WA"]=0;
        mp["TLE"]=0;
        mp["RE"]=0;


        for(int i=0;i<n;i++)
        {
            string s;
            cin>>s;

            mp[s]++;
        }


        cout<<"AC"<<" x "<<mp["AC"]<<endl;
        cout<<"WA"<<" x "<<mp["WA"]<<endl;
        cout<<"TLE"<<" x "<<mp["TLE"]<<endl;
        cout<<"RE"<<" x "<<mp["RE"]<<endl;


















    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n ,x) for (int i = x; i < (int)(n); ++i)
#define repBack(i, n) for (int i = n; i >= 0; --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    int N;
    cin >> N;
    int ans = 0;
    repX(i,N+1,1){
        repX(j, N + 1, 1){
            repX(k, N + 1, 1) {
                ans ++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
*/

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = { -1, 0, +1, 0 };
int dx4[4] = { 0, +1, 0, -1 };
int dy8[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
int dx8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
	return a / gcd(a, b) * b;
}

ll nCr(ll n, ll r){
	if (r == 0 || r == n){
		return 1;
	}
	else if (r == 1){
		return n;
	}
	return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
	r = n - r;
	ll ret = 1;
	for (ll i = n; i >= r + 1; i--) ret *= i;
	return ret;
}

//-----------------------ここから-----------

int main(void){
	int cookie[3];
	int k;
	int turn = 1;
	cin >> cookie[1] >> cookie[2] >> k;

	while (k > 0){
		if (cookie[turn] % 2 == 0){
			cookie[3 - turn % 3] += cookie[turn] / 2;
			cookie[turn] /= 2;
		} else {
			cookie[turn]--;
			cookie[3 - turn % 3] += cookie[turn] / 2;
			cookie[turn] /= 2;
		}

		if (turn == 1){
			turn = 2;
		} else {
			turn = 1;
		}
		k--;
	}

	for (int i = 1; i < 3; i++){
		cout << cookie[i] << endl;
	}
} 


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.nextIntArray(n);

            int cnt = 0;
            for (int i = 0; i < n; i++) {
                while (a[i] % 2 == 0) {
                    cnt++;
                    a[i] /= 2;
                }
            }

            out.println(cnt);
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

    }
}



Measured memory_bytes: 25300
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
long long d[110];
vector<int>g[110];
int sz[110];
long long val[110];
void dfs(int a){
	for(int i=0;i<g[a].size();i++){
		dfs(g[a][i]);
		val[a]+=val[g[a][i]];
		sz[a]+=sz[g[a][i]];
	}
	sz[a]++;
	val[a]+=d[a];
}
pair<long double,int>ev[110];
long long dp[200000];
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<a;i++){
		scanf("%lld",d+i);
		if(i){
			int pr;scanf("%d",&pr);pr--;
			g[pr].push_back(i);
		}
	}
	dfs(0);
	reverse(sz,sz+a);
	reverse(val,val+a);
	//for(int i=0;i<a;i++)printf("%d %lld\n",sz[i],val[i]);
	for(int i=0;i<a;i++){
		ev[i]=make_pair((long double)val[i]/sz[i],i);
	}
	std::sort(ev,ev+a);
	long long ret=0;
	for(int i=1;i<200000;i++)dp[i]=inf;
	int dd=0;
	for(int i=0;i<a;i++){
		int U=min(50,c);
		if(sz[i]==a)U=50;
		for(int j=dd;j>=0;j--){
			for(int k=0;k<=U;k++){
				dp[j+k*sz[i]]=min(dp[j+k*sz[i]],dp[j]+val[i]*k);
			}
		}
		dd+=U*sz[i];
	}
	for(int i=0;i<=dd;i++){
		if(dp[i]>b)continue;
		long long tmp=i;
		long long rem=b-dp[i];
		for(int j=0;j<a;j++){
			int at=ev[j].second;
			long long use;
			use=min(rem/val[at],(long long)max(c-50,0));
			if(sz[at]==a){
				use=rem/val[at];
			}
			rem-=val[at]*use;
			tmp+=sz[at]*use;
		}
		ret=max(ret,tmp);
	}
	printf("%lld\n",ret);
}


Measured memory_bytes: 1792
import java.util.Scanner;
public class Main
{
	public static void main(String[] args){
		//3????????´??°???????????????
		Scanner scan = new Scanner(System.in);
		int a;
		int b;
		int c;
		a = scan.nextInt();
		b = scan.nextInt();
		c = scan.nextInt();
		yesNo(a, b, c);
	}

	//a<b<c??§Yes???????????????????????????
	public static void yesNo(int a,int b, int c){
		String ans = "No";
		if(a < b){
			ans = "No";
			if(a < c){
				ans = "No";
				if(b < c){
					ans = "Yes";
				}
			}
		}
		System.out.println(ans);
	}
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int H, W, D;
int A;
int Q;
int L, R;
P ps[1 + 300 * 300];
ll S[1 + 300 * 300];

int d(P &p, P &q){
    int x1, y1, x2, y2;
    std::tie(x1, y1) = p;
    std::tie(x2, y2) = q;

    return std::abs(x1 - x2) + std::abs(y1 - y2);
}

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

    std::cin >> H >> W >> D;

    for(int i=0;i<H;++i){
        for(int j=0;j<W;++j){
            std::cin >> A;

            ps[A] = std::make_tuple(i, j);
        }
    }

    for(int a=H*W-D;a>0;--a){
        S[a] = S[a + D] + d(ps[a], ps[a + D]);
    }

    std::cin >> Q;

    for(int i=0;i<Q;++i){
        std::cin >> L >> R;

        ll total = S[L] - S[R];
        std::cout << total << std::endl;
    }
}


Measured memory_bytes: 2560
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = ReadLine();
            WriteLine(a[0] > a[2] ? ">" : (a[0] < a[2] ? "<" : "="));
        }
    }
}



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

const int Maxn = 300005;

int n, x;
int res[Maxn];
int pnt;

int main()
{
    scanf("%d %d", &n, &x);
    n = 2 * n - 1;
    if (x == 1 || x == n) printf("No\n");
    else {
        printf("Yes\n");
        int mid = (n + 1) / 2;
        if (x > mid) {
            int l = mid, r = x - 1;
            for (int i = 1; i < l; i++)
                res[pnt++] = i;
            res[pnt++] = x;
            for (int i = x + 1; i <= n; i++)
                res[pnt++] = i;
            for (int i = l; i <= r; i++)
                res[pnt++] = i;
        } else if (x == mid)
            for (int i = 1; i <= n; i++)
                res[pnt++] = i;
        else {
            int l = x + 1, r = mid;
            pnt = n - 1;
            for (int i = n; i > r; i--)
                res[pnt--] = i;
            res[pnt--] = x;
            for (int i = x - 1; i > 0; i--)
                res[pnt--] = i;
            for (int i = r; i >= l; i--)
                res[pnt--] = i;
        }
        for (int i = 0; i < n; i++)
            printf("%d\n", res[i]);
    }
    return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
using namespace std;

int main() {
    string s; cin >> s;
    string a = s.substr(0, s.size() / 2);
    string b = s.substr(s.size() / 2 + 1, s.size());
    Yes(a == b);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>

using namespace std;
typedef long long int ll;
#define space " "
#define vi vector<int>
#define pb push_back

#define MOD (int)(1e9  + 7)
int idx(char chr ) {
    if(chr == 'R') return 0 ;
    else if (chr == 'G') return 1 ;
    else return 2 ;
}
int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vi a[4] ;
    ll res = 0;
    for(int i = 0  ; i< n ; i ++ ) a[idx(s[i])].push_back(i) ;

    for(int i = 0 ; i < n ; i++ ){
        for(int j  = i + 1 ; j < n ; j++ ){
           if(s[i] != s[j]) {
               char nxt = 'R' + 'G' + 'B' - s[i] - s[j] ;
               int ii = idx(nxt) ;
               int size = (int)a[ii].size();
               res += (size - (upper_bound(a[ii].begin() , a[ii].end() , j) - a[ii].begin()) );
               if(binary_search(a[ii].begin() , a[ii].end() , 2 * j - i )) res -- ;
           }
        }
    }



    cout << res << endl ;





        return 0;

}

Measured memory_bytes: 3636
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int = 0, 0, 0

func main() {
	var N int
	var S string
	fmt.Scan(&N, &S)

	// i文字目から，j文字目から始まる文字列のうち最長のもの
	dp := make([][]int, N+5)
	for i := 0; i < N+5; i++ {
		dp[i] = make([]int, N+5)
	}
	for i := N - 1; 0 <= i; i-- {
		for j := N - 1; 0 <= j; j-- {
			if string(S[i]) == string(S[j]) {
				dp[i][j] = dp[i+1][j+1] + 1
			} else {
				dp[i][j] = 0
			}
		}
	}

	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			now := min(dp[i][j], j-i)
			ans = max(ans, now)
		}
	}
	fmt.Println(ans)
}

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

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; 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
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] > h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 208000
import numpy as np
from numba import njit
 
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())), dtype=np.int64)
 
@njit
def imos(a):
  b = np.zeros(n+1, dtype=np.int64)
  for i in range(n):
    l = max(0, i-a[i])
    r = min(i+a[i]+1, n)
    b[l] += 1
    if r <= n-1: b[r] -= 1
  
  b = np.cumsum(b)[:-1]
  return b
 
for q in range(k):
  a = imos(a)
  if np.min(a)==n:
    break
    
print(*a)

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


Measured memory_bytes: 256
import bisect

def generate_primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def solve():
  X = int(input())
  primes = generate_primes(10 ** 5 + 100)
  index = bisect.bisect_left(primes, X)
  return primes[index]

print(solve())

Measured memory_bytes: 4196
# AOJ ITP2_8_D: Multi-Map
# Python3 2018.6.24 bal4u

from bisect import bisect_left, bisect_right, insort_left
dict = {}
keytbl = []
q = int(input())
for i in range(q):
	a = list(input().split())
	ki = a[1]
	if a[0] == '0':
		if ki not in dict:
			dict[ki] = []
			insort_left(keytbl, ki)
		dict[ki].append(int(a[2]))
	elif a[0] == '1':
		if ki in dict and dict[ki] != []: print(*dict[ki], sep='\n')
	elif a[0] == '2':
		if ki in dict: dict[ki] = []
	else:
		L = bisect_left (keytbl, a[1])
		R = bisect_right(keytbl, a[2], L)
		for j in range(L, R):
			for k in dict[keytbl[j]]: print(keytbl[j], k)



Measured memory_bytes: 39200
import java.awt.*;
import java.io.*;
import java.util.*;
 
public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new TestC().doIt();
	}
	class TestC{
		void doIt() {
			int N = sc.nextInt();
			long A = 0;
			long B = 0;
			long MOD = 1000000007;
			long ans = 0;
			for(int i = 0;i < N;i++) {
				A = Long.parseLong(sc.next());
				if(i > 0) {
					ans = (ans + A * B) % MOD;
				}
				B = (B + A) % MOD;
			}
			System.out.println(ans);
		}
	}
}

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

{
     char b;
  while(cin>>b)
  {
    if(b=='A')
      cout<<'T'<<endl;
    if(b=='T')
      cout<<'A'<<endl;
    if(b=='C')
      cout<<'G'<<endl;
    if(b=='G')
      cout<<'C'<<endl;
   
  }
  return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>
#include <string.h>
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	int n;
	cin >> n;
	if (n < 1000)cout << "ABC" << endl;
	else cout << "ABD" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
long long combi(int x){
    return (long long) x*(x-1)/2;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N; cin >> N;
    vector<int> A(N);
    vector<int> cnt(N+1);
    for(int i = 0; i < N; ++i){
        cin >> A[i];
        cnt[A[i]]++;
    }
    long long sum = 0;
    for(int i = 0; i < N; ++i){
        sum += combi(cnt[i+1]);
    }
    for(int i = 0; i < N; ++i){
        cout << sum -(combi(cnt[A[i]]) - combi(cnt[A[i]] - 1)) << endl;
    }
    return 0;
}

Measured memory_bytes: 4700
//
//	Created by shamim_nik
//

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,
		tree_order_statistics_node_update> indexed_set;

#define br printf("\n")

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

//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	vector<int> arr;
	for (int i = 0; i < 5; i++) {
		int num;
		cin >> num;
		arr.push_back(num);
	}
	for (int i = 0; i < arr.size(); i++) {
		if (arr[i] == 0) {
			cout << i + 1 << '\n';
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3568
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=2e5+5;
int n,a[maxn];
int main()
{
  	scanf("%d",&n);
  	long long ans=0;
  	int mmax=0;
  	for(int i=0;i<n;i++){
  		scanf("%d",&a[i]);
  		mmax=max(mmax,a[i]);
  		ans+=mmax-a[i];
	}
	printf("%lld",ans);
  	return 0;
}

Measured memory_bytes: 2488
# ABC134E - Sequence Decomposing
def longest_subsequence(A: "Array[int]", equals: bool, increasing: bool) -> int:
    from bisect import bisect_left, bisect_right

    bs = bisect_right if equals else bisect_left
    compare = (lambda x, y: x >= y) if equals else (lambda x, y: x > y)
    if not increasing:
        A = A[::-1]
    
    dp = [A[0]]  # dp := length of LIS (dp table itself is not LIS)
    for i in A[1:]:
        if compare(i, dp[-1]):
            dp.append(i)
        else:
            dp[bs(dp, i)] = i
    return len(dp)


def main():
    N, *A = map(int, open(0))
    ans = longest_subsequence(A, equals=1, increasing=0)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9372
N, A, B = map(int, input().split())

if (B-A) % 2 == 0:
    ans = (B-A) // 2
else:
    ans1 = A
    C, D = 1, B-ans1
    ans1 += (D-C) // 2

    ans2 = N-B+1
    C, D = A+ans2, N
    ans2 += (D-C) // 2

    ans = min(ans1, ans2)

print(ans)


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

int main() {
	bool prime[1000000];
	fill(prime, prime + 1000000, true);
	prime[0] = prime[1] = false;
	for (int i = 2; i * i < 1000000; i++) {
		for (int j = 2; j * i < 1000000; j++) {
			if (!prime[i * j]) continue;
			prime[i * j] = false;
		}
	}

	int n;
	while (cin >> n) {
		if (n == 0) break;

		int t = 0, sum = 0;
		while (n > 0) {
			if (!prime[++t]) continue;

			n--;
			sum += t;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 4008
#!/usr/bin/python
# -*- coding: utf-8 -*-

import numpy as np

def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(input())
    return x

def int_map():
    return map(int,input().split())

def int_list():
    return list(map(int,input().split()))

import collections as col

N = int(input())
a = int_list()

c = col.Counter(a)

ans = 0

for i in range(1,100000):
    ans = max(ans,c[i-1]+c[i]+c[i+1])

print(ans)

Measured memory_bytes: 38620
#include <stdio.h>

int main(){
  int n,i,j,key,flag,count=0;
  int A[100];
  
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  
  flag = 1;
  i = 0;
  while(flag){
    flag = 0;
    for(j=n-1;j>=i+1;j--){
      if(A[j-1]>A[j]){
	key = A[j-1];
	A[j-1] = A[j];
	A[j] = key;
	flag = 1;
	count++;
      }
    }
    i++;
  }
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  
  return 0;
}



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

typedef long long ll;

#define v(T) vector<T>
#define ttt(T) tuple<T, T, T>
#define pb push_back
#define mp make_pair
#define rep(i, s, n) for(int i=s;i<n;i++)
#define repeq(i,s,n) for(int i=s;i<=n;i++)
#define poiu(n) for(int i=0; i < n; i++)
#define MOD 1000000007
#define endl '\n'

template<typename T>
void max_self(T& a, T b) { a=a>b?a:b; }
template<typename T>
void min_self(T& a, T b) { a=a<b?a:b; }

using namespace std;

int n;
int temp;

pair<int, int> pear[100005];


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

    cin >> n;

    for(int i=1; i<=n; i++)
        cin >> temp, pear[i]={temp, i};

    sort(pear+1, pear+n+1, [](auto a, auto b) {return a.first < b.first;});

    for(int i=1; i<=n; i++)
        cout << pear[i].second << ' ';
    cout << endl;





    


    return 0;

}



Measured memory_bytes: 1664
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int imos1[200009],imos2[200009],ans,sum,SUM;
vector<int>v;
string s;
stack<int>st;
int main(){
  cin>>s;
  r(i,s.size()){
    if(s[i]=='_')continue;
    if(s[i]=='\\')st.push(i);
    if(s[i]=='/'){
      if(st.empty())continue;
      int x=st.top();st.pop();
      imos1[x]+=(i-x);
      imos2[i]-=(i-x);
    }
  }
  r(i,200009){
    sum+=imos1[i];
    ans+=imos1[i];
    sum+=imos2[i];
    if(sum==0){
      SUM+=ans;
      if(ans!=0)v.push_back(ans),ans=0;
    }
  }
  cout<<SUM<<endl<<v.size();
  r(i,v.size()) cout<<' '<<v[i];
  cout<<endl;
}



Measured memory_bytes: 3360
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#define fastio cin.tie(0); ios::sync_with_stdio(0)
#define multitc int _t; cin>>_t; while(_t--)
#define arrin(arr, n, type) arr.assign(n,type()); for(auto& i : arr) cin>>i;
#define all(x) (x).begin(), (x).end()
const int dir[9][2] = {{0,-1},{-1,0},{0,1},{1,0},{1,1},{-1,-1},{1,-1},{-1,1},{0,0}};
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll INF = 1e15+7;
const ll MOD = 998244353;
using namespace std;
using namespace __gnu_pbds;
int nextInt(){int x; cin>>x; return x;}
ll nextLong(){ll x; cin>>x; return x;}
template<typename T>
void arrin2d(vector<vector<T>>& arr, int y, int x)
{
    arr.assign(y,vector<T>(x));
    for(int i=0;i<y;++i)
    {
        for(int j=0;j<x;++j)
        {
            cin>>arr[i][j];
        }
    }
}

//using template
//code goes here

int main()
{
    string s;
    cin>>s;
    if(s[2] == s[3] && s[4] == s[5])
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#include<bitset>
#include<map>
using namespace std;
template<typename __T>
inline void read(__T &x)
{
    x=0;
    int f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')	f=-1;c=getchar();}
    while(isdigit(c))	{x=x*10+c-'0';c=getchar();}
    x*=f;
}
int a,b;
int main()
{
	cin>>a>>b;
	long long ans=b*1900+(a-b)*100;
	ans<<=b;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

vvc ans;
vector<string> th{"aa.", "..a","..a"}, fo{"aabc","ddbc","bcaa","bcdd"},
  fi{"aabba","bcc.a","b..cb","a..cb","abbaa"},
  si{"aabc..","ddbc..","..aabc","..ddbc","bc..aa","bc..dd"},
  se{"aabbcc.","dd.dd.a","..d..da","..d..db","dd.dd.b","..d..dc","..d..dc"};
void on(ll now, ll num){
  vector<string> t;
  if(num==3) t = th;
  if(num==4) t = fo;
  if(num==5) t = fi;
  if(num==6) t = si;
  if(num==7) t = se;
  for(int i=0;i<t.size();i++){
    for(int j=0;j<t.size();j++){
      ans[now+i][now+j] = t[i][j];
    }
  }
}
void pr(vvc v){
  re(i, v.size()){
    re(j, v[0].size()) std::cout << v[i][j];
    std::cout << '\n';
  }
}
int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  ans.resize(n, vector<char>(n, '.'));
  if(n<=2){
    std::cout << -1 << '\n';
    return 0;
  }
  if(n==3){
    on(0, 3);
    pr(ans);
    return 0;
  }
  ll x = n/4, y = n%4;
  if(y!=0) x--, y+=4;
  for(int i=0;i<x;i++) on(i*4, 4);
  on(4*x, y);
  pr(ans);
  return 0;
}


Measured memory_bytes: 3200
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main() {
  int n,k;cin>>n>>k;
  string s;cin>>s;
  if(s.at(k-1)=='A')
  {
    s.at(k-1)='a';
  }
    else if(s.at(k-1)=='B')
    {
      s.at(k-1)='b';
    }
   else if(s.at(k-1)=='C')
   {
     s.at(k-1)='c';
   }
  cout<<s<<endl;
}
  

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
#define str string
typedef long long ll;
typedef long double ld;
const ll inf = 999999999999999999;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
ll gcm(ll i, ll j) {//?????§??¬?´???°
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int n, a[100][100], b[100][100], ans = -1 * inf;
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
			if (i == 0) {
				if (j == 0)
					b[i][j] = a[i][j];
				else
					b[i][j] = b[i][j - 1] + a[i][j];
			}
			else if (j == 0) {
				b[i][j] = b[i - 1][j] + a[i][j];
			}
			ans = max(ans, a[i][j]);
		}
	}
	for (int i = 1; i < n; i++) {
		for (int j = 1; j < n; j++) {
			b[i][j] = a[i][j] + b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1];
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int x = 0; x <= i; x++) {
				for (int y = 0; y <= j; y++) {
					int sum = b[i][j];
					if (x > 0)
						sum -= b[x - 1][j];
					if (y > 0)
						sum -= b[i][y - 1];
					if (x > 0 && y > 0)
						sum += b[x - 1][y - 1];
					ans = max(ans, sum);
				}
			}
		}
	}
	cout << ans << endl;
	getchar(); getchar();
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
char dir[] = "DRUL";
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

// const ll mod = 998244353ll;
const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= mod; b >>= 1;}(x *= a) %= mod; b--;} return x;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod ) * rfact[n - r]) % mod;
}
*/
struct Timer {
    int64_t start;
    const int64_t CYCLES_PER_SEC = 2800000000;
    Timer() { reset(); }
    void reset() { start = getCycle(); }
    inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; }
    inline int64_t getCycle() {
        uint32_t low, high;
        __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
        return ((int64_t)low) | ((int64_t)high << 32);
    }
};

Timer timer;

bool multicase = false;

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

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

ll x[500005], y[500005], z[500005];

void solve() {
    ll l, r;
    cin >> l >> r >> d;
    for(int i=l;i<=r;i++){
        if (i % d == 0) ans ++;
    }
    p(ans);
    return;
}

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



Measured memory_bytes: 3656
#include "iostream"
#define max 100005
#define nil -1
using namespace std;

struct node 
{
	int p,l,r;
}t[max];
int n,d[max];
void pri(int u)
{
	int i,c;
	cout<<"node "<<u<<": ";
	cout<<"parent = "<<t[u].p<<", ";
	cout<<"depth = "<<d[u]<<", ";
	
	if(t[u].p==nil)cout<<"root, ";
	else if(t[u].l==nil)cout<<"leaf, ";
	else cout<<"internal node, ";
	
	cout<<"[";
	for(i =0,c=t[u].l;c!=nil;i++,c=t[c].r)
	{
		if(i)cout<<", ";
		cout<<c;
	}
	cout<<"]"<<endl;
	
}

///递归地求深度
int rec(int u,int p)
{
	d[u]=p;
	if(t[u].r!=nil)rec(t[u].r,p);//右侧兄弟设置为相同深度；
	if(t[u].l!=nil)rec(t[u].l,p+1);//最左侧子节点的深度设置为自己的深度+1；
}
int main()
{
	int i,j,d,v,c,l,r;
	cin>>n;
	for(i=0;i<n;i++)t[i].p=t[i].l=t[i].r=nil;
	for(i=0;i<n;i++)
	{
		cin>>v>>d;
		for(j=0;j<d;j++)
		{
			cin>>c;
			if(j==0)t[v].l=c;
			else t[l].r=c;
			l=c;
			t[c].p=v;
		}
	}
	for(i=0;i<n;i++)
	{
		if(t[i].p==nil)r=i;
	}
	rec(r,0);
	for(i=0;i<n;i++)pri(i);
	
	return 0;
}


Measured memory_bytes: 7672
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <functional>
#include <numeric>
using namespace std;
#define rep(p,q) for(int i = p;i < q; i++)


int main(void) {
	int c_num = 0, c_kind = 0;
	int ate = 10001;
	int count = 0;
	cin >> c_num >> c_kind;
	vector<pair<int, int>> cake;
	rep(0, c_kind) {
		int num = 0;
		cin >> num;
		cake.push_back(make_pair(num,i));
	}
	rep(0, c_num) {
		sort(cake.begin(), cake.end(), greater<>());
		if (ate != cake[0].second) {
			cake[0].first--;
			ate = cake[0].second;
		}
		else if (c_kind > 1 && cake[1].first > 0) {
			cake[1].first--;
			ate = cake[1].second;
		}
		else {
			cake[0].first--;
			ate = cake[0].second;
			count++;
		}
	}
	cout << count << endl;
}

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

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

  vector<int> a(3 * N, 0);
  for (int i = 0; i < 3 * N; i++) {
    scanf("%d", &a.at(i));
  }

  sort(a.begin(), a.end(), greater<int>());

  long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (long) a.at(i * 2 + 1);
  }
  
  printf("%ld", ans);
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
 
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ll n = 1, ans, aux = 2, x;
    vector<ll> seq;
    seq.pb(0);
    while(n <= 100000000000) {
        seq.pb(n);
        n += aux;
        aux++;
    }
    cin >> x;
    loop(i, 0, seq.size()) {
        if(seq[i] >= x) {
            ans = i;
            break;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 6512
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);


  int n;
  map<int,int> mp;
  cin>>n;
  rep(i,n){
    int d;
    cin>>d;
    mp[d]++;
  }

  int m;
  cin>>m;
  bool flag=true;

  rep(i,m){
    int t;
    cin>>t;
    flag&=(mp[t]>0);
    mp[t]--;
  }


  YES(flag);

}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
typedef long long ll;
typedef unsigned long long int llt;
const int N = 3e5 + 10;


int main()
{
    int n;
    cin>>n;
    double arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr, arr + n);
    for(int i=0;i<n-1;i++)
    {
        arr[i+1] = (arr[i] + arr[i+1]) / 2;
    }
    cout<<setprecision(10)<<arr[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <string> 
#include <stack> 
#include <iostream> 
using namespace std; 
int main() { 
    string word; 
    stack<int> S; 
    while (cin >> word) {
        if (word == "+") { 
            int m=S.top();
            S.pop();
            int n=S.top();
            S.pop();
            S.push(m+n);
        } 
        else if (word == "-") { 
            int m=S.top();
            S.pop();
            int n=S.top();
            S.pop();
            S.push(n-m);
        } 
        else if (word == "*") { 
            int m=S.top();
            S.pop();
            int n=S.top();
            S.pop();
            S.push(m*n);
        } 
        else { 
            S.push(atoi(word.c_str()));
        } 
    } 
    cout << S.top() <<endl;   
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll n,k;
cin>>n>>k;
map<ll,ll > map;
std::map<ll,ll> ::iterator it;
for(ll i=1;i<=n;i++){
map[i]=1;
}

for(ll i=1;i<=k;i++){
ll d;
cin>>d;
for(ll i=0;i<d;i++){
ll x;
cin>>x;
it=map.find(x);
if(it!=map.end()){
map.erase(x);
}
}
}
cout<<map.size()<<endl;
}

Measured memory_bytes: 3636
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    int n, m;
    cin >> n >> m;

    vector<vector<int>> ne(n+1, vector<int>());
    rep(i, m){
        int a, b;
        cin >> a >> b;

        ne[a].push_back(b);
        ne[b].push_back(a);
    }

    deque<int> path;
    set<int> p;

    path.push_back(1);
    path.push_back(ne[1][0]);
    p.insert(1);
    p.insert(ne[1][0]);

    while(true){
        set<int> first, last;
        for(int i : ne[path[0]]){
            first.insert(i);
        }

        for(int i : ne[path[path.size()-1]]){
            last.insert(i);
        }

        bool fCheck, lCheck;
        fCheck = lCheck = true;
        for(int i : first){
            if(p.find(i) == p.end()){
                fCheck = false;
                break;
            }
        }
        for(int i : last){
            if(p.find(i) == p.end()){
                lCheck = false;
                break;
            }
        }

        if(fCheck && lCheck){
            cout << path.size() << endl;
            for(int i = 0; i < (int)path.size()-1; i++){
                cout << path[i] << " ";
            }
            cout << path[(int)path.size()-1] << endl;
            return 0;
        }

        if(not fCheck){
            for(int i : first){
                if(p.find(i) != p.end()){
                    continue;
                }
                path.push_front(i);
                p.insert(i);
                break;
            }
        }

        if(not lCheck){
            for(int i : last){
                if(p.find(i) != p.end()){
                    continue;
                }
                path.push_back(i);
                p.insert(i);
                break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 11776
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, ll> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int mod = 1e+9 + 7;
const int INF = 1e+9;

ll csum[300005];

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

    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        csum[i+1] = csum[i] + a[i];
    }
    ll res = numeric_limits<ll>::max();
    for(int i = 0; i < n-1; ++i){
        ll left = csum[i+1];
        ll right = csum[n] - csum[i+1];
        res = min(res, abs(right - left));
    }

    cout << res << endl;
}

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

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

    vector<long long int> orig(size_of_arr);
    vector<long long int> dup(size_of_arr);
    long long int maxi = INT_MIN;
    long long int sum = 0;

    for(int i=0;i<size_of_arr;i++) cin >> orig[i];

    for(int i=0;i<size_of_arr;i++){
        if(orig[i] > maxi) maxi = orig[i];

        dup[i] = maxi;
    }

    for(int i=0;i<size_of_arr;i++) sum += dup[i] - orig[i];

    cout << sum << endl;

    return 0;
}


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

int main(){
	int year, month, day;
	int n, sum;
	
	cin >> n;
	while ( n-- >0 ){
		cin >> year >> month >> day;
		
		if ( year % 3 == 0 ){
			sum = 20 * ( 10 - month ) + 20 - day;
		}else{
			sum = 20 * ( ( 10 - month ) / 2 ) + 19 * ( 10 - month  - ( 10 - month ) / 2 );
			if ( month % 2 == 0 ){
				sum += 19 - day;
			}else{
				sum += 20 - day;
			}
		}
		for ( year++; year < 1000; year++ ){
			if ( year % 3 == 0 ){
				sum += 200;
			}else {
				sum += 195;
			}
		}	
		cout << sum+1 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	int a, b, c, d, p;
	scanf("%d %d %d %d %d", &a, &b, &c, &d, &p);

	int x, y;
	x = a * p;
	if (p <= c){
		y = b;
	}else{
		y = b + d * (p - c);
	}

	printf("%d\n", min(x, y));

	return 0;
}

Measured memory_bytes: 1028