akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <boost/range/irange.hpp> // boost::irange

using namespace std;
using boost::irange;

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

  const int max_m = 30;

  int k;
  int c[max_m] = {};
  int a;
  for (auto i : irange(0, n)) {
    cin >> k;
    for (auto j : irange(0, k)) {
      cin >> a;
      c[a - 1]++;
    }
  }

  int res = 0;
  for (auto i : irange(0, m)) {
    if (c[i] == n) {
      res++;
    }
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(i,n) rep2(i,0,n)
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    ll cnt=0;
    rep(i,n)cnt+=a[i]/(n+1);
    rep(i,n)a[i]%=(n+1);
    ll remain = min((ll)n,cnt);
    rep(i,n)a[i]+=remain;
    cnt+=(cnt-remain)*n;
    while(true){
        auto m=max_element(a.begin(),a.end());
        if(*m<n)break;
        for(auto itr=a.begin();itr!=a.end();++itr){
            if(m==itr)*itr-=n;
            else (*itr)++;
        }
        ++cnt;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
from math import pi, tan
EPS = 0.0000000001

def f(a, b, theta):
    if theta >= pi * 0.5:
        return 0.0
    elif tan(theta) >= b / a:
        return a * b**2 * 0.5 / tan(theta)
    else:
        return a**2 * b - a**3 * 0.5 * tan(theta)

a, b, x = map(int, input().split())

l = 0
r = pi * 0.5
while r - l >= EPS:
    mid = (l + r) * 0.5
    if f(a, b, mid) >= x:
        l = mid
    else:
        r = mid

print("{:.10f}".format(l / pi * 180))


Measured memory_bytes: 3064
<?php

    // 末尾に改行をつけて出力
    function output($str) {
        echo $str . PHP_EOL;
    }

    list($a, $b) = explode(' ', trim(fgets(STDIN)));

    $lower = floor($a / 0.08);
    $upper = ceil($b / 0.10) + 10;
    $result = -1;
    for ($i = $lower; $i <= $upper; $i++) {
        $t1 = floor($i * 0.08);
        $t2 = floor($i * 0.10);
        if ($a == $t1 && $b == $t2) {
            $result = $i;
            break;
        }
    }

    output($result);


Measured memory_bytes: 4732
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <random>
#include <utility>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <sstream>
#define REP(i,x) for(int i=0; i<(x); i++)
typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
    int n;
    cin>>n;
    int x[n];
    int cp[n];
    REP(i, n){
        cin>>x[i];
        cp[i] = x[i];
    }
    sort(cp, cp+n);
    int med_b = cp[n/2];
    int med_s = cp[(n/2)-1];
    REP(i, n){
        if(x[i] >= med_b){
            cout<<med_s<<endl;
        } else {
            cout <<med_b<<endl;
        }
    }
    
    
    return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> s(M), c(M);
  for (int i = 0; i < M; i++) {
    cin >> s.at(i) >> c.at(i);
  }
  
  int jud = 0;
  for (int i = 0; i < M - 1; i++) {
    for (int j = i + 1; j < M; j++) {
      if (s.at(i) == s.at(j) && c.at(i) != c.at(j)) {
        jud++;
      }
      else if (s.at(i) == s.at(j) && c.at(i) == c.at(j)) {
        s.at(j) = 0;
        c.at(j) = 0;
      }
      else {
        continue;
      }
    }
  }

  for (int i = 0; i < M; i++) {
    if (N != 1 && s.at(i) == 1 && c.at(i) == 0) {
      jud++;
    }
    else {
      continue;
    }
  }
  
  int x = 0;
  if (jud > 0) {
    cout << -1 << endl;
  }

  else {
    for (int i = 0; i < M; i++) {
      x += std::pow(10, N - s.at(i)) * c.at(i);
    }
    if (0 < x && x < 100 && N == 3) {
      x += 100;
    }
    else if (x == 0 && N == 3) {
      x = 100;
    }
    else if (0 < x && x < 10 && N == 2) {
      x += 10;
    }
    else if (x == 0 && N == 2) {
      x = 10;
    }
    
    cout << x << endl;
  }
  
}

Measured memory_bytes: 512
import math

a,b = map(int, input().split())

cost_list = []
state = 0

for i in range(0,1001):
    if math.floor(i/10) == b:
        cost_list.append(i)
    if math.floor(i/10) > b:
        break

for c in cost_list:
    if math.floor(c*0.08) == a:
        print(c)
        state = 1
        break

if state == 0:
    print(-1)

Measured memory_bytes: 3064
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

using namespace std;

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

typedef long long ll;

int n;
int a[100010];

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	
	sort(a,a+n);
	int count=unique(a,a+n)-&a[0];
	
	cout<<(count-(count%2==0 ? 1 : 0));
	
	//printf("Time used = %.4f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 640
H, W = map(int, input().split())

C = ["."*(W+2)]
for k in range(H):
    C.append("."+input()+".")
C.append("."*(W+2))

for k in range(1,W+1):
    for l in range(1,H+1):
        if C[l][k]=="#":
            if C[l+1][k]=="#" or C[l-1][k]=="#" or C[l][k+1]=="#" or C[l][k-1]=="#":
                pass
            else:
                print("No")
                exit(0)
print("Yes")

Measured memory_bytes: 3064
from collections import deque

def matrix(H,W, fill = False):
    return [[fill for x in range(W)] for j in range(H)]

def get_n(v):
    i,j = v

    li, lj = [i,j-1] if j>0 else [None,None]
    di, dj = [i+1,j] if i<H-1 else [None,None]
    ri, rj = [i,j+1] if j<W-1 else [None,None]
    ui, uj = [i-1,j] if i>0 else [None,None]

    pp = [(li,lj), (di,dj), (ri,rj), (ui,uj)]
    res = []

    for (i,j) in pp:
        if i!= None and maze[i][j] != "#":
            res.append((i,j))

    return res

H, W = map(int, input().split())
maze = []

prep = lambda x: 1 if x == "." else 0
for i in range(H):
    l  = input()
    maze.append(list(l))

max_d = 0

for i in range(H):
    for j in range(W):
        if maze[i][j] == "#":
            continue

        distance = matrix(H,W, 0)
        is_visited = matrix(H,W, 0)

        d = deque()
        d.append((i,j))
        is_visited[i][j] = 1

        while(d):
            v = d.popleft()
            for ni,nj in get_n(v):
                if is_visited[ni][nj]:
                    continue
                is_visited[ni][nj] = True
                distance[ni][nj] = distance[v[0]][v[1]] + 1
                max_d = max(distance[ni][nj], max_d)
                d.append((ni,nj))


print(max_d)

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, std::vector<std::string> s){
    unordered_map<string, ll> cnt;
    rep(i,0,N) {
        sort(all(s[i]));
        cnt[s[i]]++;
    }
    ll answer = 0;
    for (const auto & p : cnt) {
        answer += p.second * (p.second - 1) / 2;
    }
    cout << answer << endl;
}

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


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

