akhauriyash/Code-Regression huggingface dataset:
/*
 * main.c
 *
 *  Created on: 2019/07/21
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	int N = 0;
	int val = 0;
	int val2 = 0;
	double value = 0.0;
    scanf("%d", &N);
    value = (double)N/1.08;
    val = (double)value;
    val2 = val+1;
    if ((int)(val * 1.08) == N) {
    	printf("%d\n", val);
    } else if ((int)(val2 * 1.08) == N) {
    	printf("%d\n", val2);
    } else {
    	printf(":(\n");
    }
	return 0;
}


Measured memory_bytes: 128
h1, h2 = [int(_) for _ in input().split()]
k1, k2 = [int(_) for _ in input().split()]

a, b, c, d = [int(_) for _ in input().split()]

s = (h1-k1)*a + (h2-k2)*b + ((h1//10)-(k1//10))*c + ((h2//20)-(k2//20))*d

if s > 0:
    print('hiroshi')
elif s < 0:
    print('kenjiro')
else:
    print('even')



Measured memory_bytes: 5604
#include <stdio.h>

int main(void) {
	char s[100];
	int i, j, count = 0;

	scanf("%s", s);

	i = 0;
	while (s[i] != 0)
		i++;

	for (j = 0; j < i; j++) {
		if (s[j] != s[i - j - 1])
			count++;
	}

	printf("%d", count/2);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

vector<vector<int>> G;
int dfs(int tmp, int par) {
  if(G[tmp].size() == 0) return 1;
  multiset<int, greater<int>> se, se2;
  for(int ne: G[tmp]) se.insert(dfs(ne, tmp));
  auto itr = se.begin();
  rep(i, se.size()) {
    se2.insert(*itr+i);
    itr++;
  }
  return *se2.begin()+(par!=-1);
}
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  G = vector<vector<int>>(N);
  A[0] = -1;
  REP(i, 1, N) {
    cin >> A[i];
    A[i]--;
    G[A[i]].push_back(i);
  }
  cout << dfs(0, -1) << endl;
  return 0;
}


Measured memory_bytes: 21760
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) (a*a)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int main() {
	int a;
	cin >> a;
	if (a < 1200)cout << "ABC" << endl;
	else cout << "ARC" << endl;
	return 0;
}

Measured memory_bytes: 256
#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef long long ll;

const int INF=1e9;
char fi[101][101];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
double EPS = 1e-10;
int N,M;
int sx,sy;
int gx,gy;
int w,h;
int ans;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003


int dp[353][353]={0};
int bow[353][353]={0};
double add(double a,double b){
	if(abs(a+b)<EPS*(abs(a)+abs(b)))
	return 0;
	return a+b;
}

struct P{
	double x,y;
	P(){}
		P(double x,double y):x(x),y(y){
		}
		P operator + (P p){
			return P(add(x,p.x),add(y,p.y));
		}
		P operator - (P p){
			return P(add(x,-p.x),add(y,-p.y));
		}
		P operator *(double d){
			return P(x*d,y*d);
		}
		double dot(P p){
			return add(x*p.x,y*p.y);
		}
		double det(P p){
			return add(x*p.y,-y*p.x);
		}
};

bool cmp_x(const P& p,const P& q){
	if(p.x!=q.x) return p.x<q.x;
	return p.y<q.y;
}

vector<P> convex_hull(P* ps, int n){
	sort(ps,ps+n,cmp_x);
	int k=0;
	vector<P> 	qs(n*2);
	
	rep(i,n){
		while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
			k--;
		qs[k++]=ps[i];
	}
	for(int i=n-2,t=k;i>=0;i--){
		while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
		k--;
		qs[k++]=ps[i];
	}
	qs.resize(k-1);
	return qs;
}

int n,m;
vector<double> p;
P ps[101];
char c[520][520];
long long mod=1000000007;
long long pow(ll i,ll j){
	ll tmp=1;
	while(j){
		if(j%2) tmp=tmp*i%mod;
		i=i*i%mod;
		j/=2;
	}
	return tmp;
}
int cards[10];
bool ok;
void saiki(int deep){
	if(deep==4){
		ok=true;
		return;
	}
	for(int i=1;i<=7;i++){
		if(cards[i]>0&&cards[i+1]>0&&cards[i+2]>0){
			cards[i]--;
			cards[i+1]--;
			cards[i+2]--;
			saiki(deep+1);
			cards[i]++;
			cards[i+1]++;
			cards[i+2]++;
		}
		for(int i=1;i<=9;i++){
			if(cards[i]>2){
				cards[i]-=3;
				saiki(deep+1);
				cards[i]+=3;
			}
		}
	}
	
}

int main(){
	
	string s;
	while(cin>>s){
		for(int i=0;i<=9;i++){
			cards[i]=0;
		}
		queue<int> a;
		bool f=false;
		
	rep(i,s.size()){
		cards[s[i]-'0']++;
		if(cards[s[i]-'0']>4){
			f=true;
			break;
		}
	}
		if(!f){
	for(int i=1;i<=9;i++){
		if(cards[i]<4){
			ok=false;
			cards[i]++;
			for(int j=1;j<=9;j++){
				if(cards[j]>1){
					cards[j]-=2;
					saiki(0);
					if(ok){
						a.push(i);
						cards[j]+=2;
						break;
					}
					cards[j]+=2;
				}
			}
			cards[i]--;
		}
			
	}
	}
		if(f||a.empty())
			cout<<0<<endl;
	else{
		cout<<a.front();
		a.pop();
		while(!a.empty()){
			cout<<" "<<a.front();
			a.pop();
		}
		cout<<endl;
		
	}
	}
}

Measured memory_bytes: 1196
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
#define F first
#define S second

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

v2<vector<int>> dp;

// int f(int index, int n0, int n9){
//     if(n0<0 || n9<0) return 0;
//     if(index==-1) return n0==0 && n9==0;
//     if(dp[index][n0][n9]!=-1) return dp[index][n0][n9];

//     cout << index << " " << n0 << " " << n9 << "\n";

//     dp[index][n0][n9] = (8LL*f(index-1, n0, n9) + f(index-1, n0-1, n9) + f(index-1, n0, n9-1)) % MOD;
//     return dp[index][n0][n9];
// }

void solve(){
    int n;
    cin>>n;

    dp = fill(n+1, 2, vector<int>(2, 0)); //1

    dp[0][0][0] = 1;

    for(int index = 1; index <= n; ++index){
        // for(int n0 = 0; n0 <= 1; ++n0){
        //     for(int n9 = 0; n9 <= 1; ++n9){
        //         ll a = dp[index-1][n0][n9];
        //         ll b = (n0-1 >= 0) ? dp[index-1][n0-1][n9] : 0;
        //         ll c = (n9-1 >= 0) ? dp[index-1][n0][n9-1] : 0;
        //         dp[index][n0][n9] = (8LL*a + b + c) % MOD;
        //     }
        // }

        v2<int> d = dp[index-1];

        dp[index][0][0] = (8LL*d[0][0])%MOD;

        dp[index][0][1] = (9LL*d[0][1] + d[0][0])%MOD;

        dp[index][1][0] = (9LL*d[1][0] + d[0][0])%MOD;

        dp[index][1][1] = (10LL*d[1][1] + d[0][1] + d[1][0])%MOD;
    }

    // int ans = f(n-1,1,1);
    int ans = dp[n][1][1];
    cout << ans << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 151504
//
//  main.c
//  ITP1_4_B
//
//  Created by k16031kk on 2018/05/21.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    double r;
    scanf("%lf", &r);
    printf("%lf %lf\n", r*r*M_PI, 2*r*M_PI);
    return 0;
}



Measured memory_bytes: 2044
#include <stdio.h>

int main(void){
	int n,x[100],y[100];
	int va_x,va_y,vb_x,vb_y;
	int i,count=1;
	double s=0.0,sum=0.0;

	scanf("%d",&n);

	do{
		sum = 0.0;
		for(i = 0;i < n;i++){
			scanf("%d %d",&x[i],&y[i]);
		}

		for(i = 1;i < n-1;i++){
			va_x = x[i]-x[0];
			va_y = y[i]-y[0];
			vb_x = x[i+1]-x[0];
			vb_y = y[i+1]-y[0];
			
			s = ((double)va_x*vb_y-(double)va_y*vb_x)/2;
			sum+=s;
		}

		printf("%d %.1f\n",count++,-sum);
		scanf("%d",&n);
	}while(n != 0);

	return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class I,class V=typename I::value_type>V sum_up(const I&l,const I&r){V v;for(I i=l;i!=r;i++)v=i==l?*i:v+*i;return v;}
template<class I,class T=iterator_traits<I>>I operator+(I it,int n){for(int i=0;i<n;i++)it++;return it;}
template<class I,class T=iterator_traits<I>>I operator-(I it,int n){for(int i=0;i<n;i++)it--;return it;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
    int N, K, C;
    cin >> N >> K >> C;
    string S;
    cin >> S;

    if (C == 0) {
        vector<int> v;
        for (int i = 0; i < N; i++) {
            if(S[i] == 'o') v.push_back(i + 1);
        }
        if(v.size() == K) {
            for(int x : v) cout << x << endl;
        }
        return 0;
    }

    C++;
    S = string(C, 'x') + S;
    N += C;


    vector<int> F(N, 0), B(N, 0);
    for(int b = 0; b < 2; b++) {
        int x = 0;
        for (int i = 0; i < N; i++) {
            if(S[i] == 'o') {
                x = 1 + (i >= C ? F[i - C] : 0);
            }
            F[i] = x;
        }
        reverse(WHOLE(S));
        swap(F, B);
    }
    reverse(WHOLE(B));
    vector<int> P(N);
    for(int i = 0; i < N; i++) {
        int k = F[i];
        if(i + C < N) k += B[i + C];
        P[i] = K > k;
    }
    vector<int> Q(N, 0);
    for(int i = 0; i < N; i++) {
        Q[i] = (i ? Q[i - 1] : 0) + P[i];
    }
    vector<int> ans;
    for(int i = 0; i < N; i++) {
        int q = Q[i + C - 1] - Q[i];
        if(q == C - 1) ans.push_back(i + 1);
    }
    for(int x : ans) cout << x << endl;
    return 0;
}



Measured memory_bytes: 3776
#include<bits/stdc++.h>
int a(int n)
{
	int i,s=0;
	for(i=1;i<=n;i++)
	{
		s+=i;
	}
	return s;
}
int main()
{
	int i,j,n,m,s=0;
	scanf("%d %d",&n,&m);
	for(i=1;;i++)
	{
		if(m-n==i)
		{
			printf("%d",a(i)-m);
			return 0;
		}
	}
	return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    int coin[m];
    for (int i = 0; i < m; ++i)
    {
        cin >> coin[i];
    }
    vector<int> dp(n + 1, 1e9);
    dp[0] = 0;
    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            if (coin[j] <= i)
            {
                dp[i] = min(dp[i], dp[i - coin[j]] + 1);
            }
        }
    }
    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 3156
import random
import numpy
import sys
import copy

N=int(input())
m = 0
l = [9 for i in range(len(str(N)))]
for i in range(0,len(l)):
  s = copy.deepcopy(l)
  for j in range(9,-1,-1):
    s[i] = j
    num = int(''.join(map(str,s)))
    if num<=N:
      m=sum(s)
      print(m)
      exit()


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

int main(void) {
	int A, B;
	
	scanf("%d %d", &A, &B);
	printf("%d\n", A >= 13 ? B : A >= 6 ? B / 2 : 0);
	
	return 0;
}

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

using namespace std;
 
int main(){
	int n;
    cin >> n;
    vector<int> a(n), b(n), c(n-1);

    for (int i=0; i<n; i++){
      cin >> a[i];
    }
    for (int i=0; i<n; i++){
      cin >> b[i];
    }
    for (int i=0; i<n-1; i++){
      cin >> c[i];
    }

    int p1, p2;
    p1 = 0;
    p2 = 0;

    for (int i=0; i<n; i++){
      p1 += b[a[i]-1];
      if (a[i+1] == a[i] + 1) {
        p2 += c[a[i]-1];
      }
    }

    cout << p1 + p2 << endl;
    return 0;
}

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

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

void insert(int);
void inorder(struct Node *);
void preorder(struct Node *);

struct Node *root,*NIL;

int main(){
  int m,i,x;
  char com[10];
  
  scanf("%d",&m);

  for(i=0;i<m;i++){
    scanf("%s",com);
    if(strcmp(com,"insert")==0){
      scanf("%d",&x);
      insert(x);
    }
    else if(strcmp(com,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void insert(int k){
  struct Node *y=NIL;
  struct Node *x=root;
  struct Node *z;

  z=(struct Node *)malloc(10*sizeof(struct Node *));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  
  z->parent=y;
  if(y==NIL){
    root=z;
  }else{
    if(z->key < y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}

void inorder(struct Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct Node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


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

#define N_MAX 200002
#define ll long long

using namespace std;

int n;

int h[N_MAX];
ll b[N_MAX];

ll aib[N_MAX];

void update (int pos, ll val)
{
    for(int i = pos; i <= n; i += i&(-i))
        aib[i] = max(aib[i], val);
}

ll query (int pos)
{
    ll ans = 0;
    for(int i = pos - 1; i >= 1; i -= i&(-i))
        ans = max(ans, aib[i]);
    return ans;
}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> h[i];
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    for(int i = 1; i <= n; i++)
    {
        ll dp = query(h[i]) + b[i];
        update(h[i], dp);
    }
    cout << query(n + 1) << "\n";
    return 0;
}


Measured memory_bytes: 4096
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<bitset>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;



/******************************************************************************************/


