akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

struct RMQ{
	using T = long long;
	T operator()(const T &a, const T &b) { return min(a,b); };
	static constexpr T identity() { return 0; }
};

template<class Monoid>
class rangeAddQuery{
	private:
		using T = typename Monoid::T;
		Monoid op;
		const int n;
		vector<T> dat, lazy;
		T query(int a, int b, int k, int l, int r){
			eval(k);
			if(b <= l || r <= a) return LLONG_MAX;
			else if(a <= l && r <= b) return dat[k];
			else{
				T left = query(a, b, k * 2, l, (l + r) / 2);
				T right = query(a, b, k * 2 + 1, (l + r) / 2, r);
				propTo(k);
				return op(left, right);
			}
		}
		void add(int a, int b, int k, int l, int r, T x){
			eval(k);
			if(a <= l && r <= b){
				lazy[k] += x;
				eval(k);
			}else if(l < b && a < r){
				add(a, b, k * 2, l, (l + r) / 2, x);
				add(a, b, k * 2 + 1, (l + r) / 2, r, x);
				propTo(k);
			}
		}
		inline void eval(int k){
			if(lazy[k] == op.identity()) return;
			dat[k] += lazy[k];
			if(k < n){
				lazy[k * 2] += lazy[k];
				lazy[k * 2 + 1] += lazy[k];
			}
			lazy[k] = op.identity();
		}
		inline void propTo(int k){
			dat[k] = op(dat[k * 2], dat[k * 2 + 1]);
		}
		int power(int n){
			int res = 1;
			while(n >= res) res*=2;
			return res;
		}
	public:
		rangeAddQuery(int n) : n(power(n)), dat(4 * n, op.identity()), lazy(4 * n, 0) {}
		rangeAddQuery(const vector<T> &v) : n(v.size()), dat(4 * n), lazy(4 * n, 0){
			copy(begin(v), end(v), begin(dat) + n);
			for(int i = n - 1; i > 0; i--) dat[i] = op(dat[2 * i], dat[2 * i + 1]);
		}
		T query(int a, int b){ return query(a,b,1,0,n); }
		void add(int s, int t, T x){ add(s, t, 1, 0, n, x); }
		T get(int a){ return query(a, a + 1); };
		void out(){
			rep(i,n * 2){ cout << dat[i + 1] << ' '; } cout << endl;
		}
};

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

	rangeAddQuery<RMQ> seg(n);
	rep(i,q){
		int com;
		cin >> com;
		if(not com){
			int s, t, x;
			cin >> s >> t >> x;
			seg.add(s, t + 1, x);
		}else{
			int s, t;
			cin >> s >> t;
			cout << seg.query(s, t + 1) << endl;
		}
		//seg.out();
	}
}



Measured memory_bytes: 9188
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        Queue<Long> queue = new ArrayDeque<>();
        queue.add(1L);
        queue.add(2L);
        queue.add(3L);
        queue.add(4L);
        queue.add(5L);
        queue.add(6L);
        queue.add(7L);
        queue.add(8L);
        queue.add(9L);
        Long x = 0L;
        for (int i = 0; i < K; i++) {
            x = queue.poll();
            if (x % 10 != 0) {
                queue.add(10 * x + x % 10 - 1);
            }
            queue.add(10 * x + x % 10);
            if (x % 10 != 9) {
                queue.add(10 * x + x % 10 + 1);
            }
        }
        System.out.println(x);
    }
}


Measured memory_bytes: 30164
import itertools
import copy
n,m,x = map(int,input().split())
ans = [0 for i in range(m)]
books = []
answer = 1000000000000000000000
for i in range(n):
    books.append(list(map(int,input().split())))
for i in range(n):
    stock = list(list(itertools.combinations([num for num in range(n)], i+1)))
    for j in stock:
        cost = 0
        ans = [0 for i in range(m)]
        for k in j:
            for e,l in enumerate(books[k]):
                if e == 0:
                    cost += l
                else:
                    ans[e-1] += l
            if min(ans) >= x and cost < answer:
                answer = copy.deepcopy(cost)
if answer == 1000000000000000000000:
    print(-1)
else:
    print(answer)


Measured memory_bytes: 9584
from math import ceil
n = int(input())
arr = list(map(int, input().split()))
B = []
for i in range(n):
    B.append(arr[i] - (i+1))
