akhauriyash/Code-Regression huggingface dataset:
import Data.Maybe
import Data.List
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInt' = fst.fromJust.C.readInt
readLnInt = map readInt'.C.words<$>C.getLine
readCsInt n = concat<$>replicateM n readLnInt

x ? (a,b) = if x then a else b

a~>(f,x) = [a] ++ (null x)?([],f x)

main = do
 [n,k] <- readLnInt
 inputs <- readCsInt (2*k)
 print $ solve n k inputs

solve n k s = n - (length treatable) where
  treatable = nub $ trim s

trim [] = []
trim (a:as) = (take a as) ++ trim (drop a as)


Measured memory_bytes: 4712
#include <bits/stdc++.h>
#include <set>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


// const double PI = acos(-1);

void solve() {
  string s;
  cin >> s;

  int w;
  cin >> w;
  string ans;
  int n = s.size();
  for (int i= 0; i < n; i+=w) {
    ans += s[i];
  }

  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv : to;
import std.algorithm : fill;
import std.math : sqrt;



void main() {
    int input;
    immutable limitList = 200000;
    bool[] listNumbers = new bool[](limitList);
    int[] listPrimeNumbers;

    listNumbers.fill(true);
    foreach (i; 2..limitList.to!double.sqrt.to!int) {
        if (listNumbers[i]) {
            for (int j = i*2; j < limitList; j += i) listNumbers[j] = false;
        }
    }

    foreach (i; 2..listNumbers.length) {
        if (listNumbers[i]) {
            listPrimeNumbers ~= i.to!int;
        }
    }

    while ((input = readln.chomp.to!int) != 0) {
        ulong sum = 0;

        foreach (i; 0..listPrimeNumbers.length) {
            if (i == input) break;
            sum += listPrimeNumbers[i];
        }

        writeln(sum);
    }
}

Measured memory_bytes: 1232
#include <stdio.h>

int main(){
	
	int n;
	scanf ("%d", &n);
	long long int result = 0;
	for (int i = 0; i <= n; i++){
		int check = 0;
		if (i % 3 == 0 || i % 5 == 0){
			check = 1;
		}
		else if(check == 0){
			result += i;
		}
	}
	printf ("%lld\n", result);
	
	return 0;
	
}

Measured memory_bytes: 1672
K = int(input())
x = 7
ans = 1
if x%K==0:
  print(ans)
  exit()
visited = [0]*(K+1)
while x!=0:
  x %= K
  x = x*10+7
  x %= K
  if visited[x]:
    print(-1)
    exit()
  visited[x] = 1
  ans += 1
print(ans)


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

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

int N;
std::vector< std::bitset<10> > F;
VI2 P;
int main() {
    std::cin >> N;
    F.resize(N, std::bitset<10>(0));
    REP(i, N) {
        REP(j, 10) {
            int f;
            std::cin >> f;
            F[i][9-j] = (f == 1 ? true : false);
        }
    }

    P.resize(N, VI(11));
    REP(i, N) REP(j, 11) {
        std::cin >> P[i][j];
    }

    int r = (1 << 10);
    long ans = -1e10;
    for(int i=0; i<r; ++i) {
        std::bitset<10> mask(i);
        if(mask.count() == 0) continue;

        long sum = 0;
        REP(j, N) {
            std::bitset<10> same = mask & F[j];
            sum += P[j][same.count()];
        }
        ans = std::max(ans, sum);
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
N, M, Q = map(int, input().split())
A = []
for i in range(Q):
  A.append(list(map(int, input().split())))
def f(B, n):
  ans = 0
  if len(B) < N:
    for i in range(n, M+1):
      ans = max(ans, f(B+[i], i))
  else:
    for j in range(Q):
      if B[A[j][1]-1] - B[A[j][0]-1] == A[j][2]:
        ans += A[j][3]
    return ans
  return ans
print(f([], 1))

Measured memory_bytes: 8988
#include<stdio.h>
#include<algorithm>
long long min(const long long&a,const long long &b ){
	return a<b?a:b;
}
using namespace std;
long long n,k;
int main(){
	scanf("%lld %lld",&n,&k);
	long long tmp = n%k;
	printf("%lld\n",min(tmp,k-tmp));
	return 0;
} 

Measured memory_bytes: 256
// atcoder/abc135/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  lli a, b;
  while (cin >> a >> b) {
    if (a < b) swap(a, b);
    lli c = a - b;
    if (c % 2) cout << "IMPOSSIBLE" << endl;
    else cout << c / 2 + b << endl;
  }

  return 0;
}


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

#define ll long long
#define ld long double
#define ull unsigned long long
using namespace std;

const ld PI = acosl(-1.0);
const ll mod = 1000000007;
const ll inf = 9223372036854775803;
const int maxN = 6;//1000000;

int main() {
    cout.precision(10);
    cout << fixed;
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ld a,b,h,m;
    cin >> a >> b >> h >> m;
    ld x1 = a*sin((h*30 + m/2)*2*PI/360);
    ld y1 = a*cos((h*30 + m/2)*2*PI/360);
    ld x2 = b*sin(m*2*PI*6/360);
    ld y2 = b*cos(m*2*PI*6/360);
    cout << sqrt((x1-x2)*(x1-x2) + (y1 - y2)*(y1 - y2));
    return 0;
}

Measured memory_bytes: 4184
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
num = 2 ** (max(int(math.log2(max(a))) + 1, int(math.log2(k + 0.0001)) + 1))
num2 = int(math.log2(num))
for i in range(n):
    a[i] = bin(a[i] + num)[3:]
binary = [[i,0,0] for i in range(num2)]
for i in range(n):
    for j in range(num2):
        if a[i][j] == "0":
            binary[num2 - j - 1][1] += 1
        else:
            binary[num2 - j - 1][2] += 1
binary.sort(reverse = True)
ans = 0
check = 0
for i in range(len(binary)):
    if binary[i][1] > binary[i][2]:
        check += 2 ** binary[i][0]
        if check <= k:
            ans += binary[i][1] * (2 ** binary[i][0])
        else:
            check -= 2 ** binary[i][0]
            ans += binary[i][2] * (2 ** binary[i][0])
    else:
        ans += binary[i][2] * (2 ** binary[i][0])
print(ans)

Measured memory_bytes: 14208
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/graph/edge.hpp"


template <typename T> struct edge {
  int to;
  T cost;
};

#line 2 "/mnt/c/Users/leafc/dev/compro/lib/graph/dijkstra.hpp"
#include <climits>
#include <limits>
#include <queue>
#include <vector>

#ifndef DIJKSTRA
#define DIJKSTRA

// sからの各頂点への最短距離を返す。計算量はO(E logV)
template <class T> std::vector<T> dijkstra(const int s, const std::vector<std::vector<edge<T>>> &g) {
  std::priority_queue<std::pair<T, int>, std::vector<std::pair<T, int>>, std::greater<std::pair<T, int>>> q;

  constexpr T MAX = std::numeric_limits<T>::max();
  std::vector<T> d(g.size(), MAX);
  d[s] = 0;
  q.push(std::make_pair(d[s], s));

  while (!q.empty()) {
    const auto p = q.top();
    q.pop();

    const int v = p.second;
    if (d[v] < p.first)
      continue;

    for (const auto e : g[v]) {
      const int u = e.to;
      const T next_cost = d[v] + e.cost;
      if (d[u] <= next_cost)
        continue;
      d[u] = next_cost;
      q.push(std::make_pair(d[u], u));
    }
  }
  return d;
}

#endif
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << "\n"; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 3 "tmp.cpp"

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

  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--;
  t--;
  vector<vector<edge<ll>>> g1(n), g2(n);
  REP(i, m) {
    int u, v;
    ll a, b;
    cin >> u >> v >> a >> b;
    u--;
    v--;
    g1[u].push_back({v, a});
    g1[v].push_back({u, a});
    g2[u].push_back({v, b});
    g2[v].push_back({u, b});
  }

  auto d1 = dijkstra(s, g1);
  auto d2 = dijkstra(t, g2);
  vector<pair<ll, int>> val(n);
  REP(i, n) { val[i] = {d1[i] + d2[i], i}; }
  sort(val.begin(), val.end());
  vl ans(n);
  int now = 0;
  REP(i, n) {
    auto cur = val[i];
    if (cur.second < now)
      continue;
    FOR(j, now, cur.second + 1) { ans[j] = cur.first; }
    now = cur.second + 1;
  }
  REP(i, n) { cout << (ll)1e15 - ans[i] << endl; }

  return 0;
}


Measured memory_bytes: 20552
#include<stdio.h>
int main(void){
	int a,b,i;
	char moji[10000]={0};
	while(scanf("%s",moji)!=EOF){
	a=0,b=0,i=0;
		while(moji[i+1]!='\0'){
			if(moji[i]=='J' && moji[i+1]=='O' && moji[i+2]=='I')a++;
			else if(moji[i]=='I' && moji[i+1]=='O' && moji[i+2]=='I')b++;
			i++;
		}
		printf("%d\n%d\n",a,b);
	}
	return 0;
}


Measured memory_bytes: 1872
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define Endl endl

int main(){
double a,b,h,m;
    cin>>a>>b>>h>>m;
    h=(h*60+m);
    double degh= (double)(360*h)/(60*12);
    double degm= (double)(360*m)/60;
    double angle= abs(degh-degm); // in deg
    angle= double(angle)*( (double)M_PI /180);
    int a2 = a*a;
    int b2 = b*b;
    double ans =(double) a2 + (double)b2 - (double)2 * a * b * cos(angle);

    cout<<fixed<<setprecision(10)<<sqrt(ans)<<endl;
    return 0;
}

Measured memory_bytes: 4228
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
int main(void){
  int N,H,W,i;
  int h=1,w=1;
  scanf("%d",&N);
  scanf("%d",&H);
  scanf("%d",&W);

  h+=N-H;
  w+=N-W;

  printf("%d",h*w);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstring>

#define forn(i,n) for(int i=0; i<(n); i++)
#define forr(i,x,n) for(int i=(x); i<(n); i++)

using namespace std;

typedef unsigned long long ll;

ll K;
string S;

int main(){
    cin >> S;
    cin >> K;

    K--;
    forn(i,S.size()){
        if( K==i ){ cout << S[i] << endl; return 0; }
        if( S[i]-'0'>1 ){ cout << S[i] << endl; return 0; }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;


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


  int a, b, c, d;
  cin >> a >> b >> c >> d;

  pr((abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d) ? "Yes" : "No"));

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << "-1"; return;}

const int N = 1007;

vector <int> g[N], ag[N], ord;
bitset<N> used, bad;

void top_sort(int v) {
    used[v] = 1;
    for (int u : g[v])
        if (!used[u] && !bad[u])
            top_sort(u);
    ord.pb(v);
}

void solve() {
    int n, m;
    cin >> n >> m;
    loop(i, m) {
        int u, v;
        cin >> u >> v;
        g[u].pb(v);
        ag[v].pb(u);
    }
    loop1(i, n) {
        bad[i] = 1;
        loop1(v, n)
            if (!bad[v] && !used[v])
                top_sort(v);
        reverse(all(ord));
        used = 0; 
        bool ok = 0;
        for (int v : ord) {
            used[v] = 1;
            for (int u : ag[v])
                if (!bad[u] && !used[u])
                    ok = 1;
        }
        if (!ok)
            bad[i] = 0;
        used = 0; ord.clear();
    }
    vector <int> ans;
    loop1(i, n)
        if (!bad[i])
            ans.pb(i);
    if (ans.size() == n) {
        top_sort(1);
        if (ord.size() == n) {
            used = 0; ord.clear();
            top_sort(2);
            if (ord.size() != n)
                no;
        }
        else
            no;
    }
    cout << ans.size() << "\n";
    for (int x : ans)
        cout << x << "\n";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define pq priority_queue
#define st first
#define nd second
#define np next_permutation

using namespace std;
typedef long long ll;
ll const inf = 1e9;
ll const mod = 1e9 + 7;
int cnt1[100005];
int cnt2[100005];
int lef[100005];
int rig[100005];

int main()
{
    int n;
    cin >> n;
    int a[n];

    fr(i, 0, n){
        cin >> a[i];
        if(i % 2 == 0)cnt1[a[i]] ++;
        else cnt2[a[i]] ++;
    }



    fr(i, 1, 100001){
        lef[i] = max(lef[i - 1], cnt1[i]);
    }
    for(int i = 100000; i >= 0; i --){
        rig[i] = max(rig[i + 1], cnt1[i]);
    }
    int ans = 1e9;
    n /= 2;
    fr(i, 1, 100001){
        ans = min(ans, n - cnt2[i] + (n - max(lef[i - 1], rig[i + 1])));

    }
   cout << ans << endl;
}



Measured memory_bytes: 2176
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		while (!str.equals("0")) {
			int n = Integer.parseInt(str);
			int[] cardA = new int[n];
			int[] cardB = new int[n];
			int scoreA = 0;
			int scoreB = 0;
			for (int i = 0; i < n; i++) {
				str = br.readLine();
				String[] number = str.split(" ");
				cardA[i] = Integer.parseInt(number[0]);
				cardB[i] = Integer.parseInt(number[1]);
				if (cardA[i] > cardB[i]) {
					scoreA = scoreA + cardA[i] + cardB[i];
				} else if (cardA[i] < cardB[i]) {
					scoreB = scoreB + cardA[i] + cardB[i];
				} else {
					scoreA = scoreA + cardA[i];
					scoreB = scoreB + cardB[i];
				}
			}
			System.out.println(scoreA + " " + scoreB);
			str = br.readLine();
		}
	}
}

Measured memory_bytes: 33908
// 2717 ???????????????
import java.util.Scanner;
class Main{
    
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        System.out.println(a*b+" "+(2*a+2*b));
        
    }
}

