akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define fordebug int hoge;cin>>hoge;

int main(){
  int n[100],it=-1;
  char x;
  while(cin>>x){
    if('0'<=x&&x<='9'){
      it++;
      n[it]=0;
      while(1){
	n[it]*=10;
	n[it]+=x-'0';
	scanf("%c",&x);
	if(x==' ') break;
      }
    }
    else{
      if(x=='+'){
	n[it-1]=n[it-1]+n[it];
      }
      else if(x=='-'){
	n[it-1]=n[it-1]-n[it];
      }
      else if(x=='*'){
	n[it-1]=n[it-1]*n[it];
      }
      it--;
    }
  }
  cout<<n[it]<<endl;
  return 0;
}



Measured memory_bytes: 3236
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		int h1 = Integer.parseInt(str);
		String str2 = sc.next();
		int h2 = Integer.parseInt(str2);
		int g=h1*h2;
        sc.close();
        System.out.println(g);

	}

}

Measured memory_bytes: 35688
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2249

//
//  main.cpp
//

#include <iostream>
#include <algorithm>
#include <vector>
//#include <limits>
#include <math.h>
#include <queue>
//#include <tuple>
//#include <stdio.h>
//#include <stdlib.h>
//#include <string>
//#include "string.h"
#include <unordered_map>
#include <map>
#include <unordered_set>
//#include <array>
#include <set>
#include <limits>

using namespace std;

using ll = long long;

int main() {
    while (true) {
        int N, M;
        cin >> N >> M;
        if (N == 0 && M == 0) {
            return 0;
        }
        struct Edge {
            int to;
            int dist;
            int cost;
            Edge(int to, int dist, int cost) : to(to), dist(dist), cost(cost) {}
        };
        vector<vector<Edge>> graph(N, vector<Edge>());
        for (int i = 0; i < M; i++) {
            int u,v,d,c;
            cin >> u >> v >> d >> c;
            u--;
            v--;
            graph[u].emplace_back(v, d, c);
            graph[v].emplace_back(u, d, c);
        }
        struct P {
            int idx;
            int dist;
            int cost;
            P(int idx, int dist, int cost) : idx(idx), dist(dist), cost(cost) {};
        };
        struct GreaterP {
            bool operator()(const P& lhs, const P& rhs) {
                return lhs.dist > rhs.dist || (lhs.dist == rhs.dist && lhs.cost > rhs.cost);
            }
        };
        priority_queue<P, vector<P>, GreaterP> queue;
        int totalCost = 0;
        vector<bool> reached(N, false);
        vector<int> cities(N, numeric_limits<int>::max() / 2);
        queue.emplace(0, 0, 0);
        cities[0] = 0;
        while (!queue.empty()) {
            P p = queue.top();
            queue.pop();
            if (reached[p.idx]) {
                continue;
            }
            reached[p.idx] = true;
            totalCost += p.cost;
            for (Edge& e : graph[p.idx]) {
                if (cities[p.idx] + e.dist <= cities[e.to]) {
                    cities[e.to] = cities[p.idx] + e.dist;
                    queue.emplace(e.to, cities[e.to], e.cost);
                }
            }
        }
        cout << totalCost << endl;
    }
    return 0;
}




Measured memory_bytes: 4124
#include<stdio.h>

int main(void)
{
int sn,h,m,s;
scanf("%d",&sn);
h = sn/3600;
m = (sn-(h*3600))/60;
s = sn-h*3600-m*60;
printf("%d:%d:%d\n",h,m,s);
return 0;
}

Measured memory_bytes: 592
N,X = map(int,input().split())
M = [int(input()) for _ in range(N)]
M.sort()
result = 0
for i in range(N):
  if X >= M[i]:
    X -= M[i]
    result += 1
  else:
    break
while X >= M[0]:
  X -= M[0]
  result += 1
print(result)

