Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>

#pragma GCC optimize ("-O3")
#define rep(i, initial_value, max_value) for (int i{initial_value}; i < max_value; ++i)
#define fore(i, a) for(auto &i:a)
#define each(i, c) \
    for( \
        __typeof((c).begin()) i{(c).begin()}, __typeof((c).end()) end{(c).end()}; \
        i != end; \
        ++i \
    )
#define dbg(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()

using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; typedef unsigned long long ull; typedef unsigned __int128 u128; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<class T>bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }

// ===

uint64_t a[1000000];

void _main() {
  uint64_t n;
  cin >> n;
  rep(i, 0, n) cin >> a[i];

  uint64_t ans{1};

  map<uint64_t, uint64_t> m;
  uint64_t max{0};

  rep(i, 0, n) {
    uint64_t num = a[i];
    chmax(max, num);

    if (m.find(num) == m.end()) {
      m[num] = 1;
    } else {
      m[num] += 1;
    }
  }

  if (m.find(0) == m.end() || m[0] != 1) {
    cout << 0 << endl;
    return;
  }

  uint64_t prevCount{1};
  rep(i, 1, max + 1) {
    if (m.find(i) == m.end()) {
      cout << 0 << endl;
      return;
    }

    rep(j, 0, m[i]) {
      ans = (ans * prevCount) % 998244353;
    }

    prevCount = m[i];
  }

  cout << ans << endl;
}

Compiler output:
a.cc:20:107: error: 'INT_MAX' was not declared in this scope
   20 | typedef long long ll; typedef unsigned long long ull; typedef unsigned __int128 u128; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
      |                                                                                                           ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <cmath>
  +++ |+#include <climits>
    6 | 
a.cc:26:1: error: 'uint64_t' does not name a type
   26 | uint64_t a[1000000];
      | ^~~~~~~~
a.cc:6:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    5 | #include <cmath>
  +++ |+#include <cstdint>
    6 | 
a.cc: In function 'void _main()':
a.cc:29:3: error: 'uint64_t' was not declared in this scope
   29 |   uint64_t n;
      |   ^~~~~~~~
a.cc:29:3: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:30:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   30 |   cin >> n;
      |          ^
      |          yn
a.cc:31:23: error: 'a' was not declared in this scope
   31 |   rep(i, 0, n) cin >> a[i];
      |                       ^
a.cc:33:11: error: expected ';' before 'ans'
   33 |   uint64_t ans{1};
      |           ^~~~
      |           ;
a.cc:35:25: error: template argument 3 is invalid
   35 |   map<uint64_t, uint64_t> m;
      |                         ^
a.cc:35:25: error: template argument 4 is invalid
a.cc:36:11: error: expected ';' before 'max'
   36 |   uint64_t max{0};
      |           ^~~~
      |           ;
a.cc:39:13: error: expected ';' before 'num'
   39 |     uint64_t num = a[i];
      |             ^~~~
      |             ;
a.cc:40:16: error: 'num' was not declared in this scope; did you mean 'enum'?
   40 |     chmax(max, num);
      |                ^~~
      |                enum
a.cc:42:11: error: request for member 'find' in 'm', which is of non-class type 'int'
   42 |     if (m.find(num) == m.end()) {
      |           ^~~~
a.cc:42:26: error: request for member 'end' in 'm', which is of non-class type 'int'
   42 |     if (m.find(num) == m.end()) {
      |                          ^~~
a.cc:49:9: error: request for member 'find' in 'm', which is of non-class type 'int'
   49 |   if (m.find(0) == m.end() || m[0] != 1) {
      |         ^~~~
a.cc:49:22: error: request for member 'end' in 'm', which is of non-class type 'int'
   49 |   if (m.find(0) == m.end() || m[0] != 1) {
      |                      ^~~
a.cc:49:32: error: invalid types 'int[int]' for array subscript
   49 |   if (m.find(0) == m.end() || m[0] != 1) {
      |                                ^
a.cc:54:11: error: expected ';' before 'prevCount'
   54 |   uint64_t prevCount{1};
      |           ^~~~~~~~~~
      |           ;
a.cc:55:17: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
   55 |   rep(i, 1, max + 1) {
      |             ~~~~^~~
a.cc:8:73: note: in definition of macro 'rep'
    8 | #define rep(i, initial_value, max_value) for (int i{initial_value}; i < max_value; ++i)
      |                                                                         ^~~~~~~~~
a.cc:56:11: error: request for member 'find' in 'm', which is of non-class type 'int'
   56 |     if (m.find(i) == m.end()) {
      |           ^~~~
a.cc:56:24: error: request for member 'end' in 'm', which is of non-class type 'int'
   56 |     if (m.find(i) == m.end()) {
      |                        ^~~
a.cc:61:16: error: invalid types 'int[int]' for array subscript
   61 |     rep(j, 0, m[i]) {
      |                ^
a.cc:8:73: note: in definition of macro 'rep'
    8 | #define rep(i, initial_value, max_value) for (int i{initial_value}; i < max_value; ++i)
      |                                                                         ^~~~~~~~~
a.cc:62:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   62 |       ans = (ans * prevCount) % 998244353;
      |       ^~~
      |       abs
a.cc:62:20: error: 'prevCount' was not declared in this scope
   62 |       ans = (ans * prevCount) % 998244353;
      |                    ^~~~~~~~~
a.cc:65:5: error: 'prevCount' was not declared in this scope
   65 |     prevCount = m[i];
      |     ^~~~~~~~~
a.cc:65:18: error: invalid types 'int[int]' for array subscript
   65 |     prevCount = m[i];
      |                  ^
a.cc:68:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   68 |   cout << ans << endl;
      |           ^~~
      |           abs