Measured memory_bytes: 17156
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

const int INF =  405;

struct edge {int to, cap, rev;};

class FordFolkerson{
    public:
        FordFolkerson(int n){
            N = n;
            G = vector<vector<edge>>(n, vector<edge>());
            used = vector<bool>(n, false);
        }

        void add_edge(int from, int to, int cap){
            G[from].push_back((edge{to, cap, (int)G[to].size()}));
            G[to].push_back((edge{from, 0, (int)G[from].size()-1}));
        }

        int max_flow(int s, int t){
            int flow = 0;
            while(true){
                clear_used();
                int f = dfs(s, t, INF);
                if(f == 0){
                    break;
                }
                flow += f;
            }
            return flow;
        }

    private:
        vector<vector<edge>> G;
        vector<bool> used;
        int N;
        void clear_used(){
            for(int i = 0; i < N; i++) used[i] = false;
        }

        int dfs(int v, int t, int f){
            if(v == t) return f;
            used[v] = true;
            for(int i = 0; i < G[v].size(); i++){
                edge &e = G[v][i];
                if(!used[e.to] && e.cap > 0){
                    int d = dfs(e.to, t, min(f, e.cap));
                    if(d > 0){
                        e.cap -= d;
                        G[e.to][e.rev].cap += d;
                        return d;
                    }
                }
            }
            return 0;
        }
};

