akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
 
// Most important thing in CP - Have Fun :)
unordered_set<int>st;
int ok; 
 
void check(int x){
    unordered_set<int>tempset;
    for (int i = 2 ; i<sqrt(x)+1 ;i++){
        if (x%i==0){
            tempset.insert(i);
            if (x/i!=1)tempset.insert(x/i);
        }
    }
    if (x!=1)tempset.insert(x);
    for (auto& it: tempset){
        if (st.count(it)){
            //cout<<"yy"<<endl;
            ok = 0;
            return;
        }
        st.insert(it);
    }

}
void solve(){
	//write here
    int n;
    cin>>n;
    vi arr(n);
    rep(i,0,n)cin>>arr[i];
    int gcd = arr[0];
    check(arr[0]);
    ok = 1;
    for (int i = 1 ; i <n ; i++){
        if (ok==1)check(arr[i]);
        gcd = __gcd(gcd,arr[i]);
    }
    if (ok)cout<<"pairwise coprime"<<endl;
    else if (gcd==1)cout<<"setwise coprime"<<endl;
    else cout<<"not coprime"<<endl;
}
 
int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	//insert code
	
		solve();
	return 0;
}

Measured memory_bytes: 7100
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
        
    int a, b, c; cin >> a >> b >> c;
    vi v = {a, b, c};
    sort(_all(v));

    cout << v[0] + v[1] << endl;

    return 0;
}


Measured memory_bytes: 256
S=input()
a1= (S[0]=="A")
s=S[2:-1]
a2=s.count("C")==1
ss=S.replace("A","").replace("C","")
a3= (ss==ss.lower())

if a1 & a2 & a3:
    print("AC")
else:
    print("WA")


