akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define N 1000
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}

#define rank Asdfiasofsad
class UF{
public:
  int V;
  vector<int> par,rank;
  UF(){}
  UF(int V):V(V),par(V),rank(V,0){for(int i=0;i<V;i++)par[i]=i;}
  
  int find(int x){
    assert(x < V);
    if(par[x]==x)return x;
    return par[x]=find(par[x]);
  }
  
  void unite(int x,int y){
    x=find(x), y=find(y);
    if(x==y)return;
    if(rank[x]<rank[y])par[x]=y;
    else{
      par[y]=x;
      if(rank[x]==rank[y])rank[x]++;
    }
  }

  bool same(int x,int y){return find(x)==find(y);}
};

int n,m;
vector<int> G[N];

int used[N];
int dfs(int pos){
  if(used[pos]++) return 0;
  int res = G[pos].size() - 1;
  for(int to:G[pos]) res += dfs(to);
  return res;
}

signed main(){
  cin>>n>>m;
  UF uf(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b; a--,b--;
    G[a].push_back(b);
    uf.unite(a,b);
  }
  
  map<int,int> val;
  for(int i=0;i<n;i++){
    memset(used,0,sizeof(used));
    int v = dfs(i);
    if(val.count(uf.find(i))) Min(val[uf.find(i)],v);
    else val[uf.find(i)] = v;
  }

  int sum = 0;
  typedef pair<int,int> P;
  for(P p:val) sum += p.second+1;
  cout<<sum<<endl;
  
  return 0;
}

Measured memory_bytes: 3248
public class Main{
  static int head, tail;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n, q;
    String[] name;
    int[] time;
    int i, t, a;
    String s;

    n = sc.nextInt();
    q = sc.nextInt();
    name = new String[n + 1];
    time = new int[n + 1];
    for(i = 0;i < n;i++){
      name[i] = sc.next();
      time[i] = sc.nextInt();
    }
    head = 0;
    tail = n;
    t = 0;

