akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long long ll;



int main()
{
	// int t=1;
	// cin >> t ;

	// while(t--)
	{
		string s,t;
		cin>>s>>t;
		int n = s.size(), m = t.size();

		int ans[n+1][m+1];

		string out;
		for(int i=0; i<=n; i++)
			for(int j=0; j<=m; j++)
			{
				if(i==0 || j==0)
				{
					ans[i][j]=0;
					continue;
				}
				ans[i][j] = max(ans[i-1][j], ans[i][j-1]);
				if(s[i-1]==t[j-1])
				{	
					if(1+ans[i-1][j-1]>ans[i][j])
					{
						ans[i][j] = 1+ans[i-1][j-1];
						// out.push_back(s[i-1]);
					}
					// ans[i][j] = max(ans[i][j], 1+ans[i-1][j-1]);
				}
			}
		// for(int i=0; i<=n; i++, cout<<endl)
		// 	for(int j=0; j<=m; j++)
		// 		cout<<ans[i][j]<<" ";
		out.resize(ans[n][m]) ;
		int i = n , j = m , c = ans[i][j];
		while(c!=0)
		{	
			if(ans[i-1][j]==ans[i][j])
				i--;
			else if(ans[i][j-1]==ans[i][j])
				j--;
			else
			{
				out[c-1] = t[j-1];
				j--;
				c--;
				i--;
			}
		}
		
		cout<<out<<endl;

	}
	return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int ar[1000008];
int br[1000008];
int main()
{
    ll n,ans=0,res=0,i;
    cin>>n;
    for(i=0;i<=n;i++)
        cin>>ar[i];
    for(i=0;i<n;i++)
        cin>>br[i];
    for(i=0;i<n;i++){
       if(ar[i]>=br[i])ans=ans+br[i];
       else{
        ans=ans+ar[i];
        res=br[i]-ar[i];
        if(res<=ar[i+1]){ar[i+1]=ar[i+1]-res;ans=ans+res;}
        else{
            ans=ans+ar[i+1];
            ar[i+1]=0;
        }
       }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define int long long
#define INF 1000000000000000000
using namespace std;

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
template<typename T>
void debug(vector<vector<T>> m){ REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;} }



signed main(){

    int N, M; cin >> N >> M;
    int a1 = 0, a2 = INF;
    while(a2 - a1 > 1){
        int a = (a1 + a2) / 2;
        if(M >= 2 * a && N + (M - 2 * a) / 2 >= a) a1 = a;
        else a2 = a;
    }
    cout << a1 << endl;

    return 0;
}


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

int const maxn = 1e5 + 10;
int n, m;
ll dis[2][maxn], ans[2][maxn];
bool vis[2][maxn];
int const MOD = 1e9 + 7;
int st, ed;

struct Edge {
    int v, next, w;
}e[200000 << 1];
int head[maxn], cnt;

void init() {
    memset(head, -1, sizeof(head));
    memset(dis, 0x3f, sizeof(dis));
    cnt = 0;
}

void add(int u, int v, int w) {
    e[cnt].v = v;
    e[cnt].w = w;
    e[cnt].next = head[u];
    head[u] = cnt++;
}

void dijkstra(int s, ll d[], bool v[], ll ans[]) {
    priority_queue<pair<ll, int> > q;
    d[s] = 0;
    ans[s] = 1;
    q.emplace(0, s);
    while (!q.empty()) {
        int u = q.top().second;
        // cout << u << endl;
        q.pop();
        if (v[u]) continue;
        v[u] = 1;
        for (int i = head[u]; ~i; i = e[i].next) {
            int v = e[i].v;
            int w = e[i].w;
            if (d[v] > d[u] + w) {
                d[v] = d[u] + w;
                ans[v] = ans[u];
                q.emplace(make_pair(-d[v], v));
            } else if (d[v] == d[u] + w) {
                ans[v] = (ans[v] + ans[u]) % MOD;
            }
        }
    }

}

int main(void) {
    cin >> n >> m >> st >> ed;
    init();
    for (int i = 1; i <= m; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        add(u, v, w);
        add(v, u, w);
    }
    dijkstra(st, dis[0], vis[0], ans[0]);
    dijkstra(ed, dis[1], vis[1], ans[1]);

    ll path_num = ((ans[0][ed] % MOD) * (ans[1][st] % MOD)) % MOD;
    ll D = dis[0][ed];
    for (int i = 1; i <= n; i++) {
        if (dis[0][i] == dis[1][i] && D == dis[1][i] * 2) {
            path_num = path_num - ((ans[0][i] * ans[0][i] % MOD) * (ans[1][i] * ans[1][i] % MOD)) % MOD;
            path_num = (path_num + MOD) % MOD;
        }
        for (int u = head[i]; ~u; u = e[u].next) {
            int w = e[u].w;
            int v = e[u].v;
            ll d1 = dis[0][i], d2 = dis[1][v];
            if (d1 + w + d2 == D && d1 * 2 < D && d2 * 2 < D) {
                path_num = path_num - ((ans[0][i] * ans[0][i] % MOD) * (ans[1][v] * ans[1][v] % MOD)) % MOD;
                path_num = (path_num + MOD) % MOD;
            }
        }
    }
    cout << path_num << endl;
    
    return 0;
}

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i < b; i++)
    {
        if ((a * i) % b == c)
        {
            cout << "YES" << "\n";
            return 0;
        }
    }
    cout << "NO" << "\n";
}

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int64_t all_sum(int64_t k) {
  int64_t sum = k * (k+1) / 2;
  return sum;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64_t N, K;
  cin >> N >> K;
  int64_t ans = 0;
  for(int64_t i = K; i <= N + 1; i++) {
    ans += all_sum(N) - all_sum(N-i) - all_sum(i-1) + 1;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p = Mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, m;
H pa[200000];
H e[200000];
int root(int x) {
	if (pa[x].x == x) return x;
	return pa[x].x = root(pa[x].x);
}
void unite(int x, int y) {
	x = root(x); y = root(y);
	pa[y].y += pa[x].y;
	pa[x].x = y;
}
signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> e[i].x >> e[i].y;
	}
	reverse(e, e + m);
	for (int i = 1; i <= n; i++) {
		pa[i].x = i;
		pa[i].y = 1;
	}
	int ans = n * (n - 1) / 2;
	vector<int>ve;
	for (int i = 0; i < m; i++) {
		ve.push_back(ans);
		if (root(e[i].x) != root(e[i].y)) {
			ans -= pa[root(e[i].x)].y*pa[root(e[i].y)].y;
			unite(e[i].x, e[i].y);
		}
	}
	reverse(all(ve));
	for (int i = 0; i < ve.size(); i++) {
		cout << ve[i] << endl;
	}
}

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