Measured memory_bytes: 3060
#include <iostream>  
using namespace std;
int main(void)
{
	int a;
	int a1, a2;
	cin >> a;
	a1 = a / 500;
	a = a % 500;
	a2 = a / 5;
	cout << a1 * 1000 + a2 * 5;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> V(N);
  vector<int> C(N);
  int ans = 0;
  for(int i = 0; i < N; i++){
    cin >> V[i];
  }
  for(int i = 0; i <N; i++){
    cin >> C[i];
  }
  for(int i = 0; i < N; i++){
    if( V[i] > C[i] ){
      ans += V[i] - C[i];
    }
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 500


int main() {
	char sInput[MAX_STRING+1]="";
	char* psInput;

	int i=0;
	int nPriceA=0;
	int nPriceB=0;
	int nPriceAB=0;
	int nNeedsA=0;
	int nNeedsB=0;
	int nNeedsAB=0;
	int nNeedsAPair=0;
	int nNeedsBPair=0;
	int nTotal=0;
	int nSubTotal=0;
	int nTotal1=0;
	int nSubTotal1=0;
	int nSubA=0;
	int nTotal2=0;
	int nSubTotal2=0;
	int nSubB=0;

	// read line 1
	gets(sInput);
	psInput = strtok(sInput," ");
	nPriceA = atoi(psInput);
	psInput = strtok(NULL," ");
	nPriceB = atoi(psInput);
	psInput = strtok(NULL," ");
	nPriceAB = atoi(psInput);
	psInput = strtok(NULL," ");
	nNeedsA = atoi(psInput);
	psInput = strtok(NULL," ");
	nNeedsB = atoi(psInput);

	if ( nNeedsA > nNeedsB ){
		nNeedsA = nNeedsA - nNeedsB;
		nNeedsAB = nNeedsB;
		nNeedsB = 0;
	} else if ( nNeedsA < nNeedsB ){
		nNeedsB = nNeedsB - nNeedsA;
		nNeedsAB = nNeedsA;
		nNeedsA = 0;
	} else {
		nNeedsAB = nNeedsA;
		nNeedsA = 0;
		nNeedsB = 0;
	}

	// buy AB or A and B
	if ( nPriceA+nPriceB < nPriceAB*2 ) {
		nSubTotal=(nPriceA+nPriceB)*nNeedsAB;
	} else {
		nSubTotal=nPriceAB*2*nNeedsAB;
	}
	nSubA=nNeedsAB;
	nSubB=nNeedsAB;

	// buy A
	if ( nNeedsA >0 ){
		if ( nPriceA < nPriceAB*2 ){
			nSubTotal=nSubTotal+nPriceA*nNeedsA;
			nSubA=nSubA+nNeedsA;
		} else {
			nSubTotal=nSubTotal+nPriceAB*2*nNeedsA;
			nSubA=nSubA+nNeedsA;
			nSubB=nSubB+nNeedsA;
		}
	}
	// buy B
	if ( nNeedsB >0 ){
		if ( nPriceB < nPriceAB*2 ){
			nSubTotal=nSubTotal+nPriceB*nNeedsB;
			nSubB=nSubB+nNeedsB;
		} else {
			nSubTotal=nSubTotal+nPriceAB*2*nNeedsB;
			nSubA=nSubA+nNeedsB;
			nSubB=nSubB+nNeedsB;
		}
	}


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

    return 0;
}


Measured memory_bytes: 128
n = gets.to_i
as = gets.chomp.split.map(&:to_i).sort
bs = gets.chomp.split.map(&:to_i).sort
cs = gets.chomp.split.map(&:to_i).sort

cnt = 0

bs.each do |b|
  a_idx = as.bsearch_index{|x| x >= b} || n
  c_idx = cs.bsearch_index{|x| x > b} || n
  cnt += a_idx * (n - c_idx) 
end

puts cnt


Measured memory_bytes: 30452
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
pair<ll,ll> func(ll last,ll eaten,int level,V&pathi,V&legth){
	P data=mp(last,eaten);//last,eaten
	clog << level << " : " <<endl;
	if (level == 0)
	{
		data=mp(max(0LL,data.F-1LL),eaten+min(1LL,max(last,0LL)));
	}
	else if (legth[level] <= last)
	{
		data=mp(data.F-legth[level],data.S+pathi[level]);
	}
	else
	{
		if (data.F >=1)
		{
			data.F --;
		}
		if(data.F>0){
		data=func(data.F,data.S,level-1,pathi,legth);
		}
		if(data.F>=1){
			data=mp(data.F-1,data.S+1);
		}
		if (data.F > 0)
		{
			data = func(data.F, data.S, level - 1, pathi, legth);
		}
		if (data.F > 0)
		{
			data.F --; 
		}
	}
//	clog<<level<<" : "<<data.F<<" , "<<data.S<<endl;
	return data;
}
int main(){
	int n;
	ll x;
//	ll ans=0LL;
	cin >>n>>x;
	V pathi(51,1LL), legth(51,1LL);
	rep(i,51){
		if(i!=0){
			pathi[i]=pathi[i-1]*2+1LL;
			legth[i]=legth[i-1]*2+3LL;
			//clog<<pathi[i]<<" "<<legth[i]<<endl;
		}
	}
	P ans=func(x,0,n,pathi,legth);
	cout<<ans.S<<endl;
}
/*
v p l
0 1 1
1 3(2*2 +1) 5(1*2+3)
2 7(3*2 +1)  13(5*2+3)
3 15(7*2 +1) 29(13*2+3)
Vn ((V(n-1)*2 +1)  (2*(V(n-1))+3)

*/

Measured memory_bytes: 256
import string
def f(str):
    t = cnt = 0
    while 1:
        u = t
        t = string.find(s[t:],str)
        if t == -1: break
        cnt+=1; t+=u+1;
    print cnt
while 1:
    try:
        s = raw_input()
        f("JOI")
        f("IOI")
    except EOFError: break

Measured memory_bytes: 6408
n,l= map(int,input().split())
a= list(map(int,input().split()))
rh=-1
for i in range(n-1):
    if a[i]+a[i+1]>=l:
        rh=i
        break
else:
    print('Impossible')
    exit()
print('Possible')
if rh>0:
    for i in range(rh):print(i+1)
if rh+1<n:
    for i in range(n-1,rh+1,-1):print(i)
print(rh+1)


Measured memory_bytes: 19996
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int w, a, b; cin >> w >> a >> b;
  if (a > b) swap(a, b);
  int v = b - (a + w);
  outl(max(v, 0));
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 504
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

int const N = 100 + 10 , mod = 1e9 + 7 ;
int n , h[N] ;

int inv2 = (mod + 1) >> 1 ;

int z = 1 ;
set <pii> dp ;

inline void add (int &a , int b) {
	a += b ;
	if (a >= mod) a -= mod ;
}

inline int pw (int a , int b) {
	int res = 1 ;
	for (; b ; b >>= 1 , a = 1ll * a * a % mod) 
		if (b & 1) res = 1ll * res * a % mod ;
	return res ;
}

inline int get (int start , int len) {
	return (2 * start - (2ll * start * pw(inv2 , len)) % mod + mod) % mod ;
}

int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
	
	cin >> n ;
	for (int i = 0 ; i < n ; i ++) cin >> h[i] ;

	if (h[0] > 1) dp.insert({1 , pw(2 , h[0] - 1)}) ; 
	dp.insert({h[0] , 2}) ;

	for (int i = 1 ; i < n ; i ++) {
		if (h[i - 1] >= h[i]) {
			int sum = 0 , last = h[i - 1] + 1 ;
			while (dp.size() && dp.rbegin() -> F > h[i]) {
				pii p = *dp.rbegin() ;
	
				add(sum , get(p.S , last - p.F)) ;

				last = p.F ;

				dp.erase(p) ;
			}

			if (dp.size()) {
				pii p = *dp.rbegin() ;
				add(sum , get(1ll * p.S * pw(inv2 , h[i] - p.F) % mod , last - h[i])) ;
				if (p.F == h[i]) dp.erase(p) ;
			}

			add(sum , sum) ;

			dp.insert({h[i] , sum}) ; 
		}
		else {
			z = 1ll * z * pw(2 , h[i] - h[i - 1]) % mod ;

			pii p = *dp.rbegin() ;

			assert(p.F == h[i - 1]) ;

			dp.insert({h[i] , 2ll * p.S * pw(inv2 , h[i] - h[i - 1]) % mod}) ;
		}
	}

	int last = h[n - 1] + 1 , ans = 0 ;
	while (_sz(dp)) {
		pii p = *dp.rbegin() ;
	
		add(ans , get(p.S , last - p.F)) ;

		last = p.F ;

		dp.erase(p) ;
	}

	ans = 1ll * ans * z % mod ;

	cout << ans << '\n' ;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   int n, prev, cur, next, ctr = 0;
   cin >> n >> prev >> cur;
   for(int i = 2; i < n; i++)
   {
      cin >> next;
      if(cur < max(prev,next) && cur > min(prev,next))
         ctr ++;
      prev = cur;
      cur = next;
   }
   cout << ctr << endl;
   return 0;
}


Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
S = []
for i in range(N):
    S.append(str(input()))

c = collections.Counter(S)

max_c = -1
anss = []
for key, count in c.most_common():
    if max_c <= count:
        max_c = count
    else:
        break
    anss.append(key)
anss.sort()
for ans in anss:
    print(ans)

Measured memory_bytes: 128076
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
const int MAX=1e9+7;
const int mod=1e9+7;

int main()
{
	long long n,k,t=0;
	cin>>n>>k;
	while(n) 
	{
		n/=k;
		t++;
	}
	cout<<t;
}

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

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

    int n;
    string s;
    cin >>s;
    n = s.size();
    int cnt1 = 0, cnt2 = 0;
    for(int i = 0; i < n; i++){
        if(i%2 == 0){ // 0 hote hobe
            if(s[i] == '1') cnt1++;
        }
        else{ // 1 hote hobe
            if(s[i] == '0') cnt1++;
        }
    }
    for(int i = 0; i < n; i++){
        if(i%2 == 0){ // 1 hote hobe
            if(s[i] == '0') cnt2++;
        }
        else{ // 0 hote hobe
            if(s[i] == '1') cnt2++;
        }
    }

    cout << min(cnt1, cnt2)<<endl;
    return 0;
}



Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int INF = 1001001001;
int main() {
  int N, a, ma = -1, mi = 1001;
  cin >> N;
  repe(i, 1, N) {
    cin >> a;
    if (mi > a) mi = a;
    if (ma < a) ma = a;
  }
  cout << ma - mi << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define LL long long
#define mod 1000000007
using namespace std;
LL quickpow(LL a,LL b,LL m)
{
    LL ans = 1;
    LL base = a;
    while(b>0)
    {
        if(b&1==1)
            ans=(ans*base)%m;
        base=(base*base)%m;
        b>>=1;
    }
    return ans;
}
LL slove(LL n,LL m)
{
    LL ans=1;
    for(LL i=1;i<=m;i++)
    {
        LL tmp;
        tmp=(n-i+1)%mod;
        ans*=(tmp*quickpow(i,mod-2,mod))%mod;
        ans%=mod;
    }
    return ans;
}
int main()
{
    LL n,a,b;
    cin>>n>>a>>b;
    LL ans=quickpow(2,n,mod)-1;
    ans=(ans+mod-slove(n,a))%mod;
    ans=(ans+mod-slove(n,b))%mod;
    cout<<ans;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
const int M = 100000;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int count = 0;
	for (int i = a; i <= b; i++) {
		if (c%i == 0) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 10005;
const int MAX_P = 1000005;
int N;
int A[MAX_N];
vector<int> prime;
bool used[MAX_P];

vector<int> AP[MAX_N];
int PMAX[MAX_N];

bool used2[MAX_P];

vector<int> overP;

signed main()
{
  FOR(i,2,sqrt(MAX_P)) {
    if(!used[i]) {
      used[i] = true;
      prime.push_back(i);
      FOR(j,1,MAX_P) {
        if(i*j >= sqrt(MAX_P)) {
          break;
        }
        used[i*j] = true;
      }
    }
  }

  cin >> N;
  REP(n,N) {
    cin >> A[n];
    int pi = 0;
    for(int p : prime) {
      if(1000 <= p) break;
      int cnt = 0;
      while(A[n]%p == 0) {
        cnt++;
        A[n] /= p;
      }
      AP[n].push_back(cnt);
      PMAX[pi] = max(PMAX[pi], cnt);
      pi++;
    }

    if(!used2[A[n]]) {
      used2[A[n]] = true;
      overP.push_back(A[n]);
    }
  }

  int ans = 0;
  REP(n,N) {
    int tmp = 1;
    REP(i,prime.size()) {
      FOR(j,AP[n][i], PMAX[i]) {
        tmp *= prime[i];
        tmp %= MOD;
      }
    }

    for(int p : overP) {
      if(p != A[n]) {
        tmp *= p;
        tmp %= MOD;
      }
    }

    ans += tmp;
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 20992
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int n,a[100];
  int bob=0,alice=0;
  cin>>n;
  rep(i,n){
    cin>>a[i];
  }
  sort(a,a+n);
  rep(i,n){
    if(i%2==0) alice+=a[i];
    else bob+=a[i];
  }
  cout<<abs(alice-bob)<<endl;

  return 0;
}





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

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()

ll solver(ll x)
{
	if (x == -1)return 0;

	++x;
	ll y = x / 2;

	if (x % 2 == 1)
	{
		if (y % 2 == 1)return x;
		else return x - 1;
	}
	else
	{
		if (y % 2 == 1)return 1;
		else return 0;
	}
}

int main()
{
	ll a, b; cin >> a >> b;
	cout << (solver(a - 1) ^ solver(b)) << endl;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	boolean isMM(String s) {
		int m = Integer.parseInt(s);
		if (m >= 1 && m <= 12) {
			return true;
		}
		return false;
	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String s = sc.next();

		String s1 = s.substring(0, 2);
		String s2 = s.substring(2);

		String ans;
		if (isMM(s1) && isMM(s2)) {
			ans = "AMBIGUOUS";
		} else if (isMM(s1)) {
			ans = "MMYY";
		} else if (isMM(s2)) {
			ans = "YYMM";
		} else {
			ans = "NA";
		}

		out.println(ans);

		sc.close();

	}

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

}


Measured memory_bytes: 23636
MOD = 10**9+7
N = int(input())
C = []
C.append(int(input()))
for i in range(N-1):
    c = int(input())
    if c == C[-1]:
        continue
    C.append(c)
#print(C)
N = len(C)
lis = [[0] for i in range(max(C)+1)]
for i in range(N):
    lis[C[i]].append(i+1)
for i in range(len(lis)):
    lis[i].append(MOD)

def binary_search(lis,i):
    ok = 0
    ng = len(lis)-1
    while ng-ok > 1:
        mid = (ok + ng)// 2
        if lis[mid] < i:
            ok = mid
        else:
            ng = mid
    return lis[ok]
#print(binary_search([0,1,2,3,4],3))
#print(lis)
dp = [0] * (N+1)
dp[0] = 1
for i in range(1,N+1):
    dp[i] += dp[i-1]
    p = binary_search(lis[C[i-1]],i)
    if p != 0:
        dp[i] += dp[p]
    dp[i] %= MOD
    #print(p)
print(dp[-1])


Measured memory_bytes: 119744
def fibonacci(n):
    if n == 0 or n == 1:
        F[n] = 1
        return F[n]
    elif F[n] != -1:
        return F[n]
    else:
        F[n] = fibonacci(n-1) + fibonacci(n-2)
        return F[n]
    

F = [-1] * 50
print(fibonacci(int(input())))


















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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int n, m, k;
	cin >> n >> m >> k;
	long long a[n], b[m];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i) a[i] += a[i - 1];
	}
	for (int i = 0; i < m; i++) {
		cin >> b[i];
		if (i) b[i] += b[i - 1];
	}
	
	int ans = upper_bound(b, b + m, k) - b;
	for (int i = 0; i < n; i++) {
		int left = k - a[i];
		if (left < 0) break;
		int z = upper_bound(b, b + m, left) - b;
		ans = max(ans, i + z + 1);
//		cout << i << " " << z << endl;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 6700
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

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

    rep(i,100){
        if((a*(i+1))%b == c){
            cout<<"YES";
            return 0;
        }
    }
    cout<<"NO";
}

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

int main() {

int A,B,C,D;
int i = 0;
int j = 0;
cin >> A >> B >> C >> D;

// 高橋君 A-D
// 青木君 C-B

while (C > 0){
C = C - B;
i++;
}
while (A > 0){
A = A - D;
j++;
}

/*
cout << C << endl;  //青木のHP
cout << i << endl;  //高橋が殴った回数
cout << A << endl;  //高橋のHP
cout << j << endl;  //青木が殴った回数
*/

if (j >= i){
    cout << "Yes" << endl;
}
else
{
     cout << "No" << endl;
}




}


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


void solve(std::string S){
    if(S[0]=='S'){cout << "Cloudy" <<"\n";}
    else if(S[0]=='C'){cout<<"Rainy"<<"\n";}
    else if(S[0]=='R'){cout <<"Sunny"<<"\n";}
}


int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;
char a[5];
char b[5];

int main(){
    scanf("%s",a);
    scanf("%s",b);
    int flag = 1;
    for(int i=0; i<=2; i++){
        if(a[i]!=b[2-i]){
            flag = 0;
        }
    }
    if(flag){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        int n;
        //????¨???????int?????????????¶???????????????§?????????
        long total = 0;
        //????°???????Constraints????????§?????§?????????
        int min = 1000000;
        //min??¨????§?
        int max = -1000000;
    	//?¨??????\??????????????????????????§????????????
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int a[] = new int[n];
		
		for(int i = 0;i < n;i++){
			a[i] = scanner.nextInt();
			total += a[i];
			
			if(min > a[i]){
				min = a[i];
			}
			
			if(max < a[i]){
				max = a[i];
			}
		}
		
		System.out.println(min+" "+max+" "+total);
    	scanner.close();
    }
}

Measured memory_bytes: 41500
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    string pass; cin >> pass;
    int n = (int)pass.size();
    int po = 1;
    for(int i = 0; i < n; i++) po *= 10;

    string s = "0123456789";
    sort(s.begin(), s.end());
    
    string ans = "";
    int diff = 0;
    do{
        string t = s.substr(0, n);
        int val = (int)abs(stol(pass) - stol(t));
        int tmp = min(val, po - val);
        if(tmp > diff){
            diff = tmp;
            ans = t;
        }
        
    }while(next_permutation(s.begin(), s.end()));
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3232
n,k = map(int,input().split())
ary = [list(map(int,input().split())) for _ in range(n)]
ary.sort()

ans = float("Inf")
for i in range(n-k+1):
    for j in range(k,n-i+1):
        xmin = ary[i][0]
        xmax = ary[i+j-1][0]
        ary_y = sorted(ary[i:i+j], key=lambda x: (x[1]))
        for l in range(len(ary_y)-k+1):
            ymin = ary_y[l][1]
            ymax = ary_y[l+k-1][1]
            ans = min(ans,(xmax - xmin) * (ymax - ymin))
print(ans)

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

typedef long long ll;

typedef pair<int, int>P;
int n;
P r[105],b[105];
bool R[105];
int ans;
int mr2;
int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> r[i].first >> r[i].second;
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i].first >> b[i].second;
    }
    sort(r, r+n);
    sort(b, b+n);
    for (int i = 0; i < n; i++) {
        int j = 0;
        mr2 = -1;
        int l = -1;
        while (b[i].first > r[j].first && j < n) {
            j++;
        }
        for (int k = 0; k < j; k++) {
            if (b[i].second > r[k].second && r[k].second > mr2 && R[k] == false) {
                mr2 = r[k].second;
                l = k;
            }
        }
        if (l != -1) {
            R[l] = true;
            ans++;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long koyaku(long g,long l){
  if(g%l == 0) return l;
  else return koyaku(l,g%l);
}
int main(){
  long a,b,c,d;
  cin >> a >> b >> c >> d;
  long kobai = c*d/koyaku(c,d);
  long ans = 0;
  ans += b/c - (a-1)/c;
  ans += b/d - (a-1)/d;
  ans -= b/kobai - (a-1)/kobai;
  cout << b-a+1-ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////


int main() {

	ll N;
	cin >> N;

	vector<ll> cm(101, 0);

	repn(i, N) {
		ll d;
		cin >> d;
		cm[d] = 1;
	}

	ll ans = 0;
	repn(i, 100) {
		if (cm[i] == 1) { ans++; }
	}

	cout << ans;

	system("PAUSE");

	

}


Measured memory_bytes: 504
#include <iostream>
using namespace std;
int main()
{
    int n, k;
    char c;
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> c;
        cout << (char)(i == k ? c + ('a' - 'A') : c) << flush;
    }
    cout << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
	ll h,w;
	cin >> h >> w;
	
	const int MOD = 1e9 + 7;
	
	vector<vector<char>> a(h, vector<char>(w));
	for(int i=0; i < h; i++) {
		for(int j=0; j < w; j++) {
			cin >> a[i][j];
		}
	}
	vector<vector<ll>> dp(h, vector<ll>(w, 0));
	dp[0][0] = 1;
	
	for(int i=1; i < h; i++) {
		if(a[i][0] == '#') dp[i][0] = 0;
		else dp[i][0] = dp[i-1][0];
	}
	
	for(int i=1; i < w; i++) {
		if(a[0][i] == '#') dp[0][i] = 0;
		else dp[0][i] = dp[0][i-1];
	}
	
	for(int i=1; i < h; i++) {
		for(int j=1; j < w; j++) {
			if(a[i][j] == '.') {
				dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
			}
			else dp[i][j] = 0;
		}
	}
	
	cout << dp[h-1][w-1];

	return 0;
}

Measured memory_bytes: 9088
/*input
3 3
1 2 1
2 3 1
1 3 5


*/
#include <iostream>
#include <vector>

typedef std::pair<int, int> ii;

const int ms = 100100;

std::vector<ii> edges[ms];
int pos[ms];
bool visit[ms];

bool dfs(int on, int cur = 0) {
	if(visit[on]) {
		return cur == pos[on];
	}
	pos[on] = cur;
	visit[on] = true;
	for(auto a : edges[on]) {
		if(!dfs(a.first, cur + a.second)) {
			return false;
		}
	}
	return true;
}

int main() {
	int n;
	int m;
	std::cin >> n >> m;
	for(int i = 0; i < m; i++) {
		int u, v, d;
		std::cin >> u >> v >> d;
		edges[u].push_back(ii(v, d));
		edges[v].push_back(ii(u, -d));
	}
	bool ans = true;
	for(int i = 1; i <= n; i++) {
		if(!visit[i]) {
			ans = ans && dfs(i);
		}
	}
	std::cout << (ans ? "Yes" : "No") << '\n';
}

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

s = input()

x = []

for i in range(n):
    x.append(s[i])

import collections

clist = collections.Counter(x)

y = list(clist.values())

cnt = 1

for item in y:
    cnt = cnt * (item + 1)

cnt = cnt - 1
cnt = cnt % (10 ** 9 + 7)
print(cnt)

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int>d(k);
    vector<int> okashi(n);

    rep(i,k){
        cin >> d[i];
        int tmp;
        rep(j,d[i]) {cin >> tmp; okashi[tmp-1]++;}
    }

    sort(ALL(okashi));
    int ans=0;
    rep(i,n){
        if(okashi[i]!=0) break;
        ans++;
    }

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

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    Vec b(n);
    cin>>b;
    Vec res;
    per(j,n-1){
        per(i,b.size()-1LL){
            if(i+1==b[i]){
                res.pb(i);
                b.erase(i+b.begin());
                break;
            }
        }
    }

    if(res.size()==n){
        reverse(ALL(res));
        rep(i,n){
            cout<<res[i]+1<<endl;
        }
    }else{
        cout<<-1<<endl;
    }
    return  0;
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

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

    int ans=0;
    int S=s.size();

    rep(i,n)
    {
        string t;
        cin >>t;

        bool ok=false;
        //??????????????????
        rep(j,t.size())
        {
            //???
            for(int k=1; k<=t.size(); ++k)
            {
                //????????????????????????
                int last=j+(S-1)*k;
                if(last>=t.size()) continue;

                bool valid=true;
                rep(l,S)
                {
                    int p=j+l*k;
                    if(s[l]!=t[p]) valid=false;
                }

                if(valid)
                {
                    //printf(" %d, %d, %d\n",i,j,k);
                    ok=true;
                    break;
                }
            }
            if(ok) break;
        }

        if(ok) ++ans;
    }

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

Measured memory_bytes: 3184
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vii;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

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

	vi l(m), r(m);
	rep(i, m) cin >> l[i] >> r[i];

	int LEFT = l[0], RIGHT = r[0];

	for (int i = 1; i < m; ++i) {
		LEFT = max(LEFT, l[i]);
		RIGHT = min(RIGHT, r[i]);
	}
	cout << max(0, RIGHT - LEFT  + 1)<< endl;
}

Measured memory_bytes: 1024
N = int(input())						# 5
a = [int(i) for i in input().split()]	# 1 2 3 4 5 ...

count_even = 0
for i in a:
	if i % 2 == 0:
		count_even += 1


ans = ( 3 ** N ) - ( 2 ** count_even )

print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;
    int a = n%10;
    if(a==2||a==4||a==5||a==7||a==9){co("hon");return 0;}
    if(a==0||a==1||a==6||a==8){co("pon");return 0;}
    co("bon");
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=45;
int f[N][N][N],flag[N][N][N],n,ans;
char s[N][N];
int dp(int l,int r,int mid){
	if (flag[l][r][mid])return f[l][r][mid];
	if (l==r)return 1;
	if (l==mid||mid==r)return 0;
	flag[l][r][mid]=1;
	for (int j=l;j<=mid-1;j++)
		for (int k=mid+1;k<=r;k++)
			if (s[j][k]=='1')
				for (int p=j;p<=mid-1;p++)
					for (int q=mid+1;q<=k;q++)
						f[l][r][mid]+=dp(l,p,j)*dp(p+1,q-1,mid)*dp(q,r,k);
	return f[l][r][mid];
}
signed main(){
	scanf("%lld",&n);n*=2;
	for (int i=1;i<=n;i++)scanf("%s",s[i]+1);
	for (int i=2;i<=n;i++)
		if (s[1][i]=='1')ans+=dp(2,n,i);
	printf("%lld\n",ans);
	return 0;		
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int d[5], k;
  for (int i=0; i<5; i++) cin >> d[i];
  cin >> k;
  for (int i=0; i<5; i++) {
    for (int j=i+1; j<5; j++) {
      if (abs(d[i] - d[j]) > k) {
        cout << ":(" << endl;
        return 0;
      }
    }
  }
  cout << "Yay!" << endl;
}

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

void bubbleSort(string C[], int N) {
  for (int i = 0; i < N - 1; i++) {
    for (int j = N - 1; j >= i + 1; j--) {
      if (C[j - 1][1] > C[j][1]) {
        swap(C[j - 1], C[j]);
      }
    }
  }
}

void selectionSort(string C[], int N) {
  for (int i = 0; i < N - 1; i++) {
    int min_idx = i;
    for (int j = i + 1; j < N; j++) {
      if (C[j][1] < C[min_idx][1]) {
        min_idx = j;
      }
    }
    swap(C[i], C[min_idx]);
  }
}

bool Stable(string Ci[], string Co[], int N) {
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      if (Ci[i][1] != Ci[j][1]) continue;
      for (int a = 0; a < N - 1; a++) {
        for (int b = a + 1; b < N; b++) {
          if (Ci[j] == Co[a] && Ci[i] == Co[b]){
            return false;
          }
        }
      }
    }
  }
  return true;
}