Measured memory_bytes: 3064
function Main(input){
  input = input.split("\n");
  const S = input[0].split("");
  const T = input[1].split("");
  
  const L = S.length
  
  for( let i = 0; i <= L; i++ ){
  	if ( S[i] !== T[i] && i < L ){
    	console.log("No");
        i = L + 1 ;
    }else if(i === L){
    	 console.log("Yes");
    }
  }
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29624
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int a[3];
  scanf("%d %d %d", &a[0], &a[1], &a[2]);
  qsort(a, 3, sizeof(int), acs);
  int ans = a[1] - a[0] + a[2] - a[1];
  printf("%d\n", ans);
  return 0;
}


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

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

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}
//C++14 (GCC 5.4.1)
int main() {
    int N;
    cin >>N;

    int A,ans;
    cin >> ans;
    rep(i,N-1){
        cin >> A;
        ans=gcd(ans,A);
    }
    //-----------------------------------

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

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main {

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        
        String s = sc.next();
        String t = sc.next();

        if(t.startsWith(s)){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }

    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
    
        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }
    
        int nextInt() {
            return Integer.parseInt(next());
        }
    
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

struct edge { int to,cost; };

vector<int> dijkstra(int V, int s, vector<vector<edge>> &G) {
  vector<int> d(V,INT_MAX);d[s]=0;
  priority_queue<P,vector<P>,greater<P>> q;q.push({0,s});
  while (!q.empty()) {
    P p = q.top();q.pop();
    int v = p.second;
    if (d[v]<p.first) continue;
    for (edge e:G[v]) {
      if (d[e.to]>d[v]+e.cost) {
        d[e.to] = d[v]+e.cost;
        q.push({d[e.to],e.to});
      }
    }
  }
  return d;
}

int main() {
  // まず0~9の間の数字でグラフを作る
  // 1を起点とした単一始点最短経路
  // なので、グラフを作るときは有向グラフの反対方向で格納
  int H,W;cin>>H>>W;
  vector<vector<edge>> G(10);
  vector<vector<int>> cs(10,vector<int>(10));
  vector<vector<int>> AS(H,vector<int>(W));
  REP(i,10)REP(j,10) {
    int c;cin>>c;
    if (i!=j) G[j].push_back({i,c});
  }
  REP(h,H)REP(w,W) cin>>AS[h][w];

  vector<int> ds = dijkstra(10,1,G);

  int ans = 0;
  REP(h,H)REP(w,W) {
    if (AS[h][w]==-1) continue;
    ans += ds[AS[h][w]];
  }
  OUT(ans);

  return 0;
}

Measured memory_bytes: 384
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  (n : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  as <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    as' = VU.fromList . map pred $ as :: VU.Vector Int
    ls = VU.accumulate (+) (VU.replicate n 0) . VU.map (flip (,) 1) $ as' :: VU.Vector Int
    m = VU.sum . VU.map comb $ ls :: Int
  VU.mapM_ print . VU.map ((m -) . pred . (ls VU.!)) $ as'

comb :: Int -> Int
comb l = (l * pred l) `div` 2

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 15612
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from copy import deepcopy
import heapq
#import math
#import string

setrecursionlimit(10**6)
input=stdin.readline

n,k,q=map(int,input().split())
ans=[k-q]*n
for _ in range(q):
    a=int(input().rstrip())
    ans[a-1]+=1

for i in range(n):
    print("Yes"if ans[i]>0 else "No")

Measured memory_bytes: 6704
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 1010101010
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define mp make_pair

using namespace std;





int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

const int MOD = 1000000007;

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


ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}



int t[200010];
int main() {
	int N, T; cin >> N >> T;
	REP(i, N) {
		cin >> t[i];
	}
	ll ans = T;
	FOR(i, 1, N) {
		int d = t[i] - t[i - 1];
		if (d >= T)ans += T;
		else ans += d;
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] m = new int[n];
        int ans = n;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int p = sc.nextInt();
            m[i] = p;
            x -= p;
            min = Math.min(min, p);
        }
        ans += x / min;
        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i = ll(a); i <= ll(b); i++)
int main()
{
	ll n, m;
    cin >> n >> m;
    vector<int> food(m);    
    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int a;
            cin >> a;
            food.at(a - 1)++;
        }
    }    
    int count = 0;
    for (int i = 0; i < m; i++) {
        if (food.at(i) == n) {
            count++;
        }
    }
    cout << count << endl;
}

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

int main(){
	
	int n;
	cin>>n;
	vector<double> m(n);
	
	for(int i=0;i<n;i++)
		cin>>m[i];
	
	sort(m.begin(),m.end());
	cout<<m[n-1]-m[0]<<endl;
		
}

Measured memory_bytes: 2060
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<unordered_map>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep2(i,n) for(int i = -1; i < (n); i++)
#define PI 3.141592653589793

using namespace std;
using ll = unsigned long long;


