akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

// D - Patisserie ABC
ll N, M;
ll a[1010][3];
ll ans = -500000;

int main(){
    cin >> N >> M;
    rep(i, 0, N){
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }

    ll L = 3;
    // 2^L - 1回の全探索
    for(ll i=0;i<1<<L;++i){
        vector<ll> sum;
        ll r;
        rep(j, 0, N){
            ll tmpsum=0;
            for(r=0;r<L;++r){
                ll tmp=1;
                if((i & (1 << r)) != 0){
                    tmp=-1;
                }
                tmpsum += a[j][r]*tmp;
            }
            sum.push_back(tmpsum);
        }
        sort(all(sum), greater<ll>());
        ll tmpans = 0;
        rep(k, 0, M){
            tmpans += sum[k];
        }
        ans = max(ans, tmpans);
    }

    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)
struct DSU
{
    int n,x;
    vi p,r,sz;
    DSU(int N){
        n=N;x=N-1;sz.assign(N,1);p.assign(N,0);r.assign(N,1);
        for(int i=0;i<N;i++)p[i]=i;
    }
    int find(int i){return (p[i]==i)?i:(p[i]=find(p[i]));}
    bool sameset(int i,int j){return find(i)==find(j);}
    void join(int i,int j)
    {
        int p1=find(i);int p2=find(j);
        if(p1!=p2){
            x--;
            if(r[p1]>=r[p2]){
                p[p2]=p1;
                sz[p1]+=sz[p2];
                if(r[p1]==r[p2])
                    r[p1]++;
            }
            else{
                p[p1]=p2;
                sz[p2]+=sz[p1];
            }
        }
    }
    void debug(){for(int it:p)cout<<it<<' ';cout<<endl;}
    int getsize(int i){return sz[find(i)];}
    int noOfSets(){return x;}
};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m,y,z;
    cin>>n>>m;
    DSU foo(n);
    vvi lang(m);
    for(int i=0;i<n;i++){
        cin>>x;
        for(int j=0;j<x;j++){
            cin>>y;
            y--;
            lang[y].pb(i);
        }
    }
    for(int i=0;i<m;i++){
        for(int j=1;j<lang[i].size();j++){
            foo.join(lang[i][j], lang[i][j-1]);
        }
    }
    cout<<(foo.noOfSets()?"NO":"YES");
    


    return 0;
}

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

using namespace std;

#define pb push_back
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

const double eps = 1e-10;
const int MOD = 1000000007;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, s.size()) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  while(1) {
    int n, m, a; cin >> n >> m >> a;
    if(n==0 && m==0 && a==0) break;
    vector<pair<int, P>> l(m);
    REP(i, m) {
      cin >> l[i].fi >> l[i].se.fi >> l[i].se.se;
    }
  
    sort(ALL(l), greater<pair<int, P>>());
  
    int win = a;
    int h = l[0].fi+1;
    REP(i, m) {
      if(win == l[i].se.fi && h > l[i].fi) {
        win = l[i].se.se;
        h = l[i].fi;
      } else if(win == l[i].se.se && h > l[i].fi) {
        win = l[i].se.fi;
        h = l[i].fi;
      }
    }

    cout << win << endl;
  }
}



Measured memory_bytes: 3080
#define _GLIBCXX_DEBUG       // Iterator safety; out-of-bounds access for Containers, etc.
#pragma GCC optimize "trapv" // abort() on (signed) integer overflow.
#pragma GCC optimize("O3")
#pragma GCC optimize("O1")
#pragma GCC optimize("O2")
#pragma GCC optimize("Os")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
}
int main()
{
    vok();
    ll n,k;
    IN n>>k;
    vll a(n);
    bitset<50> b[n];
    loop(i,0,n)
    {
        IN a[i];
        bitset<50> temp(a[i]);
        b[i]=temp;
    }
    bitset<50> ans(0);
    rloop(i,49,0)
    {
        int countt=0;
        loop(j,0,n)
        {
            if(b[j][i])
            {
                countt++;
            }
          	//cout<<"";
        }
        ans[i]=1;
        if((countt*2)<n && ans.to_ullong()<=k)
        {
            //Do Nothing
        }
        else
        {
            ans[i]=0;
        }
    }
    ll fans=0LL;
    ll X=ans.to_ullong();
    loop(i,0,n)
    {
      	//cout<<"";
        fans+=(X^a[i]);
    }
    OUT fans<<endl
    return 0;
}


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

