Language: C++

#include<bits/stdc++.h>

int main() {
	int N, K, A[N];
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	set<int> values;
	for (int i = 0; i < N; i++) {
		insert.values(A[i]);
	}
	int x = values.size();
	
	int B[x];
	for (int i = 0; i < N; i++) {
		B[A[i]]++;
	}
	sort(B, B + x,greater<int>);
	int rest=0;
	for (int i = 0; i < K; i++) {
		rest += B[i];
	}
	int ans=N-rest;
	cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         cin >> N >> K;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 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:9:9: error: 'set' was not declared in this scope
    9 |         set<int> values;
      |         ^~~
a.cc:9:9: note: suggested alternatives:
In file included from /usr/include/c++/14/set:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158:
/usr/include/c++/14/bits/stl_set.h:96:11: note:   'std::set'
   96 |     class set
      |           ^~~
/usr/include/c++/14/set:87:13: note:   'std::pmr::set'
   87 |       using set = std::set<_Key, _Cmp, polymorphic_allocator<_Key>>;
      |             ^~~
a.cc:9:13: error: expected primary-expression before 'int'
    9 |         set<int> values;
      |             ^~~
a.cc:11:17: error: 'insert' was not declared in this scope; did you mean 'assert'?
   11 |                 insert.values(A[i]);
      |                 ^~~~~~
      |                 assert
a.cc:13:17: error: 'values' was not declared in this scope
   13 |         int x = values.size();
      |                 ^~~~~~
a.cc:19:23: error: 'greater' was not declared in this scope; did you mean 'std::greater'?
   19 |         sort(B, B + x,greater<int>);
      |                       ^~~~~~~
      |                       std::greater
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/stl_function.h:353:12: note: 'std::greater' declared here
  353 |     struct greater;
      |            ^~~~~~~
a.cc:19:31: error: expected primary-expression before 'int'
   19 |         sort(B, B + x,greater<int>);
      |                               ^~~
a.cc:19:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   19 |         sort(B, B + x,greater<int>);
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:25:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   25 |         cout << ans << 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:25:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   25 |         cout << ans << endl;
      |                        ^~~~
      |                        std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~