akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

//Mayan Crucial Prediction
public class Main{

	int[] day = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int MOD = 13*20*20*18*20;
	int B = 20*20*18*20;
	int KA = 20*18*20;
	int T = 18*20;
	int W = 20;
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			String in = sc.next();
			if("#".equals(in))break;
			String[] t = in.split("\\.");
			int n = t.length;
			int[] a = new int[n];
			for(int i=0;i<n;i++)a[i]=Integer.parseInt(t[i]);
			if(n==5)toSeireki(a[0], a[1], a[2], a[3], a[4]);
			else toMayan(a[0], a[1], a[2]);
		}
	}
	
	void toSeireki(int b, int ka, int t, int w, int ki){
		int days = b*B + ka*KA + t*T + w*W + ki;
		int y = 2012, m = 12, d = 21;
		while(0 < days){
			if(m==1 && d==1){
				int yearDay = 365 + leap(y);
				if(yearDay <= days){
					y++;
					days-=yearDay;
					continue;
				}
			}
			if(m==2){
				if(d==day[2]+leap(y)){
					m++; d=1;
				}
				else d++;
			}
			else{
				if(d==day[m]){
					m++; d=1;
					if(m==13){
						y++; m=1;
					}
				}
				else d++;
			}
			days--;
		}
		System.out.printf("%d.%d.%d\n", y, m, d);
	}

	int leap(int y){
		return y%4==0 && (y%100!=0 || y%400==0) ? 1 : 0;
	}
	
	void toMayan(int y, int m, int d){
		int Y = 2012, M = 12, D = 21;
		int days = 0;
		while(Y!=y || M!=m || D!=d){
			if(MOD <= days)days-=MOD;
			if(M==1 && D==1){
				if(Y!=y){
					int year = 365+leap(Y);
					days+=year;
					Y++;
					continue;
				}
			}
			if(M==2){
				if(D==day[2]+leap(Y)){
					M++; D=1;
				}
				else D++;
			}
			else{
				if(D==day[M]){
					M++; D=1;
					if(M==13){
						Y++; M=1;
					}
				}
				else D++;
			}
			days++;
		}
		if(MOD <= days)days-=MOD;
		int b = days/B; days%=B;
		int ka = days/KA; days%=KA;
		int t = days/T; days%=T;
		int w = days/W; days%=W;
		int ki = days;
		System.out.printf("%d.%d.%d.%d.%d\n", b, ka, t, w, ki);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 29240
while true
  line = gets
  break if line == nil
  a, b, c, d, e, f = line.split.map { |x| x.to_f }
  x = ( c*e - b*f ) / ( a*e - b*d )
  y = ( a*f - d*c ) / ( a*e - b*d )
  x = 0.0 if x.zero?
  y = 0.0 if y.zero?
  puts sprintf("%.3f %.3f", x, y)
end

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

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

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);

bool check(ll m, vector<ll> &h, ll a, ll b){

  ll cnt=0;
  REP(i,h.size()){
    if(h[i]>b*m){
      cnt += (h[i] - b*m + a - b - 1)/(a-b);
    }
  }
  return cnt <= m;
}

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  vector<ll> h(N);

  REP(i,N)cin >> h[i];

  ll l=0; 
  ll r=(ll)1e9;

  while(l<r){
    ll m = (l+r)/2;
//    cout << l << " " << r << " " << m << endl;
    if(check(m,h,A,B)){
      r=m;
    }else{
      l=m+1;
    }
  }

  cout << l << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

int main(void){
  int N,W;cin >> N >> W;
  PIL v[N];
  REP(i,N) cin >> v[i].first >> v[i].second;
  ll dp[2][W+1];
  //next[j]:重さj以下となる最大価値
  ll *prev = dp[0];
  ll *next = dp[1];
  REP(j,W+1) prev[j] = 0;
  REP(i,N){
    REP(j,W+1){
      next[j] = prev[j];
      if(j-v[i].first >= 0) next[j] = max(next[j],prev[j-v[i].first] + v[i].second);
      //cout << i << " " << j << " " << " " << v[i].first << " " <<  next[j] << endl;
    }
    swap(prev,next);
  }
  swap(prev,next);
  cout << next[W] << endl;
  return 0;
}


Measured memory_bytes: 1792
"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const N = parseInt(arg[0]);
    const a = arg[1].split(" ").map(n=>parseInt(n));
    let free = 0;
    
    const map = {
        grey:   false,
        brown:  false,
        green:  false,
        mizu:   false,
        blue:   false,
        yellow: false,
        orange: false,
        red:    false
    }
    
    for(let i in a) {
        if(a[i] < 400) {
            map.grey = true;
        } else if(a[i] < 800) {
            map.brown = true;
        } else if(a[i] < 1200) {
            map.green = true;
        } else if(a[i] < 1600) {
            map.mizu = true;
        } else if(a[i] < 2000) {
            map.blue = true;
        } else if(a[i] < 2400) {
            map.yellow = true;
        } else if(a[i] < 2800) {
            map.orange = true;
        } else if(a[i] < 3200) {
            map.red = true;
        } else {
            free++;
        }
    }
    
    const existColorsNum = Object.keys(map).filter(key=>map[key] === true).length;
    
    const min = existColorsNum === 0 ? 1 : existColorsNum;
    const max = existColorsNum + free;
    
    console.log(min + " " + max);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
