Language: C++

#include <cstdio>
#include <iostream>

#include <vector>
#include <algorithm>
#include <unordered_set>
#include <climits>

using Set = std::unordered_set<uint32_t>;

void FindAndUpdate(int key, Set* o) {
  auto find = o->find(key);
  if (find == o->end()) {
    o->insert(key);
  }
}

int main() {
  uint32_t n = 0;
  scanf("%d", &n);

  uint32_t a = 0;
  uint32_t i = 0;
  Set o;
  uint32_t free = 0;
  while (std::cin >> a) {
    if (a >= 1 && a <= 399) {
      FindAndUpdate(1, &o);
    } else if (a >= 400 && a <= 799) {
      FindAndUpdate(2, &o);
    } else if (a >= 800 && a <= 1199) {
      FindAndUpdate(3, &o);
    } else if (a >= 1200 && a <= 1599) {
      FindAndUpdate(4, &o);
    } else if (a >= 1600 && a <= 1999) {
      FindAndUpdate(5, &o);
    } else if (a >= 2000 && a <= 2399) {
      FindAndUpdate(6, &o);
    } else if (a >= 2400 && a <= 2799) {
      FindAndUpdate(7, &o);
    } else if (a >= 2800 && a <= 3199) {
      FindAndUpdate(8, &o); 
    } else {
      free++;
    }

    i++;
    if (i >= n) {
      break;
    }
  }

  uint32_t max = std::min(uint32_t(o.size()) + free, uint32_t(8));
  uint32_t min = std::max(uint32_t(o.size()), 1);

  std::cout << min << " " << max << std::endl;
}


Compiler output:
a.cc:9:32: error: 'uint32_t' was not declared in this scope
    9 | using Set = std::unordered_set<uint32_t>;
      |                                ^~~~~~~~
a.cc:8:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    7 | #include <climits>
  +++ |+#include <cstdint>
    8 | 
a.cc:9:40: error: template argument 1 is invalid
    9 | using Set = std::unordered_set<uint32_t>;
      |                                        ^
a.cc:9:40: error: template argument 2 is invalid
a.cc:9:40: error: template argument 3 is invalid
a.cc:9:40: error: template argument 4 is invalid
a.cc:11:29: error: 'Set' has not been declared
   11 | void FindAndUpdate(int key, Set* o) {
      |                             ^~~
a.cc: In function 'void FindAndUpdate(int, int*)':
a.cc:12:18: error: request for member 'find' in '* o', which is of non-class type 'int'
   12 |   auto find = o->find(key);
      |                  ^~~~
a.cc:13:18: error: request for member 'end' in '* o', which is of non-class type 'int'
   13 |   if (find == o->end()) {
      |                  ^~~
a.cc:14:8: error: request for member 'insert' in '* o', which is of non-class type 'int'
   14 |     o->insert(key);
      |        ^~~~~~
a.cc: In function 'int main()':
a.cc:19:3: error: 'uint32_t' was not declared in this scope
   19 |   uint32_t n = 0;
      |   ^~~~~~~~
a.cc:19:3: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:20:16: error: 'n' was not declared in this scope
   20 |   scanf("%d", &n);
      |                ^
a.cc:22:11: error: expected ';' before 'a'
   22 |   uint32_t a = 0;
      |           ^~
      |           ;
a.cc:23:11: error: expected ';' before 'i'
   23 |   uint32_t i = 0;
      |           ^~
      |           ;
a.cc:24:3: error: 'Set' was not declared in this scope
   24 |   Set o;
      |   ^~~
a.cc:25:11: error: expected ';' before 'free'
   25 |   uint32_t free = 0;
      |           ^~~~~
      |           ;
a.cc:26:22: error: 'a' was not declared in this scope
   26 |   while (std::cin >> a) {
      |                      ^
a.cc:28:25: error: 'o' was not declared in this scope
   28 |       FindAndUpdate(1, &o);
      |                         ^
a.cc:30:25: error: 'o' was not declared in this scope
   30 |       FindAndUpdate(2, &o);
      |                         ^
a.cc:32:25: error: 'o' was not declared in this scope
   32 |       FindAndUpdate(3, &o);
      |                         ^
a.cc:34:25: error: 'o' was not declared in this scope
   34 |       FindAndUpdate(4, &o);
      |                         ^
a.cc:36:25: error: 'o' was not declared in this scope
   36 |       FindAndUpdate(5, &o);
      |                         ^
a.cc:38:25: error: 'o' was not declared in this scope
   38 |       FindAndUpdate(6, &o);
      |                         ^
a.cc:40:25: error: 'o' was not declared in this scope
   40 |       FindAndUpdate(7, &o);
      |                         ^
a.cc:42:25: error: 'o' was not declared in this scope
   42 |       FindAndUpdate(8, &o);
      |                         ^
a.cc:44:7: warning: ISO C++ forbids incrementing a pointer of type 'void (*)(void*) noexcept' [-Wpointer-arith]
   44 |       free++;
      |       ^~~~
a.cc:44:11: error: lvalue required as increment operand
   44 |       free++;
      |           ^~
a.cc:47:5: error: 'i' was not declared in this scope
   47 |     i++;
      |     ^
a.cc:53:11: error: expected ';' before 'max'
   53 |   uint32_t max = std::min(uint32_t(o.size()) + free, uint32_t(8));
      |           ^~~~
      |           ;
a.cc:54:11: error: expected ';' before 'min'
   54 |   uint32_t min = std::max(uint32_t(o.size()), 1);
      |           ^~~~
      |           ;
a.cc:56:16: error: 'min' was not declared in this scope; did you mean 'std::min'?
   56 |   std::cout << min << " " << max << std::endl;
      |                ^~~
      |                std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:56:30: error: 'max' was not declared in this scope; did you mean 'std::max'?
   56 |   std::cout << min << " " << max << std::endl;
      |                              ^~~
      |                              std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~