akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); (i)++)
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); (i)--)
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n;
	cin >> n;
	Vec a(n), b(n), c(n), b_sum(n+1);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n) cin >> c[i];

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

	repr(i, n-1){
		b_sum[i] = c.end()-upper_bound(all(c), b[i])+b_sum[i+1];
	}
	ll ans = 0;
	rep(i, n){
		ll j = upper_bound(all(b), a[i])-b.begin();
		ans += b_sum[j];
	}
	co(ans);

	return 0;
}


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

#define int long long
#define MOD 1000000007LL

int N, X, Y, Z;
int dp[41][1<<18];

signed main() {
  cin >> N >> X >> Y >> Z;

  const int MASK = (1<<17) - 1;
  const int NG = (1<<(Z-1)) | (1<<(Y+Z-1)) | (1<<(X+Y+Z-1));

  for (int k=1; k<=10; k++) dp[0][(1<<(k-1)) & MASK] = 1;
  for (int i=1; i<N; i++) {
    for (int b=0; b<=MASK; b++) {
      if (dp[i-1][b] == 0) continue;
      for (int k=1; k<=10; k++) {
        int nb = ((b<<k) | (1<<(k-1))) & MASK;
        if ((nb & NG) == NG) continue;
        dp[i][nb] = (dp[i][nb] + dp[i-1][b]) % MOD;
      }
    }
  }
  int p = 1;
  for (int i=0; i<N; i++) {
    p = (10LL*p) % MOD;
  }
  int s = 0;
  for (int b=0; b<=MASK; b++) {
    s += dp[N-1][b];
    s %= MOD;
  }
  s = MOD - s;
  cout << (p + s) % MOD << "\n";
  return 0;
}


Measured memory_bytes: 80128
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
}
	
int main(){
	init();
	ll A,B,C;
	cin>>A>>B>>C;
	if(A<=C && C<=B)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

N = int(input())

flag = 0
for i in range(1, 10, 1) : 
    for j in range(1, 10, 1) : 
        if N == i*j : 
            flag = 1
            
if flag == 1 : 
    print("Yes")
else : 
    print("No")

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n + 2, 0);
    vector<int> b(n + 2, 0);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        b[i] = a[i];
        a[i] ^= a[i - 1];
    }
    a[n + 1] = a[n];
    for (int i = 1; i <= n; i++) {
        cout << (a[n] ^ a[i] ^ a[i - 1]) << " ";
    }
    return 0;
}


Measured memory_bytes: 4680
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <sstream>
#include <queue>
using namespace std;
typedef long long ll;

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

  vector<int> west_sum(n);
  vector<int> east_sum(n);

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

  for (int i = n-2; i >= 0; i--) {
    if (s[i+1] == 'E') {
      east_sum[i] = east_sum[i+1] + 1;
    } else {
      east_sum[i] = east_sum[i+1];
    }
  }

  int ans = 1e9;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      ans = min(ans, east_sum[i]);
    } else if (i == n-1) {
      ans = min(ans, west_sum[i]);
    } else {
      ans = min(ans, west_sum[i] + east_sum[i]);
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main(){ 
  string s,t; cin >> s >> t;
  int a,b; cin >> a >> b;
  string u; cin >> u;
  if( s == u ){ cout << a-1 << " " << b << endl;}
else{ cout << a << " "<< b-1 << endl;}
  
  return 0;
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int n;
vector< vector<int> > a;
lint memo[21][1 << 21];

lint solve(int i, int women){
    if(i == n){
        return women == 0;
    }
    if(memo[i][women] >= 0){
        return memo[i][women];
    }
    lint res = 0;
    rep(j, n){
        if(a[i][j] & women >> j){
            res += solve(i + 1, women - (1 << j));
            res %= MOD;
        }
    }
    return memo[i][women] = res;
}

int main(){
    cin >> n;
    a.resize(n);
    rep(i, n){
        a[i].resize(n);
        rep(j, n){
            cin >> a[i][j];
        }
    }
    fill(memo[0], memo[21], -1);
    lint ans = solve(0, (1 << n) - 1);
    cout << ans << endl;
    return 0;
}

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

void say(bool n) {
    if (n == false) {
        cout << ":(";
        return;
    } 

    cout << "Yay!";
    return;
}

int main()
{
    int a,b;
    scanf("%d %d", &a, &b);
    if ((a <= 8) && (b <= 8)) {
        say(true);
        return 0;
    }

    say(false);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int t,Stac[1000];

void push(int x)
{
  Stac[++t] = x;
}

int pop()
{
  t--;
  return Stac[t+1];
}

int main()
{
  int x,y;
  t =0;
  char O[100];

  while( scanf("%s",O) !=EOF)
    {
      if (O[0] == '+')
	{
	  x = pop();
	  y = pop();
	  push(x+y);
	}
      else if(O[0] == '-')
	{
	  y = pop();
	  x = pop();
	  push(x-y);
	}
      else if(O[0] == '*')
	{
	  x = pop();
	  y = pop();
	  push(x*y);
	}
      else
	{
	  push(atoi(O));
	}
    }

  printf("%d\n",pop());

  return 0;
}
    



Measured memory_bytes: 2748
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)


// ------------debug用------------
#define FALSE cout<<"false"<<endl;
#define TRUE cout<<"true"<<endl;
// ------------debug用------------


// ------------計算用------------
#define ALL(x) (x).begin(),(x).end()
#define FOR(x) for(ll i = 0;i < x;++i)
// ------------計算用------------


// ------------出力用------------
#define PRINT(x) cout<<x<<endl;
// ------------出力用------------


using namespace std;
typedef long long ll;

int main(){
  int N,L;
  cin>>N>>L;
  vector<pair<int,int>> apples(N);
  
  for(int i = 0;i < N;i++){
    apples[i].second = L + i;
    apples[i].first = abs(apples[i].second);
  }
  
  sort(ALL(apples));
  
  int tmp = apples[0].second;
  
  int ans = 0;
  for(int i = 0;i < N;i++)ans += apples[i].second;
  ans -= tmp;
  cout<<ans;
  return 0;
}


Measured memory_bytes: 256
import itertools


n, m = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0

for pattern in itertools.product(range(2), repeat=n):
    power = [0]*m
    for i in range(len(pattern)):
        if pattern[i] == 1:
            for j in range(len(info)):
                if i + 1 in info[j][1:]:
                    power[j] += 1
    for i in range(m):
        if power[i] % 2 != p[i]:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 3064
# 全操作終了後に裏になるカードは、以下のような配置にあるカードのみ
# 1. 上下左右斜めを他のカードに囲まれているカード
# 2. 上下 or 左右 のみ他のカードに囲まれているカード
# 1が成り立つのは、行・列数ともに3以上の場合で、2が成り立つのは行・列数のどちらかが1で、もう一方が3以上の場合
# それぞれ、裏になっているカードの数は
# 1. → (M-2) * (N-2)
# 2. → 1 * (N-2) （N>=3 の場合）

M, N = map(int, input().split())

m = M - 2
if m < 0:
    m = 1
n = N - 2
if n < 0:
    n = 1

print(m * n)


Measured memory_bytes: 3316
# from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import numpy as np
import statistics
import string
import sys
from array import array
from collections import deque
from functools import wraps
import time

def intinput():
    return int(input())
def listintinput():
    return list(map(int, input().split()))
def splitintinput():
    return map(int, input().split())
def factorialsurplus(x, y, z):  # xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y + 1):
        ret = (ret * i) % z
    return (ret)
def isprime(x):
    if x == 1:
        return False
    if x == 2:
        return True
    sq = int(math.sqrt(x))
    for i in range(2,sq+1):
        if x % i == 0:
            return False
    return True
def hcfnaive(a,b):#最大公約数 math.gcdが使えない時の手段として入れとく。pythonが更新されたらいらなくなるはず
    if(b==0):
        return a
    else:
        return hcfnaive(b,a%b)

N,Y = splitintinput()

time_sta = time.perf_counter()

for i in range(N+1):
    if 10000 * i > Y:
        break
    for j in range(N - i + 1):
        if 10000 * i + 5000 * j + 1000 * (N- i - j) == Y:
            print(i,j,N-i-j)
            exit()

print('-1 -1 -1')


time_end = time.perf_counter()

#print(time_end - time_sta)


Measured memory_bytes: 13560
#include <math.h>
#include <assert.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <array>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
//const int N = 3e5+7 ;
//const int INF = 1e18 ;
//const int MOD = 1e9 + 7 ;


void solve(){
	int n ;
	cin >> n ;
	vi a(n) ;
	for(auto& x : a) cin >> x ;
	int x = 0 ;
	for(int i = 0 ; i < n ; i++){
		x ^= a[i] ;
	}
	vi ans(n) ;
	for(int i = 0 ; i < n ; i++){
		ans[i] = x^a[i] ;
	}
	for(auto x : ans) cout << x << " " ;
	cout << endl ;
	
}

int32_t main(){
	FAST_IO ;
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}
}


Measured memory_bytes: 6364
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define MX              200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
void codeforces()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
int32_t main()
{
    
    // w(t)
    {
        int n;
        cin>>n;
        if(n%1000 == 0) cout<<0;
        else cout<<1000 - (n%1000);
    }
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
 
int mean_temp(int T, int x) {
    int temp_1000x = (T * 1000) - (x * 6);
    return temp_1000x;
}
 
int abs_diff(int A, int H) {
    if (A > H) 
        return A - H;
    else
        return H - A;
}
 
int main() {
    int N, T, A, temp;
    
    std::cin >> N >> T >> A;
    int temp_ans = 0;
    int record = 1000000;
    int ans = -1;
    for (auto i=0; i<N; ++i) {
        std::cin >> temp;
        temp_ans = abs_diff(A * 1000, mean_temp(T,temp));
        if (temp_ans < record) {
            ans = i+1;
            record = temp_ans;
        }
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <cstddef>
#include <complex>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>

using ll = long long;
using ull = unsigned long long;

using namespace std;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }

template <class T>
constexpr bool in(T min, T max, T t)
{
    return t >= min && t <= max;
}

template <class T>
constexpr bool nin(T min, T max, T t)
{
    return !in(min, max, t);
}

template <class T>
void ninDebug(T min, T max, T t)
{
    using namespace std;
    if (nin(min, max, t))
    {
        cout << "ERROR" << endl;
    }
}


int main()
{
    string s;
    cin >> s;

    if (s == "ABC")
        cout << "ARC" << endl;
    else
        cout << "ABC" << endl;

    return 0;
}

Measured memory_bytes: 3572
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,a,b;
  cin>>n>>a>>b;
  cout<<min(a,b)<<' ';
  cout<<(0<=(a+b)-n ? (a+b)-n : 0)<<'\n';
  return(0);
}


Measured memory_bytes: 256
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> N;
  invec<ll> A(N);
  
  ll r = 1;
  bst::sort(A);
  
  for (auto i : A) {
    if (i == 0)
      return 0LL;
    if (r > 1000000000000000000LL / i)
      return -1LL;
    r *= i;
  }
    


  return r;
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}




Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[4010][4010], n;
ll nthblueat[4010], nthredat[4010], numblue, numred;
char inp[4010];
int main()
{
	scanf(" %s", inp);
	n = strlen(inp);
	for (int i = 0; i < n; i++)
	{
		if (inp[i] == '0')
		{
			nthredat[numred++] = i;
			nthredat[numred++] = i;
		}
		else if (inp[i] == '1')
		{
			nthredat[numred++] = i;
			nthblueat[numblue++] = i;
		}
		else
		{
			nthblueat[numblue++] = i;
			nthblueat[numblue++] = i;
		}
	}
	dp[0][0]++;
	for (int i = 0; i <= numblue; i++)
	{
		for (int j = 0; j <= numred; j++)
		{
		//	printf("%d %d - %lld\n", i, j, dp[i][j]);
			dp[i][j] %= 998244353;
			if (i < numblue && nthblueat[i] <= i+j)
			{
				dp[i+1][j] += dp[i][j];
			}
			if (j < numred && nthredat[j] <= i+j)
			{
				dp[i][j+1] += dp[i][j];
			}
		}
	}
	printf("%lld\n", dp[numblue][numred]);
}

Measured memory_bytes: 123520
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

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

using namespace std;

int main(){
    int N;
    int count = 0;
    cin >> N;
    REP(i, N) {
        int digit_num = log10((double)i) + 1;
        if (digit_num % 2)  count++;
    }
    
    cout << count << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;


int main(){

    int N,count=0;

    cin>>N;
    int arr1[N],arr2[N];

    for(int i=0; i<N; i++){
        cin>>arr1[i];
        arr2[i] = arr1[i];

    }

    sort(arr2,arr2+N);

    for(int i=0; i<N; i++){
        if(arr1[i] != arr2[i]){
            count++;
        }

    }

    if(count <= 2 ){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }


}


Measured memory_bytes: 256
import Foundation

func main() {
 let inputString = readLine()!
 let split: [Int] = inputString.components(separatedBy: " ").map{Int(String($0))!}
 let a = split[0]
 var b = split[1]
 var c = split[2]
 let k = Int(readLine()!)!
 
 for _ in 1...k+1 {
     if (a < b && b < c) {
         print("Yes")
         return
     } else if(a < b) {
         c = c * 2
     } else {
         b = b * 2
     }
 }
 print("No")
}

main()

Measured memory_bytes: 14068
X=int(input())
if(X>=400 and X<=599):
    print('8')
elif(X>=600 and X<=799):
    print('7')
elif(X>=800 and X<=999):
     print('6')
elif(X>=1000 and X<=1199):
    print('5')
elif(X>=1200 and X<=1399):
    print('4')
elif(X>=1400 and X<=1599):
    print('3')
elif(X>=1600 and X<=1799):
    print('2')
elif(X>=1800 and X<=1999):
    print('1')

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    string s;
    cin>>s;
    int y=0,m=0,d=0;
    rep(i,4)y=y*10+(s[i]-'0');
    rep(i,2)m=m*10+(s[i+5]-'0');
    rep(i,2)d=d*10+(s[i+8]-'0');
    bool ok=true;
    if(y>2019)ok=false;
    if(y==2019&&m>4)ok=false;
    if(y==2019&&m==4&&d>30)ok=false;
    if(ok)cout<<"Heisei"<<endl;
    else cout<<"TBD"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int Ai,Bi,Ci=0;
char A[100],B[100],C[100],winner;

void turnA(),turnB(),turnC();

void turnA(){
  if(A[Ai]=='a'){
    Ai++;
    turnA();
  }
  else if(A[Ai]=='b'){
    Ai++;
    turnB();
  }
  else if(A[Ai]=='c'){
    Ai++;
    turnC();
  }
  else {
    winner='A';
    return;
  }
}

void turnB(){
  if(B[Bi]=='a'){
    Bi++;
    turnA();
  }
  else if(B[Bi]=='b'){
    Bi++;
    turnB();
  }
  else if(B[Bi]=='c'){
    Bi++;
    turnC();
  }
  else {
    winner='B';
    return;
  }
}

void turnC(){
  if(C[Ci]=='a'){
    Ci++;
    turnA();
  }
  else if(C[Ci]=='b'){
    Ci++;
    turnB();
  }
  else if(C[Ci]=='c'){
    Ci++;
    turnC();
  }
  else {
    winner='C';
    return;
  }
}

int main(){
  scanf("%s%s%s",A,B,C);
  turnA();
  printf("%c\n",winner);
}


Measured memory_bytes: 128
<?php
list($n, $k) = ints();
$s = str();
$p = $n;
while($p > 0){
    for($i = max(0,$p - $k); $i < $p; $i++){
        if($s[$i] == '0'){
            $ans[] = $p-$i;
            $p = $i;
            continue 2;
        }
    }
    if($i == $p){
        echo -1;
        exit;
    }
}
echo implode(" ", array_reverse($ans));

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}


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

int main(void){
  string s;
  int i;
  char alphabet[26] = {};
  cin >> s;
  for(i = 0; i < (int)s.size(); i++){
    if(alphabet[s[i]-'a'] == 1){
      cout << "no" << endl;
      return 0;
    }
    alphabet[s[i]-'a']++;
  }
  cout << "yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define all(n) (n).begin(),(n).end()
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}
	
int main(){
	int h,w,k,iti[310];
	int ans[310][310];
	FOR(i,310)FOR(j,310)ans[i][j]=0;
	int cnt=0;
	FOR(i,310)iti[310]=0;
	cin >> h >> w >> k;
	string s[310];
	FOR(i,h){
		cin >> s[i];
		FOR(j,s[i].size()){
			if(s[i][j]=='#')iti[i]++;
		}
	}
	bool a=0;
	FOR(i,h){
		if(iti[i]==0){
			if(i==0 || ans[i-1][0]==0){
				a=1;
			}else{
				FOR(j,w){
					ans[i][j]=ans[i-1][j];
				}
			}
		}else{
			cnt++;
			int vv=0;
			FOR(j,w){

				if(s[i][j]=='#'){
					if(vv!=0){
						cnt++;			
					}
					vv++;
				}
				ans[i][j]=cnt;
			}
			if(a){
				for(int j=i-1;j>=0;j--){
					FOR(k,w){
						ans[j][k]=ans[j+1][k];
					}
				}
				a=0;
			}
		}

	}

	FOR(i,h){
		FOR(j,w){
			cout << ans[i][j];
			if(j!=w-1)cout << " ";
		}
		cout << endl;
	}

}

Measured memory_bytes: 1280
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
typedef pair<int,int> pint;
typedef vector<int> vint;
int INF=2e+9+1;
int main(){
	int N,M;
	scan(N);scan(M);
	if(N<2||M<2){
		if(max(N,M)==1) prin(1);
		else prin(max(N,M)-2);
	}
	else prin(((ll)N-2)*((ll)M-2));
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int w = sc.nextInt();
        char[][] hw = new char[n][w];
        for (int i = 0; i < n; i++) {
            hw[i] = sc.next().toCharArray();

        }
        int[] dx = {1,0,-1,0,1,-1,-1,1};
        int[] dy = {0,1,0,-1,1,1,-1,-1};

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < w; j++) {
                if (hw[i][j] == '#') continue;
                int num = 0;
                for(int k = 0; k < 8 ; k++) {

                    int ni = i + dx[k];
                    int nj = j + dy[k];
                    if (ni < 0 || n <= ni) continue;
                    if (nj < 0 || w <= nj) continue;
                    if(hw[ni][nj] == '#') num++;
                }

                hw[i][j] = (char)(num + '0');

            }

        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < w; j++) {
                System.out.print(hw[i][j]);
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
	int n;int k;cin>>n>>k;
    vector<int>h(n);
    for(int i=0;i<n;i++) cin>>h[i];
    sort(h.begin(),h.end());
    cout<<n-(lower_bound(h.begin(),h.end(),k)-h.begin());
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);	 
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


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

//&Start
#define lng long long
#define lit long double
#define kk(i,n) "\n "[i<n]
const int inf=0x3f3f3f3f;
const lng Inf=1e17;

//&Data
const int N=1e5+10;
int n,l,t,rk;
struct Ant{
	int x,d;
	friend bool operator<(Ant a,Ant b){return a.x<b.x;}
}ant[N];

//&Main
int main(){
	scanf("%d%d%d",&n,&l,&t);
	for(int i=1;i<=n;i++) scanf("%d%d",&ant[i].x,&ant[i].d);
	for(int i=1;i<=n;i++){
		ant[i].x+=(ant[i].d==1)?t:-t;
		rk+=ant[i].x/l+(ant[i].x%l<0?-1:0);
		((ant[i].x%=l)+=l)%=l;
	}
	sort(ant+1,ant+n+1);
	((rk%=n)+=n)%=n;
	for(int i=rk+1;i<=n;i++) printf("%d\n",ant[i].x);
	for(int i=1;i<=rk;i++) printf("%d\n",ant[i].x);
	return 0;
}

Measured memory_bytes: 1920
#include<stdio.h>

int n;
int data[4][14];//S,H,C,D
char str[10]="SHCD";

void proc(){
  for(int i=0;i<4;i++){
    char c=str[i];
    for(int j=1;j<=13;j++){
      if(!data[i][j])
        printf("%c %d\n",c,j);
    }
  }
}

