akhauriyash/Code-Regression huggingface dataset:
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions 

#endif


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

    int N, K; cin >> N >> K;
    vl X(N); REP(i, N) cin >> X[i];

    if (K==1) {
        ll ans = LINF;
        REP(i, N) ans = min(ans, abs(X[i]));
        cout << ans << endl;
        return 0;
    }

    vl s(N+1,0);
    s[1] = abs(X[1] - X[0]);
    FOR(i,1,N) {
        s[i] = s[i - 1] + abs(X[i] - X[i - 1]);
    }
    vl dist;
    REP(i, N - K + 1) {
        ll d = min(abs(X[i]), abs(X[i + K - 1]));
        dist.push_back(d + (s[i + K - 1] - s[i]));
    }

    ll ans = LINF;
    for (ll d : dist) ans = min(ans, d);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2428
#include<stdio.h>
int n, s, tmp;
int main(){
  scanf("%d", &n);
  s=0;
  for (int i=0;i<n;i++){
    scanf("%d", &tmp);
    s += (tmp%2);
  }
  if (s%2){
    printf("NO\n");
  }
  else{
    printf("YES\n");
  }
  return 0;
}

Measured memory_bytes: 1588
/************************************************
   Start coding only after you have clear idea. 
*************************************************/
 
#include <bits/stdc++.h>
 
#define x first
#define y second
#define pii pair<int,int>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
const int maxm = 3e3+23;
const int maxn = 2e5+35;
int a[maxm],b[maxm],c[maxm],d[maxm],e[maxm],f[maxm];
vector<int> x,y;
int D[maxm][maxm],U[maxm][maxm],L[maxm][maxm],R[maxm][maxm];
inline int getx(int val){
    return lower_bound(all(x),val) - x.begin();
}
inline int gety(int val){
    return lower_bound(all(y),val) - y.begin();
}
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
bool check(int fx,int fy){
    return fx>=0&&fx<sz(x)&&fy>=0&&fy<sz(y);
}
int vis[maxm][maxm];
LL solve(int sx,int sy){
    queue<pii> q; q.push(pii(sx,sy)); vis[sx][sy] = 1; 
    LL ans = 0;
    while(!q.empty()){
        pii now = q.front(); q.pop();
        ans += 1ll*(x[now.x+1]-x[now.x])*(y[now.y+1]-y[now.y]);
        for(int i = 0;i < 4; ++i){
            if(i==0&&U[now.x][now.y]) continue;
            if(i==1&&D[now.x][now.y]) continue;
            if(i==2&&R[now.x][now.y]) continue;
            if(i==3&&L[now.x][now.y]) continue;
            int fx = now.x+dx[i],fy = now.y+dy[i];
            if(check(fx,fy)){
                if(!vis[fx][fy]){
                    vis[fx][fy] = 1;
                    q.push(pii(fx,fy));
                }
            }
            else return -1;
        }
    }
    return ans;
}
int main(){
    int n,m; scanf("%d %d",&n,&m);
    for(int i = 1;i <= n; ++i){
        scanf("%d %d %d",a+i,b+i,c+i);
        x.push_back(a[i]);
        x.push_back(b[i]);
        y.push_back(c[i]);
    }
    for(int i = 1;i <= m; ++i){
        scanf("%d %d %d",d+i,e+i,f+i);
        x.push_back(d[i]);
        y.push_back(e[i]);
        y.push_back(f[i]);
    }
    x.push_back(0);y.push_back(0);
    sort(all(x)); sort(all(y));
    x.erase(unique(all(x)),x.end());
    y.erase(unique(all(y)),y.end());
    for(int i = 1;i <= n; ++i){
        a[i] = getx(a[i]);b[i] = getx(b[i]);c[i] = gety(c[i]);
        for(int j = a[i];j < b[i]; ++j){
            U[j][c[i]-1] = 1;
            D[j][c[i]] = 1;
        }
    }
    for(int i = 1;i <= m; ++i){
        d[i] = getx(d[i]);e[i] = gety(e[i]);f[i] = gety(f[i]);
        for(int j = e[i];j < f[i]; ++j){
            L[d[i]][j] = 1;
            R[d[i]-1][j] = 1;
        }
    }
    LL res = solve(getx(0),gety(0));
    if(res == -1) puts("INF");
    else cout << res << '\n';
    return 0;
}

Measured memory_bytes: 114508
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int main(){
  ll n;
  cin>>n;
  ll ene = 1;
  ll count = 0;
  ll ans =0;
  while(n>1){
    n/=2;
    ene = pow(2,count);
    ans += ene;
    count++;
  }
  ans+=pow(2,count);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i > (b); i--)

