akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

int main() {
	FAST_IO();
	int N, M; cin >> N >> M;
	multiset<int> S;
	rep(i, N) {
		int x; cin >> x;
		S.insert(x);
	}
	rep(i, M) {
		auto it = S.end();
		int x = *(--it);
		S.erase(it);
		S.insert(x / 2);
	}
	ll ans = 0;
	for(auto &x : S) {
		ans += x;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 4992
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let k = get!(i64);

    let mut nn = Vec::new();
    for i in 0..50_i64 {
        nn.push(i);
    }
    let b = k/50;
    for i in 0..(50 as usize) {
        let d = if k%50 > (i as i64) { b + 1 } else { b };
        nn[i] += d * 50;
        for j in 0..(50 as usize) {
            if i != j {
                nn[j] -= d;
            }
        }
    }
    println!("50\n{}", nn.into_iter().map(|i| i.to_string()).collect::<Vec<_>>().join(" "));
}

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

int main() {
  int n;cin >> n;
  int o=0,e1= 0,e2 = 0; 
  for(int i = 0; i < n; ++i){
    int a;cin >> a;
    if(a%2==1){
      ++o;
    }
    else{
      if(a%4==0){
        ++e2;
      }
      else{
        ++e1;
      }
    }
  }
  if(e1== 0&& o>e2+1){
    cout << "No" << endl;
  }
  else if(e1!= 0&& o>e2){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
//ITNOA
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
const long long INF=1e9+10,MAX=2e5+1e4,MOD=1e9+7;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef pair<pii,ll> piii;
void OUT(long double o,int x){
	 cout<<fixed<<setprecision(x)<<o;
	 return;
}
ll a[MAX];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	cout<<"ABC"<<n;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define sh cin.tie(0); cin.sync_with_stdio(0); cout.tie(0);
#define FILE freopen("test.in", "r", stdin);
#define vprint(v) for (int ii = 0; ii < v.size(); ii++){cout << v[ii] << " ";}
#define debugv(v) if (v.size() != 0) {cout << "[ "; for (int __ = 0; __ < (int)(v.size()) - 1; __++){cout << v[__] << ", ";} cout << v[(int)(v.size()) - 1] << " ]" << endl;} else {cout << "[]" << endl;}
#define debug cout << "-----------------------------------------------" << endl;
#define print1(a) cout << "{ " << a << " }" << endl;
#define print2(a, b) cout << "{ " << a << ", " << b << " }" << endl;
#define print3(a, b, c) cout << "{ " << a << ", " << b << ", " << c << " }" << endl;
#define print4(a, b, c, d) cout << "{ " << a << ", " << b << ", " << c << ", " << d << " }" << endl;
using namespace std;
//#define int long long
const int INF = 1e9 + 228;
const int MAXN = 1e5 + 228;

signed main()
{
#ifdef LOCAL
    FILE;
#endif
    sh;
    int a, b;
    cin >> a >> b;
    string x = "", y = "";
    for (int i = 0; i < b; i++) {
    	x += (a + '0');
    }
    for (int i = 0; i < a; i++) {
    	y += (b + '0');
    }
    cout << min(x, y);
    return 0;
}


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

int main(){
    //整数Nの入力
    long long N=0;
    cin >> N;
    long long N2=N;

    //桁数・最上位ビットを取得
    int digit=0;
    int No1;
    while(N2!=0){
        if(N2<10 && N2!=0){
            No1=N2;
        }
        for(int i=9;i>=0;i--){
            if((N2-i)%10==0){
                N2=(N2-i)/10;
                digit++;
                break;
            }
        }
    }
    N2=N;

    //各桁の和の計算
    int max;
    int nine=0;
    while((N2-9)%10==0 && (N2-9)/10!=0){
        N2=(N2-9)/10;
        nine++;
    }
    //c9999かそうでないかを判断
    if(nine==(digit-1)){
        max=No1+9*nine;
    }
    else{
        max=No1-1+9*(digit-1);
    }

    //出力
    cout << max << "\n";

    return 0;
}

Measured memory_bytes: 256
/******************************************
* AUTHOR : Ashish Joshi* 
* INSTITUTION : NIT Hamirpur *
******************************************/
#include <bits/stdc++.h>
using namespace std;

#define N 100005
#define MOD 1000000007
#define PI 3.141592653589793

#define dd double
#define loop(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define set(b,i) (b|(1<<i))
#define unset(b,i) (b&!(1<<i))
#define cbit(b,i) bool(b&(1<<i))

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<ll> > vvll;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);
int n;
cin>>n;
cout<<(n+1)/2;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int mod=1e9+7;
void add(int &x,int y){
	x+=y;
	if(x>=mod) x-=mod;
}

int A,B,C,D,N;
map<string,int> mp;
string nam[50];
vector<string> vst[50];
int num[50][16];
int dp[201][52][52][52];

int main(){
	cin>>A>>B>>C>>D>>N;
	{
		string st;
		int I=-1;
		while(cin>>st){
			if(st.back()==':'){
				I++;
				nam[I]=st.substr(0,st.size()-1);
				mp[nam[I]]=I;
			}else{
				vst[I].pb(st);
			}
		}
	}
	for(int i=N-1;i>=0;i--){
		for(string st:vst[i]){
			if(st[0]=='['){
				int bit=0;
				for(char ch:st){
					if(ch=='A') bit|=1;
					if(ch=='T') bit|=2;
					if(ch=='G') bit|=4;
					if(ch=='C') bit|=8;
				}
				num[i][bit]++;
			}else{
				int id=mp[st];
				rep(j,16) num[i][j]+=num[id][j];
			}
		}
	}
	int S=0;
	rep(i,16) S+=num[0][i];
	if(S!=A+B+C+D){
		puts("0");
		return 0;
	}
	vector<int> bs;
	rep(i,16) rep(j,num[0][i]) bs.pb(i);
	dp[0][0][0][0]=1;
	rep(i,S){
		rep(a,A+1) rep(b,B+1) rep(c,C+1){
			int d=i-a-b-c;
			if(d<0||d>D) continue;
			int x=bs[i];
			rep(j,4){
				if((x>>j)&1) add(dp[i+1][a+(j==0)][b+(j==1)][c+(j==2)],dp[i][a][b][c]);
			}
		}
	}
	cout<<dp[S][A][B][C]<<endl;
}

Measured memory_bytes: 107812
n = int(input())
s = list(str(input()))
s = [int(c) for c in s]

d = {}
for i, c in enumerate(s):
    if c not in d:
        d[c] = [i]
    else:
        d[c].append(i)
#print(d)

ans = 0
import bisect
for i in range(10):
    for j in range(10):
        for k in range(10):
            if i not in d or j not in d or k not in d:
                continue
            a = min(d[i])
            b = max(d[k])
            p = bisect.bisect_right(d[j], a)
            q = bisect.bisect_left(d[j], b)
            if q-p >= 1:
                ans += 1
                #print(i, j, k)
print(ans)


Measured memory_bytes: 4616
#include<bits/stdc++.h>
using namespace std;
int n;
double c,h[222222],dp[222222];
pair<double,double> xx,yy,add;
deque<pair<double,double> > q;
double slope(pair<double,double> x,pair<double,double> y)
{
	return (y.second-x.second)/(x.first-y.first);
}
int main()
{
	scanf("%d%lf",&n,&c);
	for (int i=1;i<=n;i++)
	{
		scanf("%lf",&h[i]);
	}
	dp[1]=0.00;
	for (int i=2;i<=n;i++)
	{
		add=make_pair(-2*h[i-1],dp[i-1]+h[i-1]*h[i-1]);
		while(q.size()>1)
		{
			xx=q[(int)q.size()-1];yy=q[(int)q.size()-2];
			if (slope(yy,xx)>slope(xx,add)) q.pop_back();
			else break;
		}
		q.push_back(add);
		while(q.size()>1)
		{
			xx=q[0];yy=q[1];
			if (xx.first*h[i]+xx.second>yy.first*h[i]+yy.second) q.pop_front();
			else break;
		}
		xx=q[0];
		dp[i]=xx.first*h[i]+xx.second+h[i]*h[i]+c;
	}
	printf("%.0lf\n",dp[n]);
	return 0;
} 

Measured memory_bytes: 5632
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
    char a[5];
    scanf("%s",a);
    int flag=1;
    int c=0,d=0,e=0;
    for(int i=0;a[i]!='\0';i++)
    {
        if(a[i]=='a')
            c++;
        if(a[i]=='b')
            d++;
        if(a[i]=='c')
            e++;
        else
            flag=0;
    }
    if(c==1&&d==1&&e==1)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


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

using namespace std;

const int maxn = 100001;

int value[maxn][3];
int dp[maxn][3];

int main() {
    int N;
    while (cin >> N) {
        for (int i = 0; i < N; i++) {
            cin >> value[i][0] >> value[i][1] >> value[i][2];
        }
        dp[0][0] = value[0][0];
        dp[0][1] = value[0][1];
        dp[0][2] = value[0][2];
        for (int i = 1; i < N; i++) {
            dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + value[i][0];
            dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + value[i][1];
            dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + value[i][2];
        }
        cout << max(dp[N - 1][0], max(dp[N - 1][1], dp[N - 1][2])) << endl;
    }
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
// #define MOD 1000000007
#define MOD 998244353
#define MEM_SIZE 101010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template <typename T>
void DEBUG(T e)
{
  if (DEBUG_OUT == false)
    return;
  std::cout << e << " ";
}
template <typename T>
void DEBUG(const std::vector<T> &v)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &e : v)
  {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void DEBUG(const std::vector<std::vector<T>> &vv)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &v : vv)
  {
    DEBUG(v);
  }
}
template <class T, class... Ts>
void DEBUG(T d, Ts... e)
{
  if (DEBUG_OUT == false)
    return;
  DEBUG(d);
  DEBUG(e...);
}
template <class T>
void corner(bool flg, T hoge)
{
  if (flg)
  {
    cout << hoge << endl;
    abort();
  }
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//BELOW

void solve(void)
{
  int n;
  cin >> n;
  vector<int> a(n, 0);
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  vector<int> b(n, 0);
  set<pair<int, int>> st;
  for (int i = 0; i < n; i++)
  {
    cin >> b[i];
    st.insert({b[i], i});
  }
  int res = 0;
  while (!st.empty())
  {
    int i = st.rbegin()->second;
    st.erase(--st.end());
    int step = b[(i + 1) % n] + b[(i - 1 + n) % n];
    if (b[i] < step and b[i] != a[i])
    {
      cout << -1 << endl;
      return;
    }
    if ((b[i] - a[i]) % step == 0)
    {
      res += (b[i] - a[i]) / step;
      b[i] = a[i];
      continue;
    }
    res += b[i] / step;
    b[i] %= step;
    if (b[i] < a[i])
    {
      cout << -1 << endl;
      return;
    }
    st.insert({b[i], i});
  }
  cout << res << endl;
  return;

  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 18752
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())

using namespace std;

#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
typedef vector<ll> vecll;
const ll inf =1000000007;


 int main(){
     string s,t;
     cin >> s >>t;
     map<char,vecll> mp;
     for(ll i=0;i<s.size();i++){
         mp[s[i]].pb(i);
     }
     ll ima=-1;
     ll round=0;
     for(ll i=0;i<t.size();i++){
        if(mp[t[i]].empty()){
            cout << -1 << endl;
            return 0;
        }
        else if(upper_bound(mp[t[i]].begin(),mp[t[i]].end(),ima)!=mp[t[i]].end()){
            ima=*upper_bound(mp[t[i]].begin(),mp[t[i]].end(),ima);
        }
        else{
            ima=mp[t[i]][0];
            round++;
        }
     }
     cout << round*s.size()+ima+1LL << endl;
 }


Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  string S;
  cin >> S;
  set<string> s;
  int n = S.length();
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  if (n == 2) {
    if (S[0] == S[1]) {
      cout << "1\n";
    } else {
      cout << "2\n";
    }
    return 0;
  }

  int dp[n + 1][2]{};
  dp[0][0] = 1;
  dp[0][1] = 0;
  if (S[0] == S[1]) {
    dp[1][0] = 0;
    dp[1][1] = 1;
  } else {
    dp[1][0] = 2;
    dp[1][1] = 1;
  }

  for (int i = 2; i < n; i++) {
    if(S[i] != S[i - 1]) {
      dp[i][0] = max(dp[i - 1][0], dp[i - 2][0]) + 1; 
      dp[i][1] = dp[i - 2][0] + 1;
    } else {
      dp[i][0] = max(dp[i - 1][1], dp[i - 2][1]) + 1;
      dp[i][1] = dp[i - 2][0] + 1;
    }
  }
  cout << max(dp[n -1][0], dp[n - 1][1]) << "\n";
  return 0;
}

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define itrout(x) for(int i=0;i<x.size();i++) {cout << x[i] << (i==x.size()-1 ? "\n" : " ");}
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define debugbit(x, n) cerr << #x << " = " << bitset<n>(x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define debugbit(x, n)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long
typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, std::vector<long long> X, std::vector<long long> Y, std::vector<long long> P){
    // preprocess
    vector<vector<ll>> dx(1<<N, vector<ll>(N, LLONG_MAX)), dy(1<<N, vector<ll>(N, LLONG_MAX));
    rep(i,0,1<<N) {
        vector<int> x, y;
        rep(j,0,N) {
            if (1<<j & i) x.push_back(j);
            else y.push_back(j);
        }
        rep(j,0,N) {
            ll minCostX = abs(X[j] - 0) * P[j], minCostY = abs(Y[j] - 0) * P[j];
            for (auto xi : x) {
                minCostX = min(minCostX, (abs(X[j] - X[xi]) * P[j]));
            }
            for (auto yi : y) {
                minCostY = min(minCostY, (abs(Y[j] - Y[yi]) * P[j]));
            }
            dx[i][j] = minCostX;
            dy[i][j] = minCostY;
        }
    }

    // solve
    vector<ll> answer(N+1, LLONG_MAX);
    rep(i,0,1<<N) {
        vector<int> used;
        rep(j,0,N) {
            if (1<<j & i) used.push_back(j);
        }
        rep(j,0,1<<used.size()) {
            ll x = 0, y = (1<<N) - 1;
            rep(k,0,used.size()) {
                if (1<<k & j) x += 1<<used[k];
                else y -= 1<<used[k];
            }
            ll cost = 0;
            rep(j,0,N) {
                cost += min(dx[x][j], dy[y][j]);
            }
            answer[used.size()] = min(answer[used.size()], cost);
        }
    }
    rep(i,0,N+1) {
        cout << answer[i] << endl;
    }
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> X(N);
    std::vector<long long> Y(N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&Y[i]);
        scanf("%lld",&P[i]);
    }
    solve(N, std::move(X), std::move(Y), std::move(P));
    return 0;
}


