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

import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Integer> hp = new ArrayList<>();
        long ans = 0;

        for(int i = 0;i < n;i++){
            hp.add(sc.nextInt());
        }
        Collections.sort(hp);
        for(int i = 0; i < n-k;i++){
            ans += list.get(i);
        }
        ans += k;
        System.out.println(ans);
    }
}

Compiler output:
Main.java:16: error: cannot find symbol
            ans += list.get(i);
                   ^
  symbol:   variable list
  location: class Main
1 error
Language: Java

import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> hp = new ArrayList<>();
        long ans = 0;

        for(int i = 0;i < n;i++){
            hp.add(sc.nextInt());
        }
        Collections.sort(hp);
        for(int i = 0; i < n-k;i++){
            ans += list.get(i);
        }
        ans += k;
        System.out.println(ans);
    }
}

Compiler output:
Main.java:14: error: cannot find symbol
        for(int i = 0; i < n-k;i++){
                             ^
  symbol:   variable k
  location: class Main
Main.java:15: error: cannot find symbol
            ans += list.get(i);
                   ^
  symbol:   variable list
  location: class Main
Main.java:17: error: cannot find symbol
        ans += k;
               ^
  symbol:   variable k
  location: class Main
3 errors
Language: Java

import java.util.*;
 
public class FennecMonster{
	public static void main(String arg[]){
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		long k=sc.nextLong();
		int a[]=new int[(int)n];
		long sum =0;
		for(int i=0;i<n;i++)
			a[i]=sc.nextInt();
		Arrays.sort(a);
		if(n < k)
			System.out.println("0");
		else{
			for(int i=0;i<n-k;i++)
				sum+=a[i];
			System.out.println(sum);
		}
	}
}

Compiler output:
Main.java:3: error: class FennecMonster is public, should be declared in a file named FennecMonster.java
public class FennecMonster{
       ^
1 error
Language: Java

import java.util.*;
 
public class FennecMonster{
	public static void main(String arg[]){
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		long k=sc.nextLong();
		int a[]=new int[n];
		long sum =0;
		for(int i=0;i<n;i++)
			a[i]=sc.nextInt();
		Arrays.sort(a);
		if(n < k)
			System.out.println("0");
		else{
			for(int i=0;i<n-k;i++)
				sum+=a[i];
			System.out.println(sum);
		}
	}
}

Compiler output:
Main.java:3: error: class FennecMonster is public, should be declared in a file named FennecMonster.java
public class FennecMonster{
       ^
Main.java:8: error: incompatible types: possible lossy conversion from long to int
		int a[]=new int[n];
		                ^
2 errors
Language: Java

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



Compiler output:
Main.java:11: error: cannot find symbol
      hp.add(tmp);
        ^
  symbol:   method add(int)
  location: variable hp of type int[]
1 error
Language: Java

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



Compiler output:
Main.java:6: error: incompatible types: possible lossy conversion from long to int
    int K = sc.nextLong();
                       ^
Main.java:10: error: incompatible types: possible lossy conversion from long to int
      int tmp = sc.nextLong();
                           ^
Main.java:11: error: cannot find symbol
      hp.add(tmp);
        ^
  symbol:   method add(int)
  location: variable hp of type int[]
Main.java:15: error: cannot find symbol
      sum += tmp;
             ^
  symbol:   variable tmp
  location: class Main
4 errors
Language: Java

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



Compiler output:
Main.java:14: error: not a statement
    for(int =0; i<N -K; i++){
        ^
Main.java:14: error: ';' expected
    for(int =0; i<N -K; i++){
           ^
Main.java:14: error: illegal start of expression
    for(int =0; i<N -K; i++){
            ^
Main.java:14: error: not a statement
    for(int =0; i<N -K; i++){
                 ^
Main.java:14: error: ')' expected
    for(int =0; i<N -K; i++){
                      ^
Main.java:14: error: ';' expected
    for(int =0; i<N -K; i++){
                           ^
6 errors
Language: Java

import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long K = sc.nextLong();
    ArrayList<Integer> hp = new ArrayList<>();
    long sum = 0;
    for(int i=0; i<N; i++){
      long tmp = sc.nextLong();
      hp.add(tmp);
      sum += tmp;
    }
    if(K>0){
      Collections.sort(hp);
      for(int i=0; i<K; i++){
        long tmpHp = hp[i] - K;
        if(tmpHp>0){
          sum -= K;
        }else{
          sum -= hp[i];
      }
    }
    System.out.println(sum);
  }
}
}


Compiler output:
Main.java:11: error: incompatible types: long cannot be converted to Integer
      hp.add(tmp);
             ^
Main.java:17: error: array required, but ArrayList<Integer> found
        long tmpHp = hp[i] - K;
                       ^
Main.java:21: error: array required, but ArrayList<Integer> found
          sum -= hp[i];
                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
3 errors
Language: Java

import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long K = sc.nextLong();
    ArrayList<Integer> hp = new ArrayList<>();
    long sum = 0;
    for(int i=0; i<N; i++){
      long tmp = sc.nextLong();
      hp.add(tmp);
      sum += tmp;
    }
    if(K>0){
      Collections.sort(hp);
      for(int i=0; i<K; i++){
        long tmpHp = hp[i] - K;
        if(tmpHp>0){
          sum -= K;
        }else{
          sum -= hp[i];
      }
    }
    System.out.println(sum);
  }
}

Compiler output:
Main.java:26: error: reached end of file while parsing
}
 ^
1 error
Language: C

n, k = map(int, input().split())
h = list(map(int, input().split()))

total = 0
h.sort(reverse = True)
for i in range(k,n):
    total += h[i]

print(total)


Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n, k = map(int, input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:4: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
    1 | n, k = map(int, input().split())
      |    ^
main.c:1:8: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | n, k = map(int, input().split())
      |        ^~~
main.c:1:12: error: expected expression before 'int'
    1 | n, k = map(int, input().split())
      |            ^~~
main.c:2:1: error: expected ',' or ';' before 'h'
    2 | h = list(map(int, input().split()))
      | ^
Language: C

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

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

int main(void)
{
  int n, k;
  scanf("%d %d", &n, &k);
  int i, h[n];
  i = 0;
  while (i < n)
  {
    scanf("%d", &h[i]);
    i++;
  }
  
  qsort(h, n, sizeof(int), compare_int);
  
  if (k >= n)
  {
    printf("0");
    return 0;
  }
  
  int sum;
  sum = 0;
  i = 0;
  while (i < n - k)
  {
    sum += a[i];
    i++;
  }
  printf("%d", sum);
  return 0;
}

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

#include <iostream>
using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    uint64_t *H = new uint64_t[N];
    for(int n=0; n<N; n++){
        cin >> H[n];
    }
    sort(H, H+N);
    uint64_t s=0;
    for(int n=K; n<N; n++){
         s += H[N-n-1];
    }
    cout << s << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'uint64_t' was not declared in this scope
    8 |     uint64_t *H = new uint64_t[N];
      |     ^~~~~~~~
a.cc:2:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    1 | #include <iostream>
  +++ |+#include <cstdint>
    2 | using namespace std;
a.cc:8:15: error: 'H' was not declared in this scope
    8 |     uint64_t *H = new uint64_t[N];
      |               ^
a.cc:8:23: error: 'uint64_t' does not name a type
    8 |     uint64_t *H = new uint64_t[N];
      |                       ^~~~~~~~
a.cc:8:23: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |     sort(H, H+N);
      |     ^~~~
      |     short
a.cc:13:13: error: expected ';' before 's'
   13 |     uint64_t s=0;
      |             ^~
      |             ;
a.cc:15:10: error: 's' was not declared in this scope
   15 |          s += H[N-n-1];
      |          ^
a.cc:17:13: error: 's' was not declared in this scope
   17 |     cout << s << endl;
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,k;
  cin >> n >> k;
  int u[n];
  rep(i,n){
    cin >> u[i]; 
  }
  sort(u.begin(),u.end());
  if(n<=k){
    cout << 0 << endl;
    return 0;
  }
  int ans=0;
  rep(i,n-k){
    ans+=u[i];
  }
  cout << ans << endl;
}

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

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int K = scan.nextInt();
			
			int[] H = new int[N];
			//ArrayList<Integer> hp  = new ArrayList<Integer>();
			
			
			for(int i = 0;i<N;i++) {
				H[i] = scan.nextInt();
			}
			
			Arrays.sort(H);
			
			
			
			
			if(N<=K) {//必殺技だけで全員倒せる
				System.out.println(0);
			}else{
				long kaisuu = 0;
				for(int i = 0;i<N-K;i++) {
					kaisuu +=(long)H[i];
				}
				
				
				
				System.out.println(kaisuu);
			}
			
			
			
			
			
			

Compiler output:
Main.java:34: error: reached end of file while parsing
			}
			 ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

ll h[200010];

void solve(){
  ll n,k;
  cin >> n >> k;
  ll sum = 0;
  rep(i,n){
      cin >> h[i];
  }
  sort(h,h+n,greater<ll>);
  ll rest = k;
  ll ans = 0;
  rep(i,n){
      if(k>=1){
          k--;
      }
      else{
          ans += h[i];
      }
  }

  cout << ans << endl;

}

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


Compiler output:
a.cc: In function 'void solve()':
a.cc:18:25: error: expected primary-expression before ')' token
   18 |   sort(h,h+n,greater<ll>);
      |                         ^
Language: C++

#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

constexpr ll INF = 1e16;

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

ll max(ll a, ll b) {return a < b ? b : a; }
ll min(ll a, ll b) {return a > b ? b : a; }
double maxf(double a, double b) { return a < b ? b : a; }

vector<int> H(200000);

int main() {
  long long n, k, ans = 0;
  cin>>n>>k;

  if(n <= k) cout<<"0"<<endl;
  
  for(int i=0; i<n; i++){
    cin >> H[i];
  }
  sort(H.begin(), H.end(),  greater<int>());


  for(int i = k; i<n-k; i++){
    ans += H[i]
  }

  cout<<ans<<endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: expected ';' before '}' token
   31 |     ans += H[i]
      |                ^
      |                ;
   32 |   }
      |   ~
Language: C++

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

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


Compiler output:
a.cc:1:10: fatal error: bits/stc++.h: No such file or directory
    1 | #include <bits/stc++.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   for(i=0; i < N;++i)
      |       ^
a.cc:13:16: error: expected ';' before '}' token
   13 |   total += H[i]
      |                ^
      |                ;
   14 |   }
      |   ~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>

using namespace std;

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

  if (K >= N)
  {
    cout << 0 << endl;
    return;
  }

  vector<int> H(N);
  int sum = 0;
  for (int i = 0; i < N; ++i)
  {
    cin >> H[i];
    sum += H[i];
  }
  sort(H.begin(), H.end());

  for (int i = 0; i < K; ++i)
  {
    sum -= H[N - 1 - i];
  }
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   19 |     return;
      |     ^~~~~~
Language: C++

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, k;
  cin >> n >> k;
  vector <long long int> a(n), b;
  for (int i = 0, i < n; ++i){
cin >> a[i];
  }
  sort(a.begin(),a.end());
  for (int j = 0; j < k; ++j){
	b.push_back(a[j]);
}
long long int c = accumulate(b.begin(),b.end(),0);
cout << c << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: expected ';' before '<' token
   11 |   for (int i = 0, i < n; ++i){
      |                    ^~
      |                    ;
a.cc:11:21: error: expected primary-expression before '<' token
   11 |   for (int i = 0, i < n; ++i){
      |                     ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	for (auto& hi : h) {
		cin >> hi;
	}
	sort(h.begin(), h.end(), less<int>());
	h.resize(n - k);
	long long r = accumulate(h.begin(), h.end(), 0LL, [](long long a, long long n) { return a + n; });
	cout << r << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: 'accumulate' was not declared in this scope
   14 |         long long r = accumulate(h.begin(), h.end(), 0LL, [](long long a, long long n) { return a + n; });
      |                       ^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int>h(n);
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  sort(h.begin(),h.end());
    long long sum = 0;
  for(int i = 0;i<N-K;i++){
    sum += h[i];
  }
  if(n>k)cout << sum << endl;
  else cout << 0 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'N' was not declared in this scope
   12 |   for(int i = 0;i<N-K;i++){
      |                   ^
a.cc:12:21: error: 'K' was not declared in this scope
   12 |   for(int i = 0;i<N-K;i++){
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int>h(n);
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  sort(h.begin(),h.end());
    long long sum = 0;
  for(int i = 0;i<N-K;i++){
    sum += h[i];
  }
  if(N>K)cout << sum << endl;
  else cout << 0 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'N' was not declared in this scope
   12 |   for(int i = 0;i<N-K;i++){
      |                   ^
a.cc:12:21: error: 'K' was not declared in this scope
   12 |   for(int i = 0;i<N-K;i++){
      |                     ^
a.cc:15:6: error: 'N' was not declared in this scope
   15 |   if(N>K)cout << sum << endl;
      |      ^
a.cc:15:8: error: 'K' was not declared in this scope
   15 |   if(N>K)cout << sum << endl;
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int>h(n);
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  sort(h.begin(),h.end());
    ll sum;
  if(n>=k){  
  sum=accumulate(h.begin(),h.begin()+n-k,0);
  }
  else sum=0;
      cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'll' was not declared in this scope
   11 |     ll sum;
      |     ^~
a.cc:13:3: error: 'sum' was not declared in this scope
   13 |   sum=accumulate(h.begin(),h.begin()+n-k,0);
      |   ^~~
a.cc:15:8: error: 'sum' was not declared in this scope
   15 |   else sum=0;
      |        ^~~
a.cc:16:13: error: 'sum' was not declared in this scope
   16 |       cout<<sum<<endl;
      |             ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int>h(n);
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  sort(h.begin(),h.end());
    int sum;
  if(n>=k){  
  sum=accumulate(h.begin(),h.begin()+n-k,0);
  }
  else sum=0
      cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: expected ';' before 'cout'
   15 |   else sum=0
      |             ^
      |             ;
   16 |       cout<<sum<<endl;
      |       ~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: no matching function for call to 'end()'
   10 |   sort(h.begin(),h,end());
      |                    ~~~^~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
                 from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
/usr/include/c++/14/initializer_list:99:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  106 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
 1249 |     end(valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1249:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1265:5: note:   candidate expects 1 argument, 0 provided
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    ll n, k;
    cin >> n>> k;
    vector<ll> h(n);
    REP(i, n) cin >> h[i];

    sort(RALL(n));
    ll ans = 0;
    for(int i = k; i < n; i++) {
        ans += h[i];
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: error: request for member 'rbegin' in 'n', which is of non-class type 'll' {aka 'long long int'}
    5 | #define RALL(a) a.rbegin(), a.rend()
      |                   ^~~~~~
a.cc:23:10: note: in expansion of macro 'RALL'
   23 |     sort(RALL(n));
      |          ^~~~
a.cc:5:31: error: request for member 'rend' in 'n', which is of non-class type 'll' {aka 'long long int'}
    5 | #define RALL(a) a.rbegin(), a.rend()
      |                               ^~~~
a.cc:23:10: note: in expansion of macro 'RALL'
   23 |     sort(RALL(n));
      |          ^~~~
Language: Java

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

Compiler output:
Main.java:9: error: incompatible types: possible lossy conversion from long to int
    long M[] =new long[N];
                       ^
1 error
Language: Java

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

Compiler output:
Main.java:9: error: incompatible types: possible lossy conversion from long to int
    long M[] =new long[N];
                       ^
1 error
Language: C++

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

int main() {
  cin.tie(0);
  ios::sync_With_stdio(false);
  
  int n, k;
  cin >> n >> k;
  long long ans = 0;
  vector<long long> 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];
    }
    ans += k;
  }else if(n <= k){
    ans = k;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: 'sync_With_stdio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
    6 |   ios::sync_With_stdio(false);
      |        ^~~~~~~~~~~~~~~
Language: C++

#include<vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
int main(){
    
    int N,K;
    cin >> N >> K;
    vector<int> H(N);
    
    rep(i,N){
        cin >> H[i];
    }
    
    sort(H.begin(),H.end());
    
    ll ans = 0;
    if(N>K){
        for(ll i = 0;i<N-K;i++){
            ans += H[i + K -1];
        }
        cout << ans << endl;
    }
    
    else {
        intput(0);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> N >> K;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<vector>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |     sort(H.begin(),H.end());
      |     ^~~~
      |     short
a.cc:23:9: error: 'cout' was not declared in this scope
   23 |         cout << ans << endl;
      |         ^~~~
a.cc:23:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:24: error: 'endl' was not declared in this scope
   23 |         cout << ans << endl;
      |                        ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<vector>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc:4:19: error: 'cout' was not declared in this scope
    4 | #define intput(i) cout << i << endl
      |                   ^~~~
a.cc:27:9: note: in expansion of macro 'intput'
   27 |         intput(0);
      |         ^~~~~~
a.cc:4:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #define intput(i) cout << i << endl
      |                   ^~~~
a.cc:27:9: note: in expansion of macro 'intput'
   27 |         intput(0);
      |         ^~~~~~
a.cc:4:32: error: 'endl' was not declared in this scope
    4 | #define intput(i) cout << i << endl
      |                                ^~~~
a.cc:27:9: note: in expansion of macro 'intput'
   27 |         intput(0);
      |         ^~~~~~
a.cc:4:32: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #define intput(i) cout << i << endl
      |                                ^~~~
a.cc:27:9: note: in expansion of macro 'intput'
   27 |         intput(0);
      |         ^~~~~~
Language: C++

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

int main(){
  long long ans=0;
  int N,K;
  cin>>N>>K;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin>>H(i);
  }
  sort(H.begin(),H.end());
  for(int i=0;i<N-K;i++){ans+=H.at(i);}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: no match for call to '(std::vector<int>) (int&)'
   12 |     cin>>H(i);
      |          ~^~~
Language: C++

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

int main(){
  long long ans=0;
  int N,K;
  cin>>N>>K;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin>>H(i);
  }
  sort(H.begin(),H.end());
  for(int i=0;i<N-K;i++){ans+=H.at(i);}
}

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

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

int main(){
    int64_t N,K;
    cin >> N >> K;
    vector<int64_t> H(N);
    for ( int64_t i = 0; i < N; ++i){
        cin >> H.at(i);
    }
    sort(H.begin(),H.end());
    int64_t sum = 0;
    if ( N > K ){
        for ( int i = 0; i < N - K; ++i){
            sum += H.at(i);
        }
    }
    cout << sum << 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 <iostream>
#include <vector>
using namespace std;
int main(int argc, char** argv){
	int N,K,temp;
	vector<int> HP;
	vector<int>::iterator ite;
	cin >> N >> K;
	for(int i=0;i<N;i++){
		cin >> temp;
		HP.push_back(temp);
	}
	temp=0;
	for(int i=0; i<K;i++){
		ite = max_element(HP.begin(), HP.end());
		HP.erase(ite);
	}
	for(int i=0;i<HP.size();i++)
		temp += HP[i];
	cout << temp << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:15:23: error: 'max_element' was not declared in this scope
   15 |                 ite = max_element(HP.begin(), HP.end());
      |                       ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char** argv){

	int N,K,temp;
	vector<int> HP;
	vector<int>::iterator ite;
	cin >> N >> K;
	for(int i=0;i<N;i++){
		cin >> temp;
		vector.push_back(temp);
	}
	temp=0;
	for(int i=0; i<K;i++){
		ite = max_element(HP.begin(), HP.end());
		HP.erase(ite);
	}
	for(int i=0;i<HP.size();i++)
		temp += HP[i];
	cout << temp << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:12:23: error: expected unqualified-id before '.' token
   12 |                 vector.push_back(temp);
      |                       ^
a.cc:16:23: error: 'max_element' was not declared in this scope
   16 |                 ite = max_element(HP.begin(), HP.end());
      |                       ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  vector<int> H;
  for(int i=0;i<N;i++){
    int k;
    cin >> k;
    H.push_back(k);
  }
  if(N <= K) {cout << 0 << endl;}
  else{
    sort(H.begin(),H.end());
    long long int answer=0;
    for(int i=K;i>=1;i--){
      H.pop_back();
    }
    for(int i=0;i<H.size();i++){
      answer += H[i];
    }
    cout << answer << endl;
  }
  return 0;
}

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

#include <iostream>
using namespace std;

int main(){
    int N, K, v;

    cin >> N >> K;

    int a[N];

    for(int i = 0; i < N; i++) cin >> a[i];

    sort(a, a+N);

    if(N < K) v = 0;
    else{
        for(int i = N-K; i < N; i++){
            v = v + a[i];
        }
    }

    cout << v << endl;
}

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

#include <bits / stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>

using namespace std;

int main() {
    int n,k;
    cin >> n >> k ;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
        cin >> h[i];
    sort(h.begin(), h.end());
    reverse(h.begin(),h.end());
    long long int ans = 0;
    for (int i = k; i < n; i++)
        ans += h[i];
    cout << ans << endl;

}


Compiler output:
a.cc:1:10: fatal error: bits / stdc++.h: No such file or directory
    1 | #include <bits / stdc++.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <algorithm>
#include <iostream>
using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	sort(h.begin(), h.end());
	long sum = 0;
	for (int i = 0; i < n - k; i++) {
		sum += h[i];
	}
	cout << sum;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> h(n);
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <iostream>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> h(n);
      |                ^~~
a.cc:9:24: error: 'h' was not declared in this scope
    9 |                 cin >> h[i];
      |                        ^
a.cc:11:14: error: 'h' was not declared in this scope
   11 |         sort(h.begin(), h.end());
      |              ^
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
typedef long long ll;
 
int main() {
  	ll N,K;
    cin >> N >> K;
  	vector<ll> H(N):
  	for (ll i = 0; i < N; i++) cin >> H[i]; 
	sort(H.begin(), H.end());
  	ll sum = 0;
  	for(ll i = 0; i < N - K; i++){
      sum += H{i};
    }
  	cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<ll> H(N):
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<math.h>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:9:18: error: expected primary-expression before '>' token
    9 |         vector<ll> H(N):
      |                  ^
a.cc:9:20: error: 'H' was not declared in this scope
    9 |         vector<ll> H(N):
      |                    ^
a.cc:10:24: error: 'i' was not declared in this scope
   10 |         for (ll i = 0; i < N; i++) cin >> H[i];
      |                        ^
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   11 |         sort(H.begin(), H.end());
      |         ^~~~
      |         sqrt
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
typedef long long ll;

int main() {
  	ll N,K;
    cin >> N >> K;
  	vector<ll> H(N):
  	for (ll i = 0; i < N; i++) cin >> H[i]; 
	sort(H.begin(), H.end());
  	ll sum = 0;
  	for(ll i = 0; i < N - K; i++){
      sum += H{i};
    }
  	cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<ll> H(N):
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<math.h>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:9:18: error: expected primary-expression before '>' token
    9 |         vector<ll> H(N):
      |                  ^
a.cc:9:20: error: 'H' was not declared in this scope
    9 |         vector<ll> H(N):
      |                    ^
a.cc:10:24: error: 'i' was not declared in this scope
   10 |         for (ll i = 0; i < N; i++) cin >> H[i];
      |                        ^
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   11 |         sort(H.begin(), H.end());
      |         ^~~~
      |         sqrt
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
typedef long long ll;

int main() {
  	ll N,K
    cin >> N >> K;
  	vector<ll> H(N):
  	for (ll i = 0; i < N; i++) cin >> H[i]; 
	sort(H.begin(), H.end());
  	ll sum = 0;
  	for(ll i = 0; i < N - K; i++){
      sum += H{i};
    }
  	cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: expected initializer before 'cin'
    8 |     cin >> N >> K;
      |     ^~~
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<ll> H(N):
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<math.h>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:9:18: error: expected primary-expression before '>' token
    9 |         vector<ll> H(N):
      |                  ^
a.cc:9:20: error: 'H' was not declared in this scope
    9 |         vector<ll> H(N):
      |                    ^
a.cc:10:24: error: 'i' was not declared in this scope
   10 |         for (ll i = 0; i < N; i++) cin >> H[i];
      |                        ^
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   11 |         sort(H.begin(), H.end());
      |         ^~~~
      |         sqrt
a.cc:13:31: error: 'K' was not declared in this scope
   13 |         for(ll i = 0; i < N - K; i++){
      |                               ^
Language: C++

def fenec(k, h_list):
  h_list.sort()
  if k >= len(h_list):
    return 0
  else:
    ans = 0
    for i in range(len(h_list)-k):
      ans += h_list[i]
    return ans
    
n, k = [int(i) for i in input().split()]
h_list = [int(i) for i in input().split()]

print(fenec(k, h_list))

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def fenec(k, h_list):
      | ^~~
Language: C++

 #include<bits/stdc++.h>

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(),greater<int>);
  long long int count = 0;

  for(int i = K; i < N; i++){
    count += H[i];
  }

  cout << count;

  return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:13:38: error: expected primary-expression before ')' token
   13 |   sort(H.begin(),H.end(),greater<int>);
      |                                      ^
Language: C++

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

#define fi first
#define se second 
#define pb push_back
int a[200005];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,k; 
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	ll sum = 0;
	for(int i=0;i<n-k;i++){
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'll' was not declared in this scope
   16 |         ll sum = 0;
      |         ^~
a.cc:18:17: error: 'sum' was not declared in this scope
   18 |                 sum+=a[i];
      |                 ^~~
a.cc:20:15: error: 'sum' was not declared in this scope
   20 |         cout<<sum<<endl;
      |               ^~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;


int main() {
    long long N, K;
    vector<long long> H;
    cin >> N >> K;
    for (int i = 0; i < N; ++i) {
        long long tmp;
        cin >> tmp;
        H.push_back(tmp);
    }
    if (K >= N) {
        cout << 0 << endl;
        return 0;
    }

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

    for (int i = 0; i < K; ++i) {
        H.pop_back();
    }

    long long ans = 0;
    for (int i : H) {
        ans += i;
    }
    cout << ans << endl;
}

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


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long k = sc.nextLong();
		long[] a = new long[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		
		if (k >= n) {
			System.out.println(0);
		} else {
			long ans = 0;
			for (int i = 0; i < n - k; i++) {
				ans += a[i];
			}
			System.out.println(ans);
		}
	}
}


Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
		long[] a = new long[n];
		                    ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt(), k = sc.nextInt();
		int[] mon = new int[n];
		for(int i = 0; i < n; i++) {
			mon[i] = sc.nextInt();
		}
		Arrays.sort(mon);
		if(n<=k)pw.print(0);
		else {
			for(int i = n-1; i >= n-k; i--) {
				mon[i] = 0;
			}
			int sum = Arrays.stream(mon).sum();
			pw.print(sum);
		}
		pw.close();
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

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

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

	        return tokenizer.nextToken("\n");
	    }

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

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

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

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

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

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

void FennecvsMonster() {
    int n, k;
    long long res = 0;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];
    if (n <= k) res = 0;
    else {
        sort(h.begin(), h.end());
        for(int i=0;i<n-k;i++) res += h[i];
    }
    cout << res << endl;
    return;
}

int main(){
  FennecvsMonster();
}

Compiler output:
a.cc: In function 'void FennecvsMonster()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> n >> k;
      |     ^~~
a.cc:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int> h(n);
      |     ^~~~~~
a.cc:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> h(n);
      |            ^~~
a.cc:6:40: error: 'h' was not declared in this scope
    6 |     for (int i = 0; i < n; i++) cin >> h[i];
      |                                        ^
a.cc:9:14: error: 'h' was not declared in this scope
    9 |         sort(h.begin(), h.end());
      |              ^
a.cc:9:9: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |         sort(h.begin(), h.end());
      |         ^~~~
      |         short
a.cc:12:5: error: 'cout' was not declared in this scope
   12 |     cout << res << endl;
      |     ^~~~
a.cc:12:20: error: 'endl' was not declared in this scope
   12 |     cout << res << endl;
      |                    ^~~~
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class FennceMonster {
    public static void main(String[] args) {
        Scanner enter = new Scanner(System.in);
        int numOfMonster = enter.nextInt();
        int numOfSpecialMoves = enter.nextInt();
        long monsterlifes[] = new long[numOfMonster];
        long addition = 0;

        long max = monsterlifes[0];
        for (int i = 0; i < monsterlifes.length; i++) {
            monsterlifes[i] = enter.nextInt();}
            Arrays.sort(monsterlifes);
            for (int j = numOfMonster - numOfSpecialMoves - 1; j >= 0; j--)

                addition += monsterlifes[j];


        System.out.println(addition);


    }
}

Compiler output:
Main.java:4: error: class FennceMonster is public, should be declared in a file named FennceMonster.java
public class FennceMonster {
       ^
1 error
Language: Java

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class FennceMonster {
    public static void main(String[] args) {
        Scanner enter = new Scanner(System.in);
        int numOfMonster = enter.nextInt();
        int numOfSpecialMoves = enter.nextInt();
        long monsterlifes[] = new long[numOfMonster];
        long addition = 0;

        long max = monsterlifes[0];
        for (int i = 0; i < monsterlifes.length; i++) {
            monsterlifes[i] = enter.nextInt();}
            Arrays.sort(monsterlifes);
            for (int j = numOfMonster - numOfSpecialMoves - 1; j >= 0; j--)

                addition += monsterlifes[j];


        System.out.println(addition);


    }
}


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

#include<bits/stdc++.h>

using namespace std;
int main(){
 int N,K;
 cin >> N >> K;
 int count = 0;
 vector<int> H(N);
 for(int i = 0; i < N; i++) cin >> H[i];
  sort(H.begin(),H.end(),greater<int>);
  if(N <= K){
    cout << 0;
    return 0;
  }
    
  for(int i = K; i < N; i++){
    count += H[i];
  }

  cout << count << endl;

 


 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:38: error: expected primary-expression before ')' token
   10 |   sort(H.begin(),H.end(),greater<int>);
      |                                      ^
Language: C

#include<stdio.h>
#include<stdlib.h>
int main(void){

    int N,K;
    scanf("%d %d",&N,&K);
    long int *h;
    h = (long int *)malloc(sizeof(long int)*N);
    for(int i=0;i<N;i++){
        scanf("%ld",&h[i]);
    }
    if(K>=N){
        printf("0");
    }else{
    long int tmp;
    for(int i=1;i<N;i++){
        tmp = h[i];
        if(h[i-1]>tmp){
            swap(&h[i-1],&tmp);
        }
    }

    long int attacktotal = 0;
    for(int i=0;i<N-K;i++){
        attacktotal += h[i];
    }
    if(attacktotal!=0){
        printf("%ld",attacktotal);
    }
    }
    free(h);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:13: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   19 |             swap(&h[i-1],&tmp);
      |             ^~~~
Language: Java

/* package codechef; // don't place package name! */

import javax.swing.*;
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class sw
{
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        Scanner s = new Scanner(System.in);
        long N = s.nextInt();
        long K = s.nextInt();
        long H[] = new long[(int) N];
        long sum=0;
        for(int i=0; i<N; i++)
        {
            H[i] = s.nextInt();
        }
        Arrays.sort(H);
        for(int i=0; i<N-K;i++)
        {
            sum+=H[i];
        }
        System.out.println(sum);
    }
}


Compiler output:
Main.java:9: error: class sw is public, should be declared in a file named sw.java
public class sw
       ^
1 error