void inp(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    char tmp[10];int x;
    scanf("%s%d",tmp,&x);
    for(int j=0;j<4;j++){
      if(str[j]==tmp[0]){
        data[j][x]=1;
        break;
      }
    }
  }
}

int main(){
  inp();
  proc();
  return 0;
}

Measured memory_bytes: 1012
from sys import stdin

A, B, M = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
b = [int(x) for x in stdin.readline().rstrip().split()]
X = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]

L = []
L.append(min(a) + min(b))

for x in X:
    L.append(a[x[0]-1] + b[x[1]-1] - x[2])
    
    
print(min(L))


Measured memory_bytes: 36468
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    assert_eq!(!0usize, std::usize::MAX); //🙊
    let (k, s) = (io.read::<i64>(), io.read::<i64>());

    let mut ans = 0;
    for x in 0..k + 1 {
        for y in 0..k + 1 {
            if x + y > s {
                continue;
            } else {
                let z = s - x - y;
                if z <= k {
                    ans += 1;
                }
            }
        }
    }
    io.writeln(ans);
}

static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 4352
<?php
$x = trim(fgets(STDIN));
$q = (int)($x / 11);
$r = $x % 11;

if ($r == 0) {
    $t = 2 * $q;
} else {
    $t = ($r <= 6) ? 2 * $q + 1 : 2 * $q + 2;
}

