akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);
    static long M = 1000000007;

    public static void main(String[] args){
        int N = in.i();
        long[] A = in.ll();
        long ans = 0;
        
        for(int i = 0; i < 60; i++){
            long b = 1L<<i;
            int count = 0;
            for(int j = 0; j < N; j++){
                long c = A[j] & b;
                if(c != 0) count++;
            }
            ans = (ans+f(b%M, count, N-count))%M;
        }
        out.println(ans);
        out.flush();
    }
    
    static int f(long... a){
        long b = 1;
        for(int i = 0; i < a.length; i++){
            b = (b*a[i])%M;
        }
        return (int)b;
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 92220
import Data.Char (digitToInt)

main = interact $ unlines.map (show.calcBottommost.map digitToInt).lines

unitDigit :: Int -> Int -> Int
unitDigit a b = (a+b) `mod` 10

calcDigits :: [Int] -> [Int]
calcDigits (x:y:[]) = unitDigit x y : []
calcDigits (x:y:ys) = unitDigit x y : calcDigits (y:ys)

calcBottommost :: [Int] -> Int
calcBottommost [x] = x
calcBottommost xs = calcBottommost $ calcDigits xs

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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug if(true)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	int n,k,i,j;
	int a[200001];
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++){scanf("%d",&a[i]);}
	queue<int> q;
	for(i=0;i<k;i++){
		q.push(a[i]);
	}
	for(i=k;i<n;i++){
		int front = q.front(); q.pop();
		if(a[i] > front){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
		q.push(a[i]);
	}
	
	return 0;
};

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

#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    SPEED
    int N; cin >> N;
    vector<int> V(N+1),W(N+1);
    for(int i = 1; i <= N; ++i) {
        cin >> V[i] >> W[i];
    }
    int Q; cin >> Q;
    string ans_str="";

    //O(Q)
    int m = 1<<11,g=1<<7;
    vector<int> wr(g);
    vector<int> vr(g);
    vector<vector<pair<int,int>>> sl(m);
    vector<vector<int>> wl(m);
    for(int n = 1; n < m; ++n) {
        int k = 2*n;
        vector<int> l;
        while(k/=2) {
            l.push_back(k);
        }
        int nl = l.size();
        //O(2^9*9)
        for(int i = 0; i < (1<<nl); ++i) {
            int ww=0,vv=0;
            for(int j = 0; j < nl; ++j) {
                if(!(i&(1<<j))) continue;
                ww += W[l[j]];
                vv += V[l[j]];
            }
            wl[n].push_back(ww);
            sl[n].push_back({ww,vv});
        }

        //O(2^9*9 log 2^9)
        sort(sl[n].begin(),sl[n].begin()+(1<<nl));
        sort(wl[n].begin(),wl[n].begin()+(1<<nl));
        for(int i = 1; i < (1<<nl); ++i) {
            chmax(sl[n][i].second,sl[n][i-1].second);
        }
    }
    while(Q--) {
        int p; int Z; cin >> p >> Z;
        vector<int> r;
        int k = 2*p;
        int l=0;
        while(k/=2) {
            if(k<m) chmax(l,k);
            else r.push_back(k);
        }
        int nr = r.size();
        for(int i = 0; i < g; ++i) {
            wr[i]=vr[i]=0;
        }
        for(int i = 0; i < (1<<nr); ++i) {
            for(int j = 0; j < nr; ++j) {
                if(!(i&(1<<j))) continue;
                wr[i]+=W[r[j]];
                vr[i]+=V[r[j]];
            }
        }
        int ans = 0;
        for(int i = 0; i < (1<<nr); ++i) {
            int x = wr[i];
            if(x > Z) continue;
            int y = Z - x;
            int idx = upper_bound(wl[l].begin(),wl[l].end(),y) - wl[l].begin();
            idx--;
            int a = sl[l][idx].second;
            int b = vr[i];
            chmax(ans,a+b);
        }
        ans_str += to_string(ans)+"\n";
    }
    cout << ans_str;

    return 0;
}


Measured memory_bytes: 39340
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)  //  rep
#define repr(i,a,n) for(int i=a;i>n;i--)  //  repリバース
#define leng(n) (int)(log10(n)+1)  //  桁数leng
#define INF 9000000000000000000 //  巨大数INF
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int a;
  cin >> a;
  if (a<=999) cout << "ABC" << endl;
  else cout << "ABD" << endl;
}


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

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