int H, W;
int to_idx(int h, int w){
    return h*W+w;
}

int dh[4] = {0, 0, -1, 1};
int dw[4] = {-1, 1, 0, 0};

bool is_in_field(int i, int j){
    return i >= 0 && i < H && j >= 0 && j < W;
}

int to_in_idx(int h, int w){
    return 1+h*W+w;
}

int to_out_idx(int h, int w){
    return 1+H*W+h*W+w;
}

char c[100][100];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> H >> W;
    FordFolkerson ff(3+2*H*W);
    int s = 0, t = 2*H*W+2;
    bool ok = true;
    for(int h = 0; h < H; h++){
        for(int w = 0; w < W; w++){
            cin >> c[h][w];
            int in_idx = 1+h*W+w;
            int out_idx = 1+H*W+h*W+w;
            if(c[h][w] == 'X'){
                ff.add_edge(s, in_idx, INF);
                ff.add_edge(in_idx, out_idx, INF);
            }else{
                ff.add_edge(in_idx, out_idx, 1);
            }
            if(h == 0 || h == H-1 || w == 0 || w == W-1){
                ff.add_edge(out_idx, t, INF);
                if(c[h][w] == 'X') ok = false;
            }
            for(int i = 0; i < 4; i++){
                int h_to = h+dh[i], w_to = w+dw[i];
                if(is_in_field(h_to, w_to)){
                    ff.add_edge(to_out_idx(h_to, w_to), in_idx, 1);
                    ff.add_edge(out_idx, to_in_idx(h_to, w_to), 1);
                }
            }
        }
    }
    if(!ok){
        cout << -1 << endl;
    }else{
        cout << ff.max_flow(s, t) << endl;
    }
}

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

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

    ll a, b; cin >> a >> b;
    ll sum = 0;
    for (int i = 0; i < n - 2; i++) {
        ll save; cin >> save;
        sum ^= save;
    }

    ll ab = a + b - sum;
    if (ab < 0 || ab % 2 == 1) {
        cout << -1 << endl;
        return 0;
    }

    ab /= 2; 
    if ((ab & sum) || ab > a) {
        cout << -1 << endl;
        return 0;
    }

    ll MAX = ab;
    for (int i = 60; i >= 0; i--) {
        if ((1ll << i) & sum) {
            if ((MAX ^ (1ll << i)) <= a) {
                MAX ^= 1ll << i;
            }
        }
    }

    cout << (MAX == 0 ? -1 : a - MAX) << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int A,B,C;
    int Ans=0;
    int X;
    cin >> A >> B >> C >> X;
    REP(i,A+1){
        REP(j,B+1){
            REP(k,C+1){
                if(i*500+j*100+k*50==X){
                    Ans++;
                }
            }
        }
    }
    cout << Ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(long long i=0;i<(n);i++)
