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

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

void fnInput(vector<int>& rvnBallCnt, int& rnVarie)
{
  int nBallSiz;
  cin >> nBallSiz >> rnVarie;

  rvnBallCnt.resize(nBallSiz);
  for (int i = 0; i < nBallSiz; i++)
  {
    int nBall;
    cin >> nBall;
    rvnBallCnt[nBall]++
  }
}

int fnRewCount(vector<int>& rvnBallCnt, int nVarie)
{
  sort(begin(rvnBallCnt), end(rvnBallCnt));
  int nRewCnt = 0;

  for (int i = 0; i < rvnBallCnt.size() - nVarie; i++)
    nRewCnt += rvnBallCnt[i];

  return nRewCnt;
}

int main()
{
  vector<int> vnBallCnt;
  int nVarie;
  fnInput(vnBallCnt, nVarie);
  cout << fnRewCount(vnBallCnt, nVarie) << endl;

  return 0;
}

Compiler output:
a.cc: In function 'void fnInput(std::vector<int>&, int&)':
a.cc:14:24: error: expected ';' before '}' token
   14 |     rvnBallCnt[nBall]++
      |                        ^
      |                        ;
   15 |   }
      |   ~
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> ball(N+1);
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    ++ball[a];
  }
  
  sort(v.rbegin(), v.rend());
  
  int leave_Ball = 0;
  
  for (int i = 0; i < K; ++i) {
    leave_Ball += ball[i];
  }
  
  int ans = N - leave_Ball;
  
  cout << ans << endl;

    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:8: error: 'v' was not declared in this scope
   14 |   sort(v.rbegin(), v.rend());
      |        ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	vector<int> num;
	int existCount;
	int answer;
	int N;
	int K;

	cin >> N >> K;

	int A[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i]; 
		num.at( A[i] -1 )++;
	}

	// 0でない個数を求める
	for (int j = 0; j < num.size() ; j++) {

		if (num.at(j) != 0) existCount++;

	}


	if (existCount <= K) {
		
		answer = 0;

	}
	else {
		
		answer = 0;
		sort(num.begin(), num.end());  // 昇順にソート
		
		for (i = 0; i < existCount - K; i++ ) {
			
			answer += num.at(i);
		
		}
	}
	
	cout << answer << endl;

	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int vector<int> num;
	int existCount;
	int answer;
	int N;
	int K;

	cin >> N >> K;

	int A[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i]; 
		num.at( A[i] -1 )++;
	}

	// 0でない個数を求める
	for (int j = 0; j < num.size() ; j++) {

		if (num.at(j) != 0) existCount++;

	}


	if (existCount <= K) {
		
		answer = 0;

	}
	else {
		
		answer = 0;
		sort(num.begin(), num.end());  // 昇順にソート
		
		for (i = 0; i < existCount - K; i++ ) {
			
			answer += num.at(i);
		
		}
	}
	
	cout << answer << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:25: error: invalid declarator before 'num'
    6 |         int vector<int> num;
      |                         ^~~
a.cc:17:17: error: 'num' was not declared in this scope; did you mean 'enum'?
   17 |                 num.at( A[i] -1 )++;
      |                 ^~~
      |                 enum