using namespace std;

int main(){
  int a,b;
  cin>>a>>b;
  int r;
  
  if((r=a+b)<10){
    cout<<r;
  }else{
    cout<<"error";
  }

  return 0;
}


Measured memory_bytes: 384
#include <map>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define INF 0x3f3f3f3f



int main()
{
	
	int i, a[200000];
	long long n, x, z, sum;
	std::ios::sync_with_stdio(false);
	while (cin >> n >> x)
	{
		z = 0;
		sum = 0;
		for (i = 0; i < n; i++)
			cin >> a[i];
		for (i = 0; i < n; i++)
		{
			if (a[i] + a[i + 1] > x)
			{
				sum += a[i + 1];
				a[i + 1] = x - a[i];
				sum -= a[i + 1];
			}
		}
		cout << sum << endl;
	}


	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=0,i=0;while(n/10>0){i++;d++;}return d;}
llfor;ll ans=0;////////////////////////////////////////////////////////////
int main(){
 char s[500010];
 scanf("%s",s);
 ll n=strlen(s);
 ll a[n+10];
 rep(i,0,n)a[i]=0;

 //前から<に注目していく
 ll cnt=0;
 rep(i,0,n){
  if(s[i]=='<'){
   a[i]=cnt;
   cnt++;
   if(i==n-1){
    a[n]=cnt;
   }
  }
  else{
   a[i]=cnt;
   cnt=0;
  }
 }

 //後ろから>に注目していく
 cnt=0;
 rrp(i,n,0){
  if(s[n-1]=='>')a[n]=0;
  if(i>0&&s[i]=='>'&&s[i-1]=='<'){
   cnt++;
   a[i]=max(cnt,a[i]);
   cnt=0;continue;
  }
  if(s[i]=='>'){
   cnt++;
   a[i]=cnt;
  }
 else if(s[i]=='<'&&s[i-1]=='>'){
    a[i]=0;cnt=0;continue;
   }
 }
 ans=0;
 rep(i,0,n+1)ans+=a[i];
// rep(i,0,n+1)cout<<a[i]<<" "<<s[i]<<" ";pnn; 
 pr(ans);
 return 0; }


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

using namespace std;

int main()
{
    int n, i;
    cin>>n;
    vector<long long int> a(n);
    for(i=0;i<n;i++)
        cin>>a[i];

    long long int res=0, prevHeight=a[0];
    for(i=1;i<n;i++)
    {
        //cout<<prevHeight<<" ";
        if(a[i]<prevHeight)
            res+=(prevHeight-a[i]);
        else
            prevHeight=a[i];

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


Measured memory_bytes: 4748
#include <vector>
#include <iostream>
using namespace std;
const int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};
int h, w;
string dir = "DRUL";

bool in_range(int a, int b){
  return a >= 0 && a < b;
}

pair<int,int> find(vector<string> &C, int x, int y, int d){
  while(in_range(x+dx[d],h) && in_range(y+dy[d],w)){
    x += dx[d];
    y += dy[d];
    if(C[x][y] == 'o') return {x,y};
  }
  return {-1,-1};
}

string solve(vector<string> &C, int x, int y, int d, int c){
  if(!c) return "";
  for(int i = 0; i < 4; ++i){
    int d_ = (d+i)%4;
    if(d_ == d) continue;
    pair<int,int> next = find(C,x,y,d_);
    if(next.first < 0) continue;
    C[next.first][next.second] = '.';
    string ret = solve(C,next.first,next.second,(d_+2)%4,c-1);
    C[next.first][next.second] = 'o';
    if(ret == "!") continue;
    return dir[d_] + ret;
  }
  return "!";
}

int main(){
  cin >> h >> w;
  vector<string> C(h);
  for(int i = 0; i < h; ++i) cin >> C[i];
  int x = -1, y = -1, d = -1, l = 0;
  for(int i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j){
      char c = C[i][j];
      if(c == 'o') ++l;
      if(c != 'o' && c != '.'){
        x = i;
        y = j;
        C[i][j] = '.';
        for(int k = 0; k < 4; ++k){
          if(dir[k] == c){
            d = (k+2)%4;
          }
        }
      }
    }
  }
  cout << solve(C,x,y,d,l) << endl;
  return 0;
}



