akhauriyash/Code-Regression huggingface dataset:
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
using namespace std;
using ll = __int64_t;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(int i=(int)b;i<(int)e;i++)
#define rep0(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
constexpr int inf=(1<<30)-1;
constexpr ll mod=1e9+7;



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


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define endl "\n"
typedef long long LL;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e5 + 5;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif // LOCAL
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (x%2 == 0 && !(x%3 == 0 || x%5 == 0)) {
      return cout << "DENIED" << endl,0;
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,M;
    cin >> N >> M;
    vector<vector<int>>xyz(N,vector<int>(3));
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < 3; j++) {
            cin >> xyz[i][j];
        }
    }
    int ans = 0;
    for(int bit = 0; bit < (1 << 3); bit++) {
        vector<int>cnt;
        for(int i = 0; i < N; i++) {
            int res = 0;
            for(int j = 0; j < 3; j++) {
                if(1 & (bit >> j)) {
                    res+=xyz[i][j];
                }
                else {
                    res+=-xyz[i][j];
                }
            }
            cnt.push_back(res);
        }
        sort(cnt.rbegin(),cnt.rend());
        int sum = 0;
        for(int i = 0; i < M; i++) {
            sum+=cnt[i];
        }
        ans = max(ans,sum);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3700
#include <stdio.h>

int main(void)
{
	int x,i,a[10000],b;
	
	x = 1;
	i = 0;
	
	while(x != 0){
		scanf("%d",&x);
		a[i] = x;
		++i;
	}
	
	for(b = 0;b < i-1;++b){
		printf("Case %d: %d\n",b+1,a[b]);
	}
	
	return(0);
}

Measured memory_bytes: 2648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
vector<int> vs;
vector<vector<int>> g;
void dfs(int now, int pre) {
    vs.push_back(now + 1);
    for (int nxt : g[now]) {
        if (nxt == pre) continue;
        dfs(nxt, now);
    }
    vs.push_back(-(now + 1));
}
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    g.resize(n);
    rep(i, n - 1) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(0, -1);

    vector<ll> dp(200200, LINF);
    vector<ll> idx(n), val(n);
    vector<ll> ans(n);
    for (int now : vs) {
        if (now < 0) {
            now++;
            dp[idx[-now]] = val[-now];
        } else {
            now--;
            idx[now] = lower_bound(all(dp), a[now]) - dp.begin();
            val[now] = *lower_bound(all(dp), a[now]);

            dp[idx[now]] = a[now];
            ans[now] = lower_bound(all(dp), LINF) - dp.begin();
        }
    }
    rep(i,n) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 34892
#include <iostream>
//#include <fstream>
#include <vector>
#include <string>
//#include <cstdlib>
#include <algorithm>
//#include <set>
//#include <conio.h>
using namespace std;

int main(){
	vector<int> w(10);
	vector<int> k(10);
	vector<int> wmax(3);
	vector<int> kmax(3);
	int wsum=0, ksum=0;
	for(int i=0; i<3; ++i){
		wmax[i] = 0;
		kmax[i] = 0;
	}

	for(int i=0; i<10; ++i){
		cin >> w[i];
		if(w[i]>wmax[0]){
			wmax[0] = w[i];
			sort(wmax.begin(),wmax.end());
			continue;
		}
		if(w[i]>wmax[1]){
			wmax[1] = w[i];
			sort(wmax.begin(),wmax.end());
			continue;
		}
		if(w[i]>wmax[2]){
			wmax[2] = w[i];
			sort(wmax.begin(),wmax.end());
			continue;
		}
	}
	for(int i=0; i<10; ++i){
		cin >> k[i];
		if(k[i]>kmax[0]){
			kmax[0] = k[i];
			sort(kmax.begin(),kmax.end());
			continue;
		}
		if(k[i]>kmax[1]){
			kmax[1] = k[i];
			sort(kmax.begin(),kmax.end());
			continue;
		}
		if(k[i]>kmax[2]){
			kmax[2] = k[i];
			sort(kmax.begin(),kmax.end());
			continue;
		}
	}

	for(int i=0; i<3; ++i){
		wsum += wmax[i];
		ksum += kmax[i];
	}

	cout << wsum << " " << ksum << endl;
	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define For(i,a,b) for(long long i=a;i<b;i++)
#define pb push_back
using namespace std;
typedef long long ll;
ll power(ll x,ll y,ll p){
ll res = 1;x = x % p;
while (y > 0){
if (y & 1){res = (res*x) % p;}
y = y>>1;
x = (x*x) % p;}
return res;}
ll mcd(ll a,ll b){
    if(b>a)swap(a,b);
    if(b==0)return a;
    else return mcd(b,a%b);
}
ll t,n,m,k;
bool esprimo(ll n){
ll s=0;
for(ll i=1;i*i<=n;i++){
    if(n%i==0){s++;}}
if(s>=2){return false;}
return true;
}
int main(){
    //    cout<<fixed<<setprecision(2);
//cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
string s;
cin>>s;
if(s[s.size()-1]=='s'){
cout<<s<<"es"<<endl;
}else{
cout<<s<<"s"<<endl;
}
}



Measured memory_bytes: 3396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, d;
    cin >> n >> d;
    cout << (n - 1) / (d + d + 1) + 1;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
A = [int(x) for x in input().split()]
cnt_5 = 0
cnt_7 = 0
for i in A:
    if i == 5:
        cnt_5 += 1
    elif i == 7:
        cnt_7 += 1
if cnt_5 == 2 and cnt_7 == 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::f64::consts::PI;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn func(n: usize) -> bool {
    for i in 1..10 {
        for j in 1..10 {
            if i * j == n {
                return true;
            }
        }
    }
    false
}

fn main() {
    let n: usize = read_line().trim().parse().unwrap();
    if func(n) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	for(int i=0;i<s.size();i++) {
		s[i] = (s[i] - 'A' + n) % 26 + 'A';
	}
	cout << s;
	return 0;
}


Measured memory_bytes: 892
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int; // 多倍長整数（任意精度）


void dfs(int i, const int size, const int range_start, const int range_end, vector<int> &A, int &max, vector<int> a, vector<int> b, vector<int> c, vector<int> d)
{
    if (i == size) {
      // for(int i = 0; i < A.size(); ++i){
      //   cout << A[i] << " ";
      // }
        
      int sum = 0;

      for(int i = 1; i < a.size(); ++i){
        if(A[b[i]-1] - A[a[i]-1] == c[i]){
          sum += d[i];
        }
      }

      if(max < sum){
        max = sum;
      }
    }
    else{
      for(int j = range_start; j <= range_end; ++j){
        A[i] = j;
        dfs(i + 1, size, j, range_end, A, max, a, b, c, d);
      }
    }
}

int main(){
  int N, M, Q;

  cin >> N >> M >> Q;

  vector<int> a(Q+1), b(Q+1), c(Q+1), d(Q+1);

  for(int i = 1; i <= Q; ++i){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }

  vector<int> A(N);
  int max = -1;

  int size = N;
  int range_start = 1;
  int range_end = M;
    
  dfs(0, size, range_start, range_end, A, max, a, b, c, d);
  
  cout << max << endl;

  return 0;
}


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

int main()
{
  int n;
  cin>>n;
  int s[110];
  for (int i = 0; i < n;i++){
    cin >> s[i];
  }
  set<int> count;
  for (int i = 0; i < n;i++){
    count.insert(s[i]);
  }

  cout << count.size() << endl;
}

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

using namespace std;
using ll = long long;

int main() {
    ll n, t;
    cin >> n >> t;

    ll ans = 0, now = 0, end = 0;
    for (ll i = 0; i < n; i++) {
        ll x;
        cin >> x;

        ans += min(end, x) - now;
        now = x;
        end = x + t;
    }

    ans += end - now;
    cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 20
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
using namespace std;
typedef long long LL;
int n,m,ans,p[M];
vector<int> in,in2;
int calc()
{
	if(in.SZ != in2.SZ) return 100000;
	int re=0;
	REP(i,0,(int)in.SZ-1) re += abs(in[i] - in2[i]);
	return re;
}
int main()
{
	int x,pos;
	RI(n,m);
	REP(i,1,n)
	{
		RI(x);
		if(x) in.PB(i);
	}
	REP(i,1,m) RI(p[i]);

	x=0, pos=0;
	REP(i,1,m)
	{
		if(x==1) REP(j,pos+1,pos+p[i]) in2.PB(j);
		x ^= 1;
		pos += p[i];
	}
	ans = calc();

	in2.clear();
	x=1, pos=0;
	REP(i,1,m)
	{
		if(x==1) REP(j,pos+1,pos+p[i]) in2.PB(j);
		x ^= 1;
		pos += p[i];
	}
	ans = min(ans, calc());

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

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    string S;cin >> S;
    int N = S.size();

    deque<char> st;
    rep(i,N){
        if(S[i] == '0')st.push_back('0');
        if(S[i] == '1')st.push_back('1');
        if(S[i] == 'B'){
            if(st.empty()){
                continue;
            }
            else{
                st.pop_back();
            }
        }
    }

    int lim = st.size();
    rep(i,lim){
        cout << st.front();
        st.pop_front();
    }
    cout  << endl;
}

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

int main()
{
    int n;
    cin >> n;
    vector<long double> a(n);

    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    long double x;
    long double y;
    x = accumulate(a.begin(), a.end(), 0);
    y = accumulate(a.begin(), a.end(), 1, [](long double init, long double v) {
        return init * v;
    });

    long double sum = 0;
    for (int j = 0; j < n; j++)
    {
        sum += y / a[j];
    }

    cout << setprecision(15) << y / sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,a,b;cin>>n>>a>>b;
  print(((b-a-1)%2==0)?"Borys":"Alice");
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <unordered_map>
#include <vector>
#include <cstring>

using namespace std;
constexpr int maxn = 1 << 13;
int n, m;
int dp[maxn];
bool vis[maxn];
vector<int> availableSets;

void init() { memset(dp, 0x3f, sizeof(dp)); }

void input() {
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int price, foo, lockSet{};
        cin >> price >> foo;
        for (int j = 0; j < foo; ++j) {
            int bit;
            cin >> bit;
            lockSet |= (1 << (bit - 1));
        }
        dp[lockSet] = min(dp[lockSet], price);
        if (!vis[lockSet])
            availableSets.push_back(lockSet);
        vis[lockSet] = true;
    }
}

int solve() {
    int tot = 1 << n;
    for (auto currSet:availableSets)
        for(int nextSet = 0; nextSet < tot; ++nextSet)
            dp[currSet | nextSet] = min(dp[currSet | nextSet], dp[currSet] + dp[nextSet]);
    int res = dp[(1 << n) - 1];
    return res < 0x3f3f3f3f ? res : -1;
}

int main() {
    //freopen("/home/ngkimbing/Disk_F/CLionProjects/acm/in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    init();
    input();
    cout << solve();
    return 0;
}

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

typedef long long int ll;
typedef long double ld;
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

ll const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 1e9+7;

// code begins here

int main(){
    fast;
    
    ll n, ans=0;
    cin>>n;
    
    for(ll i=1;i<=n;i++){
        ll x = n/i;
        ans += i*(x*(x+1)/2);
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main(){
    double h[10000], max = 0, min = 100000;
    int i = 0;
    
    while(scanf("%lf", &h[i]) != EOF){
        if (h[i] > max) max = h[i];
        if (h[i] < min) min = h[i];
        i++;
    }
    printf("%.1f\n", max - min);
    
    return 0;
}

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

string s;
bool rl[26]={0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0};
bool now;
int cnt;

int main(){
  int i;
  while(1){
    cin >> s;
    if(s=="#")break;
    cnt=0;
    now = rl[s[0]-'a'];
    for(i=1;i<s.size();i++){
      if(now!=rl[s[i]-'a']){
	cnt++;
	now = rl[s[i]-'a'];
      }
    }
    cout << cnt << endl;
  }
  return 0;
}



Measured memory_bytes: 3076
#include <stdio.h>

int main() {
 int t,zero = 0,flag = 0; //zero buat nandain 0 gak,flag buat nandain melebihi gk
 scanf("%d",&t);
 long long int n,max = 1e18,sum = 1;  //sum 1 karena dikali 1 ya satu,max 10^18
 	for(int i=0;i<t;i++){
 		scanf("%lld",&n);
 		n>max ? flag = 1 : flag; //apakah inputan melebihi max ,flag = 1 kalau iya
		 sum *= n;  //sum kalikan dengan n
		 n==0 ? zero = 1 : max /= n;  //apakah n ada yang kalau iya penanda kasih 1 kalau tidak
		 							//max sekarang menjadi max dibagi n tadi supaya max jadi n tersebut agar tar overflow
	 }
	 if(zero ==1){  //kalau o print 0
	 	puts("0");
	 }
	 else{
	 	flag==1 ? puts("-1") : printf("%lld\n",sum);  //kalau input melebhi max maka -1
	 }

  return 0;
}

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

#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false);
	ll q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;
	q = q * 4;
	h = h * 2;

	ll minValue = s;
	if (h < s) minValue = h;
	if (q < minValue) minValue = q;

	if (d < minValue * 2) {
		ll val = (n / 2) * d + (n % 2) * minValue;
		cout << val << endl;
	} else {
		cout << minValue * n << endl;
	}

	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
#define _GLIBCXX_DEBUG

using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    int x;
    cin >> x;
    cout << (x == 1 ? 0 : 1) << endl;
}

Measured memory_bytes: 3548
import heapq #今回は優先度キューを使う

N, M = map(int, input().split())

A = list(map(lambda x:-int(x), input().split())) #優先度付きキューは最小値しか出せないので、×-1して最大値を最小値にしている
#A.sort() 今回は間に合わない
heapq.heapify(A) #優先度付きキューに変換
#print(A)

for _ in range(M):
    a = heapq.heappop(A) #最小値取得
    a = -a // 2 #負のまま計算すると切り捨てが違うところで起こる
    heapq.heappush(A,-a) #優先度付きキューに挿入

print(-sum(A))


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x; cin>>x;
	cout << x*x*x << "\n";
	return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

auto fl = [](auto a, auto b) { assert(b != 0); return a / b - (a % b != 0 && ((a >= 0) != (b >= 0)) ? 1 : 0); };
auto ce = [](auto a, auto b) { assert(b != 0); return a / b + (a % b != 0 && ((a >= 0) == (b >= 0)) ? 1 : 0); };
auto mo = [](auto a, auto b) { assert(b != 0); a %= b; if(a < 0) { a += abs(b); } return a; };

int main() {
	IN(int, n);
	vector<LL> a(n), b(n);
	cin >> a >> b;
	
	LL ans = 0;
	queue<int> q;
	
	auto f = [&](int i) {
		int l = mo(i - 1, n);
		int r = mo(i + 1, n);
		if(a[i] <= b[i] - b[l] - b[r]) { q.push(i); }
	};
	
	auto g = [&](int i) {
		int l = mo(i - 1, n);
		int r = mo(i + 1, n);
		LL s = b[l] + b[r];
		if_not(a[i] <= b[i] - s) { return; }
		
		LL c = min(fl(b[i] - a[i], s), ce(b[i] - max(b[l], b[r]), s));
		assert(c > 0);
		b[i] -= c * s;
		ans += c;
		f(l);
		f(r);
	};
	
	inc(i, n) { f(i); }
	until(q.empty()) {
		auto i = q.front(); q.pop();
		g(i);
	}
	
	OUT(a == b ? ans : -1);
}


Measured memory_bytes: 3840
n=int(input())
nums=list(map(int,input().split()))
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        if nums[j]!=nums[i]:
            for k in range(j+1,n):
                if nums[j]!=nums[k] and nums[k]!=nums[i]:
                    total=nums[i]+nums[j]+nums[k]
                    if total-max(nums[i],nums[j],nums[k])>max(nums[i],nums[j],nums[k]):
                        ans+=1
                        
print(ans)

Measured memory_bytes: 68448
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc144/abc144_d.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 180) * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  double a, b, x;
  cin >> a >> b >> x;

  double th = 0;
  if (b * pow(a, 2) / 2 < x) {
    th = atan(2 * (b - x / pow(a, 2)) / a);
  } else {
    th = atan(pow(b, 2) * a / (2 * x));
  }

  printf("%.9lf", rad_to_deg(th));
}

Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	string s;
	cin>>s;
	if(s[1]==s[2] && (s[0]==s[1] || s[2]==s[3])) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
//Tue Dec 22 22:01:34 JST 2009
#include<set>
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define mp make_pair
int dx[]={0,1,1,0,-1,-1};
int dy[]={-1,-1,0,1,1,0};
#define CONNECT true
#define UNCONNECT false
#define CANMOVE true
#define CANNOTMOVE false

class state{
public:
  int len;
  int x[8],y[8];
  int cnt;
  int path[8];
  bool is_connected(int me,int you){
    if ( x[me]==x[you]){
      if ( y[me]-1 == y[you] || y[me]+1 == y[you] || y[me]==y[you])return CONNECT;
    }else if ( x[me]+1 == x[you]){
      if (y[me] ==y[you] || y[me]-1==y[you])return CONNECT;
    }else if ( x[me]-1==x[you]){
      if (y[me] ==y[you] || y[me]+1 == y[you])return CONNECT;
    }

    return UNCONNECT;
  }

  bool can_good_pos(int cur){
    rep(i,cur-1){
      if ( is_connected(cur,i)==CONNECT)return false;//©ªÌOÈOÌâÂÆÂÈªÁÄ¢éÌÅ¾ßB
    }
    if (cur==0 ||  is_connected(cur,cur-1)==CONNECT)return true;//©ªÆOÌâÂÆÂÈªÁÄ¢éÌÅ¨
    return false;
  }
  
  void make_next(int now,queue<state>&Q,set<state>&S,bool flag,set<pair<int,int> > & NG){
    if ( now == len){
      if ( S.find((*this))==S.end()){
	cnt++;
	S.insert(*this);
	Q.push(*this);
	cnt--;
      }
      return;
    }

    //don't move
    
    if (can_good_pos(now) ){
      path[now]=-1;
      make_next(now+1,Q,S,CANMOVE,NG);
    }

    if ( flag == CANNOTMOVE)return;//OÌª®¢Ä½ç©ªÍ®¯È¢

    rep(i,6){
      x[now]+=dx[i];
      y[now]+=dy[i];

      path[now]=i;

      if (NG.find(mp(x[now],y[now])) == NG.end() && can_good_pos(now)){
	make_next(now+1,Q,S,CANNOTMOVE,NG);//©ªª®¢½çÌÍ®¯È¢B
      }
      x[now]-=dx[i];
      y[now]-=dy[i];
    }
        
  }
  
  bool operator<(const state & a)const{
    rep(i,len){
      if ( x[i]!=a.x[i])return x[i]<a.x[i];
      if ( y[i]!=a.y[i])return y[i]<a.y[i];
    }
    return false;
  }
  
};



int bfs(state ini,int dx,int dy,set<pair<int,int> > &NG){
  queue<state> Q;
  set<state> S;
  Q.push(ini);
  S.insert(ini);
  while(!Q.empty()){
    state now = Q.front();
    Q.pop();
    if (  (max(now.x[0],dx)-min(now.x[0],dx))/2+max(now.y[0],dy)-min(now.y[0],dy)+now.cnt>20)continue;
    if ( now.x[0]==dx && now.y[0]==dy){
      return now.cnt;
    }
    now.make_next(0,Q,S,CANMOVE,NG);
  }
  return -1;
}


main(){
  int n,m,dx,dy;
  while(cin>>n && n){
    state ini;
    set<pair<int,int> > NG;
    
    ini.len=n;
    ini.cnt=0;
    rep(i,n)cin>>ini.x[i]>>ini.y[i];
    cin>>m;
    rep(i,m){
      int f,s;
      cin>>f>>s;
      NG.insert(mp(f,s));
    }
    cin>>dx>>dy;
    cout << bfs(ini,dx,dy,NG)<<endl;
  }
  return false;
}

Measured memory_bytes: 11000
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	long long a,d,e;
	int b,c;
	scanf("%lld%d%d%lld%lld",&a,&b,&c,&d,&e);
	long long ret=-1;
	for(int i=0;i<100;i++){
		for(int j=0;j<100;j++){
			if(a<((d+i)*100+b-1)/b+((e+j)*100+c-1)/c)continue;
			ret=max(ret,a-((d+i)*100+b-1)/b-((e+j)*100+c-1)/c+i*100/b+j*100/c);
		}
	}
	printf("%lld\n",ret);
}

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

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

  int ret_total,ret_suger;
  long double max_conce = -1;
  for(int i=0;i<=30;i++){
    for(int j=0;j<=30;j++){
      for(int k=0;k<=100;k++){
        for(int l=0;l<=100;l++){
          long double total = 100*a*i + 100*b*j + c*k + d*l;
          long double total_water = 100*a*i + 100*b*j;
          long double total_suger = c*k + d*l;
          if(total <= f && total_water > 0){
            long double temp = 100*total_suger/total_water;
            if(temp <= e){
              if(temp > max_conce){
                max_conce = temp;
                ret_total = 100*a*i + 100*b*j + c*k + d*l;
                ret_suger = c*k + d*l;
              }
            }
          }
        }
      }
    }
  }
  cout << ret_total << " " << ret_suger << endl;
}