using namespace std;


int  main() {

	long w, a, b, aend, bend;
	cin >> w >> a >> b;

	aend = a + w, bend = b + w;


	if ((a<=b&&b <= aend) ||(b<=a&&a<=bend)) {
		cout << "0" << endl;
		return 0;
	}
	cout << min(abs(b - aend), abs(bend - a)) << endl;

}

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

using namespace std;

typedef long long ll;

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

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

int main(void) {
    int N;
    cin >> N;

    // title, length
    vector<pair<string, int>> songs(N);
    for (int i = 0; i < N; i++) {
        string s;
        int t;
        cin >> s >> t;
        songs[i] = {s, t};
    }

    string X;
    cin >> X;

    int i;
    for (i = 0; i < N; i++) {
        if (songs[i].first == X) {
            break;
        }
    }

    int ans = 0;
    for (int j = i + 1; j < N; j++) {
        ans += songs[j].second;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 764
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }.toMutableList()
    val b = readLine()!!.split(" ").map { it.toLong() }.toMutableList()
    var ans = 0L
    for (i in 0 until n) {
        ans += Math.min(a[i], b[i])
        b[i] = Math.max(0, b[i]-a[i])
        ans += Math.min(a[i+1], b[i])
        a[i+1] = Math.max(0,a[i+1]-b[i])
    }
    println(ans)
}


Measured memory_bytes: 85088
N = int(input())
A=[-1]
A.extend([int(a) for a in input().split()])

ans = {}
ret = []

def get_xor(frm):
    global ans
    i = frm *2
    re = 0
    while i < len(A):
        re = re ^ ans[i]
        i += frm
    return re

for i in range(1,len(A)):
    ri = len(A) - i
    if 2 * ri < len(A):
        # recursive search
        ans[ri] = A[ri] ^ get_xor(ri)
        if ans[ri]==1:
            ret.append(str(ri))
        pass
    else:  # only one
        ans[ri] = A[ri]
        if ans[ri]==1:
            ret.append(str(ri))
print(len(ret))
s = " ".join(ret)
if s:
    print(s)

Measured memory_bytes: 101360
//minamoto
#include<bits/stdc++.h>
#define R register
#define int long long
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=5e5+5;
struct eg{int v,nx;}e[N<<1];int head[N],tot;
inline void add(R int u,R int v){e[++tot]={v,head[u]},head[u]=tot;}
int sum[N],n,q;
void dfs(int u,int fa){sum[u]+=sum[fa];go(u)if(v!=fa)dfs(v,u);}
signed main(){
	scanf("%lld%lld",&n,&q);
	for(R int i=1,u,v;i<n;++i)scanf("%lld%lld",&u,&v),add(u,v),add(v,u);
	for(R int i=1,u,x;i<=q;++i)scanf("%lld%lld",&u,&x),sum[u]+=x;
	dfs(1,0);
	fp(i,1,n)printf("%lld%c",sum[i]," \n"[i==n]);
	return 0;
}

Measured memory_bytes: 22528
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vint d(n,0);
    vint a(n);
    vvint cld(n);
    a[0]=-1;
    for(int i=1;i<n;i++){
        cin >> a[i];
        a[i]--;
        cld[a[i]].pb(i);
    }
    
    vint cn(n,0);
    queue<int> q;
    REP(i,n){
        cn[i]=(int)cld[i].size();
        d[i] = (int)cld[i].size();
        if(cn[i]==0){
            q.push(i);
        }
    }
    vvint cd(n);
    while(!q.empty()){
        int now = q.front();
        q.pop();
        sort(rALL(cd[now]));
        REP(i,(int)cld[now].size()){
            d[now] = max(d[now], cd[now][i]+i+1);
        }
        int p = a[now];
        if(p==-1) break;
        cd[p].pb(d[now]);
        cn[p]--;
        if(cn[p]==0) q.push(p);
    }
    cout << d[0] << endl;
    return 0;
}

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

