akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static String I = "IMPOSSIBLE";
	public static String B = "Bad";
	public static String G = "Good";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int s = ni();
		int w = ni();

		if (s <= w) {
			out("unsafe");
		} else {
			out("safe");
		}

	}

	/*
	 * 以下メソッド集
	 */
	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

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

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static int max(int a, int b) {
		return Math.max(a, b);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static int min(int a, int b) {
		return Math.min(a, b);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}


Measured memory_bytes: 35792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    int Alice = 0, Bob = 0;
    for (int i = 0; i < n; i++) {
        cin >> vec[i];
    }
    sort(vec.rbegin(), vec.rend());
    for (int i = 0; i < n; i++) {
        if(!(i%2))Alice += vec[i];
        else Bob += vec[i];
    }
    cout << Alice - Bob << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

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

ll lcm(ll x, ll y) {
    return x / gcd(x,y) * y;
}

int main(void)
{
    /*
        解法
        x = a/2*(2p+1) 
        2p+1が奇数なので、xの素因数2^n = a/2 の素因数2^n としたときnが同じ
        2で割れる回数が同じでないといけない
        後は m >= ai/2の最小公倍数 * 奇数(1,3,5...)
    */
    IOS
    int n, m;
    cin >> n >> m;
    set<int> st;
    vector<int> v(n);
    REP(i,n) {
        int a;
        cin >> a;
        int b = a/2;
        int div2 = 0;
        while(b % 2 == 0) {
            div2++;
            b /= 2;
        }
        v[i] = a/2;
        st.insert(div2);
    }

    if (st.size() != 1) OUT(0)
    else {
        ll alcm = 1;
        REP(i,n) {
            alcm = lcm(alcm,v[i]);
            if (alcm > m) {
                alcm = 0;
                break;
            }
        }
        if (alcm == 0) OUT(0)
        else {
            int ans = 0;
            for(int i = 1;alcm * i <= m; i += 2)ans++;
            cout << ans << '\n';
        }
    }

    return 0;
}

Measured memory_bytes: 640
# N<=100000なので愚直にインクリメントしていった最初のやつでいいんじゃないかと思い始めた 繰り上がりとかの場合分けがめんどいし
n, k = map(int, input().split())
nglist = list(input().split())
while True:
    strn = str(n)
    flag = True
    for ng in nglist:
        if ng in strn:
            flag = False
            break
    if flag:
        break
    else:
        n += 1
print(n)


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b; cout << (a+b)%24 << endl;
	return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

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

		Integer s = sc.nextInt();
		Integer h = s / 3600;
		s %= 3600;
		Integer m = s / 60;
		s %= 60;

		System.out.println(h + ":" + m + ":" + s);

	}

}



Measured memory_bytes: 26268
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define Array 1400
int dp[Array][Array];

int main(){
	int h, w, maxedge = 0;
	bool tail[Array][Array];
	scanf("%d%d", &h, &w);
	for (int i = 0; i < h; i++){
		for (int j = 0; j <w; j++){
			scanf("%d", &tail[i][j]);
			if (!tail[i][j]){
				dp[i][j] = 1;
				maxedge = 1;
			}
		}
	}
	for (int i = 1; i < h; i++){
		for (int j = 1; j < w; j++){
			if (!tail[i][j])
				dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
			maxedge = max(maxedge, dp[i][j]);
		}
	}
	printf("%d\n", maxedge * maxedge);
	return 0;
}