int main(){
    int N;
    scanf("%d", &N);
    vector<int> students(N);
    vector<int> revs(N);
    for(int i = 0; i < students.size(); i++){
        cin >> students[i];
    }
    for(int i = 0; i < students.size(); i++){
        revs[students[i] - 1] = i+1;
    }
    for(int i = 0; i < revs.size(); i++){
        cout << revs[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <iomanip> 
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#include <string>
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	if ((B - A) % 2 == 0) {
		cout << A + (B - A) / 2 << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
	}
	

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

using namespace std;

int fr[1005];

int main() {
	int n, k;
  	cin >> n >> k;
  	for(int i = 0; i < n; i++) cin >> fr[i];
  	sort(fr, fr + n);
  	int ans = 0;
  	for(int i = 0; i < k; i++) ans += fr[i];
  	cout << ans;
  	return 0;
}

Measured memory_bytes: 3640
S = map(int, list(raw_input()))

large_num = S[0]*10 + S[1]
min_num = S[2]*10 + S[3]

if large_num <= 0 and min_num <= 0: print 'NA'
elif large_num <= 0 and min_num <= 12: print 'YYMM'
elif min_num <= 0 and large_num <= 12: print 'MMYY'
elif min_num <= 0 or large_num <= 0: print 'NA'
elif large_num <= 12 and min_num <= 12: print 'AMBIGUOUS'
elif large_num <= 12: print 'MMYY'
elif min_num <= 12: print 'YYMM'
else: print 'NA'

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





int main() {

	string S, T;
	cin >> S >> T;
	int count = 0;
	
	for (int i = 0; i < S.length(); i++) {
		if (S.at(i) != T.at(i)) {
			count++;
		}
		
	}
	cout << count << endl;

	return 0;
}


Measured memory_bytes: 3856
b = input()
#b = list(string.split(','))
l = ""
for i in range(len(b)):
    if b[i]=='A':
        l += 'T'
    elif b[i]=='T':
        l += 'A'
    elif b[i]=='C':
        l += 'G'
    else:
        l += 'C'

print(l)


Measured memory_bytes: 3064
S = input()+"X"
count = 0
li =[0]
for i in range(len(S)):
	if "A" == S[i] or "C"==S[i] or "G"==S[i] or "T"==S[i]:
		count += 1
	else:
		if count >0:
			li.append(count)
		count = 0

print(max(li))


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <set>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

int student[105][105];
int main()
{
	int n;
	while (scanf ("%d", &n ) && n ){
		memset (student, 0, sizeof (student ) );
		rep (i, n ){
			rep (j, n ){
				scanf (" %d", student[i]+j );
			} // end rep
		} // end rep
		vector<vector<int> > row (n, vector<int> (n, 0 ) );
		vector<vector<int> > col (n, vector<int> (n, 0 ) );
		rep (i, n ){
			rep (j, n ){
				row[i][j] = student[i][j];
				col[j][i] = student[i][j];
			} // end rep
		} // end rep
		rep (i, n ){
			sort (ALL (row[i] ) );
			sort (ALL (col[i] ) );
		} // end rep
		set<int> shortest;
		vector<int> ans;
		ans.clear();
		rep (i, n ){
			shortest.insert (row[i][0] );
		} // end rep
		rep (i, n ){
			if (shortest.count (col[i][n-1] ) ){
				ans.push_back (col[i][n-1] );
			} // end if
		} // end rep

		if (ans.empty() ){
			printf ("0\n" );
		}else{
			printf ("%d\n", ans[0] );
		} // end if
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

vector<int> a;

priority_queue<pair<int, int> > heap_open, heap_close;

int main() {
	while (!heap_open.empty())
		heap_open.pop();
	while (!heap_close.empty())
		heap_close.pop();

	int n, x, m;
	cin >> n >> m;
	LL sum = 0LL;
	int cnt = 0;
	FOR (i, n) {
		cin >> x;
		a.pb(x);
		if (i) {
			if (a[i - 1] + 1 == x || (a[i - 1] == m && x == 1))
				sum++;
			else {
				int j = a.sz - 1;
				int y = a[j - 1];
				if (y > x) {
					heap_close.push(make_pair(-x, j));
					sum += x - 1 + 1;
					cnt++;
				}
				else {
					sum += x - y;
					heap_open.push(make_pair(-y, j));
				}
			}
		}
	}

	LL ret = sum;
	//cout << ret << " " << cnt << endl;
	ffor (f, 2, m + 1) {
		while (!heap_close.empty() && f - 1 == -heap_close.top().first) {
			pair<int, int> el = heap_close.top();
			heap_close.pop();
			cnt--;
			int i = el.second;
			if (a[i - 1] > a[i])
				sum += m - a[i - 1] + a[i];
			else
				sum += a[i] - a[i - 1];
			sum--;
			if (a[i - 1] >= f)
				heap_open.push(make_pair(-a[i - 1], i));
		}
		sum -= cnt;
		ret = min(ret, sum);
		while (!heap_open.empty() && f - 1 == -heap_open.top().first) {
			pair<int, int> el = heap_open.top();
			heap_open.pop();
			cnt++;
			int i = el.second;
			if (a[i] >= f)
				heap_close.push(make_pair(-a[i], i));
		}
		//cout << sum << endl;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1780
#include <iostream>
#include <cstdio>
#define N 300002
using namespace std;
int n,k,i,j,p,a[N];
int main()
{
	scanf("%d%d",&k,&n);
	if(k%2==0){
		printf("%d ",k/2);
		for(i=2;i<=n;i++) printf("%d ",k);
		puts("");
	}
	else{
		for(i=1;i<=n;i++) a[i]=(k+1)/2;
		for(i=1,p=n;i<=n/2;i++){
			if(a[p]==1) p--;
			else{
				a[p]--;
				for(j=p+1;j<=n;j++) a[j]=k;
				p=n;
			}
		}
		for(i=1;i<=p;i++) printf("%d ",a[i]);
		puts("");
	}
	return 0;
}


Measured memory_bytes: 4832
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORit(it,a) for(auto it=a.begin();it!=a.end();it++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define vec vector
#define pb push_back
#define pop pop_back
#define STF() shrink_to_fit()
#define all(x) x.begin(),x.end()
#define testcases ll t;cin>>t;while(t--)
#define mem(a,k) memset(a,k,sizeof(a))
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define rt return
#define br break
#define ct continue
#define elif else if
#define ii pair<ll,ll>
#define arrin(a,n,index) for(int i=index;i<n;i++)cin>>a[i]
#define vecin(a,n,index) for(int i=index;i<n;i++)cin>>a[i]
#define arrout(a,n,index) for(int i=index;i<n;i++)cout<<a[i]<<" ";cout<<endl;
#define vecout(a,n,index) for(int i=index;i<n;i++)cout<<a[i]<<" ";cout<<endl;
//ll mod = 1000000007;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	// START FROM HERE :)
	string n;
	cin >> n;
	ll sum = 0;
	FOR(i, 0, n.length()) {
		sum += (n[i] - 48);
	}
	if (sum % 9 == 0)cout << "Yes\n";
	else cout << "No\n";
}


Measured memory_bytes: 3792
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[10],y[10][10],z[10];
signed main(){
	int n,m,ans=0;
	cin>>n>>m;
	f(i,m){
		cin>>x[i];
		f(j,x[i]){
			cin>>y[i][j];
			y[i][j]--;
		}
	}
	f(i,m)cin>>z[i];
	f(i,pow(2,n)){
		int a[10],b=i;
		f(j,n){
			a[j]=b%2;
			b/=2;
		}
		f(j,m){
			int cnt=0;
			f(k,x[j]){
				if(a[y[j][k]])cnt++;
			}
			if(cnt%2!=z[j])goto loop;
		}
		ans++;
		loop:;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 384
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    def manhattan_distance(p1,p2):
        x1,y1 = p1
        x2,y2 = p2
        return abs(x1-x2) + abs(y1-y2)
    
    def chebyshev_distance(p1,p2):
        x1,y1 = p1
        x2,y2 = p2
        return max(abs(x1-x2),abs(y1-y2))



    N = II()
    # N = 10
    points = []
    from random import random
    f_0 = []
    f_1 = []
    for i in range(N):
        x,y = LMIIS()
        
        # x = int(random()*10**2)
        # y = int(random()*10**2)
        points.append((x,y))
        f_0.append(x-y)
        f_1.append(x+y)
    ans = 0
    ans = max(ans,max(f_0)-min(f_0))
    ans = max(ans,max(f_1)-min(f_1))
    
    print(ans)

    # ans2 = 0
    # for i in range(N):
    #     for j in range(i+1,N):
    #         tmp = manhattan_distance(points[i],points[j])
    #         if ans2 < tmp:
    #             max_pair2 = points[i],points[j]
    #             ans2 = tmp

    # print(ans2)
    # assert(ans==ans2)




main()

Measured memory_bytes: 119600
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let _n: i32 = read();
    let nums: Vec<i32> = read_vec();
    let mut filtered_nums: Vec<i32> = nums.into_iter().filter(|num| num % 2 == 0).collect();
    let n = filtered_nums.len();
    let mut count: i32 = 0;
    let mut odd_count: usize = 0;
    while odd_count != n {
        let index = odd_count;
        let num = filtered_nums.get_mut(index).unwrap();
        *num /= 2;
        if *num % 2 == 1 {
            odd_count += 1;
        }
        count += 1;
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <unordered_set>
#include <stdio.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI 3.141592653589793
#define vi vector<int>
//#define p pair<int,int>
inline double degcos(double ang) {return cos(ang*PI/180);}
inline double degsin(double ang) {return sin(ang*PI/180);}
#define for(i,j,k,in) for (int i = j; i < k; i += in)


/*---END OF TEMPLATE---*/
        


int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    //ifstream fin("data.in");
    //ofstream fout("data.out");
    int x,y,a,b,c;
    
    cin >> x >> y >> a >> b >> c;
    ll p[a];
    ll q[b];
    ll r[c];
    for (i,0,a,1) cin >> p[i];
    for (i,0,b,1) cin >> q[i];
    for (i,0,c,1) cin >> r[i];
    sort(p,p+a);
    sort(q,q+b);
    sort(r,r+c);
    int ca = a-x, cb = b-y, cc = c-1;
    while (true) {
        if (ca == a && cb == b) break;
        else if (cc == -1) break;
        else if (r[cc] <= p[ca] && r[cc] <= q[cb]) break;

        if (ca != a && cb != b) {
            if (p[ca] <= q[cb]) {
                p[ca] = r[cc];
                ca++;
                cc--;
            }
            else {
                q[cb] = r[cc];
                cb++;
                cc--;
            }
        }
        else if (ca == a){
            if (r[cc] > q[cb]) {
                q[cb] = r[cc];
                cb++;
                cc--;
            }
            else break;
        }
        else if (cb == b){
            if (r[cc] > p[ca]) {
                p[ca] = r[cc];
                ca++;
                cc--;
            }
            else break;
        }
    }
    ll tot = 0;
    for(i,a-x,a,1) {
        tot += p[i];
    }
    for (i,b-y,b,1) {
        tot += q[i];
    }
    cout << tot;




}

Measured memory_bytes: 2560
def updiv(x,y):
    if x % y == 0:
        return x // y
    else:
        return x // y + 1


N,H = map(int,input().split())

now = 0

lis = []
dic = {}

for i in range(N):

    a,b = map(int,input().split())

    if a not in dic:
        lis.append(a)
        
    dic[a] = float("inf")
        
    if b not in dic:
        lis.append(b)

    if b in dic:
        dic[b] += 1
    else:
        dic[b] = 1

lis.sort()
lis.reverse()
ans = 0

for i in lis:

    if dic[i] * i < H:
        ans += dic[i]
        H -= dic[i] * i

    else:
        ans += updiv(H,i)
        break

print (ans)



        


Measured memory_bytes: 4784
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        if(n % 2 == 0){
            System.out.println(n / 2);
        }else{
            System.out.println(n / 2 + 1);
        }
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
const ll MOD = 1e9+7;

vector<ll> fact, ifact, invs;
ll combmod(int n, int k, ll MOD, int M = 1e5){
    if (!fact.size()){
        fact.resize(M+1); ifact.resize(M+1); invs.resize(M+1);
        fact[0] = ifact[0] = invs[0] = fact[1] = ifact[1] = invs[1] = 1;
        for(int i = 2; i <= M; i++){
            fact[i] = fact[i-1] * i % MOD;
            invs[i] = MOD - MOD / i * invs[MOD % i] % MOD;
            ifact[i] = ifact[i-1] * invs[i] % MOD;
        }
    }
    return fact[n] * ifact[k] % MOD * ifact[n-k] % MOD;
}

template<class T> T powmod(T x, ll n, ll m)
{
    T r = 1;
    T a = x % m;
    while (n>0)
    {
        if (n & 1)
            r = (r*a)%m;
        a = (a*a)%m;
        n = n >> 1;
    }
    return r;
}

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    int k;
    cin >> k;
    string s;
    cin >> s;
    int n = s.length();
//    vector<int> cnt(26);
//    FOR(i, n) cnt[s[i]-'a']++;
    combmod(2, 1, MOD, n+k+100);

//    vector<vector<ll>> dp(27, vector<ll>(n+k+10));
//    dp[26][0] = 1;
//    FORI(c, 26){
//        FOR(x, k+1) {
//            FOR(i, x+1) {
//                dp[c][x] += ifact[i] * dp[c+1][x-i] % MOD;
//            }
//            dp[c][x] %= MOD;
//        }
//    }
//    ll sol = dp[0][k];
//    sol *= fact[k];
//    sol %= MOD;
//    sol *= combmod(n+k, k, MOD);
//    sol %= MOD;
//    cout << sol << endl;

    ll sol = 0;
    ll q = powmod(25ll, k, MOD);
    for(int i = n; i<=k+n; i++){
        sol += combmod(n+k, i, MOD) * q % MOD;
        q = q * invs[25] % MOD;
    }
    sol %= MOD;
    cout << sol << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 51252
a = input()
aSplit = a.split(' ')
A = int(aSplit[0])
B = int(aSplit[1])
C = int(aSplit[2])
# a[0] = int(input())
# a[1] = int(input())
# a[2] = int(input())
if(C<=A and C>=B):
    print("Yes")
elif(C<=B and C>=A):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
N,T = list(map(int,input().split()))
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

ans = 10000000000

for j in range(N):
    if y[j] <= T:
        if ans > x[j]:
            ans = x[j]

if ans == 10000000000:
    print("TLE")

else:
    print(ans)

Measured memory_bytes: 3064
import math

x = int(input())

# 0以上整数x「未満」の素数をリストに格納して返す
def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

nums = primes(199999)

for num in nums:
  if num >= x:
    print(num)
    break

Measured memory_bytes: 11160
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<stdbool.h>
#include<set>
#define N 1000000007
using namespace std;
typedef long long ll;
int num[100001];
int main(void) {
	int m;
	cin >> m;
	cout << 48 - m << endl;
	return 0;
}


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

public class Main {

    static int N;
    static int t;
    static int[] C, T;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        t = sc.nextInt();
        C = new int[N];
        T = new int[N];
        for (int i = 0; i < N; i++) {
            C[i] = sc.nextInt();
            T[i] = sc.nextInt();
        }

        System.out.println( solve() );
    }

    static String solve() {
        int ans = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            if( T[i] <= t ) {
                ans = Math.min(C[i], ans);
            }
        }

        return ans == Integer.MAX_VALUE ? "TLE" : "" + ans;
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

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

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


Measured memory_bytes: 22740
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;
 
bool isp[mx];
 
void sv(){
 
	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}
 
ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

vl gr[mx];
ll val[mx], n, vis[mx];

void dfs(ll x){
    ll l= gr[x].size(),i,j;
    for(i=0; i< l; i++){
        
        if(!vis[gr[x][i]]){
            val[gr[x][i]]+= val[x];
            vis[gr[x][i]]= 1;
            dfs(gr[x][i]);
        }
        
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
    ll q,i,j, x, y;
    cin>>n>>q;
    ll t= n-1;
    while(t--){
        cin>>x>>y;
        gr[x].pb(y);
        gr[y].pb(x);
    }
    for(i=0; i< n+1; i++)
    {
        vis[i]= 0;
        val[i]= 0;
    }
    while(q--){
        cin>>x>>y;
        val[x]+= y;
    }
    

    vis[1]= 1;
    dfs(1);

    for(i=1; i< n+1; i++)
    cout<<val[i]<<" ";
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 25856
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<pii,int> ppiii ;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
int n,k;
bool vis[2010];
vi hen[2010];
int ret;
void dfs(int x,int dist){
	if(dist>k/2)ret++;
	vis[x]=true;
	for(int i=0;i<hen[x].size();i++){
		int to=hen[x][i];
		if(!vis[to]){
			dfs(to,dist+1);
		}
	}
}
void dfs2(int x,int y,int dist){
	//cout<<x+1<<" "<<y+1<<" "<<dist<<endl;
	if(dist>k/2)ret++;
	vis[x]=true;
	vis[y]=true;
	for(int i=0;i<hen[x].size();i++){
		int to=hen[x][i];
		if(!vis[to]){
			vis[to]=true;
			dfs2(to,x,dist+1);
		}
	}
}
vector<pii> hoge;
int main(){
	int a,b;
	cin>>n>>k;
	rep(i,n-1){
		cin>>a>>b;a--;b--;
		hen[a].pb(b);
		hen[b].pb(a);
		hoge.pb(mp(a,b));
	}
	int ans=n;
	if(k%2==0){
		for(int i=0;i<n;i++){
			ret=0;
			rep(j,n)vis[j]=false;
			dfs(i,0);
			ans=min(ans,ret);
		}
		cout<<ans<<endl;
	}else{
		for(int i=0;i<n-1;i++){
			ret=0;
			rep(j,n)vis[j]=false;
			dfs2(hoge[i].first,hoge[i].second,0);
			dfs2(hoge[i].second,hoge[i].first,0);
			//cout<<endl;
			//cout<<ret<<endl;
			ans=min(ans,ret);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 512
///a = 97  z = 122
///A = 65  Z = 90

#include <bits/stdtr1c++.h>
//#include <boost/algorithm/string.hpp>

using namespace std;

#define endl                "\n"
#define pb                  push_back
#define pii                 pair<int, int>
#define mp                  make_pair
#define x                   first
#define y                   second
#define all(v)			    ((v).begin()), ((v).end())
#define sz(v)			    ((int)((v).size()))
#define ll                  long long
#define rep(i,n)            for(int i=0 ; i<sz(n) ; i++)
#define lp(i, n)            for(int i = 0 ; (int)i<n ; i++)
#define loop(i, x, n)       for(int i=x ; (int)i<=n ; i++)
#define ms(arr, v)      memset(arr, v, sizeof arr)
typedef vector<vector<char>> vcc;
typedef vector<int> vi;
typedef deque<int> de;

int n;
int ctr, maxCtr;
multimap<string, int> words;
vector<string> vec;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
/*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif*/
    cin >> n;
    while(n--)
    {
        string str;
        cin >> str;
        words.insert(mp(str, 1));
    }
    maxCtr = -1;
    int i; string str = words.begin()->first;
    for(auto it : words)
    {
        if(it.first == str)
        {
            ctr++;
        }
        else
        {
            if(ctr > maxCtr)
            {
                vec.clear();
                vec.pb(str);
                maxCtr = ctr;
            }
            else if(ctr == maxCtr)
            {
                vec.pb(str);
            }
            ctr = 1;
            str = it.first;
        }
    }
    if(ctr > maxCtr)
    {
        vec.clear();
        vec.pb(str);
    }
    else if(ctr == maxCtr)
    {
        vec.pb(str);
    }
    for(auto s : vec) cout << s << endl;
    return 0;
}

Measured memory_bytes: 25712
import java.util.Scanner;

class Main
{
    public static void main(String[] args)
    {     
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        System.out.print(a * b);
        System.out.print(" ");
        System.out.println(2*(a + b));
    }
}



Measured memory_bytes: 26012
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
 

int main()
{
  int N;
  cin >> N;
  int x = 0, y = 0, now = 0;
  while (N--) {
    int t, nxtx, nxty;
    cin >> t >> nxtx >> nxty;
    int d = abs(x - nxtx) + abs(y - nxty);
    if (d > t - now or (d - (t - now)) % 2) {
      puts("No");
      return 0;
    }
    now = t, x = nxtx, y = nxty;
  }
  puts("Yes");

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;

struct UnionFind{
  vector<int> p;
  vector<int> r;
  vector<int> g;
  UnionFind(int n){
    p.resize(n,-1);
    r.resize(n,1);
    g.resize(n,1);
  }
  int find(int x){
    if(p[x] == -1) return x;
    else return p[x] = find(p[x]);
  }
  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(r[x] > r[y]) swap(x,y);
    if(r[x] == r[y]) ++r[y];
    g[y] += g[x];
    p[x] = y;
  }
  int gsize(int x){
    return g[find(x)];
  }
};

int main(){
  int n, m;
  cin >> n >> m;
  vector<P> vec(m);
  for(int i=0; i<m; ++i){
    int a, b;
    cin >> a >> b;
    --a; --b;
    vec[i] = make_pair(a,b);
  }
  ll ansnum = (ll)n * ((ll)n-1) /2;
  vector<ll> ans(m);
  ans[m-1] = ansnum;
  UnionFind uf(n);
  for(int i=m-1; i>0; --i){
    int ai = vec[i].first, bi = vec[i].second;
    if(uf.find(ai) != uf.find(bi)){
      int mainax = uf.gsize(ai) * uf.gsize(bi);
      ans[i-1] = ans[i] - mainax;
      uf.unite(ai,bi);
    }else{
      ans[i-1] = ans[i];
    }
  }
  for(int i=0; i<m; ++i) cout << ans[i] << endl;
}

Measured memory_bytes: 4096
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
typedef pair<int,int> pii;
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
// const int MOD = 998244353;
const int MOD = 1000000007;
int h,w;
char c[101][101];
int d[101][101] = {};

int dh[2] = {0,1};
int dw[2] = {1,0};

bool isin(int i,int j){
	return (0 <= i && i < h && 0 <= j && j < w);
}

int bfs(){
	rep(i,h)rep(j,w)d[i][j] = INF;
	d[0][0] = 1;
	if(c[0][0] == '.')d[0][0] = 0;
	queue<pii> q;
	q.push(MP(0,0));
	while(q.size()){
		pii p = q.front();
		q.pop();
		rep(i,2){
			int nh = p.fi + dh[i];
			int nw = p.se + dw[i];
			int next_dist;
			if(c[p.fi][p.se] == '.' && c[nh][nw] == '#')next_dist = d[p.fi][p.se]+1;
			else next_dist = d[p.fi][p.se];
			if(isin(nh,nw) && d[nh][nw] > next_dist){
				q.push(MP(nh,nw));
				d[nh][nw] = next_dist;
			}
		}
	}
	return d[h-1][w-1];
}

/*----------------------------------------------------------------*/
signed main(){

	cin >> h >> w;
	rep(i,h)rep(j,w)cin >> c[i][j];

	cout << bfs() << endl;

	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=gnu++17 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_b
// rm -r -f test;oj dl https://agc043.contest.atcoder.jp/tasks/agc043_a


Measured memory_bytes: 3716
import numpy as np
N, M = input().split()
N = int(N)
M = int(M)

# 2 boat
boat = 2
ab = np.zeros(M)
ab1 = []
abN = []
ok = "IMPOSSIBLE"
for i in range(M):
    a,b = input().split()
    a = int(a)
    b = int(b)
    if a == 1:
        ab1.append(b)
    elif b == N:
        abN.append(a)
if len(set(abN) & set(ab1))>=1:
    ok = "POSSIBLE"
print(ok)

Measured memory_bytes: 30832
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

a,b = Is()
print(a+b//2)

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
int a[21],ans=0;
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	for(int i=2;i<n;i++)
	{
		if(a[i-1]<=a[i])
			{
			if(a[i+1]>=a[i])
				ans++;}
		else 
		if(a[i-1]>=a[i])
			if(a[i+1]<a[i])
				ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
    cin>>a>>b;
    c=a+b;
   if(a%3==0 || b%3==0 || c%3==0) cout<<"Possible"<<endl;
   else cout<<"Impossible"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <sstream>
#include <bitset>
#include <stack>
#include <cstdlib>

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

typedef long long ll;

using namespace std;

int main() {
    
    int n,m,x;
    cin >> n >> m >> x;
    
    vector<int> a(m);
    
    int l=0,r=0;
    FOR(i, 0, m){
        cin >> a[i];
        if(a[i] > x){
            r++;
        }else{
            l++;
        }
    }
    
    cout << min(l,r) << endl;
    
    
    
    return 0;
}


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

using namespace std;

#define int long long

const int mod = 1e9 + 7;

int bp(int a, int b) {
    if (b == 0) return 1;
    int val = bp(a, b / 2);
    if (b % 2) return ((val * val) % mod) * a % mod;
    return val * val % mod;
}

void solve() {
    int n, k;
    cin >> n >> k;
    pair <int, int> d[k];
    d[0] = {0, 1};
    for (int i = 1; i < k; ++i) {
        d[i].first = (d[i - 1].first + d[i - 1].second) % mod;
        d[i].second = (bp(i + 1, n) - bp(i, n) + mod) % mod;
        for (int j = 2; j * j <= i + 1; ++j) {
            if ((i + 1) % j) continue;
            d[i].second = (d[i].second - d[(i + 1) / j - 1].second + mod) % mod;
            if (j * j == i + 1) continue;
            d[i].second = (d[i].second - d[j - 1].second + mod) % mod;
        }
        d[i].second = (d[i].second - 1  + mod) % mod;
        //cout << d[i].first <<  ' ' << d[i].second << '\n';
    }
    int ans = 0;
    for (int i = 0; i < k; ++i) ans = (ans + (i + 1) * (d[k / (i + 1) - 1].first + d[k / (i + 1) - 1].second)) % mod;
    cout << ans;
}

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


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

class Dice_c{

private:
  int me[4];
  int back;
  int front;

public:
  void Input();
  void RollVerch();
  void RollHorizon();
  void RollLeft();
  void RollRight();
  int GetMe(int num);

};

bool Check(Dice_c a,Dice_c b){
  for(int i=1; i<7; i++){
    if(a.GetMe(i) != b.GetMe(i))
      return false;
  }

  return true;
}

int main(){

  Dice_c dice[2];
  bool flg=false;

  dice[0].Input();
  dice[1].Input();

  for(int i=0; i<4; i++){
    for(int j=0; j<4; j++){
      dice[1].RollHorizon();
      if(Check(dice[0],dice[1])){
        flg=true;
        goto End;
      }
    }
    dice[1].RollVerch();
  }

  dice[1].RollLeft();
  for(int i=0; i<4; i++){
    dice[1].RollHorizon();
    if(Check(dice[0],dice[1])){
      flg=true;
      goto End;
    }
  }
  dice[1].RollRight();
  dice[1].RollRight();
  for(int i=0; i<4; i++){
    dice[1].RollHorizon();
    if(Check(dice[0],dice[1])){
      flg=true;
      goto End;
    }
  }

  End:;

  if(flg)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


///////////////////////////////////////////////////////////////////////////
void Dice_c::Input(){

  cin >> me[1] >> front >> me[2] >> me[0] >> back >> me[3];
  getchar();

}

/////////////////////////////////////////////////////////////////////////
void Dice_c::RollVerch(){

  int tmp;

  tmp=front;
  front = me[1];
  me[1]=back;
  back=me[3];
  me[3]=tmp;

}
////////////////////////////////////////////////////////////////////////////

void Dice_c::RollHorizon(){

  int tmp;

  tmp=back;
  back=me[0];
  me[0]=front;
  front=me[2];
  me[2]=tmp;

}

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

void Dice_c::RollLeft(){

  int tmp;

  tmp = me[0];
  me[0]=me[1];
  me[1]=me[2];
  me[2]=me[3];
  me[3]=tmp;

}
//////////////////////////////////////////////////////////////////////////////

void Dice_c::RollRight(){

  int tmp;

  tmp=me[3];
  me[3]=me[2];
  me[2]=me[1];
  me[1]=me[0];
  me[0]=tmp;

}
/////////////////////////////////////////////////////////////////////////////

int Dice_c::GetMe(int num){

  switch (num) {
    case 1:
      return me[1];
    case 2:
      return front;
    case 3:
      return me[2];
    case 4:
      return me[0];
    case 5:
      return back;
    default:
      return me[3];
  }

}

Measured memory_bytes: 1156
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--) 
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
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; }

int main() {
    int N, K; cin >> N >> K; int ans = 0;
    vector<bool>s(N+1,false);
    rep(i, K) {
        int d; cin >> d;
        rep(j, d) {
            int a; cin >> a;
            s[a] = true;
        }
    }
    REP(i, N) {
        if (s[i]==false) { ans++; }
    }
    cout << ans << endl;
}























































































































































































































































































































































































































































































































































































































































































    
   
   













































































































































































































































































































































   



    






    


   









    


















































































































































































































































































































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

int main(){
    int n;
    cin>>n;
    int tarous=0,hanakos=0;
    for(int i=0;i<n;i++){
        string tarou,hanako;
        cin>>tarou>>hanako;
        if(tarou>hanako){
            tarous+=3;
        }else if(tarou<hanako){
            hanakos+=3;
        }else{
            tarous++;
            hanakos++;
        }
    }
    cout<<tarous<<' '<<hanakos<<endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

 
int main(){
  int n, k;
  cin >> n >> k;
  int a[n];
  for(int i=0; i<n; i++) cin >> a[i];
  sort(a, a+n);
  int ans = 0;
  for(int i=0; i<k; i++) ans += a[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,T;
double A;
cin>>N>>T>>A;
vector<int>H(N);
vector<pair<double,double>>a(N);
for(int i=0;i<N;i++){
    cin>>H[i];
    double j=T-H[i]*0.006;
    a[i].first=abs(j-A);
    a[i].second=H[i];
}
sort(a.begin(),a.end());
for(int i=0;i<N;i++){
    if(a[0].second==H[i]){
        cout<<i+1;
        return 0;
    }
}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
static const int MAX = 100000;

int A[MAX];

int partition(int A[], int p, int r) {
    int x = A[r];
    int i = p-1; // i以下がxより小さな値
    for (int j = p; j < r; j++) { // A[j]がxと比べる値
        if (A[j] <= x) {
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);
    return i+1;
}

int main() {
    int n, idx;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> A[i];

    idx = partition(A, 0, n-1);

    for (int i = 0; i < n; i++) {
        if (i == idx) cout << "[" << A[i] << "]" << " ";
        else if (i == n-1) cout << A[i] << endl;
        else cout << A[i] << " ";
    }
    
    return 0;
}


Measured memory_bytes: 3408