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

int main(void) {
	int N = 0;
	int K = 0;
	std::cin >> N >> K;
	std::vector<int> moves;
	int val = 0;
	for (int i = 0; i < N; i++) {
		std::cin >> val;
		moves.push_back(val);
	}
	if (moves.size() < K) {
		std::cout << "0" << std::endl;
		return 0;
	}
	std::sort(moves.begin(), moves.end());
	std::cout << std::accumulate(moves.begin(), moves.end()-K-1, 0);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:14: error: 'cin' is not a member of 'std'
    4 |         std::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 | int main(void) {
a.cc:5:14: error: 'vector' is not a member of 'std'
    5 |         std::vector<int> moves;
      |              ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | int main(void) {
a.cc:5:21: error: expected primary-expression before 'int'
    5 |         std::vector<int> moves;
      |                     ^~~
a.cc:8:22: error: 'cin' is not a member of 'std'
    8 |                 std::cin >> val;
      |                      ^~~
a.cc:8:22: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:9:17: error: 'moves' was not declared in this scope
    9 |                 moves.push_back(val);
      |                 ^~~~~
a.cc:11:13: error: 'moves' was not declared in this scope
   11 |         if (moves.size() < K) {
      |             ^~~~~
a.cc:12:22: error: 'cout' is not a member of 'std'
   12 |                 std::cout << "0" << std::endl;
      |                      ^~~~
a.cc:12:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:42: error: 'endl' is not a member of 'std'
   12 |                 std::cout << "0" << std::endl;
      |                                          ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | int main(void) {
a.cc:15:14: error: 'sort' is not a member of 'std'
   15 |         std::sort(moves.begin(), moves.end());
      |              ^~~~
a.cc:15:19: error: 'moves' was not declared in this scope
   15 |         std::sort(moves.begin(), moves.end());
      |                   ^~~~~
a.cc:16:14: error: 'cout' is not a member of 'std'
   16 |         std::cout << std::accumulate(moves.begin(), moves.end()-K-1, 0);
      |              ^~~~
a.cc:16:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:27: error: 'accumulate' is not a member of 'std'
   16 |         std::cout << std::accumulate(moves.begin(), moves.end()-K-1, 0);
      |                           ^~~~~~~~~~
Language: C++

#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>

int main(void) {
	int N = 0;
	int K = 0;
	std::cin >> N >> K;
	std::vector<int> moves;
	int val = 0;
	for (int i = 0; i < N; i++) {
		std::cin >> val;
		moves.push_back(val);
	}
	if (moves.size() < K) {
		std::cout << "0" << std::endl;
		return 0;
	}
	std::sort(moves.begin(), moves.end());
	std::cout << std::accumulate(0, N - K - 1, 0);
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/numeric:62,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_numeric.h: In instantiation of '_Tp std::accumulate(_InputIterator, _InputIterator, _Tp) [with _InputIterator = int; _Tp = int]':
a.cc:21:30:   required from here
   21 |         std::cout << std::accumulate(0, N - K - 1, 0);
      |                      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:141:48: error: invalid type argument of unary '*' (have 'int')
  141 |         __init = _GLIBCXX_MOVE_IF_20(__init) + *__first;
      |                                                ^~~~~~~~
Language: Java

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int monsterNum = sc.nextInt();
		int ultimate = sc.nextInt();
		List<Integer> monsterList = new ArrayList<>();
		for(int i = 0;i < monsterNum; i++ ) {
			monsterList.add(sc.nextInt());
		}

		monsterList.sort((x,y) -> y.compareTo(x));

		int anser = monsterList.stream()
		.skip(ultimate)
		.peek(x -> System.out.println(x))
		.mapToInt(x -> x)
		.peek(x -> System.out.println(x))
		.sum();
		System.out.println(anser);


Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
              ^
  (use --enable-preview to enable unnamed classes)
Main.java:18: error: reached end of file while parsing
		System.out.println(anser);
		                          ^
2 errors
Language: C++

#include<bits/stdc++.h>					
using namespace std;	
int main(void)	
{		long long n,k;
cin>>n>>k;
long long hea[200001];long long ans = 0;
	for(int i=0;i<n;i++){
	cin>>hea[i];
}
if(k>=n){
cout<<ans;
	return 0;
}else if(k==0){
	for(int i = 0;i<n;i++){
		ans+=hea[i];
	}
cout<<ans;
	return 0;
}else{
	sort(hea,hea+n,);
for(int i=0;i<n-k;i++){
	ans+=hea[i];
}	
cout<<ans;	return 0;

}					
return 0;	 									
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: expected primary-expression before ')' token
   20 |         sort(hea,hea+n,);
      |                        ^
Language: C++

#include<iostream> 					
using namespace std;	
bool cmp(int a,int b){
	return a>b;
}
int main(void)	
{		long long n,k;
cin>>n>>k;
long long hea[200001];long long ans = 0;
	for(int i=0;i<n;i++){
	cin>>hea[i];
}
if(k>=n){
cout<<ans;
	return 0;
}else if(k==0){
	for(int i = 0;i<n;i++){
		ans+=hea[i];
	}
cout<<ans;
	return 0;
}else{
	sort(hea,hea+n,cmp);
for(int i=k;i<n;i++){
	ans+=hea[i];
}	
cout<<ans;	return 0;

}					
return 0;	 									
 } 

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

#include<iostream>					
using namespace std;	
int main()	
{		long long n,k;
cin>>n>>k;
long long hea[200001];long long ans = 0;
	for(int i=0;i<n;i++){
	cin>>hea[i];
}
if(k>=n){
	

cout<<ans;
	return 0;
}else if(k==0){
	for(int i = 0;i<n;i++){
		ans+=hea[i];
	}
cout<<ans;
	return 0;
}else{int t;
for(int i=1;i<=n;i++){
for(int j=0;j<n;j++){
if(a[j]>a[j+1])
{
t=a[j];a[j]=a[j+1];a[j+1]=t;
}
}
}
for(int i=k-1;i<n;i++){
	ans+=hea[i];
}	
cout<<ans;	return 0;

}					
return 0;	 									
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:24:4: error: 'a' was not declared in this scope
   24 | if(a[j]>a[j+1])
      |    ^
Language: C++

#include<iostream>					
using namespace std;	
int main()	
{		long long n,k;
cin>>n>>k;
long long hea[200001];long long ans = 0;
	for(int i=0;i<n;i++){
	cin>>hea[i];
}
if(k>=n){
	
ans = 0;
cout<<ans;
	return 0;
}else if(k==0){
	for(int i = 0;i<n;i++){
		ans+=hea[i];
	}
cout<<ans;
	return 0;
}else{
	int s,r;
for(int i = 0;i<n;i++){	
	for(int j = 0;j<n;j++){
		int s = ary[j];
		int r = ary[j+1];
		if(r>s){
			ary[j] = r;
			ary[j+1] = s;
		}
	}
}	
for(int i =n-1;i>0;i--){
	ans+=hea[i]; 
}
cout<<ans;	}					
	return 0; 									
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'ary' was not declared in this scope
   25 |                 int s = ary[j];
      |                         ^~~
Language: C++

#include<iostream>					
using namespace std;	
int main()	
{		long long n,k;
cin>>n>>k;
long long hea[200001];long long ans = 0;
	for(int i=0;i<n;i++){
	cin>>hea[i];ans+=hea[i];
}
if(k>=n){
	
ans = 0;
cout<<ans;
	return 0;
}else if(k==0){
	for(int i = 0;i<n;i++){
		ans+=hea[i];
	}
cout<<ans;
	return 0;
}else{
	int s,k;
for(int i = 0;i<n;i++){	
	for(int j = 0;j<n;j++){
		int s = ary[j];
		int k = ary[j+1];
		if(k>s){
			ary[j] = k;
			ary[j+1] = s;
		}
	}
}		
for(int i = 0;i<k;i++){
	ary[i] = 0;
}	
for(int i = 0;i<n;i++){
		ans+=hea[i];
	}
cout<<ans;	}					
	return 0; 									
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'ary' was not declared in this scope
   25 |                 int s = ary[j];
      |                         ^~~
a.cc:34:9: error: 'ary' was not declared in this scope
   34 |         ary[i] = 0;
      |         ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  long long int ans = 0;
  scanf("%d %d", &n, &k);
  int a[n];
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a+n);
  for(int = 0; i < n-k; i++) ans += a[i];
  printf("%lld\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: expected unqualified-id before '=' token
   10 |   for(int = 0; i < n-k; i++) ans += a[i];
      |           ^
a.cc:10:10: error: expected ';' before '=' token
   10 |   for(int = 0; i < n-k; i++) ans += a[i];
      |          ^~
      |          ;
a.cc:10:11: error: expected primary-expression before '=' token
   10 |   for(int = 0; i < n-k; i++) ans += a[i];
      |           ^
a.cc:10:16: error: 'i' was not declared in this scope
   10 |   for(int = 0; i < n-k; i++) ans += a[i];
      |                ^
a.cc:10:23: error: expected ')' before ';' token
   10 |   for(int = 0; i < n-k; i++) ans += a[i];
      |      ~                ^
      |                       )
a.cc:10:25: error: 'i' was not declared in this scope
   10 |   for(int = 0; i < n-k; i++) ans += a[i];
      |                         ^
Language: C++

#include<iostream>					
using namespace std;	
int main()	
{		long long n,k;
cin>>n>>k;
long long hea[200001];long long ans = 0;
	for(int i=0;i<n;i++){
	cin>>hea[i];
}

for(int j =0;j<k;j++){
int sign = -123;int pos =0;
for(int i =0;i<n;i++){
	if(hea[i]>sign){
		sign = hea[i];
		pos = i;
	}
} 

hea[pos] = 0;
}			
}	
{
for(int i=0;i<n;i++){
	ans+=hea[i];
}
    cout<<ans;					
	return 0; 									
 } 

Compiler output:
a.cc:23:1: error: expected unqualified-id before '{' token
   23 | {
      | ^
Language: C++

extension String:CollectionType{}
func readInts()->[Int]{
  return readLine()!.split(" ").map{Int($0)!}
}
var a:[Int]=readInts()
var n=a[0]
var k=a[1]
var h:[Int]=readInts()
var sh=h.sort{$0<$1}
var sum:Int64=0
if(n<=k){print(0)}
else{
  for i in 0..<n-k{
  sum=sum+sh[i]
}
print(sum)
}



Compiler output:
a.cc:13:12: error: too many decimal points in number
   13 |   for i in 0..<n-k{
      |            ^~~
a.cc:1:1: error: 'extension' does not name a type
    1 | extension String:CollectionType{}
      | ^~~~~~~~~
a.cc:2:1: error: 'func' does not name a type
    2 | func readInts()->[Int]{
      | ^~~~
a.cc:5:1: error: 'var' does not name a type
    5 | var a:[Int]=readInts()
      | ^~~
a.cc:10:1: error: 'var' does not name a type
   10 | var sum:Int64=0
      | ^~~
a.cc:12:1: error: expected unqualified-id before 'else'
   12 | else{
      | ^~~~
Language: C++

int main(){
  int N,K;
  cin >> N >> K;
  int HPs[N];
  for(int i=0;i<N;i++){cin >> HPs[i];}

  sort(HPs,HPs+N,greater<int>());

  float attack_num = 0;
  if(K < N){
    for(int i=K;i<N;i++){
      attack_num += HPs[i];
    }
  }
  printf("%.0f",attack_num);
  
  // int dum;
  // cin >> dum;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> N >> K;
      |   ^~~
a.cc:7:18: error: 'greater' was not declared in this scope
    7 |   sort(HPs,HPs+N,greater<int>());
      |                  ^~~~~~~
a.cc:7:26: error: expected primary-expression before 'int'
    7 |   sort(HPs,HPs+N,greater<int>());
      |                          ^~~
a.cc:7:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    7 |   sort(HPs,HPs+N,greater<int>());
      |   ^~~~
      |   short
a.cc:15:3: error: 'printf' was not declared in this scope
   15 |   printf("%.0f",attack_num);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(){
Language: C++


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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: template argument 1 is invalid
    9 |   vector<long long aint> v(N);
      |                        ^
a.cc:9:24: error: template argument 2 is invalid
a.cc:11:13: error: invalid types 'int[int]' for array subscript
   11 |     cin >> v[i];
      |             ^
a.cc:12:13: error: invalid types 'int[int]' for array subscript
   12 |     sum += v[i];
      |             ^
a.cc:14:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   14 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:14:20: error: request for member 'end' in 'v', which is of non-class type 'int'
   14 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc:15:13: error: request for member 'begin' in 'v', which is of non-class type 'int'
   15 |   reverse(v.begin(),v.end());
      |             ^~~~~
a.cc:15:23: error: request for member 'end' in 'v', which is of non-class type 'int'
   15 |   reverse(v.begin(),v.end());
      |                       ^~~
a.cc:16:34: error: invalid types 'int[int]' for array subscript
   16 |   for(int i = 0;i<K;i++){sum -= v[i];}
      |                                  ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'inverse' was not declared in this scope
   14 |   inverse(v.begin(),v.end());
      |   ^~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'll' was not declared in this scope
    5 |   ll n,k,h[200001],ans=0;
      |   ^~
a.cc:6:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   cin>>n>>k;
      |        ^
      |        yn
a.cc:6:11: error: 'k' was not declared in this scope
    6 |   cin>>n>>k;
      |           ^
a.cc:7:17: error: 'h' was not declared in this scope
    7 |   rep(i,n) cin>>h[i];
      |                 ^
a.cc:8:8: error: 'h' was not declared in this scope
    8 |   sort(h,h+n);
      |        ^
a.cc:9:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |   rep(i,n-k) ans+=h[i];
      |              ^~~
      |              abs
a.cc:10:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |   cout<<ans;
      |         ^~~
      |         abs
Language: C++

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

int main()
{
	int h,k,a,sum=0;
  	cin >> h >> k;
  	if(k>=n)
    {
    	cout << 0 << endl;
    }
  	else 
    {
    	for(int i=0;i<h-k;i++)
        {
        	cin >> a;
          	sum += a;
        }
      cout << sum << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: 'n' was not declared in this scope
    8 |         if(k>=n)
      |               ^
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int K,N,i;
	int H[200000];
	int sum=0;
	scanf("%d%d",&N,&K);
	for(i=0;i<N;i++)
	{		
		scanf("%d",&H[N]);
		sum = sum + H[N];
	}	
	sort(H,H+N,std::greater<>());	
	for(i=0;i<K;i++){
		sum = sum - H[K];
	}
	printf("%d",sum);
	return 0;	
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'greater' is not a member of 'std'
   14 |         sort(H,H+N,std::greater<>());
      |                         ^~~~~~~
a.cc:14:33: error: expected primary-expression before '>' token
   14 |         sort(H,H+N,std::greater<>());
      |                                 ^
a.cc:14:35: error: expected primary-expression before ')' token
   14 |         sort(H,H+N,std::greater<>());
      |                                   ^
Language: C++

#include<stdio.h>
#include<algorithm>

int main(){
	int K,N,i;
	int H[200000];
	int sum=0;
	scanf("%d%d",&N,&K);
	for(i=0;i<N;i++)
	{		
		scanf("%d",&H[N]);
		sum = sum + H[N];
	}	
	sort(H,H+N,greater<int>());	
	for(i=0;i<K;i++){
		sum = sum - H[K];
	}
	printf("%d",sum);
	return 0;	
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: 'greater' was not declared in this scope
   14 |         sort(H,H+N,greater<int>());
      |                    ^~~~~~~
a.cc:14:28: error: expected primary-expression before 'int'
   14 |         sort(H,H+N,greater<int>());
      |                            ^~~
a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   14 |         sort(H,H+N,greater<int>());
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int K,N,i;
	int H[200000];
	int sum=0;
	scanf("%d%d",&N,&K);
	for(i=0;i<N;i++)
	{		
		scanf("%d",&H[N]);
		sum = sum + H[N];
	}	
	std::sort(H,H+N,std::greater<int>());	
	for(i=0;i<K;i++){
		sum = sum - H[K];
	}
	printf("%d",sum);
	return 0;	
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: 'greater' is not a member of 'std'
   14 |         std::sort(H,H+N,std::greater<int>());
      |                              ^~~~~~~
a.cc:14:38: error: expected primary-expression before 'int'
   14 |         std::sort(H,H+N,std::greater<int>());
      |                                      ^~~
Language: C++

#include<stdio.h>
#include<algorithm>
int main(){
	int K,N,i;
	int H[200000];
	int sum=0;
	scanf("%d&d",&N,&K);
	for(i=0;i<N;i++)
	{		
		scanf("%d",&H[N]);
		sum = sum + H[N];
	}	
	std::sort(H,H+N,std::greater<>());	
	for(i=0;i<K;i++){
		sum = sum - H[K];
	}
	printf("%d",sum);
	return 0;	
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:30: error: 'greater' is not a member of 'std'
   13 |         std::sort(H,H+N,std::greater<>());
      |                              ^~~~~~~
a.cc:13:38: error: expected primary-expression before '>' token
   13 |         std::sort(H,H+N,std::greater<>());
      |                                      ^
a.cc:13:40: error: expected primary-expression before ')' token
   13 |         std::sort(H,H+N,std::greater<>());
      |                                        ^
Language: C++

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

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

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


int main(){
  int n,h;
  cin>>n>>h;
  int arr[n];
  for(int i=0;i<n;i++){
    cin>>arr[i];
  }
  sort(arr,arr+n);
  int c=0,ans=0;
  for(int i=n-1;i>=0;i++){
   if(c<h)
     c++;
     continue;
    else{
      c++;
      ans += arr[i];
    }
  }
  cout<<ans<<endl;
 return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'else' without a previous 'if'
   18 |     else{
      |     ^~~~
Language: C++

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


int main(){
  int n,h;
  cin>>n>>h;
  int arr[n];
  for(int i=0;i<n;i++){
    cin>>arr[i];
  }
  sort(arr,arr+n);
  int c=0,ans=0;
  for(int i=n-1;i>=0;i++){
   if(c<h)
     c++;
     continue;
    else
      c++;
      ans += arr[i];
     
  }
  cout<<ans<<endl;
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'else' without a previous 'if'
   18 |     else
      |     ^~~~
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 ans = 0;
  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:11:3: error: 'll' was not declared in this scope
   11 |   ll ans = 0;
      |   ^~
a.cc:13:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |     ans += h[i];
      |     ^~~
      |     abs
a.cc:15:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

int main(){

  int N;
  int K;
  int i=0;
  int j=0;
  
  int H;
  int sum=0;
  
  cin >> N;
  cin >> K;
  int vector<int>lank(K);
  
  while(i<N){
    cin >> H;
      while(j<K){
      if(lank.at(j)<H){
        lank.at(j)=H;
        break;
      }else {
        j++;
         }  
        if(j+1==K){
          sum=sum+H;
          break;
      }
   i++;
   j=0;
  }
  
  cout << sum <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: invalid declarator before 'lank'
   16 |   int vector<int>lank(K);
      |                  ^~~~
a.cc:21:10: error: 'lank' was not declared in this scope; did you mean 'link'?
   21 |       if(lank.at(j)<H){
      |          ^~~~
      |          link
a.cc:36:2: error: expected '}' at end of input
   36 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

int main(){

  int N;
  int K;
  int i=0;
  int j;
  int vector<int>lank;
  int H;
  int sum;
  
  cin >> N;
  cin >> K;
  while(i<K){
    lank(i)=0;
    i++
  }
  i=0;
  j=0;
  while(i<N){
    cin >> H;
      while(j<K){
      if(lank(j)<H){
        lank(j)=H;
        break;
      }else {
        j++;
         }  
        if(j+1==K){
          sum=sum+H;
      }
   i++;
   j=0;
  }
  
  cout << sum <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: invalid declarator before 'lank'
   10 |   int vector<int>lank;
      |                  ^~~~
a.cc:17:5: error: 'lank' was not declared in this scope; did you mean 'link'?
   17 |     lank(i)=0;
      |     ^~~~
      |     link
a.cc:18:8: error: expected ';' before '}' token
   18 |     i++
      |        ^
      |        ;
   19 |   }
      |   ~     
a.cc:25:10: error: 'lank' was not declared in this scope; did you mean 'link'?
   25 |       if(lank(j)<H){
      |          ^~~~
      |          link
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n,k,h,l;
  long long int s;
  vector<int> v={};
  cin>>n>>k;
  if(n<=k){
    cout<<0<<endl;
    return 0;}
  for(int i = 0; i < n; i++) {
    cin>>l;
    v.push_back(l);
  }
  sort(v.begin(),v.end());
  s = accumlate(next(v.begin,k),v.end(),0LL);
  cout<<s<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> v={};
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> v={};
      |          ^~~
a.cc:13:5: error: 'v' was not declared in this scope
   13 |     v.push_back(l);
      |     ^
a.cc:15:8: error: 'v' was not declared in this scope
   15 |   sort(v.begin(),v.end());
      |        ^
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort(v.begin(),v.end());
      |   ^~~~
      |   short
a.cc:16:7: error: 'accumlate' was not declared in this scope
   16 |   s = accumlate(next(v.begin,k),v.end(),0LL);
      |       ^~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

int[] sort(int l[],int n) {
  int i,j,t;
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(l[i]<l[j]){
        t = l[i];
        l[i] = l[j];
        l[j] = t;
      }
    }
  }
  return l;
}

int main(){
  int n,k,h,l[200000];
  long long int s;
  cin>>n>>k;
  if(n<=k){
    cout<<0<<endl;
    return 0;}
  for(int i = 0; i < n; i++) {
    cin>>l[i];
  }
  l = sort(l,n);
  s = 0;
  for(int i=k;i<n;i++) {
    s += l[i];
  }
  cout<<s<<endl;
  return 0;
}


Compiler output:
a.cc:4:4: error: structured binding declaration cannot have type 'int'
    4 | int[] sort(int l[],int n) {
      |    ^~
a.cc:4:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:4:4: error: empty structured binding declaration
a.cc:4:7: error: expected initializer before 'sort'
    4 | int[] sort(int l[],int n) {
      |       ^~~~
a.cc: In function 'int main()':
a.cc:28:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   28 |   l = sort(l,n);
      |       ^~~~
      |       short
Language: C++

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


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <vector>
#include <algorithm>
int main(){
    long N,K;
    std::cin >> N >> K;

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

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

    std::cout << sum << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:10: error: 'cin' is not a member of 'std'
    5 |     std::cin >> N >> K;
      |          ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | int main(){
a.cc:9:14: error: 'cin' is not a member of 'std'
    9 |         std::cin >> H[i];
      |              ^~~
a.cc:9:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:10: error: 'cout' is not a member of 'std'
   18 |     std::cout << sum << "\n";
      |          ^~~~
a.cc:18:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
unsigned int i,k,n,a[200010],ans=0;
  cin >> n >> k;
  for(i=0,i<n,i++){
  cin >> a[i];
  }
  sort(a,a+n,greater<int>())
    for(i=k;i<n,i++;){
    ans=ans+a[i];
    }
  cout << ans << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: expected ';' before ')' token
    7 |   for(i=0,i<n,i++){
      |                  ^
      |                  ;
a.cc:10:7: error: could not convert 'std::sort<unsigned int*, greater<int> >(((unsigned int*)(& a)), (((unsigned int*)(& a)) + ((sizetype)(((long unsigned int)n) * 4))), std::greater<int>{std::binary_function<int, int, bool>()})' from 'void' to 'bool'
   10 |   sort(a,a+n,greater<int>())
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~
      |       |
      |       void
a.cc:10:29: error: expected ';' before 'for'
   10 |   sort(a,a+n,greater<int>())
      |                             ^
      |                             ;
   11 |     for(i=k;i<n,i++;){
      |     ~~~                      
a.cc:11:5: error: expected primary-expression before 'for'
   11 |     for(i=k;i<n,i++;){
      |     ^~~
a.cc:10:29: error: expected ')' before 'for'
   10 |   sort(a,a+n,greater<int>())
      |                             ^
      |                             )
   11 |     for(i=k;i<n,i++;){
      |     ~~~                      
a.cc:7:6: note: to match this '('
    7 |   for(i=0,i<n,i++){
      |      ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
unsigned int i,k,n,a[200010],ans=0;
  cin >> n >> k;
  for(i=0,i<n,i++){
  cin >> a[i];
  }
  sort(a,a+n,greater<int>())
    for(i=k;i<n,i++){
    ans=ans+a[i];
    }
  cout << ans << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: expected ';' before ')' token
    7 |   for(i=0,i<n,i++){
      |                  ^
      |                  ;
a.cc:10:7: error: could not convert 'std::sort<unsigned int*, greater<int> >(((unsigned int*)(& a)), (((unsigned int*)(& a)) + ((sizetype)(((long unsigned int)n) * 4))), std::greater<int>{std::binary_function<int, int, bool>()})' from 'void' to 'bool'
   10 |   sort(a,a+n,greater<int>())
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~
      |       |
      |       void
a.cc:10:29: error: expected ';' before 'for'
   10 |   sort(a,a+n,greater<int>())
      |                             ^
      |                             ;
   11 |     for(i=k;i<n,i++){
      |     ~~~                      
a.cc:11:5: error: expected primary-expression before 'for'
   11 |     for(i=k;i<n,i++){
      |     ^~~
a.cc:10:29: error: expected ')' before 'for'
   10 |   sort(a,a+n,greater<int>())
      |                             ^
      |                             )
   11 |     for(i=k;i<n,i++){
      |     ~~~                      
a.cc:7:6: note: to match this '('
    7 |   for(i=0,i<n,i++){
      |      ^
a.cc:11:20: error: expected ';' before ')' token
   11 |     for(i=k;i<n,i++){
      |                    ^
      |                    ;
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
unsigned int i,k,a[200010],ans=0;
  cin >> n >> k;
  for(i=0,i<n,i++){
  cin >> a[i];
  }
  sort(a,a+n,greater<int>())
    for(i=k;i<n,i++){
    ans=ans+a[i];
    }
  cout << ans << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: 'n' was not declared in this scope
    6 |   cin >> n >> k;
      |          ^
a.cc:10:29: error: expected ';' before 'for'
   10 |   sort(a,a+n,greater<int>())
      |                             ^
      |                             ;
   11 |     for(i=k;i<n,i++){
      |     ~~~                      
a.cc:11:5: error: expected primary-expression before 'for'
   11 |     for(i=k;i<n,i++){
      |     ^~~
a.cc:10:29: error: expected ')' before 'for'
   10 |   sort(a,a+n,greater<int>())
      |                             ^
      |                             )
   11 |     for(i=k;i<n,i++){
      |     ~~~                      
a.cc:7:6: note: to match this '('
    7 |   for(i=0,i<n,i++){
      |      ^
a.cc:11:20: error: expected ';' before ')' token
   11 |     for(i=k;i<n,i++){
      |                    ^
      |                    ;
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
unsigned int i,a,k,a[200010],ans=0;
  cin >> n >> k;
  for(i=0,i<n,i++){
  cin >> a[i];
  }
  sort(a,a+n,greater<int>())
    for(i=k;i<n,i++){
    ans=ans+a[i];
    }
  cout << ans << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:20: error: conflicting declaration 'unsigned int a [200010]'
    5 | unsigned int i,a,k,a[200010],ans=0;
      |                    ^
a.cc:5:16: note: previous declaration as 'unsigned int a'
    5 | unsigned int i,a,k,a[200010],ans=0;
      |                ^
a.cc:6:10: error: 'n' was not declared in this scope
    6 |   cin >> n >> k;
      |          ^
a.cc:10:29: error: expected ';' before 'for'
   10 |   sort(a,a+n,greater<int>())
      |                             ^
      |                             ;
   11 |     for(i=k;i<n,i++){
      |     ~~~                      
a.cc:11:5: error: expected primary-expression before 'for'
   11 |     for(i=k;i<n,i++){
      |     ^~~
a.cc:10:29: error: expected ')' before 'for'
   10 |   sort(a,a+n,greater<int>())
      |                             ^
      |                             )
   11 |     for(i=k;i<n,i++){
      |     ~~~                      
a.cc:7:6: note: to match this '('
    7 |   for(i=0,i<n,i++){
      |      ^
a.cc:11:20: error: expected ';' before ')' token
   11 |     for(i=k;i<n,i++){
      |                    ^
      |                    ;
a.cc:12:14: error: invalid types 'unsigned int[unsigned int]' for array subscript
   12 |     ans=ans+a[i];
      |              ^
Language: C++

#include<iostream>
#include<algroithm>
using namespace std;
int main(){
unsigned int i,a,k,a[200010],ans=0;
  cin >> n >> k;
  for(i=0,i<n,i++){
  cin >> a[i];
  }
  sort(a,a+n,greater<int>())
    for(i=k;i<n,i++){
    ans=ans+a[i];
    }
  cout << ans << endl;
return 0;
}

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

#include<iostream>
using namespace std;
int main(){
  int a[200010],i,n,k;
  cin >> n >> k;
  for(i=0;i<n;i++){
  cin >> a[i];
    cin >> a[i];
  }
  sort(a,a+n,greater<int>());
  for(i=k;i<n;i++){
    ans=ans+a[i];
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(a,a+n,greater<int>());
      |   ^~~~
      |   short
a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |     ans=ans+a[i];
      |     ^~~
      |     abs
a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include<iostream>
#include<algorism>
using namespace std;
int main(){
  long long int ans=0,n,a[200005],k,i;
  cin >> n >> k;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a,a+n,greater<int>());
  for(i=k;i<n;i++){
    ans=ans+a[i];
  }
  cout << ans << endl;
  return 0;
}

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

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
long long int i,n,k,a[200010],ans=0;
  cin >> n >> k;
  for(i=0;i<n;i++){
  cin >> a[i]
  }
  sort(a,a+n,greater<int>());
    for(i=k;i<n;i++){
    ans=ans+a[i];
    }     
  cout << ans << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: expected ';' before '}' token
    8 |   cin >> a[i]
      |              ^
      |              ;
    9 |   }
      |   ~
Language: C++

#include<iostream>
#include<algorism>
using namespace std;
int main(){
  long long int n,a[200005],k,i;
  cin >> n >> k;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a,a+n,greater<int>());
  for(i=k;i<n;i++){
    ans=ans+a[i];
  }
  cout << ans << endl;
  return 0;
}

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

#include<iostream>
#include<algorithm>
using namespace std;
long long int main(){
long long int i,n,k,a[200010],ans=0;
  cin >> n >> k;
  for(i=0;i<n;i++){
  cin >> a[i]
  }
  sort(a,a+n,greater<int>());
    for(i=k;i<n;i++){
    ans=ans+a[i];
    }     
  cout << ans << endl;
return 0;
}

Compiler output:
a.cc:4:11: error: '::main' must return 'int'
    4 | long long int main(){
      |           ^~~
a.cc: In function 'int main()':
a.cc:8:14: error: expected ';' before '}' token
    8 |   cin >> a[i]
      |              ^
      |              ;
    9 |   }
      |   ~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n,k,a[200010],ans=0,i;
cin >> n >> k;
for(i=0;i<n;i++){
cin >> a[i];
}
sort(a,a+n,greater<int>());
for(i=k;i<n;i++)
ans=ans+a[i];
}
cout << ans <<endl;
  return 0;
  }

Compiler output:
a.cc:14:1: error: 'cout' does not name a type
   14 | cout << ans <<endl;
      | ^~~~
a.cc:15:3: error: expected unqualified-id before 'return'
   15 |   return 0;
      |   ^~~~~~
a.cc:16:3: error: expected declaration before '}' token
   16 |   }
      |   ^
Language: C++

#include<algorithm>
using namespace std;
int main(){
  int n,i,k,a[200010],ans;
  cin >> n >> k;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a,a+n,greater<int>());
  for(i=k;i<n;i++){
    ans=ans+a[i];
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   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<algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:9:14: error: 'greater' was not declared in this scope
    9 |   sort(a,a+n,greater<int>());
      |              ^~~~~~~
a.cc:9:22: error: expected primary-expression before 'int'
    9 |   sort(a,a+n,greater<int>());
      |                      ^~~
a.cc:13:3: error: 'cout' was not declared in this scope
   13 |   cout << ans << endl;
      |   ^~~~
a.cc:13:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:18: error: 'endl' was not declared in this scope
   13 |   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<algorithm>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,i,k,a[200010];
  cin >> n >> k;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a,a+n,greater<int>());
  for(i=k;i<n;i++){
    ans=ans+a[i];
  }
  cout << ans << endl;
  return 0;
}

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

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,k,h[1000000005],i,ans;
  cin >> n >>k;
  for(i=0;i<n;i++){
    cin >> h[i];
  }
  sort(h,h+n,greater<int>());
  for(i=k;i<n;i++){
    ans=ans+a[i];
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'a' was not declared in this scope
   12 |     ans=ans+a[i];
      |             ^
Language: C++

#include<iostream>
using namespace std;
int main(void){
  int h, k;
  cin >> h;
  cin >> k;
  long hp[h], sum;
  sum = 0;
  for(int i=0; i<h; i++){
    cin >> hp[i];
  }
  sort(hp, hp+h);
  for(int i=0; i<h-k; i++){
    sum += hp[i];
  }
  cout << sum;
}

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

#include<iostream>
using namespace std;
int main(void){
  int h, k;
  long hp[h], sum;
  sum = 0;
  for(int i=0; i<h; i++){
    cin >> hp[i];
  }
  sort(hp, hp+h);
  for(int i=0; i<h-k; i++){
    sum += hp[i];
  }
  cout << sum;
}

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

#include<stdio.h>
int main()
{
  	int N,K;
  	scanf("%d %d",&N,&K);
  	int H[N];
  	for(i=0;i<N;i++)
    {
  	scanf("%d",&H[i]);
    }
  	if(N<=K){
      printf("0");
    }
  	else{
    int i,j,tmp;
  	for (i=0; i<N; ++i) {
    for (j=i+1; j<N; ++j) {
      if (H[i] > H[j]) {
        tmp =  H[i];
        H[i] = H[j];
        H[j] = tmp;
     	 }
   	 }
 	 }
  	int sum=0;
  	for(j=K;j<N;j++)
    {
      sum=sum+H[j];
    }
  	printf("%d",sum);
    }
  	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:13: error: 'i' undeclared (first use in this function)
    7 |         for(i=0;i<N;i++)
      |             ^
main.c:7:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char const *argv[])
{
    unsigned long N, K, tmp;
    unsigned long result = 0;
    cin >> N >> K;
    vector<unsigned long> H;
    for (int i = 0; i < N; i++)
    {
        cin >> tmp;
        H.push_back(tmp);
    }
    sort(H.begin(), H.end());
    for (int j = 0; j < N - K; j++)
    {
        result += H[j];
    }
    cout << result << endl;
}


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

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

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

package sample;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main2 {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    
	    int N = scanner.nextInt();
	    int K = scanner.nextInt();
	    if(K>N) {
	    	System.out.println(0);
	    }else {
	    List<Integer> list = new ArrayList<Integer>();
	    
	    for(int i=0;i< N;i++){
	    	list.add(i,scanner.nextInt());
	    }
	    Collections.sort(list,Collections.reverseOrder());
	    
	     
	     int j = 0;
	     while(j<K) {
	    	 int i = 0;
	    	 list.remove(i);
	    	 j++;
	     }
	     long sum = 0;
	     for(int i = 0;i < N - K; i++) {
	    	 sum = list.get(i) + sum;
	     }
	     System.out.println(sum);
	}
	}
}


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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: declaration does not declare anything [-fpermissive]
    5 |         long long ;
      |              ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>

int main()
{
    long n, res, tmp, k;
    std::vector<int> h;

    std::cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        std::cin >> tmp;
        h.push_back(tmp);
    }
    std::sort(h.begin(), h.end());
    for (int i = 0; i < n - k; i++)
    {
        res += h[i];
    }

    std::cout << res << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   16 |     std::sort(h.begin(), h.end());
      |          ^~~~
      |          qsort
Language: C++

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

int main(void) {
  long long N, K;
  long long count = 0;
  cin >> N >> K;
  
  long long H[N];
  for(int i = 0; i < N; i++) {
    cin >> H[i];
  }
  
  sort(H, H+N, greater<long long>);
  
  for (int i = 0; i < N; i++) {
    if (K > 0) {
      count++;
      K--;
    }
    else {
      count += H[i];
    }
  }
  
  cout << count << endl;
  
  return 0;
}
    
  
  

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

#include<stdio.h>

int main(void){

    int n,k = 0;
    int i,j,tmp,h,count1 = 0;
    scanf("%d %d",&n,&k);

    int *a = new int[n];

    /*ここでhの配列を作成している*/
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    /*ここでa[]を昇順にソートしている*/
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            if(a[i]>a[j]){
                tmp = a[i];
                a[i] = a[j];
                a[j] = tmp;
            }
        }
    }
    /**/
    h = 0;
    for(i=0;i<n;i++){
        if(count1<k){
            count1++;
            continue;
        }
        h += a[i];
    }

    printf("h = %d",h);
    delete[] a;
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:14: error: 'new' undeclared (first use in this function)
    9 |     int *a = new int[n];
      |              ^~~
main.c:9:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:18: error: expected ',' or ';' before 'int'
    9 |     int *a = new int[n];
      |                  ^~~
main.c:36:5: error: 'delete' undeclared (first use in this function)
   36 |     delete[] a;
      |     ^~~~~~
main.c:36:12: error: expected expression before ']' token
   36 |     delete[] a;
      |            ^
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main()
{
  int enemy,skill;
  cin >> enemy >> skill;
  if(enemy < skill)
  {
    cout << "0" << endl;
    return;
  }
  int sum,copy;
  copy=enemy;
  
  int hp[enemy];
  while(enemy--)
  {
    cin >> hp[enemy-1];
  }
  sort(hp,hp+copy);
  copy -= skill;
  while(copy--)
  {
    sum += hp[skill-1];
    skill++;
  }
  cout << sum << endl;  
}

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

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main()
{
  int enemy,skill;
  cin >> enemy >> skill;
  if(enemy < skill)
  {
    cout << "0" << endl;
    return 1;
  }
  int sum,copy;
  copy=enemy;
  
  int hp[enemy];
  while(enemy--)
  {
    cin >> hp[enemy-1];
  }
  sort(hp,hp+copy);
  copy -= skill;
  while(copy--)
  {
    sum += hp[skill-1];
    skill++
  }
  cout << sum << endl;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:12: error: expected ';' before '}' token
   27 |     skill++
      |            ^
      |            ;
   28 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main()
{
  int enemy,skill;
  cin >> enemy >> skill;
  if(enemy < skill)
  {
    cout << "0" << endl;
    return 1;
  }
  int sum,copy;
  copy=enemy;
  
  int hp[enemy];
  while(enemy--)
  {
    cin >> hp[enemy-1];
  }
  sort(hp.begin(),hp.end() );
  copy -= skill;
  while(copy--)
  {
    sum += hp[skill-1];
    skill++
  }
  cout << sum << endl;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: request for member 'begin' in 'hp', which is of non-class type 'int [enemy]'
   22 |   sort(hp.begin(),hp.end() );
      |           ^~~~~
a.cc:22:22: error: request for member 'end' in 'hp', which is of non-class type 'int [enemy]'
   22 |   sort(hp.begin(),hp.end() );
      |                      ^~~
a.cc:27:12: error: expected ';' before '}' token
   27 |     skill++
      |            ^
      |            ;
   28 |   }
      |   ~