Measured memory_bytes: 9420
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  llong n;
  cin >> n;

  vector<llong> a(n), b(n), c(n);

  llong sum_a = 0, sum_b = 0;
  REP(i,n){
    cin >> a[i];
    sum_a += a[i];
  }
  REP(i,n){
    cin >> b[i];
    sum_b += b[i];
    c[i] = a[i] - b[i];
  }
  if(sum_a < sum_b){
    cout << "-1\n";
    return 0;
  }

  sort(ALL(c), greater<llong>());
  
  llong amari = 0;

  priority_queue<llong> que;
  llong ans = 0;

  REP(i,n){
    if(c[i] > 0){
      que.push(c[i]);
    }else if(c[i] < 0){
      llong val = c[i];
      ans++;

      if(llabs(val) < amari){
        amari = amari + val;
        continue;
      }else{
        val += amari;
        amari = 0;
      }

      while(val < 0){
        llong tp = que.top();
        que.pop();
        ans++;
        if(llabs(val) < tp){
          amari = tp + val;

          val = 0;
          break;
        }else{
          val += tp;
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3196
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define range(i, a, b, s) for (int i = (a), __##i = (b); i < __##i; i += (s))
#define down(i, a, b, s) for (int i = (a), __##i = (b); _##i < i; i -= (s))

int a, b, c;

int main(int argc, char const *argv[]) {
  // freopen("A.txt", "r", stdin);
  while (cin >> a >> b >> c) {
    cout << min(min(a + b, b + c), a + c) << endl;
  }
  return 0;
}

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

int main() {
    vector<int> a(4), b; b = {1, 4, 7, 9};
    for (int i = 0; i < 4; i++) cin >> a[i];
    sort(a.begin(), a.end());
    if (a == b) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

using namespace std;

const int N=505;

vector<int> en[N];
int ans[N][N];
int n,m,q;

int main()
{
	cin >> n >> m >> q;
	for(int i=0;i<m;i++)
	{
		int l,r;
		scanf("%d %d",&l,&r);
		en[r].push_back(l);
	}
	for(int i=1;i<=n;i++) sort(en[i].begin(),en[i].end());
	for(int l=1;l<=n;l++)
	{
		for(int r=l;r<=n;r++)
		{
			ans[l][r]=ans[l][r-1];
			ans[l][r]+=(en[r].size()-(lower_bound(en[r].begin(),en[r].end(),l)-en[r].begin()));
		}
	}
	while(q--)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		printf("%d\n",ans[x][y]);
	}
	return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  vector<int>d(N);
  for(int i=0;i<N;i++){
    cin>>d.at(i);
  }
  int ans;
  ans=0;
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      ans+=d.at(i)*d.at(j);
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;

typedef long long ll;

int const NMAX = 1e5;
int const MMAX = 1e5;
int n, m;
vector<int> graph[1 + NMAX];
int dp[1 + NMAX];

int dfs(int x) {
  if(dp[x] != -1) {
    return dp[x];
  }

  int sol = 0;
  for(int i = 0; i < graph[x].size(); i++) {
    int neighbor = graph[x][i];
    sol = max(sol, dfs(neighbor) + 1);
  }

  dp[x] = sol;
  return sol;
}

int main() {
  cin >> n >> m;
  for(int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    graph[x].push_back(y);
  }
  for(int i = 1; i <= n; i++) {
    dp[i] = -1;
  }
  int ans = 0;
  for(int i = 1; i <= n; i++) {
    ans = max(ans, dfs(i));
  }
  cout << ans;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
int main(){
    string s;
    ll ans=0;
    cin >> s;
    vector<int> w;
    for(int i=0;i < s.size();i++)
    {
        if(s.at(i)=='W'){
            w.push_back(i);
        }
    }
    for(int i=0;i < w.size();i++)
    {
        ans+=(w.at(i)-i);
    }
    cout << ans << endl;
}    

Measured memory_bytes: 1532
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e10;
const long double PI = (acos(-1));


struct UnionFind {
	vector<int> d; // d[i]:iの親の番号　(例) d[3] = 2 : 3の親が2 d[3] = -3 : 3は根で、その連結成分のサイズは3

	UnionFind(int N) : d(N, -1) {} // 負なら根である 非負なら子である

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (d[x] < 0) return x; //負なら根であるから根を返す
		return d[x] = root(d[x]);
	}

	bool unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return false; //xとyの根が同じ(=同じ木にある)時はそのまま
		if (d[rx] > d[ry])swap(rx, ry); //木のサイズが大きいほうにくっつける
		d[rx] += d[ry]; //サイズが上乗せされる
		d[ry] = rx; //yの根はxになる
		return true;
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
	int size(int x) {
		return -d[root(x)];
	}
};


signed main() {
	int N, M;
	cin >> N >> M;
	UnionFind tree(N);
	vector<int>A(M), B(M);
	rep(i, M)cin >> A[i] >> B[i];
	rep(i, M)A[i]--;
	rep(i, M)B[i]--;
	vector<int>v(M);
	v[0] = 0;
	for (int i = M - 1; i >= 0; i--) {
		if (tree.same(A[i], B[i]))v[i] = 0;
		else {
			v[i] = tree.size(A[i]) * tree.size(B[i]);
			tree.unite(A[i], B[i]);
		}
	}
	rep(i, M - 1)v[i + 1] += v[i];
	rep(i, M)cout << v[i] << endl;
}

Measured memory_bytes: 4480
def calculate(S):
    arr_string = list(S)
    
    if arr_string.count('R') == 0:
        return 0
    elif arr_string.count('R') == 1:
        return 1
    elif arr_string.count('R') == 3:
        return 3
    else: # return 2, check if it is consecutive?
        if arr_string[1] == 'S':
            return 1
        else:
            return 2
            
S = str(input())            
print(calculate(S))

Measured memory_bytes: 61652
#include <iostream>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int main(){
	int n;
	cin>>n;
	int cnt=0;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			for(int k=j+1;k<=n;k++){
				int x=a[i],y=a[j],z=a[k];
				if(x+y>z&&y+z>x&&x+z>y&&x!=y&&x!=z&&y!=z) cnt++;
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e9;

ll N,ans=0;
ll S[101],dp[110][10010];

void solve(){
    for(int i=0;i<N;i++)for(int j=0;j<10010;j++){
        if(dp[i][j]){
            dp[i+1][j]=1;
            dp[i+1][j+S[i]]=1;
        }
        if(i==N-1){
            if(j%10==0)dp[i+1][j]=0;
            if((j+S[i])%10==0)dp[i+1][j+S[i]]=0;
        }
    }
    for(int i=0;i<10010;i++)if(dp[N][i])ans=i;
    cout << ans << endl;
}

int main(){
    dp[0][0]=1;
    cin >> N;
    for(ll i=0;i<N;i++)cin >> S[i];
    solve();
}

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

long N, A, B;
vector<long> H;

bool f(long mid) {
  vector<long> V = H;
  for (auto &v : V) v -= B * mid;
  long cnt = 0, tmp = A - B;
  for (auto v : V) if (v > 0) cnt += (v + tmp - 1) / tmp;
  return (cnt <= mid) ? true : false;
}

int main() {
  cin >> N >> A >> B;
  H.resize(N);
  for (auto &h : H) cin >> h;
  long ok = 1e9, ng = -1;
    while (ok - ng > 1) {
      long mid = (ok + ng) / 2;
      (f(mid)) ? ok = mid : ng = mid;
    }
  cout << ok << "\n";
}

Measured memory_bytes: 4816
import java.util.*;

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

        String input = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51";
        String[] nums = input.split(", ");

        System.out.println(nums[K - 1]);

    }
}


Measured memory_bytes: 21972
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
using namespace std;

int main()
{
    const char *Yes = "Yes";
    const char *No = "No";

    char N[5];

    if (scanf("%s", N) < 1) return 0;

    if (N[0] == N[1] && N[1] == N[2])
    {
        printf("%s\n", Yes);
    }
    else if (N[1] == N[2] && N[2] == N[3])
    {
        printf("%s\n", Yes);
    }
    else
    {
        printf("%s\n", No);
    }

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  int N, K; std::string S; std::cin >> N >> K >> S;
  int n = std::unique(S.begin(), S.end()) - S.begin();
  n = std::max(1, n - 2*K);
  fin(N - n);
  return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int maxn = 200000+5;
ll T,n,m;
int main() {
//    scanf("%d",&T);
//    while(T--) {
//
//    }
	cin>>n>>m;
	if(((n+m)%2)){
		cout<<"IMPOSSIBLE\n";
	}
	else
		cout<<(n+m)/2<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
#define vecout(v,n) for(int i=0; i<n; i++)cout<<v[i]<<" "; cout<<endl;

const int mod = 1000000007;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}

int a, b, n, q;



signed main() {
	cin >> n >> q;
	vector<vector<int>>vec(n);
	vector<int>vec2(n);
	vector<int>vec3(n);
	vector<int>vec4(n);
	queue<int>que;
	que.push(0);
	vec4[0] = 1;
	rep(i, n - 1) {
		cin >> a >> b;
		vec[a - 1].push_back(b - 1);
		vec[b - 1].push_back(a - 1);
	}
	rep(i, q) {
		cin >> a >> b;
		vec2[a - 1] += b;
	}
	vec3[0] = vec2[0];
	while (!que.empty()) {
		a = que.front();
		rep(i, vec[a].size()) {
			if (vec4[vec[a][i]] == 0) {
				que.push(vec[a][i]);
				vec3[vec[a][i]] = vec3[a] + vec2[vec[a][i]];
				vec4[vec[a][i]] = 1;
			}
		}
		que.pop();
	}
	rep(i, n) {
		cout << vec3[i] << endl;
	}
}



Measured memory_bytes: 20976
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};


int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n;
    sfl(n);
    string ans = "";
    while(n){
        n--;
        ans += ((n%26)+'a');
        n /= 26;
    }
    reverse(all(ans));
    cout << ans << endl;
    return 0;
    

}


Measured memory_bytes: 3668
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long A = sc.nextLong();
		long B = sc.nextLong();
		sc.close();

		long q = N / (A + B);
		long r = N % (A + B);
		long rb = Math.min(r, A);
		System.out.println(q * A + rb);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;

ll power(ll x, ll y)
{
	ll res = 1;
	x %= mod;
	while (y > 0)
	{
		if (y % 2 == 1)
			res = res * x % mod;
		y /= 2;
		x = x * x % mod;
	}
	return res;
}

ll modinv(ll n)
{
	return power(n, mod-2);
}

ll choose(ll n, ll k)
{
	vector<ll> fac(n + 1);
	fac[0] = 1;
	for (int i = 1; i <= n; ++i)
		fac[i] = fac[i-1] * i % mod;
	return fac[n] * modinv(fac[k]) % mod * modinv(fac[n-k]) % mod;
}

int main()
{
	ll X, Y;
	cin >> X >> Y;
	if ((X + Y) % 3 != 0)
	{
		cout << 0 << '\n';
		return 0;
	}
	ll reduce = (X + Y) / 3;
	X -= reduce; Y -= reduce;
	if (X < 0 || Y < 0)
	{
		cout << 0 << '\n';
		return 0;
	}
	cout << choose(X+Y, X) << '\n';
}


Measured memory_bytes: 5504
import java.util.*;

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

      int u = 0;


      int[] A = new int[90000 + 1];
      int[] B = new int[90000 + 1];
      A[0] = B[0] = 0;
      for(int i = 1; i <= H; i++){
          for(int j = 1; j <= W; j++){
              u    = scan.nextInt();
              A[u] = i;
              B[u] = j;
              }
          }
      int   Q = scan.nextInt();
      int[] L = new int[Q];
      int[] R = new int[Q];
      for(int i = 0; i < Q; i++){
          L[i] = scan.nextInt();
          R[i] = scan.nextInt();
          }
      int[] power = new int[90000 + 1];
      for(int i = 1 + D; i <= H * W; i++){
          power[i] = power[i - D] + Math.abs(A[i] - A[i - D]) + Math.abs(B[i] - B[i - D]);
          }
      power[0] = 0;
      for(int i = 0; i < Q; i++){
          System.out.println(power[R[i]] - power[L[i]]);
          }
   }
}


Measured memory_bytes: 95040
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int n;
    int cnt = 0;
    cin >> n;
    vector<int>rabbit(n);
    rep(i, n)cin >> rabbit[i];
    rep(i, n) {
        if (i == rabbit[rabbit[i] - 1] - 1)cnt++;
    }
    cout << cnt/2 << endl;
}


Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>

using namespace std;

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

int main(){
	int x, y, a, b, c, d; cin >> a >> b >> c >> d;
	x = y = 0;
	x = max(a, c);
	y = min(b, d);

	if( y - x > 0 ) cout << y - x << endl;
	else cout << "0" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#define Re register int
#define LL long long

int N,H[200005],A[200005];
LL f[200005],T[800005],ans;

template <typename T> inline void read(T &var)
{
	T x=0; int w=0; char ch=0;
	while (!isdigit(ch)) w|=ch=='-',ch=getchar();
	while (isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	var=w?-x:x;
}
void Add(int id,int l,int r,int pos,LL v)
{
	if (l==r&&l==pos) {T[id]=std::max(T[id],v); return;}
	int mid=(l+r)>>1;
	if (pos<=mid) Add(id<<1,l,mid,pos,v);
	else Add(id<<1|1,mid+1,r,pos,v);
	T[id]=std::max(T[id<<1],T[id<<1|1]);
}
LL Query(int id,int l,int r,int pos)
{
	if (r<=pos) return T[id];
	int mid=(l+r)>>1; LL ret=Query(id<<1,l,mid,pos);
	if (mid<pos) ret=std::max(ret,Query(id<<1|1,mid+1,r,pos));
	return ret;
}
int main(int argc, char const *argv[])
{
	read(N); for (Re i=1; i<=N; ++i) read(H[i]);
	for (Re i=1; i<=N; ++i)
		read(A[i]),f[i]=A[i];
	ans=A[1],Add(1,1,N,H[1],f[1]);
	for (Re i=2; i<=N; ++i)
	{
		f[i]=Query(1,1,N,H[i])+A[i];
		Add(1,1,N,H[i],f[i]);
		ans=std::max(ans,f[i]);
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
  int n,a,b;
  cin>>n>>a>>b;
  int sum=0,ans=0;
  for(int i=1;i<=n;++i){
    if(i%10000==0) sum-=35;
    else if(i%1000==0) sum-=26;
    else if(i%100==0) sum-=17;
    else if(i%10==0) sum-=8;
    else sum++;
    
    if(sum>=a && sum<=b) ans+=i;
  }
  
  cout<<ans<<endl;
}

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

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

	int N, A[100005];
	int cnt1[100005];
	int cnt2[100005];
	bool ud[100005];
	int total = 0;
	memset(cnt1, 0, sizeof(cnt1));
	memset(cnt2, 0, sizeof(cnt2));

	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> A[i];
		if(i % 2 == 0) cnt1[A[i]]++;
		else cnt2[A[i]]++;
	}

	for(int i = 1; i <= 100000; i++) {
		if(cnt1[i] != 0 or cnt2[i] != 0) {
			total++;
		}
	}

	if(total == 1) {
		cout << N / 2 << endl;
		return 0;
	}
	else {
		int ans1 = 0; int ans2 = 0; 
		int maxi1 = -1; int maxi2 = -1;
		for(int i = 0; i < N; i ++) {
			if(i % 2 == 0) {
				//cout << "! " << A[i] << " " << cnt1[A[i]] << endl;
				if(maxi1 < cnt1[A[i]] and not(ud[A[i]])) {
					maxi2 = maxi1;
					ans2 = ans1;
					maxi1 = cnt1[A[i]];
					ans1 = A[i];
					ud[A[i]] = 1;
				}
				else if(maxi2 < cnt1[A[i]] and not(ud[A[i]])) {
					maxi2 = cnt1[A[i]];
					ans2 = A[i];
					ud[A[i]] = 1;
				}
			}
		}
		memset(ud, 0, sizeof(ud));
		int ans3 = 0; int ans4 = 0;
		int maxi3 = -1; int maxi4 = -1;
		for(int i = 0; i < N; i++) {
			if(i % 2 == 1) {
				if(maxi3 < cnt2[A[i]] and not(ud[A[i]])) {
					maxi4 = maxi3;
					ans4 = ans3;
					maxi3 = cnt2[A[i]];
					ans3 = A[i];
					ud[A[i]] = 1;
				}
				else if(maxi4 < cnt2[A[i]] and not(ud[A[i]])) {
					ud[A[i]] = 1;
					maxi4 = cnt2[A[i]];
					ans4 = A[i];
				};
			}
		}

		//cout << maxi1 << " " << maxi2 << " " << maxi3 << " " << maxi4 << endl;
		if(ans1 == ans3) {
			int temp = max(maxi2 + maxi3, maxi1 + maxi4);
			cout << N - temp << endl;
		}
		else {
			cout << N - maxi1 - maxi3 << endl;
		}
	}
}

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

int main() {
    int n;
    scanf("%d", &n);
    char c, pc = -1;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        scanf(" %c", &c);
        if (pc != c) {
            ++ans;
        }
        pc = c;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class319
    {
        static void Main()
        {
            string S = Console.ReadLine();
            int N = S.Length;

            long ans = 0;
            for(int i = 0; i < (1 << N - 1); i++)
            {
                long sum = 0;
                long s = S[0] - '0';
                for(int j = 0; j < N-1; j++)
                {
                    if ((i & (1 << j)) > 0)
                    {
                        s *= 10;
                        s += S[j + 1] - '0';
                    }
                    else
                    {
                        sum += s;
                        s = S[j + 1] - '0';
                    }
                }
                sum += s;
                ans += sum;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>
#include <random>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

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

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

random_device seed_gen;
mt19937 engine(seed_gen());
// 0, 1, 2 のどれかが得られる一様分布
// uniform_int_distribution<> dist(0, 2);
// cout << dist(engine) << endl;
// みたいに、先に確率分布を宣言して、そこにengineを与えて使う。

// =========ここまでテンプレ============

int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> p(n);
    vector<ll> c(n);
    rep(i, n)
    {
        ll tempP;
        cin >> tempP;
        --tempP;
        p[i] = tempP;
    };
    rep(i, n) cin >> c[i];
    ll result = LLONG_MIN;
    rep(i, n)
    {
        // マスiからスタートします
        vector<bool> already = vector<bool>(n, false);
        vector<ll> scoreHere = vector<ll>(n, 0);
        vector<ll> walkedCountHere = vector<ll>(n, -1);
        ll score = 0;
        ll greatest = LLONG_MIN;
        ll walkedCount = 0;
        ll nowAt = i;
        walkedCountHere[i] = 0;
        already[i] = true;
        while (walkedCount < k)
        {
            ll next = p[nowAt];
            nowAt = next;
            ++walkedCount;
            score += c[nowAt];
            greatest = max(greatest, score);
            if (nowAt == i)
            {
                ll period = walkedCount;
                ll scoreOfLoop = score;
                if (scoreOfLoop > 0)
                {
                    ll q = (k - walkedCount) / period;
                    if ((k - walkedCount) % period == 0)
                        q = max(ll{0}, q - 1);
                    walkedCount += period * q;
                    score += scoreOfLoop * q;
                    greatest = max(greatest, score);
                }
                else
                {
                    greatest = max(greatest, score);
                    break;
                }
            }
        }
        result = max(result, greatest);
    }
    cout << result << endl;

    return 0;
}

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

using namespace std;

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

  int c[256]={},ans=0;
  for(int i=0;i<s.size();i++){
    c[s[i]]++;
  }

  for(int i='a';i<='z';i++)
    ans+=(c[i])%2;

  cout<<ans/2<<endl;

  return 0;
}

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

using namespace std;

const int inf = 1e9;

int main () {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
  
  string s; cin >> s;
  int N = (int) s.size();
  for (int i = 0; i < N-1; ++i) {
    if (s[i] == s[i+1]) {
      cout << i+1 << " " << i+2 << '\n'; goto done;
    }
  }
  
  for (int i = 0; i < N-2; ++i) {
    for (int j = i; j < i + 3; ++j) {
      if (s[i] == s[i+2]) {
        cout << i + 1 << " " << i + 3 << '\n'; goto done;
      }
    }
  }
  
  cout << -1 << " " << -1 << '\n';
  done: ;

  return 0;
}




Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
int N;
int a[100002],b[100002],c[100002];
bool isOKa(int index,int key){
	if(a[index]>= key)return true;
	else return false;
}
bool isOKc(int index,int key){
	if(c[index]>= key)return true;
	else return false;
}

long long binary_searcha(int key){
	int left = -1;//[index = 0] が条件を満たすこともあるので、初期値は-1
	int right = N; //[index = a.size()-1]が条件を満たさないこともあるので初期値はa.size();
	while(right -left > 1){
		int mid = (left+right)/2;
		if(isOKa(mid,key))right=mid;
		else left = mid;
	}
	/*leftは条件を満たさない最大の値、rightは条件を満たす最小の値になっている*/
	return left+1;
}
long long binary_searchc(int key){
	int left = -1;//[index = 0] が条件を満たすこともあるので、初期値は-1
	int right = N; //[index = a.size()-1]が条件を満たさないこともあるので初期値はa.size();
	while(right -left > 1){
		int mid = (left+right)/2;
		if(isOKc(mid,key))right=mid;
		else left = mid;
	}
	/*leftは条件を満たさない最大の値、rightは条件を満たす最小の値になっている*/
	return N-right;
}

int main(void){
	cin >> N;
	for(int i=0;i<N;i++)cin >> a[i];
	for(int i=0;i<N;i++)cin >> b[i];
	for(int i=0;i<N;i++)cin >> c[i];
	sort(a,a+N);sort(b,b+N);sort(c,c+N);
	long long ans = 0;
	for(int i=0;i<N;i++){
		int key = b[i];
		long long ac = binary_searcha(key);
		long long cc = binary_searchc(key+1);
		ans += ac*cc;
	}
	cout << ans << endl;
}

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

int main() {
  double N,Sum1=0,Sum2=0,Ans1=0,Ans2=0;
  cin>>N;
  vector<double> vec(N);
  rep(i,N){cin>>vec.at(i);Sum1+=vec.at(i);Sum2+=vec.at(i);}
  Sum1=floor(Sum1/N);
  Sum2=ceil(Sum2/N);
  rep(i,N){Ans1+=(vec.at(i)-Sum1)*(vec.at(i)-Sum1);
          Ans2+=(vec.at(i)-Sum2)*(vec.at(i)-Sum2);}
  cout<<min(Ans1,Ans2)<<endl;
}

Measured memory_bytes: 3824
#include <iostream>
#include <cmath>
#include <string>
#include <string.h>
#include <cstdlib>
#include <iomanip>
#include <stdio.h>

using namespace std;

int main(){

  int n,x[1000],y[1000];
  double xy=0;

  scanf("%d\n",&n);

  for(int i=0;i<n;i++){
    scanf("%d ",&x[i]);
  }
  for(int i=0;i<n;i++){
    scanf("%d ",&y[i]);
  }

  for(int i=0;i<n;i++){
    xy += (double)abs(x[i] - y[i]);
  }
  printf("%.6lf\n",xy);

  xy=0;
  for(int i=0;i<n;i++){
    xy += pow((double)abs(x[i] - y[i]),2);
  }
  xy=sqrt(xy);
  printf("%.6lf\n",xy);

  xy=0;
  for(int i=0;i<n;i++){
    xy += pow((double)abs(x[i] - y[i]),3);
  }
  xy=cbrt(xy);
  printf("%.6lf\n",xy);

  xy=0;
  for(int i=0;i<n;i++){
    if(xy<(double)abs(x[i] - y[i]))
      xy = (double)abs(x[i] - y[i]);
  }
  printf("%.6lf\n",xy);
}


Measured memory_bytes: 3376
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2", "sse4")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

const int mxn = 2e5 + 5, mxm = 1e6 + 5;
const int ml0 = 1047961, mo0 = 1048505167;
const int ml1 = 1027127, mo1 = 1010521781;

int n;
char s[mxm];
int pw0[mxm], pw1[mxm];
int bg[mxn], ln[mxn];
int hs0[mxm], hs1[mxm];
int h0[mxn], h1[mxn];

/*
#include <bits/extc++.h>
using namespace __gnu_pbds;
gp_hash_table <ll, int> S;
*/

// /*
struct hashMap {
	static const int mxn = 19260817;
	int hd[mxn];
	vector <int> nex;
	vector <ll> key;
	vector <int> val;
	hashMap() { memset(hd, -1, sizeof(hd)); nex.clear(); key.clear(); val.clear(); }
#define fore(e, id) for (int e = hd[id]; ~e; e = nex[e])
	int &operator [] (ll x) {
		int id = x % mxn; fore(e, id) if (key[e] == x) return val[e];
		key.pb(x); nex.pb(hd[id]); hd[id] = nex.size() - 1; val.pb(0);
		return val[nex.size() - 1];
	}
	int get(ll x) {
		int id = x % mxn; fore(e, id) if (key[e] == x) return val[e];
		return 0;
	}
#undef fore
};

hashMap S;
// */

bool hav[mxm];

int main() {
	rep(i, mxm) pw0[i] = i ? 1LL * pw0[i - 1] * ml0 % mo0 : 1;
	rep(i, mxm) pw1[i] = i ? 1LL * pw1[i - 1] * ml1 % mo1 : 1;
	scanf("%d", &n);
	// n = 2e5;
	rep(i, n) {
		bg[i] = i ? bg[i - 1] + ln[i - 1] : 0;
		scanf("%s", s + bg[i]);
		// rep(j, 1e6 / n) s[bg[i] + j] = rand() % 26 + 'a';
		ln[i] = strlen(s + bg[i]);
		h0[i] = h1[i] = 0;
		for (int j = ln[i] - 1; ~j; -- j) {
			h0[i] = (h0[i] + 1LL * pw0[ln[i] - 1 - j] * s[bg[i] + j]) % mo0;
			h1[i] = (h1[i] + 1LL * pw1[ln[i] - 1 - j] * s[bg[i] + j]) % mo1;
			hs0[bg[i] + j] = h0[i]; hs1[bg[i] + j] = h1[i];
		}
		hav[ln[i]] = 1;
		S[1LL * h0[i] * mo1 + h1[i]] ++;
	}
	ll ans = 0;
	rep(i, n) {
		int cnt[26]; memset(cnt, 0, sizeof(cnt));
		rep(j, ln[i]) {
			cnt[s[bg[i] + j] - 'a'] ++;
			int rs = ln[i] - j - 1;
			int rh0 = rs ? hs0[bg[i] + j + 1] : 0;
			int rh1 = rs ? hs1[bg[i] + j + 1] : 0;
			if (!hav[rs + 1]) continue;
			rep(c, 26) if (cnt[c]) {
				int nh0 = (1LL * (c + 'a') * pw0[rs] + rh0) % mo0;
				int nh1 = (1LL * (c + 'a') * pw1[rs] + rh1) % mo1;
				if (j) ans += S.get(1LL * nh0 * mo1 + nh1);
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 102448
//code_sm
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> 
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int> 
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu ((int)1e9+7)
#define set0(a) memset(a,0,sizeof(a))

//sieve generation begin
vi PRIME;
void sieve(int n)
{
	bool a[n+1];
	memset(a,0,sizeof(a));
	a[0]=1;
	a[1]=1;
	for(int i=2;i*i<=n;i++)
	{
		if(a[i]==0)
		{
			for(int j=i*i;j<=n;j+=i)
			a[j]=1;
		}
	}
	for(int i=2;i<=n;i++)
	{
		if(a[i]==0)
		PRIME.pb(i);
	}
}
//sieve generation end
ll gcd(ll a,ll b)
{
	while(b%a)
	{
		ll c=b;
		b=a;
		a=c%a;
	}
	return a;
}
ll bigpow(ll x,ll y)
{
	if(y==0)
	return 1;
	else if(y&1)
	{
		return (x*bigpow((x*x)%chotu,(y-1)/2))%chotu;
	}
	else 
	return bigpow((x*x)%chotu,y/2);
}

void solve()
{
	fastio
int x,y,a,b,c;
cin>>x>>y>>a>>b>>c;
priority_queue<ll>apple,orange,no,res;
for(int i=0;i<a;i++)
{
	ll x;
	cin>>x;
	apple.push(x);
}
for(int i=0;i<b;i++)
{
	ll x;
	cin>>x;
	orange.push(x);
}
for(int i=0;i<c;i++)
{
	ll x;
	cin>>x;
	no.push(x);
}
ll sum=0;
for(int i=0;i<x;i++)
{
	res.push(apple.top());
	apple.pop();
}
for(int i=0;i<y;i++)
{
	res.push(orange.top());
	orange.pop();
}
for(int i=0;i<c;i++)
{
	res.push(no.top());
	no.pop();
}
for(int i=0;i<x+y;i++)
{
	sum+=res.top();
	res.pop();
}
cout<<sum;
}
int main()
{
//code
fastio
int t;
t=1;
while(t--)
{
	solve();
	cout<<'\n';
}

}

Measured memory_bytes: 8688
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)


int main(){
    int A,B,M;
    cin >> A >> B >> M;
    vector<int> a(A);
    vector<int> b(B);
    rep(i,A) cin >> a[i];
 
    rep(i,B) cin >> b[i];
 
    int x[M],y[M],c[M];
    rep(i,M){
        cin >> x[i] >> y[i] >> c[i];
    }
 
    ll ans = a[x[0]-1]+b[y[0]-1]-c[0];
 
    for(int i=0;i<M;i++){
        ll sum =a[x[i]-1]+b[y[i]-1]-c[i];
        ans = min(ans,sum);
    }
 
    sort(a);
    sort(b);
    ll o = a[0]+b[0];
    ans = min(ans,o);
    cout << ans << endl;
}
    

Measured memory_bytes: 2176
num = []
for _ in range(6):
    num.append(int(input()))
#print(num)
f = 0
for i in range(5):
    if(num[i]-num[0]>num[5]):
        f = 1
for i in range(2,5):
    if(num[i]-num[1]>num[5]):
        f = 1

for i in range(3,5):
    if(num[i]-num[1]>num[5]):
        f = 1

for i in range(4,5):
    if(num[i]-num[1]>num[5]):
        f = 1

if(f == 0):
    print("Yay!")
else:
    print(":(")
"""
num[1]-num[0]
num[2]-num[0]
num[3]-num[0]
num[4]-num[0]

num[2]-num[1]
num[3]-num[1]
num[4]-num[1]

num[3]-num[2]
num[4]-num[2]

num[4]-num[3]
"""


Measured memory_bytes: 3064
n, m, k = [int(t) for t in open(0).read().split()]
mod = 998244353
mem = [0] * max(k + 3, n + 1)
for i in range(k + 2):
    mem[i] = pow(m, i, mod)
c = 1
for i in range(k + 2, n + 1):
    mem[i] = (m * mem[i - 1] - m * c * pow(m - 1, i - k - 2, mod)) % mod
    c = (c * (i - 1) * pow(i - k - 1, - 1, mod)) % mod
print(mem[n])

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

using namespace std;

int main() {
  int N, P;
  string S;
  cin >> N >> P >> S;

  if (P == 2 or P == 5) {
    long long ans = 0;
    for (int i = 1; i <= N; i++) {
      if ((S[i - 1] - '0') % P == 0) {
        ans += i;
      }
    }
    cout << ans << endl;
    return 0;
  }

  int pow_ten[1000005];
  pow_ten[0] = 1;
  for (int i = 1; i < 1000005; i++) {
    pow_ten[i] = (pow_ten[i - 1] * 10) % P;
  }
  vector<int> count_mod(P);
  count_mod[0]++;
  int now = 0;
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    now += (S[N - i] - '0') * pow_ten[i];
    now %= P;
    ans += count_mod[now];
    count_mod[now]++;
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 4484
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

char c;

int main() {
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel";
  } else {
    cout << "consonant";
  }
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using Pt = pair<int, int>;


void ARC098D()
{
	int N;
	cin >> N;
	vi A(N);
	for (auto& x : A)
		cin >> x;

	ll B = 0;
	ll C = 0;
	ll ct = 0;
	int l = 0;
	int r = 0;
	for (; r < N; ++r)
	{
		B += A[r];
		C ^= A[r];
		if (B == C)
		{
			continue;
		}
		while (B != C)
		{
			ct += r - l;
			B -= A[l];
			C ^= A[l];
			++l;
		}
	}
	while (B == C && l < N)
	{
		ct += N - l;
		B -= A[l];
		C ^= A[l];
		++l;
	}
	cout << ct << endl;

}

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

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

int main()
{
    int n;
    cin >> n;
    if (n == 1)
        cout << "Hello World" << endl;
    else
    {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x[100000010];
#define int long long 
signed main(){

   cin.tie(0);
   ios::sync_with_stdio(false);
    
    int a;
    cin>>a;
    double b,c;
    b=a;
    if(a%2==1) a++;
    c=a/2;
    cout<<c/b<<'\n';
}


Measured memory_bytes: 256
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main(){
    int n;
    int a[100002];
    cin >> n;
    a[0] = 0;
    REP(i, n){
        cin >> a[i + 1];
    }
    a[n + 1] = 0;
    int sum = 0;
    REP(i, n + 1){
        sum += abs(a[i] - a[i + 1]);
    }
    int ans = 0;
    rep(i, 1, n + 1){
        ans = sum + abs(a[i - 1] - a[i + 1]) - (abs(a[i - 1] - a[i]) + abs(a[i] - a[i + 1]));
        print(ans);
    }
}

Measured memory_bytes: 1664
#include <stdio.h>

int n;
int a[100000];
int ans[100002];
int max = 0;
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d", &a[i]);
    ans[a[i]-1]++;
    ans[a[i]]++;
    ans[a[i]+1]++;
  }
  for(int i=0;i<=100001;i++){
    if(max<ans[i])
      max=ans[i];
  }
  printf("%d\n", max);
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
    using namespace std;
    template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
    template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
    typedef long long ll;
    typedef vector<int> vint;
    typedef pair<int, int> pint;
    typedef vector<long long> vlong;
    #define _GLIBCXX_DEBUG
    #define vpush(a,x) a.push_back(x);
    #define rep(i, n) REP(i, 0, n)
    #define all(v) v.begin(), v.end()
    #define REP(i, x, n) for(int i = x; i < n; i++)
    #define INF 2e9
    vint dp(100005,-1);
    vector<vector<int> > li(100005);
    int dfs(int now,int count){
    if(dp[now]!=-1){
    return dp[now];
    }
    int si=li[now].size(),nx=0;
    rep(i,si){
    nx=max(nx,dfs(li[now][i],dp[now])+1);
    }
    dp[now]=nx;
    return dp[now];
    }
    signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    int x,y;
    rep(i,m){
    cin>>x>>y;
    li[x].push_back(y);
    }
    int max=-1,a;
    REP(i,1,n+1){
    a=dfs(i,dp[i]);
    if(max<a){
    max=a;
    }
    }
    cout<<max<<'\n';
    return(0);
    }

Measured memory_bytes: 8192
#include<bits/stdc++.h>
#define fs first
#define se second
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef double db;

const int maxn=1e3+5;
const ll inf=0x3f3f3f3f;
const ll mod=1e9+7;

char s[maxn];

int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	printf("%d",(n-1)/(k*2+1)+1);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long f(int n){
	long long s=0;
	for(int i=0;i<n;i++)
		s=s+i;
	return s;
}
int main(){
	int N;
	scanf("%d",&N);
	map<string,int> kk;
	for(int i=0;i<N;i++){
		string t;
		cin >> t;
		sort(t.begin(),t.end());
		kk[t]++;
	}
	long long ans=0;	
	map<string,int>::iterator it;
	for(it=kk.begin();it!=kk.end();it++){
		ans=ans+f(it->second);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 11136
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int[] a= {1,3,5,7,8,10,12},b= {4,6,9,11},c= {2};
		int x=sc.nextInt(),y=sc.nextInt();
		String X="",Y="";
		for(int i=0;i<7;i++) {
			if(x==a[i])X="a";	if(y==a[i])Y="a";
		}
		for(int i=0;i<4;i++) {
			if(x==b[i])X="b";	if(y==b[i])Y="b";
		}
		if(x==c[0])X="c";	if(y==c[0])Y="c";
		System.out.println(X==Y?"Yes":"No");
		sc.close();
	}
}

Measured memory_bytes: 21844
import math

N, M = list(map(int, input().split()))
S = input()
T = input()
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

L = N * M // gcd(N, M)

d = dict()

for i in range(N):
    index = 1 + (L // N) * i
    d[index] = S[i]

for j in range(M):
    index = (1 + (L // M) * j)
    if index in d:
        if d[index] != T[j]:
            print(-1)
            exit()
print(L)


Measured memory_bytes: 15396