akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i,h) cin >> s[i];

    int ans=0;
    //1<<hは2のh乗を表している
    rep(is,1<<h)rep(js,1<<w){
        int cnt=0;
        rep(i,h)rep(j,w){
            //その行が消えているorその列が消えているならcontinue
            if(is>>i&1)continue;
            if(js>>j&1)continue;
            if(s[i][j] == '#') cnt++;
        }
        if(cnt==k) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
N,M=map(int,input().split());A=[map(int,input().split())for _ in range(N)];C=[list(map(int,input().split()))for _ in range(M)]
for a,b in A:print(min([(i,abs(c-a)+abs(d-b))for i,(c,d)in enumerate(C,1)],key=lambda x:x[1])[0])

Measured memory_bytes: 3060
#include <stdio.h>
int main() {
	int H, W;
	int i, j;
	while (1) {
		scanf("%d %d", &H, &W);
		if (H == 0 || W == 0) break;
		for (i = 0;i < H;i++) {
			for (j = 0;j < W;j++) {
				if (i % 2 == 0 && j % 2 == 0 || i % 2 == 1 && j % 2 == 1) {
					printf("#");
				}
				else {
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2088
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <iostream>
#include <deque>
#include <functional>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <string>
#include <vector>
#include <vector>

using namespace std;

#define int long long

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

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

#define debug(x) cerr << #x << ": " << x << endl;

const int MOD = 1e9 + 7;

signed main(void)
{
  bool flag = true;
  string s; cin >> s;
  vector<int> a('Z' - 'A' + 1, 0);
  for (int i = 0; i < 4; ++i) a[s[i] - 'A']++;

  for (int i = 0; i < 26; ++i) {
    if (a[i] != 2 && a[i] != 0) flag = false;
  }
  cout << (flag ? "Yes" : "No") << endl;
}


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

int main(int argc, char const *argv[])
{
    int n,m,c;
    cin >> n >> m >> c;
    vector<int> b(m);
    vector<vector<int>> a(n, vector<int>(m));
    
    for(int i = 0; i < m; i++) {
        cin >> b[i];
    }

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

    int ans = 0;

    for(int i = 0; i < n; i++) {
        int sum = 0;
        for(int j = 0; j < m; j++) {
            sum += a[i][j] * b[j];
        }
        sum += c;

        if(sum > 0) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


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

#define ll          long long int
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pair<int,int>>
#define mi          map<int,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(i=a;i<b;i++)
#define inf         INT_MAX
#define llinf       LLONG_MAX

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

using namespace std;
const int N=2e5+5;
int par[N],r[N];
int find(int a)
{
    if(par[a]<0) return a;
    else return(par[a]=find(par[a]));
}
void merge(int a,int b)
{
    a=find(a);
    b=find(b);
    if(a==b)return;
    if(r[a]>r[b])
    {
        par[b]=a;
        r[a]+=r[b];
    }
    else
    {
        par[a]=b;
        r[b]+=r[a];
    }
}
void solve()
{
    int n,q,i;
    cin>>n>>q;
    rep(i,0,n+1)par[i]=-1,r[i]=1;
    while(q--)
    {
        int t,a,b;
        cin>>t>>a>>b;
        if(t==0)merge(a,b);
        else
        {
            if(find(a)==find(b))cout<<1;
            else cout<<0;
            cout<<endl;
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 4980
(* O(n!) *)
let n, m = Scanf.scanf " %d %d" @@ fun n m -> n, m
let g = Array.make n []
let visited = Array.make n false
let ans = ref 0
let c = ref 0
let rec dfs v =
    visited.(v) <- true;
    incr c;
    if !c = n then incr ans;
    let f v2 = if not visited.(v2) then (dfs v2; visited.(v2) <- false; decr c) in
    List.iter f g.(v)
let _ =
  for _ = 1 to m do
    Scanf.scanf " %d %d" @@ fun u v ->
      let u, v = u - 1, v - 1 in
      g.(u) <- v :: g.(u);
      g.(v) <- u :: g.(v);
  done;
  dfs 0;
  Printf.printf "%d\n" !ans

Measured memory_bytes: 384
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(int i=(a);i<(b);++i)


#define huge 1000000007
typedef long long ll;

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll K = 0;
	ll Y = 0;
	ll X = 0;
	ll m[100000] = {};
	ll p[100] = {};
	ll x[100] = {};
	//ll *x, *c, *d;
	string S,T;
	ll count = 0;
	ll sum = 0;
	ll min = 1;
	ll i = 0;
	//char p;
	cin >> N;

	sum = N+1;

	while (true) {
		
		sum /= 10;

		if (sum < 1)break;

		count++;

	}

	i = (N+1) / pow(10,count);

	cout << count * 9 + i-1 << endl;

	return 0;

}



Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>


using ll =  long long;

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

using namespace std;

int main(){

    int n;
    cin >> n;
    int a[100];
    
    rep(i,n) cin >> a[i];
    sort(a, a+n, greater<int>());
    int alice=0;
    int bob=0;
    for(int i=0; i<n; i++){
        if(i%2==0)
            alice +=a[i];
        else 
            bob += a[i];
    }

    cout << alice-bob << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}
#define PS pair<string,P>


main(){
  int n;
  cin>>n;
  vector<PS> v(n);
  rep(i,n){
    string s;
    int a;
    cin>>s>>a;
    v[i]=PS(s,P(inf-a,i+1));
  }

  sort(all(v));
  rep(i,n){
    cout<<v[i].S.S<<endl;
  }

}


Measured memory_bytes: 256
def over(X, start=100):
    i = 0
    current = start
    while True:
        i += 1
        current += current // 100
        if current >= X:
            return i

def main():
    X = int(input())

    result = over(X, 100)

    print(result)
   


if __name__ == '__main__':
    main()

Measured memory_bytes: 9184
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
	vector<string> in(2);
	cin >> in[0]>> in[1];
	if (in[0].size() > in[1].size()){
		cout << "GREATER";
	}
	else if (in[0].size() < in[1].size()){
		cout << "LESS";
	}
	else{
		int i;
		for (i = 0; i < in[0].size(); i++){
			if (in[0][i] > in[1][i]){
				cout << "GREATER";
				break;
			}
			else if (in[0][i] < in[1][i]){
				cout << "LESS";
				break;
			}
		}
		if (i == in[0].size()){
			cout << "EQUAL";
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
    long long n,x;
    cin>>n>>x;
    vector<long long> a(n),a2(n),a3(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        a2[i]=a[i];
        a3[i]=a[i];
    }
    long long ans=0;
    long long ans2=0;
    long long ans3=0;
    for(int i=0;i<n;i++){
        if(a[i]>x){
            ans+=a[i]-x;
            a[i]=x;
            a2[i]=a[i];
            a3[i]=a[i];
        }
    }

    for(int i=0;i<n-1;i++){
        if(a2[i]+a2[i+1]>x){
            ans2+=a2[i]+a2[i+1]-x;
            a2[i]-=a2[i]+a2[i+1]-x;
        }
    }
    for(int i=1;i<n;i++){
        if(a3[i]+a3[i-1]>x){
            ans3+=a3[i]+a3[i-1]-x;
            a3[i]-=a3[i]+a3[i-1]-x;
        }
    }
    cout<<ans+min(ans2,ans3)<<endl;
}

   


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

int main(){
    cin.tie(0);
	ios::sync_with_stdio(false);
    string s;
    cin>>s;
    bool b=true;
    long long h=0, ii=0;
    for(int i=0; i<s.length(); i++){
        if(i%2==0 && s[i]!='h' )  {b=false; break;}
        else if(i%2!=0 && s[i]!='i') {b=false; break;}
        h+= (s[i]=='h');
        ii+= (s[i]=='i');
       // else{b=false; break;}
    }

    cout<<(b && (h==ii) ? "Yes" : "No");
}


Measured memory_bytes: 256
[n, m] = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
l = [[int(j) for j in input().split()] for i in range(m)]
l.sort(reverse=True, key=lambda x:x[1])

k = []
for i in l:
    k += [i[1]] * i[0]
    if (len(k) >= n):
        break

k += a
k.sort(reverse = True)
print(sum(k[:n]))


Measured memory_bytes: 28864
#include<bits/stdc++.h>
#define ll long long                        
using namespace std;
ll k,a[1000005],f=1,l=9,t,n;
int main(){
	cin>>k;
	for(int i=1;i<=9;i++) a[i]=i;
    if(k<=9) {cout<<k;return 0;}
    while(1)
    {
    	t=a[f];
    	for(int i=-1;i<=1;i++)
    	{
    		if(t%10==0&&i==-1) continue;
			if(t%10==9&&i==1) continue;
			n=t*10+t%10+i;
			a[++l]=n;
			if(l>=k){cout<<a[k];return 0;}
		}
		f++;
	}
	return 0;
}
//68871358
//76140264
//25446011
//200841159
//914174775

Measured memory_bytes: 1024
#include<bits/stdc++.h>
     
#define int long long 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb emplace_back
#define sz(a) (int)(a).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
 
template<typename T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<typename T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T> bool Min(T a, T b) { return a > b ? b : a; }
template<typename T> bool Max(T a, T b) { return a < b ? b : a; }
template<typename T> void de(T a ){
#ifdef LOCAL
	cout<<a<<" ";
#endif
}
const int INF = 2e5+1;


void solve(){
	int n,k,m;
	cin>>n>>k>>m;
	vi arr(n,0);
	int a;
	forn(i,m){
		cin>>a;
		arr[a-1]++;
	}
	forn(i,n){
		de(arr[i]);
		if( k-(m-arr[i]) > 0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}
 
int32_t main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    	cout.precision(10);
    	cout << fixed;
#ifdef LOCAL
    freopen("input.txt", "rt", stdin);
    freopen("output.txt","w",stdout);
#endif
        int q=1;
#ifdef LOCAL 
        cin>>q;
#endif
        while(q--){
            solve();
        }
               
#ifdef LOCAL
    cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
#endif
 
	return 0;
}	
 


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

const int MOD = (int)1e9+7;

int main(){
	int N,M,L;
	cin >> N >> M >> L;
	vector<int> A(M),B(M),C(M);
	for(int i=0;i<M;i++){
		cin >> A.at(i) >> B.at(i) >> C.at(i);
		A.at(i)--;
		B.at(i)--;
	}
	int Q;
	cin >> Q;
	vector<int> s(Q),t(Q);
	for(int i=0;i<Q;i++){
		cin >> s.at(i) >> t.at(i);
		s.at(i)--;
		t.at(i)--;
	}

	vector<vector<int>> graph(N,vector<int>(N,L+1));
	for(int i=0;i<M;i++){
		if(C.at(i)>L)	continue;
		graph.at(A.at(i)).at(B.at(i))=C.at(i);
		graph.at(B.at(i)).at(A.at(i))=C.at(i);
	}
	//warshall-floyd
	for(int k=0;k<N;k++){
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				graph.at(i).at(j)=min(graph.at(i).at(j),graph.at(i).at(k)+graph.at(k).at(j));
				graph.at(j).at(i)=graph.at(i).at(j);
			}
		}
	}
	vector<vector<int>> GRAPH(N,vector<int>(N,N+1));
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(graph.at(i).at(j)<=L)	GRAPH.at(i).at(j)=1;
		}
	}
	//warshall-floyd
	for(int k=0;k<N;k++){
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				GRAPH.at(i).at(j)=min(GRAPH.at(i).at(j),GRAPH.at(i).at(k)+GRAPH.at(k).at(j));
				GRAPH.at(j).at(i)=GRAPH.at(i).at(j);
			}
		}
	}

	for(int i=0;i<Q;i++){
		if(GRAPH.at(s.at(i)).at(t.at(i))==N+1)	cout << -1 << endl;
		else	cout << GRAPH.at(s.at(i)).at(t.at(i))-1 << endl;
	}

	return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>

using namespace std;

int mp[25][25];

int main()
{
    
    int n,m,x,y,l,nx,ny,sum;
    char d;
    
    
    while(cin >> n,n!=0){
        fill_n(*mp,25*25,0);
        for(int i=0;i<n;i++){
            cin >> x >> y;
            mp[y][x] = 1;
        }
    
        ny = 10;
        nx = 10;
        sum = mp[ny][nx];
        mp[ny][nx] = 0;
    
        cin >> m;
        for(int i=0;i<m;i++){
            cin >> d >> l;
            for(int j=0;j<l;j++){
                if(d == 'N') ny++;
                if(d == 'E') nx++;
                if(d == 'W') nx--;
                if(d == 'S') ny--;
                sum += mp[ny][nx];
                mp[ny][nx] = 0;
            }
        }
    
        cout << (sum==n?"Yes":"No") << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3084
#include <stdio.h>
#include <math.h>
 
int main(void){
	
	double n;
	int a,b,c,d;
	
	scanf("%lf",&n);
	
	if(0<=n && n <=9999 && ceil(n)==floor(n)){
		a = n/1000;
		b = (n-a*1000)/100;
		c = (n-a*1000-b*100)/10;
		d = n-a*1000-b*100-c*10;
		
		
		if(a+b+c+d == 7){
			printf("%d+%d+%d+%d=%d\n",a,b,c,d,7);
		}else if(a+b+c-d == 7){
			printf("%d+%d+%d-%d=%d\n",a,b,c,d,7);
		}else if(a+b-c+d == 7){
			printf("%d+%d-%d+%d=%d\n",a,b,c,d,7);
		}else if(a+b-c-d == 7){
			printf("%d+%d-%d-%d=%d\n",a,b,c,d,7);
		}else if(a-b+c+d == 7){
			printf("%d-%d+%d+%d=%d\n",a,b,c,d,7);
		}else if(a-b+c-d == 7){
			printf("%d-%d+%d-%d=%d\n",a,b,c,d,7);
		}else if(a-b-c+d == 7){
			printf("%d-%d-%d+%d=%d\n",a,b,c,d,7);
		}else if(a-b-c-d == 7){
			printf("%d-%d-%d-%d=%d\n",a,b,c,d,7);
		}else{
			printf("error\n");
		}
	
	}
	
	return 0;
}

Measured memory_bytes: 128
void main()
{
    long n = rdElem;

    n %= 10;

    if (n == 3)
    {
        "bon".writeln;
    }
    else if (n == 0 || n == 1 || n == 6 || n == 8)
    {
        "pon".writeln;
    }
    else
    {
        "hon".writeln;
    }
}

enum long mod = 10L^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 2704
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

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

int main() {
    string s;
    cin >> s;
    vector<bool> check(10000, false);
    int l = s.size();
    rep(i, l) {
        if(check[s[i]] == false) {
            check[s[i]] = true;
        } else {
            cout << "no" << endl;
            return 0; 
        }
    }
    cout << "yes" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

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

	if(a >= 3200) {
		cout << s << endl;
	} else {
		cout << "red" << endl;
	}

}

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

using namespace std;
#define rep(i,i0,n) for(int i=(i0);i<(int)(n);++i)
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vii;
typedef long long ll;

ll xo[200010], sum[200010];


int main(){
    int n;cin>>n;
    vector<ll> a(n);
    rep(i,0,n){
        cin>>a[i];
        xo[i] = sum[i] = a[i];
    }
    rep(i,1,n){
        xo[i]^=xo[i-1];
        sum[i]+=sum[i-1];
    }
    ll ret=0;
    rep(l,0,n){
        int ok = l;
        int ng = n;
        while(ok + 1 < ng){
            int mid = (ok + ng)/2;
            ll x = l>0 ? xo[mid]^xo[l-1] : xo[mid];
            ll s = l>0 ? sum[mid]-sum[l-1] : sum[mid];
            if(x==s)ok = mid;
            else ng = mid;
        }
        ret += ok - l + 1;
    }
    cout<<ret<<endl;
	return 0;
}



Measured memory_bytes: 4992
// ABC173 A - Payment
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  // 初期値
  int N;
  cin >> N;
  
  // Main loop
  while(1){
    N -= 1000;
    if (N <= 0)
      break;
  }
  
  cout << abs(N) << endl;
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;
const ll mod = 1e9 + 7;

int main() {
  int x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector <int> p(a), q(b), r(c);
  REP(i, a) {
	cin >> p[i];
  }
  REP(i, b) {
	cin >> q[i];
  }
  REP(i, c) {
	cin >> r[i];
  }
  sort(all(p), greater <int>());
  sort(all(q), greater <int>());
  priority_queue <int> que;
  REP(i, x) {
	que.push(p[i]);
  }
  REP(i, y) {
	que.push(q[i]);
  }
  REP(i, c) {
	que.push(r[i]);
  }
  ll ans = 0;
  REP(i, x + y) {
	ans += que.top();
	que.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3572
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

/*
 ????¬?
 ????±?????????? ???????§£???????????????(???????????????????????§??????)?????????????±????????????? ??????????????¬???B
 ?????????????????? ??????????§£????????????????????¨???????§£????????????????????????????????????????±????????????? ???????????±?????\???????????°??¨???
 ??¢
 */

/*
 DP
 ???DP??????????¨?????±?????????????????????????(?§£?????°?´????????§??????§???????????????)
 */

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while(1) {
		ll n,i,j;
		cin>>n>>i>>j;
		if(n==0&&i==0&&j==0) break;
		i--;
		j--;
		string ret="";
		REP(roop,n) {
			ll _n=n-roop;
			if(i%(1ll<<(_n-1))==i%(1ll<<(_n))) {
				if(i%2==0) {
					if(j%2==0) {
						ret+='L';
					} else {
						ret+='R';
					}
				} else {
					if(j%2==0) {
						ret+='R';
					} else {
						ret+='L';
					}
				}
				i=((1ll<<(_n-1))-1)-i;
			} else {
				if(i%2==0) {
					if(j%2==0) {
						ret+='L';
					} else {
						ret+='R';
					}
				} else {
					if(j%2==0) {
						ret+='R';
					} else {
						ret+='L';
					}
				}
				i=i%(1ll<<(_n-1));
			}
			j/=2;
		}
		REP(roop,n) {
			cout<<ret[n-1-roop];
		}
		cout<<endl;
	}
}

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

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

    bool isError = false;
    if (n % 2 != 0)
    {
        isError = true;
    }
    else
    {
        string a = s.substr(0,n/2);
        string b = s.substr(n/2, n-1);
        if (a != b)
        {
            isError = true;
        }
    }

    if (isError)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def examA():
    C1 = SI()
    C2 = SI()
    ans = "YES"
    if C1[0]!=C2[2] or C1[1]!=C2[1] or C1[2]!=C2[0]:
        ans = "NO"
    print(ans)
    return

def examB():
    A, B, C, X, Y = LI()
    loop = max(X,Y)
    ans = inf
    for i in range(loop+1):
        cost = i*2*C
        if X>i:
            cost += A*(X-i)
        if Y>i:
            cost += B*(Y-i)
        ans = min(ans,cost)
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 5712
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] d = new int[k];
        for (int i = 0; i < k; i++) {
            d[i] = sc.nextInt();
        }
        sc.close();
        String s = "";
        while (true) {
            boolean check = false;
            s = "" + n;
            for (int i = 0; i < s.length(); i++) {
                s = "" + n;
                String str = s.substring(i, i + 1);
                Integer tar = Integer.parseInt(str);
                for (int j = 0; j < k; j++) {
                    if (tar == d[j]) {
                        n++;
                        check = true;
                        continue;
                    }
                }
            }
            if (!check) {
                break;
            }
        }
        System.out.println(n);

    }
}

Measured memory_bytes: 39332
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <utility>
using namespace std;
typedef pair<int, int> pii;

pair<int, int> operator+(const pii& a, const pii& b){
    return make_pair(a.first +b.first, a.second +b.second);
}
pair<int, int> operator-(const pii& a, const pii& b){
    return make_pair(a.first -b.first, a.second -b.second);
}

int main(){
    while(1){
        int m;
        cin >> m;
        if(m==0) break;

        set<pii> a;
        for(int i=0; i<m; i++){
            int x,y;
            cin >> x >> y;
            a.insert(make_pair(x, y));
        }

        int n;
        cin >> n;
        set<pii> b;
        for(int i=0; i<n; i++){
            int x,y;
            cin >> x >> y;
            b.insert(make_pair(x, y));
        }

        for(pii q: b){
            pii diff = q-*(a.begin());
            bool match = true;
            for(pii p: a){
                if(b.find(p+diff) == b.end()){
                    match = false;
                    break;
                }
            }
            if(match){
                cout << diff.first << " " << diff.second << endl;
                break;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3168
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
typedef long long ll;
using namespace std;

#define N 105
int n,maxw;
int v[N],w[N];
int dp[N][10005];

int DP(int i,int weight){
    if(dp[i][weight]!=-1);
    else if(i==0){
        if(weight>=w[0])dp[0][weight]=v[0];
        else dp[0][weight]=0;
    }else if(weight<w[i]){
        dp[i][weight]=DP(i-1,weight);
    }else{
        dp[i][weight]=max(DP(i-1,weight-w[i])+v[i],DP(i-1,weight));
    }
    return dp[i][weight];
}

int main(){
    cin>>n>>maxw;
    for(int i=0;i<=n-1;i++)cin>>v[i]>>w[i];
    for(int i=0;i<=n-1;i++)for(int j=0;j<=maxw;j++)dp[i][j]=-1;
    printf("%d\n",DP(n-1,maxw));
    return 0;
}


Measured memory_bytes: 7048
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

int main()
{
  string s, t;
  cin>>s>>t;
  int sl = s.size();
  int tl = t.size();

  vector<vector<int>> dic(26);
  rep(i, sl) {
    int x = s[i]-'a';
    dic[x].push_back(i+1);
  }

  ll ans = 0;
  ll now = 0;
  rep(i, tl) {
    int x = t[i]-'a';
    if (dic[x].empty()) {
      cout << -1 << endl;
      return 0;
    }
    auto itr = upper_bound(dic[x].begin(), dic[x].end(), now);
    if (itr == dic[x].end()) {
      ans += sl;
      now = 0;
      itr = upper_bound(dic[x].begin(), dic[x].end(), now);
    }
    now = *itr;
  }
  cout << ans+now << endl;

  return 0;
}


Measured memory_bytes: 1216
S = input()
key_str = 'keyence'

ans = 'NO'
for i in range(len(key_str)):
    if i == 0:
        if S.startswith(key_str) or S.endswith(key_str):
            ans = 'YES'
            break
    else:
        left = key_str[:i]
        right = key_str[i:]
        if S.startswith(left) and S.endswith(right):
            ans = 'YES'
            break
print(ans)


Measured memory_bytes: 2940
#include<algorithm>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<stack>
#include<string>
#include<deque>
#include<queue>
#include<vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
const double PI = acos(-1);  // PI = 3.141593...

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

    string s;
    cin >> s;
    s = "N" + s + "N";

    char target = 'L';
    if(s[1] == 'L') target = 'R';
    vector<int> pos;
    int ans = 0;
    for(int i=1; i<=n; ++i) {
        if(s[i] == 'R' && s[i+1] == 'R') ++ans;
        if(s[i] == 'L' && s[i-1] == 'L') ++ans;
        if(s[i] == target && s[i+1] != target) pos.emplace_back(i);
    }

    for(int i : pos) {
        if(k > 0) {
            if(i == n) ++ans;
            else ans += 2;
            --k;
        }
        else break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int k, x;
  cin >> k >> x;
  int l = max(x - k + 1, -1000000);
  int r = min(x + k - 1, 1000000);
  FOR(i, l, r + 1)
  {
    cout << i;
    if (i != r)
    {
      cout << " ";
    }
  }
  cout << endl;
}


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

int main()
{
    int N, M, C;
    cin >> N >> M >> C;

    int B[M];
    int A[N][M];

    // input B
    for(int i = 0; i < M; i++)
    {
        cin >> B[i];
    }

    // input A
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < M; j++)
        {
            cin >> A[i][j];
        }
    }

    int count = 0;
    for(int i = 0; i < N; i++)
    {
        int64_t sum = 0;
        for(int j = 0; j < M; j++)
        {
           sum += A[i][j] * B[j]; 
        }
        sum += C;
        if(sum > 0)
        {
            count++;
        }
    }

    cout << count << endl;
    
    return 0;
}

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

int main(){
	using P = pair<ll,ll>;
	int n;
	ll d;
	ll a;
	cin >> n >> d >> a;
	d *= 2;
	vector<P> monsters(n);
	for(auto &i:monsters){
		cin >> i.first >> i.second;
	}
	sort(monsters.begin(),monsters.end());

	ll ans = 0;
	ll sum_damage = 0;
	int rp = 0;
	for(auto &i:monsters){
		while(rp<n&&monsters[rp].first<=i.first+d){
			monsters[rp].second += sum_damage;
			++rp;
		}
		ll hp = i.second - sum_damage;
		if(hp>0){
			ll time = (hp + a - 1) / a;
			ans += time;
			sum_damage += time * a;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0; i<(n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main()
{
    int n;
    cin >> n;
    vector<int> x(n);
    REP(i,n) {
        cin >> x[i];
    } 
    int minx = x[0];
    int maxx = x[0];
    REP(i,n) {
        minx = min(minx,x[i]);
        maxx = max(maxx,x[i]);
    } 
    int mind = 1000000000;
    for(int p = minx ;p <= maxx; p++) { 
        int tmp = 0;
        REP(i,n) {
            tmp += (x[i] - p) * (x[i] - p);
        }
        mind = min(mind,tmp);
    }

    cout << mind << endl;


    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FORR(i, m, n) for(int i = m; i >= n; i--)

using namespace std;

typedef vector<int> vi; typedef pair<int,int> pii;
typedef long long ll; typedef vector<long long> vl;
typedef vector<string> vs;

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

	int n, m, x;
	cin >> n >> m >> x;

	vi fld(n + 1);
	REP(i, m) {
		int x;
		cin >> x;
		fld[x] = 1;
	}

	int l = 0, r = 0;
	REPR(i, x) {
		l += fld[i];
	}
	FOR(i, x, n) {
		r += fld[i];
	}

	cout << min(l, r) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

struct dice{
    int top, front, right;
    void set(int t, int f){
        top = t;
        front = f;
        int a[7][7] = {{0, 0, 0, 0, 0, 0, 0},
                       {0, 0, 3, 5, 2, 4, 0},
                       {0, 4, 0, 1, 6, 0, 3},
                       {0, 2, 6, 0, 0, 1, 5},
                       {0, 5, 1, 0, 0, 6, 2},
                       {0, 3, 0, 6, 1, 0, 4},
                       {0, 0, 4, 2, 5, 3, 0}};
        right = a[top][front];
    }
    void rotate(int dir){
        switch (dir){
            case 0:
                swap(right, top);
                top = 7 - top;
                break;
            case 1:
                swap(right, top);
                right = 7 - right;
                break;
            case 2:
                swap(front, top);
                front = 7 - front;
                break;
            case 3:
                swap(front, top);
                top = 7 - top;
                break;
        }
    }
    int find(int i){
        if (right == i) return 0;
        if (7 - right == i) return 1;
        if (7 - front == i) return 2;
        if (front == i) return 3;
        return -1;
    }
};

vector<dice> ds[100][100];

int main() {
    int n, m = 100;
    while (cin >> n && n){
        REP(i,m) REP(j,m) ds[i][j].clear(); 
        while (n--){
            int x = 50, y = 50, t, f;
            cin >> t >> f;
            dice d;
            d.set(t, f);
            while (1){
                bool move = false;
                FORR(p,6,4){
                    int dir = d.find(p);
                    if (dir == -1) continue;
                    int xx = x + dx[dir], yy = y + dy[dir];
                    if (ds[xx][yy].size() < ds[x][y].size()){
                        x = xx;
                        y = yy;
                        d.rotate(dir);
                        move = true;
                        break;
                    }
                }
                if (!move) break;
            }
            ds[x][y].push_back(d);
        }
        int count[6] = {};
        REP(i,m) REP(j,m){
            if (ds[i][j].empty()) continue;
            count[ds[i][j][ds[i][j].size() - 1].top - 1]++;
        }
        REP(k,6){
            if (k > 0) cout << " ";
            cout << count[k];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3340
# -*- coding: utf-8 -*-
n, m = map(int,input().split())
sc = []
for i in range(m):
    sc.append([int(i) for i in input().split()])

if n == 1:
    #print("a")
    if m == 1:
        print(sc[0][1])
    elif m == 0:
        print(0)
    elif m > 1:
        print(-1)

if n == 2:
    count = 0
    for i in range(10, 100):
        tmp1 = i // 10
        tmp2 = i - (tmp1 * 10)
        tmp = 0
        flag = True
        for j in range(m):
            if sc[j][0] == 1 and sc[j][1] != tmp1:
                flag = False
            if sc[j][0] == 2 and sc[j][1] != tmp2:
                flag = False
        if flag:
            print(i)
            break
        else:
            count += 1
    if count == 90:
        print(-1)

if n == 3:
    count = 0
    for i in range(100, 1000):
        tmp1 = i // 100
        tmp2 = (i - tmp1 * 100) // 10
        tmp3 = i - tmp1 * 100 - tmp2 * 10
        flag = True
        for j in range(m):
            if sc[j][0] == 1 and sc[j][1] != tmp1:
                flag = False
            if sc[j][0] == 2 and sc[j][1] != tmp2:
                flag = False
            if sc[j][0] == 3 and sc[j][1] != tmp3:
                flag = False
        if flag:
            print(i)
            break
        else:
            count += 1
    if count == 900:
        print(-1)

Measured memory_bytes: 3064
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, h;
    cin >> n >> h;
    vector<int> as(n), bs(n);
    for(int i = 0; i < n; i++){
        cin >> as[i] >> bs[i];
    }
    sort(as.rbegin(), as.rend());
    sort(bs.rbegin(), bs.rend());
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(bs[i] < as[0]){ break; }
        h -= bs[i];
        ans++;
        if(h <= 0){
            cout << ans << '\n';
            return 0;
        }
    }
    cout << ans + (h + as[0] - 1) / as[0] << '\n';
}


Measured memory_bytes: 1024
import heapq

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)

ans = 0
ans += a[0]

h = []
heapq.heapify(h)
heapq.heappush(h, -a[1])
heapq.heappush(h, -a[1])

for i in range(2, n):
    b = heapq.heappop(h)
    ans += (-b)
    heapq.heappush(h, -a[i])
    heapq.heappush(h, -a[i])

print(ans)

Measured memory_bytes: 105336
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>

using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if((a - b) >= c){
        cout<<"0";
    }
    else{
        cout<<c-(a-b);
    }


    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for

int main()
{
    string a,b;
    cin >> a >> b;
    if (a[0] == b[2] && a[1] == b[1] && a[2] == b[0]) {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		
		String[]ab = line.split(" ");
		int a = Integer.parseInt(ab[0]);
		int b = Integer.parseInt(ab[1]);
		
		if (a < b) {
			System.out.println("a < b");
			
		} else if(a > b){
			System.out.println("a > b");

		}else {
			System.out.println("a == b");
		}

	}

}



Measured memory_bytes: 26124
x, y = map(int, input().split())
judge='No'

for i in range(x+1):
  if(x==1 and (y==4 or y==2)):
    judge='Yes'
  if(y%4==0 and y/4==x):
    judge='Yes'
  if(y%2==0 and y/2==x):
    judge='Yes'
  for j in range(x+1-i):
    if((i*2+j*4)==y and i+j==x):
      judge='Yes'
    if((i*4+j*2)==y and i+j==x):
      judge='Yes'
      
if(y%2==1):
  judge='No'

print(judge)
  

Measured memory_bytes: 9088
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;
//set<int>::iterator it;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int i,a=0,b=0,n;
	cin>>n;
	int s[n];
	for(i=0;i<n;i++)cin>>s[i];
	sort(s,s+n);
	for(i=0;i<n;i++){
		if(i%2==0){
			a+=s[n-i-1];
		}
		else b+=s[n-i-1];
	}
	cout<<a-b<<endl;
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = 2 * pow(10, 9) + 1;//+1しないとREになるかも(out of rangeになるんかな?? )

vector<int> dx = { -1, 0, 1, 0, -1, -1, 1, 1 };
vector<int> dy = { 0, -1, 0, 1, -1, 1, -1, 1 };

ll max_num(ll a, ll b) { return (a > b) ? a : b; }
ll min(ll a, ll b) { return (a < b) ? a : b; }


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

	}

	map<string, int> mp;
	for (int i = 0; i < N; i++) {
		mp[S[i]]++;
	}


	int max_num = 0;
	for (auto element : mp) max_num = max(max_num, element.second);

	//cout << max_num << endl;

	auto begin = mp.begin(), end = mp.end();
	for (auto iter = begin; iter != end; iter++) {
		// first: key, second: value
		//cout << "key = " << iter->first << "\n";
		//cout << "value = " << iter->second << "\n";
		if (iter->second == max_num) cout << iter->first << endl;
	}

}


Measured memory_bytes: 26752
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    int a,b;
    cin >> a >> b;
    if(a > b)swap(a,b);
    repi(i,b,0){
        cout << a;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
#define MAXX 500005
 
#define PI   3.14159265358979323846264338327950
 
#define PB push_back 
#define PF push_front
#define F first
#define S second
 
#define fixx(n) fixed << setprecision(n)
 
#define ll 	  long long 
 
#define mod  1000000007



int main()
{
	FAST;
	int h, a;
	cin >> h >> a;
	int k = h/a;
	if(h % a){
		k ++;
	}
	cout << k;
	return 0;
}

Measured memory_bytes: 3576
# -*- coding: utf-8 -*-

# CODE FESTIVAL 2016 qual C
# Problem A

if __name__ == '__main__':
    s = input()
    cf = 'CF'
    count = 0

    for si in s:
        if count == 0 and si == cf[0]:
            count += 1
        elif count == 1 and si == cf[1]:
            print('Yes')
            exit()

    print('No')


Measured memory_bytes: 2940
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
    string s,t;
    cin >> s >> t;
    string s0=s;
    s+=s0;
    int ans;
    for(int i=0; i<t.length(); i++){
        int c=0;
        ans=1;
        while(c<t.length()){
            if(s[c+i]!=t[c]){
                ans=0;
                break;
            }
            c++;
        }
        if(ans==1) break;
    }
    if(ans==1){
        cout << "Yes";
    }else{
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>  // min, max
#include <fstream>  // ifstream
#include <iomanip>  // setprecision
using namespace std;
typedef long long ll;

int main(void)
{
#ifdef FILE_DEBUG
    ifstream inputFile("data/input.txt");
    cin.rdbuf(inputFile.rdbuf());
#endif
    // これより下にコードを書く

    int R;
    cin >> R;

    if (R < 1200)
        cout << "ABC" << endl;
    else if (R < 2800)
        cout << "ARC" << endl;
    else
        cout << "AGC" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int MOD = 1e9+7;
const int MAXN = 111;
const int MAXA = 256;

int dp[MAXN][MAXN][MAXA];

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> A(n);
	for (int i = 0; i < n; i++)
		cin >> A[i];
	dp[0][0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= i; j++) {
			for (int a = 0; a < MAXA; a++) {
				(dp[i+1][j][a] += dp[i][j][a]) %= MOD;
				(dp[i+1][j+1][a^A[i]] += dp[i][j][a]) %= MOD;
			}
		}
	}
	ll ans = 0;
	ll fact = 1;
	for (int i = 1; i <= n; i++) {
		(fact *= i) %= MOD;
		(ans += fact * dp[n][i][k]) %= MOD;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;


int main(int argc, char *argv[])
{
    
    
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    string line;
    
    getline(cin, line);
    
    for (int i = 0; i < line.length(); i++) {
        if (isalpha(line[i])) {
            if (isupper(line[i])) {
                cout << tolower(line[i], locale::classic());
            } else {
                cout << toupper(line[i], locale::classic());
            }
        } else {
            cout << line[i];
        }
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3220
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cstring>


using namespace std;

const int N_MAX = 1000000;

int binarysearch(int target, int* arr, int arr_size){
  int l_ix = 0;
  int r_ix = arr_size;
  int mid_ix = l_ix + (r_ix - l_ix)/2;

  /*
  while(l_ix < r_ix){
    mid_ix = l_ix + (r_ix - l_ix)/2;

    if(l_ix == r_ix - 1){
      if(arr[l_ix] == target || arr[r_ix] == target ) return 1;
      else break;
    }
    
    if(arr[mid_ix] == target) return 1;
    if(arr[mid_ix] < target) l_ix = mid_ix;
    if(arr[mid_ix] > target) r_ix = mid_ix;
    }*/

  // improved
  while(l_ix <= r_ix){
    mid_ix = l_ix + (r_ix - l_ix)/2;
    if(arr[mid_ix] == target) return 1;
    if(arr[mid_ix] < target) l_ix = ++mid_ix;
    if(arr[mid_ix] > target) r_ix = --mid_ix;
  }
  
  return 0;
}


int main(){
  int n;
  cin >> n;
  int* S = new int[n];
  
  for(int i=0;i<n;i++){
    cin >> S[i];
  }
  
  int q;
  cin >> q;

  int ans = 0;
  
  int* T = new int[n];
  for(int i=0; i<q; i++){
    cin >> T[i];
    ans += binarysearch(T[i], S, n-1);
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3664