Language: C++

#include <bits/stdc++.h>
using namespace std;


template <uint32_t P> struct MontgomeryModInt32 {
public:
  using i32 = int32_t;
  using u32 = uint32_t;
  using i64 = int64_t;
  using u64 = uint64_t;
  using mont = MontgomeryModInt32;

private:
  u32 v;

  static constexpr u32 get_r() {
    u32 iv = P;
    for (u32 i = 0; i != 4; ++i) iv *= 2U - P * iv;
    return -iv;
  }

  static constexpr u32 r = get_r(), r2 = -u64(P) % P;

  static_assert((P & 1) == 1);
  static_assert(-r * P == 1);
  static_assert(P < (1 << 30));

  static constexpr u32 pow_mod(u32 x, u64 y) {
    u32 res = 1;
    for (; y != 0; y >>= 1, x = u64(x) * x % P)
      if (y & 1) res = u64(res) * x % P;
    return res;
  }

public:
  static constexpr u32 get_pr() {
    u32 tmp[32] = {}, cnt = 0;
    const u64 phi = P - 1;
    u64 m = phi;
    for (u64 i = 2; i * i <= m; ++i)
      if (m % i == 0) {
        tmp[cnt++] = i;
        while (m % i == 0) m /= i;
      }
    if (m != 1) tmp[cnt++] = m;
    for (u64 res = 2; res != P; ++res) {
      bool flag = true;
      for (u32 i = 0; i != cnt && flag; ++i) flag &= pow_mod(res, phi / tmp[i]) != 1;
      if (flag) return res;
    }
    return 0;
  }

  MontgomeryModInt32() = default;
  ~MontgomeryModInt32() = default;
  constexpr MontgomeryModInt32(u32 v) : v(reduce(u64(v) * r2)) {}
  constexpr MontgomeryModInt32(const mont &rhs) : v(rhs.v) {}
  static constexpr u32 reduce(u64 x) { return x + (u64(u32(x) * r) * P) >> 32; }
  static constexpr u32 norm(u32 x) { return x - (P & -(x >= P)); }
  constexpr u32 get() const {
    u32 res = reduce(v) - P;
    return res + (P & -(res >> 31));
  }
  explicit constexpr operator u32() const { return get(); }
  explicit constexpr operator i32() const { return i32(get()); }
  constexpr mont &operator=(const mont &rhs) { return v = rhs.v, *this; }
  constexpr mont operator-() const {
    mont res;
    return res.v = (P << 1 & -(v != 0)) - v, res;
  }
  constexpr mont inv() const { return pow(-1); }
  constexpr mont &operator+=(const mont &rhs) {
    return v += rhs.v - (P << 1), v += P << 1 & -(v >> 31), *this;
  }
  constexpr mont &operator-=(const mont &rhs) {
    return v -= rhs.v, v += P << 1 & -(v >> 31), *this;
  }
  constexpr mont &operator*=(const mont &rhs) { return v = reduce(u64(v) * rhs.v), *this; }
  constexpr mont &operator/=(const mont &rhs) { return this->operator*=(rhs.inv()); }
  friend mont operator+(const mont &lhs, const mont &rhs) { return mont(lhs) += rhs; }
  friend mont operator-(const mont &lhs, const mont &rhs) { return mont(lhs) -= rhs; }
  friend mont operator*(const mont &lhs, const mont &rhs) { return mont(lhs) *= rhs; }
  friend mont operator/(const mont &lhs, const mont &rhs) { return mont(lhs) /= rhs; }
  friend bool operator==(const mont &lhs, const mont &rhs) { return norm(lhs.v) == norm(rhs.v); }
  friend bool operator!=(const mont &lhs, const mont &rhs) { return norm(lhs.v) != norm(rhs.v); }
  friend istream &operator>>(istream &is, mont &rhs) {
    return is >> rhs.v, rhs.v = reduce(u64(rhs.v) * r2), is;
  }
  friend ostream &operator<<(ostream &os, const mont &rhs) { return os << rhs.get(); }
  constexpr mont pow(i64 y) const {
    if ((y %= P - 1) < 0) y += P - 1; // phi(P) = P - 1, assume P is a prime number
    mont res(1), x(*this);
    for (; y != 0; y >>= 1, x *= x)
      if (y & 1) res *= x;
    return res;
  }
};