    for(;!isEmpty();){
      a = dequeue(time, n);
      s = strdequeue(name, n);
      if(a > q){
        t += q;
        a -= q;
        strenqueue(name, n, s);
        enqueue(time, n, a);
      }else{
        t += a;
        System.out.println(s + " " + t);
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static void enqueue(int[] time, int n, int a){
    time[tail] = a;
    tail = (tail + 1) % (n + 1);
  }

  private static void strenqueue(String[] name, int n, String s){
    name[tail] = s;
  }

  private static int dequeue(int[] time, int n){
    head = (head + 1) % (n + 1);
    return time[(n + head) % (n + 1)];
  }

  private static String strdequeue(String[] name, int n){
    return name[(head + n) % (n + 1)];
  }

  private static boolean isEmpty(){
    if(head == tail){
      return true;
    }else{
      return false;
    }
  }

}

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

int T, card[16];


bool is_same_number(int a, int b, int c){
	if (a == b && b == c) return true;
	else return false;
}

bool is_sequence(int a, int b, int c){
	if (a == b + 1 && a == c + 2) return true;
	else return false;
}

bool is_good_set(int a, int b, int c){
	return is_same_number(a, b, c) || is_sequence(a, b, c);
}

bool is_all_good_set(int card[9]){
	if (is_good_set(card[0], card[1], card[2]) && is_good_set(card[3], card[4], card[5]) && is_good_set(card[6], card[7], card[8]))
		return true;
	else return false;
}

int main(){
	cin >> T;
	for (int t = 0; t < T; ++t){
		for (int i = 0; i < 9; ++i){
			cin >> card[i];
		}
		string color;
		for (int i = 0; i < 9; ++i){
			cin >> color;
			if (color == "G") card[i] += 10;
			else if (color == "B") card[i] += 20;
		}
		sort(card, card + 9);
		int judge = 0;
		do{
			if (is_all_good_set(card))
				judge = 1;
		} while (next_permutation(card, card + 9));
		cout << judge << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
N,M=map(int,input().split())

ans=dict()
AC=0
WA=0

for i in range(M):
    P,S= map(str,input().split())
    if((P in ans)==False):
        ans[P]=[S]
    else:
        ans[P].append(S)

for i in ans.values():
    tmp=0
    for value in i:
        if(value=='AC'):
            AC+=1
            WA+=tmp
            break
        else:
            tmp+=1
print(AC,WA)

Measured memory_bytes: 30136
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;

int main() {
	
	int n;
	cin >> n;
	vector<double> a(n);
	rep(i, n) {
		cin >> a.at(i);
	}
	

	rep(i, n) {
		if (n == 1) {
			cout << "Yes" << endl;
			break;
		}
		if (a.at(i + 1) > a.at(i)) a.at(i + 1)--;
		else if (a.at(i + 1) < a.at(i)) {
			cout << "No" << endl;
			break;
		}
		if (i == (n - 2)) {
			cout << "Yes" << endl;
			break;
		}
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define mem(a, b) memset(a, b, sizeof(a))
#define MOD 1000000007
#define MAX (int) 1e9
#define PI 3.141592653589793238462643383279502884

template <typename T, typename U>
T max(T x, U y) {
    return x > y ? x : y;
}

template <typename T, typename U>
T min(T x, U y) {
    return x < y ? x : y;
}

template<typename T>
void debug(string msg, T t) {
	cout << msg << ": " << t << "\n";
}

template<typename T>
T abs(T a, T b) {
	return a > b ? a - b : b - a;
}

inline int toDigit(char c) { return c - '0'; }

unordered_set<int> f;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0); 

	int x, n, p;
	cin >> x >> n;

	for(int i = 0; i < n; i++) {
		cin >> p;
		f.emplace(p);
	}

	int ans = 0;
	for(int d = 0; d <= 100; d++) {
		if(f.count(x - d) == 0) {
			ans = x - d;
			break;
		} else if(f.count(x + d) == 0) {
			ans = x + d;
			break;
		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3668
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int P[SIZE],Y[SIZE];
VI d[SIZE];
int main(){
    int N,M;
    R(N,M);
    REP(i,M){
        R(P[i],Y[i]);
        d[P[i]].PB(Y[i]);
    }
    REP(i,SIZE)sort(ALL(d[i]));
    REP(i,M){
        printf("%06d%06d\n",P[i],(int)(lower_bound(ALL(d[P[i]]),Y[i]+1)-d[P[i]].begin()));
    }
    return 0;
}


Measured memory_bytes: 31232
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n > 0) {
    int sum = 0;
    int mx = 0;
    int mn = 10000;
    int x;
    for (int i = 0; i < n; i++) {
      cin >> x;
      sum += x;
      if (x > mx) mx = x;
      if (x < mn) mn = x;
    }
    cout << (sum - mx - mn) / (n - 2) << endl;
    cin >> n;
  }
  return 0;
}



Measured memory_bytes: 3080
#!/usr/bin/env python3
import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, S: "List[str]"):
    s_plus = []
    s_minus = []
    total = 0
    last = 0
    for s in S:
        l = 0
        r = 0
        for v in s:
            if v == '(':
                l += 1
            elif v == ')':
                if l > 0:
                    l = l - 1
                else:
                    r += 1
        # if r == 0:
        #     total += l
        # elif l ==0:
        #     last += r
        if l >= r:
            s_plus.append([l, r])
        else:
            s_minus.append([l, r])

    s_plus.sort(key=lambda x: x[1])
    s_minus.sort(key=lambda x: -x[0])
    # print(s_plus, s_minus)
    total = 0
    for l, r in s_plus + s_minus:
        total -= r
        if total < 0:
            print(NO)
            return
        total += l
    if total == 0:
        print(YES)
    else:
        print(NO)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, S)


if __name__ == '__main__':
    main()


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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

int main() {
  ll k, n;
  cin >> k >> n;
  VI v(n);
  REP(i,n){
    cin >> v[i];
  }

  SORT(v);

  VI dist(n);
  REP(i,n-1){
    dist[i] = v[i + 1] - v[i];
  }
  dist[n - 1] = k - v[n - 1] + v[0];

  int m = 0;
  REP(i, n) {
    m = max(m, dist[i]);
  }
  ANS(k - m);

  return 0;
}


Measured memory_bytes: 1920
#include <cstdint>
#include <cstdio>

using namespace std;

uint64_t kLimit = 1'000'000'007;

uint64_t solve(uint64_t m, uint64_t n) {
  if (n <= 3) {
    uint64_t acc = 1;
    for (uint64_t i = 0; i < n; ++i) {
      acc *= m;
      acc %= kLimit;
    }
    return acc;
  }

  return (solve((m * m) % kLimit, n / 2) * (n % 2 == 0 ? 1 : m)) % kLimit;
}

int main() {
  uint64_t m, n;
  scanf("%llu %llu", &m, &n);
  printf("%llu\n", solve(m, n));

  return 0;
}



Measured memory_bytes: 2732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll n; cin>>n;
  ll cnt=0;
  
  for(ll i=1; i<=n; i++) {
    ll d=floor(log10(i)+1);
    if(d%2==1) cnt++;
  }
  
  cout << cnt;
    
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
#define lowbit(x) ((x)&(-x))
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
int n;
long long k;
long long a[2000100];
long long INF=1e9+1;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>k;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	INF=INF*INF;
	long long cl,cr,cm,l,r,m,tot;
	cl=-INF;
	cr=INF;
	while(cl+1<cr){
		cm=(cl+cr)/2LL;
		tot=0LL;
		for(int i=0;i<n;i++){
			if(a[i]<0){
				l=-1;
				r=n;
				while(l+1<r){
					m=(l+r)/2LL;
					if(a[i]*a[m]<cm)
						r=m;
					else
						l=m;
				}
				tot+=(long long)(n)-r;
			}
			else{
				l=-1;
				r=n;
				while(l+1<r){
					m=(l+r)/2LL;
					if(a[i]*a[m]<cm)
						l=m;
					else
						r=m;
				}
				tot+=r;
			}
			if((a[i]*a[i])<cm)
				tot-=1LL;
		}
		tot/=2LL;
		if(tot<k)
			cl=cm;
		else
			cr=cm;
	}
	cout<<cl<<endl;
	return 0;
}


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

using namespace std;

int main() {

	int h, w;
	cin >> h >> w;

	vector<string> s(h + 2, "");
	vector<string> ss(h + 2, "");
	for (int i = 1; i <= h; i++) {
		cin >> s[i];
	}
	for (int i = 0; i <= w + 1; i++) {
		s[0].push_back('.');
		s[h+1].push_back('.');
	}
	for (int i = 1; i <= h; i++) {
		s[i].push_back('.');
		s[i].insert(s[i].begin(),'.');
	}
	
	ss = s;

	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (ss[i][j] == '.') {
				int counter = 0;
				for (int k = -1; k <= 1; k++) {
					for (int l = -1; l <= 1; l++) {
						if ((k != 0 || l != 0) && ss[i+k][j+l] == '#') { counter++; }
					}
				}
				ss[i][j] = counter+'0';
			}
		}
	}