B.sort()
b1 = B[n//2]
b2 = B[n//2]
if n > 1:
	b2 = B[int(ceil(n/2))]
ans1, ans2 = 0, 0
for i in range(n):
    ans1 += abs(arr[i]-(b1+i+1))
    ans2 += abs(arr[i]-(b2+i+1))
print (min(ans1, ans2))

Measured memory_bytes: 32212
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int R, G, B, N;
	cin >> R >> G >> B >> N;
	
	int ans = 0;
	REP(i, 3001) REP(j, 3001) {
		int cur = R * i + G * j;
		int diff = N - cur;
		if (diff >= 0 && diff % B == 0) ++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll H = 1e9+7;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    ll t = 1;
    for(int i = 0; i < n; i++) t *= H;
    vector<int> xa(n);
    vector<int> xb(n);
    for(int i = 0; i < n; i++) xa[i] = a[i] ^ a[(i+1) % n];
    for(int i = 0; i < n; i++) xb[i] = b[i] ^ b[(i+1) % n];
    ll ah = 0;
    ll bh = 0;
    for(int i = 0; i < n; i++) ah = ah * H + xa[i];
    for(int i = 0; i < n; i++) bh = bh * H + xb[i];

    for(int i = 0; i < n; i++)
    {
        if(ah == bh)
        {
            cout << i << " " << (a[i] ^ b[0]) << endl;
        }
        ah = ah * H + xa[i] - t * xa[i];
    }
}


Measured memory_bytes: 6528
let max_m = 2000

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let make_dp a n =
  let dp = Array.make_matrix (n + 1) (max_m + 1) false in
  for i = 1 to n do
    dp.(i).(a.(i-1)) <- true
  done;
  for i = 2 to n do
    for j = 1 to max_m do
      if dp.(i-1).(j) || j > a.(i-1) && dp.(i-1).(j - a.(i-1)) then dp.(i).(j) <- true
    done;
  done;
  dp

let () =
  let read_ns () = read_line () |> split_on_char ' ' |> List.map int_of_string in
  let n = read_int () in
  let a = read_ns () |> Array.of_list in
  let _ = read_int () in
  let dp = make_dp a n in
  read_ns () |> List.iter (fun e -> print_endline (if dp.(n).(e) then "yes" else "no"))

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

int main(){
  char c;
  cin >> c;
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
  return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
        using namespace std;
        #define ll long long
        #define pll pair<ll,ll>
        #define pii pair<int,int>
        #define mii map<int,int>
        #define msi map<string,int>
        #define pb push_back
        #define mp make_pair
        #define M 1101
        #define MOD 1000000007
        #define fi first
        #define se second
        #define vi vector<int>
        #define vl vector<ll>
        #define all(v) v.begin(),v.end()
        #define allr(v) v.rbegin(),v.rend()
        #define repl(i,l,r) for(long long i=l;i<=r;++i)
        #define rep(i,l,r) for(int i=l;i<=r;++i)
        #define ins insert
        #define inf INT_MAX
        #define vpi vector< pair<int,int> >
        #define vpl vector< pair<ll,ll> >
        #define eps 0.00001
        const int maxn=2e5+10;
        ll x[maxn],y[maxn];
        char d[maxn];
        double b1[maxn],b2[maxn];
        int n;
        double f(double xx)
        {
            double xmin=1e12,xmax=-1e12,ymin=1e12,ymax=-1e12;
            rep(i,1,n)
            {
                b1[i]=x[i];b2[i]=y[i];
            }
            rep(i,1,n)
            {
                if(d[i]=='R')
                {
                    b1[i]+=xx;
                }
                else
                    if(d[i]=='L')
                {
                    b1[i]-=xx;
                }
                else
                    if(d[i]=='U')
                {
                    b2[i]+=xx;
                }
                else
                    if(d[i]=='D')
                {
                    b2[i]-=xx;
                }
                xmin=min(xmin,b1[i]);
                xmax=max(xmax,b1[i]);
                ymin=min(ymin,b2[i]);
                ymax=max(ymax,b2[i]);
            }
            return (xmax-xmin)*(ymax-ymin);
        }
        double ts(double l,double r)
        {
            rep(i,1,400)
            {
                double m1=l+(r-l)/3;
                double m2=r-(r-l)/3;
                double f1=f(m1);double f2=f(m2);
                if(f1>=f2)
                {
                    l=m1;
                }
                else
                {
                    r=m2;
                }
            }
            return f(l);
        }
        int main()
        {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            cout.tie(NULL);
            cin>>n;
            rep(i,1,n)
            {
                cin>>x[i]>>y[i]>>d[i];
         
            }
            cout<<fixed<<setprecision(12)<<ts(0,1e12)<<"\n";
         
            return 0;
         
            //check for long long or int
        }

Measured memory_bytes: 5632
#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;


string S;

const int MAXN = 300000;

int dp[26];
char path[MAXN];

int main() {
	cin >> S;
	SET(dp, 0);
	for (int i = S.sz - 1; i > -1; i--) {
		int ch = S[i] - 'a';
		int bb = 1 << 20;
		int idx = -1;
		FOR (j, 26)
			if (dp[j] < bb) {
				bb = dp[j];
				idx = j;
			}
		bb++;
		dp[ch] = bb;
		path[i] = (char)('a' + idx);
	}
	int bb = 1 << 20;
	char idx;
	FOR (i, 26)
		if (dp[i] < bb) {
			bb = dp[i];
			idx = (char)('a' + i);
		}
	int pos = 0;
	printf("%c", idx);
	while (pos < S.sz) {
		while (pos < S.sz && S[pos] != idx)
			pos++;
		if (pos < S.sz) {
			idx = path[pos];
			printf("%c", idx);
			pos++;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 772
#include <bits/stdc++.h>
#define mod 1000000007
#define pi 3.14159265359
#define pb push_back
using namespace std;
vector <long long int> prm;
bool prime[10000001];
int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r)
    {
        int m = l + (r - l) / 2;
        if (arr[m] == x)
            return m;
        if (arr[m] < x)
            l = m + 1;
        else
            r = m - 1;
    }
    return -1;
}
void SieveOfEratosthenes(int n)
{
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == false)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = true;
        }
    }
    for (int p=2; p<=n; p++)
        if (!prime[p])
          prm.pb(p);
}
long long int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
long long binomialCoeff(long long n, long long k)
{
    long long C[n + 1][k + 1];
    long long i, j;
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {
            if (j == 0 || j == i)
                C[i][j] = 1;
            else
                C[i][j] = (C[i - 1][j - 1] + C[i - 1][j])%mod;
				C[i][j]%= mod;
        }
    }
    return C[n][k];
}
int countDigit(long long n)
{
    int count = 0;
    while (n != 0)
    {
        n = n / 10;
        ++count;
    }
    return count;
}
long long int power(int a, int b)
{
    long long k=1;
    for(int i=0; i<b; i++)
    {
        k*=a;
        k%=mod;
    }
    return k;
}
long long int maxSubArraySum(long long int a[],long long int size)
{
   long long int max_so_far = 0, max_ending_here = 0;
   for (int i = 0; i < size; i++)
   {
       max_ending_here = max_ending_here + a[i];
       if (max_ending_here < 0)
           max_ending_here = 0;
       else if (max_so_far < max_ending_here)
           max_so_far = max_ending_here;
   }
   return max_so_far;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,c;
	cin>>n;
	if(n%1000)
        c=n/1000+1;
    else
        c=n/1000;
    cout<<(1000*c-n);
    return 0;
}

