criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define PI 3.14159265358979323846264338327950L
  /* 配列の要素を交換する */
void Swap(int x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}
void Qdsort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */

    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

    while (1) {                    /* 無限ループ */

        while (x[i] > pivot)       /* pivot より小さい値が */
            i++;                   /* 出るまで i を増加させる */

        while (pivot > x[j])       /* pivot より大きい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */

        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }
    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}
int main(){
    int n,k,i;
    scanf("%d%d",&n,&k);
    long int h[n],sum=0;
    rep(i,n){
        scanf("%ld",&h[i]);
        sum+=h[i];
    }
    if(n<=k){
        printf("0");
    }else{
        Qdsort(h,0,n-1);
        rep(i,k) sum=sum-h[i];
        printf("%ld",sum);
    }
    return 0;
}

Compiler output:
main.c: In function 'Qdsort':
main.c:40:9: error: implicit declaration of function 'QSort'; did you mean 'qsort'? [-Wimplicit-function-declaration]
   40 |         QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
      |         ^~~~~
      |         qsort
main.c: In function 'main':
main.c:55:16: error: passing argument 1 of 'Qdsort' from incompatible pointer type [-Wincompatible-pointer-types]
   55 |         Qdsort(h,0,n-1);
      |                ^
      |                |
      |                long int *
main.c:15:17: note: expected 'int *' but argument is of type 'long int *'
   15 | void Qdsort(int x[ ], int left, int right)
      |             ~~~~^~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define PI 3.14159265358979323846264338327950L
void dsort(long int a[], int n)
{
    int i,j;

    for(i=0;i<n-1;i++){
        for(j=n-1;j>i;j--){
            if(a[j-1]<a[j]){
 			  int tmp=a[i];
              a[i]=a[j];
              a[j]=tmp;
            }
        }
    }
}
int main(){
    int n,k,i;
    scanf("%d%d",&n,&k);
    long int h[200010]={0},sum=0;
    rep(i,n){
        scanf("%ld",&h[i]);
        sum+=h[i];
    }
    if(n<=k){
        printf("0");
    }else{
        dsort(h,n);
        rep(i,k) sum=sum-h[i];
        printf("%ld",sum);
        return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:1: error: expected declaration or statement at end of input
   35 | }
      | ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define PI 3.14159265358979323846264338327950L
void dsort(int a[], int n)
{
    int i,j;

    for(i=0;i<n-1;i++){
        for(j=n-1;j>i;j--){
            if(a[j-1]<a[j]){
 			  int tmp=a[i];
              a[i]=a[j];
              a[j]=tmp;
            }
        }
    }
}
int main(){
    int n,k,i;
    scanf("%d%d",&n,&k);
    long int h[200010]={0},sum=0;
    rep(i,n){
        scanf("%ld",&h[i]);
        sum+=h[i];
    }
    if(n<=k){
        printf("0");
    }else{
        dsort(h,n);
        rep(i,k) sum=sum-h[i];
        printf("%ld",sum);
        return 0;
}

Compiler output:
main.c: In function 'main':
main.c:31:15: error: passing argument 1 of 'dsort' from incompatible pointer type [-Wincompatible-pointer-types]
   31 |         dsort(h,n);
      |               ^
      |               |
      |               long int *
main.c:6:16: note: expected 'int *' but argument is of type 'long int *'
    6 | void dsort(int a[], int n)
      |            ~~~~^~~
main.c:35:1: error: expected declaration or statement at end of input
   35 | }
      | ^
Language: Java

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] mns = new int[n];
		int k = sc.nextInt();
		Long ans = 0;

		for(int i=0;i<n;i++){
			mns[i] = sc.nextInt();
		}

		Arrays.sort(mns);

		for(int j=0;j<k;j++){
			mns[n - j - 1] = 0;
		}

		for(int m=0;m<n;m++){
			ans += mns[m];
		}

		System.out.println(ans);

		}
	}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:8: error: incompatible types: int cannot be converted to Long
		Long ans = 0;
		           ^
Main.java:14: error: cannot find symbol
		Arrays.sort(mns);
		^
  symbol:   variable Arrays
  location: class Main
4 errors
Language: C++