string s, t;

int binary_search(vector<vector<int>> &tmp, int &x, char &c){
    int ok = s.size() + 1;
    int ng = x;
    while (abs(ok - ng) > 1){
        int mid = (ok + ng) / 2;
        if (tmp[mid][c - 'a'] - tmp[x][c - 'a']) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main(){
    cin >> s >> t;
    vector<int> check(26, 0);
    vector<vector<int>> tmp(s.size() + 1, vector<int>(26, 0));
    for (int i = 1; i <= s.size(); i++){
        tmp[i] = tmp[i - 1];
        tmp[i][s[i - 1] - 'a']++;
    }
    for (int i = 0; i < t.size(); i++) check[t[i] - 'a']++;
    for (int i = 0; i < 26; i++){
        if (check[i] != 0 && tmp[s.size()][i] == 0){
            cout << - 1 << endl;
            exit(0);
        }
    }
    long long ans = 0; int x = 0;
    for (int i = 0; i < t.size(); i++){
        int z;
        z = binary_search(tmp, x, t[i]);
        if (z == s.size() + 1){
            ans += s.size();
            x = 0; i--;
        }
        else x = z;
    }
    cout << ans + x << endl;
}

Measured memory_bytes: 13824
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD =1e9+7;
using ll=long long;
using Graph = vector<vector<int>>;
int gcd(int a, int b){
    if(a>b) swap(a,b);

    if(b%a !=0) return gcd(a,b%a);
    else  return a;
}
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    } 
    int ans = gcd(a[0],a[1]);
    rep(i,n-1){
        ans = gcd(ans, a[i+1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
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;}

void Main()
{
  i64 n;
  cin >> n;

  vvi s(n,vi(n,INF));

  rep(i,n) rep(j,n){
    char c;
    cin >> c;
    if(c=='1'){
      s[i][j]=1;
      s[j][i]=1;
    }
    if(i==j)
      s[i][j]=0;
  }
  
  rep(k,n) rep(i,n) rep(j,n){
    if(s[i][j]<INF && s[i][k]+s[k][j]<INF && s[i][j]%2!=(s[i][k]+s[k][j])%2){
      cout << "-1\n";
      return;
    }
    chmin(s[i][j],s[i][k]+s[k][j]);
    s[j][i]=s[i][j];
  }

  i64 ans = -1;
  rep(i,n) rep(j,n){
    chmax(ans,s[i][j]);
  }
  cout << ans+1 << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


Measured memory_bytes: 640
#include <iostream>


using namespace std;

int main() {
    int N,i,sum;

    cin >> N;
    i = N;
    while(i > 0){
        
        sum += i % 10;
        i /= 10;
    }

    if(N % sum == 0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
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<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//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 SQ(a) ((a)*(a))
#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())
#define LB lower_bound
#define UB upper_bound

//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);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

int main() {
  int N;
  cin >> N;
  
  VI A(N);
  
  REP(i,N) {
    cin >> A.at(i);
  }
  
  for(int i = 1; i < N; i++) {
    REP(k,N) {
      cout << A.at(k);
      if(k != N-1) cout << " ";
      else cout << endl;
    }
    int v = A.at(i), j = i-1;
    while(j>=0 && A.at(j) > v) {
      A.at(j+1) = A.at(j);
      j--;
    }
    A.at(j+1) = v;
  }
  
  REP(k,N) {
      cout << A.at(k);
      if(k != N-1) cout << " ";
      else cout << endl;
    }
  
  return 0;
}


Measured memory_bytes: 3096
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.Remoting.Contexts;
using System.Security.Cryptography.X509Certificates;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }
        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }
    }

    struct A
    {
        public int Value, Index;

        public A(int v, int i)
        {
            Value = v;
            Index = i;
        }
    }

    class Program
    {
        private int N;
        private A[] A;
        private void Scan()
        {
            var sc = new Scanner();
            N = sc.NextInt();
            A = sc.IntArray().Select((i, index) => new A(i, index)).ToArray();
        }

        public void Solve()
        {
            Scan();
            var ans = new int[N];
            Array.Sort(A, (a, b) => a.Value.CompareTo(b.Value));
            for (int i = 0; i < N; i++)
            {
                int q;
                if (i < N / 2)
                {
                    q = A[N / 2].Value;
                }
                else
                {
                    q = A[N / 2 - 1].Value;
                }

                ans[A[i].Index] = q;
            }
            Console.WriteLine(string.Join("\n", ans));
        }


        static void Main(string[] args)
        {
            new Program().Solve();
        }
    }
}

Measured memory_bytes: 52776
def dia(r):
	return r[0]**2 + r[1]**2 
def issmaller (a,b):
 	if dia(a) != dia(b):
		return dia(a) < dia(b)
	else :
		return a[0] < b[0]

while 1 :
	h, w = map(int,raw_input().split())
	if (h, w) == (0,0):
		break
	dia_base = (h, w)
	rect = (149,150) if h + 1 == w else (h+1,w) 
	winc = w + 1
	hinc = winc
	while hinc > 1:
		for hinc in xrange(1,winc):
			if issmaller(dia_base, (hinc, winc)):
				if issmaller((hinc,winc),rect):
					rect = (hinc,winc)
				break
		winc += 1

	winc = w - 1
	hinc = winc
	while hinc > 1:
		for hinc in xrange(1, winc):
			if issmaller((winc-hinc,winc),dia_base):
				break
			if issmaller((winc-hinc,winc),rect):
				rect = (winc-hinc,winc)
		winc -= 1
	
	print rect[0], rect[1]

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

int solveZY(int e,int min) {
	int tempmin,X;
	for(int Z = 0; Z*Z*Z<=e; Z++) {
		for(int Y = 0; Y*Y<=(e-Z*Z*Z); Y++) {
			X = e-Y*Y-Z*Z*Z;
			tempmin = X+Y+Z;
			//cout << X << " " << Y << " " << Z << endl;
			//cout << tempmin << endl;
			if((tempmin<min) && (X+Y*Y+Z*Z*Z == e)) {
				min = tempmin;
			}
		}
	}
	return min;
}

int main() {

	int E;
	int min;

	while(true) {
		cin >> E;
		if(E == 0) {
			break;
		}
		min = 1000000;
		min = solveZY(E,min);

		cout << min << endl;

	}
	return 0;
}

Measured memory_bytes: 2948
#include<stdio.h>
#include<float.h>

int main(){
 int n,i,x;
 i=1;
 x=i;
 scanf("%d",&n);
 while(1){
    while(1){
        if(x/10==0 || x%10==3)
            break;
        x/=10;
    }
    if(x%10==3)
        printf(" %d",i);
    while(++i<=n){
        x=i;
        if(x%3==0)
            printf(" %d",i);
        else break;
    }if(n<i) break;
 }
 printf("\n");
return 0;
}

Measured memory_bytes: 600
import sys
import math
import collections
import heapq

def set_debug(debug_mode=False):
    if debug_mode:
        fin = open('input.txt', 'r')
        sys.stdin = fin


def int_input():
    return list(map(int, input().split()))


if __name__ == '__main__':
    # set_debug(True)

    # t = int(input())
    t = 1

    for ti in range(1, t + 1):
        m, n, k = int_input()

        A = []

        res = 0

        for i in range(m):
            A.append([x for x in input()])

        # print(A)

        for i in range(2 ** m):
            for j in range(2 ** n):
                cnt = 0

                for h in range(m):
                    for w in range(n):
                        if (i>>h & 1): continue
                        if (j>>w & 1): continue
                        cnt += A[h][w] == '#'

                if cnt == k:
                    res += 1

        print(res)


Measured memory_bytes: 9484
using System;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        int s = int.Parse(Console.ReadLine());
        HashSet<int> hs = new HashSet<int>();
        hs.Add(s);
        int prev = s;
        for (int i = 2; ; i++)
        {
            int next = prev % 2 == 0 ? prev / 2 : 3 * prev + 1;
            if (!hs.Add(next))
            {
                Console.WriteLine(i);
                return;
            }
            prev = next;
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int sita, ue, d, G;
  
  G = 0;
  
  cin >> sita >> ue >> d;
  
  for(int i = sita; i <= ue; i++){
    
    if(i % d == 0)G++;
    
  }
  
  cout << G <<endl;
  
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long n,m;
    cin >> n >> m;
    
    if(n == 1 && m == 1){
        cout << 1 << endl;
        return 0;
    }
    else if(n == 1 || m == 1){
        cout << n*m -2 << endl;
        return 0;
    }
    else if(n ==2 || m == 2) {
        cout << 0 << endl;
        return 0;
    }
    else{
        cout << n*m - (2*(n+m)-4) << endl;
        return 0;
    }
}


Measured memory_bytes: 3580
#include <iostream>

using namespace std;

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	int a[n], s = 0;
	rep(i, n) {
		cin >> a[i];
		a[i]--;
	}
	rep(i, n) if(i == a[a[i]]) s++;
	cout << s/2 << endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,p[55],cnt=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>p[i];
		if(p[i]!=i+1) cnt++;
	}
	if(cnt<=2) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

    long long N,A,B;
    int i;
    long long cnt = 0;

    scanf("%lld %lld %lld", &N, &A, &B);
    long long X[N];
    long long dis = 0;
    for(i=0;i<N;i++){
        scanf("%lld",&X[i]);
    }

    for(i = 1;i < N;i++){
        dis = X[i] - X[i-1];
        if(B > dis * A){
            cnt += dis * A;
        }
        else{
            cnt += B;
        }

        //printf("%lld %lld %lld\n", dis*A, B, cnt);
    }

    printf("%lld\n", cnt);

    return 0;
}

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