Measured memory_bytes: 3640
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#define For(i , j , k) for (int i = (j) , _##end_ = (k) ; i <= _##end_ ; ++ i)
#define Fordown(i , j , k) for (int i = (j) , _##end_ = (k) ; i >= _##end_ ; -- i)
#define Set(a , b) memset(a , b , sizeof(a))
#define pb push_back
#define INF (0x3f3f3f3f)
#define Mod (1000000007)
using namespace std;
typedef long long LL;

template <typename T> inline bool chkmax(T &a , T b) { return a < b ? (a = b , 1) : 0; }
template <typename T> inline bool chkmin(T &a , T b) { return b < a ? (a = b , 1) : 0; }

int _ , __;
char c_;
inline int read()
{
    for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}

inline void file()
{
#ifdef hany01
    freopen("permutation.in" , "r" , stdin);
    freopen("permutation.out" , "w" , stdout);
#endif
}

const int maxn = 500010 , maxm = 10000000;

int v[maxm] , in[maxn] , nex[maxm] , beg[maxn] , n , k , p[maxn] , e , ans[maxn];

inline void add(int uu , int vv)
{
//  printf("%d %d\n" , uu , vv);
    v[++ e] = vv;
    ++ in[vv];
    nex[e] = beg[uu];
    beg[uu] = e;
}

struct Item
{
    int key , pos;
    bool operator < (const Item &item) const
    {
        return key < item.key;
    }
};

typedef set<Item>::iterator It;
It it;

inline void init()
{
    n = read();
    k = read();
    For(i , 1 , n)
        p[i] = read();
    set<Item> st;
    For(i , 1 , n)
    {
        if (i >= k + 1)
            st.erase((Item){p[i - k] , i - k});
        it = st.upper_bound((Item){p[i] , i});
        if (it != st.end())
            add(i , (*it).pos);
/*      printf("%d:" , p[i]);
        for (it = st.begin() ; it != st.end() ; ++ it)
            printf(" %d" , (*it).key);
        putchar('\n');*/
        st.insert((Item){p[i] , i});
    }
    st.clear();
    For(i , 1 , k - 1)
        st.insert((Item){p[i] , i});
//  putchar('\n');
    For(i , 1 , n)
    {
        st.erase((Item){p[i] , i});
        if (i + k - 1 <= n)
            st.insert((Item){p[i + k - 1] , i + k - 1});
        it = st.upper_bound((Item){p[i] , i});
        if (it != st.end())
            add(i , (*it).pos);
/*      printf("%d:" , p[i]);
        for (it = st.begin() ; it != st.end() ; ++ it)
            printf(" %d" , (*it).key);
        putchar('\n');*/
        st.erase((Item){p[i - k + 1] , i - k + 1});
    }
}

inline void toposort()
{
    priority_queue<int , vector<int> , greater<int> > q;
    For(i , 1 , n)
        if (!in[i])
            q.push(i);
    int now = 0;
    while (!q.empty())
    {
        int u = q.top();
        q.pop();
        ans[u] = ++ now;
        for (int i = beg[u] ; i ; i = nex[i])
        {
            -- in[v[i]];
            if (!in[v[i]])
                q.push(v[i]);
        }
    }
}

inline void print()
{
    For(i , 1 , n)
        printf("%d\n" , ans[i]);
}

int main()
{
    file();
    init();
    toposort();
    print();
    return 0;
}

Measured memory_bytes: 45440
#include<iostream>
#include<algorithm>
#include<complex>
#include<vector>
#include<queue>
#define LL long long
LL N;
LL add;
std::priority_queue<LL> q;
int main() {
	std::cin >> N;
	for (int i = 0; i < N; i++) {
		LL tmp;
		std::cin >> tmp;
		q.push(tmp);
	}
	while (true) {
		LL a = q.top();
		q.pop();
		if (a + add < N) {
			break;
		}
		a += add;
		LL tmp = (a  - N)/ N + 1;
		a -= tmp * N;
		add += tmp;
		a -= add;
		q.push(a);
	}
	std::cout << add << std::endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#define ll long long
using namespace std;

int main(){
    string s;
    cin >> s;
    vector<ll> ans(s.length(), 1);
    for(ll i = 0; i < s.length(); i++){
        ll count = 0;
        if(s[i]=='R'){
            for(ll j = i+1; j < s.length(); j++){
                count++;
                if(s[i]!=s[j]&&count%2!=0){
                    ans[i]--;
                    ans[i+count-1]++;
                    //cout << count << " " << i+count-1 << endl;
                    break;
                }
                else if(s[i]!=s[j]&&count%2==0){
                    ans[i]--;
                    ans[i+count]++;
                    //cout << count << " " << i+count << endl;
                    break;
                }
            }
            for(ll k = 1; k < count; k++){
                ans[i+k]--;
                if((count-k)%2!=0) ans[i+count-1]++;
                else ans[i+count]++;
            }
            i+=(count-1);
        }
    }
    for(ll i = s.length()-1; i >= 0; i--){
        ll count = 0;
        if(s[i]=='L'){
        for(ll j = i-1; j >= 0; j--){
            count++;
            if(s[i]!=s[j]&&count%2!=0){
                ans[i]--;
                ans[i-count+1]++;
                //cout << i-count+1 << endl;
                break;
            }
            else if(s[i]!=s[j]&&count%2==0){
                ans[i]--;
                ans[i-count]++;
                //cout << i-count << endl;
                break;
            }
        }
            for(ll k = 1; k < count; k++){
                ans[i-k]--;
                if((count-k)%2!=0) ans[i-count+1]++;
                else ans[i-count]++;
            }
            i-=(count-1);
        }
    }
    for(ll i = 0; i < s.length(); i++)
        cout << ans[i] << " ";
    cout << endl;
    return 0;
}


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

int main(){
    int n;cin>>n;
    long long d,x,y;
    cin>>d;
    int sum=0;
    for(int i=0;i<n;i++){
        scanf("%lld %lld",&x,&y);
        if(x*x+y*y<=d*d)sum++;
    }
    cout<<sum<<endl;
}

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

vector<int> to[200005];
vector<int> ans;
void dfs(int x, int p=-1) {
    for (int u : to[x]) {
        if (u == p) continue;
        ans[u] += ans[x];
        dfs(u,x);
    }
}

int main() {
    int n, q;
    cin >> n >> q;
    rep(i,n-1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    ans.resize(n);
    rep(i,q) {
        int p, x;
        cin >> p >> x;
        --p;
        ans[p] += x;
    }
    dfs(0);
    rep(i,n) {
        if (i != n-1) printf("%d ", ans[i]);
        else printf("%d\n", ans[i]);
    }
    return 0;
}

Measured memory_bytes: 23424
from collections import Counter

n = int(input())
s = []
for i in range(n):
    s.append(input())

c = Counter(s)

mostCommon = c.most_common()
count = mostCommon[0][1]
ans = []
ans.append(mostCommon[0][0])

for i in range(1, len(mostCommon)):
    if count == mostCommon[i][1]:
        ans.append(mostCommon[i][0])
    else:
        break

ans.sort()

for _ans in ans:
    print(_ans)

Measured memory_bytes: 47660
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int x1,x2,x3,x4,x5,ans=0;
        x1=scan.nextInt();
        x2=scan.nextInt();
        x3=scan.nextInt();
        x4=scan.nextInt();
        x5=scan.nextInt();
        if(x1==0) ans=1;
         if(x2==0) ans=2;
          if(x3==0) ans=3;
           if(x4==0) ans=4;
            if(x5==0) ans=5;
        System.out.println(ans);
    }
}


Measured memory_bytes: 35784
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
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; }

int main() {
    ll N, K; cin >> N >> K;
    vector<ll> h(N);
    rep(i, N) cin >> h.at(i);
    sort(ALL(h), greater<int>());

    ll mi = 1e9;
    foreps(i, 0, N - K + 1) {
        mi = min(mi, h.at(i) - h.at(i + (K - 1)));
    }
    cout << mi << endl;
}