#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9+7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
unsigned day;
if(dow < dow1) dow += 7;
day = dow - dow1;
day += 7 * n - 6;
return day;
}
unsigned DayToWeekNumber(unsigned day)
{
  return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
  return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main(){
  int N,K; cin>>N>>K;
  int A[N];
  rep(i,N)cin>>A[i];
  sort(A.begin(),A.end());
  int ans=0;
  rep(i,N-K)ans+=A[i];
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:10: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   62 |   sort(A.begin(),A.end());
      |          ^~~~~
a.cc:62:20: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   62 |   sort(A.begin(),A.end());
      |                    ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long 
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> vec(n);
  sort(vec.begin(), vec.end());
  for(int i=0;i<k;++i){
    vec.pop_back();
  }
  int ans=0;
  for(int x:vec){
    ans+=x;
  }
  cout<<x<<endl;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:16:9: error: 'x' was not declared in this scope
   16 |   cout<<x<<endl;
      |         ^
Language: C++

#define ll long long
using namespace std;

ll h[200000];


int main()
{
	int n, k;
	cin >> n >> k;
	for(int i=0; i<n; i++){
        cin >> h[i];
	}
	ll s = 0;
	for(int i=0; i<n-k; i++){
        s+=h[i];
	}
	 cout << s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'cin' was not declared in this scope
   10 |         cin >> n >> k;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define ll long long
a.cc:18:10: error: 'cout' was not declared in this scope
   18 |          cout << s;
      |          ^~~~
a.cc:18:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#define <bits/stdc++.h>
using namespace std;



int main()
{
	
	long long n, k;
	vector<long long>m;
	cin >> n >> k;

	for (long long i = 0; i < n; i++)
	{
		long long x;
		cin >> x;
		m.push_back(x);
	}

	sort(m.rbegin(), m.rend());

	long long sum = 0;

	for (long long i = k; i < n; i++)
	{
		sum += m[i];
	}

	cout << sum;
}


Compiler output:
a.cc:1:9: error: macro names must be identifiers
    1 | #define <bits/stdc++.h>
      |         ^
a.cc: In function 'int main()':
a.cc:10:9: error: 'vector' was not declared in this scope
   10 |         vector<long long>m;
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #define <bits/stdc++.h>
a.cc:10:16: error: expected primary-expression before 'long'
   10 |         vector<long long>m;
      |                ^~~~
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> n >> k;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define <bits/stdc++.h>
a.cc:17:17: error: 'm' was not declared in this scope
   17 |                 m.push_back(x);
      |                 ^
a.cc:20:14: error: 'm' was not declared in this scope
   20 |         sort(m.rbegin(), m.rend());
      |              ^
a.cc:20:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   20 |         sort(m.rbegin(), m.rend());
      |         ^~~~
      |         short
a.cc:29:9: error: 'cout' was not declared in this scope
   29 |         cout << sum;
      |         ^~~~
a.cc:29:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#define <bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);


int main()
{
	FIO;
	long long n, k;
	vector<long long>m;
	cin >> n >> k;

	for (long long i = 0; i < n; i++)
	{
		long long x;
		cin >> x;
		m.push_back(x);
	}

	sort(m.rbegin(), m.rend());

	long long sum = 0;

	for (long long i = k; i < n; i++)
	{
		sum += m[i];
	}

	cout << sum;
}

Compiler output:
a.cc:1:9: error: macro names must be identifiers
    1 | #define <bits/stdc++.h>
      |         ^
a.cc: In function 'int main()':
a.cc:3:13: error: 'ios_base' has not been declared
    3 | #define FIO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
      |             ^~~~~~~~
a.cc:8:9: note: in expansion of macro 'FIO'
    8 |         FIO;
      |         ^~~
a.cc:3:42: error: 'cin' was not declared in this scope
    3 | #define FIO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
      |                                          ^~~
a.cc:8:9: note: in expansion of macro 'FIO'
    8 |         FIO;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define <bits/stdc++.h>
a.cc:3:54: error: 'cout' was not declared in this scope
    3 | #define FIO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
      |                                                      ^~~~
a.cc:8:9: note: in expansion of macro 'FIO'
    8 |         FIO;
      |         ^~~
a.cc:3:54: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #define FIO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
      |                                                      ^~~~
a.cc:8:9: note: in expansion of macro 'FIO'
    8 |         FIO;
      |         ^~~
a.cc:10:9: error: 'vector' was not declared in this scope
   10 |         vector<long long>m;
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #define <bits/stdc++.h>
a.cc:10:16: error: expected primary-expression before 'long'
   10 |         vector<long long>m;
      |                ^~~~
a.cc:17:17: error: 'm' was not declared in this scope
   17 |                 m.push_back(x);
      |                 ^
a.cc:20:14: error: 'm' was not declared in this scope
   20 |         sort(m.rbegin(), m.rend());
      |              ^
a.cc:20:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   20 |         sort(m.rbegin(), m.rend());
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y){ 
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2);
        if(y%2==0)
         return (p*p)%hell;
        else
        return (x*((p*p)%hell))%hell;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    if(k>=n)
    cout<<n;
    else
    {
        for(int i=0;i<n-k;i++)
        s=s+a[i];
        cout<<s;
    }}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 's' was not declared in this scope
   41 |         s=s+a[i];
      |         ^
a.cc:42:15: error: 's' was not declared in this scope
   42 |         cout<<s;
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<long long> H(N);
    for (int i=0; i<N; i++) cin >> H.at(i);
    sort(H.begin(), H.end());
    reverse(H.begin(), H.end()); //降順ソートする
    // この最初からK個 H.at(0) ~ H.at(K-1)は必殺技で一撃で倒す
    // すなわち、H.at(K) ~ H.at(N-1) の合計が必要な攻撃回数
    long long ans = 0;
    for (int k=K; k < N; k++){
        ans += H.at(k);
    }
    cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: expected '}' at end of input
   17 |     cout << ans << endl;
      |                         ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

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

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

    while(k>0){
        if(h.empty()) break;
        h.pop_back();
        k--;
    }
    long long int ans = 0;

    for(int i=0; i<h.size(); i++){
        ans += h[i];
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |     sort(h.begin(), h.end());
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i >= 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n,k; cin >> n >> k;
	vint h(n);
	rep(i,n) cin >> h[i];
	sort(be(h));
	reverse(be(h));
	rep(i,k,n) ans+=h[i];
	cout << ans << endl;
}

Compiler output:
a.cc:20:18: error: macro "rep" passed 3 arguments, but takes just 2
   20 |         rep(i,k,n) ans+=h[i];
      |                  ^
a.cc:6:9: note: macro "rep" defined here
    6 | #define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
      |         ^~~
a.cc: In function 'int main()':
a.cc:20:9: error: 'rep' was not declared in this scope
   20 |         rep(i,k,n) ans+=h[i];
      |         ^~~
a.cc:21:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: Java

import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int K = sc.nextInt();
      
      int h[] = new int[N];
      int th = 0;
      int maxh = 0;
      int ans = 0;
      for(int i=1; i<=N-1; i++){
          int  h =sc.nextInt();
          th = th+h[i];
          maxh = Math.max(maxh,h[i]);
          ans =th - maxh;
      }
      System.out.println(ans);
    }
}

