akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;

int count(int n)
{
	int ans = 0;
	while(n%2 == 0)
	{
		n = n/2;
		ans++;
	}

	return ans;
}

int main()
{
	FAST;
	int n;
	cin >> n;


	int ans = -1;
	for(int i=0 ; i<=20 ; i++)
	{
	    if(1<<i <= n)   ans = 1<<i;
	}

	cout << ans;
	return 0;
}

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

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

    string s;
    cin >> s;
    bool a = false, b = false;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'A') a = true;
        else b = true;
    }

    if(a and b) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
char s[4005],t[4005];
int u[4005],m,i,n,j,c;
int main(){
	for(;~scanf(" %s %s",s+1,t+1);c=i=m=!printf("%d\n",m)){
		for(n=strlen(s+1)+1;!i|t[i];i++)
			for(j=n;--j;m<c?m=c:0)
				u[j+1]=c=s[j]-t[i]?0:u[j]+1;
		
	}
	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    string a,b,s; cin >> a >> b >> s;
    bool ok = 1;
    REP(i,stoi(a)) if(s[i]=='-') ok = 0;
    if(s[stoi(a)]!='-') ok = 0;
    FOR(i,stoi(a)+1,s.size()) if(s[i]=='-') ok = 0;
    Yn(ok);

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007
#define EPS 1e-9

typedef vector<long double> vec;
typedef vector<vec> mat;

mat operator*(const mat& a,const mat& b){
  int N=a.size();
  mat res(N,vec(N,0));
  for(int i=0;i<N;i++)res[i][i]=0;
  for(int i=0;i<N;i++){
    for(int k=0;k<N;k++){
      for(int j=0;j<N;j++){
         res[i][j]+=a[i][k]*b[k][j];
      }
    }
  }
  return res;
}

mat mat_pow(mat a,ll n){
  int N=a.size();
  mat res(N,vec(N));
  rep(i,N)res[i][i]=1;
  while(n>0){
    if(n&1)res=res*a;
    a=a*a;
    n>>=1;
  }
  return res;
}

vec gauss_jordan(const mat& A,const vec& b){
  int n=A.size();
  mat B(n,vec(n+1));
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      B[i][j]=A[i][j];
    }
    B[i][n]=b[i];
  }

  for(int i=0;i<n;i++){
    int piv=0;
    for(int j=i;j<n;j++){
      if(abs(B[j][i])>abs(B[piv][i]))piv=j;
    }
    swap(B[i],B[piv]);
    if(abs(B[i][i])<EPS)return vec();
    for(int j=i+1;j<=n;j++)B[i][j]/=B[i][i];
    for(int j=0;j<n;j++){
      if(i!=j){
        for(int k=i+1;k<=n;k++)B[j][k]-=B[j][i]*B[i][k];
      }
    }
  }
  vec x(n);
  for(int i=0;i<n;i++)x[i]=B[i][n];
  return x;
}

ll S,N,K;
ll dp[201][201];
ll tot;
long double p[201];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>S>>N>>K;
  S=llabs(S);
  if(N==1){
    if(S%K==0){
      printf("%lld\n", S/K);
    }else{
      printf("-1\n");
    }
    return 0;
  }
  tot=1;
  rep(i,K)tot*=N;
  dp[0][0]=1;
  ll M=N*K;
  rep(i,K)rep(j,M+1){
    if(dp[i][j]==0)continue;
    repl(d,1,N+1)dp[i+1][j+d]+=dp[i][j];
  }
  rep(i,M+1)p[i]=(long double)dp[K][i]/(long double)tot;

  mat A(M,vec(M,0));
  vec b(M,1);
  A[0][0]=1;
  b[0]=0;
  repl(i,1,M){
    A[i][i]++;
    for(ll s=K;s<=M;s++){
      if(s<=i) A[i][i-s]-=p[s];
      else A[i][s-i]-=p[s];
    }
  }
  vec prf=gauss_jordan(A,b);
  if(S<M){
    printf("%.10Lf\n", prf[S]);
    return 0;
  }
  reverse(all(prf));
  mat B(M+1,vec(M+1,0));
  rep(j,M)B[0][j]=p[j+1];
  B[0][M]=1;
  repl(i,1,M)B[i][i-1]=1;
  B[M][M]=1;
  mat pB=mat_pow(B,S-M+1);
  long double res=0;
  rep(j,M)res+=pB[0][j]*prf[j];
  res+=pB[0][M];
  printf("%.10Lf\n", res);

  return 0;
}



Measured memory_bytes: 3876
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <cmath>