Measured memory_bytes: 3952
function Main(input) {
  var N = parseInt(input[0], 10);
  var A = input[1].split(" ");

  var total = 0;
  for (var i = 0; i < N; i++) {
    A[i] = parseInt(A[i], 10);
    total += A[i];
  }
//   console.log("total:%s", total);

  var result = 0;
  var mae = 0;
  var ato = 0;
  var target = 0;
  for (var i = 0; i < N; i++) {
    if (mae + A[i] < total / 2) {
      mae += A[i];
    } else if (mae + A[i] == total / 2) {
      console.log("%s", 0);
      return;
    } else {
      target = i;
      ato = total - mae - A[i];
      break;
    }
  }
//   console.log("mae:%s", mae);
//   console.log("ato:%s", ato);
//   console.log("target:%s", i);
//   console.log("Ai:%s", A[i]);

  var diff = Math.abs(ato - mae);
//   console.log("diff:%s", diff);
  var result = Math.abs(A[i] - diff);
  console.log("%s", result);
}

Main(
  require("fs")
    .readFileSync("/dev/stdin", "utf8")
    .split("\n")
);


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

#define loop(n) for(int i = 0;i < (int)(n);++i)
#define rep(i,n) for(int i = 0;i < (int)(n);++i)
#define all(vec) (vec).begin(),(vec).end()
#define Sort(vec) sort(all(vec))
#define Rev(vec) reverse(all(vec))

namespace Input
{
                
    void input(){return;}
    template<typename First,typename... Rest> void input(First &first,Rest&... rest){
    std::cin >> first;
    input(rest...);
}
    
    void inputVec(){return;}
    template<typename First,typename... Rest> void inputVec(vector<First> &first,Rest&... rest){
        int N = first.size();
        for(int i = 0;i < N;i++){
            cin >> first[i];
        }
        inputVec(rest...);
    }
    
    template<typename First,typename Second> void inputTwoVec(vector<First> &first,vector<Second>& second){
        int N = first.size();
        for(int i = 0;i < N;i++){
            cin >> first[i] >> second[i];
        }
    }
}

void calculate(){
    int N;
    Input::input(N);
    vector<int> a(3 * N);
    Input::inputVec(a);
    Sort(a);
    long long sum = 0;
    for(int i = 3 * N - 2;N <= i; i -= 2)
    {
        sum += a[i];
    }
    cout << sum << '\n';
}

int main(int,char**){
    calculate();    
}




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

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

  ll sum = 0;
  ll q = pow(10, 9) + 7;

  for(ll i = k; i <= n+1; i++){
    if(i == 1 || i == n){
      sum += n + 1;
      sum %= q;
    }
    else if(i == n+1){
      sum += 1;
      sum %= q;
    } 
    else{
      sum += ((2*n-i+1)*i)/2 - ((i-1)*i)/2 + 1;
      sum %= q;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3636
n, k = map(int, input().split())
p = list(map(int, input().split()))

value = 0
index = 0

for i in range(0, k):
    value += p[i]

max = value

for i in range(1, n - k + 1):
    value = value - p[i - 1] + p[i + k - 1]
    if value > max:
        max = value
        index = i

total = 0
for i in range(index, index + k):
    total += p[i] / 2 + 0.5

print(total)

Measured memory_bytes: 25060
#include<stdio.h>

void swap(int *x, int *y){
	int a;
	a = *x;
	*x = *y;
	*y = a;
}

int main(void){
	int x, y;
	scanf("%d %d", &x, &y);
	while (x != 0){
		if(x < y){
			swap(&x, &y);
		}
		x = x % y;
	}
	printf("%d\n", y);
	return 0;
}

Measured memory_bytes: 592
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char dn[1300000], * di = dn;
int keta1 = 1, keta2;
char C1[10] = { '1', '0', '0', '0', '0', '0' };
char C2[10] = { '0', '0', '0', '0', '0', '0' };

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


	int N, M;
	scanf("%d %d", &N, &M);

	if (N % 2) {
		int n = N - 1;
		keta2 = 0;
		while (n) {
			*(C2 + keta2) = '0' + n % 10;
			n /= 10;
			keta2++;
		}

		rep1(i, M) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = ' ';
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';

			C1[0]++;
			int tmp = 0;
			while (C1[tmp] > '9') {
				C1[tmp++] -= 10;
				C1[tmp]++;
				if (C1[keta1] != '0') keta1++;
			}
			C2[0]--;
			tmp = 0;
			while (C2[tmp] < '0') {
				C2[tmp++] += 10;
				C2[tmp]--;
				if (C2[keta2 - 1] == '0') keta2--;
			}
		}
	}
	else {
		int n = N;
		keta2 = 0;
		while (n) {
			*(C2 + keta2) = '0' + n % 10;
			n /= 10;
			keta2++;
		}
		rep1(i, (M + 1) / 2) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = ' ';
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';

			C1[0]++;
			int tmp = 0;
			while (C1[tmp] > '9') {
				C1[tmp++] -= 10;
				C1[tmp]++;
				if (C1[keta1] != '0') keta1++;
			}
			C2[0]--;
			tmp = 0;
			while (C2[tmp] < '0') {
				C2[tmp++] += 10;
				C2[tmp]--;
				if (C2[keta2 - 1] == '0') keta2--;
			}
		}
		C2[0]--;
		int tmp = 0;
		while (C2[tmp] < '0') {
			C2[tmp++] += 10;
			C2[tmp]--;
			if (C2[keta2 - 1] == '0') keta2--;
		}
		for (int i = (M + 1) / 2 + 1; i <= M; i++) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = ' ';
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';

			C1[0]++;
			int tmp = 0;
			while (C1[tmp] > '9') {
				C1[tmp++] -= 10;
				C1[tmp]++;
				if (C1[keta1] != '0') keta1++;
			}
			C2[0]--;
			tmp = 0;
			while (C2[tmp] < '0') {
				C2[tmp++] += 10;
				C2[tmp]--;
				if (C2[keta2 - 1] == '0') keta2--;
			}
		}
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 2764
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.math.BigInteger
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
import kotlin.math.sqrt

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val A = nl()
    val B = ns().filter { it != '.' }.toString().toLong()
    out.println(A * B / 100)

  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}

