akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
    int X,count;
    cin>>X;
    if(X==2){
        cout<<2<<endl;
    }
    else{
        while(1){
            if(X%2==0){
                X++;
            }
            count=0;
            for (int i = 3; i < X; i+=2){
                if (X % i == 0){
                    count++;
                    break;
                }
            }
            if(count==0){
                cout<<X<<endl;
                break;
            }
            X++;
        }
    }
}


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

#define INFTY (1 << 30);
typedef long long ll;

int main(void) {
  int a[5];
  int k;
  for (int i = 0; i < 5; i++){
    cin >> a[i];
  }

  cin >> k;

  for (int i = 0; i < 5; i++){
    for (int j = i; j < 5; j++){
      if ((a[j] - a[i]) > k) {
        cout << ":(" << endl;
        return 0;
      }
    }
  }
  
  cout << "Yay!" << endl;
  return 0;
}


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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

void answer(vector<ll> &A){
    ll sum = 0;
    for(ll a : A){
        sum += a;
    }
    p(sum);
    exit(0);
}

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

    // input
    ll N, M;
    cin >> N >> M;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A[i];
    }
    sort(ALL(A));
    // vprint(A);

    vector<pair<ll, ll> > P;
    FOR(i, 0, M){
        ll b, c; 
        cin >> b >> c;
        P.push_back(make_pair(c, b));
    }
    sort(ALL(P), greater<pair<ll, ll> >());
    // pn(P.size());

    // 左から変えていく
    ll index = 0;
    for(auto p : P){
        // p2(p.first, p.second);
        ll value = p.first;
        ll count = p.second;

        FOR(i, 0, count){
            chmax(A[index], value);
            index++;
            if(index==N){
                answer(A);
            }
        }
        // vprint(A);
    }

    answer(A);
    
    return 0;
}

Measured memory_bytes: 3188
#include<cstdio>
#include<iostream>
#define LL long long
using namespace std;
LL a,b,ans=1,clu;
LL gcd(LL x,LL y)
{
	return y==0? x:gcd(y,x%y);
}
int main()
{
	scanf("%lld%lld",&a,&b);
	LL Mx=gcd(a,b);
	clu=Mx;
	for(LL i=2;i*i<=clu;i++)
	{
		if(Mx%i==0) ans++;
		while(Mx%i==0) Mx/=i;
		if(Mx==1) break;
	}
	if(Mx!=1) ans++;
	printf("%lld\n",ans);
	return 0;
}

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

long long N;
long long A, B;
long long h[100005];


bool beat(long long num) {
	long long cur = 0;

	for (long long i = 0; i < N; i++) {
		long long rest;
		rest = h[i] - num * B;
		if (rest > 0) {
			if ((rest % (A - B)) == 0) {
				cur += rest / (A - B);
			}
			else {
				cur += rest / (A - B);
				cur++;
			}
		}
	}
	return num >= cur;
}