using namespace std;

int main(void) {

	char S[5];
    scanf("%s", S);
    
    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3] ) puts("Bad");
    else puts("Good");

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<tuple>
#include<iomanip>
#include<list>
#include<climits>
#define endl '\n'
#define ll long long
#define ld long double
#define mod 1000000007
#define mod1 998244353
#define PI acos(-1)
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll n;
	cin>>n;
	ll sum=0;
	for(int i=1;i<=n;i++)
    {
		if(i%5!=0&&i%3!=0)
		{
			sum+=i;
		}
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3652
import math
H, W = map(int, input().split())
ans = 0
tmp1 = math.ceil(W / 2)
tmp2 = W // 2
ans += tmp1 * math.ceil(H / 2)
ans += tmp2 * (H // 2)
if H == 1 or W == 1:
    print(1)
else:
    print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <string>
#include <random>
#include <map>
#include <math.h>
#pragma warning(disable : 4996)

#define MAX_N 100000

char S[MAX_N+1];
char R[MAX_N+1];

int main(void) {
	int n;
	scanf("%d", &n);
	scanf("%s", &S[0]);

	for (int f = 0; f < 2; ++f) {
		for (int s = 0; s < 2; ++s) {
			// 0:Sheep 1:Wolf
			int n0 = f;
			int n1 = s;
			R[0] = (f == 0) ? 'S' : 'W';
			R[1] = (s == 0) ? 'S' : 'W';
			int n2;
			for (int i = 2; i <= n; ++i) {
				if (n1 == 0) {
					if (S[i - 1] == 'o') {
						n2 = n0;
					}
					else {
						n2 = 1 - n0;
					}
				}
				else {
					if (S[i - 1] == 'o') {
						n2 = 1 - n0;
					}
					else {
						n2 = n0;
					}
				}
				n0 = n1;
				n1 = n2;
				R[i%n] = (n2 == 0) ? 'S' : 'W';
			}
			R[n] = '\0';
			bool success = false;
			if (n2 == f) {
				if (f == 0) {
					if (S[0] == 'o') {
						success = R[1] == R[n-1];
					}
					else {
						success = R[1] != R[n - 1];
					}
				}
				else {
					if (S[0] == 'o') {
						success = R[1] != R[n - 1];
					}
					else {
						success = R[1] == R[n - 1];
					}
				}
			}
			if (success) {
				printf("%s", R);
				return 0;
			}
		}
	}
	printf("-1");
	return 0;
}


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

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

using ll = long long;
using P = pair<int,int>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

int main() {
    int N;
    cin>>N;
    int p = 0;
    int cnt = 0;
    rep(i,N){
        cnt += i+1;
        if(cnt>=N) {
            p = i+1;
            break;
        }
    }
    for(int i = p; i > 0; i--){
        if(N<i) continue;
        else {
            cout<<i<<endl;
            N-=i;
        }
    }
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define NINTH_POWER_OF_TEN 1000000000
#define LL_INF (numeric_limits<long long>::max()/2)
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

string s;
int x, y;
string ans;

bool dpx[16001], dpy[16001];

signed main() {
  cin >> s;
  cin >> x >> y;

  dpx[0+8000] = true; dpy[0+8000] = true;

  int i = 0;
  bool state_init = true;
  bool state_x = true;
  while (i < s.length()) {
    int c = 0;
    while (i < s.length() && s[i] == 'F') {
      ++i;
      ++c;
    }

    if (state_x) {
      bool dpx2[16001];
      REP(j, 16001) {
        dpx2[j] = false;
        if (j-c >= 0) { dpx2[j] |= dpx[j-c]; }
        if (j+c < 16001 && !state_init) { dpx2[j] |= dpx[j+c]; }
      }
      REP(j, 16001) { dpx[j] = dpx2[j]; }
      state_init = false;
    } else {
      bool dpy2[16001];
      REP(j, 16001) {
        dpy2[j] = false;
        if (j-c >= 0) { dpy2[j] |= dpy[j-c]; }
        if (j+c < 16001) { dpy2[j] |= dpy[j+c]; }
      }
      REP(j, 16001) { dpy[j] = dpy2[j]; }
    }
    ++i;
    state_x = !state_x;

    // cout << state_x << endl;
    //
    // FOR(j, -5, 5) { cout << dpx[j+8000] << " "; }
    // cout << endl;
    // FOR(j, -5, 5) { cout << dpy[j+8000] << " "; }
    // cout << endl;
  }


  if (dpx[x+8000] && dpy[y+8000]) {
    ans = "Yes";
  } else {
    ans = "No";
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		String input_line = input.readLine();

		String[] coordinate_group = input_line.split(" ");

		double coordinate_x = Double .parseDouble(coordinate_group[0]);

		double coordinate_y = Double .parseDouble(coordinate_group[1]);

		double coordinate_xi = Double .parseDouble(coordinate_group[2]);

		double coordinate_yi = Double .parseDouble(coordinate_group[3]);

		double x_distance = Math.pow(coordinate_x - coordinate_xi, 2);

		double y_distance = Math.pow(coordinate_y - coordinate_yi, 2);

		double distance = Math.sqrt(x_distance + y_distance);

		System.out.println(distance);

	}

}

Measured memory_bytes: 24404
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    int n; cin >> n;
    vector<int> a(n);
    int ans = 0;
    rep(i, n) cin >> a[i];
    for(int i = 1; i < n; i++) {
        if(a[i] == a[i - 1]){
            ans++;
            i++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a, b;  
    cin>> a >> b;  
    if ( a < b ) cout << "a < b" << endl;
    else if ( a > b ) cout << "a > b" << endl;
    else cout << "a == b" << endl;
    return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
    IOS();
    ll a,b,c;
    cin >> a >> b >> c;
    ll tmp = a-b;
    cout << max(0LL,c-tmp) << endl;
}


Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
_ = ri()
a = rl()
b = rl()
ans = 0
for i, j in zip(a, b):
  ans += max(0, i-j)
print(ans)









Measured memory_bytes: 27156
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

ll N, K;
vector<ll> A;
vector<ll> F;

bool check(ll m){
    ll cnt = 0;

    REP(i,N){
        if(A[i] * F[i] <= m) continue;
        else{
            cnt += A[i] - (m / F[i]);
        }
    }
    return (cnt <= K);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    REP(i,N){
        ll a;
        cin >> a;
        A.push_back(a);
    }
    REP(i,N){
        ll a;
        cin >> a;
        F.push_back(a);
    }
    sort(A.begin(), A.end());
    sort(F.rbegin(), F.rend());

    ll l = -1, r = 2*LINF;
    while(r - l > 1){
        ll m = (l + r) / 2;
        if(check(m))  r = m;
        else l = m;
    }
    cout << r << endl;
}

Measured memory_bytes: 4848
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize, d: i64, a: i64,
        mut xh: [(i64, i64); n]
    }

    xh.sort();
    let mut damage = vec![0i64; n+2];
    let mut ans = 0i64;

    for i in 0..n {
        damage[i+1] += damage[i];
        let (left, hp) = xh[i];
        if hp - damage[i+1] <= 0 {
            continue;
        }
        let right = left + d * 2;
        let rpos = xh.lower_bound(&(right+1, 0));
        let count = (hp - damage[i+1] + a - 1) / a;
        ans += count;
        damage[i+1] += a * count;
        damage[rpos+1] -= a * count;
    }
    println!("{}", ans);
}


Measured memory_bytes: 10608
#include<bits/stdc++.h>							
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;


void solve() {
	int n;
	cin >> n; 
	int a[n], b[n], c[n - 1];
	for(int i = 0; i < n; ++i) cin >> a[i];
	for(int i = 0; i < n; ++i) cin >> b[i];
	for(int j = 0; j < n - 1; ++j) cin >> c[j];
	ll sum  = 0;
	for(int i = 0; i < n; ++i) {
		int x = a[i];
		x--;
		sum += b[x];
		if(i) {
			if(a[i] == a[i - 1] + 1) sum += c[a[i - 1] - 1];
			}
		}
		cout << sum << endl;
}


int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}
 
 
 


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Printer{
    void print(vector<int> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    void print(vector<vector<int> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};

//--global--//



//----------//

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<ll> a, b, c;
    rep(i, x){
        ll tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    rep(i, y){
        ll tmp;
        cin >> tmp;
        b.push_back(tmp);
    }
    rep(i, z){
        ll tmp;
        cin >> tmp;
        c.push_back(tmp);
    }
    sort(ALL(a), greater<ll>());
    sort(ALL(b), greater<ll>());
    sort(ALL(c), greater<ll>());

    vector<ll> sumtwo;
    rep(i, b.size()){
        rep(j, c.size()){
            sumtwo.push_back(b[i]+c[j]);
        }
    }
    sort(ALL(sumtwo), greater<ll>());

    vector<ll> ans;
    int limit = min(k, (int)(sumtwo.size()));
    rep(i, a.size()){
        rep(j, limit){
            ans.push_back(a[i]+sumtwo[j]);
        }
    }
    sort(ALL(ans), greater<ll>());



    rep(i, k){
        cout << ans[i] << endl;
    }

    
    return 0;
}


Measured memory_bytes: 43256
/*bismillah ->                                                                                                         << Suirkhanov Meyirlan >>
  GL HF


                                                                                                                      42

    bless my code =)
                                                                                                            NEVER FOLLOW YOUR RULES :D HAHAHAHA
*/


///scanf ("%d%d", &x, &y);
///printf("%d", &a)

#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define pii pair < int , int >
#define pll pair < ll, ll >
#define pb push_back
#define pf psuh_front
#define mp make_pair
#define fi first
#define se second
#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define eb emplace_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll N = 2 * 1e5 + 7;
const ld pi = 3.14159265359;
const int INF = 1e20 + 7;
const double eps = 1e-9;

const int xi[4] = {-1, 0, +1, 0};
const int yj[4] = {0, +1, 0, -1};
const int xxi[4] = {+1, 0, -1, 0};
const int yyj[4] = {0, -1, 0, +1};

string s;

bool f[N];

int main(){

  //freopen("bridge.in", "r", stdin);
  //freopen("bridge.out", "w", stdout);

  fast
  randoperation;

  ///           ||
  ///start here \/

  cin >> s;

  f[0] = 1;

  for(int i = 0; i < s.size(); i++){
    if(f[i]){
      if(s.substr(i, 7) == "dreamer"){
        f[i + 7] = 1;
      }
      if(s.substr(i, 5) == "dream"){
        f[i + 5] = 1;
      }
      if(s.substr(i, 6) == "eraser"){
        f[i + 6] = 1;
      }
      if(s.substr(i, 5) == "erase"){
        f[i + 5] = 1;
      }
    }
  }

  /*
  for(int i = 0; i < s.size() + 1; i++){
    cout << f[i] << ' ';
  }
  */

  if(f[s.size()]){
    cout << "YES";
  }
  else{
    cout << "NO";
  }
}


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

using namespace std;

long long int S(long long int n) {

	if (n < 10) { return n; }

	return n % 10 + S(n / 10);
};

long long int f(long long int N) {


	if (N <= 8) { return N+1; }

	N++;

	vector<pair<long double, long long int> > V;

	long long int K;

	int k = 1;
	while (1) {
		K = N;
		for (int i = 1; i <= k; i++) { K /= 10; }
		for (int i = 1; i <= k; i++) { K = K * 10 + 9; }

		V.push_back(pair<long double, long long int>(1.0L*K / S(K), K));
		//cout << K << endl;
		k++; if (k == 17) { break; }
	}

	sort(V.begin(), V.end());

	return V[0].second;

};

int main(void) {

	long long int K;

	cin >> K;

	long long int count = 0;

/*	vector<pair<long double, long long int> > V;
	
	for (int i = 1; i <= 10000; i++) {
		V.push_back(pair<long double, long long int>(1.0L*i / S(i), i));
	}

	int M = 0;
	for (int i = 0; i < 10000; i++) {
		int sign = 0;
		for (int j = M+1; j < 10000; j++) {
			if (V[M].first > V[j].first) { sign = 1; break; }
		}
		if (sign == 0) { cout << V[M].second << endl;  }
		M++;
	}
	*/

	long long int N = 0;

	while (1) {
		cout << f(N) << endl;
		N = f(N);
		count++;
		if (count >= K) { break; }
	}

	//cout << f(N) << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
//AUTHOR : TIRTH JARSANIA
//COLLEGE : DAIICT

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

#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define bp __builtin_popcountll
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define pii pair<ll,ll>
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<pii,vector<pii>,greater<pii> > 
#define maxQueue priority_queue<pii> 
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))

int main()
{
    FAST;
    ld a , b;
    cin >> a >> b;
    b-- , a--;
    cout << ceil(b/a);
}

Measured memory_bytes: 256
s=list(input())
t=list(input())
sal=[]
ska=[]
tal=[]
tka=[]
n=len(s)
for i in range(n):
    if s[i] in sal:
        ska[sal.index(s[i])].append(i)
    else:
        sal.append(s[i])
        ska.append([i])
    if t[i] in tal:
        tka[tal.index(t[i])].append(i)
    else:
        tal.append(t[i])
        tka.append([i])
ska.sort()
tka.sort()
if ska==tka:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 16688
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int cnt = 0;
		var stk = new Stack<char>();
		int N = S.Length;
		for(int i=0;i<N;i++){
			switch(S[i]){
				case 'T':{
					if(stk.Count > 0){
						stk.Pop();
					} else {
						cnt++;
					}
				} break; 
				case 'S': {
					stk.Push('S');
				} break;
			}
		}
		Console.WriteLine(cnt + stk.Count);
	}
	String S;
	public Sol(){
		S = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 12256
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;
const uint64 INF=1<<30;

bool dp[100][100001]={false};
int table[]={1,(int)pow(6,1),(int)pow(9,1),(int)pow(6,2),(int)pow(9,2),(int)pow(6,3),(int)pow(9,3),(int)pow(6,4),(int)pow(9,4),(int)pow(6,5),(int)pow(6,6),(int)pow(9,5)};

int main(){
    int n; scanf("%d",&n);
    int ans;
    bool solve = false;
    rep(i , 12){
        if( table[i] == n ) { printf("1\n"); return 0;}
        dp[0][table[i]]=true;
    }
        rep1(i , 100){
            rep1(j , 100000){
                if(dp[i-1][j]){
                    rep(k , 12){
                        if( j+table[k] < n ){
                        dp[i][j+table[k]]=true;
                        } else if( j+table[k] > n ) break;
                        else if( j+table[k] == n ) { solve = true; break; }
                    }
                }
                if(solve) break;
            }
            if(solve) { ans=i+1; break; }
        }
    printf("%d\n",ans);
}

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            long a;
            a=long.Parse(Console.ReadLine());

            switch (a)
            {
                case 25:
                    Console.WriteLine("Christmas");
                    break;
                case 24:
                    Console.WriteLine("Christmas Eve");
                    break;
                case 23:
                    Console.WriteLine("Christmas Eve Eve");
                    break;
                case 22:
                    Console.WriteLine("Christmas Eve Eve Eve");
                    break;
            }


        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    set<string> st;
    int n;cin>>n;
    rep(i,n){
        string s;cin>>s;
        st.insert(s);
    }
    cout<<st.size()<<endl;
    return 0;
}


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

int LinearSearch(vector<int> v,int x){
    for (int i=0;i<v.size();i++){
        if (v[i] == x) return 1;
    }
    return 0;
}

int main(){
    int n; cin >> n;
    vector<int> v(n);
    for (int i=0;i<n;i++){
        cin >> v[i];
    }
    int q; cin >> q;
    vector<int> s(q);
    for (int i=0;i<q;i++){
        cin >> s[i];
    }
    int res = 0;
    for (int i=0;i<q;i++){
        res += LinearSearch(v,s[i]);
    }
    cout << res << endl;
    return 0;
}


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

int main() {
  long long n,k;
  long long ans = 0;
  cin >> n >> k;
  vector<long long> hp(n);
  for(int i=0;i<n;i++){
    cin >> hp.at(i);}
  sort(hp.begin(),hp.end());
  for(int j=0;j<k;j++){hp.pop_back();
                      }
  for(int m=0;m<n-k;m++){
    ans += hp.at(m);}
  cout << ans <<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <map>
using namespace std;

// Q1.
int main()
{
	char szVal[4];
	int x, y, z;
	cin >> x >> y;

	z = x + y / 2;
	cout << z;

	return 0;
}


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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)          \
  sort(x.begin(), x.end()); \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << "(" << #x << ", " << #y << ") = " \
                          << "(" << x << ", " << y << ")" << '\n'

typedef long long int ll;
typedef pair<int, int> P;

const long long INF = 3e18 + 12;
const int inf = 1e9;

// ----------------------------------------------
vector<ll> divisor(ll n) {
  vector<ll> divs;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      divs.push_back(i);
      if (i != n / i) divs.push_back(n / i);
    }
  }
  sort(all(divs));
  return divs;
}

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

  int n;
  cin >> n;

  int count = 0;

  for (int i = 1; i <= n; i += 2) {
    auto divs = divisor(i);
    if (divs.size() == 8) {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;

bool seen[2000000]{};
bool finished[2000000]{};
int d[2000000]{};
int dfs(const Graph &G, int now){
    if(seen[now] == true) return d[now];
    seen[now] = true;
    for(auto e : G[now]){
        if(seen[e] && !finished[e]){
            cout << -1 << endl;
            exit(0);
        }
        d[now] = max(d[now], dfs(G, e)+1);
    }
    finished[now] = true;
    return d[now];
}

int encode(int i,int j){
    if(i < j) swap(i, j);
    return i * (i - 1) / 2 + j + 1;
}


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

	int N;
    cin >> N;
    Graph G(N*(N-1)/2+1);
    rep(i,N){
        int now = 0;
        rep(j,N-1){
            int k;
            cin >> k;
            --k;
            int next = encode(i, k);
            G[now].push_back(next);
            now = next;
        }
    }
    cout << dfs(G, 0) << endl;
}

Measured memory_bytes: 35840
def main():
    import math
    n, d = map(int, input().split())
    inlis = []
    for i in range(n):
        inlis.append(list(map(int, input().split())))
    
    ans = 0
    for i in range(n):
        for j in range(n):
            if i < j:
                dist = 0
                for k in range(d):
                    dist += (inlis[i][k] - inlis[j][k])**2
                if (dist ** 0.5).is_integer():
                    ans += 1
    print(ans)
if __name__ == "__main__":
    main()


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

int main(){
	int N;
	cin >> N;
	int t_n = 0, x_n = 0, y_n = 0;
	rep(i,N){
		int t, x, y;
		bool flag = false;
		cin >> t >> x >> y;
		if (abs(x-x_n)+abs(y-y_n)>t-t_n) flag = true;
		else {
			int parity = (x-x_n + y-y_n)%2;
			parity = (parity+2)%2;
			if (parity != (t-t_n)%2) flag = true;
		}
		if (flag) {
			cout << "No" << endl;
			return 0;
		}
		t_n = t; x_n = x; y_n = y;
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 3540
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>


using namespace std;

int main(){
    long long int a,b,c,k;
    cin >> a >> b >> c  >> k;

    if(abs(b-a)>1000000000000000000LL)cout << "Unfair";

    else if(k%2LL)cout << b-a;
    else cout << a-b;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
typedef unsigned long long int ull;
int n;
map <string,int> a;
int main(){
	cin >> n;
	while (n--){
		string t;
		cin >> t;
		a[t]++;
	}
	cout << "AC x " << a["AC"] << endl;
	cout << "WA x " << a["WA"] << endl;
	cout << "TLE x " << a["TLE"] << endl;
	cout << "RE x " << a["RE"] << endl;
	return 0;
}



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

using namespace std;

int main(void){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N ; i++)
    {
        cin >> A[i] ;
    }
    int Q;
    cin >> Q;
    vector<int> B(Q);
    vector<int> C(Q);
    for(int i = 0 ; i < Q; i++)
    {
        cin >> B[i] >> C[i];
    }
    vector<long long> sum(Q+1);
    vector<int> math(100010);
    for(int i = 0; i < N ; i++)
    {
        sum[0] = sum[0] + A[i];
        math[A[i]]++;
    }
    for(int i = 0; i < Q;i++)
    {
        sum[i+1] = sum[i] + (C[i]-B[i])*math[B[i]];
        math[C[i]] = math[C[i]]+math[B[i]];
        math[B[i]] = 0;
    }
    for(int i = 1; i <= Q;i++)
    {
        cout << sum[i] << endl;
    }

}

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

count = 0
is_match = False
for i in range(n):
    d = [int(e) for e in input().split()]
    
    if d[0] == d[1]:
        count += 1
    else:
        count = 0
    
    if count == 3:
        is_match = True
        break

if is_match:
    print('Yes')
else:
    print('No')
    

    

Measured memory_bytes: 9176
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int r = nextInt();
		int D = nextInt();
		int tX = nextInt();//x2000

		int[]x = new int[11];
		x[0]=tX;
		for(int i=0;i<10;i++)x[i+1]=x[i]*r-D;
		for(int i=1;i<=10;i++)out.println(x[i]);
	}

	private static int nextInt() {
		return Integer.parseInt(next());
	}
	private static long nextLong() {
		return Long.parseLong(next());
	}
	private static String next() {
		return sc.next();
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    using P = pair<int, int>;
    multiset<P, greater<P>> s1;
    multiset<P> s2;
    for (int i = 0; i < N; i++) {
        int L, R;
        cin >> L >> R;
        s1.insert({L, R});
        s2.insert({R, L});
    }
    const auto S1 = s1;
    const auto S2 = s2;
    ll ans1 = 0;
    int pos1 = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            const auto r = *s1.begin();
            if (pos1 <= r.first) { ans1 += r.first - pos1, pos1 = r.first; }
            s1.erase(s1.begin());
            s2.erase(s2.find({r.second, r.first}));
        } else {
            const auto r = *s2.begin();
            if (pos1 >= r.first) { ans1 += pos1 - r.first, pos1 = r.first; }
            s2.erase(s2.begin());
            s1.erase(s1.find({r.second, r.first}));
        }
    }
    ans1 += abs(pos1);

    s1 = S1, s2 = S2;
    ll ans2 = 0;
    int pos2 = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 1) {
            const auto r = *s1.begin();
            if (pos1 <= r.first) { ans2 += r.first - pos2, pos2 = r.first; }
            s1.erase(s1.begin());
            s2.erase(s2.find({r.second, r.first}));
        } else {
            const auto r = *s2.begin();
            if (pos2 >= r.first) { ans2 += pos2 - r.first, pos2 = r.first; }
            s2.erase(s2.begin());
            s1.erase(s1.find({r.second, r.first}));
        }
    }
    ans2 += abs(pos2);
    cout << max(ans1, ans2) << endl;
    return 0;
}