# coding=utf-8

def fib(n):
    global fib_list
    if fib_list[n]:
        return fib_list[n]

    if n == 0:
        fib_list[0] = 1
        return 1
    elif n == 1:
        fib_list[1] = 1
        return 1
    else:
        fib_list[n] = fib(n-2) + fib(n-1)
        return fib(n-2) + fib(n-1)

n = int(input())
fib_list = [None for i in range(n+1)]
print(fib(n))

Measured memory_bytes: 7676
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
const int maxN = 4e6 + 2;
typedef pair<int, int> P;
typedef pair<int, P>PP;
struct edge {
	int to, cost;
};

int kj[maxN], kji[maxN];
int modpow(int a, int x, int mod) {
	int res = 1;
	while (x) {
		if (x & 1)res = res*a%mod;
		x >>= 1;
		a = a*a%mod;
	}
	return res;
}
void setkj(int n) {
	kj[0] = 1;
	rep(i, n)kj[i + 1] = kj[i] * (i + 1) % mod;
	rep(i, n + 1)kji[i] = modpow(kj[i], mod - 2, mod);
}
int comb(int r, int c) {
	if (c<0 || r<c)return 0;
	return kj[r] * kji[c] % mod*kji[r - c] % mod;
}
signed main() {
	int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
	setkj(r2 + c2+2);
	 int now = comb(r1 + c1, r1);int sum = 0;
	for (int I = r1 + c1; I <= min(r1+c2, r2+c1); I++) {
		sum += now;
		now *= 2;
		now += comb(I, r1 - 1) + comb(I, c1 - 1);
		now %= mod;
		sum %= mod;
	}

	if (r1 + c2 < r2 + c1) {
		now -= comb(r1+c2+1, c2 + 1);
	}
	else {
		now -= comb(r2 + c1+1, r2 + 1);
	}
	
	for (int I = min(r1 + c2, r2 + c1) + 1; I <= max(r1 + c2, r2 + c1); I++) {
		sum += now;
		sum %= mod;
		now *= 2;
		if (r1 + c2 < r2 + c1) {
			now += comb(I, c2 + 1)+comb(I,c1-1);
			now -= comb(I+1, c2 + 1);
			now = (now + mod) % mod;
		}
		else {
			now += comb(I, r2 + 1) + comb(I, r1 - 1);
			now -= comb(I+1, r2 + 1);
			now = (now + mod) % mod;
		}
	}
	if (r1 + c2 < r2 + c1) {
		now -= comb(r2 + c1+1, r2 + 1);
	}
	else {
		now -= comb(r1 + c2+1, c2 + 1);
	}

	for (int I = max(r1 + c2, r2 + c1) + 1; I <= r2 + c2; I++) {
		sum += now;
		sum %= mod;
		now *= 2;
		now += comb(I, r2 + 1) + comb(I, c2 + 1);
		now -= comb(I+1, c2 + 1);
		now -= comb(I+1, r2 + 1);
		now = (now + mod * 2) % mod;
	}
//	sum = (sum + now) % mod;
	cout << sum << endl;
}

Measured memory_bytes: 33024
from collections import deque
N,M=map(int,input().split())
to=[[] for _ in range(N)]
for _ in range(M):
  a,b=map(int,input().split())
  to[a-1].append(b-1)
  to[b-1].append(a-1)
q=deque([0])
r=[None]*N
r[0]=0
while q:
  x=q.popleft()
  for i in to[x]:
    if r[i] is None:
      q.append(i)
      r[i]=x+1
print("Yes",*r[1:],sep="\n")

Measured memory_bytes: 39004
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cstring>
#include<stdio.h>
#include<string>
#include<math.h>

using namespace std;

typedef long long ll;
typedef double db;

 ll mod = 1e9 + 7;