Measured memory_bytes: 3200
<?php
// $n = (int)trim(fgets(STDIN));
$input = explode(' ', trim(fgets(STDIN)));

$w = (int)$input[0];
$h = (int)$input[1];
$x = (int)$input[2];
$y = (int)$input[3];

$max = $w * $h / 2;
$res = 0;
if ($w / 2 == $x && $h / 2 == $y) {
	$res = 1;
}
echo $max . ' ' . $res;

Measured memory_bytes: 4728
(* O(h w) *)
let h, w = Scanf.scanf " %d %d" @@ fun a b -> a, b
let q = Queue.create ()
let ds = Array.make_matrix h w @@ -1
let a_ss = Array.init h @@ fun i -> Array.init w @@ fun j -> Scanf.scanf " %c" @@ fun a ->
  if a = '#' then (ds.(i).(j) <- 0; Queue.push (i, j) q); a
let ans = ref 0
let _ =
  while not @@ Queue.is_empty q do
    let y0, x0 = Queue.pop q in
    let f (dy, dx) =
      let y, x = y0 + dy, x0 + dx in
      if 0 <= y && y < h && 0 <= x && x < w && ds.(y).(x) = -1 then
        (ans := ds.(y0).(x0) + 1; ds.(y).(x) <- !ans; Queue.push (y, x) q) in
    List.iter f [-1, 0; 0, -1; 1, 0; 0, 1]
  done;
  Printf.printf "%d\n" !ans

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int A, B;
    cin >> A >> B;

    if (A > B) {
        cout << 2*A-1 << endl;
    } else if (A < B) {
        cout << 2*B-1 << endl;
    } else {
        cout << 2*A << endl;
    }
    return 0;
}

Measured memory_bytes: 256
use std::collections::*;
use std::io::*;
use std::*;
macro_rules! get {
    ($($t:tt),*; $n:expr) => {
        {
            let stdin = std::io::stdin();
            let ret = std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
                let line = line.unwrap();
                let mut it = line.split_whitespace();
                _get!(it; $($t),*)
            }).collect::<Vec<_>>();
            ret
        }
    };
    ($($t:tt),*) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut it = line.split_whitespace();
            _get!(it; $($t),*)
        }
    };
}
macro_rules! _get {
    // iterator(splitted input-string) => iterator(output-type)
    ($it:ident; [char]) => {
        _get!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; usize1) => {
        $it.next().unwrap().parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap().parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:ty),+) => {
        ($(_get!($it; $t)),*)
    };
}

fn main() {
    let n = get!(usize);
    let mut count = vec![0; n + 1];
    for x in 1..=100 {
        for y in 1..=100 {
            for z in 1..=100 {
                let val = x * x + y * y + z * z + x * y + y * z + z * x;
                if val <= n {
                    count[val] += 1;
                }
            }
        }
    }
    for i in 1..=n {
        println!("{}", count[i]);
    }
}


Measured memory_bytes: 2200
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
	ll n, k;
	cin >> n >> k;
	mint ans = 0;
	rep2(i, k, n+2){
		ll l = i-1;
		l = l * (l+1)/2;
		ll r = n * (n+1)/2;
		ll rd = (n-i) * (n-i+1)/2;
		r -= rd;
		// cerr << l << " " << r << " " << r - l + 1 << endl;
		ans += (r - l + 1);
	}
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    int N,K; cin >> N >> K;
    double ans = 0;
    for (int i = 1;i <= N; ++i) {
        if (i >= K) {
            ans += (double)1/N;
            continue;
        }
        int cnt = 0;
        int x = i;
        while (x < K) {
            x *= 2;
            ++cnt;
        }
        ans += (double)pow(0.5,cnt)/N;
    }
    cout << setprecision(20);
    cout << ans << '\n';
    return 0;
}

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