/* define*/
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( i = a, i < b ; i++)
#define REP(i, n) for ( i = 0; i < n ; i++)
#define DER(i, n) for ( i = 0; n ; i--)
#define max(a,b) (a > b) ? a : b
#define min(a,b) (a < b) ? a : b

/* const */
const int MOD = 1e9 + 7;

/* alias */
typedef long long ll;

/* function */
int cmp(const int *a, const int *b) {
	return *a - *b;
}
int cmp2(const int *a, const int *b) {
	return *b - *a;
}

//* main */

int main() {
	int n, i, j;
	ll c, r = 1;
	char s[100000];
	scanf("%d%s", &n, s);
	REP(i, 26) {
		c = 0;
		REP(j, n)if (s[j] == 'a' + i)c++;
		r *= c + 1;
		r %= MOD;
	}
	printf("%lld\n", r - 1);
	return 0;
}

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

#define ll long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010
 
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}

void swapl(ll* a,ll* b){ll tmp=*a;*a=*b;*b=tmp;}
ll absl(ll a){if(a<0)return -a;return a;}
ll dupl(ll a,ll d){if(a%d==0)return a/d;else return a/d+1;}
ll modl(ll a,ll m){if(a<0)return a%m+m;else return a%m;}

ll GCD(ll a,ll b){ll c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
ll LCM(ll a,ll b){return a*b/GCD(a,b);}

ll factorial(ll n, ll m) {return n < m ? 1 : n*factorial(n-1, m);}

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

// ll dp[]

struct slist
{
    int index;
    struct slist *next;
};

typedef struct slist list;


list *putV(list *v, int go){
    list *u = (list *)malloc(sizeof(int));
    u->index = go;
    u->next = v;
    return u;
}

int getV(list **v){
    if(*v == NULL) return -1;
    int a = (*v)->index;
    list *u = *v;
    (*v) = (*v)->next;
    
    // free(u);
    return a;
}

int isNull(list *v){return v == NULL;}

list *V[100001];
int ans[1000001];
int che[1000001];
int n , m;
int checkn;

void sol(list *s, int d){
    int a, b;
    list *next_s=NULL;
  if(checkn == n) return;

    while (!isNull(s))
    {
        a = getV(&s);
        while(!isNull(V[a])){
            b = getV(&V[a]);
            if(che[b] == 0){
                ans[b] = a;
                next_s = putV(next_s, b);
                che[b]++;
              checkn++;
            }
        }
    }

    return sol(next_s, d+1);
}

int main(){
    int a, b;
    list first;

    for (int i = 0; i < 100001; i++)
    {
        V[i] = NULL;
    }

    scanf("%d%d", &n, &m);
    
    for (int i = 0; i < m; i++)
    {
        scanf("%d%d", &a, &b);
        V[a] = putV(V[a], b);
        V[b] = putV(V[b], a);
    }

    first.index = 1;
    first.next = NULL;
    sol(&first, 1);

    printf("Yes\n");

    for (int i = 2; i <= n; i++)
    {
        printf("%d\n", ans[i]);
    }
    
    return 0;
}

Measured memory_bytes: 18876
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
using ll = long long;
using namespace std;
ll n,k,s=0,a[550],b[550],ans=0;
ll f(ll w) {
    ll s2 = 0,s3 = 0;
    rep(i,0,n) {
	    b[i] = a[i] % w;
	    s2 += b[i];
	} 
    sort(b,b+n);
    rep(i,0,n-s2/w) s3 += b[i];
    if(s3 <= k) return w;
    else return 0;
}
int main(){
    cin >> n >> k;
    rep(i,0,n) {
	    cin >> a[i];
		s += a[i];
	}
    for(ll p=1;(p*p)<=s;p++) if(s % p == 0) {
        ans = max(ans,f(p));
        if(s % p == 0)ans = max(ans,f(s/p));
    }
    cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
priority_queue<long long> que;
#define ll long long
int main()
{
    int m,n,i;
    ll x;
    scanf("%d %d",&n,&m);
    while(n--)
    {
        scanf("%lld",&x);
        que.push(x);
    }
    while(m--)
    {
        ll t=que.top();
        que.pop();
        t/=2;
        que.push(t);
    }
    ll ans=0;
    while(!que.empty())
    {
        ll t=que.top();
        que.pop();
        ans+=t;
    }
    printf("%lld\n",ans);
    return 0;
}



Measured memory_bytes: 1528
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return


ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////


int main(){
    ll n,a,b;
    cin >> n >> a >> b;

    ll ans = modpow(2,n) - 1;

    ll aa = 1,aaa = 1;
    rep(i,0,a){
	aa *= n-i;
	aa = mod(aa);
	aaa *= i+1;
	aaa = mod(aaa);
    }
    aa = divm(aa , aaa);

    ll bb = 1,bbb = 1;
    rep(i,0,b){
	bb *= n-i;
	bb = mod(bb);
	bbb *= i+1;
	bbb = mod(bbb);
    }
    bb = divm(bb,bbb);

    // PS(ans);PS(aa);P(bb);
    
    ans -= aa;
    ans = mod(ans + ll(1e9+7));
    ans -= bb;
    ans = mod(ans + ll(1e9+7));
    P(ans);
    return  0;
}


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

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

    int ans = n, a[m];
    for (int i=0;i<m;i++) {
        cin >> a[i];
        ans = ans - a[i];
    }
    if (ans >= 0) {
        cout << ans;
    } else {
        cout << "-1";
    }
}


Measured memory_bytes: 3664
#include<stdio.h>
int main()
{
	int n,k;
	scanf("%d %d",&n,&k);
	char s[100005];
	scanf("%s",s);
	int count=0;
	int i;
	for(i=0;i<n;i++)
		if(s[i]=='0')
			count++;
	if(count==0)
	{
		printf("%d\n",n);
		return 0;
	}
	int sta[100005],fin[100005];
	int m=0;
	if(s[0]=='0')
		sta[m]=0;
	for(i=1;i<n;i++)
	{
		if(s[i-1]=='1' && s[i]=='0')
			sta[m]=i;
		if(s[i-1]=='0' && s[i]=='1')
		{
			fin[m]=i-1;
			m++;
		}
	}
	if(s[n-1]=='0')
	{
		fin[m]=n-1;
		m++;
	}
	int ans=0;
	int start,finish;
	for(i=0;i<m;i++)
	{
		if(i==0)
			start=0;
		else
			start=fin[i-1]+1;
		if(i+k<m)
			finish=sta[i+k]-1;
		else
			finish=n-1;
		if(ans<finish-start+1)
			ans=finish-start+1;
	}
	printf("%d\n",ans);
	return 0;
}

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

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

    int x, n; cin >> x >> n;
    if (n==0) {
        cout << x << endl;
        return 0;
    }
    vector<int> p(n,0); for (int i=0;i<n;i++) cin >> p[i];

    int diff = 10000000;
    int ans = 0;


    sort(p.begin(), p.end());

    for (int i=0; i<=101; i++)
    {
        if (find(p.begin(), p.end(), i) != p.end()) continue;
        else {
            if (diff>abs(x-i)) { diff = abs(x-i), ans = i; }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1e9+7
using namespace std;
typedef long long ll;

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

    if(s[0]==t[2]&&s[2]==t[0]&&s[1]==t[1]){
        cout<<"YES";
    }else{
        cout<<"NO";
    }
}

Measured memory_bytes: 256
mod = 10**9 + 7
fac = []
pw = []

fac.append(1 % mod)
pw.append(1 % mod)
for i in range(1, 1001):
    fac.append(fac[i-1]*i % mod)

for i in range(1, 1001):
    pw.append(pow(fac[i], mod-2, mod))

n, k = [int(s) for s in input().split()]
if n > k:
    print(0)
else:
    print(fac[k] * pw[k-n] % mod)



Measured memory_bytes: 5624
#include <iostream>
#include <cstdlib>
#include<ctime>
#include<math.h>
#include<string>
using namespace std;



int main(){
    int x, y;
    cin >> x >> y;
    while( x>0 || y>0 ){
       if(x>=y){
           cout << y << " "<< x << endl;
       } 
       else cout << x << " "<< y << endl;
    
        cin >> x >> y;
    }
   
    
     return 0;
}


Measured memory_bytes: 3000
N = int(input())
AB = []
for n in range(N):
    AB.append(list(map(int,input().split())))
AB = sorted(AB, key=lambda x: (x[1],x[0]))
time = 0
result = True
for n in range(N):
    if AB[n][1] < time + AB[n][0]:
        result = False
        break
    else:
        time += AB[n][0]
print("Yes") if result else print("No")

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N, 0);
    for (int i=1; i<N; i++){
        int a;
        cin >> a;
        a--;
        A[a]++;
    }
    for (auto a : A){
        cout << a << endl;
    }
    return 0;
}


