akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

const int INF=1001001001;

int main() {
  int N,K,S;
  cin>>N>>K>>S;
  vector<int>A(N);
  int k=K;
  for(int i=0;i<N;i++){
    if(k>0){A[i]=S;k--;}
    else if(S==1000000000){A[i]=1;}
    else{A[i]=S+1;}
  }
  for(int i=0;i<N;i++){
    cout<<A[i];
    if(i<N-1){cout<<" ";}
  }cout<<endl;
  return 0;
}

Measured memory_bytes: 3688
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

int main() {
    int N, ans = 0, max_ = 0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int h;
        cin >> h;
        if (max_ <= h)ans++;
        max_ = max(max_, h);
    }

    cout << ans << endl;

    return 0;
}

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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	// int N;
	int cnt;

	public void init() {
		// N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		long N = Integer.parseInt(strArr[0]);
		long M = Integer.parseInt(strArr[1]);
		if (N >= 3 && M >= 3) {
			System.out.println((N - 2) * (M - 2));
			return;
		}
		if (N == 1 && M == 1) {
			System.out.println(1);
			return;
		}
		if (N == 1 && M == 2) {
			System.out.println(0);
			return;
		}
		if (N == 1 && M >= 3) {
			System.out.println(M - 2);
			return;
		}
		if (N == 2 && M == 1) {
			System.out.println(0);
			return;
		}
		if (N >= 3 && M == 1) {
			System.out.println(N - 2);
			return;
		}
		if (N == 2 && M == 2) {
			System.out.println(0);
			return;
		}
		if (N == 2 && M >= 3) {
			System.out.println(0);
			return;
		}
		if (N >= 3 && M == 2) {
			System.out.println(0);
			return;
		}
	}

	public boolean hasNext() {
		// return cnt < N;
		return false;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {
	}
}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
int pri[1000020], cnt;
int mark[1000020];
int a[1000020];
int suck[1000020];

void filter(int n) {
	for (int i = 2; i <= n; ++ i) {
		if (!mark[i]) pri[++cnt] = i;
		for (int j = 1; j <= cnt && i * pri[j] <= n; ++ j) {
			mark[i * pri[j]] = 1;
		}
	}
}

bool isa(int n) {
	for (int i = 1; i <= n; ++ i) {
		int t = a[i];
		for (int j = 1; j <= cnt && t > 1; ++ j) {
			if (t % pri[j] == 0) {
				while (t % pri[j] == 0) t /= pri[j];
				if (suck[pri[j]]) return false;
				suck[pri[j]] ++;
			}
			if (t > 1 && !mark[t]) {
				// printf("suck %d", t);
				if (suck[t]) return false;
				suck[t] ++;
				t = 1;
			}
		}
	}
	return true;
}

int gcd(int a, int b) {
	return b ? gcd(b, a % b) : a;
}

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; ++ i) {
		scanf("%d", a + i);
	}
	filter(1000000);
	if (isa(n)) return puts("pairwise coprime")&0;
	int g = a[1];
	for (int i = 2; i <= n; ++ i) {
		g = gcd(g, a[i]);
	}
	if (g == 1) return puts("setwise coprime")&0;
	puts("not coprime");
}


Measured memory_bytes: 12188
/**
 * @author Finn Lidbetter
 */