int main(void){
    int N;
    cin >> N;
    int H[N+1];
    H[0] = 0;
    for(int i = 1 ; i <= N ; i++){
        cin >> H[i];
    }
    
    int max = 0;
    int i = 1;
    int counter = 0;
    while(i <= N){
        if(max <= H[i] && H[i-1] <= H[i]) counter++;
        if(max < H[i]) max = H[i];
        i++;
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repm(i, a, n) for (int i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    if (c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void Print(bool c)
{
    if (c)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

int kaijo(int x)
{
    int ans = 1;
    rep(i, 1, x + 1) ans *= i;
    return ans;
}

string n_shin(int x, int n)
{
    string s;
    while (x > 0)
    {
        s += to_string(x % n + 1);
        x /= n;
    }
    while (s.size() < n)
    {
        s += '0';
    }
    s.reserve();
    //cout << s << endl;
    return s;
}

int main()
{
    int n, k;
    cin >> n >> k;
    vi h(n);
    rep(i, 0, n) cin >> h[i];

    sort(h.begin(), h.end());
    ll ans = 0;
    rep(i, 0, n - k) ans += h[i];
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).end()
template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}


int main(){
    ll n;
    cin >> n;
    ll v1[n/2],v2[n/2];
    for (ll i=0;i<n;i++){
        if (i%2)cin >> v2[i/2];
        else cin >> v1[i/2];
    }
    sort(v1,v1+(n/2));
    sort(v2,v2+(n/2));
    vector<pair<ll,ll> > vec1,vec2;
    ll c=1;
    for (ll i=1;i<n/2;i++){
        if (v1[i-1]!=v1[i]){
            pair<ll,ll> p;
            p=make_pair(c,v1[i-1]);
            c=1;
            vec1.push_back(p);
        }else{
            c++;
        }
    }
    pair<ll,ll> p;
    p=make_pair(c,v1[(n/2)-1]);
    c=1;
    vec1.push_back(p);
    for (ll i=1;i<n/2;i++){
        if (v2[i-1]!=v2[i]){
            pair<ll,ll> p;
            p=make_pair(c,v2[i-1]);
            c=1;
            vec2.push_back(p);
        }else{
            c++;
        }
    }
    p=make_pair(c,v2[(n/2)-1]);
    c=1;
    vec2.push_back(p);
    sort(ALL(vec1),pairCompare);
    sort(ALL(vec2),pairCompare);
    ll ans=0;
    if (vec1.size()==1){
        if (vec2.size()==1){
            if (vec2[0].second==vec1[0].second){
                ans=vec2[0].first;
            }
            cout << ans << endl;
            return 0;
        }
        if (vec2[vec2.size()-1].second==vec1[vec1.size()-1].second){
            ans=(n/2)-vec2[vec2.size()-2].first;
        }
        ans=(n/2)-vec2[vec2.size()-1].first;
        cout << ans << endl;
    }else{
        if (vec2.size()==1){
            if (vec2[vec2.size()-1].second==vec1[vec1.size()-1].second){
                ans=(n/2)-vec1[vec1.size()-2].first;
                cout << ans << endl;
                return 0;
            }
            ans=(n/2)-vec1[vec1.size()-1].first;
            cout << ans << endl;
            return 0;
        }
        if (vec2[vec2.size()-1].second==vec1[vec1.size()-1].second){
            ll ans2=0;
            ans+=(n/2)-vec2[vec2.size()-1].first;
            ans+=(n/2)-vec1[vec1.size()-2].first;
            ans2+=(n/2)-vec2[vec2.size()-2].first;
            ans2+=(n/2)-vec1[vec1.size()-1].first;
            cout << min(ans2,ans) << endl;
            return 0;
        }
        ans+=(n/2)-vec2[vec2.size()-1].first;
        ans+=(n/2)-vec1[vec1.size()-1].first;
        cout << ans << endl;
    }
    return 0;
}


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

using namespace std;
using ll = long long;

int main(){

    ll x, k, d;
    cin >> x >> k >> d;

    x = abs(x);
    if(x/d <= k){
        k -= x/d;
        x -= x/d*d;
    }else{
        cout << x-k*d << '\n';
        return 0;
    }

    if(k%2){
        cout << abs(x-d) << '\n';
    }else{
        cout << x << '\n';
    }

    return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
char A[SIZE],B[SIZE];
int rr[SIZE],ll[SIZE];
const int DD=6000;
int main(){
    RS(A+DD);
    RS(B+DD);
    if(strcmp(A+DD,B+DD)==0)return 0*puts("0");
    int n=LEN(A+DD);
    REP(i,n)A[DD-n-n+i]=A[DD-n+i]=A[DD+n+i]=A[DD+n+n+i]=A[DD+i];
    REP(i,n)B[DD-n-n+i]=B[DD-n+i]=B[DD+n+i]=B[DD+n+n+i]=B[DD+i];
    bool A_have_one=0,B_have_one=0;
    REP(i,n){
        if(B[DD+i]=='1')B_have_one=1;
        if(A[DD+i]=='1')A_have_one=1;
    }
    ll[DD-n-n-1]=-2e5;
    REPP(i,DD-n-n,DD+n+n+n){
        if(B[i]=='1')ll[i]=i;
        else ll[i]=ll[i-1];
    }
    rr[DD+n+n+n]=2e5;
    for(int i=DD+n+n+n-1;i>=DD-n;i--){
        if(B[i]=='1')rr[i]=i;
        else rr[i]=rr[i+1];
    }
    if(!B_have_one&&A_have_one)return 0*puts("-1");
    int an=1e9;
    REPP(offset,-2*n,2*n){
        VPII pp;
        int dif=0;
        multiset<int>H;
        REP(i,n){
            if(B[DD+offset+i]!=A[DD+i]){
                dif++;
                int mi=min(DD+offset+i,DD+i);
                int ma=max(DD+offset+i,DD+i);
                if(rr[mi]>ma){
                    pp.PB(MP(mi-ll[mi],rr[ma]-ma));
                    H.insert(pp.back().S);
                }
            }
        }
        if(!SZ(H)){
            an=min(an,abs(offset)+dif);
            continue;
        }
        sort(ALL(pp));
        an=min(an,abs(offset)+dif+*H.rbegin()*2);
        an=min(an,abs(offset)+dif+pp.back().F*2);
        REP(i,SZ(pp)-1){
            H.erase(H.find(pp[i].S));
            an=min(an,abs(offset)+dif+(pp[i].F+*H.rbegin())*2);
        }
    }
    printf("%d\n",an);
    return 0;
}


Measured memory_bytes: 4480
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int n;cin>>n;
  cout<<(n+1)/2<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

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

namespace AtCoder.Abc
{
    // 問題:https://atcoder.jp/contests/abc166/tasks/abc166_a
    class A_166_A_C
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            string s = Console.ReadLine();

            if(s == "ABC")
            {
                string result = "ARC";
                Console.WriteLine(result);
            }
            else
            {
                string result = "ABC";
                Console.WriteLine(result);
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 25668
n = int(input())
a = list(map(int,input().split()))
a.sort()
if a[0] == 1:
    if n > 1:
        if a[1] == 1:
            print(0)
            exit()
    print(1)
    exit()

p = [False for i in range(a[-1]+1)]
kaburi = set()
for i in range(n):
    if p[a[i]]:
        kaburi.add(a[i])
    p[a[i]] = True

for i in range(2,a[-1]+1):
    if not p[i]:
        continue
    for j in range(i*2,a[-1]+1,i):
        p[j] = False
ans = 0
for i in range(a[-1]+1):
    if p[i] and not i in kaburi:
        ans += 1
print(ans)

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int cmp(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)calloc(n,sizeof(int));
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int *tmp=(int *)calloc(n,sizeof(int));
  int ans=0;
  for(i=30;i>=1;i--){
    qsort(a,n,sizeof(int),cmp);
    int len=0;
    int p=0;
    int q=n-1;
    while(p<q){
      if(a[p]+a[q]==(1<<i)){
	ans++;
	p++;
	q--;
      } else if(a[p]+a[q]<(1<<i)){
	tmp[len++]=a[p++];
      } else {
	tmp[len++]=a[q--];
      }
    }
    if(p==q){
      tmp[len++]=a[p];
    }
    memcpy(a,tmp,sizeof(int)*len);
    n=len;
  }
  printf("%d\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 2540
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
const int INF=1000000000;


int main(){
    int h,w,K;
    cin>>h>>w>>K;
    int inp[h][w];
    int c[15][1005];
        rep(i,h){
        string s;
        cin>>s;
        rep(j,w){
            inp[i][j]=s[j]-'0';
        }
    }
    //cout<<endl;
    int ans=INF;
    rep(i,1<<h-1){
        rep(j,h){
            rep(k,w) c[j][k]=0;
        }
        int id[h];
        int a=0;
        rep(j,h){
            id[j]=a;
            if(i>>j&1) a++;
        }
        rep(j,a+1){
            rep(k,h){
                if(id[k]==j){
                    rep(l,w) c[j][l]+=inp[k][l];
                }
            }
        }
        rep(j,a+1){
            rep(k,w){
                //cout<<c[j][k];
            }
            //cout<<endl;
        }
        //cout<<endl;
        
        int ans1=__builtin_popcount(i);
        int p=0;
        bool ok=true;
        vector<int> tate(a+1,0);
        do{
            rep(j,a+1){
                tate[j]+=c[j][p];
            }
            rep(j,a+1){
                if(tate[j]>K){
                    ok=false;
                }
            }
            if(!ok){
                ok=true;
                ans1++;
                rep(j,a+1) tate[j]=c[j][p];
            }
            p++;
        }while(p!=w);

        rep(j,w){
            rep(k,a+1){
                if(c[k][j]>K){
                    ans1=INF;
                }
            }
        }
        //cout<<"ans1 "<<ans1<<endl;
        //cout<<endl;
        ans=min(ans,ans1);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define all(x) x.begin(),x.end() 
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define per(i,a,b) for(ri i=(a);i>=(b);--i)
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
#define db(x) cout << "#x:" << x << endl
#define dd() cout << "Out put!\n"
const int mod=1e9+7,eps=1e-6,pi=acos(-1.0),maxn=1000010;
const int inf=0x7f7f7f7f7f7f7f7f;
using namespace std;
int a[maxn],b[maxn],c[maxn];
string s; 
signed main()
{
	ios::sync_with_stdio(0);
	int t=1;
//	cin >> t;
	while(t--)
	{
		int a,b,c,d,e;
		rep(i,1,5)
		{
		
			cin >> a;
			if(a==0)
			{
				cout << i;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3532
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(llint i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
// lower_boundは二分探索
struct edge { int to, cost; };
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//sは初めの点、vは頂点size、dは最短距離を求める(初期化はINF),Gは有向グラフ
void dijkdtra(int s, int v, vector<int>& d, whei(edge)& G) {
	priority_queue<Pint, vector<Pint>, greater<Pint>> que;//firstが距離、secondが頂点
	d[s] = 0;//スタートの距離はもちろんzero
	que.push(Pint(0, s));
	while (!que.empty()) {
		Pint p = que.top();
		que.pop();
		int V = p.second;
		if (d[V] < p.first)continue;
		for (int i = 0; i < G[V].size(); i++) {
			edge e = G[V][i];
			if (d[e.to] > d[V] + e.cost) {
				d[e.to] = d[V] + e.cost;
				que.push(Pint(d[e.to], e.to));
			}
		}
	}
}

llint binary_search(vector<int>&s,llint a) {
	llint l = -1;
	llint r = (int)s.size();
	while (r - l > 1) {
		llint mid = l + (r - l) / 2;

		if (s[mid]>=a) r = mid;
		else l = mid;
	}
	return r;
}
int ans = 0;
void bfs(whei(char)& a, int n, int m) {
	queue<Pint> que;
	que.push(Pint(0, 0));
	whei(int) best(n, hei(int)(m, -1));
	best[0][0] = 0;
	int dx[] = { 1,0,-1,0 };
	int dy[] = { 0,1,0,-1 };
	while (!que.empty()) {
		Pint p = que.front(); que.pop();
		rep(i, 0, 4) {
			int Nx = p.first + dx[i];
			int Ny = p.second + dy[i];
			if (Nx < 0 || Ny < 0 || Nx >= n || Ny >= m || a[Nx][Ny] == '#' || best[Nx][Ny] != -1)continue;
			best[Nx][Ny] = best[p.first][p.second]+1;
			que.push(Pint(Nx, Ny));
		}
	}
	ans = best[n - 1][m - 1];
}

int main() {
	int n, m;
	cin >> n >> m;
	int sum = 0;
	whei(char) a(n, hei(char)(m));
	rep(i, 0, n) {
		rep(j, 0, m) {
			cin >> a[i][j];
			if (a[i][j] == '.')sum++;
		}
	}
	bfs(a,n,m);
	if (ans != -1) {
		ans = sum - ans - 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

class Hp
  def initialize(len)
    @main = na(len,[99999999,nil])
    @ind = 1
    @size = len - 5
  end

  def push(n)
    p "wa" if(@ind > @size)
    @main[@ind+1] = n
    sind = @ind+1
    while(sind >= 2)
      nind = sind/2
      if(@main[sind][0] < @main[nind][0])
        @main[sind], @main[nind] = @main[nind], @main[sind]
      else
        break
      end
      sind /= 2
    end
    @ind += 1
  end

  def put()
    return @main
  end

  def pop()
    ans = @main[1]
    @main[1] = @main[@ind]
    @main[@ind] = @main[-1]
    sind = 1
    while(true)
      nind = sind*2
      break if(nind > @ind)
      l = @main[nind]
      nind += 1
      if(nind > @ind)
        ind = nind-1
        if(@main[ind][0] < @main[sind][0])
          @main[sind], @main[ind] = @main[ind], @main[sind]
        end
        break
      end
      r = @main[nind]
      ind = (l[0] > r[0])? nind : nind-1
      if(@main[ind][0] < @main[sind][0])
        @main[sind], @main[ind] = @main[ind], @main[sind]
      end
      sind = ind
    end
    @ind -= 1
    return ans
  end

  def res()
    @ind = 1
    push([99999999,nil])
  end
end

hp = Hp.new(200000)
n,m = inp
a = inp
a.each do |d|
  hp.push([d*-1,0])
end
m.times do
  u = hp.pop
  if(u[0] == 0)
    puts 0
    exit
  end
  hp.push([((u[0]*-1)/2)*-1,0])
end
ans = 0
while true
  u = hp.pop

  break if(u[1] == nil)
  ans += u[0]
end
p ans * -1


Measured memory_bytes: 18544
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
struct UnionFind
{
    vector<ll> par, rank;
    UnionFind(int size) : par(size), rank(size, 1)
    {
        rep(i, size)
        {
            par[i] = i;
        }
    }
    ll find(ll x) //根を返す
    {
        if (par[x] == x)
            return x;
        else
        {
            par[x] = find(par[x]);
            return par[x];
        }
    }
    bool unite(ll x, ll y) //もともと同じならfalseを、そうでなければtrueを返す
    {
        x = find(x);
        y = find(y);
        if (x == y)
            return false;
        if (rank[x] < rank[y])
        {
            swap(x, y);
        }
        par[y] = x; //大きいほうに小さいほうを繋げる
        if (rank[x] == rank[y])
            rank[x]++;
        return true;
    }
    bool same(ll x, ll y)
    {
        return find(x) == find(y);
    }
};
int main()
{
    int N, M;
    cin >> N >> M;
    vint X(M), Y(M), Z(M);
    UnionFind uf(N);
    rep(i, M)
    {
        cin >> X[i] >> Y[i] >> Z[i];
        uf.unite(X[i] - 1, Y[i] - 1);
    }
    vector<bool> Num(N);
    int ans = 0;
    rep(i, N)
    {
        if (!Num[(uf.find(i))])
        {
            Num[(uf.find(i))] = true;
            ans++;
        }
    }
    cout << ans;
    return 0;
}

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

void solve()
{
	int n, m;
	cin >> n >> m;
	int h[n];
	for(int i = 0; i<n; i++) cin >> h[i];
	vector<int> adj[n];
	
	for(int i =0; i<m; i++)
	{
		int a, b;
		cin >> a >> b;
		a--; b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	int cnt = 0;
	int bad[n] = {};
	for(int i = 0; i<n; i++)
	{
		if(bad[i]) continue;
		int height = h[i];
		for(int x :adj[i])
		{
			if(h[x] >= height)
			{
				bad[i] = 1;
				break;
			}
			else bad[x] = 1;
		}
	}
	for(int x :bad)
	{ 
		if(x == 0) cnt++;
	}	
	cout << cnt << "\n";
}

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


Measured memory_bytes: 9556
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  LL n, k;
  cin >> n >> k;
  map<LL, LL> m;
  REP(i, 0, n) {
    LL a;
    cin >> a;
    ++m[a];
  }
  LL ans = 0;
  LL type = m.size();
  if (k < type) {
    VEC<LL> num;
    for (auto v : m) {
      num.push_back(v.second);
    }
    sort(ALL(num));
    DUMP(num);
    LL i = 0;
    while (k < type) {
      ans += num[i];
      --type;
      ++i;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 14964
import numpy as np

X = np.array([int(input()) for i in range(5)])

last = -100
last_idx = -100
for i in range(len(X)):
    if X[i]%10 == 0:
        c = -1
    else:
        c = 10 - X[i]%10

    if c > last:
        last_idx = i
        last = c

X_max = X[last_idx]
X = np.delete(X, last_idx)

ans = 0
for x in X:
    if x%10 == 0:
        ans += x
    else:
        ans += (x//10)*10 + 10
ans += X_max

print(ans)



Measured memory_bytes: 12508
from collections import defaultdict
N=int(input())
def factorint(x):
  F={}
  i=2
  while i**2<=x:
    if x%i==0:
      c=0
      while x%i==0:
        x=x//i
        c+=1
      F[i]=c
    i+=1
  if x!=1:
    F[x]=1
  return F

A=defaultdict(int)
for i in range(2,N+1):
  for p,q in factorint(i).items():
    A[p]+=q

num2=0
num4=0
num14=0
num24=0
num74=0
for p,q in A.items():
  if q>=2:
    num2+=1
  if q>=4:
    num4+=1
  if q>=14:
    num14+=1
  if q>=24:
    num24+=1
  if q>=74:
    num74+=1
    
ans=0
ans+=(num2-2)*(num4)*(num4-1)//2
ans+=(num2-1)*(num24)
ans+=(num4-1)*(num14)
ans+=num74
print(ans)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
ll S[2007];
int main()
{
    ll N;
    cin >> N;
    if(N<=2) cout << 0 << endl;
    else {
        ll ans  = 0;
        S[0] = 1;S[1] = 1;S[2] = 1;
        for(ll i=3;i<=N;i++)
        {
            S[i] = S[i-1]+S[i-3];
            S[i] %= MOD;
        } cout << S[N-3] << endl;
    }
}


Measured memory_bytes: 3592
n = int(input())
a = list(map(int, input().split()))

s=[]
s.append(0)
l = sum(a)
ans=[]
for i in range(1,n):
    s.append(s[i-1]+a[i-1])
    x = s[i]
    y = l-s[i]
    ans.append(abs(x-y))
print(min(ans))

Measured memory_bytes: 29860
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

double STD(int n){
	double s[1000] = {0.0};
	double m = 0.0;
	double sum = 0.0;
	double sigma2 = 0;
	for(int i = 0; i < n; i++){
		cin>>s[i];
		sum += s[i];
	}
	m = sum / n;
	for(int i = 0; i < n; i++){
		sigma2 += (s[i] - m)*(s[i] -m);
	}
	sigma2 = sigma2 / n;
	return sqrt(sigma2);
}


int main()
{
	int n;
	cin>>n;
	while(n != 0){
		double std = STD(n);
		printf("%0.8lf\n",std);
		cin>>n;
	}
	return 0;
}

Measured memory_bytes: 3168
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello{
    public static void Main(){
        
            int [] read=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int a=read[0];
            int b=read[1];
            int c=read[2];
            
            int [,] tate=new int [a,b];
            int [,] yoko=new int [b,c];
            
            for(int i=0;i<a;i++){
                read=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                for(int j=0;j<b;j++)tate[i,j]=read[j];
            }
            for(int i=0;i<b;i++){
                read=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                for(int j=0;j<c;j++)yoko[i,j]=read[j];
            }
            
            double ans=0;
            for(int w=0;w<a;w++)
            {
                for(int j=0;j<c;j++){
                    for(int i=0;i<b;i++){
                        ans+=tate[w,i]*yoko[i,j];
                    }
                    if(j==c-1)Console.Write(ans);
                    else Console.Write(ans+" ");
                    ans=0;
                }
                Console.WriteLine();
            }
    }
}



Measured memory_bytes: 18408
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
LL N, A, B;
vector<LL> h;






//サブ関数
//入力
void input()
{
	cin >> N >> A >> B;
	LL tmp;
	REP(i, N) {
		cin >> tmp;
		h.push_back(tmp);
	}
}

bool judge(
	const LL& time, 
	const LL& A,
	const LL& B,
	vector<LL> h)
{
	for (auto& n : h) n -= B * time;
	

	LL res = 0;
	LL diff = A - B;
	for (auto num : h) if (num > 0) 
		res += ceil((float)num / diff);
	return res <= time;
}


//計算
void calc()
{
	LL l = 0, r = INF;
	while (r - l > 1) {
		LL mid = (l + r) / 2;
		if (judge(mid,A,B,h)) {
			r = mid;
		}
		else {
			l = mid;
		}
	}
	if (judge(l, A, B, h)) {
		cout << l << endl;
	}
	else {
		cout << r << endl;
	}
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 1908