#define rep2(i,m,n) for(long long i=(m);i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back







int main(){

    int n;
  	cin>>n;

    vi value(n);
    rep(i,n){
        cin>>value.at(i);
    }
    vi cost(n);
    rep(i,n){
        cin>>cost.at(i);
    }

    int ans=0;

    rep(i,n){
        if (value.at(i)-cost.at(i)>0){
            ans+=value.at(i)-cost.at(i);
        }
    }

    cout<<ans<<endl;

}








            






Measured memory_bytes: 3584
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    int m1,d1,m2,d2;
    cin>>m1>>d1;
    cin>>m2>>d2;
    if(d1>d2) cout<<1;
    else cout<<0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
    string N;
    cin >> N;
    bool found(false);
    for (int i = 0; i < N.size(); i++) {
        if (N[i] == '7') {
            found = true;
            break;
        }
    }
    cout << ((found) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
int main(){
    string str,dummy;
    int time;
    cin>>str;
    cin>>time;
    int answer=0;
    for(int i=0;i<time;++i){
        cin>>dummy;
        dummy+=dummy;
        if(dummy.find(str)!=string::npos)++answer;
    }
    cout<<answer<<endl;
    return 0;
}

Measured memory_bytes: 3176
#include<stdio.h>

int main(){
	int A,B,C,D;
	int i=0,j=0;
	scanf("%d %d %d %d",&A,&B,&C,&D);
	
	do{
		C = C-B;
		i++;
	}while(C > 0);
	
	do{
		A = A-D;
		j++;
	}while(A > 0);
	
	if(i > j){
		printf("No");
	}
	else{
		printf("Yes");
	}
		
		

}

Measured memory_bytes: 1700
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#define  _SCL_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
//Boost
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/miller_rabin.hpp>
#include <boost/random.hpp>
namespace mp = boost::multiprecision;
*/
using namespace std;
#define REP(a,b) for(long long a = 0;a < b;++a)
long long dp[1000][6] = {};
int is_it[1000] = {};
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	vector<pair<int, int>> hoge;
	REP(i, k) {
		int a, b;
		cin >> a >> b;
		is_it[a] = b;
	}
	if (is_it[1] == 0) {
		dp[1][0] = 1;
		dp[1][2] = 1;
		dp[1][4] = 1;
	}
	else {
		if (is_it[1] == 1) {
			dp[1][0] = 1;
		}
		else if(is_it[1] == 2) {
			dp[1][2] = 1;
		}
		else {
			dp[1][4] = 1;
		}
	}
	for (int i = 2;i <= n;++i) {
		if (is_it[i] == 0) {
			dp[i][1] = dp[i - 1][0];
			dp[i][3] = dp[i - 1][2];
			dp[i][5] = dp[i - 1][4];
			dp[i][0] = dp[i - 1][2] + dp[i - 1][3] + dp[i - 1][4] + dp[i - 1][5];
			dp[i][2] = dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][4] + dp[i - 1][5];
			dp[i][4] = dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][2] + dp[i - 1][3];
		}
		else {
			if (is_it[i] == 1) {
				dp[i][1] = dp[i - 1][0];
				dp[i][0] = dp[i - 1][2] + dp[i - 1][3] + dp[i - 1][4] + dp[i - 1][5];
			}
			else if (is_it[i] == 2) {
				dp[i][3] = dp[i - 1][2];
				dp[i][2] = dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][4] + dp[i - 1][5];
			}
			else {
				dp[i][5] = dp[i - 1][4];
				dp[i][4] = dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][2] + dp[i - 1][3];
			}
		}
		for (int q = 0;q < 6;++q) {
			dp[i][q] %= 10000;
		}
	}
	long long ans = 0;
	for (int i = 0;i < 6;++i) {
		ans += dp[n][i];
	}
	ans %= 10000;
	cout << ans << endl;
}