const int IINF = 1e9 + 7;
const ll LINF = 1e18 + 7;
const ll MOD = 1e9 + 7;


// 多次元vector生成，初期化
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {for (T& x : vec) is >> x;return is;}
// pair
template <typename T, typename U>ostream& operator<<(ostream & os, pair<T, U> & pair_var) {	os << "(" << pair_var.first << ", " << pair_var.second << ")";return os;}
// vector
template <typename T>ostream& operator<<(ostream & os, const vector<T> & vec) {	os << "{";	for (int i = 0; i < vec.size(); i++) {os << vec[i] << (i + 1 == vec.size() ? "" : ", ");}os << "}";return os;}
// map
template <typename T, typename U>ostream& operator<<(ostream & os, map<T, U> & map_var) {os << "{";	repi(itr, map_var) {os << *itr;itr++;if (itr != map_var.end()) os << ", ";itr--;}os << "}";return os;}
// set
template <typename T>ostream& operator<<(ostream & os, set<T> & set_var) {os << "{";repi(itr, set_var) {os << *itr;itr++;if (itr != set_var.end()) os << ", ";itr--;}os << "}";return os;}

ll dp[1 << 14];

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	
	int H, W, A, B;
	cin >> H >> W >> A >> B;

	auto mp = make_v<int>(H, W);
	fill_v(mp, 0);

	for (int i = 0; i < H - B; i++)
	{
		for (int j = 0; j < W - A; j++)
		{
			mp[i][j] = 1;
		}
	}

	for (int i = H - B; i < H; i++)
	{
		for (int j = W - A; j < W; j++)
		{
			mp[i][j] = 1;
		}
	}

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			cout << mp[i][j];

		}
		cout << endl;

	}



}