#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;


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

    vector<int> minFactor(1000005);
    rep(i,1000005){
        for(int j = 2; j * j <= i; j++){
            if(i % j == 0) {
                minFactor[i] = j;
                break;
            }
        }
        if(minFactor[i] == 0) minFactor[i] = i;
    }

    vector<int> a(n);
    int G = a[0];
    rep(i,n) {
        cin >> a[i];
        G = gcd(G,a[i]);
    }
    if(G != 1){cout << "not coprime" << endl; return 0;}

    map<int,int> mp;
    rep(i,n){
        while(a[i] != 1){
            if(mp[minFactor[a[i]]] > 0) {
                cout << "setwise coprime" << endl;
                return 0;
            }
            mp[minFactor[a[i]]]++;
            int A = a[i];
            while(a[i] % minFactor[A] == 0) {
                a[i] = a[i] / minFactor[A];
            }
        }
    }
    cout << "pairwise coprime" << endl;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<long long int> block(3);
    for(int i=0; i<3; i++)
        cin >> block.at(i);
    sort(block.begin(),block.end());
    if(block.at(0)%2==0 || block.at(1)%2==0 || block.at(2)%2==0)
        cout << 0 << endl;
    else
        cout << block.at(0)*block.at(1) << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define fout(x) cout << fixed << setprecision(10) << x << endl
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

auto print = [](auto &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
};

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

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

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  VL a(n), b(n), c(n);
  ll l = 1;
  bool flag = true;
  rep(i, n) {
    cin >> a[i];
    b[i] = a[i] / 2;
    l = lcm(l, b[i]);
    if(l > m) {
      flag = false;
      break;
    }
  }
  if(flag) {
    rep(i, n) {
    c[i] = l / b[i];
    if(c[i] % 2 == 0) flag = false;
    }
  }
  ll ans = 0;
  if(flag) {
    ans = ceil((m / l + 1) / 2);
  }
  out(ans);


  return 0;
}


Measured memory_bytes: 2560
#include <iostream>


using namespace std;

#define vi vector<int>
#define pb push_back
#define ll long long
#define qi queue<int>
#define vll vector<long long>
#define si set<int>
#define mi map<int,int>
#define mod %
#define frt(i,a,b) for(int i=a;i<b;i++)
#define fre(i,a,b) for(int i=a;i<=b;i++)
#define pair_int pair<int,int>
#define pair_ll pair<ll,ll>
#define pq priority_queue
#define N 100007

ll M = 1000000007;
ll dp[3001][3001];

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

   ll a[n+1];
   frt(i,1,n+1)
   	cin >> a[i];
  	
  	for(int sz=1; sz<=n;sz++)
  	{

  		for(int st=1;st+sz-1<=n;st++)
  		{
  			int ed = st+sz-1;
  			int mv;
  			if(n mod 2 == sz mod 2)
  			{
  				if(st==ed)
  					dp[st][sz] = a[st];
  				else
  					dp[st][sz] = max(a[st] + dp[st+1][sz-1], a[ed] + dp[st][sz-1]);
  				
  			}
  			else
  			{
  				if(st==ed)
  					dp[st][sz] = -a[st];

  				else
  					dp[st][sz] = min(-a[st] + dp[st+1][sz-1], -a[ed] + dp[st][sz-1]);
  				
  			}


  		}

  	}

   cout << dp[1][n] << endl;
   return 0;

}

  


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

const ll INF = 1001001001;
const ll mod = 1000000007;

ll dp[105][11];

int main(){
    int h, w, k; cin >> h >> w >> k;
    dp[0][1] = 1;
    for(int i = 1; i <= h; i++){
        for(int l = 1; l <= w; l++){
            ll a = 0, b = 0, c = 0;
            for(int j = 0; j < (1 << w-1); j++){
                bool ok = true;
                for(int m = 0; m < w - 2; m++){
                    if(j & (1 << (m + 1)) && j & (1 << m)) ok = false;
                }
                if(!ok) continue; 
                int mask1 = 1 << (l - 1), mask2 = 1 << (l - 2);
                if(l >= 2 && (mask2 & j)) a++;
                else if(mask1 & j) c++;
                else b++;
            }
            dp[i][l] = (dp[i-1][l-1]*a%mod+dp[i-1][l]*b%mod + dp[i-1][l+1]*c%mod)%mod;
        }
    }
    cout << dp[h][k] << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};