int main() {
  int N;
  string Cards[40], C1[40], C2[40];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> Cards[i];
    C2[i] = C1[i] = Cards[i];
  }

  bubbleSort(C1, N);
  for (int i = 0; i < N; i++) {
    if (i) cout << " ";
    cout << C1[i];
  }
  cout << endl;
  cout << (Stable(Cards, C1, N) ? "Stable" : "Not stable") << endl;
  
  selectionSort(C2, N);
  for (int i = 0; i < N; i++) {
    if (i) cout << " ";
    cout << C2[i];
  }
  cout << endl;
  cout << (Stable(Cards, C2, N) ? "Stable" : "Not stable") << endl;
  
  return 0;
}


Measured memory_bytes: 3220
#pragma region Macros

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

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

void Main() {
    string S;
    cin >> S;

    set<string> s{"abc", "acb", "bac", "bca", "cab", "cba"};
    //{"abc","acb","bac","bca","cab","cba"}

    if (s.count(S)) {
        cout << "Yes";
        return;
    }

    cout << "No";
}

#pragma region main
main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  vc a(3); rep(i, 3) cin >> a[i];
  sort(all(a));
  if(a[0] == 'a'&&a[1] == 'b'&&a[2] == 'c')
  fin("Yes")
  else
  fin("No")
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <queue>
#include <vector>
#include <string>