	for (int i = 1; i <= h; i++) {
		ss[i].pop_back();
		ss[i].erase(ss[i].begin());
		cout << ss[i] << endl;;
	}

}

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

int main() {
  string n;
  cin >> n;
  bool has_seven = false;
  if (n[0] == '7') has_seven = true;
  if (n[1] == '7') has_seven = true;
  if (n[2] == '7') has_seven = true;

  if (has_seven) {
    cout << "Yes" << endl;
    return 0;
  } else {
    cout << "No" << endl;
    return 0;
  }
}


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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    int n = s.size();
    vector<vector<int>> d(4, vector<int>(n + 1));
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= 3; j++) {
            d[j][i] = -1;
            if (j > i) continue;
            if (j == i) {
                d[j][i] = 1;
                continue;
            }
            for (int k = 1; k <= 3; k++) {
                if (j + k > i) continue;
                if (d[k][i - j] == -1) continue;
                if (k == j && s.substr(i - j - k, k) == s.substr(i - j, j)) {
                    continue;
                }
                d[j][i] = max(d[j][i], d[k][i - j] + 1);
            }
//            cout << i << " " << j << " " << d[i][j] << "\n";
        }
    }
    int res = 0;
    for (int i = 1; i <= 3; i++) {
        res = max(res, d[i][n]);
    }
    cout << res;

    return 0;
}

Measured memory_bytes: 4500
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;
//set<int>::iterator it;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	string s,t,u;
	int i,j,len,min=11111110,ans=0;
	char c;
	cin>>s;
	u=s;
	for(j=0;j<26;j++){
		c='a'+j;
		t=s=u;
		ans=0;
		while(1){
//			cout<<c<<" "<<t<<" "<<s<<endl;
			len=t.length();
			bool ch=true;
			for(i=0;i<len;i++){
				if(t[i]!=c){
					s=t;
					ch=false;
					break;
				}
			}
			if(!ch){
				t="";
				for(i=0;i<s.length()-1;i++){
					if(s[i]==c||s[i+1]==c)t+=c;
					else t+=s[i];
				}
				ans++;
			}
			else{
				if(min>ans)min=ans;
//				cout<<c<<" "<<ans<<" "<<min<<endl;
				break;
			}
		}
	}
	cout<<min<<endl;
	
	
	
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 256
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