int main() {
	int k;
	cin >> k;
	int a[15] = {0};
	int i = 0;
	int count = 0;

	if (k <= 10) {
		cout << k;
	}
	else {
		i = 10;
		a[13] = 1;
		while (i < k) {
			count = 0;
			if (abs(a[14] + 1 - a[13]) <= 1 && a[14]!=9) {
				a[14]++;
				i++;
			}
			else {
				for (int y = 0; y < 15; y++) {
					if (a[y])break;
					count++;
				}
				for (int j = 13; j >= 0; j--) {
					if (a[j - 1] == 0 && a[j]==9) {
						a[j - 1]++;
						for (int l = j; l <= 14; l++) {
							a[l] = 0;
						}
						i++;
						break;
					}
					else if (a[j - 1] == 0 && a[j] != 9 && j == count) {
						a[j]++;
						for (int l = j + 1; l <= 14; l++) {
							a[l] = a[l - 1] - 1;
							if (a[l] < 0)a[l] = 0;
						}
						i++;
						
						break;
					}
					else if (abs(a[j] + 1 - a[j - 1]) <= 1 && a[j]!=9) {
						a[j]++;
						for (int l = j + 1; l <= 14; l++) {
							a[l] = a[l - 1] - 1;
							if (a[l] < 0)a[l] = 0;
						}
						i++;
						break;
					}
				}
			}
		}
		for (int I = 0; I <= 14; I++) {
			if (a[I]) {
				for (I; I <= 14; I++) {
					cout << a[I];
				}
				break;
			}
		}
	}
    return 0;
}

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

int main() {

    int N;
    cin >> N;

    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;

    string s;
    rep(i, N) {
        cin >> s;
        if (s == "AC") ac++;
        if (s == "WA") wa++;
        if (s == "TLE") tle++;
        if (s == "RE") re++;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

    return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
	int n,k,p,a[100],i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&k,&p);
		a[i]=k%p;
		if(a[i]==0){
			a[i]=p;
		}
	}
	for(i=0;i<n;i++){
		printf("%d\n",a[i]);
	}
	return 0;
}


Measured memory_bytes: 2076
import java.util.Scanner;
import java.util.Random;;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int Q = scan.nextInt();
        String S = scan.next();
        int A[] = new int[N+1];

        for(int i = 0; i < N-1; i++){
            if(S.charAt(i) == 'A' && S.charAt(i + 1) == 'C'){
                A[i+2] += 1;
            }
        }

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

        for(int i = 0; i < Q; i++){
            int l = scan.nextInt();
            int r = scan.nextInt();
            System.out.println(A[r]-A[l]);
        }
    }
}


Measured memory_bytes: 79300
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,i,c = 1;vector<ll> t;scanf("%lld",&n);
  ll a[n];
  for(i=0;i<n;i++) scanf("%lld",&a[i]);
  sort(a,a+n,greater<ll>());
  for(i=1;i<n;i++){
    if(a[i]==a[i-1]) c++;
    else c = 1;
    if(c==2){
      t.push_back(a[i]);c = 0;
    }
    if(t.size()==2){
      printf("%lld\n",t[0]*t[1]);return 0;
    }
  }
  printf("0\n");
}

Measured memory_bytes: 1024
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(ll i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	vi d(n+1);
	rep(i,n+1)d[i]=i;
	rep(i,n){
		int t=6;
		while(i+t<n+1){
			d[i+t]=min(d[i+t],d[i]+1);
			t*=6;
		}
		t=9;
		while(i+t<n+1){
			d[i+t]=min(d[i+t],d[i]+1);
			t*=9;
		}
	}
	cout<<d[n]<<endl;
}















Measured memory_bytes: 640
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  print(N * N * N);
}

Measured memory_bytes: 256
#!/usr/bin/env python

import sys
import re

s= sys.stdin.readline().strip()
s= s.replace("BC","D")
s= re.sub("[BC]+"," ",s).split()

t= 0
for seg in s:
    a= 0
    for c in seg:
        if c=="A": a+=1
        elif c=="D": t+= a
#
print( t )


Measured memory_bytes: 5668
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

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

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	int n = fetch<int>();
	double answ = 0.;
	int cnt = 0;

	vector<pii> pts(n);
	vector<int> ord(n, NIL);
	iota(ord.begin(), ord.end(), 0);

	for(auto& pt: pts) {
		cin >> pt.first >> pt.second;
	}

	do {
		++cnt;

		for(int i = 0; i < n - 1; ++i) {
			int j1 = ord[i];
			int j2 = ord[i + 1];

			double dx = pts[j2].first - pts[j1].first;
			double dy = pts[j2].second - pts[j1].second;

			dx *= dx;
			dy *= dy;

			answ += sqrt(dx + dy);
		}
	}
	while(next_permutation(ord.begin(), ord.end()));

	answ /= 1. * cnt;
	cout << fixed << setprecision(12) << answ << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define help freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);

int main()
{
    double d, t, s;
    cin >> d >> t >> s;
    double x;
    if (d < s)   
         cout << "Yes" << endl;
    else if(d/s<=t)
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;
        
    

    return 0;
}


Measured memory_bytes: 3668
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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



