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

import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int ans = 0;
    Map<Integer,Integer> a=new HashMap<Integer,Integer>();
    for(int i=0;i<N;i++){
      int num=sc.nextInt();
      int cnt=a.getOrDefault(num, 0);
      a.put(num, cnt+1);
    }
    List<int[]> list=new ArrayList<int[]>();
    for(int i:a.keySet()){
      list.add(new int[]{i,a.get(i)});
    }
    Collections.sort(list,new Comparator<Integer>());
    for(int i=0;i<list.size()-K;i++){
      ans += list.get(i)[1];
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:19: error: Comparator is abstract; cannot be instantiated
    Collections.sort(list,new Comparator<Integer>());
                          ^
1 error
Language: Java

import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int ans = 0;
    Map<Integer,Integer> a=new HashMap<Integer,Integer>();
    for(int i=0;i<N;i++){
      int num=sc.nextInt();
      int cnt=a.getOrDefault(num, 0);
      a.put(num, cnt+1);
    }
    List<int[]> list=new ArrayList<int[]>();
    for(int i:a.keySet()){
      list.add(new int[]{i,a.get(i)});
    }
    Collections.sort(list,new java.util.Comparator<Integer>());
    for(int i=0;i<list.size()-K;i++){
      ans += list.get(i)[1];
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:19: error: Comparator is abstract; cannot be instantiated
    Collections.sort(list,new java.util.Comparator<Integer>());
                          ^
1 error
Language: Java

import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int ans = 0;
    Map<Integer,Integer> a=new HashMap<Integer,Integer>();
    for(int i=0;i<N;i++){
      int num=sc.nextInt();
      int cnt=a.getOrDefault(num, 0);
      a.put(num, cnt+1);
    }
    List<int[]> list=new ArrayList<int[]>();
    for(int i:a.keySet()){
      list.add(new int[]{i,a.get(i)});
    }
    Collections.sort(list);
    for(int i=0;i<list.size()-max;i++){
      ans += list.get(i)[1];
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:19: error: no suitable method found for sort(List<int[]>)
    Collections.sort(list);
               ^
    method Collections.<T#1>sort(List<T#1>) is not applicable
      (inference variable T#1 has incompatible bounds
        equality constraints: int[]
        upper bounds: Comparable<? super T#1>)
    method Collections.<T#2>sort(List<T#2>,Comparator<? super T#2>) is not applicable
      (cannot infer type-variable(s) T#2
        (actual and formal argument lists differ in length))
  where T#1,T#2 are type-variables:
    T#1 extends Comparable<? super T#1> declared in method <T#1>sort(List<T#1>)
    T#2 extends Object declared in method <T#2>sort(List<T#2>,Comparator<? super T#2>)
Main.java:20: error: cannot find symbol
    for(int i=0;i<list.size()-max;i++){
                              ^
  symbol:   variable max
  location: class Main
2 errors
Language: Java

import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int ans = 0;
    Map<Integer,Integer> a=new HashMap<Integer,Integer>();
    for(int i=0;i<N;i++){
      int num=sc.nextInt();
      int cnt=m.getOrDefault(num, 0);
      a.put(num, cnt+1);
    }
    List<int[]> list=new ArrayList<int[]>();
    for(int i:m.keySet()){
      list.add(new int[]{i,m.get(i)});
    }
    Collections.sort(list);
    for(int i=0;i<list.size()-max;i++){
      ans += list.get(i)[1];
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:12: error: cannot find symbol
      int cnt=m.getOrDefault(num, 0);
              ^
  symbol:   variable m
  location: class Main
Main.java:16: error: cannot find symbol
    for(int i:m.keySet()){
              ^
  symbol:   variable m
  location: class Main
Main.java:17: error: cannot find symbol
      list.add(new int[]{i,m.get(i)});
                           ^
  symbol:   variable m
  location: class Main
Main.java:19: error: no suitable method found for sort(List<int[]>)
    Collections.sort(list);
               ^
    method Collections.<T#1>sort(List<T#1>) is not applicable
      (inference variable T#1 has incompatible bounds
        equality constraints: int[]
        upper bounds: Comparable<? super T#1>)
    method Collections.<T#2>sort(List<T#2>,Comparator<? super T#2>) is not applicable
      (cannot infer type-variable(s) T#2
        (actual and formal argument lists differ in length))
  where T#1,T#2 are type-variables:
    T#1 extends Comparable<? super T#1> declared in method <T#1>sort(List<T#1>)
    T#2 extends Object declared in method <T#2>sort(List<T#2>,Comparator<? super T#2>)
Main.java:20: error: cannot find symbol
    for(int i=0;i<list.size()-max;i++){
                              ^
  symbol:   variable max
  location: class Main
5 errors
Language: Java

import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int ans = 0;
    int[] a = new int [200001];
    for (int i = 0; i < N; i++){
      a[sc.nextInt()] +=1;
    }
    Arrays.sort(a);
    for(int i = K;i < a.length();i++) {
      ans += a[i];
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:14: error: cannot find symbol
    for(int i = K;i < a.length();i++) {
                       ^
  symbol:   method length()
  location: variable a of type int[]
1 error
Language: Java

import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int ans = 0;
    int[] a = new int [200001];
    for (int i = 0; i < N; i++){
      a[sc.nextInt()] +=1;
    }
    Arrays.sort(a);
    for(int i = K; a.length();i++) {
      ans += a[i];
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:14: error: cannot find symbol
    for(int i = K; a.length();i++) {
                    ^
  symbol:   method length()
  location: variable a of type int[]
1 error
Language: Java

import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int ans = 0;
    int[] a = new int [200001];
    for (int i = 0; i < n; i++){
      a[sc.nextInt()] +=1;
    }
    Arrays.sort(a);
    for(int i = K: a.length();i++) {
      ans += a[i];
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:14: error: ';' expected
    for(int i = K: a.length();i++) {
                 ^
Main.java:14: error: ';' expected
    for(int i = K: a.length();i++) {
                                 ^
2 errors
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> A(N+1,0);
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    A[x]++;
  }
  sort(A.rbegin(),A.rend());
  int ret=n;
  for(int i=0;i<k;i++){
    ret-=A[i];
  }
  cout << ret << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'N' was not declared in this scope
    9 |   vector<int> A(N+1,0);
      |                 ^
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort(A.rbegin(),A.rend());
      |   ^~~~
      |   short
Language: C++

#include <bits/stdc++.h>

using namespace std;
const int MAX_N = 2e5;

int counts[MAX_N + 1];
int N, K;

int main() {
	ios_base::sync_with_stdio(false);
	memset(counts, 0, sizeof(counts));
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		counts[a]++;
	}
	vi sorted_counts;
	int s = 0;
	for (int i = 0; i <= MAX_N; i++) {
		if (counts[i]) {
			sorted_counts.push_back(counts[i]);
			s++;
		}
	}
	sort(sorted_counts.begin(), sorted_counts.end());
	int cost = 0;
	if (s - K <= 0) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = 0; i < s - K; i++) {
		cost += sorted_counts[i];
	}
	cout << cost << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'vi' was not declared in this scope
   17 |         vi sorted_counts;
      |         ^~
a.cc:21:25: error: 'sorted_counts' was not declared in this scope
   21 |                         sorted_counts.push_back(counts[i]);
      |                         ^~~~~~~~~~~~~
a.cc:25:14: error: 'sorted_counts' was not declared in this scope
   25 |         sort(sorted_counts.begin(), sorted_counts.end());
      |              ^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;

int counts[MAX_N + 1];
int N, K;

int main() {
	ios_base::sync_with_stdio(false);
	memset(counts, 0, sizeof(counts));
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		counts[a]++;
	}
	vi sorted_counts;
	int s = 0;
	for (int i = 0; i <= MAX_N; i++) {
		if (counts[i]) {
			sorted_counts.push_back(counts[i]);
			s++;
		}
	}
	sort(sorted_counts.begin(), sorted_counts.end());
	int cost = 0;
	if (s - K <= 0) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = 0; i < s - K; i++) {
		cost += sorted_counts[i];
	}
	cout << cost << endl;
	return 0;
}

Compiler output:
a.cc:6:12: error: 'MAX_N' was not declared in this scope
    6 | int counts[MAX_N + 1];
      |            ^~~~~
a.cc: In function 'int main()':
a.cc:11:16: error: 'counts' was not declared in this scope; did you mean 'const'?
   11 |         memset(counts, 0, sizeof(counts));
      |                ^~~~~~
      |                const
a.cc:19:30: error: 'MAX_N' was not declared in this scope
   19 |         for (int i = 0; i <= MAX_N; i++) {
      |                              ^~~~~
Language: C++



/*@author hussein zayed ;
    ___  ___
   |\  \|\  \
   \ \  \_\  \
    \ \   ___ \USSEIN
     \ \  \\ \ \
      \ \__\\ \_\
       \|__| \|__|
****************************************
*/

#include <bits/stdc++.h>
using namespace std;
#define fr for(int i=0;i<n;++i)
#define fr1 for(int i=1;i<=n;++i)
#define cinA for(int i=0;i<n;++i){cin>>arr[i];}
#define cinA1 for(int i=1;i<=n;++i){cin>>arr[i];}
#define coutA for(int i=0;i<n;++i){cout<<arr[i]<<" ";}
#define ll long long
#define lnarray sizeof(arr)/sizeof(*arr)
#define vi vector<int>
#define vs vector<string>
void Fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline int RD()
{
    int i ;
    cin>>i;
    return i;
}

inline float RF()
{
    float i ;
    cin>>i;
    return i;
}

inline double RDO()
{
    double i ;
    cin>>i;
    return i;
}

inline string RS()
{
    string i ;
    cin>>i;
    return i;
}

inline ll RLL()
{
    ll i ;
    cin>>i;
    return i;
}

int cm[200000];

ll sumSet(ll n)
{
    return (1ll*n*(n+1))/2;
}
string s;


bool isPrime(int n)
{
    if(n==1)
        return false;
    for(int i=2; i*i<=n; ++i)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int sumDigit(int n){
int sum =0;
  while (n != 0)
    {
        sum+= + n % 10;
        n = n / 10;
    }
    return sum;
}

ll power2(int n){
  ll ans=(1<<n);
  return ans;
}

ll sumpow2(ll n){
 ll sum=(n*(n+1)*(2*n-1))/6;
 return sum;
}

int arr[2e5+3];
vi vr;
int main(){
    Fast();
//freopen("output.txt" , "w" , stdout);
//freopen("wall.in" , "r" , stdin);

	int n=RD(),k=RD(),a,cont=0;
	  fr{
	    cin>>a;
		++arr[a];}
     fr{
		if(arr[i])
			vr.push_back(arr[i]);
			}
			
			
	sort(vr.rbegin(),vr.rend());
 
	for(int i=0;i<k && i<vr.size();++i)
		cont+=vr[i];
	
	int ans=n-cont;
	cout<<ans;
			
}


Compiler output:
a.cc:106:12: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
  106 | int arr[2e5+3];
      |         ~~~^~
a.cc:106:12: error: could not convert '(2.0e+5 + (double)3)' from 'double' to 'long unsigned int'
  106 | int arr[2e5+3];
      |         ~~~^~
      |            |
      |            double
a.cc:106:12: error: size of array 'arr' has non-integral type 'double'
Language: C++

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

int main() {
  int N,K;
  cin >> N >> K;
  map<int,int> mp;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    mp[a]++;
  }
  vector<int> vec;
  for(auto p:mp){
    vec.push_back(mp.second);
  }
  sort(vec.begin(),vec.end());
  int sum=0;
  for(int i=0;i<K;i++){
    sum+=vec[i];
  }
  cout << sum;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: 'class std::map<int, int>' has no member named 'second'
   15 |     vec.push_back(mp.second);
      |                      ^~~~~~
Language: C++

  #include <iostream>
  #include <vector>
  #include <string>
  #include <bitset>
  #include <cmath>
  #include <queue>
  #include <iomanip>
  using namespace std;

  #define INF 1e18
  #define int long long
  #define MAX 200010

  signed main() {
    int n, k; cin >> n >> k;
    int maxa = 0;
    vector<int> a(n);
    int cnt[MAX];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        maxa = max(maxa, a[i]);
        cnt[a[i]]++;
    }

    sort(&cnt[1], &cnt[maxa + 1]);

    int ans = 0;
    for(int i = 1; i <= maxa - k; i++) {
        ans += cnt[i];
    }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   25 |     sort(&cnt[1], &cnt[maxa + 1]);
      |     ^~~~
      |     sqrt
Language: C++

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

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;

int main()
{
    ll N,K,res;

    cin >> N >> K;

    vector <ll> cnt(200001,0);

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


    REP(i,N)
    {
        cin >> tmp;
        cnt[tmp]++; 
    }

    //cntが立ってるやつはいくつなのって話
    sort(cnt.begin(),cnt.end());

    ll kind;
    ll keshi = 0;
    for(ll i = 1; i <= N; i++)
    {
        if(cnt[i] == 0)
        {
            continue;
        }
        else
        {
            kind = N - i;
        }
        if(kind <= K)
        {
            break;
        }
        keshi += cnt[i];
    }

    cout << keshi << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   28 |         cin >> tmp;
      |                ^~~
      |                tm
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#define INF INT_MAX
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	int a;
	int sum[200005];
	int cnt = 0;
	int ans = 0;
	for(int i = 0;i < 200005;i++) sum[i] = INF;

	cin >> n >> k;

	for(int i = 0;i < n;i++){
		cin >> a;
		if(sum[a] == INF){
			cnt ++;
			sum[a] = 0;
		}
		sum[a] ++;
	}

	sort(sum, sum + n + 1);

	for(int i = 0;cnt > k && i < n;i++){
		ans += sum[i];
		cnt--;
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:13: error: 'INT_MAX' was not declared in this scope
    4 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:15:48: note: in expansion of macro 'INF'
   15 |         for(int i = 0;i < 200005;i++) sum[i] = INF;
      |                                                ^~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<algorithm>
  +++ |+#include <climits>
    4 | #define INF INT_MAX
a.cc:4:13: error: 'INT_MAX' was not declared in this scope
    4 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:21:30: note: in expansion of macro 'INF'
   21 |                 if(sum[a] == INF){
      |                              ^~~
a.cc:4:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:21:30: note: in expansion of macro 'INF'
   21 |                 if(sum[a] == INF){
      |                              ^~~
Language: C++

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

int main() {
  long int n,k,mode;//nは要素数 modeは最頻値
  cin>>n;
  vector<long int> a(n);//最頻値を求める配列
  for(long int i=0;i<n;i++)cin>>a[i];
  
  //最頻値を求める
  vector<long int> aa(n);
  vector<pair<long int,long int>> mode_(n);
  long int count=1;
  long int x=0;
  for(long int i=0;i<n;i++)aa[i]=a[i];
  sort(aa.begin(),aa.end());
  
  for(long int i=0;i<n-1;i++){
    if(aa[i]==aa[i+1]){
      count++;
      mode_[x].first=count;
      mode_[x].second=aa[i];
    }
    else{
      mode_[x].first=count;
      mode_[x].second=aa[i];
      count=1;
      x++;
    }
  }
  sort(mode_.begin(),mode_.end());
  reverse(mode_.begin(),mode_.end());
  
  /*mode[n].second n+1番目に多く出る数
  その数の個数はmode[n].first*/
  
  for(long int i=0;i<k;i++){
    n-=mode[n].first;
    if(n==0)break;
  }
  cout<<n<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: invalid types 'long int[long int]' for array subscript
   38 |     n-=mode[n].first;
      |            ^
Language: C++

package main

import (
	"fmt"
	"sort"
)

// 2018-08-01T21:47:17+0800
// 2018-08-01T21:53:36+0800
// 2018-08-01T22:00:04+0800
func main() {
	var N, K int
	fmt.Scanf("%d%d", &N, &K)
	m := make(map[int]int)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
		m[A[i]] ++
	}
	if len(m) <= K {
		fmt.Println(0)
		return
	}
	n := make([]int, len(m))
	i := 0
	for _, value := range m {
		n[i] = value
		i++
	}
	sort.Ints(n)

	ans := 0
	end := len(m) - K
	for i := 0; i < end; i++ {
		ans += n[i]
	}
	fmt.Println(ans)
}

Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
Language: C++

#include <iostream>  
#include <cstdio>  
#include <cstring>  
#include <algorithm>  
  
using namespace std;  
const int maxn=2e5+100;  
int par[maxn],sum[maxn];  
int N,K,p,tot;  
  
void init(int n)  
{  
    for(int i=0;i<=n;i++)  
        par[i]=i;  
}  
  
int find(int x)  
{  
    if(par[x]==x)  
        return x;  
    return par[x]=find(par[x]);  
}  
void unit(int x,int y)  
{  
    int fx=find(x),fy=find(y);  
    if(fx!=fy)  
        par[fx]=fy;  
}  
bool same(int x,int y)  
{  
    return find(x)==find(y);  
}  
int main()  
{  
    while(~scanf("%d%d",&N,&K))  
    {  
        int ans=0;  
        memset(sum,0,sizeof(sum));  
        memset(par,0,sizeof(par));  
        tot=0;  
        init(N);  
        int t;  
        scanf("%d",&t);  
        sum[t]++;  
        p=t;  
        tot++;  
        for(int i=2;i<=N;i++)  
        {  
            scanf("%d",&t);  
            sum[t]++;  
            if(!same(t,p))  
            {  
                tot++;  
                unit(t,p);  
            }  
        }  
        sort(sum,sum+N+1);  
        if(tot<=K)  
            ans=0;  
        else  
        {  
            int cnk=tot-K;  
            int pos=lower_bound(sum,sum+N+1,1)-sum;  
            while(cnt--)  
                ans+=sum[pos++];         
        }  
        printf("%d\n",ans);  
    }  
    return 0;  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:19: error: 'cnt' was not declared in this scope; did you mean 'cnk'?
   64 |             while(cnt--)
      |                   ^~~
      |                   cnk
Language: C

#include <iostream>  
#include <cstdio>  
#include <cstring>  
#include <algorithm>  
  
using namespace std;  
const int maxn=2e5+100;  
int par[maxn],sum[maxn];  
int N,K,p,tot;  
  
void init(int n)  
{  
    for(int i=0;i<=n;i++)  
        par[i]=i;  
}  
  
int find(int x)  
{  
    if(par[x]==x)  
        return x;  
    return par[x]=find(par[x]);  
}  
void unit(int x,int y)  
{  
    int fx=find(x),fy=find(y);  
    if(fx!=fy)  
        par[fx]=fy;  
}  
bool same(int x,int y)  
{  
    return find(x)==find(y);  
}  
int main()  
{  
    while(~scanf("%d%d",&N,&K))  
    {  
        int ans=0;  
        memset(sum,0,sizeof(sum));  
        memset(par,0,sizeof(par));  
        tot=0;  
        init(N);  
        int t;  
        scanf("%d",&t);  
        sum[t]++;  
        p=t;  
        tot++;  
        for(int i=2;i<=N;i++)  
        {  
            scanf("%d",&t);  
            sum[t]++;  
            if(!same(t,p))  
            {  
                tot++;  
                unit(t,p);  
            }  
        }  
        sort(sum,sum+N+1);  
        if(tot<=K)  
            ans=0;  
        else  
        {  
            int cnt=tot-K;  
            int pos=lower_bound(sum,sum+N+1,1)-sum;  
            while(cnt--)  
                ans+=sum[pos++];         
        }  
        printf("%d\n",ans);  
    }  
    return 0;  
}  

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

 1 #include <iostream>
 2 #include <stdio.h>
 3 #include <string.h>
 4 #include <algorithm>
 5 #include <set>
 6 using namespace std;
 7 typedef long long ll;
 8 int a[200005];
 9 bool compare(int a,int b){
10     return a>b;
11 }
12 int main(){
13     ios::sync_with_stdio(0);
14     int n,k,x;
15     cin>>n>>k;
16     memset(a,0,sizeof(a));
17     for(int i=0;i<n;i++){
18         cin>>x;
19         a[x]++;
20     }
21     int ans=0;
22     sort(a,a+n,compare);
23     for(int i=k;i<=n;i++){
24         ans+=a[i];
25     }
26     cout<<ans<<endl;
27     return 0;
28 }

Compiler output:
main.c:1:2: error: expected identifier or '(' before numeric constant
    1 |  1 #include <iostream>
      |  ^
main.c:1:4: error: stray '#' in program
    1 |  1 #include <iostream>
      |    ^
main.c:2:4: error: stray '#' in program
    2 |  2 #include <stdio.h>
      |    ^
main.c:3:4: error: stray '#' in program
    3 |  3 #include <string.h>
      |    ^
main.c:4:4: error: stray '#' in program
    4 |  4 #include <algorithm>
      |    ^
main.c:5:4: error: stray '#' in program
    5 |  5 #include <set>
      |    ^
main.c:7:2: error: expected identifier or '(' before numeric constant
    7 |  7 typedef long long ll;
      |  ^
main.c:8:2: error: expected identifier or '(' before numeric constant
    8 |  8 int a[200005];
      |  ^
main.c:9:2: error: expected identifier or '(' before numeric constant
    9 |  9 bool compare(int a,int b){
      |  ^
main.c:12:1: error: expected identifier or '(' before numeric constant
   12 | 12 int main(){
      | ^~
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main() {
	int n, k, a, b, c = 0, d, e = 0;
	map<int, int> m;
	vector<int> v(1);
	cin >> n >> k;
	for(int i = 0; i< n; i++){
		cin >> b;
		if(m[b] == 0){
			v.resize(v.size() + 1);
			vector.at(c) = b;
			c++;
		}
		m[b]++;
	}
	for(int i = 0; i < v.size() - k; i++){
		d = 200000;
		for(int j = 0; j < v.size(); j++){
			if(m[v.at(j)] < d){
				d = v.at(j);
			}
		}
		e += m[d];
		m[d] = 0;
	}
	cout << e << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:31: error: expected unqualified-id before '.' token
   16 |                         vector.at(c) = b;
      |                               ^
Language: C++

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

int main() {
	int n, k, a, b, c = 0, d, e = 0;
	map<int, int> m;
	vector<int> v(1);
	cin >> n >> k;
	for(int i = 0; i< n; i++){
		cin >> b;
		if(m[b] == 0){
			v.resize(v.size() + 1);
			vector.at(c) = b;
			c++;
		}
		m[b]++;
	}
	for(int i = 0; i < v.size() - k; i++){
		d = 200000;
		for(int j = 0; j < v.size(); j++){
			if(m[v.at(j)] < d){
				d = v.at(j);
			}
		}
		e += m[d];
		m[d] = 0;
	}
	cout << e << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'map' was not declared in this scope
    8 |         map<int, int> m;
      |         ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    3 | #include <algorithm>
  +++ |+#include <map>
    4 | using namespace std;
a.cc:8:13: error: expected primary-expression before 'int'
    8 |         map<int, int> m;
      |             ^~~
a.cc:13:20: error: 'm' was not declared in this scope
   13 |                 if(m[b] == 0){
      |                    ^
a.cc:15:31: error: expected unqualified-id before '.' token
   15 |                         vector.at(c) = b;
      |                               ^
a.cc:18:17: error: 'm' was not declared in this scope
   18 |                 m[b]++;
      |                 ^
a.cc:23:28: error: 'm' was not declared in this scope
   23 |                         if(m[v.at(j)] < d){
      |                            ^
a.cc:27:22: error: 'm' was not declared in this scope
   27 |                 e += m[d];
      |                      ^
Language: C++

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

int main() {
	int n, k, a, b, c = 0, d, e = 0;
	map<int, int> m;
	vector<int> v(1);
	cin >> n >> k;
	for(int i = 0; i< n; i++){
		cin >> b;
		if(map[b] == 0){
			v.resize(v.size() + 1);
			vector.at(c) = b;
			c++;
		}
		map[b]++;
	}
	for(int i = 0; i < v.size() - k; i++){
		d = 200000;
		for(int j = 0; j < v.size(); j++){
			if(map[v.at(j)] < d){
				d = v.at(j);
			}
		}
		e += map[d];
		map[d] = 0;
	}
	cout << e << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'map' was not declared in this scope
    8 |         map<int, int> m;
      |         ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    3 | #include <algorithm>
  +++ |+#include <map>
    4 | using namespace std;
a.cc:8:13: error: expected primary-expression before 'int'
    8 |         map<int, int> m;
      |             ^~~
a.cc:15:31: error: expected unqualified-id before '.' token
   15 |                         vector.at(c) = b;
      |                               ^
Language: C++

#include<cstdio>
#include<map>
using namespace std;

int a[200005];
map<int,int>Q;

int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	for(register int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		a[x]++;
		if(!Q.count(x)){
			Q[x]=1;
			now++;
		}
	}
	sort(a+1,a+n+1);
	int ans=0;
	for(register int i=n-now+1;i<=n-k;i++){
		ans+=a[i];
	}
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   11 |         for(register int i=1;i<=n;i++){
      |                          ^
a.cc:17:25: error: 'now' was not declared in this scope
   17 |                         now++;
      |                         ^~~
a.cc:20:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   20 |         sort(a+1,a+n+1);
      |         ^~~~
      |         short
a.cc:22:30: error: 'now' was not declared in this scope
   22 |         for(register int i=n-now+1;i<=n-k;i++){
      |                              ^~~
a.cc:22:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |         for(register int i=n-now+1;i<=n-k;i++){
      |                          ^
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;

int a[200005],q[200005];

int main(){
	int n;
	int now=0;
	scanf("%d",&n);
	for(register int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		a[x]++;
		if(!q.count(x)){
			q[x]=1;
			now++;
		}
	}
	sort(a+1,a+n+1);
	int ans=0;
	for(register int i=n-now+1;i<=n-k;i++){
		ans+=a[i];
	}
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   11 |         for(register int i=1;i<=n;i++){
      |                          ^
a.cc:15:23: error: request for member 'count' in 'q', which is of non-class type 'int [200005]'
   15 |                 if(!q.count(x)){
      |                       ^~~~~
a.cc:22:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |         for(register int i=n-now+1;i<=n-k;i++){
      |                          ^
a.cc:22:41: error: 'k' was not declared in this scope
   22 |         for(register int i=n-now+1;i<=n-k;i++){
      |                                         ^
Language: C++

#include<stdio.h>
int main()
{
  int N;
  int K;
  int A;
  int i, j;
  int found;
  int presentTypes;
  int least;
  int leastType;
  int ans;
  int L[200000][2];

  for(i = 0; i < 200000]; i++){
    L[i][0] = 0;
    L[i][1] = 0;
  }
  
  scanf("%d %d", &N, &K);
  for(i = 0; i < N; i++){
    scanf("%d", &A);
    found = 0;
    for(j = 0; j < i; j++){
      if(L[j][0] == A){
        L[j][1]++;
        found = 1;
        break;
      }
    }
    if(found == 0){
      L[i][0] = A;
    }
  }
  
  for(i = 0; i < N; i++){
    if(L[i][0] != 0){
      presentTypes = i + 1;
    }else{
      break;
    }
  }
  
  ans = 0;
  while(K < presentTypes){
    least = N;
    leastType = N;
    for(i = 0; i < N; i++){
      if(L[i][0] != 0){
        if(least > L[i][1]){
          least = L[i][1];
          leastType = i;
        }
      }else{
        break;
      }
    }
    ans += least;
    L[leastType][1] = N;
    presentTypes--;
  }
  
  // 出力
  printf("%d\n", ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: expected ';' before ']' token
   15 |   for(i = 0; i < 200000]; i++){
      |                        ^
      |                        ;
a.cc:15:24: error: expected primary-expression before ']' token
a.cc:15:24: error: expected ')' before ']' token
   15 |   for(i = 0; i < 200000]; i++){
      |      ~                 ^
      |                        )
a.cc:15:24: error: expected primary-expression before ']' token
a.cc:15:30: error: expected ';' before ')' token
   15 |   for(i = 0; i < 200000]; i++){
      |                              ^
      |                              ;
Language: C++

import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static char c;
	public static void main(String[] args) throws Exception {
		int k=sc.nextInt();
		int max=sc.nextInt();
		int[] arr=new int[k];
		Map<Integer,Integer> m=new HashMap<Integer,Integer>();
		for(int i=0;i<arr.length;i++){
			int number=sc.nextInt();
			int count=m.getOrDefault(number, 0);
			m.put(number, count+1);
		}
		List<int[]> list=new ArrayList<int[]>();
		for(int i:m.keySet())
			list.add(new int[]{i,m.get(i)});
		Collections.sort(list,((i1,i2)->(i1[1]-i2[1])));
		int count=0;
		for(int i=0;i<list.size()-max;i++){
			count+=list.get(i)[1];
		}
		System.out.println(count);
		
		
		
	}

}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.List;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.ArrayList;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Collections;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.HashMap;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.HashSet;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.Map;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
    7 | import java.util.Scanner;
      | ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
    8 | import java.util.Set;
      | ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'import' does not name a type
    9 | import java.util.concurrent.BlockingQueue;
      | ^~~~~~
a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: 'import' does not name a type
   10 | import java.util.concurrent.LinkedBlockingDeque;
      | ^~~~~~
a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:12:1: error: expected unqualified-id before 'public'
   12 | public class Main {
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define mod 1000000007
#define N 2010
#define inf 2000000000000000000ll
#define int long long
#define MI map<vector<ll>,vector<pair<ll,ll> > > :: iterator
using namespace std;
typedef long long ll;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
struct sp{ll B,C;}F[N];
map <vector<ll> ,vector<pair<ll,ll> > > M;
vector<pair<ll,ll> > tmp;
vector<ll> ttp;
ll n,k,A[N];
inline bool cmp(const sp a,const sp b)
{
	return a.C<b.C;
}
int gepopt(ll a,ll b)
{
    int ret=0;
    for(int i=62;i>=0;i--)
    {
        if(!(a>>i&1)&&(b>>i&1))
        {
            if(a!=0) ret++;
            break;
        }
        else if(a>>i&1)
        {
            a-=1LL<<i;
            b-=1LL<<i;
            ret++;
        }
    }
    return ret;
}
inline void acquire(int x)
{
	for(int i=1;i<=n;i++)
	{
		F[i].B=A[i]/(1ll<<x); 
		F[i].C=A[i]%(1ll<<x);
	}
	F[0].C=-1;
	sort(F+1,F+1+n,cmp); 
	for(int i=1;i<=n;i++) if(F[i-1].C<F[i].C)
	{
		ttp.clear();
		ll bs=getpop(F[i-1].C+1,F[i].C),R=inf;
		for(int j=1;j<i;j++)
			if(F[j].B-1<0) return ;
			else ttp.push_back(F[j].B-1);
		for(int j=i;j<=n;j++)
			ttp.push_back(F[j].B);
		sort(ttp.begin(),ttp.end());
	//	cout << k << endl;
		ll lef=k-x-bs; R=ttp[0];
		if(lef<0) return ;
		for(int i=0;i<(int)ttp.size()-1;i++)
			ttp[i]=ttp[i+1]-ttp[i];
		ttp[ttp.size()-1]=0ll;
		M[ttp].push_back(make_pair(max(0ll,R-lef),R));
	}
}
signed main()
{
	//ll a,b;
	//while(cin>> a>>b) cout << getpop(a,b) << endl;
	n=read(); k=read(); 
	for(int i=1;i<=n;i++)
		A[i]=read();
	for(int i=0;i<=62;i++)
		acquire(i);
	ll Ans=0;
	for(MI it=M.begin();it!=M.end();it++)
	{
		tmp=it->second;
		sort(tmp.begin(),tmp.end());
		ll nl=tmp[0].first,nr=tmp[0].second;
		for(int i=1;i<(int)tmp.size();i++)
		{
			//cout << tmp[i].first << " " <<tmp[i].second << endl;
			if(tmp[i].first>nr)
				Ans+=(nr-nl+1),nl=tmp[i].first;
			Ans%=mod;
			nr=max(nr,tmp[i].second);
		}
		Ans+=(nr-nl+1); Ans%=mod;
	}
	cout << Ans%mod << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void acquire(long long int)':
a.cc:56:23: error: 'getpop' was not declared in this scope; did you mean 'getpt'?
   56 |                 ll bs=getpop(F[i-1].C+1,F[i].C),R=inf;
      |                       ^~~~~~
      |                       getpt
a.cc:64:32: error: 'R' was not declared in this scope
   64 |                 ll lef=k-x-bs; R=ttp[0];
      |                                ^
Language: C++

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

int main() {

    int n, k, a[200000];
    vector< int > val(200001, 0);

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

    int sum = 0, cnt = 0;

    sort(val.begin(), val.end());
    for(auto p: val) {
        if(val.size() - cnt <= k) break;
        sum += p;
        cnt++;
    }

    cout << sum << endl;

}


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

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> a(n);
  for (auto& e : a)
    cin >> e;

  map<int, int> c;

  for (auto e : a) {
    c[e] += 1;
  }

  vector<int> cv;
  for (auto& e : c) {
    cv.push_back(e.second);
  }

  if (k >= cv.size()) {
    cout << 0 << endl;
	return 0;
  }

  sort(cv.begin(), cv.end());
  int ans = 0;
  for (int i = 0; i < cv.size() - k; i++) {
    ans += cv[i];
  }

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


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#include <cmath>
#include <cstdlib>
#include <climits>
#include <show_vector.hh>

//#include <stdio.h>
//#include <stdlib.h>
using namespace std;

#define debug false

int main(int argc, char *argv[]){

  int N, K;
  cin >> N >> K;
  int tmp;
  map<int, int> mp;
  vector<int> v;
  for(int i = 0; i < N; i++){
    cin >> tmp;
    mp[tmp]++;
    if(mp[tmp] == 1) v.push_back(tmp);
  }
  // データ構築ここまで

  int large_cnt = 0;
  for(int k = 0; k < K; k++){
    int max = 0;
    int max_ind;

    // 最大値探索
    for(int i = 0; i < v.size(); i++){
      if(max < mp[v[i]]){
        max = mp[v[i]];
        max_ind = i;
      }
    }

    large_cnt += max;
    v.erase(v.begin() + max_ind);

    if(v.size() == 0) break;
  }

  cout << N-large_cnt << endl;

  return 0;
}


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

#include <bits/stdc++.h>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;
 
#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;
 
struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};
 
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int ddx[]={1,1,1,0,-1,-1,-1,0},ddy[]={1,0,-1,-1,-1,0,1,1};
 
ll mypow(ll x,ll n,ll m) {	//xのn乗をmで割った余り
	if(n==0) return 1;
	if(n%2==0) return mypow(x*x%m,n/2,m);
	else return x*mypow(x,n-1,m)%m;
}
 
//-----------------------------------------------------------------------------
 
int n;
ll a[55];
ll mi=LINF,ma=-LINF;
int i1,i2;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	cin>>n;
	REP(i,n) {
		cin>>a[i];
		if(a[i]<mi) mi=a[i],i1=i;
		if(a[i]>ma) ma=a[i],i2=i;
	}
		if(abs(ma)>abs(mi)) {
			cout<<2*n-1<<endl;
			REP(i,n) cout<<i2+1<<' '<<i+1<<endl;
        		REP(i,n-1) {
			        cout<<i+1<<' '<<i+2<<endl;
		        }
		}
		else {
			cout<<2*n-1<<endl;
			REP(i,n) cout<<i1+1<<' '<<i+1<<endl;
		        for(int i=n-1;i>0;i--) {
			       cout<<i+1<<' '<<i<<endl;
		        }
		}
	}
	
	return 0;
}

Compiler output:
a.cc:69:9: error: expected unqualified-id before 'return'
   69 |         return 0;
      |         ^~~~~~
a.cc:70:1: error: expected declaration before '}' token
   70 | }
      | ^
Language: C++

#include <iostream>
using namespace std;

int main() {
  
  int N;
  int K;
  
  cin >> N >> K;
  
  int* numbers = new int[N];
  
  memset(numbers, 0, N*sizeof(numbers));
  
  for( int i=0; i<N; i++ ) {
    int tmp;
    cin >> tmp;
    numbers[tmp-1] ++ ;
  }
  
  //count non-zero
  int nonZero = 0;
  for( int i=0; i<N; i++ ){
    if( numbers[i] > 0 )
      nonZero ++;
  }
  
  int numberOfBallNeedToChange = 0;
  
  while( K < nonZero ) {
    int min = INT_MAX;
    int minPos = -1;
    
    for( int i=0; i<N; i++ ){
      if( numbers[i] != 0 && numbers[i] < min ) {
        min = numbers[i];
        minPos = i;
      }
    }
    
    numbers[minPos] = 0;
    numberOfBallNeedToChange += min;
    nonZero--;
  }

  cout << numberOfBallNeedToChange;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'memset' was not declared in this scope
   13 |   memset(numbers, 0, N*sizeof(numbers));
      |   ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:31:15: error: 'INT_MAX' was not declared in this scope
   31 |     int min = INT_MAX;
      |               ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int i=0, j=0,n,k,r,c=0;
int p[200010],t[200010];
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
		cin>>p[i];
    sort(p,p+n);   
    while (i < n)  
    {
        if (p[i] != p[i+1])
            t[j++] = p[i];
        ++i;
    }
	if(j<=k)
	cout<<"0"<<endl;
	else
	{
			for(i=0;i<n;i++)
			{
				for(r=t[k];r<=t[j-1];r++)
				{
					if(p[i]==r)
					c++;
				}
			}
		cout<<c<<endl;	
	}
	
} 

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

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int i = 0, j = 0,n,k,r,c=0;
int p[20010],t[20010];
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
		cin>>p[i];
    sort(p,p+n);   
    while (i < n)  
    {
        if (p[i] != p[i+1])
            t[j++] = p[i];
        ++i;
    }
	if(j<=k)
	cout<<"0"<<endl;
	else
	{
			for(i=0;i<n;i++)
			{
				for(r=t[k];r<=t[j-1];r++)
				{
					if(p[i]==r)
					c++;
				}
			}
		cout<<c<<endl;	
	}
	
} 

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

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
bool cmp(int a,int b)
{
	return a>b;
}
int a[200010];
int main()
{
	int n,k;
	while(~scanf("%d %d",&n,&k))
	{
		memset(a,0,sizeof(a));
		int b;
		for(int i=0;i<n;i++)
		{
			scanf("%d",&b);
			a[b]++;
		}
		sort(a,a+200010,cmp);
		int sum=0;
		for(int i=0;i<k;i++)
		{
			sum+=a[i];
		}
		printf("%d\n",n-sum);
	}
}

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

#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
using namespace std;

int n,k,x,b[200050],m;

int main()
{
    scanf("%d%d",&n,&k);
    m=n;
    for (int i=1;i<=n;i++) 
    {
        scanf("%d",&x);
        b[x]++;
    }
    sort(b+1,b+n+1);
    for (int i=n;i>=n-k+1;i--) m-=b[i];
    cout<<m<<endl;
    return 0;
}

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

#include <cstdio>
#include <map>
using namespace std;
int main()
{
	map<int,int> m;
	int a,n,k,v=0,r=0,l[200000];
	scanf("%d %d",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%d",&a);
		if(m.count(a)){
			l[m[a]]++;
		}else{
			l[m[a]=v++]++;
		}
	}
	sort(l,l+v);
	for(int i=v;i>k;i--){
		r+=l[v-i];
	}
	printf("%d\n",r);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |         sort(l,l+v);
      |         ^~~~
      |         short
Language: Java

//package arc086;

import java.io.*;
import java.util.*;

public class TaskC {
    public FastScanner in;
    public PrintWriter out;

    public void solve() {
        int n = in.nextInt();
        int k = in.nextInt();
        int[] counter = new int[n + 1];
        for (int i = 0; i < counter.length; i++) counter[i] = 0;
        for (int i = 0; i < n; i++) counter[in.nextInt()]++;
        int numbers = 0;
        for (int i = 0; i < counter.length; i++) {
            if (counter[i] > 0) numbers++;
        }
        Arrays.sort(counter);
        int ans = 0;
        for (int i = 0; i < counter.length; i++) {
            if (counter[i] == 0) continue;
            if (numbers - k <= 0) break;
            ans += counter[i];
            numbers--;
        }
        out.println(ans);
    }

    public void runIO() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    public void run() {
        try {
            in = new FastScanner(new File("input.txt"));
            out = new PrintWriter(new File("output.txt"));
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }

        solve();

        out.close();
    }

    public class FastScanner {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public FastScanner(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public FastScanner(File file) {
            try {
                reader = new BufferedReader(new FileReader(file));
            } catch (FileNotFoundException e) {
                throw new RuntimeException(e);
            }
            tokenizer = null;
        }

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

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

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

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

    public static void main(String[] args) {
        new TaskC().runIO();
    }
}


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

#include <bits/stdc++.h>
#include <random>
#include <unordered_map>

using namespace std;

int MAX = 200001;

int cnt[MAX];

int main()
{
    int N, K;
    int a;
    cin >> N >> K;
    vector<int> x;    
    for(int i = 0; i < N; i++) {
        cin >> a;
        cnt[a]++;
    }
    
    for(int i = 0; i < MAX; i++) {
        if(cnt[i] > 0) {
        	x.emplace_back(cnt[i]);
        }
    }
    
    sort(x.begin(), x.end());
    int size = x.size();
    int ans = 0;
    int index = 0;
    while(size > K && index < x.size()) {
        ans += x[index];
        size--;
        index++;
    }
    
    cout << ans << endl;
    
    return 0;
}


Compiler output:
a.cc:9:9: error: size of array 'cnt' is not an integral constant-expression
    9 | int cnt[MAX];
      |         ^~~
Language: C++

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

map<int,int> cnt;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin>>n>>k;
    int ans = 0;
    for (int i=0; i<n; i++) {
        int a;
        cin>>a;
        cnt[a]++;
    }
    deque<int> v;
    for (pair<int,int> p: cnt) {
        v.push_back(p.second);
    }
    sort(v.begin(), v.end());
    while (v.size()>k) {
        ans+=v[0];
        v.pop_front();
    }
    cout<<ans;
}


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