Measured memory_bytes: 3140
import java.util.*;
import java.util.concurrent.LinkedBlockingDeque;

public class Main {
    public static class Node {
        int current;
        int father;
        public Node(int current, int father) {
            this.current = current;
            this.father = father;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Node node = (Node) o;

            if (current != node.current) return false;
            return father == node.father;

        }

        @Override
        public int hashCode() {
            int result = current;
            result = 31 * result + father;
            return result;
        }
    }
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        Map<Integer, Set<Integer>> fathers = new HashMap<>();
        Map<Integer, Set<Integer>> sons = new HashMap<>();
        Set<Integer> roots = new HashSet<>();
        int [] fatherCounts = new int[n + 1];
        for (int i = 1; i <= n; ++i) {
            roots.add(i);
        }
        for (int i = 0; i < n + m - 1; i++) {
            int u = scanner.nextInt();
            int v = scanner.nextInt();
            Set<Integer> descendants = sons.getOrDefault(u, new HashSet<>());
            descendants.add(v);
            sons.put(u, descendants);
            roots.remove(v);
            ++fatherCounts[v];
            Set<Integer> parents = fathers.getOrDefault(v, new HashSet<>());
            parents.add(u);
            fathers.put(v, parents);
        }
        int root = -1;
        for (final int r : roots) {
            root = r;
        }
        int [] reorder = new int[n];
        int numNode = 0;
        reorder[numNode++] = root;
        Map<Integer, Integer> nodeReorder = new HashMap<>();
        nodeReorder.put(root, 0);
        for (int i = 0; i < numNode; ++i) {
            for (int son : sons.getOrDefault(reorder[i], new HashSet<>())) {
                if (--fatherCounts[son] == 0) {
                    reorder[numNode++] = son;
                    nodeReorder.put(son, numNode - 1);
                }
            }
        }

        for (int i = 1; i <= n; ++i) {
            if (!fathers.containsKey(i)) {
                System.out.println(0);
                continue;
            }
            int fatherWithMaxReorder = -1;
            for (int father : fathers.get(i)) {
                if (fatherWithMaxReorder == -1 || nodeReorder.get(father) > nodeReorder.get(fatherWithMaxReorder)) {
                    fatherWithMaxReorder = father;
                }
            }

            System.out.println(fatherWithMaxReorder);
        }

    }
}


Measured memory_bytes: 171640
#include<stdio.h>

int main(){
	int n,x;
	int count;
	int i,j,k;
	
	while(1){
		scanf("%d %d",&n,&x);
		if(n==0 && x==0)   break;
		
		count=0;
		for(i=1;i<=n-2;i++){
			for(j=i+1;j<=n-1;j++){
				for(k=j+1;k<=n;k++){
					if(i+j+k == x)   count++;
				}
			}
		}
		printf("%d\n",count);
	}
	
	return 0;
}

Measured memory_bytes: 600
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
const ll mod = 1000000007;
const ll mod9 = 1000000009;