a.cc:21:29: error: 'num' was not declared in this scope; did you mean 'enum'?
   21 |         for (int j = 0; j < num.size() ; j++) {
      |                             ^~~
      |                             enum
a.cc:36:22: error: 'num' was not declared in this scope; did you mean 'enum'?
   36 |                 sort(num.begin(), num.end());  // 昇順にソート
      |                      ^~~
      |                      enum
a.cc:38:22: error: 'i' was not declared in this scope
   38 |                 for (i = 0; i < existCount - K; i++ ) {
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int num[20000];
	int answer;
	int N;
	int K;

	cin >> N >> K;

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

	// 0でない個数を求める
	for (int j = 1; j <= 20000 ; i++) {

		if (num[j] != 0) answer++;

	}

	answer -= K;

	cout << max(0,answer) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:38: error: 'i' was not declared in this scope
   20 |         for (int j = 1; j <= 20000 ; i++) {
      |                                      ^
Language: C++

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

ll gcd(ll a, ll b){
  return (b != 0) ? gcd(b, a%b) : a;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int a[200050];
  rep(i, n){
    int tmp;
    cin >> tmp;
    a[tmp]++;
  }
  
  if(k >= a.size()){cout << 0 << "\n"; return 0;}
  int ans = 0;
  vector<int> cnt(n+1);
  cnt[0] = 1e6;
  for(int i = 1; i <= n; ++i) cnt[i] = a[i];
  sort(cnt.begin(), cnt.end());
  for(int i = 0; i < (a.size()-k); ++i) ans += cnt[i];
  cout << ans << "\n";
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: request for member 'size' in 'a', which is of non-class type 'int [200050]'
   24 |   if(k >= a.size()){cout << 0 << "\n"; return 0;}
      |             ^~~~
a.cc:30:25: error: request for member 'size' in 'a', which is of non-class type 'int [200050]'
   30 |   for(int i = 0; i < (a.size()-k); ++i) ans += cnt[i];
      |                         ^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<set>
#include<iomanip>
#include<utility>
#include<deque>
#include<vector>
#include<locale>
#include<sstream>
#define f(i,a,b) for(int i=a;i<=b;i++)
typedef long long ll;
using namespace std;
int a[2000010];
int main(){
    int l=100000,r=0;
    int n,k;
    scanf("%d%d",&n,&k);
    int d;
    for(int i=1;i<=k;i++){
        scanf("%d",&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:30:10: error: 'i' was not declared in this scope
   30 |     if(r-i+1<=k){
      |          ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define MAX_K 200100

int main() {
  int N, K, cur = 0;
  cin >> N >> K;

  vector<int> A(N, 0);
  vector<int> cnt(MAX_K, 0);

  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (!cnt[A[i]]) cur++;
    cnt[A[i]] += 1;
  }

  sort(cnt.begin(), cnt.end());
  int ans = 0, diff = cur - K;
  for (int i = 0; i < cnt.size(); i++) {
    if (diff <= 0) break;
    if (cnt[i]) {
      ans += cnt[i];
      diff--;
    }
  }
  cout << ans << endl;
  return 0;
}

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

#include<stdio.h>
#include<algorithm>
#include<funcutional>
using namespace std;
int main(void)
{
	int N, K;
	int a[200000];
	int count[200000] = { 0 };
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; i++) {
		scanf("%d", &a[i]);
		count[a[i]]++;
	}
	sort(a, a + N, greater<int>());
	int i = 0;
	int sum = 0;
	while (true) {
		if (i > K) {
			sum += count[i];
		}
		else if (count[i] == 0) {
			break;
		}
		i++;
	}
	printf("%d", sum);


	return 0;
}


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

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

const int N = 2e5;

int n,m;
int li[N+5];

vector<int> com;

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&li[i]);
	}
	sort(li+1,li+n+1);
	int cnt = 1;
	com.clear();
	for(int i=2;i<=n;i++){
		if(li[i] == li[i-1]){
			cnt++;
		} else {
			com.push_back(cnt);
			cnt = 1;
		}
	}
	com.push_back(cnt);
	sort(com.begin(),com.end());
	reverse(com.begin(),com.end());
	int ans = n;
	for(int i=0;i<min(m,com.size());i++){
		ans-=com[i];
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:26: error: no matching function for call to 'min(int&, std::vector<int>::size_type)'
   31 |         for(int i=0;i<min(m,com.size());i++){
      |                       ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:31:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   31 |         for(int i=0;i<min(m,com.size());i++){
      |                       ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:31:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   31 |         for(int i=0;i<min(m,com.size());i++){
      |                       ~~~^~~~~~~~~~~~~~
Language: C++

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

using namespace std;

int main(void)
{
	int n = 0, k = 0, num = 0, cnt =0, sum=0;
	int bnum;
	bool flg = true;
	vector<int> vec;
	vector<int> mem;

	cin >> n; //個数
	cin >> k; //種類

	for (int i = 0; i < n; i++)
	{
		cin >> num;
		vec.push_back(num);
	}

	sort(vec.begin(), vec.end());
	bnum = vec[0];
	for (int i = 0; i < n; i++)
	{
		if (vec[i] != bnum)
		{
			bnum = vec[i];
			cnt++;
		}
		else
		{
			mem[cnt] += 1;
		}
	}

	//どの数値が何個あるか迄完成
	sort(mem.begin, mem.end);
	while ( int a = 0 <= mem.size() -k)
	{
		sum += mem[a];
		a++;
	}

	cout << sum <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:13: error: no matching function for call to 'sort(<unresolved overloaded function type>, <unresolved overloaded function type>)'
   40 |         sort(mem.begin, mem.end);
      |         ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   template argument deduction/substitution failed:
a.cc:40:13: note:   couldn't deduce template parameter '_RAIter'
   40 |         sort(mem.begin, mem.end);
      |         ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C

#include <stdio.h>

// 15min
int main(void){
  int n = 0;
  int k = 0;
  int a[200001];
  int cnt[200001];

  scanf("%d%d", &n, &k);

  // 全てのcntを0にしておく
  for(int i = 0; i < 20001; i++){
    cnt[i] = 0;
  }
  
  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
    cnt[a[i]]++;
  }

  for(cnt[]){

  }

  while()
  
  
  return 0;
  
}


Compiler output:
main.c: In function 'main':
main.c:22:11: error: expected expression before ']' token
   22 |   for(cnt[]){
      |           ^
main.c:22:12: error: expected expression before ')' token
   22 |   for(cnt[]){
      |            ^
main.c:26:9: error: expected expression before ')' token
   26 |   while()
      |         ^
Language: C++

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

int main() {
  int num, limit;
  std::map<int,int> data;
  std::cin >> num >> limit;
  for (int i=0; i<num; i++) {
    int temp_num;
    std::cin >> temp_num;
    if(data.count(temp_num)) {
      data.at(temp_num)++;
    }
    else {
      data[temp_num] = 1;
    }
  }
  
  std::priority_queue<int, std::vector<int>, std::greater<int>> queue;
  for (auto p:data) {
    int temp_num = p.second;
    queue.push(temp_num);
  }
  
  if(data.size() <= limit) {
    std::cout << 0 << std::endl;
  }
  else {
    int sum = 0;
    for (int i=0; i<data.size()-limit; i++) {
      sum += queue.top()
    }
    std::cout << sum << std::endl;
  }
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:34:25: error: expected ';' before '}' token
   34 |       sum += queue.top()
      |                         ^
      |                         ;
   35 |     }
      |     ~
Language: C++

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

int main() {
  int num, limit;
  std::map<int,int> data;
  std::cin >> num >> limit;
  for (int i=0; i<num; i++) {
    int temp_num;
    std::cin >> temp_num;
    if(data.count(temp_num)) {
      data.at(temp_num)++;
    }
    else {
      data[temp_num] = 1;
    }
  }
  
  std::priority_queue<int, std::vector<int>, std::greater<int>> queue;
  for (auto p:data) {
    int temp_num = data.second;
    queue.push(temp_num);
  }
  
  if(data.size() <= limit) {
    std::cout << 0 << std::endl;
  }
  else {
    int sum = 0;
    for (int i=0; i<data.size()-limit; i++) {
      sum += queue.top()
    }
    std::cout << sum << std::endl;
  }
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: 'class std::map<int, int>' has no member named 'second'
   24 |     int temp_num = data.second;
      |                         ^~~~~~
a.cc:34:25: error: expected ';' before '}' token
   34 |       sum += queue.top()
      |                         ^
      |                         ;
   35 |     }
      |     ~
Language: C++

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

int main() {
  int num, limit;
  std::map<int,int> data;
  std::cin >> num >> limit;
  for (int i=0; i<num; i++) {
    int temp_num;
    std::cin >> temp_num;
    if(data.count(temp_num)) {
      temp_num.at(temp_num)++;
    }
    else {
      data[temp_num] = 1;
    }
  }
  
  std::priority_queue<int, std::vector<int>, std::greater<int>> queue;
  for (auto p:data) {
    int temp_num = data.second;
    queue.push(temp_num);
  }
  
  if(data.size() <= limit) {
    std::cout << 0 << std::endl;
  }
  else {
    int sum = 0;
    for (int i=0; i<data.size()-limit; i++) {
      sum += queue.top()
    }
    std::cout << sum << std::endl;
  }
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: request for member 'at' in 'temp_num', which is of non-class type 'int'
   15 |       temp_num.at(temp_num)++;
      |                ^~
a.cc:24:25: error: 'class std::map<int, int>' has no member named 'second'
   24 |     int temp_num = data.second;
      |                         ^~~~~~
a.cc:34:25: error: expected ';' before '}' token
   34 |       sum += queue.top()
      |                         ^
      |                         ;
   35 |     }
      |     ~
Language: C++

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

int main() {
  int num, limit;
  std::map<int,int> data;
  std::cin >> num >> limit;
  for (int i=0; i<num; i++) {
    int temp_num;
    std::cin >> temp_num;
    if(data.count(temp_num)) {
      temp_num.at(temp_num)++;
    }
    else {
      data[temp_num] = 1;
    }
  }
  
  std::priority_queue<int, std::vector<int>, std::greater<int>> queue;
  for (auto p:data) {
    int temp_num = data.second;
    queue.push(temp_num);
  }
  
  if(data.size() <= limit) {
    std::cout << 0 << std::endl;
  }
  else {
    int sum = 0;
    for (int i=0; i<data.size()-limit; i++) {
      sum += queue.top()
    }
    std::cout << sum << std::endl;
  }
}
    
  

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

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

int main() {
  int num, limit;
  std::map<int,int> data;
  std::cin >> num >> limit;
  for (int i=0; i<num; i++) {
    int temp_num;
    std::cin >> temp_num;
    if(data.count(temp_num)) {
      temp_num.at(temp_num)++;
    }
    else {
      data[temp_num] = 1;
    }
  }
  
  std::priority_queue<int, std::vector<int>, std::greater<int>> queue;
  for (auto p:data) {
    int temp_num = data.second;
    queue.push(temp_num);
  }
  
  if(data.size() <= limit) {
    std::cout << 0 << std::endl;
  }
  else {
    int sum = 0;
    for (int i=0; i<data.size()-limit; i++) {
      sum += queue.top()
    }
    std::cout << sum << std::endl;
  }
}
    
  

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

    #include <iostream>
    using namespace std;
     
    int b[200007] = { };
     
    int main(){
      int n, k;
      cin >> n >> k;
      int arr[n];
      for(int i = 0; i < n; i++) {
        cin >> arr[i];
        b[arr[i]]++;
      }
      int u = 0, r = 0;
      for(int i = 1; i <= n; i++) if(b[i]) u++;
      sort(b+1, b+n+1);
      for(int i = 1; i <= n; i++){
        if(u <= k){
          cout << r << '\n';
          return 0;
        }
        u--;
        r += b[i];
        if(u <= k){
          cout << r << '\n';
          return 0;
        }
      }
    }

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

#include <iostream>
using namespace std;

int b[200007] = { };

int main(){
  int n, k;
  cin >> n >> k;
  int arr[n];
  for(int i = 0; i < n; i++) {
    cin >> arr[i];
    b[arr[i]]++;
  }
  int u = 0, r = 0;
  for(int i = 1; i <= n; i++) if(b[i]) u++;
  sort(b+1, b+n+1);
  for(int i = 1; i <= n; i++){
    u -= b[i];
    r += b[i];
    if(u <= k){
      cout << r << '\n';
      return 0;
    }
  }
}

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

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
  int n,k,a[n];
  rep(i,n) cin >> a[i];
  int count[n];
  set<int> num;
  rep(i,n) count[i]=0;
  rep(i,n) count[a[i]] += 1;
  sort(count.begin(),count.end());
  reverse(count.begin(),count.end());
  rep(i,n) num.insert(a[i]);
  int d = num.size() - k;
  int ans;
  while(d>0){
	rep(i,n) {
      if(a[i]==0) continue;
      else ans+= a[i];
      d-=1;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: request for member 'begin' in 'count', which is of non-class type 'int [n]'
   11 |   sort(count.begin(),count.end());
      |              ^~~~~
a.cc:11:28: error: request for member 'end' in 'count', which is of non-class type 'int [n]'
   11 |   sort(count.begin(),count.end());
      |                            ^~~
a.cc:12:17: error: request for member 'begin' in 'count', which is of non-class type 'int [n]'
   12 |   reverse(count.begin(),count.end());
      |                 ^~~~~
a.cc:12:31: error: request for member 'end' in 'count', which is of non-class type 'int [n]'
   12 |   reverse(count.begin(),count.end());
      |                               ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
  int n,k,a[n];
  rep(i,n) cin >> a[i];
  int count[200010];
  set<int> num;
  rep(i,n) count[i]=0;
  rep(i,n) count[a[i]] += 1;
  sort(count.begin(),count.end());
  reverse(count.begin(),count.end());
  rep(i,n) num.insert(a[i]);
  int d = num.size() - k;
  int ans;
  while(d>0){
	rep(i,n) {
      if(a[i]==0) continue;
      else ans+= a[i];
      d-=1;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: request for member 'begin' in 'count', which is of non-class type 'int [200010]'
   11 |   sort(count.begin(),count.end());
      |              ^~~~~
a.cc:11:28: error: request for member 'end' in 'count', which is of non-class type 'int [200010]'
   11 |   sort(count.begin(),count.end());
      |                            ^~~
a.cc:12:17: error: request for member 'begin' in 'count', which is of non-class type 'int [200010]'
   12 |   reverse(count.begin(),count.end());
      |                 ^~~~~
a.cc:12:31: error: request for member 'end' in 'count', which is of non-class type 'int [200010]'
   12 |   reverse(count.begin(),count.end());
      |                               ^~~
Language: C++

#include<stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
  int n,k,a[n];
  rep(i,n) cin >> a[i];
  int count[200010];
  set<int> num;
  rep(i,n) count[i]=0;
  rep(i,n) count[a[i]] += 1;
  sort(count.begin(),count.end());
  reverse(count.begin(),count.end());
  rep(i,n) num.insert(a[i]);
  int d = num.size() - k;
  int ans;
  while(d>0){
	rep(i,n) {
      if(a[i]==0) continue;
      else ans+= a[i];
      d-=1;
    }
  }
}


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

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

using namespace std;

int main() {
  int N, K;
  int cnt[200001];
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    cnt[a - 1]++;
  }
  if (cnt.size() <= K) {
    cout << 0 << endl;
    return 0;
  }
  sort(cnt, cnt + N);
  int ans = 0;
  for (int i = 0; i < N - K; i++) {
    ans += cnt[i];
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: request for member 'size' in 'cnt', which is of non-class type 'int [200001]'
   15 |   if (cnt.size() <= K) {
      |           ^~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N,K;
    cin >> N >> K;
    vector<int> A(N);
    vector<int> L(N+1);
    for(int i = 0;i<N;i++){
        cin >> A[i];
        L[A[i]]++;
    }
    vector<bool> frags(N+1);
    sort(L.begin(),L.end());
    int kind = 0;
    for(int i = 0;i < N+1;i++){
        if(L[i] > 0){
            frags[i] = 1;
        kind++;
        }
    }
    int a = N;
    for(int i = 0;i < N+1;i++){
        if(kind > K && frags[i]){
            ans += L[i];
            kind--;
        }
    }

    cout << ans << endl;
}

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

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

int cnt[200010];

int main(){
	int N,K;
	cin>>N>>K;
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		cnt[a]++;
	}
	sort(cnt,cnt+200001);
	reverse(cnt,cnt+200001);
	int ans=0;
	for(int i=K;i<200001;i++){
		ans+=cnt[i];
	}
	cout<<ans<<endl;
	return 0;
}#include <bits/stdc++.h>
using namespace std;

int cnt[200010];

int main(){
	int N,K;
	cin>>N>>K;
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		cnt[a]++;
	}
	sort(cnt,cnt+200001);
	reverse(cnt,cnt+200001);
	int ans=0;
	for(int i=K;i<200001;i++){
		ans+=cnt[i];
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:22:2: error: stray '#' in program
   22 | }#include <bits/stdc++.h>
      |  ^
a.cc:22:3: error: 'include' does not name a type
   22 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:25:5: error: redefinition of 'int cnt [200010]'
   25 | int cnt[200010];
      |     ^~~
a.cc:4:5: note: 'int cnt [200010]' previously declared here
    4 | int cnt[200010];
      |     ^~~
a.cc:27:5: error: redefinition of 'int main()'
   27 | int main(){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(){
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i) = 0; (i) < n; (i)++)
#define SORT(a) sort((a).begin(), (a).end())
#define MOD 1000000007#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i) = 0; (i) < n; (i)++)
#define SORT(a) sort((a).begin(), (a).end())
#define MOD 1000000007
typedef long long ll;

int main(void){
  int n, k;
  cin >> n >> k;
  vector<int> hozon(1e6, 0);
  rep(i, n){
    int tmp;
    cin >> tmp;
    hozon[tmp]++;
  }
  sort(hozon.begin(), hozon.end(), greater<int>());
  ll sum = 0;
  for(int i = k; i < hozon.size(); i++){
    sum += hozon[i];
  }
  cout << sum << endl;
  return 0;
}

typedef long long ll;

int main(void){
  int n, k;
  cin >> n >> k;
  vector<int> hozon(10, 0);
  rep(i, n){
    int tmp;
    cin >> tmp;
    hozon[tmp]++;
  }
  sort(hozon.begin(), hozon.end(), greater<int>());
  ll sum = 0;

  for(int i = k; i < hozon.size(); i++){
    sum += hozon[i];
  }
  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc:9:9: warning: "MOD" redefined
    9 | #define MOD 1000000007
      |         ^~~
a.cc:5:9: note: this is the location of the previous definition
    5 | #define MOD 1000000007#include<bits/stdc++.h>
      |         ^~~
a.cc:32:5: error: redefinition of 'int main()'
   32 | int main(void){
      |     ^~~~
a.cc:12:5: note: 'int main()' previously defined here
   12 | int main(void){
      |     ^~~~
Language: C++

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

int main() {
    int n,k;
    cin>>n>>k;
    map<int,int> m;
    for (int i=0;i<n;i++) {
        int a;cin>>a;
        m[a]++;
    }
    vector<int> a;
    for (auto p:m)
        a.push_back(p.second);
    sort(a.begin().a.end());
    int ans=0;
    for (int i=0;i<(int)a.size()-k;i++)
        ans+=a[i];
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'std::vector<int>::iterator' has no member named 'a'
   16 |     sort(a.begin().a.end());
      |                    ^
Language: C++

from collections import Counter
n,k=map(int,input().split())
A=list(map(int,input().split()))
s=len(set(A))
C=Counter(A).most_common()
if s>k:
	for i in range(k):
		n-=C[i][1]
	print(n)
else:
	print(0)

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import Counter
      | ^~~~
Language: C++

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

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> A(N);
    map<int,int> b;//mapはサイズを初期化しなくても代入後自動的に決まる説
    for(int i=0;i<N;i++){
        cin >> A.at(i);
    }
    for(int i=0;i<N;i++){
        b[A.at(i)]++;
    }
    cout<<b.size()<<endl;
    vector<int> c(b.size());
    int j=0;
    for(auto itr=b.begin();itr!=b.end();itr++){
        c.at(j)=itr->second;
        j++;
    }
    sort(c.begin(),c.end());
    reverse(c.begin(),c.end());
    int a=0;
    while(c.size()>K){
        a+=c.at(c.size()-1);
        c.pop_back;
    }
    return 0;
} 
    
    /*set<int> st;
    for(int i=0;i<N;i++){
        st.insert(A.at(i));
    }
    for(auto itr=st.begin();itr!=st.end();itr++){
        cout<< *itr <<endl;
    }
    int c=0;
    while(K!=st.size()){
    st.erase(A.at(A.size()-1));
    c++;
    }
    cout << c <<endl;
}*/



Compiler output:
a.cc: In function 'int main()':
a.cc:27:11: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = int; _Alloc = std::allocator<int>]'
   27 |         c.pop_back;
      |         ~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1324:7: note: declared here
 1324 |       pop_back() _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		int[] A = new int[N];
		for(int i = 0;i < N;i++) {
			A[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		int[] cnt = new int[N];
		for(int i=0;i<A.length;i++) {
			for(int j = 0;j < N;j++) {
				if(A[i] - 1 == j) {
					cnt[j]++;
				}
			}
		}
		Arrays.sort(cnt);
		int ans = 0;
		if(N-K-1 >= 0) {
			for(int i = N-K-1;i > 0;i--) {
				ans += cnt[i];
			}
		}
		System.out.println(ans);
	}
}

Compiler output:
Main.java:22: error: cannot find symbol
		Arrays.sort(cnt);
		^
  symbol:   variable Arrays
  location: class Main
1 error
Language: C++

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

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

    map<int, int> mp;
    for(int i = 0; i < N; i++){
        mp[A[i]]++;
    }
    vector<int> B;
    for(auto p: mp){
        B.push_back(p.second);
    }
    //cout << "Yes"<<endl;

    sort(B.begin(), B.end());
    int sum = 0;
    int f = B.size();
    //cout << B.size() << "  " << K << endl;
    if((B.size()- K) <= 0){
        cout << 0 <<endl;
        return 0;
    }
    else{
        for(int i = 0; i < B.size() - K; i++ ){
            sum += B[i];
        }
        cout << sum <<endl;
    }
}

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

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

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

    map<int, int> mp;
    for(int i = 0; i < N; i++){
        mp[A[i]]++;
    }
    vector<int> B;
    for(auto p: mp){
        B.push_back(p.second);
    }
    //cout << "Yes"<<endl;

    sort(B.begin(), B.end());
    int sum = 0;
    int f = B.size();
    //cout << B.size() << "  " << K << endl;
    if((B.size()- K) <= 0){
        cout << 0 <<endl;
        return 0;
    }
    else{
        for(int i = 0; i < B.size() - K; i++ ){
            sum += B[i];
        }
        cout << sum <<endl;
    }
}

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

#include<stdio.h>
#include<algorithm>
using namespace std;
int main(void)
{
	int N, K;
	int a[200000];
	int count[200000] = { 0 };
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; i++) {
		scanf("%d", &a[i]);
		count[a[i]]++;
	}
	sort(a, a + N, greater<int>());
	int i = 0;
	int sum = 0;
	while (true) {
		if (i > K) {
			sum += count[i];
		}
		else if (count[i] == 0) {
			break;
		}
		i++;
	}
	printf("%d", sum);


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: 'greater' was not declared in this scope
   14 |         sort(a, a + N, greater<int>());
      |                        ^~~~~~~
a.cc:14:32: error: expected primary-expression before 'int'
   14 |         sort(a, a + N, greater<int>());
      |                                ^~~
Language: C++

//  Created by liszt on 2019/07/22.
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,k; cin>>n >>k;
    int sp[n]={0};
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        sp[a[i]-1]++;
    }
    
    int sub=0;
    for(int i=0;i<n;i++)if(sp[i])sub++;
    sort(sp,sp+n);
    
    int ans=0,i=0;
    while(sub>k){
        if(sp[i]){
            ans+=sp[i];
            sub-;
            sp[i]--;
        }
        i++;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: expected primary-expression before ';' token
   22 |             sub-;
      |                 ^
Language: C++

#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
map<int,int> m;
vector<int> v;
signed main(){
	int n,k,ans=0;
	cin>>n>>k;
	f(i,n){
		int a;
		cin>>a;
		m[a]++;
	}
	for(P p:m){
		v.push_back(p.S);
	}
	sort(v.begin(),v.end());
	f(i,v.size()-k)ans+=v[i].F;
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: request for member 'first' in 'v.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
    5 | #define F first
      |           ^~~~~
a.cc:29:34: note: in expansion of macro 'F'
   29 |         f(i,v.size()-k)ans+=v[i].F;
      |                                  ^
Language: C++

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

int main(){
  int n,k;
  cin >> n >> k;
  
  vector<int> a(n);
  vector<int> cnt(n);
  
  for (int i=0; i<n; i++){
    cin >> a.at(i);
    cnt.at(a.at(i)-1)++;
  }
  
  sort(cnt);
  
  int res = 0;
  
  for (int i=0; i<n-k; i++){
    res += cnt.at(i);
  }
  
  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: no matching function for call to 'sort(std::vector<int>&)'
   16 |   sort(cnt);
      |   ~~~~^~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 1 provided
Language: C++

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

using namespace std;

int main(){
  int N;
  cin >> N;
  int K;
  cin >> K;
  map<int, int> ball;
  
  for(int i = 0; i < N; i++){
    int t;
    cin >> t;
    ball[t]++;
  }
  
  int div = 0;
  vector<int> V;
  for(auto itr = ball.begin(); itr != ball.end(); itr++){
    V.push_bakc(itr->second);
    div++;
  }
  sort(V.begin(), V.end());
  int ans = 0;
  for(int i = 0; i < div - K; i++) ans += V[i];
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:7: error: 'class std::vector<int>' has no member named 'push_bakc'; did you mean 'push_back'?
   24 |     V.push_bakc(itr->second);
      |       ^~~~~~~~~
      |       push_back
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[2000010];
int l=100000,r=0; 
int d;
int n,k;
int main(){
    cin>>n>>k;
    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;exit(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++

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

// Problem https://atcoder.jp/contests/abc081/tasks/arc086_a
int solver(int allBall,int kindNum,vector<int> ballNo){
    int result=0


    return result;
}


int main(void){
    int answer=0;
    int N,K;
    cin >> N >> K;
    vector<int> Ai(N);
    for(int j=0;j<N;j++){
        cin >> Ai(j);
    }
    answer = solver(N,K,Ai);
    cout << answer << endl;
}

Compiler output:
a.cc: In function 'int solver(int, int, std::vector<int>)':
a.cc:11:5: error: expected ',' or ';' before 'return'
   11 |     return result;
      |     ^~~~~~
a.cc:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
   12 | }
      | ^
a.cc: In function 'int main()':
a.cc:21:18: error: no match for call to '(std::vector<int>) (int&)'
   21 |         cin >> Ai(j);
      |                ~~^~~
Language: C++

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

// Problem https://atcoder.jp/contests/abc081/tasks/arc086_a
int solver(int allBall,int kindNum,vector<int> ballNo){
    int result=0
        

    return result;
}


int main(void){
    int answer=0;
    int N,K;
    cin >> N >> K;
    vector<int> Ai(N);
    for(int j=0;j<N;j++){
        cin >> Ai(j);
    }
    answer = solver(N,K,Ai);
    cout << answer << endl;
}

Compiler output:
a.cc:6:36: error: 'vector' has not been declared
    6 | int solver(int allBall,int kindNum,vector<int> ballNo){
      |                                    ^~~~~~
a.cc:6:42: error: expected ',' or '...' before '<' token
    6 | int solver(int allBall,int kindNum,vector<int> ballNo){
      |                                          ^
a.cc: In function 'int solver(int, int, int)':
a.cc:10:5: error: expected ',' or ';' before 'return'
   10 |     return result;
      |     ^~~~~~
a.cc:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
   11 | }
      | ^
a.cc: In function 'int main()':
a.cc:17:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   17 |     cin >> N >> K;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:18:5: error: 'vector' was not declared in this scope
   18 |     vector<int> Ai(N);
      |     ^~~~~~
a.cc:18:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:18:12: error: expected primary-expression before 'int'
   18 |     vector<int> Ai(N);
      |            ^~~
a.cc:20:16: error: 'Ai' was not declared in this scope
   20 |         cin >> Ai(j);
      |                ^~
a.cc:22:25: error: 'Ai' was not declared in this scope
   22 |     answer = solver(N,K,Ai);
      |                         ^~
a.cc:23:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   23 |     cout << answer << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:23:23: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   23 |     cout << answer << endl;
      |                       ^~~~
      |                       std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int N, K, A[200001];
	
	cin >> N >> K;
	
	multiset<int> A;
	set<int> B;
	int check[N] = {};
	
	for(int i=0; i<N; i++)
		cin >> A[i];
	
	sort(A, A+N, greater<int>());
	
	int ans = 0;
	
	for(int i = 0; i < K; i++)
		ans += A[i];
	
	cout << n - ans;
	
	return 0;
}//not yet

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: conflicting declaration 'std::multiset<int> A'
   13 |         multiset<int> A;
      |                       ^
a.cc:9:19: note: previous declaration as 'int A [200001]'
    9 |         int N, K, A[200001];
      |                   ^
a.cc:27:17: error: 'n' was not declared in this scope
   27 |         cout << n - ans;
      |                 ^
Language: C++

#include <iostream>
#include <array>
#include <algorithm>

using namespace std;

int main(){
    array<pair<int,int>,200000>num;
    int k,n,sum,ans;
    cin>>n>>k;
    for(int i = 0; i < n; i++){
        int a;
        cin>>a;
        num.at(a-1).first = -1;
        num.at(a-1).second++;
    }
    sort(num.begin(),num.end());
    for(int i = 0; i < n; i++){
        sum = sum - num.at(i).first;
    }
    if(sum-k>0){
        for(int i = 0; i < sum - k; i++){
            ans = ans + num.at(i).second;
        }
    }else{
        ans = 0;
    }
    cout<<ans<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:28:21: error: expected '}' at end of input
   28 |     cout<<ans<<endl;
      |                     ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define itn int
#define rep(i, n) for(int i = 0; i < n; i++)
#define irep(i,n) for(int i = n-1; i>=0; i--)
using namespace std;
typedef long long ll;


int main() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> memo(200000);
  set<int> s;
  rep(i,n){
    int size=s.size();
    cin >> a[i];
    s.push(a[i]);
    if(size<s.size()){
      if(memo[i]!=0){
        memo[i]--;
      }
      else{
        memo[i]=199999;
      }
    }
  }
  if(s.size()<=k){
    cout << 0 << endl;
    return 0;
  }
  sort(memo.begin(),memo.end(),greater<int>());
  int ans=0;
  for(int i = 0;i!=s.size()-k;i++){
    ans+=memo[i]-1;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:7: error: 'class std::set<int>' has no member named 'push'
   18 |     s.push(a[i]);
      |       ^~~~
Language: C

#include<iostream>
#include<vector>

using namespace std;

int main(){
    int N,K;
    int ans=0;
    cin>>N>>K;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
        if(K<A[i]){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

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

using namespace std;

int main(){

    int n, k;
    cin >> n >> k;

    int a;
    vector<int> tmp(n);

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

    sort(tmp.begin(), tmp.end(), greater<int>());

    int ans = n;

    for(int i = 0; i<k; i++)
        ans -= tmp[i]

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:22: error: expected ';' before 'cout'
   25 |         ans -= tmp[i]
      |                      ^
      |                      ;
   26 | 
   27 |     cout << ans << endl;
      |     ~~~~
Language: C++

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

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

    vector<int> v(n+1);
    for (int i = 0; i < n; i++) {
        v[a[i]] += 1;
    }
    sort(v.begin(), v.end());

    int sum = 0;
    for (int i = 0; i < v.size() - k; i++) {
        sum += v[i];
    }

    cout << sum << endl;
}


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

from collections import Counter
n,k=map(int,input().split())

a=[int(i) for i in input().split()]
d=Counter(a)
a=sorted(list(d.items()),key=lambda x:x[1],reverse=True)
if len(a)<=k:
    print(0)
else:
    ans=0
    for i in range(k,len(a)):
        ans+=a[i][1]
    print(ans)
    



Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import Counter
      | ^~~~