import java.util.*;
import java.io.*;
import java.awt.geom.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    
    char[] seq = br.readLine().toCharArray();
    int n = seq.length+1;
    int[] arr = new int[n];
    Arrays.fill(arr, -1);
    int index = n-1;
    while (index>0) {
      if ((index==n-1 || seq[index]=='<') && seq[index-1]=='>') {
        arr[index] = 0;
        while (index-2>=0 && seq[index-2]=='>') {
          arr[index-1] = arr[index] + 1;
          index--;
        }
        arr[index-1] = arr[index] + 1;
      }
      index--;
    }
    if (arr[0]==-1) {
      arr[0] = 0;
    }
    index = 1;
    while (index<n) {
      if (arr[index]==-1) {
        arr[index] = arr[index-1] + 1;
      }
      index++;
    }
    for (int i=0; i<n-1; i++) {
      if (seq[i]=='<' && arr[i]>=arr[i+1])  {
        arr[i+1] = arr[i] + 1;
      }
      if (seq[i]=='>' && arr[i]<=arr[i+1]) {
        arr[i] = arr[i+1] + 1;
      }
    }
    long sum = 0;
    for (int i=0; i<n; i++) {
      sum += arr[i];
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 30008
def f(s):
    if s == "#":
        return 1
    else:
        return 0

h, w = map(int, input().split())
s = []
for i in range(h):
    s.append(list(input()))

for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            cnt = 0
            for x in [-1, 0, 1]:
                for y in [-1, 0, 1]:
                    if 0 <= i+x < h and 0 <= j+y < w:
                        cnt += f(s[i+x][j+y])

            # if 0 <= i-1:
            #     cnt += f(s[i-1][j])
            # if i+1 < h:
            #     cnt += f(s[i+1][j])
            # if 0 <= j-1:
            #     cnt += f(s[i][j-1])
            # if j+1 < w:
            #     cnt += f(s[i][j+1])
            
            # if 0 <= i-1 and 0 <= j-1:
            #     cnt += f(s[i-1][j-1])
            # if 0 <= i-1 and j+1 < w:
            #     cnt += f(s[i-1][j+1])
            # if i+1 < h and 0 <= j-1:
            #     cnt += f(s[i+1][j-1])
            # if i+1 < h and j+1 < w:
            #     cnt += f(s[i+1][j+1])
            
            
            s[i][j] = cnt

for i in range(h):
    for j in range(w):
        print(s[i][j], end="")
    if i != h-1:
        print("\n")


Measured memory_bytes: 3444
///BISMILLAHIR-RAHMANIR-RAHIM
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    long long n;
    scanf("%lld", &n);

    long long ara[n];
    long long i;
    for(i = 0; i < n; i++) scanf("%lld", &ara[i]);

    long long j;
    long long dif, max_dif = 0;

    for(i = 0; i  < n - 1; i++){
        for(j = i + 1; j < n; j++){
            dif = abs(ara[i] - ara[j]);
            if(dif > max_dif){
                max_dif = dif;
            }
        }
    }

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

    return 0;
}
///ALHAMDULILLAH


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

using namespace std;

int main(int argc, char const *argv[])
{
    priority_queue<double> que;
    int N, M;
    cin >> N >> M;
    double Ai;
    for(int i = 0; i < N; i++){
        cin >> Ai;
        que.push(Ai);
    }
    double tmp;
    for(int i = 0; i < M; i++){
        tmp = que.top();
        tmp /= 2;
        que.pop();
        que.push(tmp);
    }
    long long s = 0;
    for(int i = 0; i < N; i++){
        s += (long long)que.top();
        que.pop();
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 1400
#define MOD_TYPE 1

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

#if 0
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
#endif

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

struct io_init
{
  io_init()
  {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(30) << setiosflags(ios::fixed);
  };
} io_init;
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  string s;
  cin >> s;
  if (s.back() == 's')
  {
    s = s + "es";
  }
  else
  {
    s = s + "s";
  }
  cout << s << "\n";
}

int main()
{
  solve();
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <math.h>
#include <deque>
#include <queue>
#include <map>
#include <iterator>
#include <set>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

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

	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int lim = max(x, y) * 2;

	int ans = 1e9;
	for (int i = 0; i <= lim; i+=2) {
		int A = max(0, x - i / 2);
		int B = max(0, y - i / 2);
		int now = A * a + B * b + i * c;
		chmin(ans, now);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
	int a, i=1;

	while (1) {
		scanf("%d", &a);

		if (a == 0) {
			break;
		}

		else {
			printf("Case %d: %d\n",i,a);
		}
		i++;
	}
	return 0;
}

Measured memory_bytes: 600
n = gets.to_i
as = gets.split.map(&:to_i)
q = gets.to_i
bc = q.times.map {gets.split.map(&:to_i)}

table = as.tally
table.default = 0
sum = as.sum

bc.each do |b, c|
  sum += (c - b) * table[b]
  puts sum
  table[c] += table[b]
  table.delete(b)
end

Measured memory_bytes: 27656
#include <iostream>
#include <stack>
#include <map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <string.h>

using namespace std;

int N, C;
int D[100][100];
int c[1000][1000];
int d[3][100];

int main(int argc, char** argv) {
    cin >> N >> C;
    for (int i = 1; i <= C; i++) for (int j = 1; j <= C; j++) cin >> D[i][j];
    for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) cin >> c[i][j];

    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            for (int k = 1; k <= C; k++) {
                d[(i + j) % 3][k] += D[c[i][j]][k];
                // d[(i + j) % 3][k] += D[k][c[i][j]];
            }
        }
    }
    int ans = 1e9;
    for (int c0 = 1; c0 <= C; c0++)
        for (int c1 = 1; c1 <= C; c1++)
            for (int c2 = 1; c2 <= C; c2++) {
                if (c0 == c1 || c0 == c2 || c1 == c2) continue;
                int cost = d[0][c0] + d[1][c1] + d[2][c2];
                ans = min(ans, cost);
                // cout << c0 << c1 << c2 << " " << cost << endl;
            }
    cout << ans << endl;
}

Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <list>
 