bool isPrime(int x) {
    for (int i = 2; i <= sqrt(x); i++) {
        if (x % i == 0)
            return false;
    }
    if (x == 1)
        return false;
    return true;
}

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int32_t main() {
#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("out.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        int n, m;
        cin >> n >> m;
        int f[n + 1] = {0};
        while (m--) {
            int q;
            cin >> q;
            while (q--) {
                int temp;
                cin >> temp;
                f[temp]++;
            }
        }
        int c = 0;
        loop(1, n + 1) {
            if (f[i] == 0)
                c++;
        }
        cout << c << endl;
    }
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define sort(n) sort(n.begin(), n.end());
#define Out(S) cout << S << endl;
int main() {
  lli A,B,C,D=0,E=-1;
  cin >> A;
  vector<lli>P(A);
  rep(i,A)cin >> P[i];
  rep(i,A){
    if(P[i]%2==0){
      rep(j,INF){
        if(P[i]%2!=0)break;
        else{
          P[i]/=2;
          D++;
        }
      }
    }
  }
  Out(D);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define for0(n) for(i=0; i<(n); i++)
#define forn1 for(i=1; i<=n; i++)




int main()
{
    ll _,i,j,n,a,b,e,k,u,t,x=1,m,y,q,f=1,c=0,d=0,l,p,z,o,r;
    string s,ss;
    cin>>n;
    while(n)
    {
        x=n%10;
        n/=10;
        if(x==7)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 3588
N = input()
S = list(input())
count = 0
num_count = [False]*10
for i in range(len(S)-2):
    s_i = int(S[i])
    if num_count[s_i]:
        continue
    num_count[s_i] = True
    num_count_2 = [False]*10
    for j in range(i+1, len(S)-1):
        s_j = int(S[j])
        if num_count_2[s_j]:
            continue
        num_count_2[s_j] = True
        num_count_3 = [False] * 10
        for k in range(j+1, len(S)):
            s_k = int(S[k])
            if num_count_3[s_k]:
                continue
            num_count_3[s_k] = True
            count += 1
print(count)


Measured memory_bytes: 9168
#include <stdio.h>

int main(){
	int num;
	int r,g,b;

	scanf("%d %d %d", &r, &g, &b);

	num = 100*r + 10*g + b;

	if(num % 4 == 0){
		printf("YES\n");
	} else {
		printf("NO\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long LL;
const LL INF_LL = 1e13+7;
const LL INF = 1e11+7;
const int MAXN = 105;
LL cap[MAXN][MAXN];
int source = 0,sink = 101,n,par[MAXN];
bool visited[105];
vector<int>adjList[105];

bool bfs(){
    for(int i = 0 ; i < 105 ; i++) visited[i] = 0;
    queue<int>q;
    q.push(source);
    visited[source] = true;
    par[source] = -1;
    while(!q.empty()){
        int now = q.front();
        q.pop();
        for(int nxt:adjList[now]){
            if(!visited[nxt] && cap[now][nxt] > 0){
                q.push(nxt);
                par[nxt] = now;
                visited[nxt] = true;
            }
        }
    }
    return visited[sink];
}

LL fordfulkerson(){
    LL max_flow = 0;
    int now,nxt;
    while(bfs()){
        LL path_flow = INF_LL;
        for(nxt = sink ; nxt != source ; nxt = par[nxt]){
            now = par[nxt];
            path_flow = min(path_flow,cap[now][nxt]);
        }
        for(nxt = sink ; nxt != source ; nxt = par[nxt]){
            now = par[nxt];
            cap[now][nxt] -= path_flow;
            cap[nxt][now] += path_flow;
        }
        max_flow += path_flow;
    }
    return max_flow;
}


int main(){
    scanf("%d",&n);
    for(int i = 0 ; i < MAXN ; i++) for(int j = 0 ; j < MAXN ; j++)cap[i][j] = 0;
    sink = n+1;
    LL ans = 0;
    for(int i = 1 ; i <= n ; i++){
        int in;
        scanf("%d",&in);
        if(in >= 0){
            ans += (LL) in;
            adjList[i].pb(sink);
            adjList[sink].pb(i);
            cap[i][sink] = (LL)in;
        }else{
            adjList[source].pb(i);
            adjList[i].pb(source);
            cap[source][i] = (LL)(0-in);
        }
        for(int j = 1 ; j < i ;j++){
            if(i%j == 0){
                adjList[i].pb(j);
                adjList[j].pb(i);
                cap[j][i] = INF;
            }
        }
    }
    ans -= fordfulkerson();
    printf("%lld\n",ans);
    return 0;
}

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

int main(){
    /*
    string a1 = "abc";
    string a2 = "bcd";
    string a3 = "acd";
    vector<string> aa(3);
    aa[0] = a1;
    aa[1] = a2;
    aa[2] = a3;

    for(const auto a : aa){
        cout<<a<<endl;
    }
    sort(aa.begin(), aa.end());
    for(const auto a : aa){
        cout<<a<<endl;
    }
    */
   int N;
   cin>>N;
   using tsii = tuple<string, int, int>;
   vector<tsii> data(N);

   for(int i=0;i<N;i++){
       string ss;
       int p;
       cin>>ss>>p;
       p = -p;
       data.at(i) = make_tuple(ss,p,i);
//       cout<<ss<<p<<i<<endl;
   }

   sort(data.begin(),data.end());
   
   for(int i=0;i<N;i++){
       string s;
       int p;
       int j;
       tie(s,p,j) = data.at(i);
 //      cout<<s<<p<<j<<endl;
       cout<<j+1<<endl;
   }


    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iterator>
#include <fstream>
#include <math.h>

#include <random>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <list>
#include <bitset>
#include <unordered_set>
#include <unordered_map>

#include <random>
#include <ctime>

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define FOR(i, from, to) for (int i = from; i < to; i++)
#define ROF(i, from, to) for (int i = from; i > to; i--)

const long double PI = 3.141592653589793238463;
const int INF = 0x3f3f3f3f;
const int INFS = 1000000000;
const ll M = 998244353;
const ll LLINF = 1000000000000000000;
const double EPS = 1e-8;

#define int long long

vector<vector<int> > tree;
int tmp, k;

void dfs(int v, int prev, int d) {
    if (d > k)
        return;
    ++tmp;
    for (auto u : tree[v]) {
        if (u == prev)
            continue;
        dfs(u, v, d + 2);
    }
}

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

    int n, t1, t2;
    cin >> n >> k;
    tree.resize(n);
    FOR(i, 0, n - 1) {
        cin >> t1 >> t2;
        --t1; --t2;
        tree[t1].push_back(t2);
        tree[t2].push_back(t1);
    }
    int ans = n;
    FOR(v, 0, n) {
        tmp = 0;
        dfs(v, v, 0);
        ans = min(ans, n - tmp);
        for (auto u : tree[v]) {
            if (u > v) {
                tmp = 0;
                dfs(v, u, 1);
                dfs(u, v, 1);
                ans = min(ans, n - tmp);
            }
        }
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3784
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int k, t; cin >> k >> t;
	VE a(t); rep(i, t)cin >> a[i];
	int ma = 0;
	rep(i, t)chmax(ma, a[i]);
	cout << max(ma - 1 - (k - ma), 0LL) << endl;
	return 0;
}

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

int main(){
  int N,M ;
  cin >> N >> M ;
  vector<int> cnt(M, 0) ;
  for(int i=0;i<N;i++){
    int K[i] ;
    cin >> K[i] ;
    for (int j=0; j<K[i];j++){
      int A ;
      cin >> A ;
      A --;
      cnt[A] ++ ;
    }
  }
  int ans =0 ;
  for(int i=0 ;i<M;i++){
    if(cnt[i] == N)
      ans ++ ;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using ll = long long;
using namespace std;
int main(){
    string str;
    ll k,cnt=0;
    cin >> str;
    cin >> k;
    for(cnt=0;cnt<k;cnt++){
        if(str[cnt]!='1') break;
    }
    if(k==cnt)  cout << str[cnt-1] << endl;
    else    cout << str[cnt] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a>=13){
		printf("%d\n",b);
	}else if(a>=6){
		printf("%d\n",b/2);
	}else{
		printf("%d\n",0);
	}
	return 0;
}

Measured memory_bytes: 128
n, k, q = [int(i) for i in input().split()]
dic = {}
for i in range(n):
  dic[i] = k 
for _ in range(q):
  dic[int(input())-1] += 1
for i in range(n):
  if dic[i] - q > 0:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 19464
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    vector<int> x(5);
    cin >> x.at(0) >> x.at(1) >> x.at(2) >> x.at(3) >> x.at(4);
    int po;
    for (int i = 0; i < 5; i++)
    {
        if (x.at(i) == 0)
        {
            po = i+1;
        }
    }
    cout << po;
}

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

A = list(map(int, input().split()))

data = [0] * N
possible = True
MOD = 10**9+7

for a in A:
	data[a] += 1

if N % 2 == 0:
	for i in range(1,N,2):
		if data[i] != 2:
			possible = False
			break
else:
	if data[0] == 1:
		for i in range(2,N,2):
			if data[i] != 2:
				possible = False
				break
	else:
		possible = False

if possible:
	if N % 2 == 0:
		num = N // 2
	else:
		num = (N-1)//2
	ans = 1
	for i in range(num):
		ans = ans * 2 % MOD
		ans %= MOD

	print(ans)
else:
	print(0)


Measured memory_bytes: 14008
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long a[] = new long[5];
		long take[] = new long[5];

		for(int i = 0; i < 5; i++){
			a[i] = sc.nextLong();
			take[i] = (n + a[i] - 1)/a[i];
		}

//		System.out.println(takeA + " "+takeB+" "+takeC+" "+takeD+" "+takeE);


		long result = take[0];

		for(int i = 1; i < 5; i++){
//			if(take[i] > take[0]){
//				result += take[i] - take[0] + 1;
//			}
//			else {
//				result++;
//			}

			result = Math.max(result + 1, i + take[i] );
//			System.out.println("last leaves "+result);
		}
//		result++;

		System.out.println(result);
	}

}

Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine();
            var b = Console.ReadLine();
            if (a.Length > b.Length) Console.WriteLine("GREATER");
            if (a.Length < b.Length) Console.WriteLine("LESS");
            if (a.Length == b.Length)
            {
                for (int i = 0; i < b.Length; i++) 
                {
                    if (a[i] > b[i])
                    {
                        Console.WriteLine("GREATER");
                        break;
                    }
                    if (a[i] < b[i])
                    {
                        Console.WriteLine("LESS");
                        break;
                    }
                    if (a[i] == b[i] && i == b.Length - 1) Console.WriteLine("EQUAL");
                }

            }
        }
    }
}

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

template<class T> inline void chmax(T & a, T b) { if (a < b) a = b; }
template<class T> inline void chmin(T & a, T b) { if (a > b) a = b; }

const long long INF = 1LL << 60;
using namespace std;

int main() {
	int N, K; cin >> N >> K;
	long long h[100100];
	long long dp[100100];
	for (int i = 0; i < N; i++) scanf("%lld", &h[i]);
	for (int i = 0; i < 100100; i++) dp[i] = INF;

	dp[0] = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 1; j <= K; j++) {
			chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
		}
	}

	cout << dp[N-1] << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

int main()
{
	long long a, b2;
	double b;
	cin >> a >> b;
	b2 = (long long)round(b * 100.0);

	//cout << a * b;

	long long out = a * b2;
	int amari = out % 100;
	out -= amari;
	out /= 100;
	cout << out;

	return 0;
}


Measured memory_bytes: 3736
N=int(input())
A =list(map(int,input().split()))
flag=False

ans=0
A.sort()

f=[0]*1000005

for i in A:
    f[i]+=1

for i in range(1,1000001,1):
    if f[i]==0:
        continue
    j=i+i
    while j<=1000000:
        f[j]+=f[i]
        j=j+i

for i in A:
    if f[i]==1:
        ans+=1


print(ans)

Measured memory_bytes: 106292
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits>

int main(){
    long A;
    std::cin >> A;
    std::string B;
    std::cin >> B;
    long Bs = (B[0]-'0')*100+(B[2]-'0')*10+B[3]-'0';
    std::cout << A*Bs/100 << std::endl;
    return 0;
}

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

// #define DEBUG 1

#define int long long
#define for0(i,n) for (int i=0; i<n; i++)
#define iter(c) for(auto it=c.begin(); it!=c.end(); it++)
#define iter2(c) for(auto it2=c.begin(); it2!=c.end(); it2++)
#define pb push_back
#define ms(a,z) memset(a,z,sizeof(a));
#define mp make_pair
#define X first
#define Y second
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define all(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define pmod(x,m) (((x)%(m)+m)%m)
#ifdef int
#define read(x) scanf("%lld",&x);
#else
#define read(x) scanf("%d",&x);
#endif

#ifdef DEBUG
#define nl cout<<"\n";
#define pr(x) cout<<(x)<<" ";
#define prl(x) cout<<#x " = "<<x<<endl;
#define prp(x) cout<<"("<<(x).first<<" "<<(x).second<<") ";
#define printv(v) {for(int _=0; _<sz(v); _++) cout<<v[_]<<" "; cout<<"\n";}
#define printa(a,s) {for (int _=0; _<s; _++) cout<<a[_]<<" "; cout<<"\n";}
#define print2D(a,m,n) {for (int _=0; _<m; _++) {for (int __=0; __<n; __++) cout<<a[_][__]<<" "; cout<<"\n";} cout<<"\n";}
#define priter(v) iter(v) {pr(*it)} nl
#define debug cout<<"ok at line "<<__LINE__<<endl;
#else
#define nl
#define pr(x)
#define prl(x)
#define prp(x)
#define printv(v)
#define printa(a,s)
#define print2D(a,m,n)
#define priter(v)
#define debug
#endif
#define MAXN 200000

using namespace std;

typedef long long ll;

const int INF = 2147483647;
const long long INFL = 9223372036854775807LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;

int next_char[MAXN+5];
int prev_char[MAXN+5]; 
ll dp[MAXN+5]; 

int32_t main()
{
    #ifdef DEBUG
    //freopen("B.txt","r",stdin);
    //freopen("","w",stdout);
    #endif

    int n;
    cin >> n;
    vector<int> chars;
    ms(prev_char, -1); 
    ms(next_char, -1); 
    
    for0(i,n) {
        int c; read(c);
        if (sz(chars) == 0 or c != chars.back()) {
            if (prev_char[c] != -1) {
                next_char[prev_char[c]] = chars.size(); 
            }
            prev_char[c] = chars.size(); 
            chars.push_back(c);            
        }
    }
    n = sz(chars); 
    printa(next_char,n); 
    
    dp[n-1] = 1;
    for (int i=n-2; i>=0; i--) {
        dp[i] = dp[i+1];
        if (next_char[i] != -1) 
            dp[i] = (dp[i] + dp[next_char[i]]) % MOD; 
    }
    printa(dp,n)
    cout<<dp[0]<<endl; 
    return 0;
}


Measured memory_bytes: 6640
#include <bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<double,double> Pdouble;

const int INF = 2000000000;
const int MOD = 1000000007;

int main() {
  vector<ll> a;
  a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a.at(k-1) << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

X, N = map(int, input().split())
Ps = list(map(int, input().split()))
P_set = set(Ps)

ans = 1e9
for i in range(-105, 105):
    if i in P_set:
        continue
    if abs(ans - X) > abs(i - X):
        ans = i
print(ans)




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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, ans = 0, a, even = 0;
  map<ll, ll> mp;
  cin >> n;
  rep(i, n) scanf("%d", &a), mp[a]++;

  for (auto m : mp) {
    if (m.second > 1 && m.second % 2 == 0) even++;
    ans++;
  }

  cout << (even % 2 == 0 ? ans : ans - 1) << endl;
  return 0;
}


Measured memory_bytes: 6528
using System;

namespace Watch
{
    class Program
    {
        static void Main(string[] args)
        {
            var seconds = decimal.Parse(Console.ReadLine());
            var h = (int)(seconds / 3600);
            var m = (int)((seconds - h * 3600) / 60);
            var s = seconds - h * 3600 - m * 60;

            Console.WriteLine("{0}:{1}:{2}", h, m, s);
        }
    }
}



Measured memory_bytes: 18020
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long ll;

class SegmentTree {
private:
	ll num;
	vector<ll> dat;

	// TODO: Change the operator and the identity element.
	static const ll INI = 0;
	ll op(ll a, ll b) {
		return max(a, b);
	}

public:
	SegmentTree(ll n_) {
		num = 1;
		while (num < n_) num *= 2;
		dat = vector<ll>(2 * num, INI);
	}

	// Update the k-th value (0-indexed) to a.
	void update(ll k, ll a) {
		k += num - 1;
		dat[k] = a;
		while (k > 0) {
			k = (k - 1) / 2;
			dat[k] = op(dat[2 * k + 1], dat[2 * k + 2]);
		}
	}

	// Get the value of the range [a, b).
	// k: The index of the node.
	// [left, right): The range corresponds to the k-th node.
	// Call like getval(a, b).
	ll getval(ll a, ll b, ll k = 0, ll left = 0, ll right = -1) {
		if (right < 0) right = num;
		if (right <= a || b <= left) return INI;
		if (a <= left && right <= b) return dat[k];
		ll vleft = getval(a, b, 2 * k + 1, left, left + (right - left) / 2);
		ll vright = getval(a, b, 2 * k + 2, left + (right - left) / 2, right);
		return op(vleft, vright);
	}
};



ll h[200005];
ll a[200005];

int main() {
	ll N; cin >> N;
	for (ll i = 0; i < N; i++) cin >> h[i], h[i]--;
	for (ll i = 0; i < N; i++) cin >> a[i];
	SegmentTree seg(N);
	for (ll i = 0; i < N; i++) {
		ll t = seg.getval(0, h[i]);
		seg.update(h[i], t + a[i]);
	}
	cout << seg.getval(0, N) << endl;
	return 0;
}

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

using namespace std;

int n;

const int M = 303;

double dp[M][M][M];


double f(int i, int j, int k){
	if(i+j+k==0){
		return 1.0;
	}
	if(i < 0 || i > n || j < 0 || j > n || k < 0 || k > n ){
		return 0;
	}
	if(dp[i][j][k] > 0.00001) return dp[i][j][k];
	double total = i+j+k;
	return dp[i][j][k] = i/total * f(i-1,j,k) + (j/total) * f(i+1,j-1,k) + (k / total) * f(i,j+1,k-1) + n / total;
}

int main(){
	cin >> n;
	vector<int> a(4,0);
	for(int i = 0; i < n; i++){
		int x; cin >> x;
		a[x]++;
	}
	cout << fixed << setprecision(16) << f(a[1],a[2],a[3])-1	 << "\n";
	return 0;
}


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

using namespace std;

int NumWin(const auto &you, const auto &me, size_t pass) {
    int res = 0;
    for (size_t i = 0, j = 0; i < you.size() && j < me.size(); ) {
        if (j != pass && you[i] < me[j]) { ++res; ++i; }
        ++j;
    }
    return res;
}

void Erase(auto &data, int x) {
    for (size_t i = 0; i + 1 < data.size(); ++i)
        if (data[i] == x) swap(data[i], data[i + 1]);
    data.pop_back();
}

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

    int n;
    cin >> n;

    vector<int> you(n), me(n);
    for (auto &&x : you) cin >> x;
    for (auto &&x : me) cin >> x;

    vector<int> ord(you);
    sort(you.begin(), you.end());
    sort(me.begin(), me.end());

    int max_win = NumWin(you, me, n);

    vector<int> ans; ans.reserve(n);
    for (const int x : ord) {
        Erase(you, x);

        int lb = 0, ub = me.size();
        int idx = distance(me.begin(), lower_bound(me.begin(), me.end(), x + 1));
        if (idx == ub || (x < me[idx]) + NumWin(you, me, idx) != max_win) ub = idx;
        else lb = idx;

        while (1 < ub - lb) {
            int mid = (lb + ub) >> 1;
            if ((x < me[mid]) + NumWin(you, me, mid) == max_win) lb = mid;
            else ub = mid;
        }

        if (x < me[lb]) --max_win;
        ans.push_back(me[lb]);
        Erase(me, ans.back());
    }

    for (int i = 0; i < n; ++i)
        cout << ans[i] << " \n"[i == n - 1];

    return 0;
}



Measured memory_bytes: 3220
// C - Exception Handling

#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const long double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
// vector<P> vp;
// vp.emplace_back(a[i], b[i]);
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, k, n, w, ans = 0, count = 0;
  string s, t;
  cin >> n;
  vlli d(n), e;
  rep(i, 0, n)
  {
    cin >> d[i];
    e.pb(d[i]);
    // ans = max(ans, d[i]);
  }
  SORTR(e);
  rep(i, 0, n)
  {

    if (e[0] == d[i])
    {
      cout << e[1] << endl;
    }
    else
    {
      cout << e[0] << endl;
    }
    // cout << d << endl;
  }
}