signed main(){
    string s;
    cin>>s;
    ll t = 0;
    ll mt = 0;
    rep(i,3){
        if (s[i]=='R') t++;
        else t=0;
        mt = max(t,mt);
    }
    cout<<mt<<endl;
}


Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	int tafel[n];
	int i;
  
	for( i=0; i<n; i++ ){
		cin >> tafel[i];
	}
	 
	int sum = 0;
  
  	while(1){
  	for(i=0; i<n; i++){
			if(tafel[i] % 2 == 0){
				tafel[i] /= 2; 
			}
			else{
				goto end;
			}
	}
    sum++;
    }
	
	end:
	cout << sum << endl;	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; using namespace atcoder;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
struct UnionFind {
	using T = int;
	const T def = 0;
	T f(T a, T b) { return a + b; }
	//==========================================
	vector<int> par;
	vector<T> value;
	UnionFind() {}
	UnionFind(int NV) { init(NV); }
	void init(int NV) { par.clear(); rep(i, 0, NV) par.push_back(i); value.resize(NV, 1); }
	void reset() { rep(i, 0, par.size()) par[i] = i; }
	int operator[](int x) {
		if (par[x] == x) return x;
		else {
			int res = operator[](par[x]);
			if (res != par[x]) {
				value[res] = f(value[res], value[par[x]]);
				value[par[x]] = def;
			}
			return par[x] = res;
		}
	}
	// uf(x,y)->y
	void operator()(int x, int y) {
		x = operator[](x); y = operator[](y);
		if (x != y) {
			value[y] += value[par[x]];
			value[par[x]] = def;
			par[x] = y;
		}
	}
	T getValues(int x) { return value[operator[](x)]; };
};
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, M;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> M;

	UnionFind uf(N);
	rep(i, 0, M) {
		int a, b; cin >> a >> b;
		a--; b--;
		uf(a, b);
	}

	int grp = 0;
	rep(i, 0, N) if (uf[i] == i) grp++;
	int ans = grp - 1;
	cout << ans << endl;
}







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

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

  double pi = 3.14159265359;
  p = p * pi / 180;

  double s, c, l, h;
  s = a * b * sin(p) / 2;
  c = pow((pow(a, 2) + pow(b, 2) - 2 * a * b * cos(p)), 0.5);
  l = a + b + c;
  h = b * sin(p);

  cout << fixed << setprecision(7);
  cout << s << endl;
  cout << l << endl;
  cout << h << endl;
}