#define rep(i,a,b)(long long i=a;i<b;i++)

int beki(int n){
	int ans=1;
	for(int i=0;i<n;i++)
		ans*=10;
	return ans;
}

using namespace std;


struct POINT {
	int x;
	int y;
	POINT(int X, int Y){
		x = X;y = Y;
	}
};

unsigned long num;
string str[12];
int kirei[10][4]={0};
int kr;
bool suji[10]={0};
int nakaji=0;

int cul(){
	int sum=0;
	for(int i=0;i<kr;i++)
		sum+=(kirei[i][3]*kirei[i][2]);
	if(!sum){
		return 1;
	}else
		return 0;
}


void saiki(int itr){
	for(int x=0;x<10;x++){
		if(!suji[x]&&!(x==0&&kirei[itr][1]==true)){

			int tmp=kirei[itr][2];
			kirei[itr][2]=x;
			suji[x]=true;

			if(itr+1==kr)
				nakaji+=cul();
			else
				saiki(itr+1);

			kirei[itr][2]=tmp;
			suji[x]=false;
		}
	}
}

int main(void){

	while(1){

		bool abc[26][2]={0};
		kr=0;

		nakaji=0;

		for(int i=0;i<10;i++){
			for(int j=0;j<4;j++){
				kirei[i][j]=0;
			}
			suji[i]=0;
		}

		cin >> num;
		if(num==0)
			break;

		for(int i=0;i<num;i++){
			cin >> str[i];
			if(str[i].length()!=1)
				abc[str[i][0]-'A'][1]=true;
			for(int j=0;j<str[i].length();j++){
				abc[str[i][j]-'A'][0]=true;
			}
		}

		int kei[26]={0};
		for(int i=0;i<num-1;i++){
			int ju=1;
			for(int j=str[i].length()-1;j>=0;j--){
				kei[str[i][j]-'A']+=ju;
				ju*=10;
			}
		}
		int i=num-1;
		int ju=1;
		for(int j=str[i].length()-1;j>=0;j--){
			kei[str[i][j]-'A']-=ju;
			ju*=10;
		}

		for(int i=0;i<26;i++){
			if(abc[i][0]){
				kirei[kr][0]=i+'A';
				kirei[kr][1]=abc[i][1];
				kirei[kr++][3]=kei[i];
			}
		}
			
		

		saiki(0);

		cout << nakaji <<endl;

	}

	return 0;
}

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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];
    ll all = 1;
    rep(i, n) all *= 3;
    ll sub = 1;
    rep(i, n) if (v[i] % 2 == 0) sub *= 2;
    cout << all - sub << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
