Language: C++

#include <iostream>
#include <vector>

using namespace std;
vector <int> a(300000, -1);
vector <int> b(300000, 3000000);
int n;

void counter(int k)
{
    int counter = 0;
    while(unique(b.begin(), b.end()) - b.begin() >= k){
        for (int i=0; i<k; i++){
            b.at(i)--;
        }
        sort(b.begin(), b.end());
        counter ++;
    }
    cout << counter;
}
void remove(vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

int main()
{
    cin >> n;
    for (int i=0; i<n; i++){
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    int j = 0;
    int previous = -1;
    for (int i=1; i<=n; i++){
        if (a.at(i)==0){
            break;
        }
        else if (a.at(i) != previous){
            previous = a.at(i);
            j++;
        }
        b.at(j) += 1;
    }
    sort(b.begin(), b.end());
    remove(b, 0);
    for (int i=1; i<=n; i++){
        counter(i);
    }
}

Compiler output:
a.cc: In function 'void counter(int)':
a.cc:12:11: error: 'unique' was not declared in this scope
   12 |     while(unique(b.begin(), b.end()) - b.begin() >= k){
      |           ^~~~~~
a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |         sort(b.begin(), b.end());
      |         ^~~~
      |         short
a.cc: At global scope:
a.cc:21:20: error: 'T' was not declared in this scope
   21 | void remove(vector<T>& vector, unsigned int index)
      |                    ^
a.cc:21:21: error: template argument 1 is invalid
   21 | void remove(vector<T>& vector, unsigned int index)
      |                     ^
a.cc:21:21: error: template argument 2 is invalid
a.cc: In function 'void remove(int&, unsigned int)':
a.cc:23:12: error: request for member 'erase' in 'vector', which is of non-class type 'int'
   23 |     vector.erase(vector.begin() + index);
      |            ^~~~~
a.cc:23:25: error: request for member 'begin' in 'vector', which is of non-class type 'int'
   23 |     vector.erase(vector.begin() + index);
      |                         ^~~~~
a.cc: In function 'int main()':
a.cc:32:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   32 |     sort(a.begin(), a.end());
      |     ^~~~
      |     short
a.cc:46:11: error: no matching function for call to 'remove(std::vector<int>&, int)'
   46 |     remove(b, 0);
      |     ~~~~~~^~~~~~
a.cc:21:6: note: candidate: 'void remove(int&, unsigned int)'
   21 | void remove(vector<T>& vector, unsigned int index)
      |      ^~~~~~
a.cc:21:24: note:   no known conversion for argument 1 from 'std::vector<int>' to 'int&'
   21 | void remove(vector<T>& vector, unsigned int index)
      |             ~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:158:12: note: candidate: 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |            ^~~~~~
/usr/include/stdio.h:158:12: note:   candidate expects 1 argument, 2 provided