Measured memory_bytes: 3500
function main (s) {
    s=s.split(" ");
	s[0]=parseInt(s[0]);
	s[1]=parseInt(s[1]);
	var g=[1,3,1,2,1,2,1,1,2,1,2,1];
	console.log((g[s[0]-1]==g[s[1]-1])?"Yes\n":"No\n");
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
sx, sy, tx, ty = map(int, input().split())

holizontal = tx - sx
vertical = ty - sy

ans = ['L']
ans += ['U'] * (vertical + 1)
ans += ['R'] * (holizontal + 1)
ans += ['D']
ans += ['L'] * holizontal
ans += ['D'] * (vertical + 1)
ans += ['R'] * (holizontal + 1)
ans += ['U'] * (vertical + 1)
ans += ['L']
ans += ['D'] * vertical
ans += ['L'] * holizontal

print(''.join(ans))


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

int twoCheck(int n) {
  int cnt = 0;
  while (n % 2 == 0) {
    n /= 2;
    cnt++;
  }
  return min(2, cnt);
}

signed main() {
  int n, inp, zero = 0, two = 0, four = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> inp;
    if (twoCheck(inp) == 0) zero++;
    if (twoCheck(inp) == 1) two++;
    if (twoCheck(inp) == 2) four++;
  }
  
  if (two == 0 and n % 2 == 1) four++;
  
  if (zero > four) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 640
import sys
from bisect import bisect_left
read = sys.stdin.read

N, *A = map(int, read().split())
A.sort()
zero = bisect_left(A, 0)
xy = []
for i in range(1, N - 1):
    if i < zero:
        xy.append((A[-1], A[i]))
        A[-1] -= A[i]
    else:
        xy.append((A[0], A[i]))
        A[0] -= A[i]

print(A[-1] - A[0])
for x, y in xy:
    print(x, y)
print(A[-1], A[0])

Measured memory_bytes: 19196
#include <iostream>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main()
{
    int m,n,o=100,i,j,k;
    //long long int m,n,o,i,j,k;
    //float f,g,h;
    //char c,d;
    //string a;
    cin>>m>>n;
    //cin>>m>>c>>n>>d>>i;
    //cin>>f>>g;
    //cin>>c;
    for(i=0;i<=m;i++)
    {
        for(j=0;j<=m-i;j++)
        {
            for(k=0;k<=m-i-j;k++)
            {
                if((i*10000+j*5000+k*1000)==n)
                {
                    if(i+j+k!=m) continue;
                    cout<<i<<" "<<j<<" "<<k;
                    return 0;
                }
            }
        }
    }
    cout<<"-1 -1 -1";
    return 0;
}



Measured memory_bytes: 384
from math import gcd




def resolve():
    N = int(input())

    sm =0
    for i in range(1,N+1):
        for j in range(1,N+1):
            tmp = gcd(i,j)
            for k in range(1,N+1):
                sm += gcd(tmp,k)
    print(sm)



if __name__ == "__main__":
    resolve()

Measured memory_bytes: 67772
#include <iostream>
#include <vector>
#include <map>

using namespace std;

const int MOD = 998244353;

long long modPow(long long a, long long p){
    if(p == 0) return 1;
    auto res = modPow(a, p/2);
    res = (res*res)%MOD;
    if(p%2) res = (res*a)%MOD;
    return res;
}

int bitCount(int t){
    int res = 0;
    for(int i=t;i;i&=i-1) ++res;
    return res;
}

int main(){
    int N, M;
    while(cin >> N >> M){
        vector<map<int, int>> mp(N);
        for(int i=0;i<M;i++){
            int a, b, c;
            cin >> a >> b >> c;
            mp[a-1][b-1] = c;
        }
        vector<long long> dp(2, 0LL);
        if(mp[0].count(0)){
            dp[mp[0][0]] = 1;
        } else {
            dp[0] = dp[1] = 1;
        }
        for(int i=0;i<N-1;i++){
            vector<long long> next(2, 0LL);
            for(int j=0;j<16;j++){
                if(bitCount(j)%2) continue;
                bool ok = true;
                for(int k=0;k<4;k++){
                    int da = k%2, db = k/2;
                    int c = (j>>k)%2;
                    if(mp[i+da].count(i+db)){
                        if(mp[i+da][i+db] != c) ok = false;
                    }
                }
                if(!ok) continue;
                int m = 1;
                if(i > 0){
                    if(mp[i-1].count(i+1)){
                        if(mp[i+1].count(i-1)){
                            if((mp[i-1][i+1] + mp[i+1][i-1])%2 != j%2) continue; 
                        }
                    } else if(!mp[i+1].count(i-1)){
                        m = 2;
                    }
                }
                next[(j>>3)%2] += m * dp[j%2];
                next[(j>>3)%2] %= MOD;
            }
            dp = next;
        }
        long long res = (dp[0]+dp[1])%MOD;
        long long sub = 0;
        for(int i=0;i<N;i++){
            for(auto& p : mp[i]){
                if(abs(p.first - i) <= 2) continue;
                if(mp[p.first].count(i)){
                    if(mp[i][p.first] != mp[p.first][i]) res = 0;
                    if(i < p.first) ++sub;
                } else {
                    ++sub;
                }
            }
        }
        if(N >= 4){
            res *= modPow(2, (N-2LL)*(N-3LL)/2 - sub);
            res %= MOD;
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 7296
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <vector>
#include <memory>
#include <map>
#include <random>
#include <set>
using namespace std;

vector<int> calcSmallestPref(string a, string b){
    size_t n = a.size();
    vector<int> smallest_pref(n,-1);

    smallest_pref[0] = (a[0] == b[0]);
    for(int i = 1; i < n; i++){
        smallest_pref[i] = smallest_pref[i-1];

        if(smallest_pref[i-1] < b.size() && a[i] == b[smallest_pref[i-1]])
            smallest_pref[i]++;
    }
    return smallest_pref;
}

template<typename T>
T reversed(T a){
    reverse(a.begin(), a.end());
    return a;
}

void run(std::istream &cin, std::ostream &cout) {
    int a, b, c;
    cin >> a >> b >> c;
    int untasty_with_poison = min(a, c);
    c -= untasty_with_poison;
    a -= untasty_with_poison;

    int tasty_with_poison = min(b, c);
    c -= tasty_with_poison;
    b -= tasty_with_poison;

    int tasty_left = b;

    cout << untasty_with_poison + 2*tasty_with_poison + tasty_left + (c > 0);
}

int main() {
#ifdef  LOCAL
    std::ifstream cin("input.txt"); // ofstream cout("output.txt");
#else
    std::cin.tie(nullptr); std::ios::sync_with_stdio(false);
#endif
    run(cin, std::cout);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	long long n, k, s, i;
	cin >> n >> k;
	s = 1;
	while (n--) {
		s = min(s * 2, s + k);
	}
	cout << s << "\n";

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int main() {
	int n;
	cin >> n;
	ll y;
	cin >> y;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			if ((y - (i * 10000 + 5000 * j))/1000==n-i-j&&n-i-j>=0) {
				cout << i << " " << j << " " << n - i - j << endl;
				return 0;
			}
		}
	}
	cout << "-1" << " " << "-1" << " " << "-1" << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

def factorial(x):
	ans = 1
	for i in range(2, x+1):
		ans *= i
	return ans
	
def order(P):
	ranks = []
	used = [False] * (n+1)
	for i in range(n):
		c = P[i]
		j = 1
		rank = 0
		while j <= c:
			if not used[j]:
				rank += 1
			j += 1
		used[c] = True
		ranks.append(rank)
	return rank2order(ranks)
	
def rank2order(ranks):
	ng = factorial(n)
	order = 1
	for i in range(n-1):
		ng = ng // (n-i)
		order += ng*(ranks[i]-1)
	return order


a = order(P)
b = order(Q)
print (abs(a-b))

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;

void solve(long long N, std::vector<long long> A, std::vector<long long> B){
  long long ret = 0;
  multiset<pair<long long, int> > q;
  for (int i = 0; i < N; i++) {
    q.insert(make_pair(B[i], i));
  }
  while (!q.empty()) {
    auto a = (--(q.end()));
    if (a->first == A[a->second]) {
      q.erase(a);
    } else {
      long long l, r;
      l = B[((a->second - 1) + N)%N];
      r = B[((a->second + 1) + N)%N];
      if ((B[a->second] - A[a->second]) / (l+r) < 1) {
        std::cout << -1 << std::endl;
        return;
      }
      ret += (B[a->second] - A[a->second]) / (l+r);
      B[a->second] -= ((B[a->second] - A[a->second]) / (l+r)) * (l+r);
      pair<long long, int> t = make_pair(B[a->second], a->second);
      if (B[a->second] < A[a->second]) {
        std::cout << -1 << std::endl;
        return;
      } else if (B[a->second] == A[a->second]) {
        q.erase(a);
      } else {
        q.erase(a);
        q.insert(t);
      }
    }
  }
  std::cout << ret << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
  std::vector<long long> B(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&B[i]);
  }
  solve(N, std::move(A), std::move(B));
  return 0;
}


Measured memory_bytes: 17920
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
x,y,a,b,c = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

A = sorted(list( map(int, input().split()) ), reverse=True)	# 1 2 3 4 5 ...(降順(逆順)ソート付き)
B = sorted(list( map(int, input().split()) ), reverse=True)	# 1 2 3 4 5 ...(降順(逆順)ソート付き)
C = sorted(list( map(int, input().split()) ), reverse=True)	# 1 2 3 4 5 ...(降順(逆順)ソート付き)

#p("A",A)
#p("B", B)
#p("C", C)

A = A[:x]
B = B[:y]

#p("A",A)
#p("B", B)

ans=a=b=c=0

for _ in range(x+y):
	an = 0 if len(A)<=a else A[a]
	bn = 0 if len(B)<=b else B[b]
	cn = 0 if len(C)<=c else C[c]
#	p("a,b,c、an,bn,cn = ",a,b,c, "、", an,bn,cn)
	
	m = max(an,bn,cn)
	ans += m

#	p("ans,m = ",ans,m)

	if m == an:   a+=1
	elif m == bn: b+=1
	elif m == cn: c+=1
#	p("a,b,c = ",a,b,c)

print(ans)


Measured memory_bytes: 23200
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T> void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 998244353;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod) { a %= _mod; b %= _mod; ll res = 1; switch(op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break; } if (res < 0) res += _mod; return res; }


int main()
{
        ll N;
        cin >> N;
        vll D(N);
        rep(i, 0, N) cin >> D[i];
        map<ll, ll> mp;
        rep(i, 0, N) mp[D[i]]++;

        if (mp[0] != 1 or D[0] != 0) {
                cout << 0 << endl;
                return 0;
        }

        ll ans = 1;
        rep(i, 1, N) {
                ans = modc(ans, '*', modc(mp[i-1], '^', mp[i]));
        }

        cout << ans << endl;
}


Measured memory_bytes: 10384
_ = raw_input()
nums = map(int, raw_input().split())

def assert_num(nums):
    is_denied = False
    for num in nums:
        if num % 2 != 0:
            # odd
            continue
        if num % 3 == 0 or num % 5 == 0:
            # OK
            continue
        is_denied = True
    return is_denied
            
print 'DENIED' if assert_num(nums) else 'APPROVED'

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

int main() {
  int N;
  cin >> N;
  int count = 0;
  
  vector<int>p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
    if (p.at(i) != i+1){
      count++;
    }
  }

  if (count == 0 || count == 2){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}
  

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

int N,K;
int main(){
    cin >> N >> K;
    double ans = 0.0;
    rep(i,1,N+1){
        double tmp = 1.0/N;
        int j = 0;
        while(i<<j < K){
            tmp *= 0.5;
            ++j;
        }
        ans += tmp;
    }

    cout << fixed << setprecision(15) << ans << "\n";
    return 0;
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 100005;

int n;

int main() {

	FAST;

	char x;
	cin >> x;
	cout << char (int(x) + 1) << '\n';
	return 0;	
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define UP(i,a,b) for(int i=(a); i<=(b); ++i)
#define DOWN(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) UP(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

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


/*********** variables ************/
string S[100];
int N, L;
/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> L;
    REP(i, N) cin >> S[i];
    sort(S, S+N);
    REP(i, N) cout << S[i];
    cout << endl;
}


Measured memory_bytes: 256