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

#include <iostream>
#include <memory.h>
using namespace std;


	int	n,k, a[200000];
	int	t[200000],tc=0;
int main()
{

	cin >>n >>k;

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

	memset(&t[0],0,sizeof(int)*n);

	for(int i=0; i<n;i++)
	{
		if(!t[a[i]])
		{
			tc++;
		}
		t[a[i]]++;
	}

	int ans=0;

	int min=200001, min_tc;
	for(;tc>k;tc--)
	{
		for(int i=0;i<n;i++)
		{
			if(t[i] && min=>t[i])
			{
				min=t[i],min_tc=i;
			}
		}
		t[min_tc]=0;
		ans+=min;
		min=200001;
	}

	cout << ans;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:40: error: expected primary-expression before '>' token
   36 |                         if(t[i] && min=>t[i])
      |                                        ^
Language: C++

#include <iostream>
using namespace std;


int main()
{
	int	n,k, a[200000];

	cin >>n >>k;

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

	int	t[200000],tc=0;
	memset(t,0,sizeof(int));

	for(int i=0; i<n;i++)
	{
		if(!t[a[i]])
		{
			tc++;
		}
		t[a[i]]++;
	}

	int ans=0;

	int min=200001, min_tc;
	for(;tc>k;tc--)
	{
		for(int i=0;i<n;i++)
		{
			if(t[i] && min>t[i])
			{
				min=t[i],min_tc=i;
			}
		}
		t[min_tc]=0;
		ans+=min;
		min=0;
	}

	cout << ans;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'memset' was not declared in this scope
   17 |         memset(t,0,sizeof(int));
      |         ^~~~~~
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;
Language: C++

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

    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: expected ')' before ';' token
   12 |     sort(cut,cut+n;
      |         ~         ^
      |                   )
Language: C++

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

    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:4: error: expected initializer before 'int'
    5 |    int n,k;
      |    ^~~
a.cc:6:11: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |    cin >> n >>k;
      |           ^
      |           yn
a.cc:6:15: error: 'k' was not declared in this scope
    6 |    cin >> n >>k;
      |               ^
a.cc:10:8: error: 'cut' was not declared in this scope
   10 |        cut[a-1]++;
      |        ^~~
a.cc:12:10: error: 'cut' was not declared in this scope
   12 |     sort(cut,cut+n;
      |          ^~~
Language: C++

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int bpm(int x, int y) {
  if (x == 0)
    return 0;
  else if (y == 0) {
    return 1;
  }
  int ans = 1;
  x %= MOD;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) {
      ans *= x;
      ans %= MOD;
    }
    x = x * x;
    x %= MOD;
  }
  return ans;
}
unordered_map<int, int> element_num; //change type if you need
template <class T>
void counter(T container) {
  for (int i = 0; i < container.size(); i++) {
    element_num[container[i]] += 1;
  }
}

class CNotSoDiverse {
public:
  int solve(std::istream &cin, std::ostream &cout) {
    element_num = {};
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) {
      cin >> A[i];
    }
    counter(A);
    vector<int> B;
    int num = 0;
    rep(i, N + 1) {
      if (element_num[i]){
        num += 1;
        B.emplace_back(element_num[i]);
      }
    }
    sort(ALL(B));
    int ans = 0;
    rep(j, B.size()) {
      if (num <= K) {
        break;
      } else if (B[j]) {
        ans += B[j];
        num -= 1;
      }
    }
    cout << ans << endl;
  }
};


Compiler output:
a.cc: In member function 'long long int CNotSoDiverse::solve(std::istream&, std::ostream&)':
a.cc:73:3: warning: no return statement in function returning non-void [-Wreturn-type]
   73 |   }
      |   ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  int n, k, s = 0; scanf("%d %d", &n, &k);
  v1i v(n); rep(i, n) scanf("%d", &v[i]);
  map<int> m; priority_queue<int> p;
  rep(i, n) m[v[i]]++;
  for(auto q: m) p.push(q.se);
  rep(i, k){
    if(p.empty()) break;
    s += p.top();
    p.pop();
  }
  printf("%d\n", n-s);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:10: error: wrong number of template arguments (1, should be at least 2)
   33 |   map<int> m; priority_queue<int> p;
      |          ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:34:14: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   34 |   rep(i, n) m[v[i]]++;
      |              ^
a.cc:35:15: error: 'begin' was not declared in this scope
   35 |   for(auto q: m) p.push(q.se);
      |               ^
a.cc:35:15: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:35:15: error: 'end' was not declared in this scope
   35 |   for(auto q: m) p.push(q.se);
      |               ^
