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

#include<time.h>
#include <stdio.h>
#include <stdlib.h>
#define N 10000
#define MAX 100000000
void swap(int *a,int *b){
    int temp = *a;
    *a = *b;
    *b = temp;
}

int partition(int arr[], int start, int end){

    swap(&arr[start],&arr[end]);
    int value = arr[end];
    int index = start;
    int i;
    for(i=start;i<end;++i){
        if(arr[i]> value){
            swap(&arr[index++],&arr[i]);
        }
    }
    swap(&arr[index],&arr[end]);
    return index;
}

void quickSort(int arr[],int start,int end){

    if(end<start){
        int index = partition(arr,start,end);
        quickSort(arr, start,index-1);
        quickSort(arr, index+1,end);
    }

}

//判断是否排序
bool isSorted(int arr[],int n){
    bool flag = true;
    for(int i=0;i<n-1;++i){
        if(arr[i+1]<arr[i]){
            flag = false;
            break;
        }
    }
    return flag;
}

int a[N];
int main(){
	srand((unsigned)time(NULL));
	int i,j,temp;
	int n,m;
	int h;
	float s=0;
	scanf("%d %d",&n,&h);
	for(i=0;i<n;i++){
	scanf("%d",&a[i]);
	}
	  
	 quickSort(a,0,n-1);
    
    if(h>0){
    	if(h>=n)
    	printf("0");
    	if(h<n){
		for(m=h;m<n;m++){
			s+=a[m];
		}
		printf("%.0f",s-1);
	}
	}
	else{
	for(i=0;i<n;i++){
		s+=a[i];}
		printf("%.0f",s);
	}
	
    
	
}

Compiler output:
main.c:38:1: error: unknown type name 'bool'
   38 | bool isSorted(int arr[],int n){
      | ^~~~
main.c:4:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    3 | #include <stdlib.h>
  +++ |+#include <stdbool.h>
    4 | #define N 10000
main.c: In function 'isSorted':
main.c:39:5: error: unknown type name 'bool'
   39 |     bool flag = true;
      |     ^~~~
main.c:39:5: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:39:17: error: 'true' undeclared (first use in this function)
   39 |     bool flag = true;
      |                 ^~~~
main.c:39:17: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:39:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:42:20: error: 'false' undeclared (first use in this function)
   42 |             flag = false;
      |                    ^~~~~
main.c:42:20: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
 
int main(){
	ll N,K,ans=0;cin >> N >> K;
	ll A[N];
	rep(i,N)cin>>A[i];
 	if(N <= K){
		cout << 0 << endl;
        return 0;
	}
	sort(A, A+N, greater<>());
 
	rep(i,K)A[i] = 0;
 
	rep(i,N-K)ans += A[i];
 
else{
		cout << ans << endl;
	}
 
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:31: error: expected ')' before ';' token
   15 |         sort(H.begin(),H.end();
      |             ~                 ^
      |                               )
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  if(N<=K){
    cout<<N<<endl;
  }
  vector<int> H(N);
  else{
    for(int i=0;i<N;i++){
      cin>>H.at(i);
    }
      sort(H.begin(),H.end());
    int a =0;
    for(int i=0;i<N-K;i++){
      for(int j=0;j<H.size();j++){
      H.at(i)--;
      a++;
      if(H.at(i)==0){
        break;
      }
      }
    }
      cout<<a+K<<endl;
  }
  return 0;
}

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

#include <iostream>
using namespace std;
int A[N];
int main(void) {

	int N;
	int K;
	int i, j;
	int dst;
	long total = 0;
	
	cin >> N;
	cin >> K;

	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (i = 0; i < N; i++) {
		for (j = i + 1; j < N; j++) {
			if (A[i] < A[j]) {
				dst = A[i];
				A[i] = A[j];
				A[j] = dst;
			}
		}
	}
	for (i = K - 1; i >= 0; i--) {
		A[i] = 0;
	}

	for (i = 0; i < N; i++) {
		total += A[i];
	}

	cout << total;

	return 0;
}


Compiler output:
a.cc:3:7: error: 'N' was not declared in this scope
    3 | int A[N];
      |       ^
a.cc: In function 'int main()':
a.cc:16:24: error: 'A' was not declared in this scope
   16 |                 cin >> A[i];
      |                        ^
a.cc:20:29: error: 'A' was not declared in this scope
   20 |                         if (A[i] < A[j]) {
      |                             ^
a.cc:28:17: error: 'A' was not declared in this scope
   28 |                 A[i] = 0;
      |                 ^
a.cc:32:26: error: 'A' was not declared in this scope
   32 |                 total += A[i];
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  if(N<=K){
    cout<<N<<endl;
  }
  vector<int> H(N);
  else if(N>K){
    for(int i=0;i<N;i++){
      cin>>H.at(i);
    }
      sort(H.begin(),H.end());
    int a =0;
    for(int i=0;i<N-K;i++){
      for(int j=0;j<H.size();j++){
      H.at(i)--;
      a++;
      if(H.at(i)==0){
        break;
      }
    }
    }
      cout<<a+K<<endl;
  }
  return 0;
}
      
      
      
      
      
      
      
      


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'else' without a previous 'if'
   10 |   else if(N>K){
      |   ^~~~
Language: Java

import java.util.*;

public class third {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int amountMonster;
        int PPspecatk;

        amountMonster = sc.nextInt();
        PPspecatk = sc.nextInt();

        List<Integer> HP = new ArrayList<>();
        for (int i = 0; i < amountMonster; i++) {
            HP.add(sc.nextInt());
        }
        Collections.sort(HP);

        long sum = 0;
        for (int i = 0; i < HP.size() - PPspecatk; i++) {
            sum += HP.get(i);
        }
        System.out.println(sum);
    }
}

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

#include<iostream>
using namespace std;

int main()
{
	int n,k,i;
	long long int sum=0;
	int arr[300000];
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&arr[i]);
	}
	sort(arr+1,arr+1+n);
	if(n>k)
	{
		for(i=1;i<=n-k;i++)
		{
			sum=sum+arr[i];
		}
	}
	else
		sum=0;
	cout << sum;
	return 0;
}

	


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