Measured memory_bytes: 19072
import sys

# import math
# import bisect

# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
# INF = sys.maxsize
# MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    ans = ((n-1)*n)//2
    print(ans)

if __name__ == '__main__':
    main()


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    int num = 1;
    for (int i = 0; i < N; i++) {
        if (A[i] == num) num++;
    }

    if (num == 1) {
        cout << -1 << endl;
    } else {
        cout << N - num + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
def PRINT(S,a,b):
    print(S[a:b+1])
def REPLACE(S,T,a,b):
    return S[:a] + T + S[b+1:]
def REVERSE(S,a,b):
    tmp = S[a:b+1]
    return S[:a] + tmp[::-1] + S[b+1:] 

S = input()
q = int(input())

for i in range(q):
    order = list(input().split())
    a = int(order[1])
    b = int(order[2])
    if order[0] == "replace":
        S = REPLACE(S,order[3],a,b)
    elif order[0] == "reverse":
        S = REVERSE(S,a,b)
    else:
        PRINT(S,a,b)


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

int main(){
  int h,w;
  cin>>h>>w;
  
  string board[50];
  rep(i,h)cin>>board[i];
  const int dx[8]={1,1,1,0,0,-1,-1,-1};
  const int dy[8]={-1,0,1,-1,1,-1,0,1};
  rep(i,h)rep(j,w){
    if(board[i][j]=='#')continue;
    int num=0;
    rep(d,8){
      const int ni=i+dy[d];//loop回すだけで8方向の検討可能。賢い。
      const int nj=j+dx[d];//上に同じ
      
      if(ni<0 or h<=ni)continue;//はみ出しがあればとばす
      if(nj<0 or w<=nj)continue;//はみ出しがあればとばす
      if(board[ni][nj]=='#')num++;
    }
    board[i][j]=char(num+'0');
  }
  rep(i,h)cout<<board[i]<<endl;
  return 0;
}

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

int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	
	if (e - a > k) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stack>
 
using namespace std;
 
int main() {
    string s1, s2;
    while(cin >> s1 >> s2) {
        int l1 = s1.length(), l2 = s2.length(), i, j;
        int dp[l1+1][l2+1];
        for(i=0; i<=l1; i++) dp[i][0] = 0;
        for(j=1; j<=l2; j++) dp[0][j] = 0;
        for(i=1; i<=l1; i++) {
            for(j=1; j<=l2; j++) {
                dp[i][j] = (s1[i-1]==s2[j-1]) ? (dp[i-1][j-1] + 1) : max(dp[i-1][j], dp[i][j-1]);
            }
        }
        string t;
        for(i=l1, j=l2; i>0 && j>0;) {
            if(dp[i][j]==dp[i-1][j]) i--;
            else if(dp[i][j]==dp[i][j-1]) j--;
            else /*if(dp[i][j]==dp[i-1][j-1]+1)*/ {
                t.push_back(s1[i-1]);
                i--; j--;
            }
        }
        cout << string(t.rbegin(), t.rend()) << endl;
    }
}

Measured memory_bytes: 35456
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    // Rust version 1.15.1, which is used by AtCoder,
    // does not support std::str::FromStr for char
    ($iter:expr, char) => {
        $iter.next().unwrap().chars().next().expect("Parse error")
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
fn main() {
    use std::cmp::max;
    use std::cmp::min;
    use std::collections::HashMap;

    input!{
        n: i32,
        a: i32,
    }
    println!("{}", n*n-a);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  cout<<n*n*n<<endl;
  return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char input[202];
char temp[101];
void PrintCard(char input[]){
	int cardLen;
	cardLen = strlen(input);
	int i;
	for(i = 0 ; i < cardLen ; i++){
		printf("%c", input[i]);
	}
	printf("\n");
}
void putTemp(char input[], int numberShuffle){
	int i;
	for(i = 0 ; i < numberShuffle ; i++){
		temp[ i ] = input[ i ];
	}
}
void backToFront(char input[],int numberShuffle){
	int i ;
	int k = 0 ;
	int lastIndex = strlen(input)-1;
	for(i = numberShuffle ; i <= lastIndex ; i++){
		input[ k ] = input[ i ];
		k++;
	}
}
void tempToInput(char input[], char temp[], int numberShuffle){
	int i;
	int k = 0;
	int lastIndex = strlen(input)-1;
	for(i = strlen(input) - numberShuffle ; i <= lastIndex ; i++){
		input[ i ] = temp[ k ];
		k++;
	}
}
void Shuffle(char input[], int numberShuffle){
	int lastIndex = strlen(input)-1;
	putTemp(input, numberShuffle);
	backToFront(input, numberShuffle);
	tempToInput(input, temp, numberShuffle);
} 




int main(){
	int numberShuffle;
	int shuffleTimes;
	int i ;
	while(1){
		scanf("%s", &input);
		if(strcmp(input, "-") == 0){
			return 0 ;
		}
		scanf("%d", &shuffleTimes);
		for(i = 0 ; i < shuffleTimes ; i++){
			scanf("%d", &numberShuffle);
			Shuffle(input, numberShuffle);
			temp[202] = NULL;
		}
		PrintCard(input);
		input[202] = NULL;
		
	}
	return 0 ;
}


Measured memory_bytes: 2108
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n;
    cin >> n;

    ll cnt(0);
    for(ll i=0; i<(1<<n); i++)
    {
        cout << cnt << ":";

        rep(j,0,n)
            if ((i & (1<<j)) > 0)
                cout << " " << j;

        cnt++;

        cout << endl;
    }

    return 0;
}



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

const int N = 2e5 + 300;
 
int n;
ll dp[N];
int a[N], h[N];
 
ll update(ll r, ll val){
	for (; r < N; r |= r + 1)	
		dp[r] = max(val, dp[r]);
}
 
ll get(int r){
	ll mx = 0;
	for (; r >= 0; r = (r & (r + 1)) - 1)
		mx = max(mx, dp[r]);
	return mx;
}
 
int main(){
	cin >> n;
	rep(i,n) cin >> h[i];
	rep(i,n) cin >> a[i];
	ll mx = 0;
	rep(i,n){
		ll x = get(h[i] - 1);
		update(h[i], a[i] + x);
		mx = max(mx, get(h[i]));
	}
	cout << mx;
	return 0;
}

Measured memory_bytes: 3328
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)
 
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
#define repp(i, a, b) for(int i = a; i <= b; i++)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, b, a) for(int i = b; i >= a; i--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define mem(a, b) memset(a, b, sizeof(a));
#define mem0(a) memset(a, 0, sizeof(a));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define in_edges(m) repp(i, 1, m){ll a, b; cin >> a >> b; v[a].pb(b), v[b].pb(a);}
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define endl "\n"
ll power(ll x, ll y); 

const ll MOD = 1000000007;

vector<ll> v[2003];
bool vis[2003];
ll level[2003];
ll dis[2003];
ll n, x, y;

ll mat[2001][2001];

void bfs(ll s)
{
    mem0(level);
	queue<ll> q;
	q.push(s);
	vis[s] = 1;
	while(!q.empty()){
		ll p = q.front();
		q.pop();
		for(auto i : v[p]){
			if(vis[i]) continue;
			level[i] = level[p] + 1;
			q.push(i);
			vis[i] = 1;
		}
	}

    repp(i, 1, n) mat[i][s] = mat[s][i] = level[i];
    // repp(i, 1, n) cout << level[i] << " "; cout << endl;
    // repp(i, 0, 1000) dis[level[i]]++;
}
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    quickio
    ll x, y, n1, n2, n3, inp;
    cin >> x >> y >> n1 >> n2 >> n3;
    vector<ll> a, b, c, v;
    rep(i, 0, n1){
        cin >> inp;
        a.pb(inp);
    }
    rep(i, 0, n2){
        cin >> inp;
        b.pb(inp);
    }
    rep(i, 0, n3){
        cin >> inp;
        c.pb(inp);
    }

    sort(rall(a));
    sort(rall(b));
    sort(rall(c));

    rep(i, 0, x) v.pb(a[i]);
    rep(i, 0, y) v.pb(b[i]);

    sort(all(v));

    int j = 0;
    rep(i, 0, c.size()){
        if(c[i] <= v[j] || j == v.size()) break;
        v[j] = c[i], j++;
    }

    ll res = 0;
    for(auto i : v) res += i;

    cout << res;
}
 
ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 4852