Measured memory_bytes: 34740
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>
#include <sstream>

using namespace std;

typedef unsigned long long ull;

bool is_prime(ull n){

  for(ull i=2; i*i<=n; i++)
    if(n%i==0)return false;
  return true;
}

string toString(ull a){
  ostringstream oss;
  oss << a;
  return oss.str();
}

ull toULL(string s){
  istringstream iss(s);
  ull a;
  iss >> a;
  return a;
}

int main(void){
  int n,c;
  string str="",C="";

  cin >> n >> c;

  for(int i=0;i<n;i++)str+="9";
  
  if(c>=0)C=c+'0';

  if(c<0){
    cout << str << str << endl;
    return 0;
  }
  while(true){
    string rstr=str;
    reverse(rstr.begin(),rstr.end());
    
    string res=str+C+rstr;
    ull ans=toULL(res);

    if(is_prime(ans)){
      cout << ans << endl;
      return 0;
    }

    ull tmp=toULL(str);
    tmp--;
    str=toString(tmp);
  }

  return 0;
}

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

using namespace std;

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

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef long long ll;
typedef pair<int, int> PII;
typedef priority_queue<int> PQI;
typedef priority_queue<PII> PQII;

const double EPS = 1e-10;

map<string, int> d;

int is_cat(string s) {
  if (s.empty()) return 1;
  if (d.find(s) != d.end()) return d[s];
  int n = (int)s.size();
  if (s[0]!='m' || s[n-1]!='w') return 0;
  FOR(i,1,n-1) if (s[i] == 'e') {
    if (is_cat(s.substr(1,i-1)) && is_cat(s.substr(i+1,n-1-(i+1))))
      return d[s] = 1;
  }
  return d[s] = 0;
}

int main() {
  string s;
  cin >> s;
  if (is_cat(s))
    cout << "Cat" << endl;
  else
    cout << "Rabbit" << endl;

  return 0;
}

Measured memory_bytes: 5632
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.util.*;
import java.util.Map.Entry;

public class Main {

	public static void main(String[] args) throws IOException {
		FastReader in = new FastReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		char[] n = in.next().toCharArray();
		int a = n[0] - '0';
		int b = n[1] - '0';
		int c = n[2] - '0';
		if (a < b || (b >= a && c > a)) {
			++a;
		}
		out.println(a + "" + a + "" + a);
		out.flush();
		out.close();

	}

	static class FastReader {
		StringTokenizer st;
		BufferedReader br;