int main() {
    ll n, a[100005], mx = -1;
    
    cin >> n;
    REP(i, n){
        cin >> a[i];
        mx = max(mx, a[i]);
    }
    
    ll c = INF;
    REP(i, n){
        if(abs((mx + 1) / 2 - c) >= abs((mx + 1) / 2 - a[i])){
            c = a[i];
        }
    }
    
    cout << mx << ' ' << c << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;


public class Main{

	static Scanner sc = new Scanner(System.in);
	
	static double steps, angle, total_angle = 0, x = 0, y = 0;
	static String str[];
	
	public static void main(String[] args) {
		
		while(read()){
			solve();
		}
		
		System.out.println((int)x);
		System.out.println((int)y);

	}
	
	public static boolean read(){
		
		str = sc.next().split(",");
		
		steps = Integer.parseInt(str[0]);
		angle = Integer.parseInt(str[1]);
		
		if(steps == 0 && angle == 0) return false;
		
		return true;
	}
	
	public static void solve(){
		
		x += steps * Math.sin(total_angle * Math.PI / 180);
		y += steps * Math.cos(total_angle * Math.PI / 180);
		
		if(angle < 0) angle += 360;
		total_angle = (total_angle + angle) % 360;
		
	}

}

Measured memory_bytes: 12000
#include<iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	string A,B;
	for (int i = 0; i < b; i++) {
		A = A + (char)(a+48);
	}
	for (int i = 0; i < a; i++) {
		B = B + (char)(b+48);
	}
	if (A < B) {
		cout << A << endl;
	}
	else {
		cout << B << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % mod; a = a * a % mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// head

int t;

int main()
{
	ios::sync_with_stdio(false);
#ifdef RG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vector<pair<int, int>> vec;
	int tmp;
	rep(i, 0, a) {
		cin >> tmp;
		vec.push_back(make_pair(tmp, 0));
	}
	rep(i, 0, b) {
		cin >> tmp;
		vec.push_back(make_pair(tmp, 1));
	}
	rep(i, 0, c) {
		cin >> tmp;
		vec.push_back(make_pair(tmp, 2));
	}
	sort(all(vec));

	int all = x + y;
	ll ans = 0;
	per(i, 0, sz(vec)) {
		pii val = vec[i];
		if (val.second == 0 && x > 0 && all > 0) {
			ans += val.first;
			x--; all--;
		}
		else if (val.second == 1 && y > 0 && all > 0) {
			ans += val.first;
			y--; all--;
		}
		else if (val.second==2 && all > 0) {
			ans += val.first;
			all--;
		}
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    ll Q, H, S, D;
    cin >> Q >> H >> S >> D;

    ll N;
    cin >> N;

    ll q,h,s,d;
    q = Q;
    h = min(H, 2*q);
    s = min(S, 2*h);
    d = min(D, 2*s);

    ll ans=0;
    ans = (N/2) * d + (N % 2) * s;
    cout << ans << endl;


    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"unicode/utf8"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

type Move struct {
	i, j int
}

var S string
var T string
var dp [][]int

func main() {
	S = nextLine()
	T = nextLine()
	s_len := utf8.RuneCountInString(S)
	t_len := utf8.RuneCountInString(T)
	dp = make([][]int, s_len+1)
	mv := make([][]Move, s_len+1)
	for i, _ := range dp {
		dp[i] = make([]int, t_len+1)
		mv[i] = make([]Move, t_len+1)
	}
	for i := 0; i < s_len; i++ {
		for j := 0; j < t_len; j++ {
			if S[i] == T[j] {
				if dp[i][j]+1 > dp[i+1][j+1] {
					dp[i+1][j+1] = dp[i][j] + 1
					mv[i+1][j+1] = Move{i, j}
				}
			} else {
				if dp[i][j+1] > dp[i+1][j] {
					dp[i+1][j+1] = dp[i][j+1]
					mv[i+1][j+1] = Move{i, j + 1}
				} else {
					dp[i+1][j+1] = dp[i+1][j]
					mv[i+1][j+1] = Move{i + 1, j}
				}
			}
		}
	}
	i := s_len
	j := t_len
	ans := ""
	for i > 0 && j > 0 {
		if dp[i][j] == dp[i-1][j] {
			i--
		} else if dp[i][j] == dp[i][j-1] {
			j--
		} else {
			i--
			j--
			ans = string(S[i]) + ans
		}
	}
	fmt.Println(ans)
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func MaxIn2Values(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinIn2Values(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


Measured memory_bytes: 229760
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 99999999



int main(){
    int a,b;
    int month[]={0,0,31,29,31,30,31,30,31,31,30,31,30,31};
    for(int i=1;i<=12;i++)month[i]=month[i]+month[i-1];
    string w[]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
    while(cin>>a>>b){
        if(a==0&&b==0)break;
        int sum=0;
        sum+=month[a];
        sum+=b-1;
        sum=sum%7;
        cout<<w[sum]<<endl;
    }
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
 
#define  rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i>=0; i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector<ll> a(n); rep(i,n) std::cin >> a[i];

  // 3 1 0 2 (n==4)
  std::vector<ll> ans;
  for(int i=n-1; i>=0; i-=2) {
    ans.push_back( a[i] );
  }
  if ( n % 2 == 0 ) for(int i=0; i<n; i+=2) ans.push_back( a[i] );
  else for(int i=1; i<n; i+=2) ans.push_back( a[i] );
  for(auto&& k : ans) std::cout << k << " ";
  std::cout << std::endl;
  return 0;
}


Measured memory_bytes: 5488
#include <bits/stdc++.h>
using namespace std;
int main(){
 int a, b, c, x, y;
 cin >> a >> b >> c >> x >> y;
 if(a + b <= 2 * c){cout << a * x + b  * y << endl;}
 else{
   int sum = c * 2 * min(x, y);
   int rem = max(x, y) - min(x, y);
   int val;
   (max(x, y) == x) ? val = a : val = b;
   if(val >= 2 * c) sum += rem * 2 * c;
   else sum += rem * val;
   cout << sum << endl;
 }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    int a[4];
    string s;
    cin>>s;
    rep(i,4) a[i]=s[i]-'0';
    rep(i,8){
        int B[3],p=i;
        rep(j,3) B[j]=p%2,p/=2;
        int ans=a[0];
        rep(j,3){
            if(B[j]) ans+=a[j+1];
            else ans-=a[j+1];
        }
        if(ans==7){
            cout<<a[0];
            rep(j,3){
                if(B[j]) cout<<'+'<<a[j+1];
                else cout<<"-"<<a[j+1];
            }
            cout<<"=7";
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
#define gc getchar
#define pc putchar
#define fi first
#define se second
#define debug(x) cout << #x" = " << x << endl;
#define pp(x,y) cout << "pp: " << x << " " << y << endl;
inline ll read(){
	register ll x=0,f=1;register char c=gc();
	for(;!isdigit(c);c=gc())if(c=='-')f=-1;
	for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
#define rd read
void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
void writeln(ll x){write(x);puts("");}
const int maxn = 131074;
typedef long long ll;
typedef pair<ll,ll> pll;
vector<pair<ll,ll> > V[maxn],edge[maxn];
int q[maxn],n; 
inline void merge(vector<pll> &res,vector<pll> &va,vector<pll> &vb,ll wa,ll wb,ll limit){
	vector<pll> tmp;
	unsigned j=0;
	for(auto i:va){
		while(j<vb.size() && vb[j].fi<=limit-wa-wb-i.se) j++;
		if(j!=0){
			tmp.push_back({i.fi+wa,vb[j-1].se+wb});
			tmp.push_back({vb[j-1].se+wb,i.fi+wa});
		}
	}sort(tmp.begin(),tmp.end());
	res.clear();
	for(auto it:tmp)
		if(res.empty()||it.se<res.back().second)
			res.push_back(it);
}
inline bool check(ll limit){
	Dep(i,n-1,0){
		int u = q[i];
		if(edge[u].size()==0){
			V[u].clear();
			V[u].push_back({0,0});
		} else{
			merge(V[u],V[edge[u][0].fi],V[edge[u][1].fi],edge[u][0].se,edge[u][1].se,limit);
		}
		if(V[u].empty()) return false;
	}return true;
}
int main(){
	n = rd();
	Rep(i,2,n){
		int u = rd(),w = rd();
		edge[u] . push_back({i,w});
	}
	int front=0,rear=0;
	q[rear++] = 1;
	while(front<rear){
		int u=q[front++];
		for(auto v:edge[u]) q[rear++] = v.fi;
	}
	ll l= 0,r = 1e18,ans=-1;
	while(l<=r){
		ll mid=(l+r)>>1;
		if(check(mid)){
			ans = mid;
			r=mid-1;
		} else{
			l=mid+1;
		}
	}writeln(ans);
	return 0;
}

Measured memory_bytes: 31884
e, y = map(int, input().split())
if e == 0:
    if y >= 1989: print("H{}".format(y-1988))
    elif y >= 1926: print("S{}".format(y-1925))
    elif y >= 1912: print("T{}".format(y-1911))
    else: print("M{}".format(y-1867))
elif e == 1: # Meiji era
    print(1867+y)
elif e == 2: # Taisho era
    print(1911+y)
elif e == 3: # Showa era
    print(1925+y)
else: # Heisei era
    print(1988+y)


Measured memory_bytes: 5596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n;
ll a[2][100];
ll dp[2+1][100+1];

int main(){
	cin >> n;
	rep(i,2)rep(j,n)cin >> a[i][j];
	rep(i,2){
		rep(j,n){
			dp[i][j] += a[i][j];
			if(i+1<2)dp[i+1][j] = max(dp[i][j],dp[i+1][j]);
			if(j+1<n)dp[i][j+1] = max(dp[i][j],dp[i][j+1]);
		}
	}
	cout << dp[1][n-1] << endl;
}


Measured memory_bytes: 256
# include <iostream>
# include <queue>
using namespace std;
queue<int> q;
int f[10],s,k,vc,i;
int main () {
    cin>>s>>k;
    for(i=1;i<=k;i++){
        cin>>vc;
        f[vc]=1;
    }
    for(i=1;i<10;i++)
        if(f[i]==0)
            q.push(i);
    while(!q.empty()){
        vc=q.front();
        q.pop();
        if(vc>=s){
            cout<<vc<<"\n";
            return 0;
        }
        for(i=0;i<10;i++)
            if(f[i]==0)
                q.push(vc*10+i);
    }
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int main(){
    int h,w,n,m;
    cin>>h>>w>>n>>m;
    cout<<h*w-(n*w+m*h-n*m)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

// using namespace std;

const int N = 2000;
const int M = 2000;
const int Q = 200000;

int n, m, q;
char board[N][M];
int h_crossing_edges[N+1][M+1];
int v_crossing_edges[M+1][N+1];
int lr_comp[M+1][N+1];

int lr_crossings(int ai, int bi, int aj, int bj);
int components(int ai, int bi, int aj, int bj);


int main(){
    std::cin >> n >> m >> q;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            std::cin >> board[i][j];
        }
    }


    // init crossing edges

    bool has_crossing_edge;

    for (int i = 1; i < n; i++) {
        for (int j = m-1; j > -1; j--) {
            has_crossing_edge = board[i][j] == '1' && board[i-1][j] == '1';
            h_crossing_edges[i][j] = h_crossing_edges[i][j+1] + has_crossing_edge;
        }
    }

    for (int j = 1; j < m; j++) {
        for (int i = n-1; i > -1; i--) {
            has_crossing_edge = board[i][j] == '1' && board[i][j-1] == '1';
            v_crossing_edges[j][i] = v_crossing_edges[j][i+1] + has_crossing_edge;
        }
    }

    // for (int i = 0; i < n+1; ++i) {
    //     for (int j = 0; j < m+1; ++j) {
    //         std::cout << v_crossing_edges[i][j] << " ";
    //     }
    //     std::cout << std::endl;
    // }


    // init lr components

    bool upper_left_square;
    int comp_without_upper_left_square;
    for (int i = n-1; i > -1; i--) {
        for (int j = m-1; j > -1; j--) {
            comp_without_upper_left_square = (
                components(i+1, j, n, m) + components(i, j+1, i+1, m) - h_crossing_edges[i+1][j+1]);
            upper_left_square = board[i][j] == '1';
            lr_comp[i][j] = upper_left_square + comp_without_upper_left_square - lr_crossings(i, j, i+1, j+1);
        }
    }


    // process queries!

    int ai, bi, aj, bj;
    for (int r = 0; r < q; r++) {
        std::cin >> ai >> bi >> aj >> bj;
        std::cout << components(ai-1, bi-1, aj, bj) << std::endl;
    }

};


// helper methods

int lr_crossings(int ai, int bi, int aj, int bj) {
    int h = h_crossing_edges[aj][bi] - h_crossing_edges[aj][bj];
    int v = v_crossing_edges[bj][ai] - v_crossing_edges[bj][aj];
    return h + v;
}

int components(int ai, int bi, int aj, int bj) {
    int t = lr_comp[ai][bi];
    int bc = lr_comp[ai][bj];
    int c = lr_comp[aj][bj];
    int ac = lr_comp[aj][bi];
    return t + c - bc - ac + lr_crossings(ai, bi, aj, bj);
}


Measured memory_bytes: 52608
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());

		int k2 = 1;
		for (int i = 0; i < k; i++) {
			k2 *= 2;
		}

		int max = Math.max(a, Math.max(b, c));

		if (max == a) {
			System.out.println(a * k2 + b + c);
		} else if (max == b) {
			System.out.println(a + b * k2 + c);
		} else {
			System.out.println(a + b + c * k2);
		}
	}

}


Measured memory_bytes: 20948
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    double x = 1.00 * 360 / (12 * 60) * (h * 60 + m);
    double y = 1.00 * 360 / 60 * m;
    double delta = abs(x - y);
    double degrees = delta;
    if (delta == 180) {
        cout << a + b << '\n';
        return 0;
    }
    else if (delta > 180) {
        degrees = 360 - delta;
    }
    double ans = sqrt(a * a + b * b - 2 * (a * b * cos(degrees * acos(-1) / 180)));
    cout << fixed << setprecision(20) << ans << '\n';
}


Measured memory_bytes: 4196
N = int(input())
Ai = list(map(int,input().split()))
Ai.sort(reverse=True)
Alice = 0
for w in range(0,len(Ai),2):
    Alice = Alice + Ai[w]
for w in range(1,len(Ai),2):
    Alice = Alice - Ai[w]
print(str(Alice))


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back

typedef pair<int, int> PII;
typedef long long LL;

const int MOD = 1000000007;
LL DP[2005][2005];

int main() {
  int N, K;
  scanf("%d%d", &N, &K);
  FOR(i,1,N-K+2) DP[N-K+1][i] = 1;
  FOR(i,N-K+2,N+1) {
    LL su = 0;
    REP(j,i+1) {
      su += DP[i-1][j];
      DP[i][j] = su % MOD;
    }
  }
  LL res = DP[N][N];
  REP(i,max(0, N-K-1)) res = 2 * res % MOD;
  printf("%lld\n", res);
}


Measured memory_bytes: 22912
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector < vector <int> > vvi;
const int HUGEI = 2147483647;  // (1 << 31) - 1
const ll HUGEL = 9223372036854775807;  // (1 << 63) - 1
const string ABC = "abcdefghijklmnopqrstuvwxyz";

const long long MOD = 998244353;
const int MAX = 300001;
long long fact[MAX];

void init_fact() {
    fact[0] = 1;
    for (int i = 1; i < MAX; i++) {
        fact[i] = fact[i - 1] * i % MOD;
    }
}

long long power_func(long long a, long long b) {
    // a^b mod p
    if (b == 0) return 1;
    if (b % 2 == 0) {
        long long d = power_func(a, b / 2);
        return d * d % MOD;
    } else {
        return a * power_func(a, b - 1) % MOD;
    }
}

long long combi(long long n, long long k) {
    if (n < 0 || k < 0 || n < k) return 0;
    if (n == 0 || k == 0) return 1;
    long long a = fact[n];
    long long b = fact[k];
    long long c = fact[n - k];
    return a * power_func(b, MOD - 2) % MOD * power_func(c, MOD - 2) % MOD;
}

int main(void) {
    long long n, a, b, k;
    cin >> n >> a >> b >> k;
    init_fact();

    long long res = 0;
    for (int i = 0; i <= n; i++) {
        long long residual = k - a * i;
        if (residual < 0) continue;
        if (residual % b > 0) continue;
        long long j = residual / b;
        res += combi(n, i) * combi(n, j) % MOD;
        res %= MOD;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
int h[200005];
int main(){
	int n,k;long long ans=0;scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++)scanf("%d",h+i),h[i]=-h[i];
	sort(h,h+n);
	for(int i=k;i<n;i++)ans-=h[i];
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 1024
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		if(S[0] == S[1] || S[1] == S[2] || S[2] == S[3])
			System.out.println("Bad");
		else
			System.out.println("Good");
	}

}


Measured memory_bytes: 21716
#include<iostream>
#include<map>
#include<string>

using namespace std;
int main() {
	string a, b;
	int c, d;
	string e;

	std::cin >> a >> b >> c >> d >> e;
	
	map<string, int> m;
	m[a] = c;
	m[b] = d;
	m[e] -= 1;
	std::cout << m[a] << ' ' << m[b] << std::endl;
	return 0;
}

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

ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

int main(void){
    ll n;
    cin >> n;
    
    vector<ll> a(n, 0);
    for (int i = 0; i < n; i++) cin >> a[i];
    
    vector<ll> left(n+1, 0);
    vector<ll> right(n+1, 0);
    
    for (int i = 0; i < n; i++) left[i+1] = gcd(left[i], a[i]);
    for (int i = n-1; i >= 0; i--) right[i] = gcd(right[i+1], a[i]);
    
    ll res = 0;
    ll l, r;
    for (int i = 0; i < n; i++) {
        l = left[i];
        r = right[i+1];
        
        if (res < gcd(l, r)) res = gcd(l, r);
    }
    cout << res << endl;
    
}


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

uint64_t cnt = 0;

void merge(uint64_t A[], uint64_t left, uint64_t mid, uint64_t right) {
  uint64_t n1 = mid - left;
  uint64_t n2 = right - mid;
  uint64_t L[n1+1];
  uint64_t R[n2+1];
  for (uint64_t i = 0; i < n1; i++) {
    L[i] = A[left + i];
  }
  for (uint64_t i = 0; i < n2; i++) {
    R[i] = A[mid + i];
  }
  L[n1]=numeric_limits<uint64_t>::max();
  R[n2]=numeric_limits<uint64_t>::max();
  uint64_t i = 0, j = 0;
  for (uint64_t k = left; k < right;k++) {
    if (L[i] <= R[j]) {
      A[k] = L[i++];
    } else {
      cnt += n1 - i;
      A[k] = R[j++];
    }
  }
}

void mergeSort(uint64_t A[], uint64_t left, uint64_t right) {
  if (left+1 < right) {
    uint64_t mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main() {
  uint64_t n;
  cin >> n;
  uint64_t A[n];
  for (uint64_t i = 0; i < n; i++) {
    cin >> A[i];
  }
  mergeSort(A, 0, n);
  cout << cnt << endl;
}



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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> a(H, vector<char>(W));
  for(int i = 0; i < H; i++)
  {
    for(int j = 0; j < W; j++)
    {
      cin >> a.at(i).at(j);
    }
  }
  vector<int> A(H, 0), B(W, 0);
  for(int i = 0; i < H; i++)
  {
      int cnt = 0;
    for(int j = 0; j < W; j++)
    {
      if(a.at(i).at(j) == '#')
        A.at(i) = 1;
      else
        continue;
    }
  }

  for(int i = 0; i < W; i++)
  {
    int cnt = 0;
    for(int j = 0; j < H; j++)
    {
      if(a.at(j).at(i) == '#')
        B.at(i) = 1;
      else
        continue;
    }
  }
  
  for(int i = 0; i < H; i++)
  {
    if(A.at(i) != 0)
    {
      for(int j = 0; j < W; j++)
      {
        if(B.at(j) != 0)
        {
          cout << a.at(i).at(j);
        }
      }
      cout << endl;
    }
    else
      continue;
  }
}


Measured memory_bytes: 256
#define CPP17
#include <limits>
#include <initializer_list>
#include <utility>
#include <bitset>
#include <tuple>
#include <type_traits>
#include <functional>
#include <string>
#include <array>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <complex>
#include <random>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <regex>
#include <cassert>
#include <cstddef>
#ifdef CPP17
#include <variant>
#endif

// Yay!!
#define endl codeforces

// macros for iterator
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)

// alias
using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;

// variadic min/max
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }

// variadic chmin/chmax
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

// multi demension array
template <typename T, std::size_t Head, std::size_t... Tail> struct multi_dim_array { using type = std::array<typename multi_dim_array<T, Tail...>::type, Head>; };
template <typename T, std::size_t Head> struct multi_dim_array<T, Head> { using type = std::array<T, Head>; };
template <typename T, std::size_t... Args> using mdarray = typename multi_dim_array<T, Args...>::type;

#ifdef CPP17
// fill container
template <typename T, typename F, typename... Args> 
void fill_seq(T &t, F f, Args... args) { if constexpr (std::is_invocable<F, Args...>::value) { t = f(args...); } else { for (ssize_t i = 0; i < t.size(); i++) fill_seq(t[i], f, args..., i); } }
#endif

// make multi dimension vector
template <typename T> vec<T> make_v(ssize_t sz) { return vec<T>(sz); }
template <typename T, typename... Tail> auto make_v(ssize_t hs, Tail&&... ts) { auto v = std::move(make_v<T>(std::forward<Tail>(ts)...)); return vec<decltype(v)>(hs, v); }

// init
namespace init__ { 
struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; 
}


int main() {
    char c;
    std::cin >> c;
    if ('a' <= c && c <= 'z') std::cout << 'a';
    if ('A' <= c && c <= 'Z') std::cout << 'A';
    std::cout << "\n";
    return 0;
}


Measured memory_bytes: 3632
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int> P;
const long long mod = 1000000007;
const double eps = 1e-11;
const int inf = 1ll << 61;
int s[100006], t[100006];
struct segtree {
	int n = 1;
	vector<int>node, lazy;
//	vector<bool>lazyF;
	void init(int N) {
		while (n < N)n *= 2;
		node.resize(2 * n - 1);
		lazy.resize(2 * n - 1);
	}

	void eval(int k) {
		if (lazy[k]) {
			node[k] += lazy[k];
			if (k<n-1) {
				lazy[2 * k + 1] += lazy[k];
				lazy[2 * k + 2] += lazy[k];
			}
			lazy[k] = 0;
		}
	}
	void update(int a, int b, int x, int k, int l, int r) {
		eval(k);
		if (r <= a || b <= l)return;
		if (a <= l&&r <= b) {
			lazy[k] += x;
			eval(k);
		}
		else {
			update(a, b, x, k * 2 + 1, l, (l + r) / 2);
			update(a, b, x, k * 2 + 2, (l + r) / 2, r);
			node[k] = min(node[k * 2 + 1], node[k * 2 + 2]);
		}
	}

	int calc(int a, int b, int k, int l, int r) {
		eval(k);
		if (r <= a || b <= l)return inf;
		if (a <= l&&r <= b)return node[k];
		int vl = calc(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = calc(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
	void add(int a, int b, int x) {
		update(a, b, x, 0, 0, n);
	}
	int getmin(int a, int b) {
		return calc(a, b, 0, 0, n);
	}
};
segtree seg;
signed main() {
	int n, q; cin >> n >> q;
	seg.init(n);
	rep(x, q) {
		int a; cin >> a;
		if (a) {
			int s, t; cin >> s >> t;
			cout << seg.getmin(s, t + 1)<<endl;
		}
		else {
			int s, t, y; cin >> s >> t >> y;
			seg.add(s, t + 1, y);
		}
	}
}


Measured memory_bytes: 7056
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(string, s);
    CoutYn(s.find("YAKI") == 0);
}



Measured memory_bytes: 256