Measured memory_bytes: 4048
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (3e15)

using namespace std;

int N, A[200005], sum[200005];

typedef pair<int, int> P;
P digit[30];

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

    cin >> N;
    REP(i, N) cin >> A[i];

    int r = 0;
    int ans = 0;
    int xsum = 0;
    REP(l, N) {
        while (r < N) {
            int ra = A[r];
            if ((xsum ^ ra) != (xsum + ra)) break;
            xsum ^= ra;
            ++r;
        }
        ans += r - l;
        xsum ^= A[l];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int a = ir.nextInt();
		int p = ir.nextInt();
		out.println((a * 3 + p) / 2);
	}

	public static void main(String[] args) {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}

	static void tr(Object... o) {
		out.println(Arrays.deepToString(o));
	}
}


Measured memory_bytes: 22740
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	 ll h,n,i,j;cin>>h>>n;vpi v(n);for(i=0;i<n;i++) cin>>v[i].fs>>v[i].se;
	 vi d(h+1,1e18);d[0]=0;
	 for(i=1;i<=h;i++){
		 for(j=0;j<n;j++) if(i<=v[j].fs) d[i]=min(d[i],v[j].se); else d[i]=min(d[i],d[i-v[j].fs]+v[j].se);
	 }cout<<d[h]<<endl;
}



Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var nm = ReadLine().Split().Select(int.Parse).ToArray();
        var n = nm[0];
        var m = nm[1];
        if (n > 1 && m > 1)
        {
            WriteLine((long)n * m - (long)(n + m - 2) * 2);
        }
        else
        {
            if (n == 1)
            {
                WriteLine(m> 2 ? m - 2 :m==2?0:1);
            }
            else
            {
                WriteLine(n> 2 ? n - 2 :n==2?0:1);
            }
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> H(n);
    for (auto &&i : H) scanf("%d", &i);
    vector<vector<int>> G(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        a--; b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int ok = 1;
        for (auto &&j : G[i]) {
            if(H[j] >= H[i]) ok = 0;
        }
        ans += ok;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 8864
#include<stdio.h>
#include<stdio.h>

int main(){
  int L,N,i,j;
  scanf("%d %d",&N,&L);
  char S[N][L+1];
  char tmp[N];
  for(i=0;i<N;i++){
      scanf("%s",S[i]);
  }
  for(i=0;i<N-1;i++){
    for(j=N-1;j>i;j--){
      if(strcmp(S[j-1],S[j])>0){
        strcpy(tmp,S[j-1]);
        strcpy(S[j-1],S[j]);
        strcpy(S[j],tmp);
      }
    }
  }
for(i=0;i<N;i++)
printf("%s",S[i]);
return 0;
}

Measured memory_bytes: 128
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}
int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n;
	cin>>n;
	msi mp;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		mp[s]++;
	}
	int mx=INT_MIN;
	vs g;
	for(auto it=mp.begin();it!=mp.end();it++)
	{
		if(it->second>mx)
		{
			g.clear();
			g.pb(it->first);
			mx=it->second;
		}
		else if(it->second==mx)
			g.pb(it->first);
	}
	for(int i=0;i<g.size();i++)
		cout<<g[i]<<endl;

}
signed main()
{
	fastio;
//	test
		solve();
}