		public FastReader(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public FastReader(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}

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


int main() {
  int N, M, X;
  cin >> N >> M >> X;
  int S = N * (M + 1);
  vector<int> input(S);
  vector<int> ans(1);
  vector<int> sp(1);
  int skill = 0;
  int price = 0;
  for( int i = 0;i < S; i++) {
    cin >> input.at(i);
  }
  for (int tmp = 0; tmp < (1 << 12); tmp++) {
  bitset<12> s(tmp);
  // (ビット列sに対する処理)
    for( int i = 0; i < M; i++) {
      for(int j = 0; j < N; j++) {
        if(s.test(j) == 1) {
          skill += input.at((M + 1) * j + i + 1);
        }
      }
        sp.push_back(skill);
        skill = 0;
    }
    sort(sp.begin(),sp.end());
    if(sp.at(1) >= X) {
      for(int j = 0; j < N; j++) {
        if(s.test(j) == 1) {
          price += input.at((M + 1) * j);
        }
      }
      ans.push_back(price);
      price = 0;
    }
    sp = vector<int>(1,0);
  }
  sort(ans.begin(),ans.end());
  if(ans.size() == 1) {
    cout << -1 << endl;
  }
  else{
    cout << ans.at(1);
  }
}
      



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod = 1e9+7;

int solve(vector<vector<char> >& A, int i, int j, int n, int m, vector<vector<int> >& dp)
{
    
    //cout << i << " " << j << endl;    
    
    if(i >= n || j >= m)
        return 0;
        
    if(i == n-1 && j == m-1) 
        return 1;
        
    if(A[i][j] == '#')
        return 0;
    
    if(dp[i][j] != -1)
        return dp[i][j];
        
    dp[i][j] = (solve(A, i+1, j, n, m, dp) + solve(A, i, j+1, n, m, dp))%mod;
    return dp[i][j];
    
}


int main()
{
  int n, m;
  cin >> n >> m;
  vector<vector<char> > a(n, vector<char>(m, 0));
  for(int i=0;i<n;++i)
  {
      for(int j=0;j<m;++j)
      {
          cin >> a[i][j];
      }
  }
  vector<vector<int> > dp(n, vector<int>(m, -1));
  solve(a, 0, 0, n, m, dp);
//   for(auto i: dp)
//   {
//       for(auto j: i)
//         cout << j << " ";
//       cout << endl;
//   }
  
  cout << dp[0][0] << endl;
  
}

Measured memory_bytes: 8740
N=gets.to_i
res = 0
ans = false
N.times.each do |i|
  d1, d2 = gets.split.map &:to_i
  res = d1 == d2 ? res + 1 : 0
  if res >= 3
    ans = true
  end
end
puts ans ? 'Yes' : 'No'

Measured memory_bytes: 14320
#include<stdio.h>
#include<string.h>
int main()
{
	char j[15000];
	int i,joi,ioi;
	while(scanf("%s",j)!=EOF){
		joi=0;
		ioi=0;
		for(i=0;i<strlen(j)-2;i++){
			if(j[i+1]=='O'&&j[i+2]=='I'){
				if(j[i]=='J'){
					joi++;
				}else if(j[i]=='I'){
					ioi++;
				}
			}
		}
		printf("%d\n%d\n",joi,ioi);
	}
	return 0;
}



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

using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)

using ll = long long;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int N, x; cin >> N >> x;


  ll A[N];
  rep(i, N) cin >> A[i];
  sort(A+0, A+N);

  ll sum = 0;
  rep(i, N) {
    if (sum > x) {
      cout << i-1 << endl;
      return 0;
    }
    sum += A[i];
  }
  if (sum == x)
    cout << N << endl;
  else
    cout << N - 1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

struct point{
    int v, w;
    vector<ll> dp; 
    int um;
};

int main() {
    vector<int> ar(5);
    rep(i,5) cin >> ar[i];
    rep(i,5){
        if (ar[i] != i+1) cout << i+1 << endl;
    }
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main()
{
	unsigned long long n,m=1;
	cin>>n;
	for(unsigned long long i=1;i<=n;i++)
    {
		m*=i;
        m%=1000000007;
	}
	cout<<m;
	return 0;
}

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

int main() {
	int K, S;
	scanf("%d%d", &K, &S);
	int count = 0;
	for (int i = 0; i <= K; i++) {
		if (i > S)break;
		for (int j = 0; j <= K; j++) {
			int m = S - i - j;
			if (i + j <= S&&m<=K)count++;
				
			
		}
		//	printf("%d%d%d,%d\n", i, j, m, i + j + m);
	}
	printf("\n%d", count);



}



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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,b,a)     for(int i=b;i>=a;i--)

vector<int> v;
int a,b,k;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
   