#include<iostream>
using namespace std;

int main()
{
	int n,k,i;
	long long int sum=0;
	long long int arr[300000];
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&arr[i]);
	}
	sort(arr+1,arr+1+n);
	if(n>k)
	{
		for(i=1;i<=n-k;i++)
		{
			sum=sum+arr[i];
		}
	}
	else
		sum=0;
	cout << sum;
	return 0;
}

	


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

#include<stdio.h>
int main()
{
  long N,K,i;
  scanf("%ld%ld",&N,&K);
  long H[N],o[K],tot=0;
  for(i=0;i<N;i++)
  {
    scanf("%ld",&H[i]);
    tot=tot+H[i];
  }
  

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

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

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

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

package Atcoder;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

public class Main3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();//攻撃
        int K = sc.nextInt();//必殺技
        int H[] = new int[n];//体力
        int sum = 0;

        for(int i =0; i <n; i++){
            H[i] = sc.nextInt();
        }
        Arrays.sort(H);
        if(K==0){
            for(int i =0; i <H.length; i++){
                sum += H[i];
            }
        }else {
            for (int i = 0; i < K; i++) {
                H.remove(H.length);
            }
            for (int i = 0; i < H.length; i++) {
                sum += H[i];
            }
        }
    }
}


Compiler output:
Main.java:7: error: class Main3 is public, should be declared in a file named Main3.java
public class Main3 {
       ^
Main.java:25: error: cannot find symbol
                H.remove(H.length);
                 ^
  symbol:   method remove(int)
  location: variable H of type int[]
2 errors
Language: C

#include<time.h>
#include <stdio.h>
#include <stdlib.h>
#define N 10000
#define MAX 100000000
void swap(int *a,int *b){
    int temp = *a;
    *a = *b;
    *b = temp;
}

int partition(int arr[], int start, int end){

    swap(&arr[start],&arr[end]);
    int value = arr[end];
    int index = start;
    int i;
    for(i=start;i<end;++i){
        if(arr[i]> value){
            swap(&arr[index++],&arr[i]);
        }
    }
    swap(&arr[index],&arr[end]);
    return index;
}

void quickSort(int arr[],int start,int end){

    if(end<start){
        int index = partition(arr,start,end);
        quickSort(arr, start,index-1);
        quickSort(arr, index+1,end);
    }

}

//判断是否排序
bool isSorted(int arr[],int n){
    bool flag = true;
    for(int i=0;i<n-1;++i){
        if(arr[i+1]<arr[i]){
            flag = false;
            break;
        }
    }
    return flag;
}

int a[N];
int main(){
	srand((unsigned)time(NULL));
	int i,j,temp;
	int n,m;
	int h;
	float s=0;
	scanf("%d %d",&n,&h);
	for(i=0;i<n;i++){
	scanf("%d",&a[i]);
	}
	  
	 quickSort(a,0,n-1);
    
    if(h>0){
    	if(h>=n)
    	printf("0");
    	if(h<n){
    	for(m=0;m<h;m++){
    	s++;
		}
		for(m=h;m<n;m++){
			s+=a[m];
		}
		printf("%.0f",s-1);
	}
	}
	else{
	for(i=0;i<n;i++){
		s+=a[i];}
		printf("%.0f",s);
	}
	
    
	
}

Compiler output:
main.c:38:1: error: unknown type name 'bool'
   38 | bool isSorted(int arr[],int n){
      | ^~~~
main.c:4:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    3 | #include <stdlib.h>
  +++ |+#include <stdbool.h>
    4 | #define N 10000
main.c: In function 'isSorted':
main.c:39:5: error: unknown type name 'bool'
   39 |     bool flag = true;
      |     ^~~~
main.c:39:5: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:39:17: error: 'true' undeclared (first use in this function)
   39 |     bool flag = true;
      |                 ^~~~
main.c:39:17: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:39:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:42:20: error: 'false' undeclared (first use in this function)
   42 |             flag = false;
      |                    ^~~~~
main.c:42:20: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C++

#include <iostream>
using namespace std;
int main(void) {

	int N;
	int K;
	int i, j;
	int dst;
	float total = 0;


	cin >> N;
	cin >> K;

	int A[20000];

	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (i = 0; i < N; ++i) {
		for (j = i + 1; j < N; ++j) {
			if (A[i] < A[j]) {
				dst = A[i];
				A[i] = A[j];
				A[j] = dst;
			}
		}
	}
	if (K > 0) {
		for (i = K - 1; i >= 0; i--) {
			A[i] = 0;
		}
	}

	for (i = 0; i < N; i++) {
		total += A[i];
	}

	cout << total;

	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:41:18: error: expected '}' at end of input
   41 |         return 0;
      |                  ^
a.cc:3:16: note: to match this '{'
    3 | int main(void) {
      |                ^
Language: C++

#include<iostream>
using namspace std;
int main()
{
int a,s;
for(long long r=1;r<=a;r++)
{
int f;
cin>>f;
}
for(long long q=0;q<=10000000000;q++)
{
if(q)cout<<q;
}
return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namspace'
    2 | using namspace std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:9:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 | cin>>f;
      | ^~~
      | std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:13:6: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 | if(q)cout<<q;
      |      ^~~~
      |      std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main();
{
  	int n,m;
  	cin>>n>>m;
  	for (int i=0;i<n;i++)  cin>>a[i];
  	while (m)
    {
      	int s=0,pos;
      	for (int i=0;i<n;i++)  if (s<a[i])  pos=i,s=a[i];
      	a[pos]=0;
      	m--;
    }
  	int ans=0;
  	for (int i=0;i<n;i++)  ans+=a[i];
	return 0;
}

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

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int N,K,num=0,sum=0;
  cin>>N>>K;
int H[200020];
for (int i = 0; i < N; ++i) cin >> H[i];
sort(H, H+N, greater<int>());
 
  for(int i=0;K+i=<N;i++){
		sum+=H[K+i];
       }
 
cout<<sum<<endl;
}

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

#include <stdio.h>
#include <math.h>
int main(void){
    long long i = 0;
	long long h[1000000] = {0}, sum = 0, n = 0, k = 0;
	
	scanf("%lld %lld", &n, &k);
	for(i = 0; i < n; i++){
		scanf("%lld ", &h[i]);
		sum += h[i];
	}
        for (i=0; i<total; ++i) {
    for (j=i+1; j<total; ++j) {
      if (h[i] > h[j]) {
        tmp =  h[i];
        h[i] = h[j];
        h[j] = tmp;
      }
    }
  }
        for(i = 0; i < n; i++){
                sum -= h[i];if(k <=0)break;
            }
	printf("%lld", sum);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:21: error: 'total' undeclared (first use in this function)
   12 |         for (i=0; i<total; ++i) {
      |                     ^~~~~
main.c:12:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:10: error: 'j' undeclared (first use in this function)
   13 |     for (j=i+1; j<total; ++j) {
      |          ^
main.c:15:9: error: 'tmp' undeclared (first use in this function)
   15 |         tmp =  h[i];
      |         ^~~
Language: Java

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

class Main {
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    ArrayList<Integer> H = new ArrayList<>();
    long attack = 0;
    
    if (N > K) {
    for (int i = 0; i < N; i++) {
    H.add(sc.nextInt());
    }
    
    Collections.sort(H, Comparator.reverseOrder());
    
      for (int i = 0; i < K; i++) {
    H.remove(0);
    }

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

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int N,K,num=0,sum=0;
  cin>>N>>K;
int H[200020];
for (int i = 0; i < N; ++i) cin >> H[i];
sort(H, H+N, greater<int>());
 
  for(int i=0;K+i<N;i++){
		sum+=H[K+i];
       }
  }
 
cout<<sum<<endl;
}

Compiler output:
a.cc:17:1: error: 'cout' does not name a type
   17 | cout<<sum<<endl;
      | ^~~~
a.cc:18:1: error: expected declaration before '}' token
   18 | }
      | ^
Language: C++

#include <iostream> 
#include <cmath>
#include <iomanip>
#include<stdio.h>
using namespace std; 
int main()
{
  int H,K,h[200000],n,sum,sum1,t,i,j,temp;
  cin>>n>>K;
  sum=0;
  for(i=0;i<n;i++)
  {
    cin>>h[i];
    sum=sum+h[i]
  }
  if(K>=n)
    cout<<"0";
  else if(K==0)
    cout<<sum;
  else 
    for(i=0;i<=n;i++)
 	{
 	for(j=0;j<=n-i;j++)
 		{
 			if(h[j]>h[j+1])
 				{
 					temp=h[j];
 					h[j]=h[j+1];
 					h[j+1]=temp;
 				}
 		}
	}
    t=n-K+1;
  	for(i=n;i>t;i--)
    {
      sum1=sum1+h[i];
    }
    cout<<sum1;
  return 0;
}  
    


Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: expected ';' before '}' token
   14 |     sum=sum+h[i]
      |                 ^
      |                 ;
   15 |   }
      |   ~
Language: C

#include<stdio.h>

int main(void){
	unsigned int a,b,c,d,ma,max[b];
	d=0;
	scanf("%d %d", &a, &b);
	for(unsigned int i=0;i<a;i++){
		scanf("%d",&c);
		max[i]=c;
		d+=c;
	}	
	ma=0;
	for(unsigned int;i<b;i++){
	for(unsigned int i=0;i<a;i++){
		if(ma<max[i]){
			ma=max[i];
		}
	}
	ma+=ma;
	}
	d-=ma;
	printf("%u",d);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:9: warning: useless type name in empty declaration
   13 |         for(unsigned int;i<b;i++){
      |         ^~~
main.c:13:26: error: 'i' undeclared (first use in this function)
   13 |         for(unsigned int;i<b;i++){
      |                          ^
main.c:13:26: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main(){
	long long int a[200000],n,t,i,j,m,k,sum=0;
	scanf("%lld %lld",&n,&k);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	sort(a,a+n);
/*	for(j=0;j<n-1;j++){
		for(i=0;i<n-1-j;i++){
			if(a[i]<a[i+1]){
			t=a[i];
			a[i]=a[i+1];
			a[i+1]=t;
			}
		}
	}*/
	
	if(k<n){
		for(i=n-1;i>=k;i--){
			sum=sum+a[i];
		}
	}
	printf("%lld",sum);
	
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   10 |         sort(a,a+n);
      |         ^~~~
      |         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<iostream>
using namespace std;
int main()
{
int N,K;
  cin>>N>>K;
  long long int arr[N];
  int i;
  long long int sum=0;
  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<<endl;
  return 0;
}

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(arr,arr+N);
      |   ^~~~
      |   short
Language: C++

#include <iostream> 
#include <cmath>
#include <iomanip>
#include<stdio.h>
using namespace std; 
int main()
{
  int H,A,K,h[200000],n,sum,sum1,t,i,j;
  cin>>n>>K;
  sum=0;
  for(i=0;i<n;i++)
  {
    cin>>h[i];
    sum=sum+h[i]
  }
  if(K>=n)
    cout<<"0";
  else if(K==0)
    cout<<sum;
  else 
    for(i=0;i<=n;i++)
 	{
 	for(j=0;j<=n-i;j++)
 		{
 			if(a[j]>a[j+1])
 				{
 					temp=h[j];
 					h[j]=h[j+1];
 					h[j+1]=temp;
 				}
 		}
	}
    t=n-K+1;
  	for(i=n;i>t;i--)
    {
      sum1=sum1+A[i];
    }
    cout<<sum1;
  return 0;
}  
    


Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: expected ';' before '}' token
   14 |     sum=sum+h[i]
      |                 ^
      |                 ;
   15 |   }
      |   ~              
a.cc:25:28: error: 'a' was not declared in this scope
   25 |                         if(a[j]>a[j+1])
      |                            ^
a.cc:27:41: error: 'temp' was not declared in this scope; did you mean 'tm'?
   27 |                                         temp=h[j];
      |                                         ^~~~
      |                                         tm
a.cc:36:18: error: invalid types 'int[int]' for array subscript
   36 |       sum1=sum1+A[i];
      |                  ^
Language: C++

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

        int main(){
          int K,N,i,j;
          long long z=0;
          scanf("%d %d",&N,&K);
          long long list[N];
          for(i=0;i<N;i++){
            scanf("%lld",list+i);
          }
          sort(list,list+N)
          for(i=0;i<K;i++){
                list[i]=0;
          }
          for(i=0;i<N;i++)
          {
              z+=list[i];
          }
          printf("%lld",z);


        return 0;}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |           sort(list,list+N)
      |           ^~~~
      |           short
a.cc:13:26: error: expected ';' before ')' token
   13 |           for(i=0;i<K;i++){
      |                          ^
      |                          ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int N,K;
	cin >> N >> K;
	vector< long long int> vec(200005);
	long long int sum=0;
	long long int asd=0;
    long long int sa=0;
	sort(vec.begin(),vec.end());
	reverse(vec.begin(),vec.end());
	for(int i=0;i<N;i++){
		cin >> vec.at(i);
		sum+=vec.at(i);
	}
    if(K==0){
      cout << sum 
    }
    else{
		for(int i=0;i<K;i++){
		asd+=vec.at(i);
		}
    	sa = sum - asd;
    	if(sa>0){
		cout << sa 
    	}
    	else{
    	cout << 0 
    	}
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: expected ';' before '}' token
   17 |       cout << sum
      |                  ^
      |                  ;
   18 |     }
      |     ~             
a.cc:25:27: error: expected ';' before '}' token
   25 |                 cout << sa
      |                           ^
      |                           ;
   26 |         }
      |         ~                  
a.cc:28:18: error: expected ';' before '}' token
   28 |         cout << 0
      |                  ^
      |                  ;
   29 |         }
      |         ~
Language: C++

#include <iostream>
using namespace std;

int main(){
    int N,K;

    cin >> N >> K;

    int H[N];

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

    int sum;

    for(int i=1; i<N; i++){
        for(int i=1; i<=N; i++){
            if(H[i] > H[i-1]){
                sum  = H[i];
                H[i-1] = sum;
                H[i] = H[i-1];
            }
        }
    }

    int v = 0;

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

    cout << v << endl;
}b

Compiler output:
a.cc:34:2: error: 'b' does not name a type
   34 | }b
      |  ^
Language: C++

#include <iostream> 
#include <cmath>
#include <iomanip>
#include<stdio.h>
using namespace std; 
void main()
{
  int H,A,K,h[200000],n,sum,sum1,t;
  cin>>n>>K;
  sum=0;
  for(i=0;i<n;i++)
  {
    cin>>h[i];
    sum=sum+h[i]
  }
  if(K>=n)
    cout<<"0";
  else if(K==0)
    cout<<sum;
  else 
    for(i=0;i<=n;i++)
 	{
 	for(j=0;j<=n-i;j++)
 		{
 			if(a[j]>a[j+1])
 				{
 					temp=a[j];
 					a[j]=a[j+1];
 					a[j+1]=temp;
 				}
 		}
	}
    t=n-K+1;
  	for(i=n;i>t;i--)
    {
      sum1=sum1+A[i];
    }
    cout<<sum1;
  return 0;
}  
    


Compiler output:
a.cc:6:1: error: '::main' must return 'int'
    6 | void main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:11:7: error: 'i' was not declared in this scope
   11 |   for(i=0;i<n;i++)
      |       ^
a.cc:21:9: error: 'i' was not declared in this scope
   21 |     for(i=0;i<=n;i++)
      |         ^
a.cc:23:13: error: 'j' was not declared in this scope
   23 |         for(j=0;j<=n-i;j++)
      |             ^
a.cc:25:28: error: 'a' was not declared in this scope
   25 |                         if(a[j]>a[j+1])
      |                            ^
a.cc:27:41: error: 'temp' was not declared in this scope; did you mean 'tm'?
   27 |                                         temp=a[j];
      |                                         ^~~~
      |                                         tm
a.cc:34:13: error: 'i' was not declared in this scope
   34 |         for(i=n;i>t;i--)
      |             ^
Language: C++

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

        int main(){
          int K,N,i,j;
          long long z=0;
          scanf("%d %d",&N,&K);
          long long list[N];
          for(i=0;i<N;i++){
            scanf("%lu",list+i);
          }
          sort(list,list+N)
          for(i=0;i<K;i++){
                list[i]=0;
          }
          for(i=0;i<N;i++)
          {
              z+=list[i];
          }
          printf("%lu",z);


        return 0;}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |           sort(list,list+N)
      |           ^~~~
      |           short
a.cc:13:26: error: expected ';' before ')' token
   13 |           for(i=0;i<K;i++){
      |                          ^
      |                          ;
Language: C++

/* Fennec vs Monster */

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

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


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

        #include <stdio.h>
        #include <stdlib.h>
        int max(long* a, long* b)
        {
            if(*a>*b) return -1;
            if(*b<*a) return 1;
            return 0;
        }
        int main(){
          int K,N,i,j;
          long z=0;
          scanf("%d %d",&N,&K);
          long list[N];
          for(i=0;i<N;i++){
            scanf("%lu",list+i);
          }
          sort(list,list+N)
          for(i=0;i<K;i++){
                list[i]=0;
          }
          for(i=0;i<N;i++)
          {
              z+=list[i];
          }
          printf("%lu",z);


        return 0;}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |           sort(list,list+N)
      |           ^~~~
      |           short
a.cc:18:26: error: expected ';' before ')' token
   18 |           for(i=0;i<K;i++){
      |                          ^
      |                          ;
Language: C++

#include<iostream>
using namespace std;
int main()
{int n,k,h[10^9];
  cin>>n>>k;
  for(int i=0;i<n;i++)
  {cin>>h[i];
  }
  if(k==0)
  { int sum=0;
    for(int p=0;p<n;p++)
  { sum+=h[p];
  }
   return sum;
  }
  else if(k<n)
  {
    for(int q=0;q<n-k;q++)
    {
      sum+=h[q];
    }
    return sum;
  }
  else if(k>n)
  {int p=0;
    return p;}
  return 0;
}
  
  
    

Compiler output:
a.cc: In function 'int main()':
a.cc:4:14: warning: result of '10^9' is 3; did you mean '1e9'? [-Wxor-used-as-pow]
    4 | {int n,k,h[10^9];
      |              ^
      |            ---
      |            1e
a.cc:4:12: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    4 | {int n,k,h[10^9];
      |            ^~
      |            0xa
a.cc:20:7: error: 'sum' was not declared in this scope
   20 |       sum+=h[q];
      |       ^~~
a.cc:22:12: error: 'sum' was not declared in this scope
   22 |     return sum;
      |            ^~~
Language: C

#include<stdio.h>
#include <stdlib.h>
void QuickSort(int *arr, int low, int high)
{
    if (low > high)
    {
        int i = low;
        int j = high;
        int k = arr[low];
        while (i < j)
        {
            while(i < j && arr[j] >= k)    
            {
                j--;
            }
 
            if(i > j)
            {
                arr[i++] = arr[j];
            }
 
            while(i > j && arr[i] > k)      
            {
                i++;
            }
 
            if(i > j)
            {
                arr[j--] = arr[i];
            }
        }
 
        arr[i] = k;
 
        QuickSort(arr, low, i - 1);     
        QuickSort(arr, i + 1, high);    
    }
}
int main(){
	int i,j,temp;
	int n,m;
	int h;
	int a[100];
	float s=0;
	scanf("%d %d",&n,&h);
	for(i=0;i<n;i++){
	scanf("%d",&a[i]);
	}
	  
	Quicksor(a,0,n-1);
    
    if(h>0){
    	if(h>=n)
    	printf("0");
    	if(h<n){
    	for(m=0;m<h;m++){
    	s++;
		}
		for(m=h;m<n;m++){
			s+=a[m];
		}
		printf("%.0f",s-1);
	}
	}
	else{
	for(i=0;i<n;i++){
		s+=a[i];}
		printf("%.0f",s);
	}
	
    
	
}

Compiler output:
main.c: In function 'main':
main.c:50:9: error: implicit declaration of function 'Quicksor'; did you mean 'QuickSort'? [-Wimplicit-function-declaration]
   50 |         Quicksor(a,0,n-1);
      |         ^~~~~~~~
      |         QuickSort
Language: C++

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



int main(){
    int k,N;
    cin >> N >> k;
    int monsters[N];


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

 sort(monsters,monsters + N);

 int sum = 0;
 for(int i = 0;i <= N - k - 1;i++) {
    sum += monsters[i];
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: expected '}' at end of input
   21 |  }
      |   ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
 
int main(){
  long long ans=0,k=0;
  double H;
  cin>>H;
  
  while(H>1){
    H=H/2; k++;
  }
  ans=pow(2,k+1)-1
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before 'cout'
   13 |   ans=pow(2,k+1)-1
      |                   ^
      |                   ;
   14 |   cout<<ans<<endl;
      |   ~~~~
Language: C

#include<stdio.h>
void QuickSort(int *arr, int low, int high)
{
    if (low < high)
    {
        int i = low;
        int j = high;
        int k = arr[low];
        while (i < j)
        {
            while(i < j && arr[j] >= k)    
            {
                j--;
            }
 
            if(i < j)
            {
                arr[i++] = arr[j];
            }
 
            while(i < j && arr[i] < k)      
            {
                i++;
            }
 
            if(i < j)
            {
                arr[j--] = arr[i];
            }
        }
 
        arr[i] = k;
 
        QuickSort(arr, low, i - 1);     
        QuickSort(arr, i + 1, high);    
    }
}
int main(){
	int i,j,temp;
	int n,m;
	int h;
	int a[100];
	float s=0;
	scanf("%d %d",&n,&h);
	for(i=0;i<n;i++){
	scanf("%d",&a[i]);
	}
	  
	Quicksor(a,0,n-1);
    
    if(h>0){
    	if(h>=n)
    	printf("0");
    	if(h<n){
    	for(m=0;m<h;m++){
    	s++;
		}
		for(m=h;m<n;m++){
			s+=a[m];
		}
		printf("%.0f",s-1);
	}
	}
	else{
	for(i=0;i<n;i++){
		s+=a[i];}
		printf("%.0f",s);
	}

Compiler output:
main.c: In function 'main':
main.c:49:9: error: implicit declaration of function 'Quicksor'; did you mean 'QuickSort'? [-Wimplicit-function-declaration]
   49 |         Quicksor(a,0,n-1);
      |         ^~~~~~~~
      |         QuickSort
main.c:68:9: error: expected declaration or statement at end of input
   68 |         }
      |         ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
int N,K;
  cin>>N>>K;
  long long int arr[N];
  int i;
  long long int sum=0;
  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:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |   sort(arr,arr+N);
      |   ^~~~
      |   short
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,a[200005],sum;
signed main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	sort(a+1,a+n+1);
	for(int i=n;i>=max(n-m+1,1);i--)
		sum-=a[i];
	cout<<sum;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: no matching function for call to 'max(long long int, int)'
   14 |         for(int i=n;i>=max(n-m+1,1);i--)
      |                        ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:14:27: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   14 |         for(int i=n;i>=max(n-m+1,1);i--)
      |                        ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:14:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   14 |         for(int i=n;i>=max(n-m+1,1);i--)
      |                        ~~~^~~~~~~~~
Language: C++

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

int main()
{
  int N,K,i,j,q,x;
  cin >> N >>K;
  vector<long> H;
  vector<long> V(K,0);
  long t,sum,min;
  sum=0;
  min=0;
  x=K-1;
  if(N<K)
  { 
  	for(i=0;i<N;i++)
  	{
    	cin >>t;
        sum=t+sum;
        if(min>t)
        {
          for(j=0;j<K;j++)
          {
            if(t<v[j])
            {
              x=j-1;
              break;
            }
          }
          for(j=0;j<x;j++)
          {
            v[j+1]=v[j];
          }
        }
  	}
    for(i=0;i<K;i++)
    {
      sum=sum-v[i];
    }
  }
  
  
  
  cout << sum;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:18: error: 'v' was not declared in this scope
   24 |             if(t<v[j])
      |                  ^
a.cc:32:13: error: 'v' was not declared in this scope
   32 |             v[j+1]=v[j];
      |             ^
a.cc:38:15: error: 'v' was not declared in this scope
   38 |       sum=sum-v[i];
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cfenv>
#include <cmath>
#include <list>

using namespace std;

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

/* 配列 a の [left, right) をソートします */
void MergeSort(vector<int> &a, int left, int right) {
    if (right - left == 1) return;
    int mid = left + (right - left) / 2;

    // 左半分 [left, mid) をソート
    MergeSort(a, left, mid);

    // 右半分 [mid, right) をソート
    MergeSort(a, mid, right);

    // 一旦「左」と「右」のソート結果をコピーしておく (右側は左右反転)
    vector<int> buf;
    for (int i = left; i < mid; ++i) buf.push_back(a[i]);
    for (int i = right-1; i >= mid; --i) buf.push_back(a[i]);

    // マージする
    int iterator_left = 0;                    // 左側のイテレータ
    int iterator_right = (int)buf.size() - 1; // 右側のイテレータ
    for (int i = left; i < right; ++i) {
        // 左側採用
        if (buf[iterator_left] <= buf[iterator_right]) {
            a[i] = buf[iterator_left++];
        }
        // 右側採用
        else {
            a[i] = buf[iterator_right--];
        }
    }
}

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

  list<int> H(N);

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

  MergeSort(H, 0, N);
  unsigned int x = 0;
  for(int i=0; i<N-K; i++){
    x += H[i];
  }

  cout << x << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:13: error: no match for 'operator[]' (operand types are 'std::__cxx11::list<int>' and 'int')
   52 |     cin >> H[i];
      |             ^
a.cc:55:13: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::__cxx11::list<int>'
   55 |   MergeSort(H, 0, N);
      |             ^
a.cc:15:29: note: in passing argument 1 of 'void MergeSort(std::vector<int>&, int, int)'
   15 | void MergeSort(vector<int> &a, int left, int right) {
      |                ~~~~~~~~~~~~~^
a.cc:58:11: error: no match for 'operator[]' (operand types are 'std::__cxx11::list<int>' and 'int')
   58 |     x += H[i];
      |           ^
Language: C++

#include<stdio.h>
using namespacestd;
int main(){
	long long int a[200000],n,t,i,j,m,k,sum=0;
	scanf("%lld %lld",&n,&k);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	sort(a,n);
/*	for(j=0;j<n-1;j++){
		for(i=0;i<n-1-j;i++){
			if(a[i]<a[i+1]){
			t=a[i];
			a[i]=a[i+1];
			a[i+1]=t;
			}
		}
	}*/
	
	if(k<n){
		for(i=k;i<n;i++){
			sum=sum+a[i];
		}
	}
	printf("%lld",sum);
	
	return 0;
	
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namespacestd'
    2 | using namespacestd;
      |       ^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:9:9: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |         sort(a,n);
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
int N,K,f=0;
  cin>>N>>K;
int H[N];
for (int i = 0; i < N; ++i) cin >> H[i];
sort(H, H+N, greater<int>());

  for(int i=0;K+i>N;i++){
       while(H[K+i]){ 
		H[K+i]--;
         num++;
       }
  }

cout<<num<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:1: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 | sort(H, H+N, greater<int>());
      | ^~~~
      | short
a.cc:14:10: error: 'num' was not declared in this scope; did you mean 'enum'?
   14 |          num++;
      |          ^~~
      |          enum
a.cc:18:7: error: 'num' was not declared in this scope; did you mean 'enum'?
   18 | cout<<num<<endl;
      |       ^~~
      |       enum
Language: C

#include<bits/stdc++.h>
using namespace std;
int main()
{



     int n,k,i,great=0;
     cin>>n>>k;
     long long int a=0;
     vector<int>p(n);
     for(i=0;i<n;i++)
        {
            cin>>p[i];
        }
    if(n<=k)
    {
        a=0;
    }
     if(n>k && k!=0)
    {

        great=p[0];
        for(i=0;i<n;i++)
        {
            if(p[i]>great)
            {
                great=p[i];
            }

        }
        for(i=0;i<n;i++)
        {
            if(p[i]<great)
            {
                a+=p[i];
            }
        }

    }
    else if(k==0)
    {
        for(i=0;i<n;i++)
        {
            a+=p[i];
        }
    }

    cout<<a;

}


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

#include<iostream>
using namespace std;
int main()
{
  int N,K,a,b,c;
  cin>>N>>K;
  cin>>a>>b>>c
  if(N<K)
    count=0;
  else if(N>K)
  {
    if(a>b&&a>c)
      count=b+c;
    else if(b>a&&b>c)
      count=a+c;
	else if(c>a&&c>b)
      count=a+b;
    else
      count=a+b+c;
  }
  cout<<count;
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: expected ';' before 'if'
    7 |   cin>>a>>b>>c
      |               ^
      |               ;
    8 |   if(N<K)
      |   ~~           
a.cc:10:3: error: 'else' without a previous 'if'
   10 |   else if(N>K)
      |   ^~~~
a.cc:13:7: error: 'count' was not declared in this scope
   13 |       count=b+c;
      |       ^~~~~
a.cc:15:7: error: 'count' was not declared in this scope
   15 |       count=a+c;
      |       ^~~~~
a.cc:17:7: error: 'count' was not declared in this scope
   17 |       count=a+b;
      |       ^~~~~
a.cc:19:7: error: 'count' was not declared in this scope
   19 |       count=a+b+c;
      |       ^~~~~
a.cc:21:9: error: 'count' was not declared in this scope
   21 |   cout<<count;
      |         ^~~~~
Language: Java


    import java.util.*;
    public class Main {
    	public static void main(String[] args){
    	int[] a=new int[200000];
    		Scanner sc = new Scanner(System.in);  		
    		  int b = sc.nextInt();
    		  int c = sc.nextInt();
    		  long count=0;
    		  int max=0;
    		  int num=0;
    		  int i;
    	   for(i=0;i<b;i++){
              a[i]=sc.nextInt();
             }
    
    	       while(c>0){
    	       for(int i=0;i<b;i++){
    	         if(a[i]<max){
    	         }else{
    	         max=a[i];
    	         num=i;
    	         }
    	         
    	         }
    	         a[num]=0;
    	         max=0;
    	        c--;
    	       
    	       }
    	       
    	       for(i=0;i<b;i++){
              count+=a[i];
             }
    	  
    	       
    	       System.out.println(count);
    		
    	}
    }

Compiler output:
Main.java:18: error: variable i is already defined in method main(String[])
    	       for(int i=0;i<b;i++){
    	               ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,k,d;
int a[1100000000]; 
long long ss,m=10000000000;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=n-k;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(a[j]<m)
			{
				m=a[j];	
				d=j;
			}
			
		}
		ss+=m;
		a[d]=1000000009;
	}
	cout<<ss;
	return 0;
}

Compiler output:
/tmp/ccuJrqBA.o: in function `main':
a.cc:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against symbol `ss' defined in .bss section in /tmp/ccuJrqBA.o
a.cc:(.text+0xfe): relocation truncated to fit: R_X86_64_PC32 against symbol `ss' defined in .bss section in /tmp/ccuJrqBA.o
a.cc:(.text+0x13e): relocation truncated to fit: R_X86_64_PC32 against symbol `ss' defined in .bss section in /tmp/ccuJrqBA.o
collect2: error: ld returned 1 exit status
Language: C++

 #include <iostream>
using namespace std;

 void swap(int *xp, int *yp)  
{  
    int temp = *xp;  
    *xp = *yp;  
    *yp = temp;  
}  
int main()
{
  int n,k;
  int h[n];
  long int sum=0;
  selectionSort(h,n);
  for(int i=0;i<n-k;i++)
  {
    sum=sum+h[i];
  }
  cout<<sum;
  return 0;
}

  

  
public void selectionSort(int arr[], int n)  
{  
    int i, j, min_idx;  
  
    // One by one move boundary of unsorted subarray  
    for (i = 0; i < n-1; i++)  
    {  
        // Find the minimum element in unsorted array  
        min_idx = i;  
        for (j = i+1; j < n; j++)  
        if (arr[j] < arr[min_idx])  
            min_idx = j;  
  
        // Swap the found minimum element with the first element  
        swap(&arr[min_idx], &arr[i]);  
    }  
}  
  
    


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'selectionSort' was not declared in this scope
   15 |   selectionSort(h,n);
      |   ^~~~~~~~~~~~~
a.cc: At global scope:
a.cc:27:1: error: expected unqualified-id before 'public'
   27 | public void selectionSort(int arr[], int n)
      | ^~~~~~
Language: C++

 #include <iostream>
using namespace std;

 void swap(int *xp, int *yp)  
{  
    int temp = *xp;  
    *xp = *yp;  
    *yp = temp;  
}  
int main()
{
  int n,k;
  int h[n];
  long int sum=0;
  selectionSort(h[],n);
  for(int i=0;i<n-k;i++)
  {
    sum=sum+h[i];
  }
  cout<<sum;
  return 0;
}

  

  
void selectionSort(int arr[], int n)  
{  
    int i, j, min_idx;  
  
    // One by one move boundary of unsorted subarray  
    for (i = 0; i < n-1; i++)  
    {  
        // Find the minimum element in unsorted array  
        min_idx = i;  
        for (j = i+1; j < n; j++)  
        if (arr[j] < arr[min_idx])  
            min_idx = j;  
  
        // Swap the found minimum element with the first element  
        swap(&arr[min_idx], &arr[i]);  
    }  
}  
  
    


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: expected primary-expression before ']' token
   15 |   selectionSort(h[],n);
      |                   ^
a.cc:15:3: error: 'selectionSort' was not declared in this scope
   15 |   selectionSort(h[],n);
      |   ^~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

 void swap(int *xp, int *yp)  
{  
    int temp = *xp;  
    *xp = *yp;  
    *yp = temp;  
}  
int main()
{
  int n,k;
  int h[n];
  long int sum=0;
  selectionSort(h,n);
  for(int i=0;i<n-k;i++)
  {
    sum=sum+h[i];
  }
  cout<<sum;
  return 0;
}

  

  
void selectionSort(int arr[], int n)  
{  
    int i, j, min_idx;  
  
    // One by one move boundary of unsorted subarray  
    for (i = 0; i < n-1; i++)  
    {  
        // Find the minimum element in unsorted array  
        min_idx = i;  
        for (j = i+1; j < n; j++)  
        if (arr[j] < arr[min_idx])  
            min_idx = j;  
  
        // Swap the found minimum element with the first element  
        swap(&arr[min_idx], &arr[i]);  
    }  
}  
  
    

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'selectionSort' was not declared in this scope
   15 |   selectionSort(h,n);
      |   ^~~~~~~~~~~~~
Language: C++

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

int main() {
  int N,K;
  cin>>N>>K;
  vector<int> data(N);
  for (int i = 0; i < N; i++) {
    cin >> data.at(i);
}
  if(K>=N){
     cout << "0" << endl;
  }
  int w;
  w=0;
  else{
    for (int i = 0; i < N-K; i++) {
    w += data.at(i);
      }
     cout << w << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'else' without a previous 'if'
   16 |   else{
      |   ^~~~
Language: Java

import java.io.*;
public class FennecMonster
  {
  public static void main(String [] args)
    {
    Scanner sc= new Scanner(System.in);
    System.out.println("Enter the no. of Monsters");
    int n= sc.nextInt();
    int h= new int [n];
    System.out.println("Enter the no. of special moves");
    int k= sc.nextInt();
     System.out.println("Enter health of all the monsters.");
    int p = 0;
    for(int i=0; i<n; i++)
      {
      h[i]= sc.nextInt();
      p= p+ h[i];
     }
    if( k== 0)
     
      System.out.println( p);
     else if(k>= n) 
       System.out.println(0);
       else
         {
         for( i=0; i<n; i++)
           {
           for( int j=0; j<n-i; j++)
             {
             if(h[j]> h[j+1])
               {
               int temp= h[j]
                 h[j]= h[j+1];
               h[j+1]=temp;
               }
             }
           }
         for(i=0; i<k; i++)
           {
           p= p- h[n-i-1];
           }
         System.out.print(p);
         }
    }
  }
         
         
     
   
    

Compiler output:
Main.java:32: error: ';' expected
               int temp= h[j]
                             ^
1 error
Language: Java

import java.util.Scanner;
 
public class Main{
 
public static void main(String[] args) {
 
int count = 0;
//number of enemies
int N;
//special attack
int S;
 
Scanner scanner = new Scanner(System.in);
H = scanner.nextInt();
S = scanner.nextInt();

//list of enemies HP
int u[] = new int[9];
  
for(int i = 0; i<9; i++){
  u[i] = scanner.nextInt();
  
}

int max = u[0];
int min = u[0];
int sum = 0;

for (int i = 1; i < u.length; i++) {
    int v = u[i];
    if (v > max) {
        max = v;
    }
    if (v < min) {
        min = v;
    }
    sum = sum +v;
}

  
System.out.println(sum-max);
  
}
  
}

Compiler output:
Main.java:14: error: cannot find symbol
H = scanner.nextInt();
^
  symbol:   variable H
  location: class Main
1 error