Measured memory_bytes: 25584
#include <stdio.h>
#include <string.h>

int main(){
	int i, j;
	 char A[100], B[100], C[100];
	 scanf("%s %s %s", A, B, C);
	 
	 if (A[strlen(A)-1] == B[0] && B[strlen(B)-1] == C[0]){
	 	printf("YES\n");
	 } else {
	 	printf("NO\n");
	 }
	
	return 0;
}

Measured memory_bytes: 1628
h, w, k = [int(x) for x in input().split()]

calc_table = [[0 for i in range(w)] for j in range(h)]
calc_total = 0
for i in range(h):
    line = [1 if x == '#' else 0 for x in list(input())]
    for j in range(w):
        calc_table[i][j] = line[j]
        calc_total += line[j]

num = 0
for hb in range(2**h):
    for wb in range(2**w):
        total = calc_total

        for i in range(h):
            selected_h = True if ((hb >> i) & 1) == 1 else False
            for j in range(w):
                selected_w = True if ((wb >> j) & 1) == 1 else False
                if selected_h or selected_w:
                    total -= calc_table[i][j]

        if total == k:
            num += 1

print(num)


Measured memory_bytes: 9160
#include<iostream>
#include<algorithm>
#include<complex>
#include<iomanip>
using namespace std;
int main(){
	double a,b,c,d,e,f,x,y;
	int t=90000;
	for(int i=t;i;i--){
		for(int j=i;j;j--){
			if(i+j==2)a=0.0;
		}
	}
	while(cin>>a){cin>>b>>c>>d>>e>>f;
		x=(c*e-b*f)/(a*e-b*d),y=(c*d-a*f)/(b*d-a*e);
		if(x==-0)x=0;if(y==-0)y=0;
		cout<<fixed<<setprecision(3)<<x<<" ";
		cout<<fixed<<setprecision(3)<<y<<endl;
	}
	return 0;
}