    cin>>a>>b>>k;
    rep(i,1,min(a,b))
        if(a%i==0 and b%i==0)
            v.emplace_back(i);
    sort(v.begin(),v.end(),greater<int>());
    cout<<v[k-1];
}


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

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(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//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 EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18
const int N = 100010;//10^5+10

const int MAX_N = 2000;
int a[MAX_N], n, x;
int f[MAX_N][MAX_N];

int main() {
	
	string s; int k; cin >> s >> k;

	for (int i = 0; i < s.length(); i++) {
		if(s[i] != 'a') {
			int d = 26 - (s[i] - 'a');

			if (k - d >= 0) {
				k -= d;
				s[i] = 'a';
			}
		}
	}

	if (s[s.length()-1] + k <= 'z') {
		s[s.length() - 1] = s[s.length() - 1] + k;

	}
	else {
		s[s.length() - 1] = s[s.length() - 1] + (k % 26) - 26;
	}

	if (s[s.length() - 1] < 'a')s[s.length() - 1] += 26;

	cout << s << endl;

	return 0;
}


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

#define ll long long
#define ld long double
#define F first
#define S second

#define ONLINE_JUDGE 1

using namespace std;

const int mod = 1e9+7;

void solve(){
	int n,m;
	cin >> n >> m;
	vector<int> a(n);
	int sum = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		sum+=a[i];
		a[i] *= 4 * m;
	}
	int cnt = 0;
//	cout << sum << "\n";
	for(int i  = 0; i < n; i++){
		if(a[i]>=sum) cnt++;
	}
	if(cnt>=m){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
}

int main(){
	#ifndef ONLINE_JUDGE	
		freopen("in.txt","r",stdin);
		freopen("out.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);		
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

ll ba(int a) {return (ll)a*a;}
int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	const int mod=2019;
	ll l, r;
	cin >>l >>r;
	VI mm(2030);
	for(ll i= l; i<= r; i++){
		mm[i%mod]++;
		if(i%mod == 0){puts("0"); return 0;}
	}
	ll ans =1LL<<60;
	rep(i, mod) if(mm[i]) rep2(j, i+1, mod) if(mm[j]){
		ans = min(ans, ((ll)i * j)%mod); 
	}
	rep(i, mod) if(mm[i] >1){
		ans = min(ans, ((ll)i*i)%mod);
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);


#define lson (t<<1)
#define rson ((t<<1)|1)
struct SGT
{
	struct segment
	{
		int l,r,mx,delta;
	}seg[1050111];
	void pushdown(int t)
	{
		seg[lson].delta+=seg[t].delta;seg[rson].delta+=seg[t].delta;
		seg[lson].mx+=seg[t].delta;seg[rson].mx+=seg[t].delta;
		seg[t].delta=0;
	}
	void build(int l,int r,int t=1)
	{
		seg[t].l=l;seg[t].r=r;seg[t].mx=-inf;seg[t].delta=0;
		if(l==r)return;
		int mid=(l+r)>>1;
		build(l,mid,lson);build(mid+1,r,rson);
	}
	void add(int l,int r,int v,int t=1)
	{
		if(l>r)return;
		if(seg[t].l==l&&seg[t].r==r)
		{
			seg[t].delta+=v;seg[t].mx+=v;
			return;
		}
		pushdown(t);
		int mid=(seg[t].l+seg[t].r)>>1;
		if(r<=mid)add(l,r,v,lson);
		else if(l>mid)add(l,r,v,rson);
		else
		{
			add(l,mid,v,lson);
			add(mid+1,r,v,rson);
		}
		seg[t].mx=max(seg[lson].mx,seg[rson].mx);
	}
	void set(int p,int v,int t=1)
	{
		if(seg[t].l==seg[t].r)
		{
			seg[t].mx=v;
			return;
		}
		pushdown(t);
		int mid=(seg[t].l+seg[t].r)>>1;
		if(p<=mid)set(p,v,lson);
		else set(p,v,rson);
		seg[t].mx=max(seg[lson].mx,seg[rson].mx);
	}
	int query(int l,int r,int t=1)
	{
		if(l>r)return 0;
		if(seg[t].l==l&&seg[t].r==r)return seg[t].mx;
		pushdown(t);
		int mid=(seg[t].l+seg[t].r)>>1;
		if(r<=mid)return query(l,r,lson);
		else if(l>mid)return query(l,r,rson);
		else return max(query(l,mid,lson),query(mid+1,r,rson));
	}
}m1;

int n,m,l[200111],r[200111];
vector<int> st[200111];
int main()
{
	get2(n,m);
	m1.build(1,m);
	for(int i=1;i<=n;i++)
	{
		get2(l[i],r[i]);
		st[l[i]+1].pb(i);
	}
	for(int i=1;i<=m;i++)m1.set(i,i);
	int ans=max(n,m);
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<(int)st[i].size();j++)
		{
			int id=st[i][j];
			m1.add(l[id]+1,r[id]-1,1);
		}
		ans=max(ans,m1.query(i,m)-i+1);
	}
	printendl(ans-m);
	return 0;
}

Measured memory_bytes: 20224
#include <bits/stdc++.h>
#define INF 1e16
using namespace std;

typedef long long ll;
ll p[2] = {1, -1};

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

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> x(N), y(N), z(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> z[i];
    }

    ll ans = 0;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                vector<vector<ll>> dp(N + 1, vector<ll>(M + 2, -INF));
                dp[0][0] = 0;
                for (int n = 0; n < N; n++) {
                    ll X = x[n] * p[i], Y = y[n] * p[j], Z = z[n] * p[k];
                    ll sum = X + Y + Z;
                    for (int m = 0; m <= M; m++) {
                        if (dp[n][m] == -INF) continue;
                        chmax(dp[n + 1][m], dp[n][m]);
                        chmax(dp[n + 1][m + 1], dp[n][m] + sum);
                    }
                }
                chmax(ans, dp[N][M]);
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 8196
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

ll g(ll B) {
  ll ans = 0;
  ans += (B + 1) / 2;
  ans %= 2;
  if (B % 2 == 0)
    ans ^= B;
  return ans;
}

int main() {
  ll A, B;
  cin >> A >> B;

  ll ans = g(B) ^ g(A - 1);

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<set>
#define ll long long 
#include <string>
using namespace std;
int main()

{
	ll int n,c=1,f=1,p;
	cin>>n;
	ll int a[n],i;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	p=a[0];
	if (n>=1)
	{
		for(i=1;i<n;i++)
		{
			if (a[i]<p)
			{
				p=a[i];
				c++;
			}
			
			
			
			
	}
	cout<<c<<endl;
	
}
}




Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  int count = 0;
  int h;
  for (int i = 0; i < N; i++) {
    cin >> h;
    if (h >= K) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 384