Measured memory_bytes: 5248
#include <iostream>
using namespace std;
#define MAX_N 50000

bool isPrime[MAX_N + 1];
int n, cnt;

void seive(){
  for(int i = 0; i <= MAX_N; i++) isPrime[i] = true;
  isPrime[0] = isPrime[1] = false;
  for(int i = 2; i * i <= MAX_N; i++){
    if(isPrime[i]){
      for(int j = i * i; j <= MAX_N; j += i) isPrime[j] = false;
    }
  }
}

int main(void){
  seive();
  while(true){
    cin >> n;
    if(n == 0) break;
    cnt = 0;
    for(int i = 2; i <= n / 2; i++){
      if(isPrime[i] && isPrime[n-i]) cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;


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

std::vector<ll> a(n);
rep(i,n) cin >> a.at(i);

sort(all(a));

ll number=a.at(0);
ll del=0,count=0,N=0;
ll i;
for(i=0;i<n;i++){
  if(number==a.at(i)){
    count++;
  }else{
    if(count>number){
      del+=count-number;
    }
    else if(count<number){
      del+=count;
    }
    number=a.at(i);
    count=1;
  }
}

if(count>number){
  del+=count-number;
}
else if(count<number){
  del+=count;
}

cout << del << endl;



}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//(double)clock() / CLOCKS_PER_SEC;
string s[109];
bool reach[109][109][109];
vi G[109];
vi GV[2509];
int vis[2509];
int vis0[109];
int pr[2509];
int pr0[109];
int vcnt;
int n, m;
bool improve(int x)
{
    vis[x]=vcnt;
    for(int nb: GV[x])
    {
        //cout<<nb<<" : "<<x<<endl;
        if(vis0[nb]<vcnt)
        {
            if(pr0[nb]==nb)
            {
                pr0[nb]=x;
                pr[x]=nb;
                return true;
            }
            vis0[nb]=vcnt;
            if(improve(pr0[nb]))
            {
                pr0[nb]=x;
                pr[x]=nb;
                return true;
            }
        }
    }
    return false;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    int piecesum=0;
    int pcnt=0;
    for(int i=0; i<n; i++)
    {
        cin>>s[i];
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            pr[i*m+j]=i*m+j;
            if(s[i][j]=='o')
            {
                pcnt++;
                pr0[pcnt]=pcnt;
                piecesum+=(i+j);
                reach[pcnt][i][j]=true;
                G[pcnt].push_back(i*m+j);
                GV[i*m+j].push_back(pcnt);
                for(int ii=i; ii<n; ii++)
                {
                    for(int jj=j; jj<m; jj++)
                    {
                        if(i==ii && j==jj) continue;
                        if(s[ii][jj]=='#') continue;
                        if(reach[pcnt][ii-1][jj] || reach[pcnt][ii][jj-1])
                        {
                            reach[pcnt][ii][jj]=true;
                            G[pcnt].push_back(ii*m+jj);
                            GV[ii*m+jj].push_back(pcnt);
                        }
                    }
                }
            }
        }
    }
    /*for(int i=0; i<n*m; i++)
    {
        cout<<i<<endl;
        for(int x: GV[i]) cout<<x<<" ";
        cout<<endl;
    }˛*/
    int anssum=0;
    for(int ijsum=n+m-2; ijsum>=0; ijsum--)
    {
        for(int i=0; i<n; i++)
        {
            int j=ijsum-i;
            if(j<0 || j>=m) continue;
            if(s[i][j]=='#') continue;
            vcnt++;
            if(improve(i*m+j))
            {
                anssum+=(i+j);
            }
        }
    }
    cout<<anssum-piecesum<<endl;
    //cout<<piecesum<<endl;
    return 0;
}


Measured memory_bytes: 5156
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    vector<vector<int>> c(3,vector<int>(3));
    rep(i,3)rep(j,3) cin>>c[i][j];
    vector<int> a(3);
    rep(a0,101)rep(a1,101)rep(a2,101){
        a[0]=a0,a[1]=a1,a[2]=a2;
        vector<set<int>> b(3);
        rep(i,3)rep(j,3){
            //c[i][j]=a[i]+b[j];
            b[j].insert(c[i][j]-a[i]);
        }
        bool flag=true;
        rep(i,3) if(b[i].size()>=2) flag=false;
        if(flag){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

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

signed main() {
	vector<int> a(128);
	int N;

	a[0] = 1;
	for (int i = 1; i <= 32; ++i) {
		a[i] = a[i-1];
		if (i >= 2) a[i] += a[i-2];
		if (i >= 3) a[i] += a[i-3];
	}
	
	while (cin >> N && N) {
		cout << ceil((double)a[N] / 3650) << endl;
	}
}



Measured memory_bytes: 3132
N = int(input())
lst = [int(x) for x in input().split(" ")]

min = 10000*N

lst.sort()

for i in range(lst[0],lst[-1]+1):
  x = 0
  for j in lst:
    x += (j-i)*(j-i)
  if x < min:
    min = x

print(min)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin>>S;
    long int count=0,sum=0;
    for(int i=0;i<S.size();i++){
        if(S[i]=='B'){
            count++;
        }
        else{
            sum+=count;
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <list>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using Wbool = std::vector<Vbool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;
template <class T>
using Vec = std::vector<T>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), std::make_pair(-1, 0), std::make_pair(0, 1), std::make_pair(0, -1)};
constexpr char BR = '\n';

#define DEBUG(x) std::cerr << #x << " = " << x << '\n';
#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
#define RSORT(A) std::sort((A).rbegin(), (A).rend())
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())



template <class T> inline int argmin(std::vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(std::vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
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;}
template <class T> inline void reverseSORT(Vec<T> &Array){
  std::sort(Array.begin(), Array.end(), std::greater<T>());
}
inline int BitI(int k){return 1 << k;}
inline lli BitL(int k){return 1LL << k;}
inline void putsDouble(double d){printf("%.16lf\n", d);}
inline int toInt(const string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res;
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






int main(void){
    int n, m; scanf("%d%d", &n, &m);
    Vint A(n, 0);
    REP(i, m){
        int l, r; scanf("%d%d", &l, &r);
        A[l-1]++;
        if(r != n) A[r]--;
    }
    REP(i, n-1) A[i+1] += A[i];
    int cnt = 0;
    REP(i, n){
        if(A[i] == m){
            cnt++;
        }
    }
    printf("%d\n", cnt);
    return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
   void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------
const int INF = 1e9+1000;
ll n, a, b;
ll h[111111];

bool ok(ll x) {
   ll c = a - b;
   ll cnt = 0;
   rep (i, n) {
      ll t = h[i] - x * b;
      if (t > 0) cnt += (t+c-1)/c;
   }
   return cnt <= x;
}

int main() {
   cin >> n >> a >> b;
   rep (i, n) cin >> h[i];
   ll low = 0, high = INF;
   while (low+1 < high) {
      ll x = (low + high) / 2;
      if (ok(x)) high = x;
      else low = x;
   }
   cout << high << endl;

   return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define R cin>>
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<char,int> P;
map<P,int> m;
map<char,int> mm;
int p,z;
string s;
string dfs() {
  if(p>=s.size() || s[p]==']') return "-2";
  if(isalpha(s[p])) {
    char c=s[p];
    p+=2;
    string d=dfs();
    stringstream ss,ss2;
    ss << d;
    int x;
    ss >> x;
    if(x==-1) return "-1";
    if(!mm.count(c)) return "-1";
    if(x>=mm[c]) return "-1";
    if(!m.count(P(c,x))) return "-1";
    ss2 << m[P(c,x)];
    ss2 >> d;
    return d;
  }
  string t="";
  t+=s[p];
  p++;
  string d=dfs();
  if(d=="-1") return "-1";
  if(d!="-2") t+=d;
  return t;
}

int solve() {
  p=2;
  string r=dfs();
  stringstream ss,ss2;
  ss << r;
  int d;
  ss >> d;
  if(d==-1) return -1;
  while(p<s.size() && s[p]==']') p++;
  if(p>=s.size()) {
    mm[s[0]]=d;
    return 1;
  }
  if(!mm.count(s[0])) return -1;
  if(d>=mm[s[0]]) return -1;
  if(s[p]=='=') p++;
  int c;
  if(isalpha(s[p])) {
    char ch=s[p];
    p+=2;
    r=dfs();
    ss2 << r;
    ss2 >> c;
    if(c==-1) return -1;
    if(!mm.count(ch)) return -1;
    if(c>=mm[ch]) return -1;
    if(!m.count(P(ch,c))) return -1;
    c=m[P(ch,c)];
  } else {
    r=dfs();
    ss2 << r;
    ss2 >> c;
  }
  m[P(s[0],d)]=c;
  return 1;
}

int main() {
  int ans=-1;
  while(1) {
    R s;
    if(s==".") {
      if(!z) break;
      if(ans==-1) pr(0);
      else pr(ans);
      ans=-1;
      z=0;
      m.clear();
      mm.clear();
      continue;
    }
    z++;
    if(solve()==-1) {
      if(ans==-1) ans=z;
    }
  }
  return 0;
}


Measured memory_bytes: 1328
using System;
using System.IO;
using System.Collections.Generic;
using System.Numerics;

namespace abc140
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_abc140A();
        }

        public static void solve_abc140A()
        {
            int n = Convert.ToInt32(Console.ReadLine());            

            Console.WriteLine(Math.Pow(n, 3));
        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr ll INF = 1e18 + 10;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

using namespace std;
//    cout << setprecision(20) << ans << "\n";

vector<pair<ll, ll>> primeFactorize(ll N)
{
    vector<pair<ll, ll>> res;
    for (ll a = 2; a * a <= N; ++a)
    {
        if (N % a != 0)
            continue;
        ll ex = 0;

        while (N % a == 0)
        {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }

    if (N != 1)
        res.push_back({N, 1});
    return res;
}

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

    int n;
    cin >> n;
    vector<ll> a(n);

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

    ll x = a[0];
    for (int i = 1; i < n; i++)
    {
        x ^= a[i];
    }

    for (int i = 0; i < n - 1; i++)
    {
        ll o = x ^ a[i];
        cout << o << " ";
    }
    ll e = x ^ a[n - 1];
    cout << e << "\n";

    return 0;
}


Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define SZ(x) ((int)x.size())
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
int n, a[4010], b[4010], sum[2][4010][2010];
int pos[2][2010];
int dp[2010][2010];
int main() {
	scanf("%d", &n);
	for(int i=1; i<=n+n; i++) {
		char ch;
		scanf(" %c %d", &ch, a+i);
		b[i] = ch == 'B';
		pos[b[i]][a[i]] = i;
		for(int j=a[i]; j<=n; j++)
			sum[b[i]][i][j]++;
	}
	for(int k=0; k<2; k++)
		for(int i=1; i<=n+n; i++)
			for(int j=1; j<=n; j++)
				sum[k][i][j] += sum[k][i-1][j];
	for(int i=0; i<=n; i++) {
		for(int j=0; j<=n; j++) {
			int p1 = pos[0][i];
			int p2 = pos[1][j];
			if(!i && !j) continue;
			else if(!i) {
				dp[i][j] = dp[i][j-1] + p2 - 1 - sum[1][p2][j-1] - sum[0][p2][i];
			} else if(!j) {
				dp[i][j] = dp[i-1][j] + p1 - 1 - sum[0][p1][i-1] - sum[1][p1][j];
			} else {
				dp[i][j] = min(dp[i-1][j] + p1 - 1 - sum[0][p1][i-1] - sum[1][p1][j], dp[i][j-1] + p2 - 1 - sum[1][p2][j-1] - sum[0][p2][i]);
			}
		}
	}
	printf("%d", dp[n][n]);
	return 0;
}

Measured memory_bytes: 78976
/*input
20 40 6

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define mod 1000000007
#define PI 3.14159265
// #define endl '\n'
#define debug(x) cout << #x << " = " << x << endl;
#define MAX 250001

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(ll a, ll b) {a += b; if (a < 0) a += mod; return a;}
inline int sub(ll a, ll b) {a -= b; if (a < 0) a += mod; return a;}
inline int mul(ll a, ll b) {return (a * 1ll * b) % mod;}
inline int pwr(ll x, ll y) {
  int ans = 1 % mod;
  while (y) {
    if (y & 1) ans = mul(ans, x);
    x = mul(x, x);
    y >>= 1;
  }
  return ans;
}
inline int inv(int a) {return pwr(a, mod - 2);}


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

  string str;
  cin >> str;
  int n = str.size();
  int ans1 = 0, ans2 = 0;
  char c1 = '0', c2 = '1';
  for (int i = 0; i < n; i++) {
    if (i & 1) {
      ans1 += (str[i] != c1);
    }
    else {
      ans1 += (str[i] != c2);
    }
  }
  for (int i = 0; i < n; i++) {
    if (i & 1) {
      ans2 += (str[i] != c2);
    }
    else {
      ans2 += (str[i] != c1);
    }
  }
  cout << min(ans1, ans2) << endl;

  return 0;
}

Measured memory_bytes: 512
def main():
    N = int(input())
    ans = 0
    for i in range(1,N+1):
        div = 0
        for c in range(1,i+1):
            if i%c == 0:
                div = div +1
        if div == 8 and (i%2)==1:
            ans = ans+1
    print(ans)
main()

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

#define FOR(i,s,e) for(int i=s;i<e;i++)
#define RFOR(i,s,e) for(int i=s;i>=e;i--)

// vector<int> vec(N,0) →長さN,0初期化
// vec[i]→ iにアクセス、vec.push_back(x)　→末尾にxを追加
// vec.size()サイズ取得
// vec2d[20][10] == vector<<vectror<int>> vec2d(20, vector<int>(10,0))
#define SORT(vec) sort(vec.begin(),vec.end())
#define MAX(vec) *max_element(vec.begin(),vec.end())
#define MAXID(vec) distance(vec.begin(),max_element(vec.begin(),vec.end()))
#define MIN(vec) *min_element(vec.begin(),vec.end())
#define MINID(vec) distance(vec.begin(),min_element(vec.begin(),vec.end()))
#define NID(vec,n) distance(vec.begin(),find(vec.begin(),vec.end(),n))



int N,M;



int kitri(int a,int b,int c);

int main(){
	bool tri = true;
	int a,b,c,d;cin >> a >> b >> c >> d;
	int A,B,C,D;cin >> A >> B >> C >> D;
	int sum0 = a + b + c + d;
	int sum1 = A + B + C + D;
	if (sum0>sum1) cout << sum0 << endl;
	else cout << sum1 << endl;
	return 0;
}

int kitri(int a,int b,int c){
	if (pow(a,2) + pow(b,2) < pow(c,2)) return 0;
	if (pow(a,2) + pow(b,2) == pow(c,2)) return 1;
	if (pow(a,2) + pow(b,2) > pow(c,2)) return 2;
	else return 114514;
}



Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <vector>

typedef long long ll;
#define rep(i,n) for(ll i = 0; i < n; i++)

using namespace std;

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

	ll total=0;

	rep(i,n){
		total += a[i];
	}
	if(total >= h){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
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;
}
template <class T>
inline T gcd(T m, T n) {
  if (n == 0)
    return m;
  else
    return gcd(n, abs(m) % abs(n));
}

#define IOS ios::sync_with_stdio(false), cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()
#define MAX(a) *max_element(all(a))

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vc = vector<char>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vvi;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  IOS;
  constexpr char endl = '\n';

  int M, N;
  cin >> N >> M;
  vi a(N);
  rep(i, N) cin >> a[i];

  int sum = accumulate(all(a), 0);

  int cnt = 0;
  rep(i, N) {
    if (a[i] >= sum / 4.0 / M) cnt++;
  }

  string res = (cnt >= M) ? "Yes" : "No";
  cout << res << endl;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
const int INF = 1 << 30;
using namespace std;
#define pp pair<int,int>
#define FOR(i,a,n) for(int i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
int main() {
	int ans = 0;
	bitset<110>b = {};
	TFOR(i, 3) {
		int n; cin >> n;
		if (!b[n]) { ++ans; b[n] = 1; }
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//       BAAP IZ HERE           //
#include<bits/stdc++.h>
using namespace std;
#define gcd __gcd
#define lli long long int
#define jmd ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int main()
{
    jmd;
    string s;
    lli n;cin>>n;
    lli ac=0,wa=0,tle=0,re=0;
    while(n--)
    {
        cin>>s;
        if(s=="AC")
            ac++;
        if(s=="WA")
            wa++;
        if(s=="TLE")
            tle++;
        if(s=="RE")
            re++;
    }
    cout<<"AC x "<<ac<<"\n";
    cout<<"WA x "<<wa<<"\n";
    cout<<"TLE x "<<tle<<"\n";
    cout<<"RE x "<<re<<"\n";
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

#include <vector>
#include <iostream>
#include <cstdio>

using namespace std;

const int MAX_V = 200000;

struct edge {int to, cost; };
vector<vector<edge>> G(MAX_V,vector<edge>(0));
vector<int> color(MAX_V,-1);

//頂点を色０と１で塗っていく
void dfs(int v,int c){
    color.at(v) = c;
    rep(i,G.at(v).size()){
        edge &e = G.at(v).at(i);
        if(color.at(e.to) == -1) dfs(e.to,e.cost^c);
    }
}

int main() {
    int V;
    scanf("%d", &V);
    int E = V-1;
    for(int i = 0; i < E; i++) {
        // sからtへの辺を張る
        int s,t,w;
        scanf("%d %d %d", &s, &t, &w);
        w = w&1;
        s--;
        t--;
        G.at(s).push_back(edge{t,w});
        G.at(t).push_back(edge{s,w});
    }

    dfs(0,1);
    /*rep(i,V){
        rep(j,G.at(i).size()){
            cout 
            << i << ' ' 
            << G.at(i).at(j).to << ' ' 
            << G.at(i).at(j).cost << ' ' 
            << G.at(i).size() 
            << endl;
        }
    }*/
    rep(i,V) cout<<color.at(i)<<endl;
    return 0;
}


Measured memory_bytes: 11136
s = input()

s1=""
s2=""

for i in range(len(s)):
    if i%2==0:
        s1+='1'
        s2+='0'
    else:
        s1+='0'
        s2+='1'

ans1=0
ans2=0

for i in range(len(s)):
    if(s[i:i+1]!=s1[i:i+1]): ans1+=1
    if(s[i:i+1]!=s2[i:i+1]): ans2+=1

print(min(ans1, ans2))


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int S = scan.nextInt();
		int W = scan.nextInt();

		if (S > W) {
			System.out.println("safe");
		} else {
			System.out.println("unsafe");
		}
	}

}

Measured memory_bytes: 35704
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();

		if (a < b && b < c)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}



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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> s(n+1);
  int m;
  for(int i = 0; i < n; i++){
    cin >> m;
    s.at(i+1) = s.at(i) + m+1;
  }
  
  int ans = 0;
  int tmp = 0;
  for(int i = 0; i + k <= n; i++){
    tmp = s.at(i+k) - s.at(i);
    if(ans < tmp) ans = tmp;
  }
  cout<<fixed<<setprecision(1);
  cout << ans / 2.0;
}




Measured memory_bytes: 1024
#include<stdio.h>
#define N 20

int main(void)
{
int n,h[N],i,j,inn,high;

scanf("%d",&n);

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


high = h[0];
inn = 1;

for(i=1;i<n;i++)
{
  if(high<=h[i])
  {
  high = h[i];
  inn += 1;
  }
}

printf("%d",inn);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#pragma GCC optimize("Ofast", "no-stack-protector", "unroll-loops")
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 2e5 + 7;

struct node {
	node* nxt[26];
	int cnt[26];
	int val, sz;
	node() {
		for(int i = 0; i < 26; i++) nxt[i] = nullptr, cnt[i] = 0;
		val = 0;
		sz = 0;
	}
} *root;

void add(string s) {
	node* ptr = root;
	for(char c:s) {
		ptr -> sz++;
		if(!(ptr -> nxt[c-'a'])) {
			ptr -> nxt[c-'a'] = new node();
		}
		ptr = ptr -> nxt[c-'a'];
	}
	ptr -> val++;
	ptr -> sz++;
}

void dfs(node* root) {
	for(int i = 0; i < 26; i++) {
		if(root -> nxt[i]) {
			dfs(root -> nxt[i]);
			root -> cnt[i] += root -> nxt[i] -> sz;
			for(int j = 0; j < 26; j++) if(j != i)
				root -> cnt[j] += root -> nxt[i] -> cnt[j];
		}
	}
}

ll ans = 0;

void dfs1(node* u) {
	for(int i = 0; i < 26; i++)
		if(u -> nxt[i]) {
			ans += (ll) (u -> nxt[i] -> val) * (u -> cnt[i] - 1);
			dfs1(u -> nxt[i]);
		}
}

signed main()
{
	IO_OP;
	root = new node();
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		string s;
		cin >> s;
		reverse(ALL(s));
		add(s);
	}
	dfs(root);
	dfs1(root);
	cout << ans << endl;
}





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

int main() {

	double a, b, T; cin >> a >> b >> T;
	int ans = 0;
	double t = 0;
	while (true) {
		t += a;
		if (t >= T + 0.5) {
			break;
		}
		ans += b;
	}
	cout << ans << endl;
	return 0;
}

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

const int INF = 1001001001;
//const ll INF = 1000000000000000000;

ll a, b, v, w, t;

int main() {
	int n;
	cin >> n;
	vector<ll> a;
	rep(i,n) {
		ll tmp;
		cin >> tmp;
		if (tmp == 0) {
			cout << 0 << endl;
			return 0;
		}
		a.push_back(tmp);
	}

	ll ans = 1;
	rep(i,n) {
		if (1000000000000000000/ans < a[i]) {
			ans = -1;
			break;
		}
		ans *= a[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4236
import sys
import math

def str_input():
    S = raw_input()
    if S[len(S)-1] == "\r":
        return S[:len(S)-1]
    return S

p = [0, 0]

n = input()
for i in xrange(n):
    S = str_input().split()
    if S[0] < S[1]:
        p[1] += 3
    elif S[0] > S[1]:
        p[0] += 3
    else:
        p[0] += 1
        p[1] += 1

print p[0], p[1]

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

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

ll basis[60];

void solve(){
	int n;
	cin>>n;
	vector<ll> a(n);
	string s;
	for(auto &x : a){
		cin>>x;
	}
	cin>>s;
	memset(basis, -1, sizeof(basis));
	for(int i = n - 1; i >= 0; i--){
		if(s[i] == '0'){
			for(int j = 59; j >= 0; j--){
				if((a[i]>>j)&1){
					if(basis[j] != -1){
						a[i] ^= basis[j];
					}
				}
			}
			for(int j = 59; j >= 0; j--){
				if((a[i]>>j)&1){
					if(basis[j] == -1){
						basis[j] = a[i];
						break;
					}
				}
			}
		}else{
			for(int j = 59; j >= 0; j--){
				if((a[i]>>j)&1){
					if(basis[j] != -1){
						a[i] ^= basis[j];
					}
				}
			}
			if(a[i]){
				cout<<1<<'\n';
				return;
			}
		}
	}
	cout<<0<<'\n';
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int t;
	cin>>t;
	while(t--)solve();

	return 0;
}

Measured memory_bytes: 3608