Measured memory_bytes: 4848
#include<stdio.h>
int main(void)
{
	int N,K,X,Y,S,A,B,C;
	scanf("%d %d %d %d",&N,&K,&X,&Y);
	if(N>K){
	A=K*X;
	B=(N-K)*Y;
	C=A+B;
		printf("%d\n",C);
	}
	else{
		A=N*X;
		printf("%d\n",A);
	}
	return 0;
}


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

using namespace std;

int main(){
	long long int x,y;
	cin>>x>>y;
	int ans=1;
	while(1)
	{
		if(x*2<=y)
		{
			x*=2;
			ans++;
		}
		else break;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
N =int(input())
numbers =input().rstrip().split(" ")
evens=[]
for number in numbers:
    if int(number)%2==0:
        evens.append(number)
i=0
#print(evens)
for even in evens:
    if (int(even)%3 != 0) and (int(even)%5 !=0):
        i=i+1
#print(i)
if i>0:
    print("DENIED")
elif i==0:
    print("APPROVED")

Measured memory_bytes: 3064
#include <stdio.h>

static char S[30030];
static int Num[1000];
static int J[10],I[10],K[10];
int main()
{
	long int N;
	scanf("%ld%s",&N,&S);

	long int i=0,j=0,k,tmp=0;;
	//printf("%c %c",S[0],S[1]);
	int jj=0,kk=0;
	for(i=0;i<N-2;i++){
	  if(I[S[i]-'0']==0){ 
	  	I[S[i]-'0']=1;
		for(j=i+1;j<N-1;j++){
			if(J[S[j]-'0']==0){
				J[S[j]-'0']=1;jj++;
				for(k=j+1;k<N;k++){
					if(K[S[k]-'0']==0){
						Num[(S[i]-'0')*100+(S[j]-'0')*10+(S[k]-'0')]=1;
						K[S[k]-'0']=1;
						kk++;
					}
					if(kk==10)break;
				}
				kk=0;
				for(tmp=0;tmp<10;tmp++)K[tmp]=0;
			}
			if(jj==10){
				break;
			}
		}
	  	jj=0;
	  	for(tmp=0;tmp<10;tmp++)J[tmp]=0;
	  }
	}
	int cnt=0;
	for(i=0;i<1000;i++){
		if(Num[i]==1){
			cnt++;
		//	printf("%d ",i);
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N=4205,mo=998244353;
int C[N][N],n,k,i,j,ans,mi[N];
int main(){
	for(i=*mi=1;i<N;++i)mi[i]=(mi[i-1]<<1)%mo;
	scanf("%d%d",&k,&n);
	for(i=**C=1;i<N;++i)for(j=*C[i]=1;j<=i;++j)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mo;
	for(i=2;i<=k*2;++i){
		ans=0;
		int ub=0;
		for(j=1;j<i-j && j<=k;++j)ub+=i-j<=k;
		if(i%2==1){
			int mu=1;
			for(j=0;j<=ub;++j,mu=-mu)
				ans=(ans+mo+1ll*mu*C[ub][j]*C[n-j*2+k-1][k-1]%mo)%mo;
		}else{
			int mu=1;
			for(j=0;j<=ub;++j,mu=-mu)
				ans=(ans+mo+1ll*mu*C[ub][j]*C[n-j*2+k-2][k-2]%mo)%mo;
			for(j=0,mu=1;j<=ub;++j,mu=-mu)
				ans=(ans+mo+1ll*mu*C[ub][j]*C[n-j*2-1+k-2][k-2]%mo)%mo;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 67840
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;

fn main() {
    input! {
        n: usize,
        day: [[usize; 3]; n],
    }

    let mut dp = vec![vec![0; 3]; n];
    dp[0][0] = day[0][0];
    dp[0][1] = day[0][1];
    dp[0][2] = day[0][2];

    for i in 1..n {
        dp[i][0] = cmp::max(dp[i-1][1], dp[i-1][2]) + day[i][0];
        dp[i][1] = cmp::max(dp[i-1][0], dp[i-1][2]) + day[i][1];
        dp[i][2] = cmp::max(dp[i-1][0], dp[i-1][1]) + day[i][2];
    }
    
    let mut max = 0;
    for i in 0..3 {
        max = cmp::max(max, dp[n-1][i]);
    }

    println!("{}", max);



}


Measured memory_bytes: 18684