struct Point{
  int x;
  int y;
};
struct Pair{
  Point red;
  Point blue;
};
 
int N;
std::list<Point> reds;
std::list<Point> blues;
std::list<Pair> pairs;
typedef std::list<Point>::iterator ItP;
 
bool cmpYDescendant(const Point &left, const Point &right) {
    return left.y > right.y;
}
 
bool cmpXAscendant(const Point &left, const Point &right) {
    return left.x < right.x;
}
 
int main(){
	Point p;
  	std::cin>>N;
  	for(int i=0;i<N;i++){
      std::cin>>p.x>>p.y;
      reds.push_back(p);
    }
  	for(int i=0;i<N;i++){
		std::cin>>p.x>>p.y;
      	blues.push_back(p);
    }
  	reds.sort(cmpYDescendant);
  	blues.sort(cmpXAscendant);
  	ItP it_b = blues.begin();
  	while(it_b != blues.end()) {
        bool found = false;
        ItP it_r = reds.begin();
 
        while(it_r != reds.end()) {
            if ((*it_r).x < (*it_b).x && (*it_r).y < (*it_b).y) {
                Pair p;
 
                found = true;
                p.red = *it_r;
                p.blue = *it_b;
                pairs.push_back(p);
                reds.erase(it_r);
                break;
            }
 
            ++it_r;
        }
 
        if (found) {
            it_b = blues.erase(it_b);
        } else {
            ++it_b;
        }
    }
 
    std::cout << pairs.size() << std::endl;
}

Measured memory_bytes: 256
S = int(input())
ten = len(str(S))-1
if S <= 10**9:
    print(S,0,1,1,0,0)
else:
    t = int(str(S)[-10::-1][::-1])+1
    if S == 10**18:
        t -= 1
    print(t,1,t*10**9-S,10**9,0,0)

Measured memory_bytes: 61840
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> ans(n+1);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int s = x*x + y*y + z*z;
        s += x*y + y*z + z*x;
        if (s > n) continue;
        ans[s]++;
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <set>

int main(void) {
    int n;
    std::scanf("%d", &n);
    std::set<int> s;
    for (int i = 0; i < n; i++) {
        int a;
        std::scanf("%d", &a);
        if (s.find(a) == s.end()) {
            s.insert(a);
        }
        else {
            s.erase(a);
        }
    }
    std::printf("%d\n", s.size());
    return 0;
}

Measured memory_bytes: 4864
import sys

def ans(index, array, k):
    r = right(index, array, k)
    l =  left(index, array, k)
    return min(r, l)


def right(index, array, k):
    start = max(index, k-1)
    count = sys.maxsize
    for i in range(start, min(len(array), k+index)):
        tmp = array[i]
        j = index - (k - (i - index + 1))
        tmp += array[i] - array[j]
        count = count if count < tmp else tmp

    if len(array) > (index + k - 1):
        count = count if count < array[index + k - 1] else array[index + k - 1]
    
    return count

def left(index, array, k):
    n = len(array)
    start = min(index, n - k + 1)
    count = sys.maxsize
    
    for i in range(max(0, start - k), start):
        tmp = -array[i]
        j = k + i - 1
        tmp += -array[i] + array[j]
        count = count if count < tmp else tmp

    if index >= k:
        count = count if count < -array[index-k] else -array[index-k]
    
    return count

n,k = map(int, input().split())

x = [int(i) for i in input().split()] 

index = n
for i in range(n):
    if x[i] >= 0:
        index = i
        break

print(ans(index, x, k))

Measured memory_bytes: 14788
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split();
        int N = int.Parse(input[0]);
        int A = int.Parse(input[1]);
        int B = int.Parse(input[2]);
        Console.WriteLine(Math.Min(A*N, B));
    }
}


Measured memory_bytes: 13140
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(int i = 0; i < (int)n; i++)
using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  int l[n];
  REP(i,n){
    cin >> l[i];
  }
  sort(l,l+n,greater<int>());
  int ans = 0;
  REP(i,k){
    ans += l[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n, k;
    while(cin>>n>>k){
        cout<<(n+k-1)/k<<endl;

    }
  return 0;
}




Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N;
  scanf("%d", &N);
  int V[N], C[N], i;
  for(i = 0; i < N; i++){
    scanf("%d", &V[i]);
  }

  for(i = 0; i < N; i++){
    scanf("%d", &C[i]);
    C[i] = V[i] - C[i];
  }

  int sum = 0;
  for(i = 0; i < N; i++){
    if(C[i] > 0) sum += C[i];
  }

  printf("%d\n", sum);
  
  return 0;
}


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