int main(){
  Sieve sieve(1e6);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    cin >> a[i];
  }
  map<int, int> gcdfactor;
  map<int, int> factornum;
  auto f0 = sieve.factor(a[0]);
  for(auto p: f0){
    gcdfactor[p.first]=p.second;
    factornum[p.first]=p.second;
  }
  bool pairwise=true;
  repo(i, n-1){
    auto f = sieve.factor(a[i]);

    map<int, int> mp;
    for(auto p: f){
      mp[p.first]=p.second;
      if(factornum[p.first]>0){
        pairwise=false;
      } else {
        factornum[p.first]=p.second;
      }
    }

    for(auto p: gcdfactor){
      /*
      if(min(mp[p.first], p.second)>=1){
        pairwise=false;
      }
      */

      gcdfactor[p.first]=min(mp[p.first], p.second);
    }
  }
  if(pairwise){
    cout << "pairwise coprime" << endl;
  } else {
    bool setwise=true;
    for(auto p: gcdfactor){
      if(p.second>=1){
        setwise=false;
        cout << "not coprime" << endl;
        return 0;
      }
    }
    cout <<"setwise coprime" << endl;
  }
  return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a > 0) {
    cout << "Positive" << endl;
  } else if (a <= 0 && b >= 0) {
    cout << "Zero" << endl;
  } else {
    cout << (((b-a)%2 != 0) ? "Positive" : "Negative") << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  string s,a ="";
  cin >> k >> s;
  if(s.size() > k){
    for(int i=0;i<k;i++){
      cout << s.at(i);
    }
    cout << '.' << '.' << '.' << endl;;
  }
  else{
    cout << s << endl;
  }
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int K, S;
  cin >> K >> S;
  int ans = 0;
  for(int x = 0; x <= K; x ++){
    for(int y = 0; y <= K; y ++){
        if(S - x - y <= K && S - x - y >= 0 ){
          ans += 1;
        }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC145_a solver = new ABC145_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC145_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int r = in.nextInt();

            out.println((int) Math.floor(Math.pow(r, 2)));
        }

    }
}



Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string.h>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    int N;
    string S1, S2;
    cin >> N >> S1 >> S2;
    vector<bool> domino_sequence; // = is false, | is true
    for(int i = 0; i < N; ){
        if(S1[i] == S2[i]){
            domino_sequence.push_back(true);
            i++;
        }else{
            domino_sequence.push_back(false);
            i += 2;
        }
    }
    long ans;
    if(domino_sequence[0]){
        ans = 3;
    }else{
        ans = 6;
    }
    for(int i = 1; i < domino_sequence.size(); i++){
        if(domino_sequence[i]){
            if(domino_sequence[i - 1]){
                ans = ans * 2 % mod;
            }
        }else{
            if(domino_sequence[i - 1]){
                ans = ans * 2 % mod;
            }else{
                ans = ans * 3 % mod;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}
template<class T>istream&operator>(istream&i,T&t){return i>>t;}
#ifndef LOCAL
struct ostdmy{
template<class T>ostdmy&operator<<(const T&t){return*this;}
template<class T>ostdmy&operator<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    string s;
    cin>n>s;
    vi c(n+1); // count of # on left
    vi d(n+1); // count of . on right
    REP(i,n) c[i+1]=c[i]+(s[i]=='#');
    REPR(i,n)d[i]=d[i+1]+(s[i]=='.');
    cerr<c<endl;
    cerr<d<endl;
    int mi=INF;
    REP(i,n+1){
        chmin(mi,c[i]+d[i]);
    }
    cout<mi<endl;

    return 0;
}


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

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main() {
    string s;
    int sum=0;
    while(cin>>s){
        rep(i,s.size()){
            if( isdigit(s[i]) ){
                string number="";
                for(int j=i;j<s.size();j++){
                    i++;
                    if(isdigit(s[j]))number+=s[j];
                    else break;
                }
                sum+=stoi(number);
                i--;
            }
        }
    }
    
    cout<<sum<<endl;
    
    return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int N,ans=0;
  cin>>N;
  int V[N],C[N];
  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]>0) ans+=V[i]-C[i];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;


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

    ll a = count(ALL(s),'1');
    ll b = count(ALL(s),'0');

    cout << 2 * min(a, b) << "\n";
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  int w, h, x, y, r;
  string result;
  cin >> w >> h >> x >> y >> r;
  if ((x + r) <= w && (y + r) <= h && (x - r) >= 0 && (y - r) >= 0) {
    result = "Yes";
  } else {
    result = "No";
  }
  cout << result << endl;
}


