akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MAXX 9000000000000000000
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> > 
#define vvpi vector<vector<pair<int,int> > >


int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int h1,m2,m1,h2,t;
	cin >> h1 >> m1 >> h2 >> m2 >> t;
	h1 *= 60;
	h2 *= 60;
	h1 += m1;
	h2 += m2;

	cout << (h2 - h1 - t);
	
	
	return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const ll MOD = (ll)1e9 + 7;
ll binpow(ll a, ll n) {
    ll res = 1;
    while (n) {
        if (n & 1) { res *= a; res %= MOD; }
        a *= a;
        a %= MOD;
        n >>= 1;
    }
    return res % MOD;
}

ll inv(ll x) { return binpow(x, MOD - 2); }

void add(ll& x, ll y) { x += y; if (x >= MOD) x -= MOD; }
void take(ll& x, ll y) { x -= y; if (x < 0) x += MOD; }

ll sum(ll a, ll b) { add(a, b); return a; }
ll sub(ll a, ll b) { take(a, b); return a; }
ll mul(ll x, ll y) { return (x * y) % MOD; }
ll rat(ll x, ll y) { assert(y); return mul(x, inv(y)); }


const ll MAXN = 52;
const ll MAXT = 26;
const ll MAXK = 50 * 25 + 10;

ll n, k;
ll dp[MAXN][MAXT][MAXK];

void no() { cout << 0 << endl; exit(0); }

ll solve(ll n, ll k) {
    if (k >= MAXK || k % 2) return 0;
    return dp[n][0][k / 2];
}

int main() {
    cout << setprecision(30);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    cin >> n >> k;

    dp[0][0][0] = 1;
    for (ll pos = 0; pos + 1 < MAXN; ++pos) {
        for (ll t = 0; t < MAXT; ++t) {
            for (ll odd = 0; odd < MAXK; ++odd) {
                if (odd + t < MAXK)                 add(dp[pos + 1][t][odd + t], dp[pos][t][odd]);
                if (t >= 1 && odd + t - 1 < MAXK)   add(dp[pos + 1][t - 1][odd + t - 1], mul(t * t, dp[pos][t][odd]));
                if (t >= 0 && odd + t < MAXK)       add(dp[pos + 1][t][odd + t], mul(2 * t, dp[pos][t][odd]));
                if ((t + 1 < MAXT) && odd + t + 1 < MAXK) add(dp[pos + 1][t + 1][odd + t + 1], mul(1LL, dp[pos][t][odd]));
            }
        }
    }

    cout << solve(n, k) << endl;

    return 0;
}


Measured memory_bytes: 13440
import java.util.Scanner;

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

        String s = input.nextLine();
        String p = input.nextLine();
        s += s;

        System.out.println(s.matches(".*" + p + ".*") ? "Yes" : "No");

    }
}

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