int main() {

	int n,k;

	cin >> n >> k;

	vector<int> p(n);

	rep(i, n) {
		cin >> p[i];
	}

	sort(p.begin(),p.end());

	ll ans = 0;

	rep(i, k) ans += p[i];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
s = input()
a = [0]*26
flag = 0
for i in s:
	a[ord(i) - ord('a')]+=1;
for i in range(len(a)):
	if i == ord('x') - ord('a'):
		continue;
	flag += (a[i]%2)
if flag > 1:
	print(-1)
else:
	left = 0;
	right = len(s) - 1;
	ans = 0
	while(left < right):
		if s[left] == s[right]:
			left+=1;
			right-=1;
		else:
			if s[left] == 'x':
				ans+=1;
				left += 1;
			elif s[right] == 'x':
				ans+= 1;
				right -= 1;
			else:
				flag = -1;
				break;
	if flag == -1:
		print(-1)
	else:
		print(ans);

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 1e5 + 7, M = 998244353, inf = 998244353;
const long long INF = LLONG_MAX;

int n, Q;
int arr[3003], dp[3003][3003], p[N];

inline int mul(int a, int b) { return (1ll * a * b) % M; };
inline int add(int a, int b)
{
     if ( a + b < 0 ) return a + b + M;
     if ( a + b >= M) return a + b - M;
     return a + b;
}


int getans(int id, int sum)
{
     if ( id < 0 )
     {
          return sum == 0;
     }

     int &mafia = dp[id][sum];
     if (mafia != -1) return mafia;

     int a1 = mul(2 , getans(id - 1, sum));
     if ( sum >= arr[id] ) a1 = add(a1, getans(id - 1, sum - arr[id]));

     return mafia = a1;
}
void solve()
{
     p[0] = 1;
     lop(i, 1, N) p[i] = mul(2, p[i - 1]);
     int s;
     cin >> n >> s;
     lop(i, 0, n) cin >> arr[i];
     memset(dp, -1, sizeof dp);
     int ans = getans(n - 1, s);
     // cout << getans(2, 1) << endl;
     cout << ans << endl;
}

int32_t main()
{
     ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

     int test = 1;
     // cin >> test;
     while (test--)solve();


}





Measured memory_bytes: 75052
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

N = int(input())
D = list(map(int, input().split()))

D.sort()
mid = N//2

count = 0
for i in range(D[mid-1]+1, D[mid]+1):
    count += 1

print(count)

Measured memory_bytes: 14172
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n=Integer.parseInt(sc.next());
long[] L=new long[n+1];
L[0]=2;
L[1]=1;
for(int i=2;i<=n;i++){
L[i]=L[i-1]+L[i-2];
}
System.out.println(L[n]);
}}

Measured memory_bytes: 23892
def spaceinput():
    return list(map(int, input().split(" ")))

def count3(S, l, r):
    for i in range(l, r+1):
        if S[i:i+3] == "...":
            return True
    return False

def is_twocontinusblock(S, l, r):
    for i in range(l,r+1):
        if S[i:i+2] == "##":
            return True
    return False


N, A, B, C, D = spaceinput()
S = input()
S="A"+S
#print(S)
def solve():
    if is_twocontinusblock(S, A, C-1) or is_twocontinusblock(S, B, D-1):
        return False
    if D < C:
        if count3(S, B-1, D-1):
            return True
        else:
            return False

    return True


if solve():
    print("Yes")
else:
    print("No")







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

using namespace std;