Compiler output:
Main.java:14: error: variable h is already defined in method main(String[])
          int  h =sc.nextInt();
               ^
Main.java:15: error: array required, but int found
          th = th+h[i];
                   ^
Main.java:16: error: array required, but int found
          maxh = Math.max(maxh,h[i]);
                                ^
3 errors
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<cmath>
using namespace std;

#define ll long long int

int main(){
ll n,k,i=0;cin>>n>>k;ll a[n],s=0;
ll a[n];while(n--){cin>>a[i];i++;}
for(ll j=0;j<n;j++)
{
  if(k>0)k--;
  else
    {s=s+a[j];}
}
cout<<s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:4: error: redeclaration of 'long long int a [n]'
   10 | ll a[n];while(n--){cin>>a[i];i++;}
      |    ^
a.cc:9:25: note: 'long long int a [n]' previously declared here
    9 | ll n,k,i=0;cin>>n>>k;ll a[n],s=0;
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n,k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i,n) cin >> h.at(i);
    sort(h.begin(),h.end());
    reverse(h.begim(),h.end());
    int ans=0;
    for(int i=k;i<n;i++){
        ans+=h.at(i);
    }
    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'class std::vector<long long int>' has no member named 'begim'; did you mean 'begin'?
   14 |     reverse(h.begim(),h.end());
      |               ^~~~~
      |               begin
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,k;
  cin >> n >> k;
  vector<int>HP(n);
  for(int i=0;i<n;i++){
    cin >> HP.at(i);
  }
  sort(HP.begin(),HP.end());
  HP.erase(0);
  long long sum=0;
  for(int i=0;i<HP.size();i++){
    sum+=HP.at(i);
  }
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: no matching function for call to 'std::vector<int>::erase(int)'
   12 |   HP.erase(0);
      |   ~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N , K ;
  long long ans=0;
  cin >> N >> K ;
  vector<long long> A(300000);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  for(int i=K;i<N;i++){
    ans += A[i};
             }
             
   cout << ans << endl;
             }
             


Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: expected ']' before '}' token
   14 |     ans += A[i};
      |               ^
      |               ]
a.cc:14:15: error: expected ';' before '}' token
   14 |     ans += A[i};
      |               ^
      |               ;
a.cc: At global scope:
a.cc:17:4: error: 'cout' does not name a type
   17 |    cout << ans << endl;
      |    ^~~~
a.cc:18:14: error: expected declaration before '}' token
   18 |              }
      |              ^
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
 