int main() {
	long long H;
	long long X = 0;
	cin >> H;
	while (H != 0) {
		X++;
		H /= 2;
	}
	long long ANS = 0;
	for (int i = 0; i < X; i++) ANS = ANS * 2 + 1;
	cout << ANS << endl;
}

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

int n,d,p[100][100],minp[100];
vi dp[100][100][100];

int main(){
  cin >> n >> d;
  int sum = 0;
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++)cin >> p[i][j];
  }

  for(int i=0;i<d;i++){
    minp[i] = 10001;
    for(int j=0;j<n;j++)minp[i] = min(minp[i],p[j][i]);
    sum += minp[i];
  }

  for(int i=0;i<n;i++)dp[0][i][0].push_back(i+1);

  for(int i=0;i<d;i++){
    for(int j=0;j<n;j++){
      for(int k=0;k<=d;k++){
	vi  tmp = dp[i][j][k];
	if(tmp.size()==0)continue;

	for(int l=0;l<n;l++){
	  if(minp[i] != p[l][i])continue;
	  if(j==l){
	    tmp.push_back(l+1);
	    if(dp[i+1][j][k].size() == 0)dp[i+1][j][k] = tmp;
	    else dp[i+1][j][k] = min(dp[i+1][j][k],tmp);
	    tmp.pop_back();
	  }else{
	    tmp.push_back(l+1);
	    if(dp[i+1][l][k+1].size() == 0)dp[i+1][l][k+1] = tmp;
	    else dp[i+1][l][k+1] = min(dp[i+1][l][k+1],tmp);
	    tmp.pop_back();
	  }
	}
      }
    }
  }

  for(int j=0;j<=d;j++){
    vi ans;
    for(int i=0;i<n;i++){
      if(dp[d][i][j].size()){
	if(ans.size() == 0 || ans > dp[d][i][j])ans = dp[d][i][j];
      }
    }
    if(ans.size()){
      cout << sum << " " << j << endl;
      for(int i=1;i<ans.size();i++)cout << ans[i] << endl;
      return 0;
    }
  }
}
	    

  
  

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  ll H,W;
  cin>>H>>W;
  if(H==1||W==1)cout<<1<<endl;
  else cout<<(H*W+1ll)/2<<endl;
  return 0;
}


Measured memory_bytes: 256
import Data.List (unfoldr)

toDigits :: Int -> [Int]
toDigits = unfoldr phi
  where
    swap (x,y) = (y,x)
    phi n | n == 0    = Nothing
          | otherwise = Just (swap (n `divMod` 10))

calc :: Int -> Int -> Int -> Int
calc n a b = sum $ filter p [1..n]
  where
    p m = a <= s && s <= b where s = sum (toDigits m)

main = do
  [n,a,b] <- (fmap read . words) <$> getLine
  print (calc n a b)


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define Endl endl