int main()
{
	int k;
	cin >> k;
	queue<ll> q;
	for (int i = 1; i <= 9; i++) q.push(i);
	if (k <= 9) {
		cout << k << endl;
		return 0;
	}

	int count = q.size();
	while (true) {
		ll tmp = q.front();
		q.pop();
		for (int i = -1; i <= 1; i++) {
			int d = tmp % 10 + i;
			if (d < 0 || 9 < d) continue;
			ll next = tmp * 10 + d;
			q.push(next);
			count++;
			if (count == k) {
				cout << next << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 768
function Main(input) {
	let[N,X,T] = input.split(" ");
  	N = Number(N)
 	X = Number(X)
  	T = Number(T)
  	
  	const reminder = N%X
    const quotient = Math.floor(N/X)
    
    if(reminder==0){
    	console.log(quotient*T)
    }else{
      	console.log((quotient+1)*T)
    }
	
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 30600
def bubble(A0):
    A = A0.copy()
    N = len(A)
    flag = True
    while(flag):
        flag = False
        for i in range(N-1):
            if A[i][1] > A[i+1][1]:
                A[i], A[i+1] = A[i+1], A[i]
                flag = True
    return A

def select(A0):
    A = A0.copy()
    N = len(A)
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j][1] < A[minj][1]:
                minj = j
        if i != minj:
            A[i], A[minj] = A[minj], A[i]
    return A

if __name__ == '__main__':
    N = int(input())
    A = list(map(str, input().split()))
    A_sort = bubble(A)
    print(*A_sort)
    
    flag = True
    for i in range(N-1):
        if A_sort[i][1] == A_sort[i+1][1]:
            if A.index(A_sort[i]) > A.index(A_sort[i+1]):
                flag = False
                break
    if flag:
        print('Stable')
    else:
        print('Not stable')
    
    A_sort = select(A)
    print(*A_sort)
    flag = True
    for i in range(N-1):
        if A_sort[i][1] == A_sort[i+1][1]:
            if A.index(A_sort[i]) > A.index(A_sort[i+1]):
                flag = False
                break

    if flag:
        print('Stable')
    else:
        print('Not stable')
        


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

using namespace std;
using ll = long long;

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

int main() {
  int n;
  cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];

  int s = 0;
  rep(i, n) s ^= a[i];
  rep(i, n) {
    int b = s ^ a[i];
    cout << b << endl;
  }
  return 0;
}


Measured memory_bytes: 4320
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#define LL long long
#define maxn 2000005
#define mod 1000000007
#define INF (LL)1e16
using namespace std;
typedef pair<LL,int> PLI;
LL n,ans,c[maxn],Siz,cnt[maxn],fact[maxn],inv[maxn],mnp[maxn],Mnp2,Mnp;
LL w[maxn],x,y,Mn=INF,Mn2=INF,mn[maxn];
bool vis[maxn];
vector<PLI> cw[maxn];
struct node { LL v; node *nxt; } edge[maxn*40],*head[maxn],*ncnt;
void addedge(LL u,LL v)
{
	ncnt++;
	ncnt->v=v,ncnt->nxt=head[u];
	head[u]=ncnt;
}
void dfs(LL u)
{
	vis[u]=true;
	cnt[c[u]]++,Siz++;
	for(node *p=head[u];p;p=p->nxt)
	{
		LL v=p->v;
		if(!vis[v]) dfs(v);
	}
}
int main()
{
	scanf("%lld%lld%lld",&n,&x,&y);
	fact[0]=1;
	for(LL i=1;i<=n;i++) fact[i]=1ll*fact[i-1]*i%mod;
	inv[1]=1;
	for(LL i=2;i<=n;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	inv[0]=1;
	for(LL i=1;i<=n;i++) inv[i]=1ll*inv[i]*inv[i-1]%mod;
	ncnt=&edge[0];
	for(LL i=1;i<=n;i++) mn[i]=INF;
	for(LL i=1;i<=n;i++) 
	{
		scanf("%lld%lld",&c[i],&w[i]);
		if(mn[c[i]]>w[i]) mn[c[i]]=w[i],mnp[c[i]]=i;
		if(Mn>w[i]) Mn=w[i],Mnp=i;//Mn=min(Mn,w[i]);
	}
	for(LL i=1;i<=n;i++)
		if(c[i]!=c[Mnp]&&Mn2>w[i]) Mn2=w[i],Mnp2=i;
	for(LL i=1;i<=n;i++)
		if(i!=mnp[c[i]]&&mn[c[i]]+w[i]<=x) { addedge(i,mnp[c[i]]); addedge(mnp[c[i]],i); }
	for(LL i=1;i<=n;i++)
	{
		if(i==Mnp) continue;
		else if(c[i]!=c[Mnp]&&Mn+w[i]<=y) { addedge(i,Mnp); addedge(Mnp,i); }
		else if(Mn2!=INF&&c[i]!=c[Mnp2]&&Mn2+w[i]<=y) { addedge(i,Mnp2); addedge(Mnp2,i); }
	}
	dfs(Mnp);
	ans=fact[Siz];
	for(LL i=1;i<=n;i++) ans=1ll*ans*inv[cnt[i]]%mod;
	printf("%lld\n",ans);
}

Measured memory_bytes: 87808
import java.util.*;

public class Main
{
	public static void main(String args[])
	{
		Scanner reader = new Scanner(System.in);
		int a=reader.nextInt();
		int b=reader.nextInt();
		int c=reader.nextInt();
		if((100*a+10*b+c)%4==0)
		{
			System.out.println("YES");
		}
		else
		{
			System.out.println("NO");
		}
	}
}

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

typedef long long ll;

int q, h, s, d, n;

int main(){
	scanf("%d%d%d%d%d", &q, &h, &s, &d, &n);
	h = std::min(h, q << 1);
	s = std::min(s, h << 1);
	d = std::min(d, s << 1);
	printf("%lld\n", 1ll * (n >> 1) * d + (n & 1) * s);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

template<typename T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vector<int> B(N);
    cin >> B;

    vector<int> ans;
    while (B.size() != 0) {
        bool found = false;
        FORR(i, B.size(), 0) {
            if (B[i] == i + 1) {
                B.erase(B.begin() + i);
                ans.emplace_back(i + 1);
                found = true;
                break;
            }
        }
        if (!found) {
            cout << -1 << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 256
#include <stdio.h>

typedef unsigned int ui;
typedef unsigned short us;
typedef unsigned char uc;

#define YEN_500		10
#define YEN_100		2
#define YEN_50		1

int main(void)
{
	int ret;
	us sum;
	us sum500_100;
	us tmp500 = 0;
	us tmp100;
	uc i500;
	uc i100;
	uc n500;
	uc n100;
	uc n50;
	uc cnt500 = 0;
	uc cnt100 = 0;
	uc cnt50 = 0;

	ret = scanf("%u", (ui *)&n500);
	ret = scanf("%u", (ui *)&n100);
	ret = scanf("%u", (ui *)&n50);
	ret = scanf("%u", (ui *)&sum);

	sum /= 50;

	for(i500=0; i500<=n500; i500++)
	{
		/* 500円の合計が入力された合計以上か */
		if(tmp500 >= sum)
		{
			if(tmp500 == sum)
			{
				cnt500++;
			}
			break;
		}

		tmp100 = 0;
		for(i100=0; i100<=n100; i100++)
		{
			sum500_100 = (tmp100 + tmp500);

			/* 500円と100円の合計が入力された合計以上か */
			if(sum500_100 >= sum)
			{
				if(sum500_100 == sum)
				{
					cnt100++;
				}
				break;
			}

			/* 50円で余りが埋まるか */
			if(n50 >= (sum - sum500_100))
			{
				cnt50++;
			}
			/* 100円の合計を算出 */
			tmp100 += YEN_100;
		}

		/* 500円の合計を算出 */
		tmp500 += YEN_500;
	}
	printf("%d", cnt500+cnt100+cnt50);

	return(0);
}

Measured memory_bytes: 128
#include<stdio.h>
#define NOT_FOUND -1
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)

bool linerSearch(int n,int S[], int key) {
    int i = 0;
    S[n] = key;
    while( S[i] != key) {
        i++;
    }
    if(i == n) {
        return false;
    }
    return true;
}

int main() {
    int n, q;
    int count = 0;
    int S[10005];
    int T[510];

    scanf("%d",&n);
    rep(i,n) {
        scanf("%d",&S[i]); // &ないとエラー        
    }
    scanf("%d",&q);
    rep(i,q) {
        scanf("%d",&T[i]); // &ないとエラー 
        if(linerSearch(n, S,T[i] )) {
            count++;
        }      
    }

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


Measured memory_bytes: 2776
#include<bits/stdc++.h>
#define ll long long
#define mk make_pair
#define pb push_back
#define pa pair<int,int>
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<"\n"
using namespace std;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-') w=-1;ch=getchar();} while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();} return w*s;}
struct node{int to,next;} e[1010010];
int n,h[1010100],tot,f[101010],g[101001];
inline void add(int from,int to){e[++tot].next=h[from];h[from]=tot;e[tot].to=to;}
inline void DFS(int now,int ffa){
	int Max=-1e9;
	for(rint i=h[now];i;i=e[i].next){
		int to=e[i].to;if(to==ffa) continue;
		DFS(to,now);g[now]+=f[to];Max=max(Max,g[to]-f[to]);
	}f[now]=g[now]+Max+1;
}
int main(){
	n=read();
	for(rint i=1;i<n;++i) {int x=read(),y=read();add(x,y);add(y,x);}
	if(n&1){
		cout<<"First\n";
		return 0;
	}
	else {
		DFS(1,0);
		if(f[1]==n/2){
			cout<<"Second\n";
			return 0;
		}
		else cout<<"First\n";
	}
	return 0;
}	

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
int n;
int x[maxn];
ll a, b, ans;
int main()
{
	scanf("%d%lld%lld", &n, &a, &b);
	for(int i = 1; i <= n; ++i) scanf("%d", &x[i]);
	for(int i = 2; i <= n; ++i)
		ans += min(a * (x[i] - x[i - 1]), b);
	cout << ans << endl;
	return 0;
}

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

int n;
int ans[1000];

struct res{
	int id;
	string city;
	int score;
	res(int _id, string _res, int _score){
		id = _id;
		city = _res;
		score = _score;
	}
};

bool cmp(res a, res b){
	if(a.city.compare(b.city) == 0){
		return a.score > b.score;
	}
	return a.city.compare(b.city) < 0;
}

vector<res> resLis;

int main(){
	cin >> n;
	for(int i = 0; i < n; ++i){
		string str;
		int score;
		cin >> str >> score;
		resLis.push_back(res(i, str, score));
	}
	sort(resLis.begin(), resLis.end(), cmp);
	for(int i = 0; i < n; ++i){
		cout << resLis[i].id+1 << endl;
	}
}

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

int main() {

    int n;

    std::cin >> n;

    int a[4][14] = { };

    char x;
    int  y;

    for ( int i = 0; i < n; i++ ) {

        std::cin >> x >> y;

        switch ( x ) {

        case 'S': a[0][y]++; break;
        case 'H': a[1][y]++; break;
        case 'C': a[2][y]++; break;
        case 'D': a[3][y]++; break;

        }
    }

    for ( int i = 0; i < 4; i++ ) {

        for ( int j = 1; j <= 13; j++ ) {

            if ( a[i][j] == 0 ) {

                std::cout << "SHCD"[i] << " " << j << std::endl;
            }
        }
    }

    return 0;
}



Measured memory_bytes: 3104
/*  CREATED BY
    STREAM_CIPHER
    29-aug-2020
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define debug1(a) cout<<#a<<"="<<(a)<<"\n"
#define debug2(a,b) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<"\n"
#define debug3(a,b,c) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<","<<#c<<"="<<(c)<<"\n"
#define fix_precision(n) cout << fixed << setprecision(n)
#define all(a) a.begin(),a.end()
const double pi=acos(-1.0);
int inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int mx=5*1000000;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    #endif
        string a,b;
        cin>>a>>b;
        int ans=inf;
        for(int i=0;i<=a.size()-b.size();i++)
        {
            // cout<<i<<endl;
            int temp=0;
            for(int j=0;j<b.size();j++)
            {
                if(a[i+j]!=b[j])
                    temp++;
            }
            ans=min(temp,ans);
        }
        cout<<ans<<endl;
}

Measured memory_bytes: 3612
import math
N,M = map(int,input().split())
l = [int(i) for i in input().split()]
l.sort(reverse = True)
l_sum = sum(l)
d = (1/(4*M))*l_sum
cnt = 0
 
for i in range(N):
    if l[i] >= d:
        cnt += 1
    else:
        break
 
if cnt >= M:
    print("Yes")
else:
    print("No") 

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    int N,D,X,i,j,Y;
    scanf("%d",&N);
    scanf("%d %d",&D,&X);
    
    int A[N];
    
    for(i=1;i<=N;i++){
        scanf("%d",&A[i]);
    }
    
    Y = 0;
    
    for(i=1;i<=N;i++){
        for(j=1;j<=D;j++){
            if((j-1)%A[i] == 0){
                Y ++;
            }
        }
    }
    
    Y += X;
    
    printf("%d",Y);
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
  
}
int a[LIMIT2]={0},b[LIMIT2]={0};
int c[LIMIT1]={0};
int tmp(cv *p,cv *q){
  int n = a[*(int *)p]-a[*(int *)q];
  if(n != 0) return n;
  else return b[*(int *)q]-b[*(int *)p];
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  char s[LIMIT1];
  priority_queue<int> que;
  
  scanf("%lld %lld",&n,&m);
  rep(i,n) scanf("%d %d",&a[i],&b[i]);
  
  tmpInit(c,n);
  qsort(c,n,sizeof(int),tmp);
  
  j=1;
  rep(i,n){
    if((ll)a[c[i]] > m){
      break;
    }
    while((ll)a[c[i]] > j){
      if(!que.empty()){
        result += (ll)que.top();
        //printf("%d %d\n",que.top(),j);
        que.pop();
      }
      j++;
    }
    que.push(b[c[i]]);
  }
  while(j<=m && !que.empty()){
    result += (ll)que.top();
    //printf("%d %d\n",que.top(),j);
    que.pop();
    j++;
  }
  printf("%lld",result);
  return 0;
}

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

public class P
{
    public int area { get; set; }
    public int id { get; set; }
}

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var n = s.Length;
        var a = new int[n];
        for (int i = 0; i < n; i++)
            if (s[i] == '\\') a[i] = -1;
            else if (s[i] == '/') a[i] = 1;
        var st1 = new Stack<int>();
        var st2 = new Stack<P>();
        getAns(s, st1, st2);
        print(st2);
    }
    public static void print (Stack <P> st)
    {
        var n = st.Count();
        if (n == 0) { Console.WriteLine(0); Console.WriteLine(0);  return; }
        var a = new int[n];
        var asum = 0;
        for (int i =    0; i < n; i++)
        {
            var w = st.Pop();
            a[n -1 -  i] = w.area;
            asum += w.area;
        }
        Console.WriteLine(asum);
        Console.Write("{0} ", n);
        for (int i = 0; i < n; i++)
            if (i == n - 1) Console.WriteLine(a[i]);
            else Console.Write("{0} ", a[i]);

    }
    public static void getAns(string s, Stack<int> st1, Stack<P> st2)
    {
        for (int i = 0; i < s.Length; i++)
            if (s[i] == '\\') st1.Push(i);
            else if (s[i] == '/' && st1.Count() > 0)
            {
                var id = st1.Pop();
                var area = i - id;
                getSum(id, area, st2);
            }
    }
    public static void getSum(int id, int area, Stack<P> st2)
    {
        while (true)
        {
            if (st2.Count() == 0) { st2.Push(new P { id = id, area = area }); return; }
            var w = st2.Peek();
            if (id > w.id) { st2.Push(new P { id = id, area = area }); return; }
            else { area += w.area; st2.Pop(); }
        }
    }
}



Measured memory_bytes: 10824
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	ll n, a[110];
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	sort(a, a + n);
	ll A = 0, B = 0;
	for (int i = 0; i < n; i++) {
		if (n % 2) {
			if (i % 2)A += a[i];
			else B += a[i];
		}
		else {
			if (i % 2)B += a[i];
			else A += a[i];
		}
	}
	cout << abs(A - B) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s=="SSS")
    cout<<"0";
  else if(s=="RSS"||s=="SSR"||s=="SRS"||s=="RSR")
    cout<<"1";
  else if(s=="SRR"||s=="RRS")
    cout<<"2";
  else
    cout<<"3";
  return 0;
}


Measured memory_bytes: 3608
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll k,n; cin>>k>>n;
    ll arr[n+2];
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    ll mx=INT_MAX;
    for(int i=2;i<=n;i++){
        mx=min(mx,k-arr[i]+arr[i-1]);
    }
    mx=min(mx,arr[n]-arr[1]);
    cout<<mx<<endl;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  vi A(n);
  for(auto &a:A)cin>>a;
  priority_queue<pair<ll,ll>>que;
  for(int i=0;i<m;i++){
    ll a,b;cin>>a>>b;
    que.push(mp(b,a));
  }
  sort(ALL(A));
  for(int i=0;i<n;i++){
    if(que.empty())break;
    pair<ll,ll>now=que.top();
    que.pop();
    if(A[i]>now.F){
      break;
    }else{
      A[i]=now.F;
      now.S--;
      if(now.S>0)
	que.push(mp(now.F,now.S));
    }
  }
  ll ans=0;
  for(int i=0;i<n;++i)ans+=A[i];
  cout<<ans<<endl;
  return 0;
}


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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
    int N, M;
    std::cin >> N >> M;
    std::vector<ll> H(N);
    rep(i, N) {
        std::cin >> H[i];
    }

    std::vector<ll> nhest(N, 0);
    rep(i, M) {
        int A, B;
        std::cin >> A >> B;
        --A; --B;
        nhest[A] = std::max(nhest[A], H[B]);
        nhest[B] = std::max(nhest[B], H[A]);
    }

    int ans = 0;
    rep(i, N) {
        if(nhest[i] < H[i]) ++ans;
    }
    std::cout << ans << std::endl;
  
}


Measured memory_bytes: 4860
#include <iostream>

using namespace std;

int H, W;
char a[105][105];

int main(void)
{
	cin >> H >> W;
	for(int y = 1; y <= H; y++){
		for(int x = 1; x <= W; x++){
			cin >> a[x][y];
		}
	}
	
	for(int y = 0; y <= H+1; y++){
		for(int x = 0; x <= W+1; x++){
			if(x == 0 || x == W+1 || y == 0 || y == H+1) cout << "#";
			else cout << a[x][y];
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
    int N, Y;
    cin >> N >> Y;
    int sum;
    bool end = false;

    for (int x = 0; x <= N; x++) {
        for (int y = 0; y <= N - x; y++) {
            int money1000 = Y - (x * 10000 + y * 5000);
            //cout << 'x' << x << " y" << y << " money1000 " << money1000 << endl;
            if (money1000 % 1000 == 0 && money1000 / 1000 == N - (x + y)) {
                cout << x << ' ' << y << ' ' << N - (x + y) << endl;
                end = true;
            }
            if (end) break;
        }
        if (end) break;
    }
    if (!end) cout << "-1 -1 -1" << endl;
}

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

int main()
{
    int w,h,n,x1,y1,x2,y2,tempx,tempy,temp;
    cin>>w>>h>>n;
    x1=y1=0;
    x2=w,y2=h;
    for(int i=0;i<n;i++)
    {
        cin>>tempx>>tempy>>temp;
            if(temp==1&&x1<tempx)
            {
                x1=tempx;
            }
            else if(temp==2&&x2>tempx)
            {
                x2=tempx;
            }
            else if(temp==3&&y1<tempy)
            {
                y1=tempy;
            }
            else if(temp==4&&y2>tempy)
            {
                y2=tempy;
            }

        if(x1>=x2||y1>=y2)
        {
            cout<<"0"<<endl;
            return 0;
        }
    }
    cout<<((x2-x1)*(y2-y1))<<endl;
    return 0;
}


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

int main()
{
  int N, v[50], c[50], ans = 0;
  
  cin >> N;

  for(int i = 0; i < N; i++)
    cin >> v[i];
  for(int i = 0; i < N; i++)
    cin >> c[i];

  for(int i = 0; i < N; i++){
    if(v[i] - c[i] > 0)
      ans += v[i] - c[i];
  }

  cout << ans << endl;

  return 0;
}


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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
    return arg1.first > arg2.first;
}

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

    if(s.at(2)==s.at(3)&&s.at(4)==s.at(5)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i,a,b) for(ll i=(a);i<(b);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1LL<<59)

signed main(){
    int n;
    cin>>n;
    int sum = 0;
    vector<int> v(n);
    rep(i,n){
        cin>>v[i];
        sum+=v[i];
    }
    
    int ans = INF;
    int now = 0;
    for(int i=1;i<n;i++){
        now+=v[i-1];
        ans = min(ans,abs(now-(sum-now)));
    }
    
    cout<<ans<<endl;
}

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

using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(d>=abs(a-c) or (d>=abs(a-b) and d>=abs(b-c))){
  	cout << "Yes" << endl;
  }else{
  	cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  998244353
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int a[1005],b[1005],c[1005];
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int x,y,z,k;
   cin>>x>>y>>z>>k;
   rep(i,0,x)cin>>a[i];
   rep(i,0,y)cin>>b[i];
   rep(i,0,z)cin>>c[i];
   vi v;
   for(int i=0;i<x;i++)
   {
       for(int j=0;j<y;j++)
       {
           v.pb(a[i] + b[j]);
       }
   }
   sort(all(v),greater<int>());
   sort(c,c+z,greater<int>());
   priority_queue<int>pq;
   int cnt=1e6;
   for(int i=0;i<v.size() && pq.size()<3*cnt;i++)
   {
       for(int j=0;j<z && pq.size()<3*cnt;j++)
       {
           pq.push(v[i] + c[j]);
       }
   }
   while(k--)
   {
       cout<<pq.top()<<endl;
       pq.pop();
   }
}


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

int main() {
  int n, m;
  cin >> n >> m;
  priority_queue<int> arr;
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    arr.push(a);
  }
  for (int j = 0; j < m; ++j) {
    int max_element = arr.top();
    arr.pop();
    arr.push(max_element / 2);
  }
  long long ans = 0;
  while (!arr.empty()) {
    ans += arr.top();
    arr.pop();
  }
  cout << ans << endl;
}


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



int main(int argc, char const *argv[])
{
	long long int n,w,i,j;
	cin>>n>>w;
	int **a=new int*[n+1];
	for(i=0;i<=n;i++)
	{
		a[i]=new int[2];
	}
	for(i=1;i<=n;i++)
	{
		cin>>a[i][0]>>a[i][1];
	}
	//we create a dp array which denotes dp[i][w] as what ever we can choose from frist i items such that weights of these items is exactly w
	long long int dp[n+1][w+1];
	long long int mx=-1;
	memset(dp,0,sizeof(dp));
	for(i=1;i<=w;i++)
	{
		if(i==a[1][0])
		{
			dp[1][i]=a[1][1];
		}
		else
		{
			dp[1][i]=0;
		}
	}
	for(i=1;i<=n;i++)
	{
		if(a[i][0]==1)
		{
			dp[i][1]=a[i][1];
		}
		else
		{
			dp[i][1]=0;
		}
	}
	for(i=2;i<=n;i++)
	{
		for(j=2;j<=w;j++)
		{
			long long int op1=-1,op2=-1;
			op1=dp[i-1][j];
			if(j-a[i][0]>=1)
			op2=dp[i-1][j-a[i][0]]+a[i][1];

		    dp[i][j]=max(op1,op2);
		}
	}
	for(i=1;i<=w;i++)
	{
		if(dp[n][i]>mx)
		{
			mx=dp[n][i];
		}
	}
	cout<<mx<<"\n";
	return 0;
}



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

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

	for(int i=1;i<n-1;i++){
		if(p[i]>p[i-1]&&p[i]<p[i+1]){
			ans++;
		}else if(p[i]<p[i-1]&&p[i]>p[i+1]){
			ans++;
		}
	}
	cout<<ans<<endl;
}


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

int main()
{
    long a,b;
    std::cin >> a >> b;
    if(a<b){
        for(long i=0; i<b; i++){
            std::cout << a;
        }
    }else{
        for(long i=0; i<a; i++){
            std::cout << b;
        }
    }
    std::cout << std::endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)

ll powmod(ll n, ll k) {
    ll res = 1;
    while(k) {
        if(k&1) res = res*n%MOD;
        n = n*n%MOD;
        k /= 2;
    }
    return res;
}

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

    int n; cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a; cin >> a;
        mp[a]++;
    }
    
    int ans = 1;
    if(n&1) {
        for(auto e : mp) {
            if(e.first&1) {
                cout << 0 << '\n';
                return 0;
            }
            if(e.first == 0 && e.second != 1) {
                cout << 0 << '\n';
                return 0;
            }
            if(e.first != 0 && e.second != 2) {
                cout << 0 << '\n';
                return 0;
            }
        }
        cout << powmod(2, (ll)mp.size()-1) << '\n';
    } else {
        for(auto e : mp) {
            if(e.first%2 == 0) {
                cout << 0 << '\n';
                return 0;
            }
            if(e.second != 2) {
                cout << 0 << '\n';
                return 0;
            }
        }
        cout << powmod(2, (ll)mp.size()) << '\n';
    }
    return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>


using namespace std;

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

	long long int x = (c - a - b) * (c - a - b) - 4 * a * b;

	if (c - a - b <= 0) x = -1;
	if (x > 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        final long x = sc.nextLong();

        long ans = 0;
        long money = 100;
        while (true) {
            if (money >= x) {
                System.out.println(ans);
                return;
            }

            money += money * 0.01;
            ans++;
        }
    }
}


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

int main() {
	int a, b, N;
	cin >> a >> b;
	N = b - a;
	int sum_ = 0;
	for (int i = 1; i <= N; i++) {
		sum_ += i;
	}
	int res = sum_ - b;
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

int gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}



int main() {
	string S="No";
	string s;
	cin >> s;
	int a = 0, b = 0, c = 0, d = 0;
	rep(i, s.size()) {
		if (s.at(i) == 'N') {
			a = 1;
		}
		else if (s.at(i) == 'W') {
			b = 1;
		}
		else if (s.at(i) == 'S') {
			c = 1;
		}
		else if (s.at(i) == 'E') {
			d = 1;
		}
	
	}
	if ((a + c) % 2 == 0 && (b + d) % 2 == 0) {
		S = "Yes";
	}
	
	
	cout << S << endl;

	
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int y = sc.nextInt();
		String z = "";

		if(x>y) {
			z = ">";
		}else if(x<y) {
			z = "<";
		}else {
			z = "==";
		}

		System.out.println("a " + z + " b");

		sc.close();
	}
}


Measured memory_bytes: 26108
#include <stdio.h>
#define MAX 10000
#define NIL -1

struct Node {int parent,left,right;};

struct Node T[MAX];
int n,D[MAX],H[MAX];


void setDepth(int u,int d){
  if(u==NIL) return;
  D[u]=d;
  setDepth(T[u].left,d+1);
  setDepth(T[u].right,d+1);
}

int setHeight(int u){
  int h1=0,h2=0;
  if(T[u].left!=NIL){
    h1=setHeight(T[u].left)+1;
  }
  if(T[u].right!=NIL){
    h2=setHeight(T[u].right)+1;
  }
  return H[u]=(h1>h2 ? h1 : h2);
}

int getSibling(int u){
  if(T[u].parent==NIL){
    return NIL;
  }
  if(T[T[u].parent].left!=u && T[T[u].parent].left!=NIL){
    return T[T[u].parent].left;
  }
  if(T[T[u].parent].right!=u && T[T[u].parent].right!=NIL){
    return T[T[u].parent].right;
  }
  return NIL;
}

void print(int u){
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  int deg=0;
  if(T[u].left!=NIL){
    deg++;
  }
  if(T[u].right!=NIL){
    deg++;
  }
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);

  if(T[u].parent==NIL){
    printf("root\n");
  }
  else if(T[u].left==NIL && T[u].right==NIL){
    printf("leaf\n");
  }
  else{
    printf("internal node\n");
  }
}

int main(){
  int i,v,l,r,root=0;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].parent=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d%d%d",&v,&l,&r);
    T[v].left=l;
    T[v].right=r;
    if(l!=NIL){
      T[l].parent=v;
    }
    if(r!=NIL){
      T[r].parent=v;
    }
  }

  for(i=0;i<n;i++){
    if(T[i].parent==NIL){
      root=i;
    }
  }
    setDepth(root,0);
    setHeight(root);

    for(i=0;i<n;i++){
      print(i);
    }
    return 0;
}



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

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

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

    long long sum = 0;
	for(long long i = 0; i < n; i++){
        sum += a[i];
    }
    
    if(sum >= h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1024
N = int(input())

S = []

import collections

for i in range (0, N):
	S.append(str(input()))

S = sorted(S)
cnt = collections.Counter()

for word in S:
	cnt[word] += 1
    
mostCommon = cnt.most_common()

D = mostCommon[0][1]
print(mostCommon[0][0])
for i in range(1, len(set(S))):
	if mostCommon[i][1] == D:
		print(mostCommon[i][0])
	else:
		exit()

Measured memory_bytes: 63276
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <chrono>
#include<assert.h>
#define MAX 1000001
#define pii pair<int, int>
#define F first
#define S second
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define forn(i, n) for (long long i = 0; i < long long(n); ++i)
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
inline bool is_palindrome(const string &s) { return std::equal(s.begin(), s.end(), s.rbegin()); }
struct knap{
    int num,weight;
};
int32_t main()
{
auto start = chrono::high_resolution_clock::now();
IOS
int n,we;
cin>>n>>we;
vector<int> dp(we+1,0);
int weight,value;
cin>>weight>>value;
for(int i=weight;i<=we;i++)
dp[i] = value;
for(int i=0;i<n-1;i++){
    int weight,value;
    cin>>weight>>value;
    for (int j = we- weight; j >=0; j--)
    {
        dp[j+weight] = max(dp[j+weight],dp[j] + value);
    }
}
// for(auto a : dp)
// cout<<a<<" ";
// cout<<endl;
cout<<dp[we]; 
auto end = chrono::high_resolution_clock::now();
double time_taken = chrono::duration_cast<chrono::nanoseconds>(end - start).count();
time_taken *= 1e-9;
//cout << fixed << time_taken;
return 0;
}

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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;

typedef pair<int,int>   ii;

vector<int> vec[N];

int tr[N << 1];
int lz[N << 1];

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

    int n;  cin >> n;
    int m;  cin >> m;   m += 1;

    auto app = [&](int i,int v) {
        tr[i] += v;
        lz[i] += v;
    };
    auto upd = [&](int l,int r,int v)   {
        int L = l += m - 1;
        int R = r += m - 1; ++r;

        for(; l < r ; l >>= 1, r >>= 1) {
            if (l & 1)  app(l++,v);
            if (r & 1)  app(--r,v);
        }
        for(; L > 1 ; L >>= 1)  tr[L >> 1] = max(tr[L],tr[L ^ 1]) + lz[L >> 1];
        for(; R > 1 ; R >>= 1)  tr[R >> 1] = max(tr[R],tr[R ^ 1]) + lz[R >> 1];
    };

    for(int i = 0 ; i < n ; ++i)    {
        int l;  cin >> l;
        int r;  cin >> r;

        vec[l].pb(r);
    }
    int ans = max(0,n - m + 1);

    for(int i = 1 ; i <= m ; ++i)   upd(i,i,i - m);
    for(int i = 0 ; i <  m ; ++i)   {
        for(int r : vec[i])
            upd(1,r,1);
        
        if (ans < tr[1] - i)
            ans = tr[1] - i;
    }
    cout << ans << endl;
}

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

int main() {
  int N; cin >>N;
  vector<double> v(N);
  rep(i,0,N) cin >>v[i];

  sort(v.begin(),v.end());
  double ans=v[0];
  rep(i,1,N) ans=(ans+v[i])/2;
  cout <<ans <<endl;
  return 0;
}


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

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPS(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;

const ll INF = 1e18;
const ll MOD = 1e9+7;

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

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n; cin >> n;
    cout << n << ":";
    for(int i = 2; i * i <= n; i++)
    {
        while(n % i == 0)
        {
            cout << " " << i;
            n /= i;
        }
    }     
    if(n != 1) cout << " " << n;
    cout << endl;
}


Measured memory_bytes: 3204
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Maybe

solve ts ds
  | VU.null ts = "YES"
  | (not $ VU.null ts) && (VU.null ds) = "NO"
  | otherwise =
    case compare t d of
      EQ -> solve (VU.tail ts) (VU.tail ds)
      GT -> solve ts (VU.tail ds)
      LT -> "NO"
  where
    t = VU.head ts
    d = VU.head ds
    

main = do
  n <- readLn :: IO Int
  ds <- VU.fromList . sort . map (fst . fromJust . B.readInt) . B.words <$> B.getLine
  m <- readLn :: IO Int
  ts <- VU.fromList . sort . map (fst . fromJust . B.readInt) . B.words <$> B.getLine
  putStrLn $ solve ts ds


Measured memory_bytes: 38268
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

int bad[N];
void solve()
{
	ll n;
	cin >> n;
	ll a[n], b[n];
	for(int i = 0; i < n; ++i){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n);
	map<int, int> mp;
	for(int i = 0; i < n; ++i){
		mp[b[i]] = i;
	}
	
	for(int i = 0; i < n; ++i){
		if(mp[a[i]] < (n + 1) / 2){
			cout << b[(n) / 2];
		}
		else cout << b[(n - 1) / 2];
		cout << '\n';
	}
}


 
 
int main()
{
    Red;
  	//int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 14464
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int N, M, k, u;
    cin >> N >> M;
    vector<int> ve[M];
    int p[M];
    for(int i = 0; i < M; i++) {
        cin >> k;
        while(k--) {
            cin >> u;
            ve[i].push_back(u - 1);
        }
    }
    for(int i = 0; i < M; i++) {
        cin >> p[i];
    }

    int ans = 0;
    for(int bmask = 0; bmask < (1 << N); bmask++) { // duyệt combination state của công tắc
        bool isOn = true;
        for(int i = 0; i < M && isOn; i++) { // duyệt bóng đèn
            int bState = 0;
            for(int &v : ve[i]) {
                bState ^= (bmask >> v & 1);
            }
            if(bState != p[i]) {
                isOn = false;
            }
        }
        if(isOn) {
            ans++;
        }
    }
    cout << ans;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  int bai = 1;
  set<int> ams;
  while(1) {
    int sum = a * bai;
    int am = sum % b;
    if(am == c) {
      cout << "YES" << endl;
      return 0;
    }
    if(ams.count(am)) {
      cout << "NO" << endl;
      return 0;
    }
    ams.insert(am);
    bai++;
  }
}

Measured memory_bytes: 256