int main() {

    int n;
    string s;
    cin >> n >> s;
    
    vector<int> v[3];

    for (int i = 0; i < n; ++i) {
        if(s[i] == 'R') v[0].push_back(i);   
        if(s[i] == 'G') v[1].push_back(i);   
        if(s[i] == 'B') v[2].push_back(i);   
    }
    
    auto check = [&] (vector<int> a, vector<int> b, vector<int> c) {
        long long aa = 0;
        for (int l: a) {
            for (int m: b) {
                if(m < l) continue;
                int d = m - l;
                int pos = upper_bound(c.begin(), c.end(), m) - c.begin();
                int cur = lower_bound(c.begin(), c.end(), m + d) - c.begin();
                aa += c.size() - pos;
                if(cur < (int)c.size() and c[cur] == m + d) aa--;
            }
        }
        return aa;
    };

    
    long long ans = 0;
    vector<int> bb = {0,1,2};
    do {
        ans += check(v[bb[0]], v[bb[1]], v[bb[2]]);
    } while(next_permutation(bb.begin(), bb.end()));

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <iomanip>
#include <math.h>
#include <algorithm>
#define hmm "\n"
#define test() int t; cin>>t; while(t--)
#define ll long long int
#define ull unsigned long long
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
void solve()
{
    int r;
    cin>>r;
    cout<<r*r<<hmm;
}
int main()
{
    fastIO
    //test()
    solve();
}


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

using namespace std;

int main()
{
  int s, t, a[101];
  bool f;
  
  while(cin>>s>>t){
    fill(a, a+101, 0);
    a[s] = a[t] = 1;

    while(cin>>s>>t && s && t){
      a[s]++;
      a[t]++;
    }

    f = true;
    if(a[1]%2 == 0 || a[2]%2 == 0)
      f = false;

    for(int i = 3; i <= 100 && f; i++)
      if(a[i]%2 == 1) f = false;
    
    cout << (f? "OK" : "NG") << endl;
  }
  
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n,m;cin>>n>>m;
    ll sum=0;
    vector<ll>a(n);
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    ll cnt=0;
    rep(i,n){
        if(a[i]*4*m>=sum)cnt++;
    }
    if(cnt>=m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
S = input()
N = len(S)

def p(T):
    for i in range(len(T)):
        if T[i] != T[-i-1]:
            return False
    return True

if p(S) and p(S[:(N-1)//2]) and p(S[(N+3)//2-1:]):
    print("Yes")
else:
    print("No")


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

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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


int main(){
  long long A,B,C,D;
  cin>>A>>B>>C>>D;
  
  cout<<(B-A+1)-(B/C-(A-1)/C)-(B/D-(A-1)/D)+(B/lcm(C,D)-(A-1)/lcm(C,D))<<endl;
  
  
}

Measured memory_bytes: 3608
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = 0

for i in range(N-1):
    if A[i] + 1 == A[i+1]:
        ans += C[A[i]-1]
        
print(ans + sum(B))

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>

using namespace std;

double abs(double a){
    if(a>0)return a;
    else return -a;
}
double bmi(double height,double weight){
    return 10000 * weight / (height*height);
}

int solve(int n){
    int bw=0,bh=0,bi=100000000;
    double bbmi = -1;
    for(int i=0;i<n;i++){
        int ind,w,h;
        cin >> ind >> h >> w;
        double te = bmi(h,w);
        if(bh*bh*w == h*h*bw && bi > ind){
            bi = ind;bbmi = te;bw=w;bh=h;
        }else if(abs(bbmi-22) > abs(te-22)){
            bi = ind;bbmi = te;bw=w;bh=h;
        }
    }
    return bi;
}

int main(){
    int n;
    while(cin >> n && n != 0){
        cout << solve(n) << endl;
    }
}

Measured memory_bytes: 0
import java.io.*;
import java.util.*;

public class Main {
	
	static int H;
	static int W;
	static char[][] a;
	static long [][] dp;
	static int INF = Integer.MAX_VALUE / 2;
	static int MOD = 1000000007;
		
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		H = sc.nextInt();
		W = sc.nextInt();
		a = new char[H][W];
		
		for(int i = 0; i < H; i++){
			a[i] = sc.next().toCharArray();
		}
		
		dp = new long[H][W];
		dp[0][0] = 1;
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				if(i + 1 < H && a[i+1][j] != '#'){
					dp[i+1][j] += dp[i][j];
					dp[i+1][j] %= MOD;
				}
				if(j + 1 < W && a[i][j+1] != '#'){
					dp[i][j+1] += dp[i][j];
					dp[i][j+1] %= MOD;
				}
			}
		}
		
		System.out.println(dp[H-1][W-1]);
		
	}//end main
	
	
	
}//end Main

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


Measured memory_bytes: 45408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    if (n % 2 == 1) {
        iota(a.begin(), a.end(), 1);
        for (int i = 0; i < m; i++) {
            b[i] = n - i;
        }
    } else {
        for (int i = 0; i < m; i++) {
            if (i % 2 == 0) {
                a[i] = i / 2 + 1;
                b[i] = a[i] + m - i;
            } else {
                a[i] = b[0] + 1 + i / 2;
                b[i] = a[i] + m - i;
            }
        }
    }
    for (int i = 0; i < m; i++) {
        cout << a[i] << " " << b[i] << '\n';
    }
    return 0;
}

Measured memory_bytes: 3776
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (mut a, mut b) = read!(usize, usize);

    if a > b {
        swap(&mut a, &mut b);
    }

    println!(
        "{}",
        std::iter::repeat((b'0' + a as u8) as char)
            .take(b)
            .collect::<String>()
    );
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include "math.h"
#include <set>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
int N;
vector <int > A,B;
vector <int> p,m;




int main()
{

	cin >> N;

	A.resize(N);
	B.resize(N);

	REP(i,N){
		cin >> A[i];
	}
	REP(i,N){
		cin >> B[i];
	}
	REP(i,N){
		if (A[i] > B[i])
			p.push_back(A[i] - B[i]);
		else if(A[i] < B[i])
			m.push_back(B[i] - A[i]);
	}
	if(p.size() == 0 && m.size() != 0){
		cout << -1 << endl;
		return 0;
	}
	sort(p.begin(),p.end(), greater<int>());
	double sum = 0;
	REP(i,m.size())
		sum += m[i];

	int ans = m.size();
	int i = 0;
	while(sum > 0 ){
		sum -= p[i];
		ans++;
		i++;
		if(i > p.size()){
			cout << -1 << endl;
			return 0;
		}
	}
	cout << ans;
}


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

int main() {
    int a, b; cin >> a >> b;
    double a1 = a;
    double b1 = b;
    double c = a1/b1;
    cout << a/b << " " << a%b << " ";
    cout << fixed << setprecision(5) << c << endl;
    
    return 0;
}



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

int main(){
    int ans ;
    int n;
    string s;

    cin >> s;
    n = s.size();

    vector<int> a(n);
    for(int i=0; i  <n; i++){
        if(s[i] == '0') {
            a.at(i) =0;
        } else{
            a.at(i) = 1;
        }
    }

    if(n ==1){
        cout << 0 <<endl;
    } else {
        for(int i =0; i < n -1; i ++) {
            if(a.at(i) ==a.at(i + 1)) {
                a.at(i+1) = 1-a.at(i+1);
                ans++;

            }
        }

        cout <<ans<<endl;
    }
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define go(u) for(int i = head[u], v = e[i].to; i; i=e[i].lst, v=e[i].to)
#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define pb push_back
#define re(x) memset(x, 0, sizeof x)
inline int gi() {
    int x = 0,f = 1;
    char ch = getchar();
    while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
    return x * f;
}
template <typename T> inline bool Max(T &a, T b){return a < b ? a = b, 1 : 0;}
template <typename T> inline bool Min(T &a, T b){return a > b ? a = b, 1 : 0;}
const int N = 1e6 + 7;
int n, ans, hd = 1, tl;
int a[N], q[N];
char s[N], t[N];
int main() {
#ifdef fwat
#endif
	n = gi();
	scanf("%s%s", s + 1, t + 1);
	if(strcmp(s + 1, t + 1) == 0) return puts("0"), 0;
	for(int i = n, j = n, x = i; i; --i) {
		if(t[i] == t[i - 1]) continue;
		j = min(j, i);
		while(j && s[j] != t[i]) --j;
		if(!j) return puts("-1"), 0;
		for(; hd <= tl && q[hd] - (tl - hd + 1) >= x; ++hd);
		if(x != j)
			q[++tl] = j, Max(ans, tl - hd + 1);
		x = i - 1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
int main()
{
	io
	int x, y, z;
	cin>>x>>y>>z;
	cout<<z<<" " <<x<<" " <<y;
}


Measured memory_bytes: 256
def main():
    while True:
        try:
            n = [int(x) for x in raw_input()]
            n.sort()
            solve(n)
        except EOFError as e:
            break

def solve(input_numbers):
    valid_numbers = []
    c = count_number(input_numbers);
    for i in range(9):
        if c[i] == 4:
            continue
        c[i] += 1
        if isvalid(c, 0, False):
            valid_numbers.append(i+1)
        c[i] -= 1

    s = " ".join(map(str, valid_numbers)) if len(valid_numbers) > 0 else "0"
    print(s)

def count_number(input_numbers):
    c = [0] * 9
    for i in input_numbers:
        c[i-1] += 1
    return c

def isvalid(input_numbers, pos, head):
    if pos == 8:
        if head and input_numbers[8] == 0:
            return True
        elif head and input_numbers[8] == 3:
            return True
        elif (not head) and input_numbers[8] == 2:
            return True
        else:
            return False

    if input_numbers[pos] == 0:
        return isvalid(input_numbers, pos+1, head)

    if input_numbers[pos] == 1:
        if not can_sequence(input_numbers, pos, 1):
            return False
        else:
            input_numbers[pos] -= 1
            input_numbers[pos+1] -= 1
            input_numbers[pos+2] -= 1
            r = isvalid(input_numbers, pos+1, head)
            input_numbers[pos] += 1
            input_numbers[pos+1] += 1
            input_numbers[pos+2] += 1
            return r

    if input_numbers[pos] == 2:
        if not head:
            input_numbers[pos] -= 2
            r = isvalid(input_numbers, pos+1, True)
            input_numbers[pos] += 2
            if r:
                return True

        if can_sequence(input_numbers, pos, 2):
            input_numbers[pos] -= 2
            input_numbers[pos+1] -= 2
            input_numbers[pos+2] -= 2
            r = isvalid(input_numbers, pos+1, head)
            input_numbers[pos] += 2
            input_numbers[pos+1] += 2
            input_numbers[pos+2] += 2
            return r

    if input_numbers[pos] == 3:
        input_numbers[pos] -= 3
        r = isvalid(input_numbers, pos+1, head)
        input_numbers[pos] += 3
        if r:
            return True

        if can_sequence(input_numbers, pos, 1):
            input_numbers[pos] -= 2
            r = isvalid(input_numbers, pos, True)
            input_numbers[pos] += 2
            return r
        else:
            return False

    if input_numbers[pos] == 4:
        input_numbers[pos] -= 3
        r = isvalid(input_numbers, pos, head)
        input_numbers[pos] += 3
        if r:
            return True

        if not head:
            input_numbers[pos] -= 2
            r = isvalid(input_numbers, pos, True)
            input_numbers[pos] += 2
            return r
        else:
            return False

def can_sequence(input_numbers, pos, num):
    if pos > 6:
        return False
    return input_numbers[pos] >= num and input_numbers[pos+1] >= num and input_numbers[pos+2] >= num

main()

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

using namespace std;

const int max_n = 100111, inf = 1000111222;

int n, k;

bool solve(int n, int k) {
    long long s1 = 0, s2 = 0;
    for (int i = 0; i < n; ++i) {
        s1 += k + i;
        s1 += k + n + i;
        s2 += k + 2 * n + i;
    }
    return s1 <= s2;
}

int used[3 * max_n];

bool go(int n, int k) {
    for (int i = 0; i < 3 * n; ++i) {
        used[i] = 0;
    }
    vector<int> a, b, c;
    int to = k + 3 * n - 1;
    int x = k + 2 * n - 1;
    int y = to - x;
    //cout << "#" << x << " " << y << " " << to << endl;
    while (to >= k + 2 * n && x > y) {
        a.push_back(y);
        b.push_back(x);
        c.push_back(to);
        used[x - k] = 1;
        used[y - k] = 1;
        --to;
        ++y;
        x -= 2;
    }
    vector<int> v;
    for (int i = 0; i < 2 * n; ++i) {
        if (!used[i]) {
            v.push_back(k + i);
        }
    }
    for (int i = 0; i < v.size() / 2; ++i) {
        a.push_back(v[i]);
        b.push_back(v[v.size() - 1 - i]);
        c.push_back(to);
        --to;
    }
    for (int i = 0; i < a.size(); ++i) {
        printf("%d %d %d\n", a[i], b[i], c[i]);
    }
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] + b[i] > c[i]) {
            return false;
        }
    }
    return true;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //cout << go(5, 1) << endl;
    //return 0;
    /*for (int k = 1; k < 10; ++k) {
        for (int n = 1; n < 20; ++n) {
            if (solve(n, k)) {
                if (!go(n, k)) {
                    cout << k << ": " << n << endl;
                    //break;
                }
                //cout << k << ": " << n << endl;
                //break;
            }
        }
    }*/
    scanf("%d%d", &n, &k);
    if (!solve(n, k)) {
        puts("-1");
        return 0;
    }
    go(n, k);
    return 0;
}


Measured memory_bytes: 5224
#include <iostream>

using namespace std ;

int main()
{
  int x,y;
  cin>>x>>y;
  char ar[x];
  for(int i=0;i<x;i++)
  {
      cin>>ar[i];
  }
 ar[y-1]=static_cast<char>(ar[y-1]+32);
for(int i=0;i<x;i++)
{
    cout<<ar[i];
}

    return 0;
}




Measured memory_bytes: 256
/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */
/*
 *
 *
 *
 */
#include<bits/stdc++.h>
#define ll long long
#define MAX 100000
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	int a[MAX][3];
	for(int i=0;i<n;i++)
		for(int j=0;j<3; j++)
			cin>>a[i][j];
	int dp[MAX][3];
	dp[0][0] = a[0][0];
	dp[0][1] = a[0][1];
	dp[0][2] = a[0][2];
	for(int i=1; i<n; i++) {
		dp[i][0] = max(dp[i-1][0] , max(dp[i-1][1], dp[i-1][2]) + a[i][0]);	
		dp[i][1] = max(dp[i-1][1] , max(dp[i-1][0], dp[i-1][2]) + a[i][1]);	
		dp[i][2] = max(dp[i-1][2] , max(dp[i-1][0], dp[i-1][1]) + a[i][2]);	
	}	
	cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));

		


	return 0;
}





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