bool d[200010],dp[550][550];

int main(){
  clr(d,false);
  d[0] = d[1] = true;
  rep(i,2,100000){
    if(!d[i]){
      for(int j = 2;j*i <= 100000;j++){
        d[j*i] = true;
      }
    }
  }
  ll ans[200010];
  clr(ans,0);
  for(int i = 3;i <= 100000;i += 2)if(!d[i] && !d[(i+1)/2])ans[i]++;
  rep(i,1,100000)ans[i] += ans[i-1];
  cin >> n;
  rep(i,0,n){
    cin >> m >> l;
    print(ans[l]-ans[m-1]);
  }
  return 0;
}

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

string S;
void solve()
{
	int A, B;
  	bool fgA, fgB;
 
  	A = (S[0] - '0')*10 + (S[1] - '0');
    B = (S[2] - '0')*10 + (S[3] - '0');
  
	fgA = fgB = false;
    if(0 < B && B <= 12)
      	fgB = true;
  	if(0 < A && A <= 12)
      	fgA = true;
	if(fgA && fgB)
      cout << "AMBIGUOUS" << endl;
  	else if(fgA && !fgB)
      cout << "MMYY" << endl;
  	else if(!fgA && fgB)
      cout << "YYMM" << endl;
  	else
      cout << "NA" << endl;
}
int main()
{
	cin >> S;
  	solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=1e9+7;

ll n,k,ans=0;

ll get_s(ll l,ll r){
	return (((l+r)*(r-l+1))/2ll)%mod;
} 

int main(){
	cin>>n>>k;
	for(ll i=k;i<=n+1;i++)
        ans=(ans+((get_s(n-i+1,n)-get_s(0,i-1)+1)%mod+mod)%mod)%mod;
	
    cout<<ans%mod<<endl;
	
	return 0;
}

Measured memory_bytes: 3636
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, Y = MAP()

for i in range(N+1):
	for j in range(N+1):
		k = N-i-j
		if k < 0:
			continue
		if 10000*i+5000*j+1000*k == Y:
			print(i, j, k)
			exit()
print(-1, -1, -1)


Measured memory_bytes: 5444