int main() {
  char A;
  cin >> A;
  
  int key=0;
  
  string base;
  base="abcdefghijklmnopqrstuvwxyz";
  
  for(int i=0; i<26; i++){
    if(A==base.at(i))
      key=i;
  }
  
  cout << base.at(key+1) << endl;
}

    

  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int x, a, b;
  string ans = "dangerous";
    cin >> x >> a >> b;
    if(b<=a) ans = "delicious";
    else if(b-a<=x) ans = "safe";
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <tuple>
#include <vector>
#define MOD 1000000007
#define MAX_N 100000
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

vector<int> Parent(MAX_N);
vector<int> Node(MAX_N);

void initUnionFind(int n) {
  rep(i, n) {
    Parent[i] = i;
    Node[i] = 0;
  }
}

int findParent(int i) {
  if (i == Parent[i]) return i;
  return Parent[i] = findParent(Parent[i]);
}

bool isSame(int x, int y) { return (findParent(x) == findParent(y)); }

void unite(int x, int y) {
  x = findParent(x);
  y = findParent(y);
  if (Node[x] < Node[y]) swap(x, y);
  Parent[y] = x;
  Node[x]++;
}

int main(void) {
  int N;
  cin >> N;
  vector<pair<int, int>> X(N);
  vector<pair<int, int>> Y(N);
  rep(i, N) {
    int x, y;
    cin >> x >> y;
    X[i] = {x, i};
    Y[i] = {y, i};
  }

  vector<tuple<int, int, int>> E((N - 1) * 2);
  sort(X.begin(), X.end());
  for (int i = 1; i < N; ++i) {
    int x0, x1, t0, t1;
    tie(x0, t0) = X[i - 1];
    tie(x1, t1) = X[i];
    E[i - 1] = make_tuple(abs(x1 - x0), t0, t1);
  }

  sort(Y.begin(), Y.end());
  for (int i = 1; i < N; ++i) {
    int y0, y1, t0, t1;
    tie(y0, t0) = Y[i - 1];
    tie(y1, t1) = Y[i];
    E[N - 1 + i - 1] = make_tuple(abs(y1 - y0), t0, t1);
  }

  initUnionFind(N);
  sort(E.begin(), E.end());
  int answer = 0;
  for (int i = 0; i < 2 * (N - 1); ++i) {
    int cost, t0, t1;
    tie(cost, t0, t1) = E[i];
    // cout << "t0=" << t0 << " t1=" << t1 << " : cost=" << cost << endl;
    if (!isSame(t0, t1)) {
      unite(t0, t1);
      answer += cost;
    }
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 4992
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
lst = [0, 0, 0]
for p in P:
    if p <= A:
        lst[0] += 1
    elif p <= B:
        lst[1] += 1
    else:
        lst[2] += 1

print (min(lst))

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[100005];
ll B[100005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i] >> B[i];
    }

    ll ans = 0;
    for (ll i = N - 1; i >= 0; --i) {
        ll a = A[i] + ans;
        ans += (B[i] - a % B[i]) % B[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
	using namespace std;
	#define M 1000000007
	#define U 998244353
	#define N 1000005
	#define int long long
	#define sz(c) (int)c.size()
	#define fr first
	#define ll long long 
	#define sc second
	#define pb push_back
	#define mp make_pair
	#define all(a) (a).begin(),(a).end()
	#define rep(i,a,n) for(int i=a ; i<n ; i++)
	#define r0 return 0;
	#define endl '\n'
	#define INF (int)1e15
	#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		std::cerr << name << " : " << arg1 << endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
	signed main()
	{
		ios_base::sync_with_stdio(0);
		int TESTS=1;
		// cin>>TESTS;
		while(TESTS--)
		{   
			int n,w;
			cin >> n >> w;
			int weight[(int)1e5+1];
			rep(i,0,(int)1e5+1) weight[i] = INF;
			weight[0] = 0;
			rep(i,0,n){
				int t,r;
				cin >> t >> r;
				for(int j=(int)1e5; j>=0; j--){
					if(j+r<=1e5) weight[j+r] = min(weight[j+r], weight[j]+t);
				}
			}
			int ans = 0;
			rep(i,0,(int)1e5+1) if(weight[i]<=w) ans = i;
			cout<<ans;
		}
	}

Measured memory_bytes: 1024
import std.stdio, std.string, std.conv, std.array, std.algorithm;

void main() {
  int[][] field;
  int[][] dp;
  string line;
  while (true) {
    line = readln.chomp;
    if (stdin.eof) break;
    field ~= line.split(",").map!(to!(int)).array;
  }
  foreach(int i, f; field) dp ~= new int[](f.length);
  int half = (field.length / 2).to!(int);
  for(int i = 1; i < field.length; i++) {
    for(int j = 0; j < field[i].length; j++) {
      if (half >= i) {
        if (j == field[i].length - 1) {
          field[i][j] += field[i - 1][j - 1];
        }
        else if (j == 0) {
          field[i][j] += field[i - 1][j];
        }        
        else {
          field[i][j] +=
            max(field[i - 1][j], field[i - 1][j - 1]);
        }
      }
      else if (half < i) {
        if (field[i].length / 2 <= i) {
          field[i][j] += max(field[i - 1][j], field[i - 1][j + 1]);
        }
        else {
          field[i][j] +=
            max(field[i - 1][j], field[i - 1][j]);
        }
      }
    }
  }
  writeln(field[$ - 1][0]);
}

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


int main(){

string s;
cin>>s;
int l=0,r=s.size()-1;

int ans=0;

while(l<r){

    if(s[l]==s[r]){
        l++;
        r--;
    }
    else{
        
        if(s[l]=='x'){
            l++;
            ans++;
        }
        else{
            if(s[r]=='x'){
                ans++;
                r--;
            }
            else{
                cout<<-1<<endl;
                return 0;
            }
        }
        
    }
    
}
cout<<ans<<endl;


return 0;
}


Measured memory_bytes: 512
k, n = map(int, input().split())
a = list(map(int, input().split()))
number = 0
for i in range(0, n - 1):
    number = max(number, a[i + 1] - a[i])
number = max(a[0] + (k - a[n - 1]), number)
print(k - number)


Measured memory_bytes: 78668
#include<iostream>
using namespace std;
int main()
{
   int a,b,c,d;
  
      cin>>a>>b>>c>>d;
   while(1)
   {
   c=c-b;
if(c<=0)
{
    cout<<"Yes";
    break;
}
a=a-d;
if(a<=0)
{
    cout<<"No";
break;
}
}

}

Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1},
//           dx[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  int n; cin >> n;
  int ans = -1;
  for (int x = 1; x <= n; ++x) {
    if (floor(x * 1.08) == n) ans = x;
  }
  if (ans == -1) {
    cout << ":(\n";
  } else {
    cout << ans << '\n';
  }
  return 0;
}


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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}