typedef long long ll;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007

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

    if(a<c&&c<b||b<c&&c<a){
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }
   }


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};

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

typedef priority_queue<ll> PQ_HIGH;
typedef priority_queue<ll,VL,greater<ll>> PQ_LOW;

#define EPSILON 1.0e-12

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
};
//降順
bool compare_by_b_high(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        return a.first < b.first;
    }
};
bool compare_by_b_higheer(tuple<string, int, int> a, tuple<string, int, int> b) {
    if(get<0>(a) != get<0>(b)){
      return get<0>(a) <get<0>(b);
    }else{
        if(get<1>(a) != get<1>(b)){return get<1>(a) > get<1>(b);}
        else{return get<2>(a) > get<2>(b);}
    }
};

int func(int a){
  vector<int> data;
  int start=2;
  int d=a;
  int tmp=0;
  int ans=1;
  int flag=1;
  while(flag){
    if(d==1){
      flag=0;
    }
    if(d%start==0){
      d/=start;
      tmp++;
    }else{
      start++;
      tmp++;
      ans*=tmp;
      tmp=0;
    }
  }
  if(ans==8){
    return 1;
  }else{
    return 0;
  }
}

int main(){
  int N;cin>>N;
  int count=0;
  for(int i=1;i<=N;i++){
    if(i%2==0){
      continue;
    }else{
      if(func(i)){
        count++;
      }
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double N = sc.nextInt();
		int K = sc.nextInt();
		sc.close();

		double ans = 0;
		for (int i = 1; i <= N; i++) {
			int a = 0;
			int b = i;
			while (b < K) {
				a++;
				b = b * 2;
			}
			ans += (1 / N) * Math.pow(0.5, a);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21332
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
a,b = iim()

if a > b:
    print(a-1)
else:
    print(a)

Measured memory_bytes: 3060
from fractions import Fraction
n, m = map(int,input().split())

li = list(map(int,input().split()))

s = sum(li)

pm = Fraction(1, 4*m)
sp = float(pm)

ans = []
for i in range(n):
    if (s * sp) <= li[i]:
        ans.append(li[i])
        
if (len(ans)>= m):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 5688
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        long M = sc.nextLong();
        
        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = sc.nextInt();
        }
        
        Map<Long, Integer> amari = new HashMap<>();
        long[] sum = new long[N];
        
        for(int i = 0; i < N; i++){
            
            if( i == 0){
                sum[i] = A[i] % M;
            } else {
                sum[i] = A[i] % M + sum[i-1];
                sum[i] %= M;
            }
            
            if( amari.containsKey(sum[i]) ){
                amari.put(sum[i], amari.get(sum[i])+1);
            } else {
                amari.put(sum[i], 1);
            }
        }
        
        long ans = 0;
        for(long i : amari.keySet() ){
            long x = amari.get(i);
            if( i == 0 ) ans += x;            
            if( x >= 2 ) ans += x * (x-1) / 2;
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 55888
#include<iostream>
#include<list>
#include<string>
#include<algorithm>
#include <utility>
#include<stdio.h>
#include<climits>
#include <vector>
#include <queue>

using namespace std;

int main(void){
    int n;
    int i,j;
    int min,max,s;
    while(1){
        cin >> n;
        if(!n) break;
        s = 0;
        cin >> j;
        min = max = j;
        s += j;
        for(i = 1;i < n;i++){
            cin >> j;
            if(min > j) min = j;
            if(max < j) max = j;
            s += j;
        }
        cout << (s-min-max)/(n-2) << endl;
    }
}

Measured memory_bytes: 1156
import java.util.Scanner;

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

        int n = scan.nextInt();
        int k = scan.nextInt();
        int[] heights = new int[n];
        for (int i = 0; i < n; ++i) {
            heights[i] = scan.nextInt();
        }

        int[] dp = new int[n];
        dp[0] = 0;
        dp[1] = Math.abs(heights[1] - heights[0]);

        for (int i = 2; i < n; ++i) {
            dp[i] = Integer.MAX_VALUE;
            for (int j = 1; j <= k && j <= i; ++j) {
                dp[i] = Math.min(dp[i], dp[i - j] + Math.abs(heights[i] - heights[i - j]));
            }
        }

        System.out.println(dp[n - 1]);
    }
}

Measured memory_bytes: 50692
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int x,y,a,b,c;

int main () {
    cin >>  x >> y >> a >> b >> c;
    vector<int> r(a);
    vector<int> g(b);
    vector<int> n(c);

    REP(i,a) cin >> r[i];
    REP(i,b) cin >> g[i];
    REP(i,c) cin >> n[i];

    vector<int> all;
    
    std::sort(r.begin(), r.end(), std::greater<int>());
    std::sort(g.begin(), g.end(), std::greater<int>());
    std::sort(n.begin(), n.end(), std::greater<int>());

    REP(i, x) all.push_back(r[i]);
    REP(i, y) all.push_back(g[i]);
    REP(i, c) all.push_back(n[i]);

    std::sort(all.begin(), all.end(), std::greater<int>());

    ll sum = 0;
    REP(i, x+y) {
        sum += all[i];
    }

    cout << sum << endl;

}

 

Measured memory_bytes: 4596
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
const ll M=1e9+7;
const ll inf=1e18+5;
using namespace std;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll bs(ll arr[], ll l, ll r, ll x){ 
	ll mid=0;
    if (r >= l){
		if (arr[mid] == x) return mid; 
        if (arr[mid] > x) return bs(arr, l, mid - 1, x); 
        return bs(arr, mid + 1, r, x); 
    }
    return -1;
}
ll power(ll x,ul y,ll p){
	ll res = 1;
	x = x % p;
	if(x == 0) return 0;
	while (y > 0){
		if (y & 1) res = (res*x) % p;
		y = y>>1;
		x = (x*x) % p;
		}
	return res;
}


void solve(){
	ll h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	ll min=(h2*60+m2-h1*60-m1);
	cout<<min-k<<"\n";
 }
int main(){
	fast();
	solve();
	return 0;
}



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

using namespace std;

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

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

#define MP make_pair
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()

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

	cout << 3 * r * r << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cmath>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;
 
#define all(v) v.begin(),v.end()
#define test() int t;cin>>t;while(t--) 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9+7;

int power(int x, int a)
{
    if(a==0)return(1);
    int z = power(x, a/2);
    z*=z;
    if(a%2)z*=x;
    return(z);
}
 
int main()
{   
    fastio
    string s, t;
    cin>>s;
    cin>>t;
    int ls = s.length(), lt = t.length();
    int mn = ls, change;
    for (int i = 0; i < ls-lt+1; i++)
    {
        change=0;
        for (int j = 0; j < lt; j++)
        {
            if(t[j]!=s[i+j])change++;
        }
        mn=min(mn, change);
    }
    cout<<mn<<endl;
}

Measured memory_bytes: 3616
//おまじないc++
#include <iostream>
#include<cmath>
#include<vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {

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

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

// #define multitest 1
#ifdef WIN32
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.first << ", " << p.second << ']';
	return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
	std::cerr << name << " { ";
	for (const auto &v : arg)
		cerr << v << ' ';
	cerr << " }\n";
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;
auto TimeStart = chrono::steady_clock::now();

const int nax = 2e5 + 10;

void solve()
{
	ll n;
	cin >> n;
	--n;
	cout << n * (n + 1) / 2;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
#ifdef WIN32
	cerr << "\n\nTime elapsed: " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " seconds.\n";
#endif
	return 0;
}

Measured memory_bytes: 256