Measured memory_bytes: 13032
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
#include <queue>
#include <unordered_map>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll intpow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = intpow(N, P/2);
        return t*t;
    }
    return N * intpow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    ll n_ = max(n,m);
    ll m_ = min(n,m);
    if(n_%m_ == 0)return m_;
    return gcd(m_,n_%m_);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
struct edge{
    int to;
    int length;
};
using Graph = vector<vector<edge>>;
vector<int> seen;
void dfs(const Graph &G, int v) {

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v.to]!=-1) continue; // next_v が探索済だったらスルー
        seen[next_v.to]=(seen[v]+next_v.length)%2;
        dfs(G, next_v.to); // 再帰的に探索
    }
}
int main() {
    // 頂点数と辺数
    int N; cin >> N;

    // グラフ
    Graph G(N);
    for (int i = 0; i < N-1; ++i) {
        int u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;
        G[u].push_back(edge{v,w});
        G[v].push_back(edge{u,w});
    }
    seen.assign(N,-1);
    seen[0]=0;
    dfs(G,0);
    rep(i,N){
        if(seen[i]==0)cout<<0<<endl;
        if(seen[i]==1)cout<<1<<endl;
    }
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<int,int>P;
typedef pair<int,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}

int n;
long long k,q;
int a;
int c[100005]={};
int main() {
	cin>>n>>k>>q;
	for(int i=0;i<q;++i){
		cin>>a;
		c[a-1]++;
	}
	for(int i=0;i<n;++i){
		if(k-q+c[i]>0)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 1024
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


# --------------------------------------------

dp = None


def main():
    N, A, B = li_input()
    V = li_input()

    V.sort(reverse=True)

    maxavg = sum(V[:A]) / A
    V_ = V[:A]

    if V_[0] == V_[-1]:
        n = V.count(V_[0])

        ans = 0
        for r in range(A, min(n + 1, B + 1)):
            ans += comb(n, r)

        print(maxavg)
        print(int(ans))

    else:
        n = V.count(V_[-1])
        r = V_.count(V_[-1])

        ans = comb(n, r)

        print(maxavg)
        print(int(ans))


main()


Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;cin>>n>>m;
	vector<P> p;
	rep(i, m){
		int a, b;cin>>a>>b;
		p.push_back(P(b, a));
	}
	sort(all(p));
	int ans = 1;
	int now = p[0].first;
	for(int i = 1;i < m;i++){
		if(p[i].second<now){

		}else{
			now = p[i].first;
			ans ++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main(){
string S;
  cin>>S;
  for(int i=2;i<S.size();i+=2){
    bool judge=true;
    for(int j=0;j<(S.size()-i)/2;j++){
      if(S.at(j)!=S.at(j+(S.size()-i)/2)){
        judge=false;
      }
    }
    if(judge) {
      cout<<S.size()-i<<endl;
      break;
    }
  }
}


Measured memory_bytes: 256
/*
h s, d't skp th si tll i's sved
 * ABC141 E
 * ABC145 D
 * ABC147 F
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
ll n;
cin>>n;
if(n%2==1)
{
cout<<0<<endl;
}
else
{
ll ans=0;
for(ll i=10;i<=n;i*=5)
{
ans+=n/i;
}
cout<<ans<<endl;
}
}

Measured memory_bytes: 3620
#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    ll N,K; cin >> N >> K;
    vector<ll> A(N);
    vector<ll> bit(50, 0);
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
        REP(b, 50){
            ll p = pow((ll)2, (ll)b);
            if(a & p){
                bit[b]++;
            }
        }
    }

    ll x = 0;
    REPR(b,49){
        if(bit[b] < N-bit[b]){//0の方が多ければ
        ll d = pow((ll)2,(ll)b);
            if(x + d <= K){
                //cout << d << endl;
                x += d;
            }
        }
    }

    ll ans = 0;
    REP(i,N){
        ans += x^A[i];
    }

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

Measured memory_bytes: 4060
import math
ceil = math.ceil
def isok(x):
    syugyo = 0##全員の時間がx以下を達成するための修行回数
    for i in range(n):
        syugyo += max(0,  ceil(( A[i]*F[i]-x )/F[i])  )
    return syugyo>kai
def bisect():
    ok = -1
    ng = 10**12+1 ##最小コストの最大値
    x = (ok+ng)//2
    while ng-ok>1:
        if isok(x):
            ok = x
        else:
            ng = x
        x = (ok+ng)//2
    return ok+1 ##一番右のTrueのindex  Trueの個数はok+1こ


n,kai = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))
F.sort()
A.sort(reverse=True)
print(bisect())


Measured memory_bytes: 119500
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n; 
int mnf[101010],mxf[101010],mxr[101010],mnr[101010];
multiset<int> mn,mx;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
    
    cin >> n;
    vpi v;
    v.pb({0,0});
    for(int i=1;i<=n;i++){
    	int x,y;
    	cin >> x >> y;
    	v.pb({x,y});
    	mx.insert(x);
    	mn.insert(y);
    }    
    sort(all(v));
    for(int i=0;i<=n+1;i++){
    	mnf[i] = 1e9+7;
    	mnr[i] = 1e9+7;
    }
    for(int i=1;i<=n;i++){
    	mnf[i] = min( v[i].sc, mnf[i-1] );
    	mxf[i] = max( v[i].fs, mxf[i-1] );
    	//cout << mxf[i] << " " << mnf[i] << endl;
    }
    for(int i=n;i>=1;i--){
    	mnr[i] = min( v[i].sc, mnr[i+1] );
    	mxr[i] = max( v[i].fs, mxr[i+1] );
    }
    int ans = 0;
    for(int i=1;i<n;i++){
    	int cur = max(0LL , mnf[i]-mxf[i]+1 )+max(0LL, mnr[i+1]-mxr[i+1]+1 );
    	ans = max(ans, max(0LL , mnf[i]-mxf[i]+1 )+max(0LL, mnr[i+1]-mxr[i+1]+1 ) );
    	//cout << cur << endl;
    }
    for(int i=1;i<=n;i++){
    	int x= v[i].fs;
    	int y = v[i].sc;
    	mn.erase(mn.find(y));
    	mx.erase(mx.find(x));
    	auto it = mn.begin();
    	int x1 = *it;
    	it = mx.end();
    	it--;
    	int y1 = *it;
    	int cur = max(0LL, x1-y1+1 )+y-x+1;
    	//cout << cur << " " << x1 << " " << y1 << " " << x << " " << y << endl;
    	ans = max(ans, cur);
    	mn.insert(y);
    	mx.insert(x);
    }
    cout << ans << endl;

return 0;
}
///....


Measured memory_bytes: 14320
import std.stdio;
import std.string;
import std.format;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.concurrency;
import std.traits;
import std.uni;
import core.bitop : popcnt;
alias Generator = std.concurrency.Generator;

enum long INF = long.max/5;
enum long MOD = 10L^^9+7;

void main() {
  long N;
  scanln(N);
  string s, t;
  scanln(s, t);
  zip(s, t).map!(a => a[0].to!string~a[1].to!string).array.join.writeln;
}

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


void times(alias fun)(long n) {
  // n.iota.each!(i => fun());
  foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(long n) {
  // return n.iota.map!(i => fun()).array;
  T[] res = new T[n];
  foreach(ref e; res) e = fun();
  return res;
}

T ceil(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  // `(x+y-1)/y` will only work for positive numbers ...
  T t = x / y;
  if (y > 0 && t * y < x) t++;
  if (y < 0 && t * y > x) t++;
  return t;
}

T floor(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  T t = x / y;
  if (y > 0 && t * y > x) t--;
  if (y < 0 && t * y < x) t--;
  return t;
}

ref T ch(alias fun, T, S...)(ref T lhs, S rhs) {
  return lhs = fun(lhs, rhs);
}
unittest {
  long x = 1000;
  x.ch!min(2000);
  assert(x == 1000);
  x.ch!min(3, 2, 1);
  assert(x == 1);
  x.ch!max(100).ch!min(1000); // clamp
  assert(x == 100);
  x.ch!max(0).ch!min(10); // clamp
  assert(x == 10);
}

mixin template Constructor() {
  import std.traits : FieldNameTuple;
  this(Args...)(Args args) {
    // static foreach(i, v; args) {
    foreach(i, v; args) {
      mixin("this." ~ FieldNameTuple!(typeof(this))[i]) = v;
    }
  }
}

void scanln(Args...)(auto ref Args args) {
  enum sep = " ";
  enum n = Args.length;
  enum fmt = n.rep!(()=>"%s").join(sep) ~ "\n";
  static if (__VERSION__ >= 2071) {
    readf!fmt(args);
  } else {
    enum argsTemp = n.iota.map!(
      i => "&args[%d]".format(i)
    ).join(", ");
    mixin(
      "readf(fmt, " ~ argsTemp ~ ");"
    );
  }
}

// fold was added in D 2.071.0
static if (__VERSION__ < 2071) {
  template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
      static if (S.length < 2) {
        return reduce!fun(seed, r);
      } else {
        return reduce!fun(tuple(seed), r);
      }
    }
  }
}

// popcnt with ulongs was added in D 2.071.0
static if (__VERSION__ < 2071) {
  ulong popcnt(ulong x) {
    x = (x & 0x5555555555555555L) + (x>> 1 & 0x5555555555555555L);
    x = (x & 0x3333333333333333L) + (x>> 2 & 0x3333333333333333L);
    x = (x & 0x0f0f0f0f0f0f0f0fL) + (x>> 4 & 0x0f0f0f0f0f0f0f0fL);
    x = (x & 0x00ff00ff00ff00ffL) + (x>> 8 & 0x00ff00ff00ff00ffL);
    x = (x & 0x0000ffff0000ffffL) + (x>>16 & 0x0000ffff0000ffffL);
    x = (x & 0x00000000ffffffffL) + (x>>32 & 0x00000000ffffffffL);
    return x;
  }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cstring>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
int MOD = 1000000007;

int main() {
	vector<int> a(10);
	for (int i = 0; i < 10; i++) cin >> a[i];
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < 3; i++) cout << a[i] << endl;
}

Measured memory_bytes: 1212
n = int(input())
s = [input() for _ in range(n)]

s.sort()
ac = 0
ans = []
i = 0
while i < n:
  temp = s[i]
  j = i + 1
  while j < n:
    if s[j] == temp:
      j += 1
    else:
      j -= 1
      break
  if j == n:
    j -= 1
  c = j - i + 1
  if c > ac:
    ans = [temp]
    ac = c
  elif c == ac:
    ans.append(temp)
  i = j + 1

for x in ans:
  print(x)

Measured memory_bytes: 20680
// N以下の1の倍数の個数 = N以下のすべての数の約数のうち1が入っているもの
// を1~Nまでやって数を数え、足していく
#include <bits/stdc++.h>

int main()
{
	int N;
	std::cin >> N;

	std::vector<long long> yakusu(N+1);
	// 1~Nについて
	for(int i=1; i<=N; i++)
	{
		// iを約数として持っている数に正の字をつけていく 
		// 最低i, 最高N, iが1つ約数であれば公差iの等差数列になる
		for(int j=i; j<=N; j+=i)
		{
			yakusu[j]++;
		}
	}

	long long ans = 0;
	for(int i=1; i<=N; i++)
	{
		ans += i * yakusu[i];
	}

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

	return 0;
}


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  int N;
  cin >> N;
  llvec A(N,0);
  llvec S(N+1, 0);
  rep(i, N) cin >> A[i];
  S[0] = abs(A[0]);
  rep(i, N-1)S[i+1] = S[i] + abs(A[i+1]-A[i]);
  S[N]=abs(A[N-1])+S[N-1];

  rep(i, N){
    if(i==0){
      cout << S[N] - abs(A[i+1] - A[i]) - abs(A[i]) + abs(A[i+1]) << endl;
    }else if(i==N-1){
      cout << S[N-2] + abs(A[i-1]) << endl;
    }
    else{
      cout << S[N] - abs(A[i]-A[i-1]) - abs(A[i+1] - A[i]) + abs(A[i+1]-A[i-1])<<endl;
    }
  }
  

  return 0;
}


Measured memory_bytes: 2816
#include<stdio.h>
#include<string.h>
int main()
{
	char t[11],s[11],b[11];
	int n,r=0;
	scanf("%s%d",t,&n);
	for(int i=0;i<n;i++){
		scanf("%s",s);
		for(int j=0;j<10;j++){
			b[0]=s[9];
			for(int k=0;k<9;k++){
				b[k+1]=s[k];
			}
			strcpy(s,b);
			if(strncmp(s,t,strlen(t))==0){
				r++;
				break;
			}
		}
	}
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 2696
#include <stdio.h>
#include <iostream>

using namespace std;

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

int min(int X, int Y) {
    return X < Y ? X : Y;
}

int abs(int X) {
    return X > 0 ? X : -X;
}

const int INF = 1000000000;
int N, A, B, C;

int dfs(int* l, int i, int a, int b, int c) {
    if (i == N) {
        if (min(min(a, b), c) > 0) {
            return abs(a - A) + abs(b - B) + abs(c - C) - 30;
        } else {
            return INF;
        }
    }

    int ret0 = dfs(l, i + 1, a, b, c);
    int ret1 = dfs(l, i + 1, a + l[i], b, c) + 10;
    int ret2 = dfs(l, i + 1, a, b + l[i], c) + 10;
    int ret3 = dfs(l, i + 1, a, b, c + l[i]) + 10;

    return min(min(min(ret0, ret1), ret2), ret3);
}

int main() {
    cin >> N >> A >> B >> C;
    int l[N]; REP(0, i, N) cin >> l[i];

    cout << dfs(l, 0, 0, 0, 0) << endl;

    return 0;
}


Measured memory_bytes: 256
#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include<bits/stdc++.h>
using namespace std; 
int main(){
    int a,b;
    cin >> a >> b;
    if(a>5 && a < 13) b = b/2;
    else if (a<6)b = 0;
    cout << b<< endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader vd = new BufferedReader(new InputStreamReader(System.in));
		
		String a = vd.readLine().split("")[0];
		String b = vd.readLine().split("")[1];
		String c = vd.readLine().split("")[2];
		
		System.out.println(a+b+c);
		
	}

}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  vll a(n), b(m);
  rep(i,n) cin >> a[i];
  rep(i,m) cin >> b[i];
  ll cnt = 0LL;
  ll ans = 0LL;
  rep(i,n) cnt += a[i];
  if(cnt>k) {
    ll tmp = n;
    int bin = 0;
    reverse(a.begin(),a.end());
    rep(j,n) {
      cnt -= a[j];
      tmp--;
      while(true) {
        if(cnt+b[bin]>k) break;
        if(bin>=m) break;
        cnt += b[bin];
        bin++;
        tmp++;
      }
      if(cnt<=k) ans = max(ans,tmp);
    }
    cout << ans << endl;
  }
  else {
    int bin = 0;
    ll tmp = n;
    while(true) {
      if(cnt+b[bin]>k) break;
      if(bin>=m) break;
      cnt += b[bin];
      bin++;
      tmp++;
    }
    ans = max(ans,tmp);
    reverse(a.begin(),a.end());
    rep(j,n) {
      cnt -= a[j];
      tmp--;
      while(true) {
        if(cnt+b[bin]>k) break;
        if(bin>=m) break;
        cnt += b[bin];
        bin++;
        tmp++;
      }
      if(cnt<=k) ans = max(ans,tmp);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 6424
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    ll arr[n+1];
    for(int i = 1;i <= n;i++){
        cin >> arr[i];
    }
    sort(arr+1,arr+n+1);
    ll ans = arr[n];
    int k = n-1;
    for(int i = n-2; i > 0;i-= 2){
        if(i == 1){
            ans += arr[k];
            break;
        }
        ans = ans + 2LL * arr[k--];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 5188
from sys import exit
H,W = [int(n) for n in input().split()]
S = [0]*H
dxy = [[1,0],[0,1],[0,-1],[-1,0],[1,1],[1,-1],[-1,1],[-1,-1]]
for i in range(H):
    S[i] = list(str(input()))

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            cnt = 0
            for d in dxy:
                if(0<= i+d[0] < H and 0<= j+d[1] < W and S[i+d[0]][j+d[1]] == "#"):
                    cnt+=1
            S[i][j] = cnt

for i in range(H):
    for j in range(W):
        print(S[i][j],end="")
    print()


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18;

/*--------------------------------------------------------------------*/

signed main(){
	int a;cin>>a;
	string s;cin>>s;
	int b=0;
	b+=s[0]-'0';
	b*=10;
	b+=s[2]-'0';
	b*=10;
	b+=s[3]-'0';

	cout<<a*b/100<<endl;
	return 0;
}



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

lint n;

vector<string> s;

void dfs(string str, char c) {
    if (str.length() == n) {
        s.push_back(str);
    } else {
        int m = c - 'a';
        for (int i = 0; i <= m; i++) {
            dfs(str + (char)('a' + i), c);
        }
        if (c != 'z') {
            dfs(str + (char)('a' + m + 1), (char)(c + 1));
        }
    }
}

int main() {
    cin >> n;
    dfs("a", 'a');
    sort(s.begin(), s.end());
    for (auto e : s) {
        cout << e << endl;
    }
}

Measured memory_bytes: 7796
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 5010
#define MAX_N 12
typedef unsigned long long ull;
const ull B = 1000000007ULL;
 
vector<ull> rolling_hash(string &s)
{
    int N = s.size();
    vector<ull> hash(N+1);
    hash[0] = 0;
     
    for (int i = 0; i < N; i++) {
        hash[i+1] = hash[i] * B + s[i];        
    }
    return hash;
}
 
int main()
{
    ull p[MAX];
    p[0] = 1;
    for (int i = 0; i < MAX-1; i++) {
        p[i+1] = p[i] * B;
    }
 
    int N, M;
    while (cin >> N >> M, N) {
        int total = 0, len_e[12];
        string e;
        vector<vector<ull>> hash_e(N);
        for (int i = 0; i < N; i++) {
            cin >> e;
            hash_e[i] = rolling_hash(e);
            total += len_e[i] = e.size();
        }
        string str, t;
        for (int i = 0; i < M; i++) {
            cin >> t;
            str += t;
        }
 
        int n = str.size(), sum = 0;
        vector<ull> hash_t = rolling_hash(str);
        for (int i = 0; i <= n - total; i++) {
            bool dp[1<<MAX_N] = {};
            dp[0] = 1;
            for (int j = 0; j < (1<<N)-1; j++) {
                if (dp[j] == 0) continue;
                int pos = i;
                for (int k = 0; k < N; k++) {
                    if (j >> k & 1) {
                        pos += len_e[k];
                    }                    
                }
                for (int k = 0; k < N; k++) {
                    if (j >> k & 1) continue;
                    int L = pos, R = pos + len_e[k] - 1;
                    ull h = hash_t[R+1] - hash_t[L] * p[R - L + 1];
                    if (h == hash_e[k][len_e[k]]) {
                        dp[j|(1<<k)] = 1;
                    }
                }
            }
            sum += dp[(1<<N)-1];
        }        
        cout << sum << endl;
    }
    return 0;
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll N;
  scanf("%lld",&N);
  vector<ll> d(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&d[i]);
  }
  sort(d.begin(),d.end());
  cout << max(0LL, d[N/2]-d[N/2-1]) << endl;
}

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


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
 
int solve(vector<int> h,int k)
{
  int n=h.size();
  vector<int> t(n,INT_MAX);
  t[0]=0;
  for(int i=0;i<n-1;++i)
  {
      for(int j=1;j<=k;++j)
      {
        if(i+j<n)
        {
            //cout<<h[i]<<" "<<h[i+j]<<" "<<t[i]<<" "<<t[i]+abs(h[i]-h[i+j])<<"\n";
            t[i+j]=min(t[i]+abs(h[i]-h[i+j]), t[i+j]);
            
        }
      }
  }
//   for(auto x: t)
//   cout<<x<<" ";
//   cout<<"\n";
  return t[n-1];  
}
 
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> h;
  for(int i=0;i<n;++i){
    int ele ;
    cin>>ele;
    h.pb(ele);
  }
  cout<<solve(h,k)<<"\n";
return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> ls;
	for (int i = 0; i < n; ++i) {
	  int l;
	  cin >> l;
	  ls.push_back(l);
	}
	int max = *max_element(ls.begin(), ls.end());
	int rest = accumulate(ls.begin(), ls.end(), 0) - max;
	string ans = rest > max ? "Yes" : "No";
	cout << ans << endl;
}

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

int main()
{ int n,m,a,b,c;
  while(~scanf("%d %d",&n,&m))
  {  a=n+m;
     b=n-m;
     c=n*m;
     if(a>b&&a>c)
        printf("%d\n",a);
     else  if(b>a&&b>c)
        printf("%d\n",b);
    else   if(c>b&&c>a)
        printf("%d\n",c);
     else  if(a==b&&b==c)
            printf("%d\n",a);
     else if(a==b&&c>b)
        printf("%d\n",c);
     else if(a==c&&b>c)
        printf("%d\n",b);
     else if(b==c&&a>c)
        printf("%d\n",a);
      else if(a==b&&c<b)
        printf("%d\n",a);
     else if(a==c&&b<c)
        printf("%d\n",a);
     else if(b==c&&a<c)
        printf("%d\n",b);

  }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main() {
	int a;
	int b;
	cin >> a >> b;
	if (a < b) {
		cout << "a" << " < " << "b" << endl;
	}
	else {
		if (a > b) {
			cout << "a" << " > " << "b" << endl;
		}
		else {
			cout << "a" << " == " << "b" << endl;
		}

	}
	
	
}


Measured memory_bytes: 3056
/*
 *  AUTHOR : MANAV PATEl
*/
#include<bits/stdc++.h>
#include<functional>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

namespace fastio {

	template <class T> istream &operator>>(istream &os, vector<T> & vec) {
		for (auto &u : vec)os >> u;
		return os;
	}
	template <class T> ostream &operator<<(ostream &os, const vector<T> & vec) {
		for (auto &u : vec)os << u << " ";
		return os;
	}
	template<class T1, class T2> inline istream& operator>>(istream& os, pair<T1, T2>& p) {
		return os >> p.first >> p.second;
	}
	template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
		return os << p.first << " " << p.second;
	}
	template <class T> ostream &operator<<(ostream &os, set<T> & con) {
		for (auto &u : con) os << u << " ";
		return os;
	}
	void re() {}
	template <typename T, typename... args> void re(T& x, args&... tail) {
		cin >> x;
		re(tail...);
	}
	void pr() {}
	template <typename T> void pr(const T& x) {
		cout << x;
	}
	template <typename T, typename... args> void pr(const T& x, const args&... tail) {
		cout << x << " ";
		pr(tail...);
	}
	template <typename... args> void prln(const args&... tail) {
		pr(tail...);
		cout << "\n";
	}
}
using namespace fastio;

typedef long long int ll;
typedef long double ld;

const ll mod = 1e9+7;
const ll mod1 = 998244353;

#define fill(a)  memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back

int main()
{
	cin.sync_with_stdio(false);
	cin.exceptions(cin.failbit);
	cin.tie(0);
	int n, x,cnt = 1, sum =  0;
	re(n,x);
	for(int i = 0; i <n; i++)
	{
		int p;
		re(p);
		sum += p;
		if(sum <= x)
			cnt++;
	}
	prln(cnt);
}


Measured memory_bytes: 256