stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <algorithm>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <deque>

#include <stack>

#include <bitset>

#include <iomanip>

#define assem99 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define ll long long



using namespace std;





int solve(int n, int m, int cntr)

{

	if (n == m)

		return cntr;

	if (n > m)

	{

		return cntr;

	}



	return (solve(n * 3, m, ++cntr));

	return (solve(n * 2, m, ++cntr));

}

int main()

{

	assem99;



	ll sum = 0;

	int n, k, arr[200005];

	int cntr = 0;

	cin >> n >> k;

	for (int i = 0; i < n; i++)

		cin >> arr[i];

	if (n <= k)

		cout << '0';

	else

	{

		sort(arr, arr + n);

		for (int i = 0; i < n; i++)

		{

			if (cntr == n - k)

				break;

			sum += arr[i];

			cntr++;

		}



		cout << sum;

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>



#define ll long long



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;





ll a[200005];



int main()

{

    ll n,k;

    io>>n>>k;

    for(int i=0;i<n;++i)io>>a[i];

    std::sort(a,a+n);

    ll ans=0;

    for(int i=0,_i=n-k;i<_i;++i)

        ans+=a[i];

    io<<ans;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <set>



using namespace std;

int main()

{

   long long n, k ,h ,counter=0 ,sum=0;

   multiset<long long , greater<long long> >st;

   cin>>n>>k;

   for(int i=0 ;i<n ;i++)

   {

       cin>>h;

       sum+=h;

       st.insert(h);

   }

    multiset<long long , greater<long long> > ::iterator it;

     it=st.begin();



   while(it!=st.end())

   {

       if(k>0)

       {

           sum-=(*it);

           k--;

           it++;

       }

       else if(k==0)

       {

           break;

       }

   }

   cout<<sum;

 /*

   while(it!=st.end())

   {

       cout<<(*it)<<" " ;

       it++;

   }*/



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>



#define ll long long



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;





ll a[200005];



int main()

{

    ll n,k;

    io>>n>>k;

    for(int i=0;i<n;++i)io>>a[i];

    std::sort(a,a+n);

    ll ans=0;

    for(int i=0,_i=n-k;i<_i;++i)

        ans+=a[i];

    io<<ans;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>



using namespace std;

int main()

{

	long long monsters, special_moves;

	cin>>monsters>>special_moves;

	vector <long long> grid;

	long long total = 0;

	for(long long i = 0; i < monsters; i++)

	{

		long long h;

		cin>>h;

		total += h;

		grid.push_back(h);

	}

	sort(grid.begin(), grid.end());



	if(special_moves == monsters)

	{

		cout<<0<<endl;

		return 0;

	}

	int i = monsters - 1;

	while(special_moves > 0 && i >= 0)

	{

		total -= grid[i];

		i--;

		special_moves--;

	}

	cout<<total<<endl;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>



#define ll long long



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;





ll a[200005];



int main()

{

    ll n,k;

    io>>n>>k;

    for(int i=0;i<n;++i)io>>a[i];

    std::sort(a,a+n);

    ll ans=0;

    for(int i=0,_i=n-k;i<_i;++i)

        ans+=a[i];

    io<<ans;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include<algorithm>

#include<cmath>

using namespace std;



int main()

{

   unsigned long long n,k;

  unsigned long long arr[200005];

  unsigned long long maxm=1;

   unsigned long long cnt =0;



  cin>>n>>k;



  for(int i=0;i<n;i++){

        cin>>arr[i];

        cnt+=arr[i];

  }

  sort(arr,arr+n);



  if (k>=n){

    cout<<0;

  } else if (k==0){

   cout<< cnt;





  }

  else {

  for (int i=n-1;i>=0;i--){

        if (maxm<=k){

        cnt-=arr[i];}

        maxm++;

  }

   cout<<cnt;}



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>



#define ll long long



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;





ll a[200005];



int main()

{

    ll n,k;

    io>>n>>k;

    for(int i=0;i<n;++i)io>>a[i];

    std::sort(a,a+n);

    ll ans=0;

    for(int i=0,_i=n-k;i<_i;++i)

        ans+=a[i];

    io<<ans;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



const int MAX = (int)2e5 + 7;

int monsters[MAX];

int main() {

	int n, k;

	cin >> n >> k;

	

	for(int i = 0; i < n; i++)

		cin >> monsters[i];

	

	sort(monsters, monsters + n);

	

	int attacksNo = n - k;

	long long ans = 0;

	for(int i = 0; i < attacksNo; i++)

		ans += (long long)monsters[i];

		

	cout << ans;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>



#define ll long long



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;





ll a[200005];



int main()

{

    ll n,k;

    io>>n>>k;

    for(int i=0;i<n;++i)io>>a[i];

    std::sort(a,a+n);

    ll ans=0;

    for(int i=0,_i=n-k;i<_i;++i)

        ans+=a[i];

    io<<ans;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>



using namespace std;



#define ll long long



int main()

{

    ll n, k;

    cin >> n >> k;



    if(k >= n)

    {

        cout << 0 << endl;

        return 0;

    }



    vector<ll> health(n);



    for(ll &h : health) cin >> h;



    sort(health.begin(), health.end());



    ll res = 0;

    for(int i = 0 ; i < health.size()-k; ++i)

    {

        res += health[i];

    }



    cout << res << endl;



    return 0;

}




// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>



#define ll long long



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;





ll a[200005];



int main()

{

    ll n,k;

    io>>n>>k;

    for(int i=0;i<n;++i)io>>a[i];

    std::sort(a,a+n);

    ll ans=0;

    for(int i=0,_i=n-k;i<_i;++i)

        ans+=a[i];

    io<<ans;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define rush() int T;scanf("%d",&T);int kase=1;while(T--)

#define all(x) (x).begin(),(x).End()

#define max(x,y) ((x)>(y)?(x):(y))

#define min(x,y) ((x)<(y)?(x):(y))

#define pb(x) push_back(x)

#define mem(a) memset(a,0,sizeof(a))

using namespace std;

using std::bitset;

typedef long long ll;

const ll maxn=1e6+5;

const ll mod=998244353;

const ll INF=0x3f3f3f3f3f3f3f3f;

const long double PI=acos(-1.0);

const long double eps=1e-5;

inline ll read(){ll ans=0,flag=1;char c;c=getchar();while(c<'0' || c>'9'){if(c=='-')flag=-1;c=getchar();}while(c>='0' && c<='9'){ans=ans*10+(ll)(c-'0');c=getchar();}return ans*flag;}

ll quickpow(ll x,ll y,ll mod){ll ans=1;while(y){if(y&1)ans=ans*x%mod;x=x*x%mod;y>>=1;}return ans;}



vector<int>a;



bool cmp(int a,int b)

{

    return a>b;

}



int main()

{

    int n,k;

    cin>>n>>k;

    for(int i=0;i<n;i++)

    {

        int x;

        cin>>x;

        a.push_back(x);

    }

    sort(a.begin(),a.end(),cmp);

    ll sum=0;

    if(k>=n)

        cout<<"0";

    else

    {

        for(int i=k;i<n;i++)

        {

            sum+=a[i];

        }

        cout<<sum;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>



#define ll long long



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;





ll a[200005];



int main()

{

    ll n,k;

    io>>n>>k;

    for(int i=0;i<n;++i)io>>a[i];

    std::sort(a,a+n);

    ll ans=0;

    for(int i=0,_i=n-k;i<_i;++i)

        ans+=a[i];

    io<<ans;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<vector>

#define lli long long int

#include<climits>

#include<unordered_map>

#include<algorithm>

#include<bitset>

#include<map>

#include<cmath>

#include<queue>

#define pb push_back

#define N (int)(1e5)

using namespace std;

using namespace std;

int main()

{

    int n,k;

    cin>>n>>k;

    lli ans=0;

    vector<lli>arr(n);

    for(int i=0;i<n;i++) cin>>arr[i];

    sort(arr.begin(),arr.end(),greater<int>());

    for(int i=k;i<n;i++)

    {

        ans = ans+arr[i];

    }

    cout<<ans<<endl;

    

    

    



}




// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>



#define ll long long



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;





ll a[200005];



int main()

{

    ll n,k;

    io>>n>>k;

    for(int i=0;i<n;++i)io>>a[i];

    std::sort(a,a+n);

    ll ans=0;

    for(int i=0,_i=n-k;i<_i;++i)

        ans+=a[i];

    io<<ans;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<vector>

#include<algorithm>

using namespace std;

vector<long long> a;

int main(){

	int n,k;

	cin>>n>>k;

	long long count=0;

	for(int i=0;i<n;i++){

		long long h;

		cin>>h;

		a.push_back(h);

	}

	if(k>=n){

		cout<<0;

		return 0;

	}

	sort(a.begin(),a.end());

	for(int i=n-k-1;i>=0;i--){

		count+=a[i];

	}

	cout<<count;



} 

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>



const int MAXN = 2e5 + 5;



int n, k;

long long int ans;

int arr[MAXN];



int main() {

    scanf("%d%d", &n, &k);

    for (int i = 1; i <= n; ++i) {

        scanf("%d", &arr[i]);

    }

    k = n - k;

    std::sort(arr + 1, arr + n + 1);

    for (int i = 1; i <= k; ++i) {

        ans += arr[i];

    }

    printf("%lld", ans);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <map>

#include <set>

#include <math.h>

#include <bits/stdc++.h>

using namespace std;



int main()

{

    long long n,k,sum=0;

    cin>>n>>k;

    int arr[n];

    for (int i=0;i<n;i++)

    {



        cin>>arr[i];

    }

    sort (arr,arr+n);

    for (int i=0;i<n-k;i++)

    {

        sum+=arr[i];

    }

    cout<<sum;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<utility>

#include<iomanip>

#include<cmath>

#include<algorithm>

#include<cfloat>

#include<functional>

#include<string>

#include<numeric>

#include<vector>

#include<stack>

#include<queue>

#include<set>

#include<map>

#include<cctype>

#include<iterator>

#include <stdio.h>

#include <string.h>

//#include<conio.h>

#define MEGA_MIND ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);

using namespace std;

using ll = long long;

using ld = long double;





int main()

{

	MEGA_MIND

			ll n, k,arr[200005],sum=0;

		cin >> n >> k;

		for (int i = 0; i < n; i++)

		{

			cin >> arr[i];

		}

		sort(arr, arr + n);

		for (int i = n-1; i >= 0; i--)

		{

			if (k>0)

			{

				k--;

			}

			else

			{

				sum += arr[i];

			}

		}

		cout << sum << endl;

	

	return  0;

}




// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>



int arr[200'001];



int main()

{

	int N, K;

	long long ans = 0;

	std::cin >> N >> K;

	for (int i = 0; i < N; ++i)

		std::cin >> arr[i];

	std::sort(arr, arr + N);

	for (int i = 0; i < N - K; ++i)

		ans += arr[i];

	std::cout << ans << std::endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>



using namespace std;



void Fastio(){

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}



int main()

{

    Fastio();

    int n,k; cin>>n>>k;

    long long arr[n];

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

    sort(arr,arr+n);

    long long res=0;

    for(int i=0; i<n-k; i++){res+=arr[i];}

    cout<<res<<'\n';



    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>

using namespace std;



int main()

{

    int n;

    while(cin >> n)

    {

    int k;

    cin >> k;

    int arr[n];

    for(int i=0;i<n;i++)

    {

        cin >> arr[i];

    }

    sort(arr , arr+n);

    int x=n-k;

    int cnt=0;

    if(x==k)

    {

        cout << 0<<endl;

        cnt++;

    }

    long long int sum=0;

    for(int i=0;i<x;i++)

    {

        sum+=arr[i];

    }

    if(cnt==0)

    {

    cout << sum<<endl;

    }

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <cmath>

using namespace std;



int main()

{

    int arr[200005];

    int n,k;

    cin>>n>>k;

    for(int i=0;i<n;i++)

    {

        cin>>arr[i];

    }

    sort(arr,arr+n);

    n-=k;

    long long sum=0;

    for(int i=0;i<n;i++)

    {

        sum+=arr[i];

    }

    cout<<sum;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<queue>

#include <iostream>

#include <algorithm>

#include<cmath>

#include<map>

typedef unsigned long long ll;

using namespace std;

int main()

{

  ll n,k,h,sum=0;

  cin>>n>>k;

  ll arr[n];

  for(int i=0;i<n;i++)

  {

      cin>>h;

      arr[i]=h;

  }

  if(k>n)

  {

      cout<<0;

      return 0;

  }

  sort(arr,arr+n);

  for(int i=0;i<n-k;i++)

  {

      sum+=arr[i];

  }

  cout<<sum;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>

using namespace std;



int main()

{

int n,k;

cin>>n>>k;

int  a[n+1];

for(int i=1;i<n+1;i++)

        cin>>a[i];

sort(a+1,a+n+1,greater<int>());

long long sum=0;



for(int i=k+1;i<n+1;i++)

{



    sum+=a[i];

}

cout<<sum;

 }










// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>

using namespace std;



int main()

{long long n,k,counter=0;

cin >> n >> k;

long long arr[n];

for (int i=0; i<n; i++)

{

    cin >> arr[i];

}

sort (arr,arr+n);

if (k>=n)

{

    cout << "0";

}

else

{

    for (int i=0; i<(n-k); i++)

    {

        counter=counter+arr[i];

    }

    cout << counter;

}

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include<iomanip>

#include <algorithm>

#include <map>

#include <vector>

#include<queue>

#include<math.h>

#include<cmath>

#include<sstream>

#include<set>

#include <map>

#include<string.h>

#include<sstream>

#include<stack>

const double pi = 3.14159265359;

using namespace std;



int main()

{

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

	long long n, k,arr[200005],sp=0,ans=0;

	cin >> n >> k;

	for (int i = 0; i < n; ++i) {

		cin >> arr[i];

	}

	sort(arr, arr + n);

	sp = n - k;

	for (int i = 0; i < sp; ++i) {

		ans += arr[i];

	}

	cout << ans;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

long long n,k,ans,h[200005];

int main(){

	scanf("%lld%lld",&n,&k);

	for(int i=0;i<n;++i)scanf("%lld",&h[i]);

	std::sort(h,h+n);

	for(int i=0,j=n-k;i<j;++i)ans+=h[i];

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem: