akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	string s;
    cin>>s;
    int l=s.length();
    LL c=0;
    FOR(i,0,l){
        c+=s[i]-'0';
    }
    if(c%9==0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }

}


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

using namespace std;
#define int long long


signed main(){
  string s;cin>>s;
  int n=s[s.size()-1]-'0';
  if(n==2||n==4||n==5||n==7||n==9) cout<<"hon";
  else if(n==0||n==1||n==6||n==8) cout<<"pon";
  else if(n==3) cout<<"bon";
  return 0;
}

Measured memory_bytes: 3564
#include<stdio.h>
#define MAX 100001
#define ZERO -1
 
typedef struct Node{
  int parent; 
  int left,right;
}Tree;
 
Tree tree[MAX];
 
void Treeprint(int);
 
int main(){
  int n,i,j,id,k,child,l;
 
  scanf("%d", &n);
 
  for(i = 0;i < n;i++){
    tree[i].parent = tree[i].left = tree[i].right = ZERO;
  }
   
    for(i = 0;i < n;i++){
      scanf("%d%d",&id,&k);
     
      for(j = 0;j < k;j++){
        scanf("%d",&child); 
        tree[child].parent = id; 
 
        if(j == 0){
          tree[id].left = child;
        }
        else if(j > 0){
          tree[l].right = child;
        }
        l = child;
      }
    }
    for(i = 0;i < n;i++){
      Treeprint(i);
    }
    return 0;
  }
 
  void Treeprint(int n){ 
    int i = tree[n].parent;
    int depth = 0;
    while(i != ZERO){
      i = tree[i].parent;
      depth++;
    }
    if(depth == 0){
      printf("node %d: parent = %d, depth = %d, root, ",n,tree[n].parent,depth);
    }
    else if(tree[n].left == ZERO){
      printf("node %d: parent = %d, depth = %d, leaf, ",n,tree[n].parent,depth);
    }
    else{
      printf("node %d: parent = %d, depth = %d, internal node, ",n,tree[n].parent,depth);
    }
 
    i = tree[n].left;
    printf("[");
    if(i != ZERO){
      printf("%d",i);
    }
    while(i != ZERO){ 
      i = tree[i].right;
 
      if(i != ZERO){
        printf(", %d", i);
      }
    }
    printf("]\n");
  }

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

  const int MOD = 1000000007;

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

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

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

  //素因数分解
  vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
      if(n % i) continue;
      res.emplace_back(i, 0);
      while(n % i == 0){
        n /= i;
        res.back().second++;
      }
    }
  if(n != 1) res.emplace_back(n, 1);
  return res;
  }






  int main(){
    int N;
    cin >> N;
    vector<int> a(N * 3);
    REP(i, N * 3) cin >> a[i];
    sort(all(a));
    reverse(all(a));

    ll ans = 0;
    REP(i, N){
      ans += a.at(1 + (i * 2));
    }
  
  print(ans);
  }