signed main(void){
    int r,D,x;
    cin >> r >> D >> x;
    REP(i,10){
        x=r*x-D;
        cout << x << endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
// clang-format on

ll A, B, C, D;

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

void solve()
{
  ll N = B - A + 1;
  ll c = (B / C - (A - 1) / C);
  ll d = (B / D - (A - 1) / D);
  ll lcm = (C * D) / gcd(C, D);
  ll cd = (B / lcm - (A - 1) / lcm);
  // cout << c << " " << d << " " << cd << endl;
  cout << N - (c + d) + cd << endl;
}

int main(void)
{
  cin >> A >> B >> C >> D;
  solve();
  return 0;
}


Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (D, N) = Read2Longs();

            if (D == 0)
            {
                if (N == 100)
                {
                    return 101;
                }
                return N;
            }
            else if (D == 1)
            {
                if (N == 100)
                {
                    return 10100;
                }
                return 100 * N;
            }
            else
            {
                if (N == 100)
                {
                    return 1010000;
                }
                return 10000 * N;
            }
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 28280
#!/usr/bin/env python3
k, n = map(int, input().split())
a = list(map(int, input().split()))
ans = k
l = []
for i in range(n-1):
    l.append(a[i+1] - a[i])
l.append(k-a[-1]+a[0])
print(k-max(l))

Measured memory_bytes: 26436
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, Y;
    cin >> n >> Y;
    for(int x = 0; x <= n; x++) {
        for(int y = 0; y <= n; y++) {
            int z = (Y - x * 10'000 - y * 5'000) / 1000;
            if(z >= 0 and x + y + z == n) {
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pi;
const int MAXN=200005;
const int MOD=1000000007;
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())

int N,Q;
int X[MAXN],S[MAXN],T[MAXN];
struct node{
	int l,r;
	int v=INT_MAX;
}t[200*MAXN];
int idx=1;
void cchild(int id){
	if(t[id].l==0)t[id].l=++idx;
	if(t[id].r==0)t[id].r=++idx;
}
void selfupd(int id, int v){
	t[id].v=min(t[id].v,v);
}
void prop(int id){
	if(t[id].l!=0)selfupd(t[id].l,t[id].v);
	if(t[id].r!=0)selfupd(t[id].r,t[id].v);
}
void upd(int id, int s, int e, int x, int y, int v){
	if(s==x&&e==y){
		t[id].v=min(t[id].v,v);
		return;
	}
	int m=(s+e)>>1;
	cchild(id);
	prop(id);
	if(x<=m)upd(t[id].l,s,m,x,min(m,y),v);
	if(y>m)upd(t[id].r,m+1,e,max(m+1,x),y,v);
}
int query(int id, int s, int e, int x){
	if(s==x&&e==x){
		return t[id].v;
	}
	int m=(s+e)>>1;
	cchild(id);
	prop(id);
	if(x<=m)return query(t[id].l,s,m,x);
	else return query(t[id].r,m+1,e,x);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N>>Q;
	typedef tuple<int,int,int>ti;
	vector<ti>vec;
	FOR(i,1,N){
		int s,t,x;cin>>s>>t>>x;
		s-=x;t-=x;--t;
		s=max(s,0);
		t=max(t,0);
		vec.pb(ti(x,s,t));
	}
	//~ sort(all(vec));
	FOR(i,1,N)tie(X[i],S[i],T[i])=vec[i-1];
	//~ FOR(i,1,N)cout<<X[i]<<' '<<S[i]<<' '<<T[i]<<"\n";
	FOR(i,1,N){
		upd(1,0,1e9,S[i],T[i],X[i]);
	}
	while(Q--){
		int d;cin>>d;
		int tmp=query(1,0,1e9,d);
		if(tmp==INT_MAX)tmp=-1;
		cout<<tmp<<"\n";
	}
}
/*
*/


Measured memory_bytes: 476016
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
  int key;
  struct node *right, *left, *parent;
};

struct node *root, *NIL;

void insert(int);
void inorder(struct node *);
void preorder(struct node *);

int main() {
  int n, i, x;
  char s[20];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s%d",s,&x);
    if(s[0]=='i') insert(x);
    else{
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}

void insert(int k){
  struct node *y = NIL;
  struct node *x = root;
  struct node *z;

  z = (struct node *)malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }

  z->parent = y;
  if(y==NIL) root = z;
  else{
    if(z->key < y->key) y->left = z;
    else y->right = z;
  }
}

void inorder(struct node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}



Measured memory_bytes: 25208
//BISMILLAHIR RAHMANIR RAHIM
                                               //BY THE NAME OF ALLAH
                                               //FAISAL AHAMMED SHAWON
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<set>
#include<map>
#include<iterator>
#include<numeric>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define SQ(a) (a)*(a)
#define pi acos(-1.0)
const int MAX=100001;
const int MOD=1e9+7;
int ara[MAX];
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    else
    gcd(b,a%b);
}
ll lcd(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}

bool f(ll a,ll b)
{
    return a>b;
}
ll max_sum_subarrays(ll ara[],ll n)
{
    ll ans=0,sum=0;
    for(ll k=0;k<n;k++){
        sum=max(ara[k],sum+ara[k]);
        ans=max(ans,sum);
    }
    return ans;
}
ll num_divisors(ll n)
{
    long long cnt=0;
    for(int i=1;i*i<=n;i++)
    {
        if(n%i==0 && i*i==n)
            cnt+=1;
        if(n%i==0 && i*i!=n)
                cnt+=2;
    }
    return cnt;
}
ll comb(ll m, ll n)
{
    ll x = max(m-n,n),ans = 1,i=1;
    for(ll k=m;k>=x+1;k--){
        ans*=k;
        ans/=i;
        i++;
    }
    return ans;
}
ll binsearch(ll low,ll high,ll target)
{
    while(low<=high)
    {
        ll mid=(low+high)/2;
        if(ara[mid]>target)
            high=mid-1;
        else if(ara[mid]<target)
            low=mid+1;
        else return mid;
    }
    return -1;
}
void solve()
{
    int a,b;
    cin>>a>>b;

    if(b==a && a!=0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}
int main()
{
    fast();
    solve();
    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int dp[N];
int a[N];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-2]+abs(a[i-2]-a[i]),dp[i-1]+abs(a[i-1]-a[i]));
	}
	cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 4372
def f(x, y):
  return g(x-1) ^ g(y)

def g(x):
  if x < 0:
    return 0
  res = 0
  res ^= ((x+1)>>1) & 0b1
  i = 0b10
  while i <= x:
    if (x&i)!=0 and (x&1)==0:
      res ^= i
    i <<= 1
  return res

a, b = [int(x) for x in input().split()]
print(f(a,b))

Measured memory_bytes: 3064
s = input()

# 0101...のパターン
x1 = 0
for i in range(len(s)):
    t1 = s[i]
    t2 = '0' if i % 2 == 0 else '1'
    if t1 != t2:
        x1 += 1

# 1010...のパターン
x2 = 0
for i in range(len(s)):
    t1 = s[i]
    t2 = '1' if i % 2 == 0 else '0'
    if t1 != t2:
        x2 += 1

print(min(x1, x2))



Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int nax = 2e5+10;
int a[nax];
int p[nax];
int n, k;

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> k;
	rep(i,1,n+1) {
		cin >> a[i];
		a[i] = (a[i] - 1) % k;
	}
	ll res = 0;
	map<int, int> wys;
	wys[0] = 1;
	p[0] = 0;
	int s = 0;
	rep(i, 1, n + 1) {
		// printf("proc: %d\n", i);
		if (i >= k) {
			--wys[p[i - k]];
			// printf("rem [%d] = %d\n", i-k-1, p[i-k]);
		}
		s = (s + a[i]) % k;
		p[i] = s;
		// printf("adding: %d\n", wys[s]);
		res = (res + wys[s]);
		++wys[s];
	}
	cout << res << endl;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define maxn 233
using namespace std;
#define G c=getchar()
typedef long long LL;
inline LL read()
{
    LL x=0,f=1;char G;
    while(c>57||c<48){if(c=='-')f=-1;G;}
    while(c>47&&c<58)x=x*10+c-48,G;
    return x*f;
}
bool b[maxn];
int sg[maxn][maxn];
LL Abs(LL x){return x<0?-x:x;}
int main()
{
/*	
	int n=20;
	for(int i=0,s,X,Y;i<=n;i++)
		for(X=i,Y=0;Y<=i;Y++,X--)
		{
			memset(b,0,sizeof(b));
			for(int k=1;2*k<=X;k++)b[sg[X-2*k][Y+k]]=1;
			for(int k=1;2*k<=Y;k++)b[sg[X+k][Y-2*k]]=1;
			for(s=0;b[s];s++);
			sg[X][Y]=s;
		}
	for(int i=0;i<=10;i++,puts(""))
		for(int j=0;j<=10;j++)
			printf("%d",sg[i][j]);
*/
	LL X=read(),Y=read();
	printf(Abs(X-Y)<2?"Brown":"Alice");
	return 0;
}

Measured memory_bytes: 256
def find_lakes(diagram):
    """Find lakes in diagram.

    >>> pat = str.maketrans('ufd', '/_\\\\')
    >>> find_lakes('ddfuu'.translate(pat))
    [6]
    >>> find_lakes('dduuudfududdddufudduuuffdddfddufdufud'.translate(pat))
    [4, 2, 1, 19, 9]
    >>> find_lakes('ff'.translate(pat))
    []
    """
    def calc_areas(ls):
        areas = []
        e1, e2 = 0, 0
        for n, m in reversed(ls):
            if e1 < n and e2 > m:
                area = areas.pop()
                areas.append(area + (m - n))
            else:
                areas.append(m - n)
                e1, e2 = n, m
        return areas[::-1]

    lakes = []
    slopes = []

    for i, c in enumerate(diagram):
        if c == '\\':
            slopes.append(i)
        elif c == '/':
            if len(slopes) > 0:
                lakes.append((slopes.pop(), i))

    return calc_areas(lakes)


def run():
    ls = find_lakes(input())

    summary = [str(len(ls))] + [str(i) for i in ls]
    print(sum(ls))
    print(" ".join(summary))


if __name__ == '__main__':
    run()



Measured memory_bytes: 6736
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int k,s,sum=0,v;
    cin>>k>>s;
    for(int i=0;i<=k;i++)
    {
        for(int j=0;j<=k;j++)
        {
            int v=s-i-j;
            if(v<=k&&v>=0)sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}

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

int main(){
    int S ,h, m , s;
    cin>> S;
    h=S/3600;
    m=(S%3600)/60;
    s=S-h*3600-m*60;
    cout<<h<<":"<<m<<":"<<s<<endl;
}
    


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

int main(){
    i64 n;
    string s;
    cin>>n>>s;
    if(n%2!=0){
        cout<<"No"<<endl;
        return 0;
    }
    for(i64 i=0;i<n/2;i++){
        if(s[i]!=s[n/2+i]) {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<ll,ll>;
const int MAX=1001001001;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	map<string,int> mp;
	rep(i,n){
		string s;
		cin>>s;
		mp[s]++;
	}
	int ans=mp.size();
	cout<<ans;

}


Measured memory_bytes: 19280
#include<iostream>
using namespace std;
#define MOD (long long)(1e9+7)
#define MAX_VAL (int)(1e5)


int main(){
	long long n, r=0, ans = 0, aa = 1, t;

	cin>>n;
	for(int i = 1; i <= n; i++){
		r = 0, t = i;
	while(t%2 == 0){
		t/=2;
		r++;
	}
		if(ans < r){
			ans =r;
			aa = i;
		}
	}
	cout<<aa<<endl;;
	return 0;
}

Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import sys
import math
import fractions
def j(a):
    if a==1: print("Yes")
    else :print("No")


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#x = int(input())                              #入力整数1つ
#x,y = (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#a,b,c,k = (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
x = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
sum = 0
for i in range(len(x)):
    sum += int(x[i])
j(int(x)%sum==0)

Measured memory_bytes: 5136
#include<bits/stdc++.h>
using namespace std;
const int Maxn = 2e5 + 10;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    if( n < 3200){
        cout << "red" <<"\n";
    }
    else{
        cout << s << "\n";
    }
    return 0;
}
//Thank u god Buddha


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  int ans = 1;
  for(int i = 0; i < N; i++) {
    if(ans * 2 <= ans + K) {
      ans *= 2;
    } else {
      ans += K;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner src = new Scanner(System.in);
	public static void main(String[] args) {
		int a = src.nextInt();
		int b = src.nextInt();
		int h = src.nextInt();
		int m = src.nextInt();
		double radmH = (360.0/12.0)/60.0; // rad / min
		double radmM = (360/60);

		double c = (30.0 / 60.0)*m;
		double hx = a * Math.cos(Math.toRadians(radmH*h*60 + c));// hにおける1分あたりの角速度
		double hy = a * Math.sin(Math.toRadians(radmH*h*60 + c));
		double mx = b * Math.cos(Math.toRadians(radmM*m));		// mにおける1分あたりの角速度
		double my = b * Math.sin(Math.toRadians(radmM*m));
		double dist = Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0));
		System.out.println(dist);
	}
}

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

int N;
static const int MAX_N = 200000;
int P[MAX_N];



int main() {
  cin >> N;
  for(int i=0;i<N;i++) cin >>P[i];
  int ans =0;
  int m = 20000001;
  for(int i=0;i<N;i++){
    if(m >= P[i]) ans++;
    m = min (m,P[i]);
  }
  cout <<ans <<endl;
}




Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <iomanip>
using namespace std;

long long int a, b;

long long zero_xor(long long n) {
  if ((n+1) % 2 == 0) {
    if (((n+1)/2)%2 == 0) {
      return 0;
    } else {
      return 1;
    }
  } else {
    if ((n/2)%2 == 0) {
      return 0 ^ n;
    } else {
      return 1 ^ n;
    }
  }
}

int main() {
  cin >> a >> b;
  long long ans = zero_xor(a-1) ^ zero_xor(b);
  
  cout << ans + 0LL << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
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; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

bool solve(){
	ll x,y,a,b,c;cin>>x>>y>>a>>b>>c;
  vector<ll>p(a);
  vector<ll>q(b);
  vector<ll>r(c);
  rep(i,a)cin>>p[i];
  rep(i,b)cin>>q[i];
  rep(i,c)cin>>r[i];
  sort(all(p),greater<ll>());
  sort(all(q),greater<ll>());
  sort(all(r),greater<ll>());
  priority_queue<ll>que;
  rep(i,x){
    que.push(p[i]);
  }
  rep(i,y){
    que.push(q[i]);
  }
  rep(i,c)que.push(r[i]);
  ll ans=0;
  rep(i,x+y){
    ans+=que.top();
    que.pop();
  }
  cout<<ans<<endl;
	return false;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


Measured memory_bytes: 8688
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

k = input_n

que = []
(1..9).each do |i|
  que.push(i)
end

cnt = 0
x = 0
while cnt < k
  x = que.shift
  que.push(10 * x + (x % 10) - 1) if x % 10 != 0
  que.push(10 * x + (x % 10))
  que.push(10 * x + (x % 10) + 1) if x % 10 != 9
  cnt += 1
end
puts x

Measured memory_bytes: 16572
class ConnectedComponents():
    def __init__(self, n):
        self.size = [1] * n
        self.id = [i for i in range(n + 1)]

    def root(self, i):
        while i != self.id[i]:
            self.id[i] = self.id[self.id[i]]
            i = self.id[i]

        return i

    def relations(self, s, t):
        s_root = self.root(s)
        t_root = self.root(t)

        if s_root == t_root: 
            return

        if self.size[s_root] < self.size[t_root]:
            self.id[s_root] = t_root
            self.size[t_root] += self.size[s_root]
        else:
            self.id[t_root] = s_root
            self.size[s_root] += self.size[t_root]

    def find(self, s, t):
        return self.root(s) == self.root(t)

# INPUT
n, m = map(int, input().split())

CC = ConnectedComponents(n)

for _ in range(m):

    s, t = map(int, input().split())

    CC.relations(s, t)

# QUESTION
q = int(input())

for _ in range(q):

    s, t = map(int, input().split())

    if CC.find(s, t):
        print("yes")
    else:
        print("no")




Measured memory_bytes: 10464
//package Atcoder133;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int D = scanner.nextInt();
        List<List<Double>> list = new ArrayList<>();
        for(int i = 0 ; i < N ; i++){
            List<Double> list2 = new ArrayList<>();
            for(int j = 0 ; j< D ; j++){
                list2.add(scanner.nextDouble());
            }
            list.add(list2);
        }
        int squareNumCount = 0;
        for(int i = 0 ; i< N ; i++){
            for(int j = N-1; j> i ; j--){
                double squaredDistanse = calSquaredDistanse(list.get(i),list.get(j));
                if(isSquareNum(squaredDistanse)){
                    squareNumCount++;
                }
            }
        }
        System.out.println(squareNumCount);
    }

    private static boolean isSquareNum(double squaredDistanse) {
        for(int i=1; i<=Math.sqrt(squaredDistanse); i++){
            if(i*i == squaredDistanse) return true;
        }
        return false;
    }

    private static double calSquaredDistanse(List<Double> integers, List<Double> integers1) {
        double sum = 0;
        for(int i=0; i < integers.size(); i++){
            double d = integers.get(i) - integers1.get(i);
//            sum = d>0 ? sum+d*d : sum-d;
            sum+=d*d;
        }
        return sum;
    }
}


//15hunn


Measured memory_bytes: 23124
#include <stdio.h>
#define REP(i, n) for(i = 0; i < n; ++i)
#define FOR(i, a, b) for(i = a; i < b; ++i)

typedef struct{
    int x;
    int y;
}point;

int abs(int a){
    return a > 0? a : -a;
}

char judge(int dt, point from, point to){

    int dx = abs(from.x - to. x), dy = abs(from.y -to.y);
    char enough = (dt >= dy + dx);
    char even_odd = (dt % 2 == (dy + dx) % 2);

    return enough & even_odd;
}

int main(){
    int N, i;
    char ans = 1;

    scanf("%d", &N);

    point places[N + 1];
    int t[N + 1];
    places[0].x = 0, places[0].y = 0, t[0] = 0;

    FOR(i, 1, N + 1){
        scanf("%d %d %d", &t[i], &places[i].x, &places[i]. y);
    }

    REP(i, N){
        ans &= judge(t[i + 1] - t[i], places[i], places[i + 1]);
    }

    if(ans){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1280
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 10L^^15;
enum mod = 10L ^^ 9 + 7;

void main() {
    int n, k;
    scan(n, k);
    auto a = readln.split.to!(int[]);

    auto dp = new long[][](n + 1, k + 1);
    dp[0][0] = 1;

    foreach (i ; 1 .. n + 1) {
        foreach (j ; 0 .. k + 1) {
            dp[i][j] = dp[i-1][j];
            if (j > 0) {
                dp[i][j] += dp[i][j-1];
                dp[i][j] %= mod;
            }
            if (j - a[i-1] - 1 >= 0) {
                dp[i][j] += mod - dp[i-1][j-a[i-1]-1];
                dp[i][j] %= mod;
            }
        }
    }

    debug {
        writefln("%(%s\n%)", dp);
    }

    auto ans = dp[n][k];

    writeln(ans);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 81276
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
/***** MAIN *****/
signed main() {
  int n;
  scanf("%d", &n);
  int nums[n];
  double ans = 0;
  REP(i, n) {
    scanf("%d", &nums[i]);
    ans += (double)1/nums[i];
  }
  ans = 1/ans;
  cout << fixed << setprecision(10) << ans;
  
  cout << "\n";
  return 0;
}
/***** MAIN *****/

Measured memory_bytes: 256