//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;

int main(){
 double X;cin>>X;
  double num=100;
  for(int i=1; i<4000;i++){
     
      num=floor(num*1.01);
  
      if(num>=X){
        cout<<i<<endl;
        break;
      }
    }
      
 }








Measured memory_bytes: 3792
#include <iostream>
#include <string>

using namespace std;

int main(){
    int a=0;
  string s;
  
  cin >> s;
  
  for(int i = 0;i < (int)s.size();i++){
      if(s[i] == '1')
      a++;
  }
  
  cout << a << endl;
  
  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);

int main(){
	int a,b;
    cin>>a>>b;
    vi p(a);
    rep(i,a)cin>>p[i];
    sort(been(p));
    ll ans =0;
    rep(i,b){
        ans+=p[i];
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

const string YES = "";
const string NO  = "";

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

    string s1, s2, s3;

    cin >> s1 >> s2 >> s3;

    cout << s1[0] << s2[1] << s3[2] << endl;

    return 0;
}



Measured memory_bytes: 256
program next_alphabet
    implicit none
    character(1):: c
    character(26), parameter:: alphabet = "abcdefghijklmnopqrstuvwxyz"
    integer:: i

    read*, c
    do i=1, 26
        if (alphabet(i:i) == c)then
            print*, alphabet(i+1:i+1)
            stop
        end if
    end do
end program next_alphabet

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

int main(){
    ll N; cin >> N;
    vector<ll> A(N+1), S(N+1);
    rep(i, 1, N+1){
        cin >> A[i];
        A[i] *= 2;
    }
    S[0] = 0;
    rep(i, 1, N + 1) S[i] = S[i-1] + A[i];
    //for(auto t: S) cerr << t << " ";
    //cerr << endl;
    ll left = 2, right = 3;
    ll ans = 1e18;

    rep(mid, 3, N){
        ll pq = S[mid-1], rs = S[N] - S[mid-1];
        while(llabs(pq/2 - S[left-1]) > llabs(pq/2 - S[left]) && left < mid-1) left++;
        if(right <= mid) right = mid + 1;
        while( right < N && llabs(rs/2 - (S[right-1] - S[mid-1])) > llabs(rs/2 - (S[right] - S[mid-1]) )) right++;
        ll t[4];
        t[0] = S[left-1];
        t[1] = pq - t[0];
        t[2] = S[right-1] - (t[1] + t[0]);
        t[3] = S[N] - (t[2] + t[1] + t[0]);
        //cerr << "left, mid, right " << left << " " <<  mid << " " << right << endl;
        //for(auto e: t) cerr << e << " ";
        //cerr << endl;
        sort(t, t + 4);
        //cerr << t[3] << t[0] << endl;
        ans = min(ans, t[3] - t[0]);
        //cerr << ans << endl;
    }
    cout << ans / 2 << endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言
#define MAX 100000

//問題をよく読もう！
//論理的に考えよう！
//サンプルを確認しよう!
//絶対に諦めるな！
//工夫をしろ！
int main() {
  int N;
  cin >> N;

  if(N<1000) cout << "ABC" << endl;
  else cout << "ABD" << endl;

  return 0;
}


Measured memory_bytes: 256
#from math import sqrt
#from heapq import heappush, heappop
#from collections import deque

n = int(input())

l = []
for _ in range(n):
    s = input()
    l.append(s)

l.sort()

max_count = 0
count = 0
results = []
ps = None
for s in l:
    if s == ps or ps is None:
        count += 1
    else:
        if max_count < count:
            max_count = count
            results = [ps]
        elif count == max_count:
            results.append(ps)
        count = 1
    ps = s

if max_count < count:
    max_count = count
    results = [ps]
elif count == max_count:
    results.append(ps)

results.sort()
for str in results:
    print(str)


Measured memory_bytes: 20680
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>/*toupperとかが入っている*/ 
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

string s1,s2,s3;

int main(void) {
  cin >> s1 >> s2 >> s3;
  
  /*大文字にする*/
  transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
  transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
  transform(s3.begin(), s3.end(), s3.begin(), ::toupper);
  
  cout << s1[0] << s2[0] << s3[0] << endl; 
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int X, Y, Z;
  cin >> X >> Y;
  if(X == 1){
    Z = Z + 300000;
  }
  if(X == 2){
    Z = Z + 200000;
  }
  if(X == 3){
    Z = Z + 100000;
  }
  if(Y == 1){
    Z = Z + 300000;
  }
  if(Y == 2){
    Z = Z + 200000;
  }
  if(Y == 3){
    Z = Z + 100000;
  }
  if(X + Y == 2){
    Z = Z + 400000;
  }
  cout << Z << endl;
}  

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

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

typedef vector<int> vi;

int main() {
	int ans=0;
	int N,H,W;
	cin >> N>>H>>W;
	vector<int> A(N),B(N);
	rep(i,N){
		cin>>A[i]>>B[i];
		if(A[i]>=H and B[i]>=W)ans++;
	}
	cout << ans << endl;
}

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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;

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




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



void printv(vint &v){
  for(auto e:v) cout<<e<<" ";
  cout<<endl;
}


// 繰り返し二乗法
ll power(ll a, ll b){
  if(a==1)return a;
  // if(a==0)re
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

const int MAX=2100000;
 
ll fact[MAX], fact_inv[MAX];
 
void init_fact(ll n){
  fact[0]=1;
  // 階乗の計算
  rep(i, n) fact[i+1]=fact[i]*(i+1)%MOD;
  fact_inv[n]=power(fact[n], MOD-2);
  // 逆元の計算
  for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}
 
ll comb(ll n, ll r){
  return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
 
ll perm(ll n, ll r){
  return (fact[n]*fact_inv[n-r])%MOD;
}






int main() {
  cout<<fixed<<setprecision(10);

  ll x,y,a,b,c; cin>>x>>y>>a>>b>>c;
  vint p(a); rep(i,a) {cin>>p[i]; }
  vint q(b); rep(i,b) {cin>>q[i]; }
  vint r(c); rep(i,c) {cin>>r[i]; }

  sort(ALL(p), greater<ll>());
  sort(ALL(q), greater<ll>());
  sort(ALL(r), greater<ll>());

  ll cnt = 0;
  ll aa,bb, cc;
  aa = bb = cc = 0;
  ll ans = 0;

  ll i,j,k;
  i = j = k = 0;

  while(cnt < x+y){
    cnt++;
    vpint vp;
    if(i < x) vp.push_back(mp(p[i], 2));
    if(j < y) vp.push_back(mp(q[j], 1));
    if(k < c) vp.push_back(mp(r[k], 0));

    sort(ALL(vp), greater<pint>());

    ll val, t;
    tie(val, t) = vp[0];
    ans += val;
    if(t == 2){
      i++;
    }else if(t == 1){
      j++;
    }else{
      k++;
    }
  }

  cout<<ans<<endl;

}






Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define mx 1000002
mt19937 myrand(time(0));

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    ll x;
    cin>>x;
    if(x>=30) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

int main(){
  int A,B;cin >> A >> B;
  if(A==B){
    cout << "Draw" << endl;
    return 0;
  }
  if(A==1){
    cout << "Alice" << endl;
  }else if(B==1){
    cout << "Bob" << endl;
  }else if(A>B){
    cout << "Alice" << endl;
  }else{
    cout << "Bob" << endl;
  }
}

Measured memory_bytes: 256
n,m = map(int,input().split())
A = [0] + list(map(int,input().split()))
B = [ [] for _ in range(n + 1) ]
for _ in range(m):
    s,e = map(int,input().split())
    B[s].append(A[e])
    B[e].append(A[s])
ans = 0
for i in range(1,n+1):
    if len(B[i]) == 0:
        ans += 1
    elif max(B[i]) < A[i]:
        ans += 1
print(ans)

Measured memory_bytes: 22992
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N,K; cin>>N>>K;
	vector<int> h(N);
	rep(i,N)cin>>h[i];
	sort(all(h));
	int ans = inf;
	for(int i = 0; i+K<=N; ++i){
		int t = h[i+K-1] - h[i];
		ans = min(ans, t);
	}
	cout<<ans<<endl;
	return 0;
}

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define int ll
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define vi vector<int>
#define pii pair<int,int>
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define MAX 500005
#define initialize(arr,elem) memset(arr,elem,sizeof(arr))

typedef long long ll;
// typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int dp[3010][3010];
string s,t;
int solve(int i, int j){
	if (i<0 or j<0) return 0;
	if (dp[i][j] != -1) return dp[i][j];

	if (s[i]==t[j]) return dp[i][j] = 1 + solve(i-1,j-1);
	return dp[i][j] = max(solve(i-1,j),solve(i,j-1));	
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
		
	

	initialize(dp,-1);
	cin>>s>>t;	
	int res = solve(s.length()-1,t.length()-1);
	int x = s.length()-1,y=t.length()-1;
	char ans[res+1];
	int index =res;
	ans[index] = '\0';
	index--;
	while(index>=0 ){
		if (s[x] == t[y]) {
			ans[index] = s[x];
			x--,y--,index--;
		}
		else if (x == 0) y--;
		else if (y==0) x--;
		else if (dp[x-1][y]>dp[x][y-1]) x--;
		else y--;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 71296
#include<stdio.h>

int main(){
	int i = 0, j = 0;
	for( i = 1; i <= 9; i++ ){
		for( j = 1; j <= 9; j++ ){
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	return 0;
}

Measured memory_bytes: 520
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, k;
	cin>>n>>k;
	
	vector<long> health(n);
	for(int i=0; i<n;i++)
	{
		cin>>health[i];
	}
	sort(health.begin(), health.end(), greater<int>());
	long long sum = 0LL;
	
	if(k > 0)
		health.erase(health.begin(), health.begin()+min(k,n));
	
	for(int i=0; i<health.size(); i++)
	{
		sum += (long long)health[i];	
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 1792
// https://atcoder.jp/contests/abc140/tasks/abc140_c
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> b(n - 1);
    REP(i, n - 1) cin >> b[i];
    ll sum = 0;
    REP(i, n) {
        if (i == 0)
            sum += b[0];
        else if (i == n - 1)
            sum += b[n - 2];
        else
            sum += min(b[i - 1], b[i]);
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from math import gcd

X = read_a_int()
# a5乗を全列挙？
candi = []
for i in range(10**10):
    if + (i + 1) ** 5 - i ** 5 > 10**11:
        break
    candi.append((i ** 5, i))
    candi.append((-i ** 5, -i))
candi.append((i ** 5, i))
candi.append((-i ** 5, -i))
# print(candi)

for a5, a in candi:
    for b5, b in candi:
        if a5 - b5 == X:
            print(a, b)
            exit()


Measured memory_bytes: 68872