Measured memory_bytes: 1408
#include<stdio.h>
#include<stdlib.h>
int main(void){
    int *h,n,i,j,ans=0;
    scanf("%d",&n);
    h=(int *)malloc(sizeof(int)*n+1);
    for(i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    for(i=0;i<n;i++){
        if(i==0){
            ans++;
            continue;
        }
        for(j=0;j<i;j++){
            if(h[i]<h[j]){
                break;
            }
        }
        if(j==i){
            ans++;
        }
    }
    printf("%d\n",ans);
    free(h);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  int ans=0,t=1;
  for(int i=1;i<n;i++){
    if(a[i]==a[i-1])t++;
    else {
      ans+=t%2;
      t=1;
    }
  }
  ans+=t%2;
  cout << ans << endl;
}

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

int main() {
  int n;
  cin>>n;
  vector<int> q(n-1);
  int ans=0;
  for (int i=0;i<(n-1);++i) {
    cin>>q[i];
  }
  if (n%2==0) {
    int d=n/2;
    ans+=q[0];
    ans+=q[n-2];
    for (int i=1;i<d;++i) {
      ans+=min(q[i-1],q[i]);
      ans+=min(q[n-2-i],q[n-1-i]);
    }
  } else {
    int d=(n-1)/2;
    ans+=q[0];
    ans+=q[n-2];
    for (int i=1;i<d;++i) {
      ans+=min(q[i-1],q[i]);
      ans+=min(q[n-2-i],q[n-1-i]);
    }
    ans+=min(q[d-1],q[d]);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a,b;
  scanf("%d%d",&a,&b);
  int ans=0;
  int out=1;
  while(out<b){
    out-=1;
    out+=a;
    ans+=1;
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int N,W;
int v[110];
int w[110];
int dp[110][10010];
int main(){
	cin>>N>>W;
	for(int i=1;i<=N;i++){
		cin>>v[i]>>w[i];
	} 
	for(int i=0;i<=N;i++){
		dp[i][0]=0;
	}
	for(int j=1;j<=W;j++){
		dp[0][j]=-(1<<30);
	}
	int temp;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=W;j++){
			if(j-w[i]<0){
				temp=-(1<<30);
			}
			else{
				temp=dp[i][j-w[i]]+v[i];
			}
			dp[i][j]=max(dp[i-1][j],temp);
		}
	}
	int Max=dp[N][W]; 
	for(int j=1;j<W;j++){
		if(dp[N][j]>Max){
			Max=dp[N][j];
		}
	}
	cout<<Max<<endl;
	
	return 0;
} 



Measured memory_bytes: 7072
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n-1,-1,-1):
  x=(sum(ans[i::i+1]))%2
  if x!=a[i]:
    ans[i]=1
print(sum(ans))
for i in range(n):
  if ans[i]==1:
    print(str(i+1)+" ",end="")

Measured memory_bytes: 8784
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

using namespace std;

#define LL long long

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

int main() {
	int n;
	string s, t;
	cin >> n;
	cin >> s;
	cin >> t;
	string res = "";
	for (int i = 0; i < s.length(); ++i) {
		res.push_back(s[i]);
		res.push_back(t[i]);
	}
	cout << res << endl;
	return 0;
}

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

int main(){
  int i,j,k,N;
  cin >> N;
  vector<pair<long long,long long>> A(N);
  for(i=0; i<N; i++){
    cin >> A.at(i).first;
    A.at(i).second = i;
  }
  sort(A.begin(),A.end(),greater<>());
  
  vector<vector<long long>> ans(N+1,vector<long long>(N+1,0));
  long long tmp1,tmp2;
  for(i=1; i<=N; i++){
    for(j=0; j<=i; j++){
      k=i-j; tmp1=0; tmp2=0;
      if(k>0) tmp1 = ans.at(k-1).at(j) + A.at(i-1).first*abs(A.at(i-1).second-k+1);
      if(j>0) tmp2 = ans.at(k).at(j-1) + A.at(i-1).first*abs(A.at(i-1).second-N+j);
      ans.at(k).at(j) = max(tmp1,tmp2);
    }
  }
  long long ansNum=0;
  for(i=0; i<=N; i++){
    ansNum = max(ansNum, ans.at(i).at(N-i));
  }
  cout << ansNum;
  return 0;
}

Measured memory_bytes: 34680
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
#include<numeric>
using namespace std;

int INF = 1e9 + 7;

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

ll gcd(ll x, ll y){
	if (y == 0) return x;
	else return gcd(y, x % y);
}

int main() {
	int n;
	vector<ll> t(110);
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> t[i];

	if (n == 1) {
		cout << t[1] << endl;
		return 0;
	}

	ll lcm = (t[1] / gcd(t[1], t[2])) * t[2];
	for (int i = 3; i <= n; i++) {
		ll x = (lcm / gcd(lcm, t[i])) * t[i];
		lcm = max(x, lcm);
	}
	cout << lcm << endl;
}

Measured memory_bytes: 256
import itertools as iters

def enlong(s,m):
    return [s + [i] for i in range(1,m+2)]

N = int(input())
alpha = "abcdefghijk"
R = [[1]]
for _ in range(N-1):
    S = []
    for r in R:
        S += enlong(r,max(r))
    R = S[::]
for r in R:
    s = "".join([alpha[ss-1] for ss in r])
    print(s)


Measured memory_bytes: 79196
#include <stdio.h>
#include <stdlib.h>

int asc(const void *a, const void *b){
  if(*(long *)a > *(long *)b){
    return 1;
  }else if(*(long *)a == *(long *)b){
    asc(a+1, b+1);
  }else{
    return -1;
  }
}

int main(void){
	int i, j, k;

	int n;
	scanf("%d", &n);

	long pos[50][2] = {};
	for(i = 0; i < n; i++){
		scanf("%ld%ld", &pos[i][0], &pos[i][1]);
	}

	qsort(pos, n, sizeof(long)*2, asc);

	long dif[2500][2] = {};
	for(i = 0; i < n-1; i++){
		for(j = i+1; j < n; j++){
			for(k = 0; ; k++){
				if(dif[k][0] == 0 && dif[k][1] == 0){
					dif[k][0] = pos[j][0]-pos[i][0];
					dif[k][1] = pos[j][1]-pos[i][1];
					break;
				}
			}
		}
	}

	int ans = 0, cnt = 0;
	for(i = 0; ; i++){
		if(dif[i][0] == 0 && dif[i][1] == 0) break;
		cnt = 0;
		for(j = i+1; ;j++){
			if(dif[j][0] == 0 && dif[j][1] == 0) break;
			if(dif[j][0] == dif[i][0] && dif[j][1] == dif[i][1] || dif[j][0] == -dif[i][0] && dif[j][1] == -dif[i][1]) cnt++;
		}
		if(cnt > ans) ans = cnt;
	}

	if(n == 1) printf("1\n");
	else printf("%d\n",n-ans-1);

	return 0;
}


Measured memory_bytes: 256
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '(L' << __LINE__ << ')' << ' ' << __FILE__ << endl;


std::map<int, std::set<int> > p;
int n,m;


int main(){
    cin>>n>>m;
    
    int a,b;
    REP(i,m){
        cin>>a>>b;
        
        auto entry= p.find(a);
        if(entry!=p.end()){            
            entry->second.insert(b);

        }
        else{
            p[a].insert(b);
        }
        entry= p.find(b);
        if(entry!=p.end()){
            
            entry->second.insert(a);

        }
        else{
            
            p[b].insert(a);
        }

    }
    int ans=0;
    
    while(1){
        bool unchanged=true;
        for (std::map<int, std::set<int> >::iterator it=p.begin(); it!=p.end(); ++it){
            std::cerr << it->first << " => " << it->second.size() << '\n';

            for(auto x : it->second) {
                std::cerr << x << "\n";     // 要素を順に表示
             }
       
        if(it->second.size()==1){
            int f=it->first;
            int s;
            for(int x : it->second) {
                s= x;   // 要素を順に表示
            }
            p[f].erase(s);
            p[s].erase(f);
            ans++;
            unchanged=false;
        }
    }
    if(unchanged){break;}
    
    }


    cout<<ans<<endl;;

}


Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,m = mi()
alis = li()

alis.sort()
ok = 0
ng = alis[n-1] * 2 +1
from bisect import bisect_left as bl
while ng - ok >1:
    mid = (ok + ng)//2
    ima = 0
    for i in range(n):
        ima += n - bl(alis,mid-alis[i])
    if ima >= m:
        ok = mid
        outrange = ima - m
    else:
        ng = mid

acu_alis = [0]*n
ima = 0
for i in range(n):
    acu_alis[i] = alis[i] + ima
    ima = alis[i] + ima

ans = 0
for i in range(n):
    tmp = bl(alis,ok-alis[i]) 
    if tmp ==0:
        ans += n*alis[i] + acu_alis[n-1]
    else:
        ans += (n-tmp)*alis[i] + acu_alis[n-1] - acu_alis[tmp-1]
ans -= outrange*ok
print(ans)




Measured memory_bytes: 14028
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#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';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

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

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

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    int n, p[200200];
    cin >> n;
    rep(i, n) cin >> p[i];

    int ans = 0;
    int t = INF;
    rep(i, n) {
        if (t >= p[i]) ans += 1;
        t = min(t, p[i]);
    }

    print(ans);

    return 0;
}



Measured memory_bytes: 1024
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
using namespace std;
using ll = long long;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  int S=0;
  for(int i=0;i<N;i++){
    cin >> A[i];
    S=(S^A[i]);
  }
  for(int i=0;i<N;i++){
    cout << (S^A[i]);
    if(i!=N-1){
      cout << " ";
    }
  }
  cout << endl;
}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair <int,int> PAIR;
const int N = 1e5+5;
const ll M = 11092019;

ll c[15],p[15][15],temp[15];

inline bool check(int m,ll x){
	for(int i = 1;i <= m;++i){
		if(temp[i] < x) return 0;
	}
	return 1;
}

int main() {
	int n,m,x;
	scanf("%d%d%d",&n,&m,&x);
	
	for(int i = 0;i < n;++i){
		scanf("%lld",&c[i]);
		for(int j = 1;j <= m;++j)
			scanf("%lld",&p[i][j]);
	}
	
	ll ans = 2e18;
	for(int base = 0;base < (1 << n);++base){
		ll cnt = 0;
		memset(temp,0,sizeof(temp));
		for(int i = 0;i < n;++i){
			if((1 << i) & base){
				cnt += c[i];
				for(int j = 1;j <= m;++j)
					temp[j] += p[i][j];
			}
		}
		//printf("%d %lld\n",base,cnt);
		if(check(m,x)) ans = min(ans,cnt);
	}
	
	if(ans == 2e18) printf("-1\n");
	else printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3828
/*-----------------------------------
                -----------MEHEDI HASAN--------------
                -----CSE,JAHANGIRNAGAR UNIVERSITY----
                -----------------------------------*/
//--------------------------------------------------------------------//
#include<bits/stdc++.h>
#include <cassert>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
//--------------------------------------------------------------------//
#define FAST        ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
#define cc(x)       cout<<#x<<"="<<x<<" ";
#define ccc(x)      cout<<x<<" ";
#define ccp(x)      cout<<#x<<"="<<"("<<x.ff<<" "<<x.ss<<") ";
#define CC(x)       for(auto xx: x) cout<<xx<<" ";
#define CCp(x)      for(auto xx: x) cout<<"("<<xx.ff<<" "<<xx.ss<<") ";
#define ee          cout<<"\n";
#define OK          cout<<"Ok"<<"\n";
//--------------------------------------------------------------------//
#define ff          first
#define ss          second
#define ll          long long
#define ull         unsigned long long
#define pii         pair<int,int>
#define mp          make_pair
#define ps          push
#define psb         push_back
#define psf         push_front
#define pp          pop
#define ppb         pop_back
#define ppf         pop_front
#define all(x)      x.begin(),x.end()
#define TESTS       int t;cin>>t;for(int tcase=1;tcase<=t;tcase++)
#define ordered_set tree< int, null_type, less_equal< int >, rb_tree_tag, tree_order_statistics_node_update>
//--------------------------------------------------------------------//
#define MAX (int)(3e6)
#define MOD (ll)(1e9+7)


int main()
{
//    FAST
    ll x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    vector <ll> A(a),B(b);
    multiset <ll> C;
    for(ll &x : A) cin>>x;
    for(ll &x : B) cin>>x;
    for(int i=0;i<c;i++)
    {
        ll x; cin>>x ; C.insert(x);
    }
    sort(all(A));sort(all(B));
    vector <ll> T;
    int p=a-1;
    for(int i=0;i<x;i++) T.psb(A[p--]);
    p=b-1;
    for(int i=0;i<y;i++) T.psb(B[p--]);
    sort(all(T));
    ll sum=0ll;
    for(int i=0;i<T.size();i++)
    {
        auto it=C.end();
        if(C.size()!=0)
        {
            it--;
            if(*it>T[i])
            {
                sum+=*it;
                C.erase(it);
            }
            else
            {
                sum+=T[i];
            }
        }
        else
        {
            sum+=T[i];
        }

    }
    cout<<sum<<endl;
    return 0;
}
//--------------------------------------------------------------------//
/*
>Check Corner Cases (n==1 or T==1)
>Overflow issues?
>LB / UB !!not found!! check?
*/
//--------------------------------------------------------------------//
/* ---INPUT---
--------(1)------
2
1 2 4

-------(2)-------


-------(3)-------
4
1 2 2
1 3 4
3 4 5

-------(4)-------



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


Measured memory_bytes: 8692
//By Vlgd
#include<bits/stdc++.h>
using namespace std;
int A[100];
void s(int n){
	for (int i=0;i<n;i++){
		printf("%d",A[i]);
		if(i==n-1)printf("\n");
		else printf(" ");
	}
}
int main(){
	int n;scanf("%d",&n);
	for (int i=0;i<n;i++) scanf("%d",&A[i]);s(n);
	for (int i=1;i<n;i++){
		int j=i-1,v=A[i];
		while (j>=0 && A[j]>v){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		s(n);
	}
}


Measured memory_bytes: 3188
#include<stdio.h>

int main(void){
  int a,b;
  scanf("%d%d",&a,&b);
  if(a==1 && b==1) printf("Draw\n");
  else if(a==1 && b!=1) printf("Alice\n");
  else if(a!=1 && b==1) printf("Bob\n");
  else{
    if(a>b) printf("Alice\n");
    else if(a<b) printf("Bob\n");
    else printf("Draw\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
main(){
  int n,i,sum;
  double a=100000,b=100000;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    a=a*1.05;
    b=b*0.05;

    sum=a-b;
    sum=sum%1000;

    if(sum!=0){
    sum=1000-sum;
    a+=sum;
    }
    b=100000;
  }
  
  printf("%.0f\n",a);
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

#define MOD 1000000007

typedef long long ll;

ll pow (ll a, ll n) {
	if (n==0)
		return 1;
	if (n==1)
		return a;
	ll tmp = pow (a, n/2);
	ll tmp2 = tmp * tmp;
	tmp2 %= MOD;
	if (n%2==0)
		return tmp2;
	return tmp2*a % MOD;
}

int main () {
	ll N;
	cin >> N;
	ll ans = (pow(10,N) + pow(8,N)) % MOD;
	ans += MOD - 2*pow(9,N)%MOD;
	ans %= MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
// #include "prettyprint.hpp"

int main() { 
  int X, Y;
  cin >> X >> Y;
  cout << (X + Y / 2) << endl;
  return 0;
}

Measured memory_bytes: 256
z=input()
sa,sb,sc,sd=z[0],z[1],z[2],z[3]
a,b,c,d=int(z[0]),int(z[1]),int(z[2]),int(z[3])
if a+b+c+d==7:
    print(sa+'+'+sb+'+'+sc+'+'+sd+'=7')
elif a+b+c-d==7:
    print(sa+'+'+sb+'+'+sc+'-'+sd+'=7')
elif a+b-c+d==7:
    print(sa+'+'+sb+'-'+sc+'+'+sd+'=7')
elif a+b-c-d==7:
    print(sa+'+'+sb+'-'+sc+'-'+sd+'=7')
elif a-b+c+d==7:
    print(sa+'-'+sb+'+'+sc+'+'+sd+'=7')
elif a-b+c-d==7:
    print(sa+'-'+sb+'+'+sc+'-'+sd+'=7')
elif a-b-c+d==7:
    print(sa+'-'+sb+'-'+sc+'+'+sd+'=7')
else:
    print(sa+'-'+sb+'-'+sc+'-'+sd+'=7')

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

int main() {
    int N,K;
    cin >> N >> K;
    vector<int> h(N);
    for(int i=0;i<N;i++){
        cin >> h.at(i);
    }
    int count=0;
    for(int i=0;i<N;i++){
        if(h.at(i)>=K) count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
 
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>=0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
 
const int mod = 1e9 + 7;
const ll INF = 1<<30;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
int n,k;
int ldp[5005][5005];
int rdp[5005][5005];
 
int main(){
    scanf("%d%d",&n,&k);
    vi a(n);
    rep(i,n) scanf("%d",&a[i]);
    rep(i,n){
        ldp[i][0]=1;rdp[i][0]=1;
        if (a[i]<k) ldp[i][a[i]]=1;
        if (a[n-1-i]<k) rdp[i][a[n-1-i]]=1;
    }
    rep2(i,1,n)rep(j,k){
            if (j-a[i]>=0) ldp[i][j]|=ldp[i-1][j-a[i]]|ldp[i-1][j];
            else ldp[i][j]|=ldp[i-1][j];
            if (j-a[n-1-i]>=0) rdp[i][j]|=rdp[i-1][j-a[n-1-i]]|rdp[i-1][j];
            else rdp[i][j]|=rdp[i-1][j];
    }
    rep(i,n)rep2(j,1,k){
        rdp[i][j]+=rdp[i][j-1];
    }
    int cnt=0;
    int lnum=0;
    rep(i,n){
        if (k-a[i]<=0){
            cnt+=1;
            continue;
        }
        rep(j,k){
            if (i==0) lnum=0;
            else if (i==n-1){
                if (ldp[i-1][j] && a[i]+j>=k){
                    cnt+=1;
                    break;
                }
                continue;
            }
            else{
                if (ldp[i-1][j]) lnum=j;
                else continue;
            }
            if (k-a[i]-lnum<=0){
                cnt+=1;
                break;
            }
            if (rdp[n-2-i][k-1-lnum]-rdp[n-2-i][k-a[i]-lnum-1]){
                cnt+=1;
                break;
            }
        }
    }
    cout << n-cnt << endl;
    return 0;
}

Measured memory_bytes: 195840
///not today

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

#define SZ(x) (int)(x).size()
#define pb push_back
#define ll long long
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
//#define int long long
#define pipii pair<int, pair<int, int> >
#define pf push_front

const int maxn = 30005;
int r[20], nxt[maxn][20];

bool f(int a, int b, int c){
    int pt = r[a];
    if(pt == -1)
        return false;
    if(nxt[pt][b] != -1)
        pt = nxt[pt][b];
    else
        return false;
    if(nxt[pt][c] == -1)
        return false;
    return true;
}

int32_t main(){
    int n;
    string s;
    cin >>n >>s;
    for(int i = 0; i < 10; i ++)
        r[i] = -1;
    for(int i = n - 1; i >= 0; i --){
        for(int j = 0; j < 10; j ++)
            nxt[i][j] = r[j];
        r[s[i] - '0'] = i;
    }
    int ans = 0;
    for(int i1 = 0; i1 < 10; i1 ++){
        for(int i2 = 0; i2 < 10; i2 ++){
            for(int i3 = 0; i3 < 10; i3 ++){
                if(f(i1, i2, i3)){
                    ans ++;
                }
            }
        }
    }
    cout <<ans <<endl;
}


Measured memory_bytes: 2688
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

typedef tuple<ll,ll,ll> e;

vector<ll> uft;

ll parent(ll a){
    if(uft[a]==a){return a;}
    return uft[a]=parent(uft[a]);
}

int main(){
    ll n,m;
    while(cin>>n>>m){
        if(n==0){break;}
    uft.resize(n);
    for(int i=0;i<n;i++){uft[i]=i;}
    priority_queue<e,vector<e>,greater<e>> Q;
    for(int i=0;i<m;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        a--; b--;
        Q.push(make_tuple(c,a,b));
    }
    ll ans=-1;
    ll count=0;
    while(!Q.empty()){
        e W=Q.top(); Q.pop();
        if(parent(get<1>(W))!=parent(get<2>(W))){
            count++;
            if(count==n/2){ans=get<0>(W);}
            uft[parent(get<1>(W))]=parent(get<2>(W));
        }
    }
    cout<<ans<<endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 3452
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;


int main(){
  int n;
  cin >> n;
  vector<int> t(n+1,0);
  vector<int> x(n+1,0);
  vector<int> y(n+1,0);
  rep(i,n){
    cin >> t[i+1] >> x[i+1] >> y[i+1];
    int dis = abs(x[i+1]+y[i+1]-x[i]-y[i]);
    int cnt = t[i+1]-t[i];
    if(dis<=cnt && (cnt-dis)%2==0){ continue; }else{ cout << "No" << endl; return 0; }
  }
  
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n; cin >> n;
  Yes(30 <= n);

  return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int check(int n,int a,int b){
    int tmp=n;
    int sum=0;
    while(tmp){
        sum+=tmp%10;
        tmp/=10;
    }
    if(a<=sum&sum<=b){
        return 1;
    }else{
        return 0;
    }

    
}
int main(void){
int n,a,b;
cin>>n>>a>>b;
int ans=0;
for (int i=1;i<=n;i++){
    if(check(i,a,b)){
        ans+=i;
    }
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

int bad[N];
void solve()
{
	ll n;
	cin >> n;
	ll a[n];
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	int res = 0, mx = -1;
	for(int i = 0; i < n - 1; ++i){
		int cur = min(a[n - 1] - a[i], a[i]);
		if(cur > mx){
			mx = cur;
			res = a[i];
		}
	}
	cout << a[n - 1] << ' ' << res << '\n';
	
}


 
 
int main()
{
    Red;
  	//int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;
typedef pair<int, int> P;
int main()
{
  map<char, P> v;
  v['N'] = P(1, 0);
  v['E'] = P(0, 1);
  v['S'] = P(-1, 0);
  v['W'] = P(0, -1);
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;
    bool daiya[21][21];
    FOR(i,0,21) FOR(j,0,21) daiya[i][j] = false;
    FOR(i,0,n) {
      int x, y;
      cin >> x >> y;
      daiya[y][x] = true;
    }
    int m;
    cin >> m;
    int nx = 10, ny = 10;
    int cnt = 0;
    FOR(i,0,m) {
      char c;
      int d;
      cin >> c >> d;
      FOR(j,0,d) {
        ny += v[c].first;
        nx += v[c].second;
        if(daiya[ny][nx]) {
          cnt++;
          daiya[ny][nx] = false;
        }
      }
    }
    if(cnt == n) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
  return 0;
}

Measured memory_bytes: 2996
n,k,c = map(int, input().split())
s=input()
l=[-1] * k
r=[-1] * k
cnt=0
last=-float("inf")
for i in range(n):
    if last+c < i and s[i] == "o":
        last=i
        l[cnt]=i
        cnt+=1
        if cnt==k:
            break

cnt=0
last=float("inf")
for i in reversed(range(n)):
    if i < last-c and s[i] == "o":
        last=i
        r[cnt]=i
        cnt+=1
        if cnt==k:
            break

r=list(reversed(r))
for i in range(k):
    if l[i]==r[i]:
        print(l[i]+1)

Measured memory_bytes: 52812
//2020.1.6
//s1270188 xxxmk2
//alds1_07c

#include<stdio.h>
#include<stdlib.h>

//struct
typedef struct{
  int p, l, r;
}node;

//prototype
void pre(int);
void in(int);
void post(int);

//global
node *data;

int main(){
  int i, a, cnt, num, root;

  //input
  scanf("%d",&num);
  data=(node *)malloc(sizeof(node)*num);
  for(i=0;i<num;i++) data[i].p=-1;
  for(i=0;i<num;i++){
    scanf("%d",&a);
    scanf(" %d %d",&data[a].l,&data[a].r);
    data[data[a].l].p=a;
    data[data[a].r].p=a;
  }

  //find root
  i=0;
  while(data[i].p!=-1) i++;
  root=i;
  
  //preorder
  printf("Preorder\n");
  pre(root);
  printf("\n");
  
  
  //inorder
  printf("Inorder\n");
  in(root);
  printf("\n");
  
  //postorder
  printf("Postorder\n");
  post(root);
  printf("\n");
  
  free(data);
  return 0;
}

void pre(int n){
  printf(" %d",n);

  if(data[n].l!=-1) pre(data[n].l);
  if(data[n].r!=-1) pre(data[n].r);
}

void in(int n){
  if(data[n].l!=-1) in(data[n].l);

  printf(" %d",n);

  if(data[n].r!=-1) in(data[n].r);
}

void post(int n){

  if(data[n].l!=-1) post(data[n].l);
  if(data[n].r!=-1) post(data[n].r);

  printf(" %d",n);
}






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

int main() {
  int n,m;cin>>n>>m;
  map<int,int> ac,wa;
  int cnt1=0,cnt2=0;
  rep(i,m){
    int p;string s;cin>>p>>s;
    if(s=="WA")wa[p]++;
    else {
      if(ac[p]==0){
        cnt2+=wa[p];
        ac[p]=1;
        cnt1++;
      }
    }
  }
  cout<<cnt1<<" "<<cnt2<<endl;
}

Measured memory_bytes: 12976
#include<iostream>
#include<algorithm>
#include<vector>
#include<iterator>
#include<string>
#include<map>
#include<set>
#include<list>
using namespace std;
#define endl "\n"
#define ll long long
const int N = 1e5 + 5;
const unsigned int M = 1000000007;
ll a[N]; 
 
int main ()
{
  ios_base::sync_with_stdio (false);
  cin.tie (NULL);
  int r,g,b;
  cin>>r>>g>>b;
  int k;
  cin>>k;
  while(g<=r and k!=0)
  {
    g*=2;
    k--;
  }

  if(g<=r)
    cout<<"No";
  else
  {
    while(b<=g and k!=0)
    {
      b*=2;
      k--;
    }

    if(b<=g)
      cout<<"No";
    else
      cout<<"Yes";
  }
  

  return 0;
}


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

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

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const ll MOD = 1e9 + 7;
const double PI = 3.1415926535897932384626433832795;

int main()
{
	int a = 0, b = 0, c = 0;
	string s;
	cin >> s;
	if (s[0] == 'a')
	{
		a++;
	}else{
		if(s[0] == 'b'){
			b++;
		}else{
			c++;
		}
	}
	if (s[1] == 'a')
	{
		a++;
	}else{
		if(s[1] == 'b'){
			b++;
		}else{
			c++;
		}
	}
	if (s[2] == 'a')
	{
		a++;
	}else{
		if(s[2] == 'b'){
			b++;
		}else{
			c++;
		}
	}
	if(a == 1 && b==1 && c==1){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
	return 0;
}

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

using namespace std;


#define fr(i,a,b) for (long long int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (long long i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)
#define foreach(it,ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
#define debug(x) cout<<#x<<": "<<x<<endl
#define ull unsigned long long
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second


#define PI 3.1415926535897932385
#define INF 1000111222
#define EPS 1e-7
#define MAXN 1000001
#define MOD 1000000007
                                           /*ASHWINI SHARMA*/
void pairsort(ll a[], ll b[], ll n)
{
    pair<ll, ll> pairt[n];

    // Storing the respective array
    // elements in pairs.
    for (ll i = 0; i < n; i++)
    {
        pairt[i].first = a[i];
        pairt[i].second = b[i];
    }

    // Sorting the pair array.
    sort(pairt, pairt + n);

    // Modifying original arrays
    for (ll i = 0; i < n; i++)
    {
        a[i] = pairt[i].first;
        b[i] = pairt[i].second;
    }
}

int main() {
    cin.sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    ll A, B;
    if(a == 0)
    A = 0;
    else
    a--;
    if(a % 4 == 0)
    A = a;
    if(a % 4 == 1)
    A = 1;
    if(a % 4 == 2)
    A = a+1;
    if(a % 4 == 3)
    A = 0;
    if(b % 4 == 0)
    B = b;
    if(b % 4 == 1)
    B = 1;
    if(b % 4 == 2)
    B = b+1;
    if(b % 4 == 3)
    B = 0;
    ll bit = 0;
    while(b != 0)
    {
    	b /= 2;
    	bit++;
    }
    
    ll xa[bit];
    ll xb[bit];
    rep(i, bit)
    {
    	if(A % 2 == 0)
    	xa[i] = 0;
    	else
    	xa[i] = 1;
    	A /= 2;
    }
    rep(i, bit)
    {
    	if(B % 2 == 0)
    	xb[i] = 0;
    	else
    	xb[i] = 1;
    	B /= 2;
    }
    ll num[bit];
    ll ans = 0;
    rep(i, bit)
    {
    	if(xb[i] == xa[i])
    	num[i] = 0;
    	else
    	num[i] = 1;
    	ans += num[i] * pow(2, i);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


dp = [[0]*101 for _ in range(10)]

dp[0][0] = 1
for i in range(0,10):
    for num in range(9,0,-1):
        for tmp_sum in range(i,101):
            dp[num][tmp_sum] += dp[num-1][tmp_sum-i]

while True:
    N,S = map(int,input().split())
    if N == 0 and S == 0:
        break
    print("%d"%(dp[N][S]))


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


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

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

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








int main() {
    ll n, q;
    string s;
    cin >> n >> q >> s;
    vector<ll> a(n + 1);
    for(ll i = 1; i < n; i++){
        a[i + 1] = a[i];
        if(s[i] == 'C' && s[i - 1] == 'A'){
            a[i + 1]++;
        }
    }
    REP(i, q){
        ll l, r;
        cin >> l >> r;
        cout << a[r] - a[l] << endl;
    }
}

Measured memory_bytes: 1792
#include<cstdio>

int main(){
    int n;
    scanf("%d", &n);
    int l[n];
    for(int i=0;i<n;i++) scanf("%d", &l[i]);

    if(n<3) printf("0");
    else{
        int ans = 0;
        for(int i=0;i<n-2;i++){
            for(int j=i+1;j<n-1;j++){
                for(int k=j+1;k<n;k++){
                    int x = l[i];
                    int y = l[j];
                    int z = l[k];
                    if(x != y && y != z && z != x && x+y > z && y+z>x && z+x>y) ans++;
                }
            }
        }
        printf("%d",ans);
    }
    return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
  string s;
  cin >> s;
  int len = s.size();
  int ans = 0;
  for (int i = 0;i < len; i++){
    ans += stoi(s.substr(i,1));
  }
  if (ans%9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll a,b,c;
    cin >>a>>b>>c;
    
    cout << min({a+b,a+c,b+c}) << endl;


    return 0;
    

}

Measured memory_bytes: 3628
# AOJ 0081 A Symmetric Point

# 2 元 1 次方程式を解く
def solve_eq(eq)
  m = []
  m << eq[0..2]
  m << eq[3..5]

  # 前進消去
  r0 = m[0][0]
  m[0].map! {|x| x / r0}
  r1 = -m[1][0]
  m[1].map!.with_index {|x, i| x + r1 * m[0][i]}

  # 後退消去
  r1 = m[1][1]
  m[1].map! {|x| x / r1}
  r0 = -m[0][1]
  m[0].map!.with_index {|x, i| x + r0 * m[1][i]}

  [m[0][2], m[1][2]]
end

# データから対称点の座標を求める
# P1 P2 の方程式：(y2 - y1) * x + (x1 - x2) * y = x1 * y2 - x2 * y1
# QR の方程式：(x2 - x1) * x + (y2 - y1) * y = (y2 - y1) * yq + (x2 - x1) * xq
def solve(data)
  x1, y1, x2, y2, xq, yq = data

  if (x1 == x2)
    [xq + 2 * (x1 - xq), yq]
  elsif (y1 == y2)
    [xq, yq + 2 * (y1 - yq)]
  else
    xc, yc = solve_eq([
      y2 - y1, x1 - x2, x1 * y2 - x2 * y1,
      x2 - x1, y2 - y1, (y2 - y1) * yq + (x2 - x1) * xq
    ])
    [xq + 2 * (xc - xq), yq + 2 * (yc - yq)]
  end
end

ARGF.each_line.map {|line| line.split(",").map {|x| x.to_f}}.each do |data|
  puts solve(data).join(" ")
end

Measured memory_bytes: 6164
package main

import (
	"fmt"
	"os"
)

func run() int {
	var n int
	fmt.Scanf("%d\n", &n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}

	approved := true
	for _, i := range a {
		if i%2 == 0 {
			if i%3 != 0 && i%5 != 0 {
				approved = false
				break
			}
		}
	}

	if approved {
		fmt.Println("APPROVED")
	} else {
		fmt.Println("DENIED")
	}
	return 0
}

func main() {
	os.Exit(run())
}


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

#define sz(x) int(x.size())
#define pii pair<int, int>
#define Task "abc"
#define For(i, a, b) for(int i = (a), _b = (b); i <= b; ++i)
#define Debug(X) cout << #X << " = " << X << '\n'
#define all(x) (x).begin(), (x).end()
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;

const int maxn = 200010;
const int inf = 0x3f3f3f3f;

int n, k;
int a[maxn];

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin);
  cin >> k >> n;
  for (int i = 0; i < n; ++i){
    cin >> a[i];
  }
  int ans = k;
  for (int i = 0; i < n - 1; ++i){
    ans = min(ans, k + a[i] - a[i + 1]);
  }
  ans = min(ans, a[n - 1] - a[0]);
  cout << ans;
return 0;
}



Measured memory_bytes: 1024
// luogu-judger-enable-o2
#include<cstdio>
#include<iostream>
#include<string>
using namespace std;
string s;
int main(){
	cin>>s;
	int len=s.length();
	if (s[0]==s[len-1]){
		if (len&1) puts("Second");
		else puts("First");
	}
	else{
		if (len&1) puts("First");
		else puts("Second");
	}
	return 0;
}

Measured memory_bytes: 512
L, R = (int(i) for i in input().split())

d = R - L
if d > 2019:
  d = 2019

min_r  = 2018
for i in range(L, L+d+1):
  for j in range(i+1, L+d+1):
    r = i*j % 2019
    if r < min_r:
      min_r = r

print(min_r)

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

typedef long long ll;

ll n,a[200000],cnt[200001],sum;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		cnt[a[i]]++;
	}
	for(int i=0;i<200001;i++){
		sum+=(cnt[i]*(cnt[i]-1))/2;
	}
	for(int i=0;i<n;i++){
		cout<<sum-cnt[a[i]]+1<<endl;
	}
}


Measured memory_bytes: 4736
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

bool solve(string s) {
	int n = s.size();

	for (int i = 0; i < n; i += 2) {
		if (s[i] != 'R' && s[i] != 'U' && s[i] != 'D') {
			return false;
		}
	}

	for (int i = 1; i < n; i += 2) {
		if (s[i] != 'L' && s[i] != 'U' && s[i] != 'D') {
			return false;
		}
	}

	return true;
}

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

	string s;
	cin >> s;

	cout << (solve(s) ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int f(int n){
    int b = 0;
    while(n){
        b = n%10;
        n /= 10;
    }
    return b;
}

int b(int n){
    return n%10;
}

int main(){
    int n;  cin >> n;
    vector<vector<int> >c(10, vector<int>(10));
    for(int i = 1; i <= n; i++){
        c[f(i)][b(i)]++;
    }
    int ans = 0;
    rep(i, 10)  rep(j, 10){
        ans += c[i][j] * c[j][i];
    }
    cout << ans << endl;
}


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

#define LL long long

#define FOR(INDEX, START, END) for (int INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (int INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
    int A, B;
    cin >> A >> B;
    
    if ((A % 2) != 0 && (B % 2) != 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256