echo "$t\n";

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

int main()
{
	int A, B;
	cin >> A >> B;
	
	if (A + B == 3)
	{
		cout << 3 << endl;
	}
	else if (A + B == 4)
	{
		cout << 2 << endl;
	}
	else
	{
		cout << 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;
//半手動
int main(){
    int n, m;
    while(cin >> n >> m, n){
        int ans = 0;
        if(n >= 1){
            for(int i = 0; i < 10; i++){
                if(n == 1)
                    if(i == m)
                        ans++;
        if(n >= 2){
            for(int j = i + 1; j < 10; j++){
                if(n == 2)
                    if(i + j == m)
                        ans++;
        if(n >= 3){
            for(int k = j + 1; k < 10; k++){
                if(n == 3)
                    if(i + j + k == m)
                        ans++;
        if(n >= 4){
            for(int l = k + 1; l < 10; l++){
                if(n == 4)
                    if(i + j + k + l== m)
                        ans++;
        if(n >= 5){
            for(int o = l + 1; o < 10; o++){
                if(n == 5)
                    if(i + j + k + l + o == m)
                        ans++;
        if(n >= 6){
            for(int p = o + 1; p < 10; p++){
                if(n == 6)
                    if(i + j + k + l + o + p == m)
                        ans++;
        if(n >= 7){
            for(int q = p + 1; q < 10; q++){
                if(n == 7)
                    if(i + j + k + l + o + p + q== m)
                        ans++;
        if(n >= 8){
            for(int r = q + 1; r < 10; r++){
                if(n == 8)
                    if(i + j + k + l + o + p + q + r == m)
                        ans++;
        if(n >= 9){
            for(int s = r + 1; s < 10; s++){
                if(n == 9)
                    if(i + j + k + l + o + p + q + r + s == m)
                        ans++;
        }}}}}}}}}}}}}}}}}}
        cout << ans << endl;
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 100000000000000000
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int, ll> P;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

int n, m;
ll x;
vector<P> edge[100000];
ll h[100000];
ll cost[100000];

void dijkstra(){
	rep(i,100000) cost[i] = INF;
	cost[0] = 0;
	PQ que;
	que.push(P(0,0));
	while(true){
		if(que.size() == 0) break;
		P p = que.top(); que.pop();
		if(p.sc > cost[p.fi]) continue;
		ll hei = max(x-cost[p.fi],0LL);
		rep(i,edge[p.fi].size()){
			P e = edge[p.fi][i];
			ll add = 0;
			if(hei - e.sc > h[e.fi]) add += hei-e.sc-h[e.fi];
			if(hei - e.sc < 0) add += e.sc-hei;
			if(cost[e.fi] > cost[p.fi]+e.sc+add){
				cost[e.fi] = cost[p.fi]+e.sc+add;
				que.push(P(e.fi,cost[e.fi]));
			}
		}
	}
}

int main(){
	scanf("%d%d%lld",&n,&m,&x);
	rep(i,n) scanf("%lld",h+i);
	rep(i,m){
		int a, b;
		ll t;
		scanf("%d%d%lld",&a,&b,&t);
		a--; b--;
		if(h[a] >= t) edge[a].push_back(P(b,t));
		if(h[b] >= t) edge[b].push_back(P(a,t));
	}
	dijkstra();
	if(cost[n-1] == INF){
		printf("-1\n");
	} else{
		ll y = 0;
		if(cost[n-1] < x) y = x-cost[n-1];
		printf("%lld\n", cost[n-1]+h[n-1]-y);
	}
}

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

using namespace std;

int main ()
{
    int a, b, c, d;

    scanf("%d %d %d %d", &a, &b, &c, &d);
    while (a > 0 || c > 0) {
        c = c - b;
        a = a - d;
        if (c <= 0) {
            puts("Yes");
            break;
        }
        else if (a <= 0){
            puts("No");
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define ill long long
#define fcout cout << fixed << setprecision(10)
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  int s1 = s.size(), t1 = t.size();
  if(s1 + 1 == t1) {
    rep(i, 0, s1) {
      if(s[i] != t[i]) {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes";
}

Measured memory_bytes: 3596
N, K = map( int, input().split())
H = [ int( input()) for _ in range(N)]
H.sort()
ans = 10**9
for i in range(N-K+1):
    if H[i+K-1] - H[i] < ans:
        ans = H[i+K-1] - H[i]
print(ans)


Measured memory_bytes: 7384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 nn, hh, maxa = 0, ans = 0;
	cin >> nn >> hh;
	vector<int64> aa(nn), bb(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> aa[ii] >> bb[ii];
		maxa = max(maxa, aa[ii]);
	}
	sort(bb.begin(), bb.end());
	for(int64 ii = nn - 1;ii >= 0;ii--)
	{
		if(bb[ii] < maxa)
		{
			break;
		}
		hh -= bb[ii];
		ans++;
		if(hh <= 0)
		{
			cout << ans << endl;
			return 0;
		}
	}
	ans += hh / maxa;
	if(hh % maxa != 0)
	{
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4820
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=0;
	string a,b,c;
	cin>>n>>a>>b>>c;
	for(int i=0;i<n;i++)
		ans+=(a[i]==b[i]&&b[i]==c[i])+(a[i]==b[i]||b[i]==c[i]||c[i]==a[i]);
	cout<<2*n-ans<<endl;
}


Measured memory_bytes: 256
local mfl = math.floor

local function comp(a, b)
  return a < b
end

local function lower_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if not comp(ary[1], x) then return 1 end
  if comp(ary[num], x) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if comp(ary[mid], x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local function upper_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if comp(x, ary[1]) then return 1 end
  if not comp(x, ary[num]) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if not comp(x, ary[mid]) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local n = io.read("*n")
local t = {}
for i = 1, n do
  t[i] = io.read("*n")
end

local edge = {}
local asked = {}
local cpos = {}
local len = {}
local stpos = {}
for i = 1, n do
  edge[i] = {}
  asked[i] = false
  cpos[i] = 0
  len[i] = 0
  stpos[i] = 0
end
len[n + 1] = 1000000007
for i = 1, n - 1 do
  local x, y = io.read("*n", "*n")
  table.insert(edge[x], y)
  table.insert(edge[y], x)
end

local lis = {}
for i = 1, n + 1 do
  lis[i] = 1000000007
end
local ret = {}
for i = 1, n do ret[i] = 1 end
local tasks = {1}
local undotask = {}
local sti = 1
while 0 < #tasks do
  local src = tasks[#tasks]
  table.remove(tasks)
  -- print(src)
  if src == -1 then
    local ubpos, v, z = undotask[#undotask][1], undotask[#undotask][2], undotask[#undotask][3]
    table.remove(undotask)
    lis[ubpos] = v
    -- print("UNDO", z, ubpos, v)
  else
    if not asked[src] then
      asked[src] = true
      local ubpos = lower_bound(lis, t[src])
      table.insert(undotask, {ubpos, lis[ubpos], src})
      -- print("ADD", src, ubpos, lis[ubpos])
      lis[ubpos] = t[src]
      local r = lower_bound(lis, 1000000007) - 1
      ret[src] = r
    end
    -- print(src, len[src])
    stpos[src] = sti
    sti = sti + 1
    while cpos[src] < #edge[src] do
      cpos[src] = cpos[src] + 1
      local dst = edge[src][cpos[src]]
      if not asked[dst] then
        len[dst] = len[src] + 1
        table.insert(tasks, src)
        table.insert(tasks, -1)
        table.insert(tasks, dst)
        break
      end
    end
  end
end
print(table.concat(ret, "\n"))


Measured memory_bytes: 54724
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009

void solve()
{
	ll n,m;
	rl2(n,m);
	priority_queue<ll> q;
	fr(i,0,n)
	{
		ll x;
		rl(x);
		q.push(x);
	}
	while(m--)
	{
		ll x=q.top();
		q.pop();
		x=floor((double)x/2);
		q.push(x);
	}
	ll sum=0;
	while(!q.empty())
	{
		sum+=q.top();
		q.pop();
	}
	wl(sum);
	NL;
}
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	solve();
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define ll long long
#define f   first
#define s   second
#define pb          push_back
#define mod         1000000007
#define hell        998244353
#define inf         1000000000000000000LL
using namespace std;
ll n,k,m;
//ll dp[15][1005];
ll dp[100005];
ll lvl[100005];
ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2){res=(res*x)%mod;}
        x=(x*x)%mod;
        y/=2;
    }
    return res;
}
ll invmod(ll x)
{ return power(x,mod-2);}
void solve()
{   ll W,X,D,Y,A,B,C;
    cin>>X>>Y>>A>>B>>C;
    vector<ll> p(A),q(B),r(C);
    for(int i=0;i<A;i++) cin>>p[i];
    for(int i=0;i<B;i++) cin>>q[i];
    for(int i=0;i<C;i++) cin>>r[i];
    sort(p.begin(),p.end(),greater<ll>());
    sort(q.begin(),q.end(),greater<ll>());
    sort(r.begin(),r.end(),greater<ll>());
    priority_queue<ll,vector<ll>,greater<ll>> pq;
    for(int i=0;i<X;i++) pq.push(p[i]);
    for(int i=0;i<Y;i++) pq.push(q[i]);
    for(int i=0;i<C;i++)
    {
        ll x=pq.top();
        if(r[i]>x)
        {
            pq.pop();pq.push(r[i]);
        }
        else break;
    }
    ll ans=0;
    while(!pq.empty())
    {
        ans+=pq.top();
        pq.pop();
    }
    cout<<ans;

    
    


    
   

    
}

int main()
{
    ll t=1;
    //cin>>t;
    
    while(t--)
        solve();

}

Measured memory_bytes: 4724
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

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

  std::vector<int> x(100001);
  for (size_t i = 0; i < N; ++i) {
    int a;
    scanf("%d", &a);
    if (a > 0) ++x[a-1];
    ++x[a];
    ++x[a+1];
  }

  printf("%d\n", *std::max_element(x.begin(), x.end()));
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int main() {
	string a[50], b[50];
	int n,m,cnt = 0;

	cin >> n >> m;
	rep (i,n) {
		cin >> a[i];
	}
	rep (i,m) {
		cin >> b[i];
	}

	rep (i,n-m+1) {
		rep (j,n-m+1) {
			if (a[i][j] == b[0][0]) {
				cnt = 0;
				rep(k,m){
					rep(l,m) {
						if (a[i + l][j + k] == b[l][k])
							cnt++;
					}
				}
				if (cnt == m * m) {
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
	}

	cout << "No" << endl;
}


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

int main(void)
{
    string a,b;
    //int a,b,c,d;
    //char a,b,c;
    int i=0,sum=700;
    //char a,b='.';
    cin>>a;
    for(i=0;i<3;i++)
        if(a[i]=='o')
            sum+=100;
    cout<<sum;
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<queue>

using namespace std;


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

#ifdef __BORLANDC__
	typedef __int64 ll;
#else
	typedef long long ll;
#endif


const int INF = 1000000000;
const ll L1 = 1;
const int N = 40;
int M = 20;

int n;
ll edge[N];
int power[N];

void printbit(ll state){
	rep(i,n)printf("%d",((L1<<i)&state)>0);puts("");
}

void printedge(){
	printf("edge\n");
	rep(i,n)printbit(edge[i]);
}

bool init(){
	cin>>n;
	if(n==0)return false;
	
	rep(i,N)edge[i]=power[i]=0;
	
	map<string,int> mp;
	vector<string> estr[N];
	rep(i,n){
		string a;
		int b,c;
		cin>>a>>b>>c;
		mp[a]=i;
		power[i]=b;
		rep(j,c){
			string d;
			cin>>d;
			estr[i].push_back(d);
		}
	}
	rep(i,n){
		rep(j,estr[i].size()){
			edge[i] |= (L1<<mp[estr[i][j]]);
		}
	}
	return true;
}

bool hasbit(ll state, int bit){return state&(L1<<bit);}

int T = (1<<M);
const int TM = (1<<20);
int half[TM];

int left_search(){
	rep(i,T)half[i]=0;
	
	int maxi = 0;
	for(int i=1;i<T;i+=2){
		bool ok = true;
		int sum = 0;
		rep(j,M){
			if(hasbit(i,j)){
				 if(edge[j]&i)ok=false;
				 sum += power[j];
			}
			if(!ok)break;
		}
		
		if(ok)half[i]=sum;
		maxi = max(maxi,half[i]);
	}
	return maxi;
}

int memo[TM];
int left_memo(int state){
	if(memo[state]!=-1)return memo[state];
	
	int ret = half[state];
	if(ret==0)ret = -INF;
	rep(i,M){
		if(state&(1<<i)){
			ret = max(ret, left_memo(state ^ (1<<i)));
		}
	}
	return memo[state]=ret;
}

int right_search(){
	int ans = 0;
	for(ll i=0; i<(L1<<n); i+=T){
		bool ok = true;
		int sum = 0;
		ll mask = 0;
		reps(j,M,n){
			if(hasbit(i,j)){
				if(edge[j]&i)ok=false;
				sum+=power[j];
				mask |= edge[j];
			}
			if(!ok)break;
		}
		
		if(ok){
			mask &= (T-1);
			mask ^= (T-1);
			//printf("i=%d sum=%d memo[bit]=%d ",i,sum,memo[mask]);
			//printbit(mask);
			ans = max(ans, memo[mask]+sum);
		}
	}
	return ans;
}
void left_dp(){
	rep(i,T)memo[i]=-1;
	
	left_memo(T-1);
}

void printdp(){
	rep(i,T){
		printf("%3d ",memo[i]);printbit(i);
	}
}
void printsearch(){
	rep(i,T){
		printf("%3d ",half[i]);printbit(i);
	}
}
int solve(){
	M = (n+1)/2;
	T = (1<<M);
	
	int a = left_search();
	left_dp();
	
	/*
	puts("s");
	printsearch();
	puts("d");
	printdp();
	*/
	return max(a,right_search());
}

int main(){
	while(init()){
		printf("%d\n",solve());
	}
}

/*
6
INTERCAL 10 3 Chef Piet COW
Chef 7 3 INTERCAL Piet COW
Piet 6 2 INTERCAL Chef
COW 7 2 INTERCAL Chef
J 6 1 A
A 12 1 J
0

6
INTERCAL 20 1 J
Chef 50 3 J A Piet
Piet 30 2 A Chef
COW 15 1 J
J 40 3 COW INTERCAL Chef
A 25 2 Chef Piet
0

*/

Measured memory_bytes: 9540
#include<bits/stdc++.h>
using namespace std;
int N,M;
string s;
map< vector<string> , bool > isD,isF;

vector<string> change(string s,bool flg=true){
  
  for(int i=0;i<(int)s.size();i++)
    if(s[i]=='/')s[i]=' ';
  
  vector<string> res;
  stringstream ss(s);
  string tmp;
  while(ss>>tmp){
    if(flg)isD[res]=true;
    res.push_back(tmp);
  }
  return res;
}

vector<string> solve(string s){
  vector<string> res,vec;
  vector<string> err(10,"?");
  
  vec=change(s,false);

  for(int i=0;i<(int)vec.size();i++){
    if(vec[i]=="."){
      if(!isD[res])return err;
      continue;
    }else if(vec[i]==".."){
      if(!isD[res])return err;
      if(res.empty())return err;
      res.pop_back();
    }else{
      res.push_back(vec[i]);
      if(!isF[res]&&!isD[res])return err;
    }
  }
  if(isD[res])res.push_back("index.html");
  else if(isF[res]&&s[s.size()-1]=='/')return err;
  return res;
}

void init(){
  isD.clear();
  isF.clear();
}

void printv(vector<string> A){
  for(int i=0;i<(int)A.size();i++)
    cout<<A[i]<<' ';
  cout<<endl;
}

int main(){
  while(1){
    cin>>N>>M;
    if(N==0&&M==0)break;
    init();
    for(int i=0;i<N;i++){
      cin>>s;s="root"+s;
      vector<string> A=change(s);
      isF[A]=true;
    }

    
    for(int i=0;i<M;i++){
      cin>>s;s="root"+s;
      vector<string> A=solve(s);
      cin>>s;s="root"+s;
      vector<string> B=solve(s);
      //cout<<endl;
      //printv(A);
      //printv(B);
      if(!isF[A]){
	cout<<"not found"<<endl;
      }else if(!isF[B]){
	cout<<"not found"<<endl;
      }else if(A==B){
	cout<<"yes"<<endl;
      }else{
	cout<<"no"<<endl;
      }
    }
    
  }
  return 0;
}

Measured memory_bytes: 1296
#include <stdio.h>
#include <stdbool.h>
#include <string.h>

int main(void)
{
    int n, b, f, r, v, i, j, k;
    int list[4][3][10] = {0};

    scanf("%d", &n);

    for (i = 0; i < n; ++i)
    {
        getchar();
        scanf("%d%d%d%d", &b, &f, &r, &v);
        list[b-1][f-1][r-1] += v;
    }

    for (i = 0; i < 4; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            for (int k = 0; k < 10; ++k)
            {
                printf("%2d", list[i][j][k]);
            }
            printf("\n");
        }
        if (i < 3)
        {
            printf("####################\n");
        }
    }
    return 0;
}

Measured memory_bytes: 2660