Measured memory_bytes: 3268
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
	static int N;
	static int M;
	static int[] Pcity;
	static int[] Ycity;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		M = sc.nextInt();
		Pcity = new int[M];
		Ycity = new int[M];
		Map<Integer,Map<Integer,Integer>> PYcityMap = new HashMap<Integer,Map<Integer,Integer>>();
		
		//组装结构
		for(int i=0;i<M;i++){
			Pcity[i] = sc.nextInt();
			Ycity[i] = sc.nextInt();
			Map<Integer,Integer> maptemp = PYcityMap.get(Pcity[i]);
			if(null == maptemp){
				Map<Integer,Integer> PYcityMaptemp = new HashMap<Integer,Integer>();
				PYcityMaptemp.put(Ycity[i], 0);
				PYcityMap.put(Pcity[i], PYcityMaptemp);
			}
			else
			{
				maptemp.put(Ycity[i], 0);
				PYcityMap.put(Pcity[i], maptemp);
			}
		}
		
		//区域内排序
		for(Integer maxMapKey:PYcityMap.keySet()){
			Map<Integer,Integer> temp = sortMapByKey(PYcityMap.get(maxMapKey));
			int index=1;
			for(Integer minMapKey:temp.keySet()){
				temp.put(minMapKey,index++);
			}
			PYcityMap.put(maxMapKey, temp);
		}
		
		//输出
		for(int i=0;i<M;i++){
			System.out.println(mendPosition(Pcity[i])+mendPosition(PYcityMap.get(Pcity[i]).get(Ycity[i])));
		}
		
		sc.close();
	}
	
	 /**
     * 使用 Map按key进行排序
     * @param map
     * @return
     */
    public static Map<Integer,Integer> sortMapByKey(Map<Integer,Integer> map) {
        if (map == null || map.isEmpty()) {
            return null;
        }

        Map<Integer,Integer> sortMap = new TreeMap<Integer,Integer>(
                new PY1MapKeyComparator());
        
        sortMap.putAll(map);

        return sortMap;
    }
    
    private static String mendPosition(int num){
    	String numTemp = String.valueOf(num);
    	String strnum = "";
    	for(int i=0;i<6-numTemp.length();i++){
    		strnum += "0";
    	}
    	strnum = strnum+numTemp;
    	return strnum;
    }
    
}

class PY1MapKeyComparator implements Comparator<Integer>{

    @Override
    public int compare(Integer str1, Integer str2) {
        
        return str1.compareTo(str2);
    }
}