a.cc:35:15: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  map<int,int>M;
  for(int i=0;i<N;i++){
  int a;
    cin>>a;
    if(M.count(a))
      M.at(i)++;
    else
      M[a]=1;
  
  }vector<int>A={0};
  for(auto p:M){
  auto k=p.first;
    auto v=p.second;
    A.push_back(v);
  
  }int m=A.size();
  if(m-1<=K)
    cout<<0<<endl;
  else{
   int ans=0;
    for(int i=1;m-K)
      ans+=A.at(i);
    cout<<ans<<endl;
  }
  
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: 'K' was not declared in this scope
   22 |   if(m-1<=K)
      |           ^
a.cc:26:20: error: expected ';' before ')' token
   26 |     for(int i=1;m-K)
      |                    ^
      |                    ;
Language: C++

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

int main()
{
  int N, K;
  cin >> N >> K;
  
  int a[N] = 0;
  int x;
  for (int i = 0; i < N; i++) {
    cin >> x;
    a[x]++;
  }
  
  sort(a.begin(), a.end());
  
  int ans = 0;
  for (int i = 0; i < N-K;i++) ans += a[i];
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: array must be initialized with a brace-enclosed initializer
    9 |   int a[N] = 0;
      |              ^
a.cc:16:10: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   16 |   sort(a.begin(), a.end());
      |          ^~~~~
a.cc:16:21: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   16 |   sort(a.begin(), a.end());
      |                     ^~~
Language: C++

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

int main()
{
  int N, K;
  cin >> N >> K;
  
  int a[N] = 0;
  int x;
  for (int i = 0; i < N; i++) {
    cin >> x;
    a[x]++;
  }
  
  sort(a.begin(), a.end());
  
  int ans = 0;
  for (int i = 0; i < N-2;i++) ans += a[i];
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: array must be initialized with a brace-enclosed initializer
    9 |   int a[N] = 0;
      |              ^
a.cc:16:10: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   16 |   sort(a.begin(), a.end());
      |          ^~~~~
a.cc:16:21: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   16 |   sort(a.begin(), a.end());
      |                     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool bigorder(const int& a, cont int& b)
{
  return a > b;
}
int main()
{
  int K, N;
  cin >> N >> K;
  vector <int> A(N+1);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A[a]++;
  }
  sort(A.begin(), A.end(), bigorder);
  int ans = 0;
  for (int i = K; i <= N; i++) {
    ans += A[i];
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:5:29: error: 'cont' has not been declared
    5 | bool bigorder(const int& a, cont int& b)
      |                             ^~~~
a.cc:5:29: error: two or more data types in declaration of 'b'
a.cc: In function 'bool bigorder(...)':
a.cc:7:10: error: 'a' was not declared in this scope
    7 |   return a > b;
      |          ^
a.cc:7:14: error: 'b' was not declared in this scope
    7 |   return a > b;
      |              ^
Language: C++

#include <iostream>
#include <vector>
#include <algprothm>
using namespace std;
bool bigorder(const int& a, cont int& b)
{
  return a > b;
}
int main()
{
  int K, N;
  cin >> N >> K;
  vector <int> A(N+1);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A[a]++;
  }
  sort(A.begin(), A.end(), bigorder);
  int ans = 0;
  for (int i = K; i <= N; i++) {
    ans += A[i];
  }
  cout << ans << endl;
  return 0;
}


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

import sys
from collections import Counter

n, k, *a = map(int, sys.stdin.read().split())

def main():
    c = Counter(a)
    res = sum(sorted(c.values())[:-k])
    print(res)

if __name__ ==  '__main__':
    main()

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

//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

int main() {
	ll N; cin >> N;
	vector<ll> A(N); rep(i, N) cin >> A[i];

	map<ll, ll> p;
	ll cnt = 0;
	rep(i, N) if (p[A[i]] == 0) {
		cnt++;
		p[A[i]] = 1;
	}
	
	if (cnt > K) cout << cnt - K << endl;
	else cout << 0 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:19: error: 'K' was not declared in this scope
   76 |         if (cnt > K) cout << cnt - K << endl;
      |                   ^
Language: C++

#include <iostream>
using namespace std;

int main(){
    int N,K;
    cin >> N >> K;
    int a[N];
    for (int i = 0; i < N; i++) cin >> a[i];
    int kind[N], Quantity[N]; //kind[i] : 数字の種類, Quantity : kind[i]の数字のa[]内の個数
    for (int i = 0; i < N; i++) {
        Quantity[i] = 0;
        for (int j = i; j < N; j++){
            if(a[j] != 0) {
                kind[i] = a[j];
                break;
            }
        }
        for (int j = i; j < N; j++) {
            if (a[j] == kind[i]) {
                Quantity[i]++;
                a[j] = 0;
            }
        }
    }
    //数字が何種類あるか
    int kindQ = 0;
    for (int i = 0; i < N; i++) {
        if (kind[i] != _NULL) {
            kindQ++;
        } else break;
    }
    int result = 0;
    if (kindQ > K) {
        for (int i = 0; i < kindQ; i++) {
            int min = Quantity[i], minindex = i;
            for (int j = i; j < kindQ; j++){
                if (min > Quantity[j]){
                    min = Quantity[j];
                    minindex = j;
                }
            }
            if (minindex != i) {
                int tmp = Quantity[minindex];
                Quantity[minindex] = Quantity[i];
                Quantity[i] = tmp;
            } 
        }
        for (int i = 0; i < kindQ-K; i++) {
            result += Quantity[i];
        }
    }
    cout << result << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:24: error: '_NULL' was not declared in this scope; did you mean 'NULL'?
   28 |         if (kind[i] != _NULL) {
      |                        ^~~~~
      |                        NULL
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[2000010];
int main(){
    int l=100000,r=0;
    int n,k;
    cin>>n>>k;
    int d;
    for(int i=1;i<=k;i++){
        cin>>d;
        a[d]++;
        l=min(l,d);
        r=max(r,d);
    }
    if(r-i+1<=k){
        cout<<0<<endl;
        return 0;
    }
    sort(a+l,a+r+1);
    int ans=0;
    while(r-l+1>k){
        ans+=a[l];
        l++;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'i' was not declared in this scope
   15 |     if(r-i+1<=k){
      |          ^
Language: C++

sing namespace std;
array<int,200010> ll;
int main()
{
    int n,k;
    cin >> n >> k;
    int tmp;
    map<int,int> m;
    int count = 0;
    for(int i = 0;i < n;i++)
    {
        cin >> tmp;
        if(m.count(tmp))
        {
            m[tmp]++;
        }
        else
        {
            m.insert(make_pair(tmp,1));
            count++;
        }
    }
    if(count <= k)
    {
        cout << "0\n";
        return 0;
    }
    vector<int> v;
    for(auto x : m)
    {
        if(x.second != 0)
            v.push_back(x.second);
    }
    sort(v.begin(),v.end());
    int sum = 0;
    for(int i = 0;i < (int)v.size();++i)
    {
        sum += v[i];
        if(count - v[i] <= k)
            break;
        count -= v[i];
    }
    cout << sum << '\n';
}

Compiler output:
a.cc:1:1: error: 'sing' does not name a type
    1 | sing namespace std;
      | ^~~~
a.cc:2:1: error: 'array' does not name a type
    2 | array<int,200010> ll;
      | ^~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> n >> k;
      |     ^~~
a.cc:8:5: error: 'map' was not declared in this scope
    8 |     map<int,int> m;
      |     ^~~
a.cc:8:9: error: expected primary-expression before 'int'
    8 |     map<int,int> m;
      |         ^~~
a.cc:13:12: error: 'm' was not declared in this scope
   13 |         if(m.count(tmp))
      |            ^
a.cc:19:22: error: 'make_pair' was not declared in this scope
   19 |             m.insert(make_pair(tmp,1));
      |                      ^~~~~~~~~
a.cc:25:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   25 |         cout << "0\n";
      |         ^~~~
      |         count
a.cc:28:5: error: 'vector' was not declared in this scope
   28 |     vector<int> v;
      |     ^~~~~~
a.cc:28:12: error: expected primary-expression before 'int'
   28 |     vector<int> v;
      |            ^~~
a.cc:29:18: error: 'm' was not declared in this scope
   29 |     for(auto x : m)
      |                  ^
a.cc:32:13: error: 'v' was not declared in this scope
   32 |             v.push_back(x.second);
      |             ^
a.cc:34:10: error: 'v' was not declared in this scope
   34 |     sort(v.begin(),v.end());
      |          ^
a.cc:34:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   34 |     sort(v.begin(),v.end());
      |     ^~~~
      |     short
a.cc:43:5: error: 'cout' was not declared in this scope; did you mean 'count'?
   43 |     cout << sum << '\n';
      |     ^~~~
      |     count
Language: C++

#include <bits/stdc++.h>

#define pow(n) (n)*(n)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using namespace std;


int main (void) 
{

  /* Variable_Proclamation */
  int N;    // input
  int K;    // input

  int i;    // subscript
  int comp; // comparison
  int dif;
  int rewrite; // output


  /* Input, Array_Proclamation */
  cin >> N >> K;
  vector<int> A(N);

  vector< pair<int, int> > kinds;


  for(i=0; i<N; i++)
  {
    cin >> A.at(i);
  }


  /* Initialize */
  comp  = 0;
  count = 0;
  rewrite = 0;


  /* Calculation */

  sort( all(A) );

  for(i=0; i<N; i++)
  {
    if( comp != A.at(i) )
    {
      comp  = A.at(i);
      kinds.push_back( make_pair(1, comp) );
    }
    else
    {
      kinds.at( kinds.size() -1 ).first++;
    }
  }

  sort   ( all(kinds) );
  reverse( all(kinds) );

  dif = kinds.size() - K;

  while(dif > 0)
  {

    rewrite += kinds.at( kinds.size() -1 ).first;
    dif--;
    
    kinds.pop_back();

  }
  

  /* Output */
  cout << rewrite << endl;


  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:11: error: overloaded function with no contextual type information
   38 |   count = 0;
      |           ^
Language: C++

#include <stdio.h>

int quick(int *arr, int L, int R);
void exch(int *arr, int i, int j);
void merge(int *arr, int L, int R);

int main()
{
	int N, K, i, T, j = 0, M, sum = 0;
	int arr[200001] = {0};

	scanf("%d %d", &N, &K);

	for (i = 0; i < N; i++)
	{
		scanf("%d", &T);
		arr[T]++;
	}

	merge(arr, 0, N);

	for (i = N-K; i >= 0; i--)
	{
		sum += arr[i];
	}

	printf("%d\n", sum);
}

int quick(int *arr, int L, int R)
{
	int left = L-1;
	int right = R;
	int index = L;
	int less = R;
	static int b[2] = {0};

	while (index < right)
	{
		if (arr[index] < arr[less])
			exch(arr, ++left, index++);
		else if(arr[index] > arr[less])
			exch(arr, --right, index);
		else
			index++;
	}
	exch(arr, right, less);

	b[0] = left+1;
	b[1] = right-1;
	
	return b;
}

void merge(int *arr, int L, int R)
{
	int *b;
	if (L < R)
	{
		b = quick(arr, L, R);
		merge(arr, L, b[0]-1);
		merge(arr, b[1]+1, R);
	}
}

void exch(int *arr, int i, int j)
{
	int temp;
	temp = arr[i];
	arr[i] = arr[j];
	arr[j] = temp;
}

Compiler output:
a.cc: In function 'int quick(int*, int, int)':
a.cc:52:16: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   52 |         return b;
      |                ^
      |                |
      |                int*
a.cc: In function 'void merge(int*, int, int)':
a.cc:60:26: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   60 |                 b = quick(arr, L, R);
      |                     ~~~~~^~~~~~~~~~~
      |                          |
      |                          int
Language: C++

#include <stdio.h>

int quick(int *arr, int L, int R);
void exch(int *arr, int i, int j);
void merge(int *arr, int L, int R);

int main()
{
	int N, K, i, T, j = 0, M, sum = 0;
	int arr[200001] = {0};

	scanf("%d %d", &N, &K);

	for (i = 0; i < N; i++)
	{
		scanf("%d", &T);
		arr[T]++;
	}

	merge(arr, 0, N);

	for (i = N-K; i >= 0; i--)
	{
		sum += arr[i];
	}

	for (i = 0; i <= N; i++)
	{
		printf("%d ", arr[i]);
	}

	
	printf("\n");

	printf("%d\n", sum);
}

int quick(int *arr, int L, int R)
{
	int left = L-1;
	int right = R;
	int index = L;
	int less = R;
	static int b[2] = {0};

	while (index < right)
	{
		if (arr[index] < arr[less])
			exch(arr, ++left, index++);
		else if(arr[index] > arr[less])
			exch(arr, --right, index);
		else
			index++;
	}
	exch(arr, right, less);

	b[0] = left+1;
	b[1] = right-1;
	
	return b;
}

void merge(int *arr, int L, int R)
{
	int *b;
	if (L < R)
	{
		b = quick(arr, L, R);
		merge(arr, L, b[0]-1);
		merge(arr, b[1]+1, R);
	}
}

void exch(int *arr, int i, int j)
{
	int temp;
	temp = arr[i];
	arr[i] = arr[j];
	arr[j] = temp;
}

Compiler output:
a.cc: In function 'int quick(int*, int, int)':
a.cc:60:16: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   60 |         return b;
      |                ^
      |                |
      |                int*
a.cc: In function 'void merge(int*, int, int)':
a.cc:68:26: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   68 |                 b = quick(arr, L, R);
      |                     ~~~~~^~~~~~~~~~~
      |                          |
      |                          int
Language: C++

#include <stdio.h>

int quick(int *arr, int L, int R);
void exch(int *arr, int i, int j);
void merge(int *arr, int L, int R);

int main()
{
	int N, K, i, j = 0, M, sum = 0;
	int arr[200000] = {0};
	int b[20000] = {0};

	scanf("%d %d", &N, &K);

	for (i = 0; i < N; i++)
	{
		scanf("%d", &arr[i]);
	}

	merge(arr, 0, N-1);

	b[0] = 1;
	for (i = 1; i < N; i++)
	{
		if (arr[i] == arr[i-1])
			b[j]++;
		else
			b[++j]++;
	}
	M = j+1;
	merge(b, 0, M-1);
	for (i = M-1-K; i >= 0; i--)
	{
		sum += b[i];
	}

	printf("%d\n", sum);
}

int quick(int *arr, int L, int R)
{
	int left = L-1;
	int right = R;
	int index = L;
	int less = R;
	static int b[2] = {0};

	while (index < right)
	{
		if (arr[index] < arr[less])
			exch(arr, ++left, index++);
		else if(arr[index] > arr[less])
			exch(arr, --right, index);
		else
			index++;
	}
	exch(arr, right, less);

	b[0] = left+1;
	b[1] = right-1;
	
	return b;
}

void merge(int *arr, int L, int R)
{
	int *b;
	if (L < R)
	{
		b = quick(arr, L, R);
		merge(arr, L, b[0]-1);
		merge(arr, b[1]+1, R);
	}
}

void exch(int *arr, int i, int j)
{
	int temp;
	temp = arr[i];
	arr[i] = arr[j];
	arr[j] = temp;
}

Compiler output:
a.cc: In function 'int quick(int*, int, int)':
a.cc:62:16: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   62 |         return b;
      |                ^
      |                |
      |                int*
a.cc: In function 'void merge(int*, int, int)':
a.cc:70:26: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   70 |                 b = quick(arr, L, R);
      |                     ~~~~~^~~~~~~~~~~
      |                          |
      |                          int
Language: C++

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
  int n, k;
  cin >> n >> k;
  vi a(n);
  set<int> s;
  rep(i,n) {
    cin >> a[i];
    s.insert(a[i]);
  }
  cout << max(s.size()-k, 0) << endl;
  return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:27:14: error: no matching function for call to 'max(std::set<int>::size_type, int)'
   27 |   cout << max(s.size()-k, 0) << endl;
      |           ~~~^~~~~~~~~~~~~~~
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:27:14: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int')
   27 |   cout << max(s.size()-k, 0) << endl;
      |           ~~~^~~~~~~~~~~~~~~
/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:27:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   27 |   cout << max(s.size()-k, 0) << endl;
      |           ~~~^~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, k, a;
  in2(n, k);
  vector<ll> c(n), d(300000, 0);
  rep(i, n)
    in(c[i]);
  a = 1;
  sort(i, n){
    if(c[i] != c[i + 1])
      a++;
  }
  if(a <= k){
    out(0);
    memi;
    return 0;
  }
  a = a - k;
  rep(i, n)
    d[c[i]]++;
  sort(all(d));
  n = k = 0;
  while(a > 0){
    if(d[k] != 0){
      n = n + d[k];
      a--;
    }
    k++;
  }
  out(n);
  memi;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:8: error: 'i' was not declared in this scope
   24 |   sort(i, n){
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N, K, ans;
  int ans = 0;
  cin >> N >> K;
vector<int> ball(N);
  for(int i = 0; i < N; i++){
   cin >> ball.at(i); 
  }
  vector<int> backets(N);
  for(int i = 0; i < N; i++){
   backets.at(ball.at(i))++; 
  }
  sort(backets.begin(), backets.end());
  for(int i = 0; i < K; i++){

    ans += backets.at(i);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: redeclaration of 'int ans'
    6 |   int ans = 0;
      |       ^~~
a.cc:5:11: note: 'int ans' previously declared here
    5 | int N, K, ans;
      |           ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N, K, ans;
  int ans = 0;
  cin >> N >> K;
vector<int> ball(N);
  for(int i = 0; i < N; i++){
   cin >> ball.at(i); 
  }
  vector<int> backets(N);
  for(int i = 0; i < N; i++){
   backets.at(ball.at(i)-1)++; 
  }
  sort(backets.begin(), backets.end());
  for(int i = 0; i < K; i++){

    ans += backets.at(i);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: redeclaration of 'int ans'
    6 |   int ans = 0;
      |       ^~~
a.cc:5:11: note: 'int ans' previously declared here
    5 | int N, K, ans;
      |           ^~~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:18:6: error: 'k' was not declared in this scope
   18 |      k++;
      |      ^
Language: C++

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

using namespace std;
int main()
{
  int n,k;
  cin >> n >> k ;
  int a[n];
  int c[n]={0};
  int ind[n]={0};
  for(int i=0;i<n;i++){
    cin >> a[i] ;
    c[a[i]-1]++;
    ind[a[i]-1]=1;
  }
  int count = 0;
  for(int i=0;i<n;i++){
    if(ind[i]>0)count++;
  }

  if(count<=k){
    cout << 0 << endl;
    return 0;
  }else{
  int total = 0;
  sort(c,c+n);
    for(int i=1;i<n;++i){
      if(c[i]==c[i-1]){
        continue;
      }else{
        while(c[i]<=0){
         c[i]--;
          total++;
        }
        count--;
        if(count<=k)break;
      }
    }
  }//else
  
    cout << total << endl;
  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:13: error: 'total' was not declared in this scope
   44 |     cout << total << endl;
      |             ^~~~~
Language: C++

#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
    int n,k;
    int a[200010];
    int book1[200010];
    int book2[200010];
    scanf("%d%d",&n,&k);
    memset(book1,0,sizeof(book1));
    memset(kook2,0,sizeof(book2));
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        book1[a[i]]=a[i];
        book2[a[i]]++;
    }
    sort(a,a+n);
    int ans=1;
    for(int i=0;i<n;i++)
    {
       if(book1[a[i]]!=book1[a[0]])
            ans++;
    }
    sort(book2,book2+ans);
    if(ans<=k)
        printf("0\n");
    return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'memset' was not declared in this scope
   12 |     memset(book1,0,sizeof(book1));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<iostream>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc:13:12: error: 'kook2' was not declared in this scope; did you mean 'book2'?
   13 |     memset(kook2,0,sizeof(book2));
      |            ^~~~~
      |            book2
a.cc:30:13: error: expected ';' before '}' token
   30 |     return 0
      |             ^
      |             ;
   31 | }
      | ~
Language: C++

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

int main(){
    int n, k; cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    
    vector<int> b(n, 0);

    int kind = 0;
    for (int i = 0; i < n; i++)
    {
        if(b.at(a.at(i)-1) == 0) kind++;
        b.at(a.at(i) - 1)++;
    }

    int ans = 0;
    if(kind <= k) ans = 0;
    else{
        int amari = kind - k;

        sort(b.begin(), b.end());
        int count = 0;
        for (int i = 0; i < N; i++)
        {
            if(b.at(i) != 0){
                count++;
                ans += b.at(i);
                if(count == amari) break;
            }
        }
        
        cout << ans << endl;

    }
    

    return 0;
}

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

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
      cin >> vec.at(i);
  }
  vector<int> backet(N);
  for(int i =0 ; i < N; i++){
  	backet.at(vec.at(i)-1)++;
  }
  int total = 0;
  for(int i = 0; i < N; i++){
    if(backet.at(i)) total++;
  }
  if(total < K){
  	cout << 0 << endl;
  }
  else{
  	sort(backet.begin(), backet.end());
    int res = 0;
    for(int i = 0; i < total - K; i++){
    	res += backet.at(i)
    }
    cout << res << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:28: error: expected ';' before '}' token
   26 |         res += backet.at(i)
      |                            ^
      |                            ;
   27 |     }
      |     ~
Language: C++

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
      cin >> vec.at(i);
  }
  vector<int> backet(N);
  for(int i = 0 ; i < N; i++){
  	backet.at(vec.at(i))++;
  }
  int total = 0;
  for(int i = 0; i < N; i++){
    if(backet(i) != 0) total++;
  }
  cout << total - K << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: no match for call to '(std::vector<int>) (int&)'
   17 |     if(backet(i) != 0) total++;
      |        ~~~~~~^~~
Language: C++

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
      cin >> vec.at(i);
  }
  vector<int> backet(N);
  for(int i = 0 ; i < N; i++){
  	backet.at(vec.at(i))++;
  }
  int total = 0;
  for(int i = 0; i < N; i++){
    if(backet(i)) total++;
  }
  cout << total - K << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: no match for call to '(std::vector<int>) (int&)'
   17 |     if(backet(i)) total++;
      |        ~~~~~~^~~
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  map<int, int> cnt;
  for (int i = 0; i < N; i++) {
    if(cnt.count(A.at(i))) cnt[A.at(i)] = cnt.at(A.at(i)) + 1;
    else cnt[A.at(i)] = 1;
  }
  vector<int> cnt2(cnt.size());
  int i = 0;
  for (auto p : cnt) {
    cnt2.at(i) = p.second;
    i++;
  }
  sort(cnt2.begin(), cnt2.end());
  if (cnt.size() <= K) cout << 0 << endl;
  else {
    int sum = 0;
    for (int j = 0; j < cnt.size() - K; j++) {
      sum += cnt2.at(j)
    }
    cout << sum << endl;
  }
}
  
    


Compiler output:
a.cc: In function 'int main()':
a.cc:28:24: error: expected ';' before '}' token
   28 |       sum += cnt2.at(j)
      |                        ^
      |                        ;
   29 |     }
      |     ~
Language: C++

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N, 0);
    for (int i = 0;i < N; i++) {
        cin >> A.at(i);
    }
    vector<int> ball(N+1, 0);
    int kind = 0;
    for (int i = 0; i < N; i++) {
        ball.at(A.at(i))++;
    }
    for (int i = 0; i < N+1; i++) {
        if (ball.at(i)) {
            kind++;
        }
    }
    sort(ball.begin(), ball.end());
    int ans = 0; now = 0;
    while (kind - K > 0) {
        if (ball.at(now)) {
            ans += ball.at(now);
            kind--;
        }
        now++;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: 'now' was not declared in this scope; did you mean 'pow'?
   22 |     int ans = 0; now = 0;
      |                  ^~~
      |                  pow
Language: C++

#include<bits/stdc++.h>

using namespace std;

int a[2000010];

int main(){
    int l=100000,r=0;
    int n,k;
    cin>>n>>k;
    int d;
    for(int i=1;i<=k;i++)
    {
        cin>>d;
        a[d]++;
        l=min(l,d);
        r=max(r,d);
    }
    if(r-i+1<=k) {
        cout<<0;
        return 0;
    }
    sort(a+l,a+r+1);
    int ans=0;
    while(r-l+1>k)
    {
        ans+=a[l];
        l++;
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: 'i' was not declared in this scope
   19 |     if(r-i+1<=k) {
      |          ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main (){
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  num[210000];
  for(int i=0; i<N;i++){
    cin >> A[i];
    num[A[i]]++;
  }
  sort(num.begin(),num.end());
  int cou=0;
  for(int i=0; i<num.size()-K;i++){
    cou+=num[i];
  }
  cout << cou << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'num' was not declared in this scope; did you mean 'enum'?
    9 |   num[210000];
      |   ^~~
      |   enum
Language: C++

#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main (){
  map<int,int> mp;
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for(int i=0; i<N;i++){
    cin >> A[i];
    mp[A[i]]++;
  }
  sort(mp.begin(),mp.end());
  int res=0;
  if(mp.size()<=K){cout << 0 << endl;}
  else{
    for(int i=0;i<(mp.size()-K);i++){
      res+=mp[i];
    }
    cout << res << 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(mp.begin(),mp.end());
      |   ^~~~
      |   short
Language: C++

#include<iostream>
#include<set>
#include<vector>
#include
using namespace std;
int main (){
  set<string> st;
  int N, K;
  cin >> N >> K;
  vector<string> A(N);
  for(int i=0; i<N;i++){
    cin >> A[i];
    st.insert(A[i]);
  }
  int b;
  b=st.size();
  if(b<=K){cout << 0 << endl;}
  else{cout << b-K << endl;}
}


Compiler output:
a.cc:4:9: error: #include expects "FILENAME" or <FILENAME>
    4 | #include
      |         ^
Language: C++

#include<iostream>
#include<set>
#include<vector>
using namespace std;
int main (){
  set<string> st;
  int N, K;
  cin >> N >> K;
  string A[N]
  for(int i=0; i<N;i++){
    cin >> A[i]
    st.insert(A[i]);
  }
  int b;
  b=st.size();
  if(b<=K){cout << 0 << endl;}
  else{cout << b-K << endl;}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected initializer before 'for'
   10 |   for(int i=0; i<N;i++){
      |   ^~~
a.cc:10:16: error: 'i' was not declared in this scope
   10 |   for(int i=0; i<N;i++){
      |                ^
Language: C++

#include<iostream>
#include<set>
using namespace std;
int main (){
  set<string> st;
  int N, K;
  cin >> N >> K;
  string A[N]
  for(int i=0; i<N;i++){
    cin >> A[i]
    st.insert(A[i]);
  }
  int b;
  b=st.size();
  if(b<=K){cout << 0 << endl;}
  else{cout << b-K << endl;}
}

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

#include<bits/stdc++.h>


using namespace std;
 
int main(){
  long int N,K;

  cin >> N >> K;
  vector<int> a(N);
  vector<int> s;
  vector<int> t(N);
  
  for(int i = 0; i < N; i++){ 
      cin >> a[i];
    

      s[a[i]] += 1; 
  }


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


    long int num = count;
    long int ans = 0;
    for(int i = 0; i < s.size() - K; i++){
           
            ans += s[a[i]];
        }
    
  
  
  cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: cannot resolve overloaded function 'count' based on conversion to type 'long int'
   26 |     long int num = count;
      |                    ^~~~~
Language: C++

#include<bits/stdc++.h>


using namespace std;
 
int main(){
  long int N,K;

  cin >> N >> K;
  vector<int> a(N);
  vector<int> s(N);
  vector<int> t(N);
  int count = 0;
  for(int i = 0; i < N; i++){ 
      cin >> a[i];
      if(s[a[i]] == 0) count++;

      s[a[i]] += 1; 
  }


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


    long int num = count;
    long int ans = 0;
    for(int i = 0; i < s.size() - K; i++){
           
            ans += s[a[i]];
        }
    }
  
  
  cout << ans;
    return 0;
}

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

#include<bits/stdc++.h>


using namespace std;
 
int main(){
  long int N,K;

  cin >> N >> K;
  vector<int> a(N);
  vector<int> s;
  vector<int> t(N);
 
  for(int i = 0; i < N; i++){ 
      cin >> a[i];
      s[a[i]] += 1; 
  }

  int count = 0;
  
  sort(s.begin(),s.end());


    long int num = s.size;
    long int ans = 0;
    for(int i = 0; i < N; i++){
        if(num > K && t[a[i]] == 0){
            num = num - 1;
            ans += s[a[i]];
            t[a[i]] = 1;
        }
    }
  
  
  cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:22: error: cannot convert 'std::vector<int>::size' from type 'std::vector<int>::size_type (std::vector<int>::)() const noexcept' {aka 'long unsigned int (std::vector<int>::)() const noexcept'} to type 'long int'
   24 |     long int num = s.size;
      |                      ^~~~
Language: C++

#include<bits/stdc++.h>


using namespace std;
 
int main(){
  long int N,K;

  cin >> N >> K;
  map<int> a(N);
  vector<int> s(N);
  vector<int> t(N);
 
  for(int i = 0; i < N; i++){ 
      cin >> a[i];
      s[a[i]] += 1; 
  }

  int count = 0;
  for(int i = 0; i < N; i++){
      if(s[a[i]] != 0) count++;
  }
  sort(s.begin(),s.end());


    long int num = count;
    long int ans = 0;
    for(int i = 0; i < N; i++){
        if(num > K && t[a[i]] == 0){
            num = num - 1;
            ans += s[a[i]];
            t[a[i]] = 1;
        }
    }
  
  
  cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: wrong number of template arguments (1, should be at least 2)
   10 |   map<int> a(N);
      |          ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:15:15: error: invalid types 'int[int]' for array subscript
   15 |       cin >> a[i];
      |               ^
a.cc:16:10: error: invalid types 'int[int]' for array subscript
   16 |       s[a[i]] += 1;
      |          ^
a.cc:21:13: error: invalid types 'int[int]' for array subscript
   21 |       if(s[a[i]] != 0) count++;
      |             ^
a.cc:29:26: error: invalid types 'int[int]' for array subscript
   29 |         if(num > K && t[a[i]] == 0){
      |                          ^
a.cc:31:23: error: invalid types 'int[int]' for array subscript
   31 |             ans += s[a[i]];
      |                       ^
a.cc:32:16: error: invalid types 'int[int]' for array subscript
   32 |             t[a[i]] = 1;
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[2000010];
int main() {
	int l=100000,r=0;
	int n,k;
	cin>>n>>k;
	int d;
	for(int i=1; i<=k; i++) {
		cin>>d;
		a[d]++;
		l=min(l,d);
		r=max(r,d);
	}
	if(r-i+1<=k) {
		cout<<0;
		return 0;
	}
	sort(a+l,a+r+1);
	int ans=0;
	while(r-l+1>k) {
		ans+=a[l];
		l++;
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 'i' was not declared in this scope
   15 |         if(r-i+1<=k) {
      |              ^
Language: C++

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


// ------------------------

void solve() {
    int N, K; cin >> N >> K;
    vector<int> A(N); rep(i, N) cin >> A[i];
    map<P> mp; rep(i, N) ++mp[A[i]];

    // prioriy que
    auto greater = [](const P& x, const P& y){
        return x.second > y.second;
    };
    priority_queue< P, vector<P>, decltype(greater) > que(greater);
    for( auto m : mp ){
        que.push(m);
    }

    int ans = 0;
    rep(i, (int)(mp.size()-K)){
        ans += que.top().second;
        que.pop();
    }

     cout << ans << "\n";
}

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

Compiler output:
a.cc: In function 'void solve()':
a.cc:13:10: error: wrong number of template arguments (1, should be at least 2)
   13 |     map<P> mp; rep(i, N) ++mp[A[i]];
      |          ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:13:30: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   13 |     map<P> mp; rep(i, N) ++mp[A[i]];
      |                              ^
a.cc:20:19: error: 'begin' was not declared in this scope
   20 |     for( auto m : mp ){
      |                   ^~
a.cc:20:19: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:20:19: error: 'end' was not declared in this scope
   20 |     for( auto m : mp ){
      |                   ^~
a.cc:20:19: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:25:21: error: request for member 'size' in 'mp', which is of non-class type 'int'
   25 |     rep(i, (int)(mp.size()-K)){
      |                     ^~~~
a.cc:2:40: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (int i = 0; i < (n); ++i)
      |                                        ^