int main() {
	cin >> N >> A >> B;
	for (long long i = 0; i < N; i++) {
		cin >> h[i];
	}

	long long l = 0;
	long long r = 1000000000;
	long long ans = INT32_MAX;
	while (l <= r) {
		long long m = (l + r) / 2;
		if (beat(m)) {
			r = m - 1;
			ans = min(ans, m);
		}
		else {
			l = m + 1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using ll = long long;

std::vector<ll> bsize(1);
std::vector<ll> npatty(1);

ll calc(ll n, ll x)
{
    if (x <= n) return 0;
    if (n == 0) return 1;
    if (x == bsize[n]) return npatty[n];

    ll center = (bsize[n] + 1) / 2;
    if (x == center) return npatty[n - 1] + 1;
    if (x < center) return calc(n - 1, x - 1);
    return npatty[n - 1] + 1 + calc(n - 1, x - bsize[n - 1] - 2);
}

int main()
{
    ll n, x;
    std::cin >> n >> x;
    bsize[0] = 1;
    npatty[0] = 1;
    for (int i = 1; i <= n; i++) {
        bsize.push_back(2 * bsize[i-1] + 3);
        npatty.push_back(2 * npatty[i-1] + 1);
    }
    std::cout << calc(n, x);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=2e5+1000;
ll t,k,n,a[maxn];
bool yes(ll mid){
    ll cnt=0;
    for(int i=0;i<n;i++){
        if(a[i]>=mid){
            cnt+=ceil(1.0*a[i]/mid)-1;
        }
    }
    if(cnt<=k) return 0;
    else return 1;
}
int main(){
    //freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n>>k;
    ll maxi=-1;
    for(int i=0;i<n;i++){
        cin>>a[i];
        maxi=max(maxi,a[i]);
    }
    ll r=1e9+10,l=1;
    while(l<=r){
        ll mid=(r+l)>>1;
        if(yes(mid)){
            l=mid+1;
        }else r=mid-1;
    }cout<<l<<endl;
    return 0;
}


Measured memory_bytes: 5180
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn =1e5+10;
const int mod=1e9+7;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int d,t,s;
    cin>>d>>t>>s;
    double a=d/(double)s;
    if(a<=t)
        cout<<"Yes"<<'\n';
    else
        cout<<"No"<<'\n';






}


Measured memory_bytes: 3644
//#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
//#include <cstdio>
//#include <cstdlib>
//#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <queue>
#include <set>
using namespace std;

int main(void){

	int a, b;
	// char ;

	//cin >> W >> H >> x >> y >> r;
	
	while(true){
		cin >> a >> b;
		if(a == 0 && b == 0) break;
		if(a > b) cout << b <<" " << a<<endl;
		else cout << a<<" " << b <<endl;
	}
	

	return 0;
}

/*
for(i=0;i<N;i++){
	cin >> X[i];
}


for(i=0;i<N;i++){
	for(j=0;j<N;j++){
		cin >> X[i][j];
	}
}
*/

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
	long long n,ans=0;
	string s;
	cin>>n>>s;;
	vector<int>b(n),g(n),r(n);
	//b
	if(s[0]=='B')b[0]++;
	for(int k=1;k<n;k++){
	    if(s[k]=='B')b[k]=b[k-1]+1;
	    else b[k]=b[k-1];
	}
	rep(i,n)rep(j,n)if(((s[i]=='R'&&s[j]=='G')||(s[i]=='G'&&s[j]=='R'))&&i<j){
	    ans+=(b[n-1]-b[j]);
	    if(j*2-i<n)if(s[j*2-i]=='B')ans--;
	}
	
	if(s[0]=='G')g[0]++;
	for(int k=1;k<n;k++){
	    if(s[k]=='G')g[k]=g[k-1]+1;
	    else g[k]=g[k-1];
	}
	rep(i,n)rep(j,n)if(((s[i]=='R'&&s[j]=='B')||(s[i]=='B'&&s[j]=='R'))&&i<j){
	    ans+=(g[n-1]-g[j]);
	    if(j*2-i<n)if(s[j*2-i]=='G')ans--;
	}
	
	if(s[0]=='R')r[0]++;
	for(int k=1;k<n;k++){
	    if(s[k]=='R')r[k]=r[k-1]+1;
	    else r[k]=r[k-1];
	}
	rep(i,n)rep(j,n)if(((s[i]=='B'&&s[j]=='G')||(s[i]=='G'&&s[j]=='B'))&&i<j){
	    ans+=(r[n-1]-r[j]);
	    if(j*2-i<n)if(s[j*2-i]=='R')ans--;
	}
	
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3656
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let (n, d) = {
        let line = get_input();
        let mut split = line.split_whitespace();
        let n: usize = split.next().unwrap().parse().unwrap();
        let d: usize = split.next().unwrap().parse().unwrap();
        (n, d)
    };

    let mut x:Vec<Vec<i32>> = Vec::new();

    for _ in 0..n {
        let mut xn:Vec<i32> = Vec::new();
        let line = get_input();
        let mut split = line.split_whitespace();
        for _ in 0..d {
            let xnd:i32 = split.next().unwrap().parse().unwrap();
            xn.push(xnd);
        }
        x.push(xn);
    }

    let mut ans = 0;
    for i in 0..x.len()-1 {
        for j in i+1..x.len() {
            let mut total = 0;
            for yz in 0..d {
                let s = x[i][yz] - x[j][yz];
                total += s * s;
            }
            let dis = (total as f32).sqrt() as i32;
            if total == dis * dis {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>

using namespace std;

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

    int p[n];

    for (int i = 0; i < n; i++) cin >> p[i];

    int ans = 0;

    for (int i = 1; i < n - 1; i++)
        if ((p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1]))
            ans++;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

int N, A, C[3], MOD = 1e9 + 7;
int64_t ans = 1;

int main() {
    cin >> N;
    rep(i, N) {
        cin >> A;
        int cnt = 0, id = -1;
        rep(j, 3) {
            if (C[j] == A) {
                cnt++;
                id = j;
            }
        }
        ans *= cnt;
        ans %= MOD;
        C[id]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

int main() {
    #ifdef LOCAL
    assert(freopen("a.in", "r", stdin));
    #else
    #endif
    string s;
    cin >> s;
    cout << s.substr(0, 4) + " " + s.substr(4) << '\n';
}

Measured memory_bytes: 764
using LIB;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    public static IO IO = new IO();
    static void Main(string[] args)
    {
        int n = IO.INT();
        LinkedList<string> l = new LinkedList<string>();
        for (int i = 0; i < n; i++)
        {
            string[] b = IO.STRING().Split(' ');
            switch (b[0])
            {
                case "insert":
                    l.AddFirst(b[1]);
                    break;
                case "delete":
                    l.Remove(b[1]);
                    break;
                case "deleteFirst":
                    l.RemoveFirst();
                    break;
                case "deleteLast":
                    l.RemoveLast();
                    break;
            }
        }
        IO.WRITE(string.Join(" ", l.ToArray()));
        IO.FLUSH();
    }
}

namespace LIB
{
    public class IO
    {
        private const int WMAX = 1000;
        private StringBuilder S = new StringBuilder();
        private T R<T>(Func<string, T> f) { return f(Console.ReadLine()); }
        private T[] R<T>(Func<string, T> f, char c) { return STRING().Split(c).Select(f).ToArray(); }
        private T[] R<T>(Func<string, T> f, int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = R(f); } return r; }
        private T[][] R<T>(Func<string, T> f, int l, char c) { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = R<T>(f, c); } return r; }
        private void W<T>(Func<T, string> f, T v, bool lf = true) { S.Append(f(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { FLUSH(); } }
        public string STRING() { return R(s => s); }
        public string[] STRING(char c) { return R(s => s, c); }
        public string[] STRING(int l) { return R(s => s, l); }
        public string[][] STRING(int l, char c) { return R(s => s, l, c); }
        public int INT() { return R(int.Parse); }
        public int[] INT(char c) { return R(int.Parse, c); }
        public int[] INT(int l) { return R(int.Parse, l); }
        public int[][] INT(int l, char c) { return R(int.Parse, l, c); }
        public long LONG() { return R(long.Parse); }
        public long[] LONG(char c) { return R(long.Parse, c); }
        public long[] LONG(int l) { return R(long.Parse, l); }
        public long[][] LONG(int l, char c) { return R(long.Parse, l, c); }
        public double DOUBLE() { return R(double.Parse); }
        public double[] DOUBLE(char c) { return R(double.Parse, c); }
        public double[] DOUBLE(int l) { return R(double.Parse, l); }
        public double[][] DOUBLE(int l, char c) { return R(double.Parse, l, c); }
        public void WRITE(string s, bool lf = true) { W(v => v, s, lf); }
        public void WRITE(int s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void WRITE(long s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void WRITE(double s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void FLUSH() { Console.Write(S); S.Length = 0; }
    }
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll N = 1e6 + 10, MOD = 1e9 + 7;
ll inv[N], fac[N], inv_fac[N];

void precalc() {
	inv[1] = 1;
	FOR(n,2,N) inv[n] = (MOD - (MOD/n)*inv[MOD%n] % MOD) % MOD;

	fac[0] = 1;
	FOR(n,1,N) fac[n] = n*fac[n-1] % MOD;

	inv_fac[0] = 1;
	FOR(n,1,N) inv_fac[n] = inv[n]*inv_fac[n-1] % MOD;
}

ll binom(ll n, ll k) {
	if (k < 0 || k > n) return 0;
	return fac[n] * inv_fac[k] % MOD * inv_fac[n-k] % MOD;
}

ll ways(ll dx, ll dy) {
	return binom(dx+dy,dx);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	precalc();
	
	ll h, w, n;
	cin >> h >> w >> n;

	vector<pll> a(n+1);
	FOR(i,0,n) cin >> a[i].xx >> a[i].yy;
	a[n] = {h,w};
	sort(all(a));
	
	vl dp(n+1);
	FOR(i,0,n+1) {
		dp[i] = ways(a[i].xx-1,a[i].yy-1);
		FOR(j,0,i) dp[i] = (dp[i] - dp[j]*ways(a[i].xx-a[j].xx, a[i].yy-a[j].yy)) % MOD;
		if (dp[i] < 0) dp[i] += MOD;
	}
	cout << dp[n] << endl;
}



Measured memory_bytes: 23808
#include <iostream>
using namespace std;
const int INF = 1000000000;

int main() {
    int A, B, C, X, Y; cin >> A >> B >> C >> X >> Y;
    int ans = INF;
    for (int i = 0; i <= 100000; i++) {
        int cost = (2 * C * i) + max(0, X-i) * A + max(0, Y-i) * B;
        ans = min(ans, cost); 
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
using namespace std;
typedef long long  ll;

/** Problem1147 : ICPC Score Totalizer Software **/
int main()
{
	int N;
	vector<int> s;
	
	while (cin>>N, N) {
		int sum=0;
		s.clear();
		rep(i, N) {
			int n;
			cin >> n;
			s.push_back(n);
			sum+=n;
		}
		
		int m = *min_element(s.begin(), s.end());
		int M = *max_element(s.begin(), s.end());
		
		sum -= m; sum -= M;
		
		cout << sum/(N-2) << endl;
		
	}
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

int main()
{
    

    ll x;
    cin>>x;
    ll ans=(x/500)*1000;
    x=x%500;
    ans+=(x/5)*5;
    cout<<ans;
    
    return 0;
}



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

int main() {
  long int n,x;
  string s;
  cin>>n>>s;
  vector<long int> a(26);
  for(long int i=0;i<26;i++)a.at(i)=1;
  for(long int i=0;i<n;i++){
    if(s.at(i)=='a')a.at(0)++;
    else if(s.at(i)=='b')a.at(1)++;
    else if(s.at(i)=='c')a.at(2)++;
    else if(s.at(i)=='d')a.at(3)++;
    else if(s.at(i)=='e')a.at(4)++;
    else if(s.at(i)=='f')a.at(5)++;
    else if(s.at(i)=='g')a.at(6)++;
    else if(s.at(i)=='h')a.at(7)++;
    else if(s.at(i)=='i')a.at(8)++;
    else if(s.at(i)=='j')a.at(9)++;
    else if(s.at(i)=='k')a.at(10)++;
    else if(s.at(i)=='l')a.at(11)++;
    else if(s.at(i)=='m')a.at(12)++;
    else if(s.at(i)=='o')a.at(13)++;
    else if(s.at(i)=='p')a.at(14)++;
    else if(s.at(i)=='q')a.at(15)++;
    else if(s.at(i)=='r')a.at(16)++;
    else if(s.at(i)=='s')a.at(17)++;
    else if(s.at(i)=='t')a.at(18)++;
    else if(s.at(i)=='u')a.at(19)++;
    else if(s.at(i)=='v')a.at(20)++;
    else if(s.at(i)=='w')a.at(21)++;
    else if(s.at(i)=='x')a.at(22)++;
    else if(s.at(i)=='y')a.at(23)++;
    else if(s.at(i)=='z')a.at(24)++;
    else if(s.at(i)=='n')a.at(25)++;
  }
  x=1;
  for(int i=0;i<26;i++){
    x*=a.at(i);
    if(x>=1000000007)x=x%1000000007;
  }
  cout<<x-1<<endl;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>

using namespace std;

typedef long long ll;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define psb push_back
#define ppb pop_back

const int INF = 1001001001;

int main() {
    int SH, SM, EH, EM, K;

    cin >> SH >> SM >> EH >> EM >> K;

    int m = (EH*60+EM) - (SH*60+SM);
    int ans = m - K;

    cout << ans << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<random>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define inf 1145141919
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
typedef pair<int, P> PP;
struct edge { int to, cost; };
int rwa[550][550];
signed main() {
	int n, m, q; cin >> n >> m >> q;
	rep(i, m) {
		int l, r; cin >> l >> r;
		rwa[l][r]++;
	}
	rep(i, n)rep(j, n)rwa[i + 1][j + 1] += rwa[i][j + 1];
	rep(i, n)rep(j, n)rwa[i + 1][j + 1] += rwa[i + 1][j];

	rep(i, q) {
		int l, r; cin >> l >> r;
		cout << rwa[r][r] - rwa[l - 1][r] - rwa[r][l-1] + rwa[l - 1][l - 1] << endl;
	}
}

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

typedef long long ll;
const ll MOD = 1e9+7;
const int N = 2e5;

ll dmod(ll x){
	return x%MOD;
}

ll fe(ll x, ll p){
	if(p==0) return 1ll;
	if(p==1) return x;
	ll ret = fe(x,p/2);
	ret = dmod(ret*ret);
	if(p&1) ret = dmod(ret*x);
	return ret;
}

int n;
ll li[N+5];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&li[i]);
	}
	sort(li+1,li+n+1);
	ll ans = 0ll;
	for(int i=1;i<=n;i++){
		ans = dmod(ans + dmod(li[i] * dmod(fe(2ll,i-1) * dmod(fe(2ll,n-i) + dmod((ll)(n-i) * fe(2ll,n-i-1))	))));
//		cout << dmod(fe(2ll,n-i) + dmod((ll)(n-i) * fe(2ll,n-i-1))) << endl;;
	}
	ans = dmod(ans * fe(2ll,n));
	printf("%lld\n",ans);
	return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, m, a[1000], b[1000], c[1000], d[100][100], ans;

int main() {
	cin >> n >> m;
	rep(i,n) {
		fill(d[i], d[i]+n, inf);
		d[i][i] = 0;
	}
	rep(i,m) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--, b[i]--;
		d[a[i]][b[i]] = d[b[i]][a[i]] = c[i];
	}
	// 全点間最短距離を求める
	rep(k,n) rep(i,n) rep(j,n)
	    chmin(d[i][j], d[i][k]+d[k][j]);
	// 各辺を見直して↑の最短距離で使われてないってわかったらans++
	rep(i,m) if (d[a[i]][b[i]]!=c[i]) ans++;
	cout << ans << ln;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

bool check_digit(int n) {
    string str = to_string(n);
    if(str[0] == str[1] and str[1] == str[2]) {
        return true;
    } else {
        return false;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    FOR(i, n, 999) {
        if(check_digit(i)) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    int n,k; cin >> n >> k;
    std::vector<int> h(n); rep(i,n) cin >> h[i];
    
    int cnt = 0;

    rep(i,n) if(h[i] >= k) cnt++;
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int a, b;
    cin >> a >> b;
    int plug = 1;
    REP(i, 2000)
    {
        if (plug >= b)
        {
            cout << i << endl;
            break;
        }
        plug += a - 1;
    }
}

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

#define INF 100000000000L

long long f(long long x) {
	long long f_x = 0;
	if (x % 2 == 0) {
		if ((x / 2) % 2 == 0) {
			f_x = x;
		}
		else {
			f_x = x+1;
		}
	}
	else {
		if (((x+1) / 2) % 2 == 0) {
			f_x = 0;
		}
		else {
			f_x = 1;
		}
	}
	return f_x;
}

int main(void) {
	long long A=0, B=0;

	std::cin >> A >> B;
	
	long long a = f(A-1);
	long long b = f(B);

	long long ans = a ^ b;

	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
"""
a, b, c, x, y = map(int, input().split())
if a + b > 2 * c and x > y:
    if a > 2 * c:
        ans = 2 * x * c
    else:
        ans = (x - y) * a + 2 * y * c
elif a + b > 2 * c and x <= y:
    if b > 2 * c:
        ans = 2 * y * c
    else:
        ans = (y - x) * b + 2 * x * c
else:
    ans = x * a + y * b
print(ans)
"""

a, b, c, x, y = map(int, input().split())
ab = 2 * c
m = 10 ** 9
for i in range(0, max(x, y) + 1):
    p = ab * i + a * max(0, x - i) + b * max(0, y - i)
    if m > p:
        m = p
print(m)

Measured memory_bytes: 3060
/**
 * author: dannysmyda
 */ 
#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    set<int> snukes;
    while(K--) {
        int d;
        cin >> d;
        for(int i = 0; i < d; i++) {
            int s;
            cin >> s;
            snukes.insert(s);
        }
    }

    int ans = 0;
    for(int i = 1; i <= N; i++) {
        if(snukes.find(i) == snukes.end()) {
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;    
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <string>

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

using namespace std;

int N, M;
int p[100001];
int x[100001];
int y[100001];

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};


int main()
{
    scanf("%d %d", &N, &M);
    REP(i, N)
        scanf(" %d ", &p[i]);
    REP(i, M)
        scanf(" %d %d ", &x[i], &y[i]);
    UnionFind u(100001);
    REP(i, M) {
        u.unionSet(x[i], y[i]);
    }
    int c = 0;
    REP(i, N) {
        if(u.findSet(i+1, p[i]))
            c++;
    }
    cout << c << endl;

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int i;
	int a[n];
 	bool was[100001]={false};
 	int ans=0;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		if(was[a[i]])
			ans++;
         	else
         		was[a[i]]=true;       
       	}
       	ans+=ans%2;
       	cout<<n-ans;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int n,x;
    cin >> n >> x;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    }
    int left = 0;
    ll ans = 0;
    rep(i, n)
    {
        int right = a[i];
        if((left + right) <= x){
            left = right;
        }else{
            int tmp = (right + left) -  x;
            ans += tmp;
            left = right - tmp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

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

    int b = 1;

    if (n % 3 != 0) b = 0;

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

    int g = 1, h = 0;
    for (auto &p : mp) {
        if (p.second % (n / 3) != 0) g = 0;
        for (int i = 0; i < p.second / (n / 3); i++) {
            h ^= p.first;
        }
    }
    if (g) {
        if (h != 0) b = 0;
    } else {
        b = 0;
    }

    int f = 1;
    for (int i = 0; i < n; i++) {
        if (a[i] != 0) f = 0;
    }
    if (f) b = 1;

    cout << (b ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 4224
#include<stdio.h>
#include<string.h>
#include<math.h>

int lg[200000];
int N = 200000;

int main(){
   int n,ans=0;
   scanf("%d ", &n);
   int a,min=n;
   for(int i=0;i<n;i++){
   	scanf("%d ", &a);
    if(a<=min){
      ans++;
      min = a;
    }
   }
   printf("%d", ans);
  
   return 0;
 
}

Measured memory_bytes: 128
import math
N=1299709
prime=[1]*(N+1)
prime[0],prime[1]=0,0
for i in range(2,int(math.sqrt(N))):
    if prime[i]==1:
        j=i
        while i*j<=N:
            prime[i*j]=0
            j+=1

while True:
    n=input()
    if n==0:break
    if prime[n]==1:
        print 0
    else:
        i=n-1
        while prime[i]!=1:
            i-=1
        j=n+1
        while prime[j]!=1:
            j+=1
        print j-i

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

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

    string X;
    cin >> X;

    ll cnt = 0;
    ll stack = 0;

    rep (i, X.size()) {
        if (X[i] == 'S') {
            stack++;
        } else {
            if (stack > 0) {
                stack--;
                cnt++;
            }
        }
    }

    cout << X.size()-cnt*2 << endl;
    return 0;
}

Measured memory_bytes: 720
#include <iostream>

using namespace std;
int n,a,b,c,d;
int main()
{
    cin>>n;
    d=n%10;
    n=n/10;

    c=n%10;
    n=n/10;
    b=n%10;
    n=n/10;
    a=n%10;
    if((a==b&&b==c)||(b==c&&c==d))
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 3e2 + 10;

int n;
ll a[maxN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for1(i, n)
    {
        cin >> a[i];
    }
    ll x = 0;
    for1(i, n)
    {
        x ^= a[i];
    }
    if (x == 0)
    {
        cout << 0;
        return 0;
    }
    x = 0;
    fore(i, 3, n)
    {
        x ^= a[i];
    }
    ll s = a[1] + a[2];
    if (s < x || (s - x) % 2 != 0)
    {
        cout << -1;
        return 0;
    }
    ll d = (s - x) / 2;
    ll g = 0, m = 0;
    for0(i, 40)
    {
        if (d >> i & 1LL)
        {
            if (x >> i & 1LL)
            {
                cout << -1;
                return 0;
            }
            m |= 1LL << i;
        }
    }
    if (m > a[1])
    {
        cout << -1;
        return 0;
    }
    ford(i, 40)
    {
        if (d >> i & 1)
        {
            g |= 1LL << i;
        }
        else
        {
            if (x >> i & 1LL)
            {
                if ((g | (1LL << i) | (m & ((1LL << i) - 1))) < a[1])
                {
                    g |= (1LL << i);
                }
            }
        }
    }
    if (g == 0)
    {
        cout << -1;
        return 0;
    }
    cout << a[1] - g;
    return 0;
}


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

int const N = 5000;
int n, c[N], v[N];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; ++i) cin >> v[i];
    for(int i = 1; i <= n; ++i) {
        cin >> c[i];
        if(v[i] - c[i] > 0) ans += (v[i] - c[i]);
    }
    cout << ans << endl;
}


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

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


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

int main() {

  int N, cnt = 0, An = 0;
  cin >> N;

  for (int i=0; i<N; i++) {
    cin >> An;

    int tmp_cnt = 0;
    while (An % 2 != 1) {
      An /= 2;
      tmp_cnt++;
    }
    if (i == 0) {
      cnt = tmp_cnt;
    } else if (tmp_cnt < cnt) {
      cnt = tmp_cnt;
    }
  }

  cout << cnt << endl;
}


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

public class Main{
	
	public static void main(String[] args){
	
	MyScanner sc = new MyScanner();
	out = new PrintWriter(new BufferedOutputStream(System.out));
	
	/**/
	
	int numOfSticks = sc.nextInt();
	int[] sticks = new int[numOfSticks];
	
	int counter = 0;
	
	for(int i = 0; i < numOfSticks; i++){
		sticks[i] = sc.nextInt();
	}
	
	if(numOfSticks < 3){
		System.out.println(0);
		return;
	}
	
	
	
	for(int i = 0; i < numOfSticks; i++){
		
		for(int i2 = i + 1; i2 < numOfSticks; i2++){
			
			for(int i3 = i2 +1; i3 < numOfSticks; i3++){
				
				if(i != i2 && i2 != i3 && i != i3){
					
					if(sticks[i] != sticks[i2] && sticks[i2] != sticks[i3] && sticks[i] != sticks[i3]){
						
						if(sticks[i] + sticks[i2] > sticks[i3] && Math.max(sticks[i], sticks[i2]) - Math.min(sticks[i],sticks[i2]) < sticks[i3]){
						counter++;
						}
						
					}
					
				}
				
			}
			
		}
		
	}
	
	System.out.println(counter);

	/**/
	 
	 out.close();	
	}
	
	public static PrintWriter out;
	
	public static class MyScanner{
		
		BufferedReader br;
		StringTokenizer st;
		
		public MyScanner(){
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
 
      int nextInt() {
          return Integer.parseInt(next());
      }
 
      long nextLong() {
          return Long.parseLong(next());
      }
 
      double nextDouble() {
          return Double.parseDouble(next());
      }
 
      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
	
}


Measured memory_bytes: 34168
#include <bits/stdc++.h>
using namespace std;
#define MOD7 1000000007
#define MOD9 1e9 + 9
#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))
typedef long long ll;
typedef long double ld;
typedef string str;
typedef double d;
typedef unsigned u;
typedef unsigned long long ull;

const long long BIGINF = 2e18 + 7;
const int INF = 2e9 + 7;


int main () {
	/*#ifndef ONLINE_JUDGE
		freopen("inputf.txt", "r", stdin);
		freopen("outputf.txt", "w", stdout);
	#endif*/
	int n;
	SCD(n);
	int x;
	vector<pair<int,int>> v;
	for (int i = 0; i < n; i++) {
		SCD(x);
		v.emplace_back(x, i);
	}
	sort(v.begin(), v.end());
	int ans = 1;
	int ind = v[0].second;
	for (int i = 1; i < n; i++) {
		if (v[i].second < ind) ans++;
		ind = min(ind, v[i].second);
	}
	printf("%d", ans);
    return 0;
}



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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (int i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (int i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;

int main () {               
    cin >> n;
    ll sum = 0;
    for (int i = 1; i <= n; i ++) {
    	cin >> a[i];
    	sum += a[i];
    }
    ll rez = (n * (ll)(n + 1)) / 2;
    if (sum % rez) {
    	cout << "NO";
    	exit(0);
    }
    ll k = sum / rez;
    ll done = 0;

    a[0] = a[n];
    for (int i = 1; i <= n; i ++) {
    	ll cur = a[i] - a[i - 1];
    	cur -= k;
    	cur = -cur;
    	if (cur < 0 || cur % n) {
    		cout << "NO";
    		exit(0);
    	}
    	done += cur / n;
    }
    if (done != k) {
    	cout << "NO";
    	exit(0);
    }

    cout << "YES";
    return Accepted;
}

// Coded By OB

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

#ifdef LOCAL
#include "prabh.hpp"
#endif

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;

void solve() {
	int n; cin >> n;
	vector<int> a(n);
	for (int &i : a) cin >> i;
	sort(range(a));
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (a[i] == a[j] or a[j] == a[k]) continue;
				if (a[i] + a[j] > a[k])
					cnt++;
			}
		}
	}

	cout << cnt << endl;
}

// you should probably see down .. believe me it would help
int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
//	cin >> t_c;
	while (t_c--)
		solve();
}

/*
 * COME ON DUDE .... DONT GET UP UNTIL U GET THE SOLUTION
 * GIVING UP NOT GONNA HELP .. JUST GET YOUR ASS TO WORK ALREADY ..
 * AND FOR FUCKING SAKE ... DONT PANIC !!
*/


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    ll N, M; cin >> N >> M;
    vector<ll> vec(M);
    map<ll, ll> mp;
    vector<ll> pairs(M);
    for(int i = 0; i < N; ++i){
        ll a; cin >> a;
        ++vec[a%M];
        ++mp[a];
        if(mp[a]%2==0) ++pairs[a%M];
    }
    ll ans = 0;
    for(ll i = 0; i < M; ++i){
        ll j = (M - i)%M;
        if(i>j) break;
        if(i==j){
            ans += vec[i]/2;
            continue;
        }
        ll idx = i, idx2 = j;
        if(vec[i] < vec[j]) swap(idx, idx2);
        else if(vec[i] == vec[j] && pairs[i] < pairs[j]) swap(idx, idx2);

        ans += vec[idx2];
        ll diff = vec[idx] - vec[idx2];
        diff /= 2;
        ans += min(diff, pairs[idx]);
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  string taro = "";
  string hanako = "";

  int taro_score = 0;
  int hanako_score = 0;

  for(int i=0;i<n;i++){
    cin >> taro >> hanako;
    if(taro.compare(hanako) > 0){
      taro_score += 3;
    } else if(taro.compare(hanako) == 0){
      taro_score++;
      hanako_score++;
    } else {
      hanako_score += 3;
    }
  }
  cout << taro_score << " " << hanako_score << endl;
}



Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	int num;
	int n;

	cin >> num;

	for (int i = 0; i < 4; i++)
	{
		if (i > 0)
		{
			if (n == num % 10)
			{
				cout << "Bad" << endl;
				return 0;
			}
		}
		n = num % 10;
		num /= 10;
	}

	cout << "Good" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,k,ans;
int main() {
	scanf("%d%d",&n,&k);
	ans=k;
	for(int i=2;i<=n;i++)
		ans*=k-1;
		printf("%d\n",ans);
}

Measured memory_bytes: 256
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#include <cmath>
#include <ctgmath>
#include <math.h>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define GFOR(i,a,n) for (i=a;i<n;i++)
#define FOR(i,a,n) for (int i=a;i<n;i++)
#define RFOR(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())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<long long int> vll;
typedef vector<pair<int, int> > vpi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

void solve() {
    int n, m;
    ll k;
    cin >> n >> m;
    cin >> k;
    vll a(n), b(m);
    for (auto &x : a)
        cin >> x;
    for (auto &x : b)
        cin >> x;

    ll sum = 0;
    b.insert(b.begin(), 0);
    FOR (i, 1, m+1)
        b[i] += b[i-1];

    int ans = 0;

    int i = 0, j = m;
    GFOR (i, 0, n+1) {
        ll rem = k - sum;
        if (rem < 0)
            break;
        while (b[j] > rem)
            j--;
        ans = max(ans, i + j);
        if (i == n)
            break;
        sum += a[i];

    }
    cout << ans << "\n";
}

int main() {
    io;
    int t = 1;
    tc(t) {
        solve();
    }
}
//check for edge cases in limits
//printing double may print 1.223232e9 like values, beware of that


Measured memory_bytes: 7944
#include<stdio.h>
#define H 2000000

int main(){
  int id,A[H],x;

  scanf("%d",&x);
  for(id = 1;id <= x;id++){
    scanf("%d",&A[id]);
  }

  for(id = 1;id <= x;id++){
    printf("node %d: key = %d, ",id,A[id]);
    if(id/2 >= 1) printf("parent key = %d, ",A[id/2]);
    if(id*2 <= x) printf("left key = %d, ",A[id*2]);
    if(id*2+1 <= x) printf("right key = %d, ",A[id*2+1]);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 608
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

//組み合わせを線形で
//参考:https://drken1215.hatenablog.com/entry/2018/06/08/210000

const int MXN=1000001;//変更可
ll fac[MXN],inv[MXN],finv[MXN];

ll pow_mod(ll x,ll y){
    if(y==0){
        return 1;
    }
    if(y%2){
        return x*pow_mod(x,y-1)%MOD;
    }
    ll t=pow_mod(x,y/2);
    return t*t%MOD;
}

void COMinit(int M) {
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[0]=finv[1]=1;
    for(int i=2;i<MXN;i++){
        fac[i]=fac[i-1]*i%M;
        inv[i]=M-M/i*inv[M%i]%M;
        finv[i]=finv[i-1]*inv[i]%M;
    }
}

ll COMBI(int N,int K,int M){
    if(N<K){
        return 0;
    }
    if(N<0||K<0){
        return 0;
    }
    return fac[N]*finv[N-K]%M*finv[K]%M;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    COMinit(MOD);
    vl c(n);
    rep(i,n){
        cin >> c[i];
    }
  	sort(c.begin(),c.end());
  	vl sum_c(n,c[0]),sum_sum_c(n,c[0]);
    FOR(i,1,n){
    	sum_c[i]=sum_c[i-1]+c[i];
        sum_c[i]%=MOD;
    }
  	FOR(i,1,n){
      	sum_sum_c[i]=sum_sum_c[i-1]+sum_c[i];
        sum_sum_c[i]%=MOD;
    }
    ll ans=0;
  	ll res=pow_mod(2,n);
    FOR(i,1,n+1){
      	ans+=((COMBI(n-1,i-1,MOD)-COMBI(n-2,i-2,MOD))%MOD*sum_c[n-1])%MOD+(COMBI(n-2,i-2,MOD)*sum_sum_c[n-1])%MOD;
      	ans%=MOD;
    }
  	ans*=res;
  	ans%=MOD;
  	cout << (ans+MOD)%MOD << endl;
}

Measured memory_bytes: 31428
#include<bits/stdc++.h>
using namespace std;
int main(void){

  string S;  cin >> S;
  map<char, int> mp;
  for(int i = 0 ; i < S.size() ; i++)  mp[S[i]] += 1;

  while(mp['a'] >= 1 && mp['b'] >= 1 && mp['c'] >= 1)
    mp['a'] -= 1, mp['b'] -= 1, mp['c'] -= 1;

  if(mp['a'] >= 2 || mp['b'] >= 2 || mp['c'] >= 2)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 512