/*

  memcpy(dest,sour,bytes);

  memset(dest,val,bytes);

*/

template <uint32_t P> struct FormalPowerSeries {
public:
  using i32 = int32_t;
  using u32 = uint32_t;
  using i64 = int64_t;
  using u64 = uint64_t;
  using value_type = MontgomeryModInt32<P>;
  using arr = value_type[1 << 21];

private:
  static inline value_type ROOT[1 << 20], IROOT[1 << 20];

public:
  FormalPowerSeries() = delete;

  static void init(i32 n) {
    static i32 lim = 0;
    static constexpr value_type G(value_type::get_pr());
    if ((lim << 1) >= n) return;
    if (lim == 0) {
      ROOT[1 << 19] = G.pow(P - 1 >> 21), IROOT[1 << 19] = G.pow(-i32(P - 1 >> 21));
      for (i32 i = 18; i != -1; --i)
        ROOT[1 << i] = ROOT[1 << i + 1] * ROOT[1 << i + 1],
                  IROOT[1 << i] = IROOT[1 << i + 1] * IROOT[1 << i + 1];
      lim = 1;
    }
    while ((lim << 1) < n) {
      for (i32 i = lim + 1, e = lim << 1; i < e; ++i)
        ROOT[i] = ROOT[i - lim] * ROOT[lim], IROOT[i] = IROOT[i - lim] * IROOT[lim];
      lim <<= 1;
    }
  }

#define dft_layer()                                                                                \
  for (i32 i = n >> 1; i >= 2; i >>= 1) {                                                          \
    for (i32 j = 0, l = i >> 1; j != l; ++j) {                                                     \
      value_type u = x[j], v = x[j + l];                                                           \
      x[j] = u + v, x[j + l] = u - v;                                                              \
    }                                                                                              \
    for (i32 j = i, l = i >> 1, m = 1; j != n; j += i, ++m) {                                      \
      value_type root = ROOT[m];                                                                   \
      for (i32 k = 0; k != l; ++k) {                                                               \
        value_type u = x[j + k], v = x[j + k + l] * root;                                          \
        x[j + k] = u + v, x[j + k + l] = u - v;                                                    \
      }                                                                                            \
    }                                                                                              \
  }

#define idft_layer()                                                                               \
  for (i32 i = 2; i < n; i <<= 1) {                                                                \
    for (i32 j = 0, l = i >> 1; j != l; ++j) {                                                     \
      value_type u = x[j], v = x[j + l];                                                           \
      x[j] = u + v, x[j + l] = u - v;                                                              \
    }                                                                                              \
    for (i32 j = i, l = i >> 1, m = 1; j != n; j += i, ++m) {                                      \
      value_type root = IROOT[m];                                                                  \
      for (i32 k = 0; k != l; ++k) {                                                               \
        value_type u = x[j + k], v = x[j + k + l];                                                 \
        x[j + k] = u + v, x[j + k + l] = (u - v) * root;                                           \
      }                                                                                            \
    }                                                                                              \
  }

  static void dft_without_first_layer(i32 n, value_type x[]) { dft_layer(); }
  static void idft_without_last_layer(i32 n, value_type x[]) { idft_layer(); }

  static void dft(i32 n, value_type x[]) {
    init(n);
    for (i32 j = 0, l = n >> 1; j != l; ++j) { // first layer
      value_type u = x[j], v = x[j + l];
      x[j] = u + v, x[j + l] = u - v;
    }
    dft_layer();
  }
  static void idft(i32 n, value_type x[]) {
    idft_layer();
    value_type iv(P - (P - 1) / n);
    for (i32 j = 0, l = n >> 1; j != l; ++j) { // last layer
      value_type u = x[j] * iv, v = x[j + l] * iv;
      x[j] = u + v, x[j + l] = u - v;
    }
  }

#undef dft_layer
#undef idfy_layer

  static u64 get_len(u64 n) { // if n=0, boom
    return --n, n |= n >> 1, n |= n >> 2, n |= n >> 4, n |= n >> 8, n |= n >> 16, n |= n >> 32, ++n;
  }

  static void inv(const i32 n, const value_type x[], value_type y[]) { // store the result in y[]
    static arr a, b, res;
    assert(x[0] != 0);
    init(n);
    res[0] = x[0].inv();
    for (i32 i = 1; i != 32 && i < n; ++i) {
      value_type sum(0);
      for (i32 j = 1; j <= i; ++j) sum += x[j] * res[i - j];
      res[i] = -res[0] * sum;
    }
    i32 len = get_len(n);
    for (i32 i = 64; i <= len; i <<= 1) {
      memcpy(a, x, sizeof(value_type) * min(n, i));
      memcpy(b, res, sizeof(value_type) * (i >> 1));
      memcpy(b + (i >> 1), res, sizeof(value_type) * (i >> 1));
      dft(i, a), dft_without_first_layer(i, b);
      for (i32 j = 0; j != i; ++j) a[j] *= b[j];
      idft_without_last_layer(i, a);
      value_type iv(P - (P - 1) / i);
      for (i32 j = 0, l = i >> 1; j != l; ++j)
        a[j] = (a[j] - a[j + l]) * iv,
            a[j + l] = -a[j];
      dft_without_first_layer(i, a);
      for (i32 j = 0; j != i; ++j) a[j] *= b[j];
      idft_without_last_layer(i, a);
      for (i32 j = 0, l = i >> 1; j != l; ++j)
        res[j + l] = (a[j + l] - a[j]) * iv;
    }
    memcpy(y, res, sizeof(value_type) * n);
  }
};

struct IO {
  char a[1 << 25], b[1 << 25], *s, *t;
  IO() : s(a), t(b) {
    a[std::fread(a, 1, sizeof a, stdin)] = 0;
  }
  ~IO() { std::fwrite(b, 1, t - b, stdout); }
  IO &operator>>(std::uint64_t &x);
  IO &operator>>(std::int64_t &x);
  IO &operator>>(std::int32_t &x);
  IO &operator>>(std::uint32_t &x) {
    x = 0;
    while (*s < '0' || *s > '9') ++s;
    while (*s >= '0' && *s <= '9') x = x * 10 + *s++ - '0';
    return *this;
  }
  IO &operator<<(char x) { return *t++ = x, *this; }
  IO &operator<<(std::int32_t x);
  IO &operator<<(std::uint64_t x);
  IO &operator<<(std::int64_t x);
  IO &operator<<(std::uint32_t x) {
    static char c[16], *i;
    i = c;
    if (x == 0) {
      *t++ = '0';
    } else {
      while (x != 0) {
        std::uint32_t y = x / 10;
        *i++ = x - y * 10 + '0', x = y;
      }
      while (i != c) *t++ = *--i;
    }
    return *this;
  }
} io;

using Modint = MontgomeryModInt32<998244353>;
int main(){
    unsigned n, k;
    io >> n >> k;
    vector<Modint> f(n + 1);
    f[0] = 1;
    while(k--){
        unsigned l, r;
        io >> l >> r;
        for(int i = l; i <= r; i++) f[i] -= 1;
    }
    FormalPowerSeries<998244353>::inv(n, f.data(), f.data());
    io << f[n - 1].get();
}
\

Compiler output:
a.cc:278:1: error: stray '\' in program
  278 | \
      | ^