Language: C++

//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
//const LL mod = 1000000007ll;
const int mod_int = 1000000007;

const LL mod = 998244353ll;

template <LL mod>
struct ModInt {
  LL x;
  ModInt() : x(0) {}
  ModInt(LL y)
      : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (LL)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const {
    return ModInt(*this) += p;
  }
  ModInt operator-(const ModInt &p) const {
    return ModInt(*this) -= p;
  }
  ModInt operator*(const ModInt &p) const {
    return ModInt(*this) *= p;
  }
  ModInt operator/(const ModInt &p) const {
    return ModInt(*this) /= p;
  }
  bool operator==(const ModInt &p) const {
    return x == p.x;
  }
  bool operator!=(const ModInt &p) const {
    return x != p.x;
  }
  ModInt inverse() const {
    LL a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(LL n) const {
    ModInt ans(1LL), mul(x);
    while(n) {
      if(n & 1LL) ans *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ans;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }
  friend istream &operator>>(istream &is, ModInt &a) {
    LL t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static LL get_mod() { return mod; }
};

LL N;
LL D[100000];

ModInt<mod> ans = 0;

void solve(){
	//頂点1から見て、深さiの点がいくつあるかをnum_depth[i]に格納
	vector<LL> num_depth(N,0);
	for(int i=0;i<N;i++){
		num_depth[D[i]]++;
	}
	if(num_depth[0]!=1) return;

	ans = 1;
	LL sum = 1;
	for(int i=1;;i++){
		ans = (ans*((ModInt<mod>(num_depth[i-1])).pow(num_depth[i])))%mod;
		//cout << "ans:" << ans.x << endl;
		sum += num_depth[i];
		if(sum==N) return;
	}
}
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> D[i];

    solve();

	cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:115:78: error: no match for 'operator%' (operand types are 'ModInt<998244353>' and 'const long long int')
  115 |                 ans = (ans*((ModInt<mod>(num_depth[i-1])).pow(num_depth[i])))%mod;
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
      |                           |                                                   |
      |                           ModInt<998244353>                                   const long long int