Measured memory_bytes: 131560
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n,q;
	int box[1000];
	int i;
	int a,b;
	cin>>n;
	for(i=0;i<n;i++)	cin>>box[i];
	cin>>q;
	for(i=0;i<q;i++){
		cin>>a>>b;
		reverse(box+a,box+b);
	}
	for(i=0;i<n;i++){
		if(i)	cout<<" ";
		cout<<box[i];
	}
	cout<<endl;
}


Measured memory_bytes: 3120
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

#define ALL(set) (set).begin(), (set).end()

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	int a, b;
	cin >> a >> b;
	for(int i = a / 0.08; i <= 1250; ++i) if(static_cast<int>(i * 0.08) == a && static_cast<int>(i * 0.1) == b) return cout << i << '\n', 0;
	cout << -1 << '\n';
}

Measured memory_bytes: 3640
def palace(N: int, T: int, A: int, H: list) -> int:
    best_t = float('inf')
    best_i = 0

    for i, h in enumerate(H):
        t = T - 0.006*h
        if abs(A - best_t) > abs(A - t):
            best_t = t
            best_i = i

    return best_i + 1


if __name__ == "__main__":
    N = int(input())
    T, A = map(int, input().split())
    H = map(int, input().split())
    ans = palace(N, T, A, H)
    print(ans)


Measured memory_bytes: 3060
n = int(input())
k = {}
k['AC'] =0
k["TLE"]=0
k["WA"]=0
k["RE"]=0
for i in range(n):
    a = str(input())
    #print(a)
    if a in k:
        k[a]+=1
print("AC x {}".format(k['AC']))
print("WA x {}".format(k['WA']))
print("TLE x {}".format(k['TLE']))
print("RE x {}".format(k['RE']))

Measured memory_bytes: 9188
#include <stdio.h>
#define H 255

typedef struct{
  int key;
  int p;
  int l;
  int r;
}Node;

void insert(Node *,int *,int );
void Print(Node *,int );

int main(){
  int n,i,data[H];
  Node heap[H];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&data[i]);
    heap[i].p=0;
    heap[i].l=1;
    heap[i].r=1;
  }
  insert(heap,data,n);
  Print(heap,n);

  
  return 0;
}

void insert(Node *heap,int *data,int n){
  int i,x;
  for(i=0;i<n;i++){
    x=i+1;
    heap[i].key=data[i];
    if(x/2>=1){
      heap[i].p=x/2;
    }
    heap[i].l=x*2;
    heap[i].r=x*2+1;
  }
}

void Print(Node *heap,int n){
  int i,x;

  for(i=0;i<n;i++){
  printf("node %d: key = %d, ",i+1,heap[i].key);
  if(heap[i].p!=0&&heap[i].p-1<n){
    x=heap[i].p-1;
    printf("parent key = %d, ",heap[x].key);
  }
  if(heap[i].l-1!=0&&heap[i].l-1<n){
    x=heap[i].l-1;
    printf("left key = %d, ",heap[x].key);
  }
  if(heap[i].r-1!=0&&heap[i].r-1<n){
    x=heap[i].r-1;
    printf("right key = %d, ",heap[x].key);
  }
  printf("\n");
  }
}
      



Measured memory_bytes: 2056
#include <stdio.h>

int main(void) {
  int n, x;
  scanf("%d%d", &n, &x);
  int m[n];
  int i;
  int min = 10000;
  int r = 0;
  for(i = 0; i < n; i++) {
    scanf("%d", &m[i]);
    if(m[i] < min) min = m[i];
    r += m[i];
  }
  printf("%d\n", n + (x - r) / min);
  return 0;
}

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

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

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

    int sum = accumulate(a, a + n, 0);
    int min = (int) ceil((float)sum / (float)(4*m));

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (min <= a[i]) cnt++;
    }

    cout << (cnt >= m ? "Yes" : "No") << endl;
    
    return 0;
}

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