int main() {
    map<int,int> m;
    int n,k;
    cin >> n>>k;
    ll sum=0;
    vector<int> h(n);
    rep(i,k){
        cin >> h[i];
    }
    sort.(ALL(h));
    if(n<=k) {
        cout << 0 << endl;
        return 0;
    }
    rep(i,n-k){
        sum += h[i];
    }
    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:10: error: expected unqualified-id before '(' token
   18 |     sort.(ALL(h));
      |          ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;

int main(){
  long long int n, k, a;

  cin >> n >> k;
  vector<int> H;
  long long int sum = 0;

  for (int i = 0; i < n; i++){
    cin >> a;
    H.push_back(a);
  }

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


  if (n <= k) cout << "0" << endl;
  else {
    for(int i = k; i < n; i++){
      sum += H[i];
    }
    cout << sum << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |   sort(H.begin(), H.end(), greater<int>());
      |   ^~~~
      |   short
Language: C++

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

int main()
{
   int  n,k;
   cin>>n>>k;
   ll ans =0;
  
  
   vector<ll>h(n);
  
  for(int i=0;i<n;i++)
  {
      cin>>h[i];
  }

   sort(h.begin(),h.end());
   
  if(n>k)
  {
     for(int i=0;i<n-k;i++)
     {
         ans += h[[i];
     }
  }
  

   cout<<ans<<endl;

    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: two consecutive '[' shall only introduce an attribute before '[' token
   25 |          ans += h[[i];
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N,K;
    cin>>N>>K;
    int count=0;
    vector<int>wtf(N);
    for(long long i=0; i<N; i++){
    cin>>wtf.at(i); 
    count++;
    }
    sort(wtf.begin().wtf.end());
   for(int i=0; i<K; i++){
    count-=wtf.at(i);
   }
   cout<<count<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: 'std::vector<int>::iterator' has no member named 'wtf'
   12 |     sort(wtf.begin().wtf.end());
      |                      ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define ll long long;

int main() {
  int N, K;
  cin >> N >> K;
  
  ll H[N];
  
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  
  sort(H, H+N);
  
  ll ans = 0;
  
  if (K >= N) {
    cout << 0 << endl;
  } else {
    for (int i = 0; i < N-K; i++) {
      ans += H[i];
    }
  cout << ans << endl;
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:17: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long;
      |                 ^~~~
a.cc:10:3: note: in expansion of macro 'll'
   10 |   ll H[N];
      |   ^~
a.cc:10:6: error: 'H' was not declared in this scope
   10 |   ll H[N];
      |      ^
a.cc:4:17: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long;
      |                 ^~~~
a.cc:18:3: note: in expansion of macro 'll'
   18 |   ll ans = 0;
      |   ^~
a.cc:18:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |   ll ans = 0;
      |      ^~~
      |      abs
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define ll long long;

int main() {
  int N, K;
  cin >> N >> K;
  
  ll H[N];
  
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  
  sort(H, H+N);
  
  ll ans = 0;
  
  for (int i = 0; i < N-K; i++) {
    ans += H[i];
  }
  
  cout << ans << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:17: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long;
      |                 ^~~~
a.cc:10:3: note: in expansion of macro 'll'
   10 |   ll H[N];
      |   ^~
a.cc:10:6: error: 'H' was not declared in this scope
   10 |   ll H[N];
      |      ^
a.cc:4:17: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long;
      |                 ^~~~
a.cc:18:3: note: in expansion of macro 'll'
   18 |   ll ans = 0;
      |   ^~
a.cc:18:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |   ll ans = 0;
      |      ^~~
      |      abs
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define ll long long;

int main() {
  int N, K;
  cin >> N >> K;
  
  ll H[N];
  
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  
  sort(H, H+N);
  
  ll ans = 0;
  
  for (int i = 0; i < N-2; i++) {
    ans += H[i];
  }
  
  cout << ans << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:17: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long;
      |                 ^~~~
a.cc:10:3: note: in expansion of macro 'll'
   10 |   ll H[N];
      |   ^~
a.cc:10:6: error: 'H' was not declared in this scope
   10 |   ll H[N];
      |      ^
a.cc:4:17: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long;
      |                 ^~~~
a.cc:18:3: note: in expansion of macro 'll'
   18 |   ll ans = 0;
      |   ^~
a.cc:18:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |   ll ans = 0;
      |      ^~~
      |      abs
Language: C

#include <stdio.h>

int main(void)
{
        int n,k,i,j,max,index,s=0;

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

        int h[n];

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

        for(i=0;i<n;i++){
                max=h[i];index=i;
                for(j=i;j<n;j++){
                        if(h[i]>max){
                                max=h[i];
                                index=j;
                        }
                }
                h[index]=h[i];
                h[i]=max;
        }

        for(i=0;i<k;i++)
                h[i]=0;

        for(i=0;i<n;i++)
                s=s+h[i];

        printf("%d",s);
        return 0;
}
~


Compiler output:
main.c:35:1: error: expected identifier or '(' before '~' token
   35 | ~
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,K;
    cin>>N>>K;
    long long a=0;
    long long c[N]={0};
    for(int i=0; i<N; i++;){
    cin>>c[i];}
    sort(c,c+N);
    reverse(c,c+N);
    for(int j=K; j<N; j++;){
    a+=c[j];}
    a+=K;
    cout<<a<<endl;
    }

    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:8:26: error: expected ')' before ';' token
    8 |     for(int i=0; i<N; i++;){
      |        ~                 ^
      |                          )
a.cc:8:27: error: expected primary-expression before ')' token
    8 |     for(int i=0; i<N; i++;){
      |                           ^
a.cc:12:26: error: expected ')' before ';' token
   12 |     for(int j=K; j<N; j++;){
      |        ~                 ^
      |                          )
a.cc:12:27: error: expected primary-expression before ')' token
   12 |     for(int j=K; j<N; j++;){
      |                           ^
Language: Java

import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long[] H = new long[N];
		long ans = 0;
		for(int i = 0;i < N;i++){
			H[i] = sc.nextLong();
		}
		H.sort();
		for(int i = 0;i < K;i++){
			H[N - 1 - i] = 0;
		}
		for(int i = 0;i < N;i++){
			ans += H[i];
		}
		System.out.println(ans);
	}
}

Compiler output:
Main.java:12: error: cannot find symbol
		H.sort();
		 ^
  symbol:   method sort()
  location: variable H of type long[]
1 error
Language: Java

import java.util.Arrays;

public class Main {
	
	public static void main(String[] args) {
		
		java.util.Scanner scan = new java.util.Scanner(System.in);

		long N = scan.nextInt();
		long K = scan.nextInt();
		long[] H = new long[N];
		long sum = 0;
		
		if(K >= N ) {
			System.out.println(N);
		}
		
		for (int i = 0; i < N; i++) {
			H[i] = scan.nextLong();
		}
		
		Arrays.sort(H);
		
		for(int i =N-1; K>0  ; i--) {
			H[i] = 0;
			K--;
		}
	
		for(long h : H) {
			sum += h;
		}
			System.out.println(K + sum);
	
	}
}


Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
		long[] H = new long[N];
		                    ^
Main.java:24: error: incompatible types: possible lossy conversion from long to int
		for(int i =N-1; K>0  ; i--) {
		            ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  int i:
  for(i=0;i<n;i++){
    cin >> h.at(i);
  }
  sort(h.begin(),h.end());
  reverse(h.begin(),h.end());
  for(i=0;i<k;i++){
    h.at(i)=0;
  }
  int sum=0;
  for(i-0;i<n;i++){
    sum+=h.at(i);
  }
  cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: expected initializer before ':' token
    7 |   int i:
      |        ^
a.cc:8:11: error: 'i' was not declared in this scope
    8 |   for(i=0;i<n;i++){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,h[n];
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  sort(h,h+n);
  c=h[n-2]+h[n-1];
  if(k!=0){
    cout<<c-(n+k);
  }
  else{
    for(int i=0;i<n;i++){
      int a+=h[i];
    }
    cout<<a;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'c' was not declared in this scope
   10 |   c=h[n-2]+h[n-1];
      |   ^
a.cc:16:12: error: expected initializer before '+=' token
   16 |       int a+=h[i];
      |            ^~
a.cc:18:11: error: 'a' was not declared in this scope
   18 |     cout<<a;
      |           ^
Language: C++

#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x)   cerr<<#x<<": "<<x<<endl;
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
typedef long long int ll;
using namespace std;


const ll mod = 1e9+7;
const double eps = 1e-9;


vector<int>cost,value;
int h , n;
int dp[10001][1002]; 

int recur(int ind,int w) {
    if(ind==0&&w>0)return 1e9;
    else if(ind>=0&&w<=0)return 0;

    if(dp[w][ind]!=-1)return dp[w][ind];

    int first=recur(ind,w-cost[ind-1])+value[ind-1];
    int second=recur(ind-1,w);
    return dp[w][ind]=min(first,second);
}

void show(int a,int b){
    for(int i=0;i<=a;i++) {
        for(int j=0;j<=b;++j) {
            cout<<dp[i][j]<<"  ";
        }
        cout<<endl;
    }
}

void solve(){
    cin>>h>>n;
    cost.resize(n+1);
    value.resize(n+1);
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++) {
        cin>>cost[i]>>value[i];
    }
    cout<<recur(n,h)<<endl;
}


void sec() {
    int n,k;
    cin>>n>>k;
    vector<llll>arr(n);
    ll total=0;
    for(int i=0;i<n;i++){ 
        cin>>arr[i]; 
        total+=arr[i];
    }
    int ind=n-1;
    while(k--) {
        total-=arr[ind--];
    }
    cout<<total;
}



int main(){
    fastio
    int test=1;
    while(test--)
        sec();
    return 0;
}


Compiler output:
a.cc: In function 'void sec()':
a.cc:55:12: error: 'llll' was not declared in this scope
   55 |     vector<llll>arr(n);
      |            ^~~~
a.cc:55:16: error: template argument 1 is invalid
   55 |     vector<llll>arr(n);
      |                ^
a.cc:55:16: error: template argument 2 is invalid
a.cc:58:17: error: invalid types 'int[int]' for array subscript
   58 |         cin>>arr[i];
      |                 ^
a.cc:59:19: error: invalid types 'int[int]' for array subscript
   59 |         total+=arr[i];
      |                   ^
a.cc:63:19: error: invalid types 'int[int]' for array subscript
   63 |         total-=arr[ind--];
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long N,K;
  cin >> N >> K;

  vector<long long> H(N);
  sort(H.begin(), H.end()); 
  reverse(H.begin(), H.end());
  for (int i = 0; i < N; i++) {
    cin >>H[i];
  }
  for (int i = 0; i < K; i++) {
    H[i] = 0;
  }
  long long a = 0;
  for (inr i = 0; i < N; i++) {
    a+=H[i];
  }
  cout << a <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:8: error: 'inr' was not declared in this scope; did you mean 'int'?
   18 |   for (inr i = 0; i < N; i++) {
      |        ^~~
      |        int
a.cc:18:19: error: 'i' was not declared in this scope
   18 |   for (inr i = 0; i < N; i++) {
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long int n;
  cin>>n;
  long long int k;
  cin>>k;
  long long int h[200004];
  for(long long int j=0;j<n;j++){
    cin>>h[j];
  }
  sort(h,h+n);
  if(k>=n){
    cout<<0;
  }else{
    long long int sum=0;
    for(long long int j=0;j<n-k;j++){
      sum+=h[j];
    }
    cout<<sum[j];
  }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:15: error: 'j' was not declared in this scope
   23 |     cout<<sum[j];
      |               ^
Language: C++



#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);

    int n,k;
    cin>>n>>K;
    vi h(n);
    rep(i,n){
        cin>>h[i];
    }
    sort(all(h));

    int ans=0;
    rep(i,n-k){
        ans+=h[i];
    }

    cout<<ans<<endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:13: error: 'K' was not declared in this scope
   37 |     cin>>n>>K;
      |             ^
Language: C

#include<stdio.h>
#include<stdlib.h>
int main()
{
long int a,b,c,i,j,tmp;

scanf("%ld %ld",&a,&b);
  int d[a];
for(int i=0;i<a;++i);
  {
  scanf("%d",&d[i]);
  }
if(b<a){ /* 数値を昇順にソート */
      qsort(d,a,sizeof(d[0]),ascSort);
  for (i=0; i<a-b; ++i)
  {c=c+d[i];}
  printf("ld",c);
  
        }
else printf("0");
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:14:30: error: 'ascSort' undeclared (first use in this function); did you mean 'qsort'?
   14 |       qsort(d,a,sizeof(d[0]),ascSort);
      |                              ^~~~~~~
      |                              qsort
main.c:14:30: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

n, k = map(int, input().split())
h = sorted(list(map(int, input().split())))
c = 0
for i in range(n-k):
  c += h[i]
print(c)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, k = map(int, input().split())
      | ^
Language: C++

import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,k=map(int,input().split())
    H=[int(_) for _ in input().split()]
    H.sort(reverse=True)
    print(sum(H[k:]))

if __name__=='__main__':
    main()

Compiler output:
a.cc:9:14: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
    9 | if __name__=='__main__':
      |              ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<algoritum>
using namespace std;
int main(){
  long N,K;
  cin>>N>>K;
  long H[200010];
  for (int i=0;i<N;i++) cin>>H[i];
  sort(H,H+N);
  long sum=0;
  for (int i=0; i<N-K; i++) sum+=H[i];
  printf("%ld\n");
}

Compiler output:
a.cc:2:9: fatal error: algoritum: No such file or directory
    2 | #include<algoritum>
      |         ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N,K;
  cin >> N >> K;
  ll H[N];
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  sort(A,A+N);
  reverse(A,A+N);
  for (int i = 0; i < K; i++) {
    A[i] = 1;
  }
  ll ans = 0;
  for (int i = 0; i< N; i++) {
    ans += A[i];
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: 'A' was not declared in this scope
   11 |   sort(A,A+N);
      |        ^
Language: C

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

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int array[], int l, int r) {
    int pivot = array[r];
    int i = (l - 1);
    
    for (int j = l; j <= r - 1; j++) {
        if (array[j] <= pivot) {
            i++;
            swap(&array[i], &array[j]);
        }
    }
    swap(&array[i + 1], &array[r]);
    return (i + 1);
}

void quickSort(int array[], int l, int r) {
    if (l < r) {
        int pivot = partition(array, l, r);
        quickSort(array, l, pivot - 1);
        quickSort(array, pivot + 1, r);
    }
}

int main(){
    int N,K,H[200000],tmp;
    scanf("%d%d",&N,&K);
    for (int i=0; i<N; i++) {
        scanf("%d",&H[i]);
        SUM+=H[i];
    }
    if (N<K) {
        printf("0\n");
        return 0;
    }
    quickSort(H,0,N);
    long int SUM=0;
    for (int i=N-1; i<N-K; i--) {
        SUM-=H[i];
    }
    printf("%ld\n",SUM);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:39:9: error: 'SUM' undeclared (first use in this function)
   39 |         SUM+=H[i];
      |         ^~~
main.c:39:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int x,y;
  cin>>x>>y;
  vector<int>z(x);
  for(int i=0;i<x;i++){
  cin>>z.at(i);
  }
  sort(z.begin(),z.end())
  for(int j=0;j<y;j++){
  z.pop_back();
  }
  int sum=0;
  for(int k=0;k<z.size();k++){
  sum+=z.at(k);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: expected ';' before 'for'
   11 |   sort(z.begin(),z.end())
      |                          ^
      |                          ;
   12 |   for(int j=0;j<y;j++){
      |   ~~~                     
a.cc:12:15: error: 'j' was not declared in this scope
   12 |   for(int j=0;j<y;j++){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n, k;
  std::cin >> n >> k;
  std::vector<int> v;
  int64_t ans;
  
  for (int i = 0; i < n; i++) {
    std::cin >> v.at(i);
  }
  sort(v.begin(), v.end());

  for (int i = 0; i < k; i++) {
    v.pop_back();
  }
  for (int i = 0; i < n-k; i++) {
    ans += v.at(i)
  }
  std::cout << ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: expected ';' before '}' token
   19 |     ans += v.at(i)
      |                   ^
      |                   ;
   20 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  // モンスターの数, 必殺技の回数
  int N, K; cin >> N >> K;
  
  // N体のモンスターの体力
  vector<long long> HP(N);
  for (long long& x: HP) cin >> x;

  sort(HP.begin(), HP.end(), greater<long long>());
  
  // HPが高い敵をK体倒す
  for (auto itr = HP.begin(); (itr < (HP.begin()+min(K, N)); ++itr){
    *itr = 0;
  }
  
  // 何回攻撃すれば勝てるか
  long long cnt = 0;
  for (long long x: HP) cnt+=x;
  
  cout << cnt << endl;

}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:14:60: error: expected ')' before ';' token
   14 |   for (auto itr = HP.begin(); (itr < (HP.begin()+min(K, N)); ++itr){
      |                               ~                            ^
      |                                                            )
Language: Java

import  java.util.*;


import static java.util.Arrays.*;

public class d8 {
    public static void main(String[] args)
    {
        Scanner sc =new Scanner(System.in);
        int a,b;
        a=sc.nextInt();
        b=sc.nextInt();
        int ar[] = new int[a];
        int i, j = 0;
        for (i = 0; i < a; i++) {
            ar[i] = sc.nextInt();
        }
        if(b>=a){
            System.out.println(a);
        }
        else {

            sort(ar);

            long sum = 0;
            for (i = 0; i <a - b; i++) {
                sum = sum + ar[i];
	}
            
	System.out.println(sum);
        }
    }
}

Compiler output:
Main.java:6: error: class d8 is public, should be declared in a file named d8.java
public class d8 {
       ^
1 error
Language: C

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

#define SWAP(x, y) \
    do {typeof(x) SWAP = x; x = y; y = SWAP;} while (0)

int partition(int arr[], int low, int high)
{
    int pivot = arr[high];
    int index = low-1;

    for(int j=low; j<high; ++j)
    {
        if(arr[j] <= pivot)
        {
            ++index;
            SWAP(arr[index], arr[j]);
        }
    }

    SWAP(arr[index+1], arr[high]);

    return index+1;
}

void qsort(int arr[], int low, int high)
{
    if(low<high)
    {
        int pi = partition(arr, low, high);
        qsort(arr, low, pi-1);
        qsort(arr, pi+1, high);
    }
}

int main(n, k)
{
    scanf("%d%d", &n, &k);

    if(k>=n) printf("0\n");
    else 
    {
        int *h = malloc(sizeof(*h)*n);
        for(int i=0; i<n; ++i)
        { 
            scanf("%d", &h[i]);
        } 

        qsort(h, 0, n-1);

        unsigned long x=0;
        for(int i=0; i<n-k; ++i)
            x += h[i];

        printf("%lu\n", x);
        free(h);
    }

    return 0;
}

Compiler output:
main.c:26:6: error: conflicting types for 'qsort'; have 'void(int *, int,  int)'
   26 | void qsort(int arr[], int low, int high)
      |      ^~~~~
In file included from main.c:2:
/usr/include/stdlib.h:970:13: note: previous declaration of 'qsort' with type 'void(void *, size_t,  size_t,  int (*)(const void *, const void *))' {aka 'void(void *, long unsigned int,  long unsigned int,  int (*)(const void *, const void *))'}
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |             ^~~~~
main.c: In function 'main':
main.c:36:5: error: type of 'n' defaults to 'int' [-Wimplicit-int]
   36 | int main(n, k)
      |     ^~~~
main.c:36:5: error: type of 'k' defaults to 'int' [-Wimplicit-int]
Language: C++

#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
int main() {
  long long int x,y;
  long long int z = 0;
  cin >> x >> y;
  if (x <= y) {
    cout << 0;
    exit(0);
  }
  vector<int> vec(x);
  for (int i = 0;i < x; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  for (int i = 0;i < y; i++) {
  vec.at(x - 1 - i) = 0;
  }
  for (int i = 0;i < x; i++) 
    z += vec.at(i);
  }
  cout << z;
}

Compiler output:
a.cc:23:3: error: 'cout' does not name a type
   23 |   cout << z;
      |   ^~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main()	{
  int n,k;
  cin>>n>>k;
  vector<int>h(n);
  rep(i,n) cin>>h[i];
  sort(h.rbegin(),h.rend());
  if(n>k){
    for(int i=k;i<n;i++){
      ans+=h[i];
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |       ans+=h[i];
      |       ^~~
      |       abs
a.cc:19:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main()	{
  int n,k;
  cin>>n>>k;
  vector<int>h(n);
  rep(i,n) cin>>h[i];
  sort(h.rbegin(),h.rend());
  if(n>k){
    rep(int i=k;i<n;i++){
      ans+=h[i];
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc:15:24: error: macro "rep" requires 2 arguments, but only 1 given
   15 |     rep(int i=k;i<n;i++){
      |                        ^
a.cc:3:9: note: macro "rep" defined here
    3 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:15:5: error: 'rep' was not declared in this scope
   15 |     rep(int i=k;i<n;i++){
      |     ^~~
a.cc:19:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main()	{
  int n,k;
  cin>>n>>k;
  vector<int>h(n);
  rep(i,n) cin>>h[i];
  ll ans=0;
  sort(h.rbegin(),h.rend());
  rep(i,k){
    h[i]=0;
  }
  if(n>k){
  for(i=k;i<n;i++){
    while(h[i]>0){
      h[i]--;
      ans++;
    }
  }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   for(i=k;i<n;i++){
      |       ^
Language: C++

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

signed main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    sort(h.begin(),h.end());
    int sum = 0;
    rep(i,n-k) sum += h[i];
    if(k>=n) sum = 0;
    cout << sum << endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: stray '\' in program
    1 | \#include<bits/stdc++.h>
      | ^
a.cc:1:2: error: stray '#' in program
    1 | \#include<bits/stdc++.h>
      |  ^
a.cc:1:3: error: 'include' does not name a type
    1 | \#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> n >> k;
      |     ^~~
a.cc:10:5: error: 'vector' was not declared in this scope
   10 |     vector<int> h(n);
      |     ^~~~~~
a.cc:2:12: error: expected primary-expression before 'long'
    2 | #define ll long long
      |            ^~~~
a.cc:4:13: note: in expansion of macro 'll'
    4 | #define int ll
      |             ^~
a.cc:10:12: note: in expansion of macro 'int'
   10 |     vector<int> h(n);
      |            ^~~
a.cc:11:21: error: 'h' was not declared in this scope
   11 |     rep(i,n) cin >> h[i];
      |                     ^
a.cc:12:10: error: 'h' was not declared in this scope
   12 |     sort(h.begin(),h.end());
      |          ^
a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |     sort(h.begin(),h.end());
      |     ^~~~
      |     short
a.cc:16:5: error: 'cout' was not declared in this scope
   16 |     cout << sum << endl;
      |     ^~~~
a.cc:16:20: error: 'endl' was not declared in this scope
   16 |     cout << sum << endl;
      |                    ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  vector<int> en(2000010);
  for(int i = 0; i < N; i++){
   cin >> en[i]; 
  }
  int HP = 0;
  for(int i = K-1; i < N; i++){
    dmg += en[i];
  }
 cout << dmg << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'dmg' was not declared in this scope
   12 |     dmg += en[i];
      |     ^~~
a.cc:14:10: error: 'dmg' was not declared in this scope
   14 |  cout << dmg << endl;
      |          ^~~