Measured memory_bytes: 3172
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  ll n;
  cin >> n;
  vl b(n - 1);
  rep(i, n - 1) cin >> b[i];
  vl a(n);
  a[0] = b[0];
  REP(i, 1, n - 1) { a[i] = min(b[i - 1], b[i]); }
  a[n - 1] = b[n - 2];
  ll ans = 0;
  rep(i, n) ans += a[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
// Nihesh Anderson - knandy

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key
ll MOD=1000000007;

#define fast_cin() ios_base::sync_with_stdio(false)
#define pb push_back
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define debug1(x) cerr << x << endl;
#define debug2(x,y) cerr << x << " " << y << endl;
#define debug3(x,y,z) cerr << x << " " << y << " " << z << endl;
#define FOR(i, a, b) for (ll i=a; i<(b); i++)
#define FORR(i, a, b) for (ll i=a; i>=(b); i--)
ll INF = 2000000000000000001;
double EPS = 1e-9;
ll nextll(){ll inp; cin>>inp; return inp;}
string nextStr(){string inp; cin>>inp; return inp;}
double nextDouble(){double inp; cin>>inp; return inp;}
ll power(ll a, ll n, ll md){if(n==0){return 1;}else{ll res=power(a,n/2,md);res=(res*res)%md;if(n%2!=0){res=(res*a)%md;}return res;}}
random_device rndm;
mt19937 grndm(rndm());
void mix(ll* a, ll* b){shuffle(a,b,grndm);}

vector<char> s,t;

vector<char> rot(ll num){
	vector<char> ans;
	FOR(i,0,s.size()){
		ans.pb(s[(i+num)%((ll)s.size())]);
	}
	return ans;
}

int main(){
	fast_cin();
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
	string a,b;
	cin>>a>>b;
	FOR(i,0,a.size()){
		s.pb(a[i]);
		t.pb(b[i]);
	}
	FOR(i,0,s.size()){
		if(rot(i) == t){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;

int N,M;
int v[3005],h[3005];
int t[3005],s[3005];

int imos[3005];
int dp[1005][3005];

void solve(){

    for(int i=0;i<1005;++i)for(int j=0;j<3005;++j)dp[i][j]=-INF;

    dp[0][0]=0;

    for(int i=0;i<M;++i){
        for(int j=0;j<=N;++j){
            int cost;
            if(j)cost=imos[j-1];
            else cost=0;
            if(cost>t[i])continue;
            if(j>0){
                dp[i+1][j]=max(dp[i][j-1]+h[j-1],dp[i+1][j]);
            }
            if(j>1){
                dp[i+1][j]=max(dp[i+1][j-1]+h[j-1]+abs(h[j-2]-h[j-1]),dp[i+1][j]);
            }
        }
        for(int j=0;j<=N;++j)dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
        for(int j=0;j<=N;++j){
            if(dp[i+1][j]<s[i])dp[i+1][j]=-INF;
        }
    }

    for(int i=0;i<=N;++i){
        if(dp[M][i]!=-INF){
            if(!i)cout<<t[M-1]<<endl;
            else cout<<t[M-1]-imos[i-1]<<endl;
            return ;
        }
    }
    cout<<-1<<endl;

}

signed main(){
    cin>>N>>M;
    for(int i=0;i<N;++i)cin>>v[i]>>h[i];
    for(int i=0;i<M;++i)cin>>t[i]>>s[i];
    for(int i=0;i<N;++i){
        if(!i){
            imos[i]=v[i];
        }
        else imos[i]=imos[i-1]+v[i];
    }
    solve();
    return 0;
}

Measured memory_bytes: 26784
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

const ll val=753;

ll solve(ll num){
	if(num<1000)return abs(val-num);
	ll mn=INT_MAX;
	while(num>99){
		mn=min(mn,abs(val-num%1000));
		num/=10;
	}
	return mn;
}


int main(){	
	fastio;
	ll lel;cin>>lel;
	cout<<solve(lel)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#define	MOD = 1000000007;
using namespace std;

int main()
{
	int H, W;
	cin >> H >> W;

	string s[100];
	for (int i = 0; i < H; i++)
	{
		cin >> s[i];
	}

	for (int i = 0; i < H; i++)
	{
		cout << s[i] << endl;
		cout << s[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <queue> 
#include <cctype> 
#include <climits> 
#include <stack> 
#include <map> 
#include <cstring> 

using namespace std; 


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

    if(b%a) cout<<b-a<<endl;
    else cout<<a+b<<endl;

    return 0;
}

Measured memory_bytes: 764
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    char s[n],t[n];
    scanf("%s %s", s, t);
    for(int i = 0; i < n; i++){
        printf("%c%c",s[i],t[i]);
    }
    return 0;
}


Measured memory_bytes: 3124
#include<cstdio>
#include<stdlib.h>

#define H_MAX 50
#define H_MIN 2
#define W_MAX 50
#define W_MIN 2
#define CICADA_MAX 9
#define CICADA_MIN 0


class CICADA
{
	public:
		// Public member function
		int Search( void );
		int GetValue( void );
	private:
		// Private member variable
		int H = 0, W = 0;					// height, width
		int blk[H_MAX][W_MAX]={ { 0 } };	// Number of cicadas per block
		int cicada[W_MAX]={ 0 };			// Total of cicadas
		int cicadabak[W_MAX]={ 0 };			// Total of cicadas of one block above
};



int CICADA::Search(void)
{
	
	for( int i = 0; i < W; i++ )
	{
		for( int j = 0; j < i + 1; j++ )
		{
			cicada[i] += blk[0][j];
		}
	}
	
	for( int i = 1; i < H; i++ )
	{
		for( int j = 0; j < W; j++ )
		{
			cicadabak[j] = cicada[j];
			if( j == 0 )
			{
				cicada[j] = cicadabak[j] + blk[i][j];
			}
			else if( cicadabak[j] > cicada[j-1] )
			{
				cicada[j] = cicada[j-1] + blk[i][j];
			}
			else
			{
				cicada[j] = cicadabak[j] + blk[i][j];
			}
		}
	}
	
	printf("%d\n", cicada[W-1]);
	
	return 0;
}



int CICADA::GetValue(void)
{
	char c;
	
	scanf( "%d %d%*c", &H, &W );
	
	for( int i = 0; i < H; i++ )
	{
		for( int j = 0; j < W; j++ )
		{
			scanf( "%c", &c );
			blk[i][j] = c - '0';
			
			if( ( blk[i][j] > CICADA_MAX ) || ( blk[i][j] < CICADA_MIN ) || ( blk[0][0] != 0 ) || ( blk[H-1][W-1] != 0 ) )
			{
				return -1;
			}
		}
		scanf("%*c");
	}
	
	return 0;
}



int main(void)
{
	CICADA Cicada;
	
	if( Cicada.GetValue() == -1 )
	{
		return -1;
	}
	
	Cicada.Search();
	
	return 0;
}




Measured memory_bytes: 2768
#include <iostream>
#include<list>
#include<vector>
#include<algorithm>
using namespace std;

bool cmp(const pair<int,int>a,const pair<int,int>b ){
    return a.first < b.first;
}

int main(){
    int n,m,i,j,m_now = 0;
  long ans = 0;
  cin >> n >> m;
  int a[n],b[n];
  vector <pair<int,int> >pairs(n);
  for(i = 0;i < n ; i++){
    cin >>a[i]>>b[i];
  }
  for(i = 0;i<n;i++){
      pairs[i] = make_pair(a[i],b[i]);
  }
  sort(pairs.begin(),pairs.end(),cmp);
  for(i = 0;i < n;i++){
      for(j=0;j < pairs[i].second;j++){
        m_now ++;
        ans += pairs[i].first;
        //cout << m_now << endl;
        if(m_now == m){
            cout << ans << endl;
            return 0;
        }
      }
  }
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;


ll cost[3] = {10000, 5000, 1000};
vector<ll> cnt(3);

bool rec(ll i, ll n, ll y) {
    if (i == 2) {
        if (y == cost[i] * n) {
            cout << cnt[0] << " " << cnt[1] << " " << n;
            return true;
        }
        return false;
    }

    rep(j, n + 1) {
        if (y - cost[i] * j >= 0) {
            cnt[i] = j;
            bool ok = rec(i + 1, n - j, y - cost[i] * j);
            if (ok) return ok;
        }
    }
    return false;
}

int main() {
    ll N, Y;
    cin >> N >> Y;
    bool ok = rec(0, N, Y);
    if (!ok) {
        cout << -1 << " " << -1 << " " << -1;
    }
}

Measured memory_bytes: 256
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define ff first
#define ss second
#define tm0 first.first
#define tm1 first.second
#define tm2 second.first
#define tm3 second.second
#define pb push_back
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ii>qq;

ll f(ll val1,ll val2,ll val3){
	return 1000000*val1+1000*val2+val3;
}


int main(){	
	fastio;
	int x,y,z,K;
	cin>>x>>y>>z>>K;
	vector<ll>X,Y,Z;
	FER(i,0,x){
		ll lel;cin>>lel;
		X.pb(lel);
	}
	FER(i,0,y){
		ll lel;cin>>lel;
		Y.pb(lel);
	}
	FER(i,0,z){
		ll lel;cin>>lel;
		Z.pb(lel);
	}
	sort(X.rbegin(),X.rend());
	sort(Y.rbegin(),Y.rend());
	sort(Z.rbegin(),Z.rend());
	vector<ll>ret;
	priority_queue<qq>pq;
	qq node={{X[0]+Y[0]+Z[0],0},{0,0}};
	pq.push(node);
	set<ll>ss;
	ss.insert(f(0,0,0));
	FER(i,0,K){
		qq ini=pq.top();
		pq.pop();
		cout<<ini.tm0<<endl;
		ll val1=X[ini.tm1+1]+Y[ini.tm2]+Z[ini.tm3];
		node={{val1,ini.tm1+1},{ini.tm2,ini.tm3}};
		if(ini.tm1+1<x){
			ll tmr=f(ini.tm1+1,ini.tm2,ini.tm3);
			if(!ss.count(tmr)){
				pq.push(node);
				ss.insert(tmr);
			}
		}
		ll val2=X[ini.tm1]+Y[ini.tm2+1]+Z[ini.tm3];
		node={{val2,ini.tm1},{ini.tm2+1,ini.tm3}};
		if(ini.tm2+1<y){
			ll tmr=f(ini.tm1,ini.tm2+1,ini.tm3);
			if(!ss.count(tmr)){
				pq.push(node);
				ss.insert(tmr);
			}
		}
		ll val3=X[ini.tm1]+Y[ini.tm2]+Z[ini.tm3+1];
		node={{val3,ini.tm1},{ini.tm2,ini.tm3+1}};
		if(ini.tm3+1<z){
			ll tmr=f(ini.tm1,ini.tm2,ini.tm3+1);
			if(!ss.count(tmr)){
				pq.push(node);
				ss.insert(tmr);
			}
		}
	}
	
	return 0;
}


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

int N;
vector<int> dataS(100);
int alice = 0;
int bob = 0;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> dataS.at(i);
	}
	sort(dataS.begin(), dataS.end());
	reverse(dataS.begin(), dataS.end());
	
	for (int i = 0; i < N; i +=2) {
		alice += dataS.at(i);
		
		bob += dataS.at(i+1);
		
	}
	cout << alice - bob << endl;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        es: [(usize, usize, i64); n-1]
    };
    let mut g: Vec<Vec<_>> = vec![Vec::new(); n];
    let mut color = vec![-1; n];
    for (u, v, w) in es {
        g[u - 1].push((v - 1, w));
        g[v - 1].push((u - 1, w));
    }
    color[0] = 0;
    dfs(0, &g, &mut color);
    for c in color {
        println!("{}", c);
    }
}

fn dfs(current: usize, g: &Vec<Vec<(usize, i64)>>, colors: &mut Vec<i64>) {
    let color = colors[current];
    for &(next, w) in &g[current] {
        if colors[next] != -1 {
            continue;
        }
        if w % 2 == 0 {
            colors[next] = color;
        } else {
            colors[next] = (color + 1) % 2;
        }
        dfs(next, &g, colors)
    }
}


Measured memory_bytes: 14616
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
  //  freopen("input.txt","r",stdin);
//	freopen("new.txt","w",stdout);

	int n;
	double d;
	cin>>n>>d;
	int sum=0;
	while(n--)
	{
		double x,y;
		cin>>x>>y;
		long double r = sqrt(pow(x,2)+pow(y,2));
		if(r<=d)
			sum++;
	}


	cout<<sum;


    return 0;
}

Measured memory_bytes: 3844
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll  long  long
#define INF 0x3f3f3f3f
#define pll pair<long long , long long>
const int MAX=1e6+9;
const ll MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
vector<int>adj[MAX];
int prime[MAX];
int main() 
{
   int n;
   cin>>n;
   long long dp[n+1];
   memset(dp , 0 , sizeof(dp));
   dp[0]=1;
   for(int i = 1;i<=n;i++){
   	for(int j = 3;j<=n;j++){
   		if(i>=j)
   			dp[i]=(dp[i]%MOD+dp[i-j]%MOD)%MOD;
   	}
   }
   cout<<dp[n]%MOD;
}


Measured memory_bytes: 27080
import java.util.Scanner;

public class Main
{

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

        int X = scan.nextInt();

        switch (X % 7) {
            case 1:
                System.out.println("fri");
                break;
            case 2:
                System.out.println("sat");
                break;
            case 3:
                System.out.println("sun");
                break;
            case 4:
                System.out.println("mon");
                break;
            case 5:
                System.out.println("tue");
                break;
            case 6:
                System.out.println("wed");
                break;
            case 0:
                System.out.println("thu");
                break;
        }

    }
}



Measured memory_bytes: 26324
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
void times(alias pred)(int n) {
    foreach(i; 0..n) pred();
}
auto rep(alias pred, T = typeof(pred()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = pred();
    return res;
}

void main() {
    int N, M;
    readf("%d %d\n", &N, &M);

    (new int[][M]).pipe!((a) {
      readln.split.to!(int[]).each!((x) {
          a[x%M] ~= x;
      });
      return a;
    }).map!(a =>
        redBlackTree!((b, c) =>
            (b[1]+c[1])%2!=0 ? b[1]%2!=0 :
            b[1] != c[1]     ? b[1]>c[1] :
                               b[0]<c[0]
        )(a.sort().group.array ~ tuple!(int, uint)(-1, 0))
    ).array.pipe!((ary) {
        int v1 = (M/2 + 1).iota.map!((i){
            int cnt = 0;
            if (i==0 || i*2==M) {
                cnt = ary[i][].map!(a => a[1]).sum/2;
                ary[i].clear;
            } else {
                int j = M-i;
                while([i, j].all!(k => ary[k].front[1]>0)) {
                    cnt++;
                    [i, j].each!(k =>
                        ary[k].pipe!((tree) {
                            auto v = tree.front;
                            tree.removeFront;
                            v[1]--;
                            tree.insert(v);
                        })
                    );
                }
            }
            return cnt;
        }).array.sum;
        int v2 = ary.map!(a => a[].map!(b => b[1]/2).sum).sum;
        return v1+v2;
    }).writeln;
}


Measured memory_bytes: 45372
#include <bits/stdc++.h>
#include <iterator>
#include <vector>
#include <algorithm>
#include <iomanip>

#define v vector
#define ll long long 
#define vpll vector<pair<long long,long long> > 
#define F first
#define S second
#define mp make_pair
#define ld long double
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pci pair<char,int>
#define un unsigned

#define mod 1000000007
#define MAXN 2001
using namespace std; 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

v<int> adj[MAXN];

int main()
{
    fast;
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    v<ll> red(a,0);
    v<ll> green(b,0);
    v<ll> colorless(c,0);
    ll ans = 0;
    for(int i = 0 ; i < a ; i++)
    cin>>red[i];
    for(int i = 0 ; i < b ; i++)
    cin>>green[i];
    for(int i = 0 ; i < c ; i++)
    cin>>colorless[i];
    sort(red.rbegin(),red.rend());
    sort(green.rbegin(),green.rend());
    sort(colorless.rbegin(),colorless.rend());
    priority_queue<ll> pq;
    for(int i = 0 ; i < x ; i++)
    pq.push(red[i]);
    for(int i = 0 ; i < y ; i++)
    pq.push(green[i]);
    for(int i = 0 ; i < c ; i++)
    pq.push(colorless[i]);
    for(int i = 0 ; i < x+y ; i++)
    {
        ll temp = pq.top();
        pq.pop();
        ans += temp;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8944
#include<stdio.h>
#include<math.h>

double rui(double kaisuu) {
	double n = 1,i;
	for (i = 0; i < kaisuu; i++) {
		n *= 2;
	}
	return n;
}
int main() {
	double H, count = 0, kaisuu = 1;
	long int i;
	scanf("%lf", &H);
	while (H > 1) {
		kaisuu++;
		H = H / 2;
		H = floor(H);
	}
	count = rui(kaisuu) - 1;
	printf("%.0f\n",count);
	return 0;
}

Measured memory_bytes: 128
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s = sc.next()
  if (s.length == 2) {
    if (s(0) == s(1)) {
      println("1 2")
    } else {
      println("-1 -1")
    }
  } else {
    s.toSeq.sliding(3).map(_.unwrap).zipWithIndex.find{ case (s, _) =>
      s(0) == s(1) || s(0) == s(2) || s(1) == s(2)
    } match {
      case Some((s, i)) => println(s"${i + 1} ${i + s.length}")
      case None => println("-1 -1")
    }
  }
}


Measured memory_bytes: 64060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
//setprecision(12)
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int k, n; cin >> k >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int ans = 0;
    int m = 0;
    REP(i,1,n) {
        ans += a[i]-a[i-1];
        m = max(m,a[i]-a[i-1]);
    }
    m = max(m,a[0]+k-a[n-1]);
    ans = ans + a[0] + k - a[n-1] - m;
    cout << ans << endl;
    return 0;
}

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

using namespace std;
int main() {
  int a, b, t;
  cin >> a >> b >> t;
  int time = 0;
  int cnt = 0;
  while (true) {
    time += a;
    if (time > t + 0.5) break;
    cnt += b;
  }
  cout << cnt << endl;
  return 0;
}

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

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

	s.erase(7, 1);
	s.erase(4, 1);
	
	int x;
	x = stoi(s);

	int h = 20190430;

	string ans = "Heisei";

	if (x - h > 0) ans = "TBD";

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
int main(){
  int n,i,x;
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    x=i;
    if ( x % 3 == 0 ){
      printf(" %d",i);
    }else{
      do{
        if ( x % 10 == 3 ){
          printf(" %d",i);
          x=0;
        }
        x /= 10;
      }while( x );
    }
  }
  printf("\n");
  return 0;
}




Measured memory_bytes: 2148
def calculate(a,b):
    s1 = list([str(a)]*b)
    s1 = "".join(s1)

    s2 = list([str(b)]*a)
    s2 = "".join(s2)

    arr = [s1,s2]

    arr = sorted(arr)

    print(arr[0])

S = input().split(" ")
a = int(S[0])
b = int(S[1])

calculate(a,b)


Measured memory_bytes: 3060
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<cstring>
#include<map>
#include<vector>
#include<set>
#define rep(i,j,k) for(register int i = j; i <= k; i++) 
#define dow(i,j,k) for(register int i = j; i >= k; i--)
//#define fi first
//#define se second
//#define P pair<int,int>
//#define PP pair<int,pair<int,int> >
//#define mp(a,b) make_pair(a,b)
#define ll long long
#define ull unsigned long long
using namespace std;
 
inline ll read() { 
	ll s = 0, t = 1; char c = getchar();
	while( !isdigit(c) ) { if( c == '-' ) t = -1; c = getchar(); }
	while( isdigit(c) ) s = s * 10 + c - 48, c = getchar();
	return s * t;
}

const int N = 1e5+5, M = N * 200, p = 1e9+7; const ll inf = 2e18;
int sum[M], c[M][2], tot = 0; 
inline void _(int &x) { if( x >= p ) x -= p; }
inline int __(int x) { if( x >= p ) x -= p; return x; }
struct tree{ 
	ll f, ql, qr; int rt, d;
	#define lc c[k][0]
	#define rc c[k][1]
	inline void upd(ll l,ll r,int &k) { 
		if( !k ) k = ++tot;
		_(sum[k] += d);
		if( l == r ) return;
		ll mid = (l + r) >> 1;
		if( ql <= mid ) upd(l,mid,lc);
		else upd(mid+1,r,rc);
	}
	inline int query(ll l,ll r,int k) { 
		if( !k ) return 0;
		if( ql <= l && r <= qr ) return sum[k];
		ll mid = (l + r) >> 1;
		if( qr <= mid ) return query(l,mid,lc);
		else if( ql > mid ) return query(mid+1,r,rc);
		else return __(query(l,mid,lc) + query(mid+1,r,rc));
	}
	inline void upd(ll pos,int D) { 
		ql = pos, d = D; if( d ) upd(0,inf,rt);
	}
	inline int query(ll pos) { 
		return ql = 0, qr = pos, query(0,inf,rt);
	}
//	inline void out(ll l,ll r,int k) {
//		if( !k ) return;
//		if( l == r ) { 
//			return;
//		}
//		ll mid = (l + r) >> 1;
//		out(l,mid,lc);
//		out(mid+1,r,rc);
//	}
//	inline void out() { 
//		cout<<"O "<<f<<endl;
//		out(0,inf,rt);
//	}
} a, b;

int main() {
	int n = read() - 1, aa, bb; 
	ll Af, Bf, A = read(), B = read(), x = read();
	a.f = x + A, b.f = x + B, a.upd(0,1), b.upd(0,1); // a.out(), b.out();
	
	while( n-- ) { 
		x = read(), aa = b.query(x), bb = a.query(x), Af = a.f, Bf = b.f;
		
		if( a.f <= x ) { 
			a.upd(Bf,aa);
			a.f = x + A;
		} else { 
			a.rt = 0;
			a.upd(Bf,aa);
			a.f = x + A;
		}
		
		if( b.f <= x ) { 
			b.upd(Af,bb);
			b.f = x + B;
		} else { 
			b.rt = 0;
			b.upd(Af,bb);
			b.f = x + B;
		}
		
	//	a.out(), b.out();
	}
	cout<<(a.query(inf) + b.query(inf)) % p<<endl;
	return 0; 
}

Measured memory_bytes: 147712
#include<iostream>
#include<cstring>
#include<deque>
using namespace std;
const int maxn=2e5+10;
char ch[maxn];
int len;
deque<char> Q;
int main(){
	cin>>ch;
	len=strlen(ch);
	Q.clear();
	Q.push_back('A');
	for(int i=0;i<len;i++){
		if(ch[i]=='S')
			Q.push_back(ch[i]);
		else if(ch[i]=='T'){
			char u=Q.back();
			if(u=='T'||u=='A')
				Q.push_back(ch[i]);
			else if(u=='S')
				Q.pop_back();
		}	
	}
	int ans=Q.size();
	if(ans%2==1) ans--;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
int n,a[1005],k;
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    int sum = 0;
    for(int i=1;i<=k;i++){
        sum+=a[i];
    }
    cout<<sum<<endl;
    return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

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

int main(){
	int h,w,n;
	cin>>h>>w>>n;

	cout<< ceil((double)n/max(h,w)) <<endl;

	return 0;
}


Measured memory_bytes: 256