int main(){
int N,M,C,ans=0;
  cin>>N>>M>>C;
  vector<int>B(M);
  vector<int>A(M);
  for(int i=0 ;i<M;i++){
    cin>>B.at(i);
  }
  for(int i=0;i<N;i++){
    int t=0;
    for(int k=0;k<M;k++){
    cin>>A.at(k);
      t+=A.at(k)*B.at(k);
    }
    if(t>-C)
      ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = n; i >= 0; i--)
#define For(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef long double ld;
using namespace std;
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
template <class T = int> T in(){T x; cin >> x; return (x);}

int main(void){
    ll result = 5;
    ll N;
    scanf("%llu", &N);
    
    vector<ll> vehicle;
    rep(i, 5){
        ll x;
        scanf("%llu", &x);
        vehicle.push_back(x);
    }
    
    ll min = *min_element(ALL(vehicle));
    ll temp = N / min;
    if(N % min != 0){
        temp ++;
    }
    
    if(temp != 0){
        result = 4 + temp;
    }
    
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
li = na()
ls = []
list.sort(li)
for i in range(len(li) - 1):
    ls.append(li[i + 1] - li[i])
ls = sorted(ls, reverse=True)
print(sum(ls[n-1:]))

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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

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

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}


void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int n ;

int main(){
   cin >> n ;
   vector < int > a( n ) ;
   forn( int , i , 0 , n )
       cin >> a[ i ] ;

   sort( all( a ) ) ;
   cout << a.back() - a.front() ;

   return 0 ;
}


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

int main() {
  int K,S;
  int ans=0;
  cin>>K>>S;
  for(int i=0;i<K+1;i++){
    for(int j=0;j<K+1;j++){
        if(S-i-j<=K&&S-i-j>=0)
          ans++;
    }
  }
     
  cout << ans << endl;
}


Measured memory_bytes: 256
//  ROAD TO GREEN
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <queue>
#include <set>

#define ll long long
#define uint unsigned int
#define ull unsigned ll


using namespace std;
const ll MAXN = 2e9+2;
const ll SIZE = 2e5+10;

bool cmp(pair<int,int> a, pair<int,int> b){
	if(a.second < b.second)
	return true;
	else return false;
}

int main(){
	int n; cin >> n;
	vector<pair<int,int>> v;
	for(int i = 1; i <= n; i++){
		int x; cin >> x;
		v.push_back(make_pair(i,x));
	}
	sort(v.begin(), v.end(),cmp);
	for(int i = 0; i < v.size(); i++){
		cout << v[i].first << " ";
	}
	return 0;
}
// 1 | 2 3 | 4
// 1 2 | 3 4 | 5 6
// 1 2 3 | 4 5 6 7 | 8 9 10
// A B C   D E F G   H J K

Measured memory_bytes: 1780
n = int(input())
data =[0]* 1000000
data[0] = n
i = 2
if n % 2 == 0:
    data[1] = n //2
else:
    data[1] = 3 * n + 1
while data[i - 1] not in data[0: i -2]:
    if data[i-1] % 2 == 0:
            data[i] = data[i - 1]//2
    else:
            data[i] = 3 * data[i - 1] + 1
    i += 1
print(i)

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1000000000;

int main(){
   int N;cin >> N;
   int s = 0;
   int tmp = N;
   while(N){
      s += N % 10;
      N /= 10;
   }
   if(tmp%s == 0){
      cout << "Yes";
   }else{
      cout << "No";
   }
   return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u) {
	int v;
	color[u] = GRAY;
	d[u] = ++tt;
	for (v = 0; v < n; v++) {
		if (M[u][v] == 0)continue;
		if (color[v] == WHITE) {
			dfs_visit(v);
		}
	}
	color[u] = BLACK;
	f[u] = ++tt;
}

void dfs() {
	int u;
	for (u = 0; u < n; u++)color[u] = WHITE;
	tt = 0;

	for (u = 0; u < n; u++) {
		if (color[u] == WHITE)dfs_visit(u);
	}
	for (u = 0; u < n; u++) {
		printf("%d %d %d\n", u + 1, d[u], f[u]);
	}
}

int main() {
	int u, v, k, i, j;

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

	for (i = 0; i < n; i++) {
		scanf("%d %d", &u, &k);
		u--;
		for (j = 0; j < k; j++) {
			scanf("%d", &v);
			v--;
			M[u][v] = 1;
		}
	}

	dfs();

	return 0;
}


Measured memory_bytes: 2076