Measured memory_bytes: 256
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a>b:
  if a-v*t<=b-t*w:
    print('YES')
  else:
    print('NO')
elif a<b:
  if a+v*t>=b+w*t:
    print('YES')
  else:
    print('NO')

Measured memory_bytes: 9184
from math import gcd
N = int(input())
A = list(map(int,input().split()))

g = 0
for a in A:
    g = gcd(g,a)
if g > 1:
    print('not coprime')
    exit()

MAXN = 10**6+10
sieve = [i for i in range(MAXN+1)]
p = 2
while p*p <= MAXN:
    if sieve[p] == p:
        for q in range(2*p,MAXN+1,p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1

st = set()
for a in A:
    tmp = set()
    while a > 1:
        tmp.add(sieve[a])
        a //= sieve[a]
    for p in tmp:
        if p in st:
            print('setwise coprime')
            exit()
        st.add(p)
print('pairwise coprime')

Measured memory_bytes: 132032
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		for(int i = 1; i <= 5; i++) {
			int x = fs.nextInt();
			if(x == 0) {
				System.out.println(i);
				return;
			}
		}
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


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

typedef long long lli;

const lli MAXN = 12;
const lli ten[9] = {1,10,100,1000,10000,100000,1000000,10000000,100000000};
lli N, ans;
string S[MAXN];
lli num[128], mini[MAXN], maxi[MAXN];

void rec(lli i, lli j, lli sum, lli used) {
  if(j == S[i].size()) ++i, j = 0;
  if(i == N) {
    ans += !sum;
    return;
  }
  if(sum < 0) return;
  if(i && !j) {
    lli low = 0, high = 0;
    for(lli k = i; k < N; ++k) {
      low += mini[k];
      high += maxi[k];
    }
    if(sum - low < 0) return;
    if(sum - high > 0) return;
  }
  if(num[S[i][j]] == -1) {
    for(lli d = S[i].size()-1 && !j; d < 10; ++d) {
      if(used >> d & 1) continue;
      num[S[i][j]] = d;
      lli nsum = sum;
      if(i) nsum -= ten[S[i].size()-j-1] * d;
      else  nsum += ten[S[i].size()-j-1] * d;
      rec(i, j+1, nsum, used | (1<<d));
    }
    num[S[i][j]] = -1;
  } else {
    lli d = num[S[i][j]];
    lli nsum = sum;
    if(S[i].size()-1 && !j && !d) return;
    if(i) nsum -= ten[S[i].size()-j-1] * d;
    else  nsum += ten[S[i].size()-j-1] * d;
    rec(i, j+1, nsum, used);
  }
}

struct LT {
  bool operator () (const string &a, const string &b) const {
    return ( a.size() != b.size() ? a.size() > b.size() : a > b );
  }
};

int main() {
  while(cin >> N && N) {
    for(lli i = 0; i < N; ++i) cin >> S[i];
    swap(S[0], S[N-1]);
    sort(S+1, S+N, LT());
    for(lli i = 0; i < N; ++i) {
      map<char, lli> d;
      maxi[i] = 0;
      for(lli j = 0, used = 0; j < S[i].size(); ++j) {
        if(!d.count(S[i][j])) {
          for(lli k = 9; k >= (S[i].size()-1 && !j); --k) {
            if(used >> k & 1) continue;
            used |= 1 << k;
            d[S[i][j]] = k;
            break;
          }
        }
        maxi[i] = maxi[i] * 10 + d[S[i][j]];
      }
    }

    for(lli i = 0; i < N; ++i) {
      map<char, lli> d;
      mini[i] = 0;
      for(lli j = 0, used = 0; j < S[i].size(); ++j) {
        if(!d.count(S[i][j])) {
          for(lli k = S[i].size()-1 && !j; k < 10; ++k) {
            if(used >> k & 1) continue;
            used |= 1 << k;
            d[S[i][j]] = k;
            break;
          }
        }
        mini[i] = mini[i] * 10 + d[S[i][j]];
      }
    }

    ans = 0;
    memset(num, -1, sizeof(num));
    rec(0, 0, 0, 0);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((int64_t *)a) < *((int64_t *)b) ? -1 : 1;
}

int compare_f2(const void *a, const void *b) {
	return *((uint64_t *)a) > *((uint64_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

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

	return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
	uint64_t result = 1;

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

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

int main(void) {
	size_t N, T[100];
	size_t M;

	size_t total = 0;

	scanf("%zu\n", &N);
	for (size_t i = 0; i < N; i++) {
		scanf("%zu", &(T[i]));
		scanf(i == N - 1 ? " " : "\n");

		total += T[i];
	}
	scanf("%zu\n", &M);
	for (size_t i = 0; i < M; i++) {
		size_t P, X;
		scanf("%zu %zu", &P, &X);
		if (i < M - 1) {
			scanf("\n");
		}

		printf("%zu\n", total - T[P - 1] + X);
	}

	return 0;
}

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

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()

const double eps=1e-5;
const long long INF=(LL)(1e9)*(LL)(1e9);



int main()
{
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    LL n,m;
    cin>>n>>m;
    vector<vector<int>> g(n);
    REP(i,m)
    {
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> r(n,-1);
    function<bool(int,int)> dfs=[&](int v,int b)
    {
        if(r[v]!=-1)
        {
            if(r[v]==b) return true;
            else return false;
        }
        r[v]=b;
        bool f=1;
        for(auto&& e:g[v])
        {
            f&=dfs(e,1-b);
        }
        return f;
    };
    if(dfs(0,0))
    {
        LL cnt=0;
        REP(i,n)
            if(r[i]==1)
                cnt++;
        cout<<cnt*(n-cnt)-m<<endl;
    }
    else
    {
        cout<<n*(n-1)/2-m<<endl;
    }
}

Measured memory_bytes: 7040
def gcd(a,b):
 while b!=0:
   a,b=b,a%b
 return a


n = int(input())
l = list(map(int,input().split()))
l.sort()

tmp = gcd(l[0],l[1])
for i in range(2,len(l)):
    tmp = gcd(tmp,l[i])

print(tmp)

Measured memory_bytes: 20044
#include <bits/stdc++.h>
using namespace std;
string x, y;
int ma = 0;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> x >> y;
    for(int i = 0; i < (int)y.length(); i++){
        for(int j = 0; j < (int)x.length(); j++){
                if(x[j] == y[i] && (int)x.length() - j >= (int)y.length() - i && j >= i){
                    int ans = 1, t1 = j, t2 = i;
                    while(t1 + 1 < (int)x.length() && t2 + 1 < (int)y.length()) if(x[++t1] == y[++t2]) ans++;
                    ma = max(ma, ans);
                }
        }
    }
    cout << y.length() - ma;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 1e5 + 5;

int X,Y,A,B,C;
ll a[N],b[N],c[N],d[3*N];
// bool vis[N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>X>>Y>>A>>B>>C;
	for(int i=1;i<=A;i++) cin>>a[i];
	for(int i=1;i<=B;i++) cin>>b[i];
	for(int i=1;i<=C;i++) cin>>c[i];
	sort(a+1,a+1+A,greater<ll>());
	sort(b+1,b+1+B,greater<ll>());
	sort(c+1,c+1+C,greater<ll>());
	for(int i=1;i<=X;i++){
		d[i]=a[i];
	}
	for(int i=1;i<=Y;i++){
		d[X+i]=b[i];
	}
	for(int i=1;i<=C;i++){
		d[X+Y+i]=c[i];
	}
	sort(d+1,d+1+A+B+C,greater<ll>());
	ll res=0;
	for(int i=1;i<=X+Y;i++){
		res+=d[i];
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 4992
<?php
  list($s) = explode(" ", trim(fgets(STDIN)));

  $n=strlen($s);
  for($i=2;$i<$n;$i=$i+2){
    $x=$n-$i;
    $a=substr($s,0,$x/2);
    $b=substr($s,$x/2,$x/2);
    //echo $a." ".$b.PHP_EOL;
    if($a==$b){
      echo strlen($a)*2;
      exit;
    }
  }
  


Measured memory_bytes: 16152
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define int long long
#define gc getchar()
#define mp make_pair
#define ri register int
#define rc register char
#define rb register bool
#define lowbit(x) (x&(-x))
#define rp(i,x,y) for(ri i=x;i<=y;++i)
#define my(i,x,y) for(ri i=x;i>=y;--i)

const int N=1e5+10;
int A,B,as=1,d;

il int read()
{
    rc ch=gc;ri x=0;rb y=1;
    while(ch!='-' && (ch>'9' || ch<'0'))ch=gc;
    if(ch=='-')ch=gc,y=0;
    while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=gc;
    return y?x:-x;
}
int gcd(ri x,ri y){return y?gcd(y,x%y):x;}

signed main()
{
	//freopen("D.in","r",stdin);freopen("D.out","w",stdout);
	A=read();B=read();d=gcd(A,B);for(ri i=2;i*i<=d;++i){if(!(d%i))++as;while(!(d%i))d/=i;}if(d!=1)++as;
	printf("%lld\n",as);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std; typedef long long ll; const int INF=1e9; typedef pair<ll,ll> P;

int main() {
  int n; cin>>n;
  string s[n];
  int v[n][30]; fill(v[0],v[n],0);
  for(int i=0;i<n;i++) cin>>s[i];

  for(int i=0;i<n;i++) {
    for(char ch:s[i]) {
      v[i][ch-'a']++;
    }
  }

  int an[30]; fill(an,an+26,1e9);
  for(int i=0;i<n;i++) {
    for(int j=0;j<26;j++) {
      an[j] = min(an[j], v[i][j]);
    }
    //for(int i=0;i<26;i++) cout<<an[i]<<" "; cout<<endl;
  }
  for(int i=0;i<26;i++) {
    for(int j=0;j<an[i];j++) {
      cout<<(char)('a'+i);
    }
  } cout<<endl;
}


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

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define fo(a,b) for(int o=a;o<b;++o)
#define fdi(a,b) for(int i=a-1;i>=b;--i)
#define fdj(a,b) for(int j=a-1;j>=b;--j)
#define fdo(a,b) for(int o=a-1;o>=b;--o)
#define pb push_back
#define mp make_pair
typedef unsigned int ui;
typedef long long ll;
/////////////////////

int n, m;
ll ans;

void solve(){
	ll q = (1 << m);
	ll a = 100 * (n - m) + 1900 * m;
	ans = a * q;
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

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

	solve();

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

	return 0;
}

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

int main(void)
{
  int x, y;
  int temp;
  while(1){
    cin >> x >> y;
    if(x == 0 && y == 0){ break ;}
    if(x > y){
      temp = x;
      x = y;
      y = temp;
    }
    cout << x << " " << y << endl;
  }
  
  return 0;
}

Measured memory_bytes: 2992
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <string>
#include <set>
#include <queue>
using namespace std;
#define mem(a,n) memset(a,n,sizeof(a))
#define pb(x) push_back(x)
typedef long long LL;
typedef unsigned long long ull;
const int mod=1e9+7;
const double eps=1e-6;
const int INF=0x3f3f3f3f;
const int N=2e4+5;
string str;
int main()
{
    while(cin>>str)
    {
        for(int i=0;i<str.length();i++)
            if(i%2==0)
            putchar(str[i]);
        puts("");
    }
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head
 
void swap(int* a, int* b){
    int t = *a;
    *a = *b;
    *b = t;
}

void solve(){
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    int c = 0;
    bool flag = true;
    for (int i = 0; i < n; i++){
        if (p[i] != i+1){
            if (p[p[i]-1] != i+1 || c == 1){
                flag = false;
                break;
            }
            else{
                c = 1;
                swap(&p[i], &p[p[i]-1]);
            }
        }
    }
    if (flag) cout << "YES\n";
    else cout << "NO\n";
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}


Measured memory_bytes: 3596
//AtCoder Beginner Contest160-B問題 リベンジ！
#include<stdio.h>
int main(void){
  int x;
  scanf("%d",&x);
  int c500=x/500;
  int r500=x%500;
  int c5=r500/5;
  int ans=c500*1000+c5*5;
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define inlld(x) scanf("%lld", &x)
#define ind(x) scanf("%d", &x)
#define inlld2(x, y) scanf("%lld%lld", &x, &y)
#define inlld3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define ind2(x, y) scanf("%d%d", &x, &y)
#define ind3(x, y, z) scanf("%d%d%d", &x, &y, &z)

const int N=1e5+5;
const int MOD=1e9+7;

typedef long long ll;
typedef long double ld;

using namespace std;

int n, m, dp[N];
vector<int>adj[N];

void dfs(int u)
{
    if(dp[u]!=-1)
        return;
    dp[u]=0;
    for(auto v:adj[u])
    {
        dfs(v);
        dp[u]=max(dp[u], 1+dp[v]);
    }
}

int main()
{
    ind2(n, m);
    while(m--)
    {
        int u, v;
        ind2(u, v);
        adj[u].pb(v);
    }
    memset(dp, -1, sizeof(dp));
    int ans=0;
    for(int a=1; a<=n; a++)
    {
        if(dp[a]==-1)
            dfs(a);
        ans=max(dp[a], ans);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 8192
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{

    class Program
    {
        private const long COMDIV = 1000000007;

        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            int ret = 0;
            for (long a = 1; a <= 1000000; a++)
            {
                for (long b = a; b <= 1000000; b++)
                {
                    var c = N - a * b;
                    if (c > 0)
                    {
                        if (a == b)
                        {
                            ret++;
                        }
                        else
                        {
                            ret+=2;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }

            Console.WriteLine(ret);
        }
    }
}

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

int main(void)
{
    int a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    for(int i = a; i <= b ; i++)
    {
        if(c % i == 0)ans++;
    }
    cout << ans << endl;
    
    return 0;
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
ll MOD = ll(1e8) + 9;

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    ll N, K;
    cin >> N >> K;

    int ans = 0;
    while (N != 0) {
        ans++;
        N /= K;
    }
    cout << ans << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256