Language: C

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

template <typename T, typename U> bool cmin(T& a, U b) { return a > b && (a = b, true); }
template <typename T, typename U> bool cmax(T& a, U b) { return a < b && (a = b, true); }

template <unsigned int mod> class modint {
private:
  unsigned int v;
  static unsigned int norm(const unsigned int& x) { return x < mod ? x : x - mod; }
  static modint make(const unsigned int& x) {
    modint m;
    return m.v = x, m;
  }
  static modint inv(const modint& x) { return make(inverse(x.v, mod)); }
  static unsigned int inverse(int a, int m) {
    int u[] = {a, 1, 0}, v[] = {m, 0, 1}, t;
    while (*v) {
      t = *u / *v;
      swap(u[0] -= t * v[0], v[0]), swap(u[1] -= t * v[1], v[1]), swap(u[2] -= t * v[2], v[2]);
    }
    return (u[1] % m + m) % m;
  }

public:
  modint() : v{0} {}
  modint(const long val) : v{norm(val % mod + mod)} {}
  modint(const modint<mod>& n) : v{n()} {}
  explicit operator bool() const noexcept { return v != 0; }
  bool operator!() const noexcept { return !static_cast<bool>(*this); }
  modint& operator=(const modint& n) { return v = n(), (*this); }
  modint& operator=(const long val) { return v = norm(val % mod + mod), (*this); }
  modint operator+() const { return *this; }
  modint operator-() const { return v == 0 ? make(0) : make(mod - v); }
  modint operator+(const modint& val) const { return make(norm(v + val())); }
  modint operator-(const modint& val) const { return make(norm(v + mod - val())); }
  modint operator*(const modint& val) const { return make((long)v * val() % mod); }
  modint operator/(const modint& val) const { return *this * inv(val); }
  modint& operator+=(const modint& val) { return *this = *this + val; }
  modint& operator-=(const modint& val) { return *this = *this - val; }
  modint& operator*=(const modint& val) { return *this = *this * val; }
  modint& operator/=(const modint& val) { return *this = *this / val; }
  modint operator+(const long val) const { return modint{v + val}; }
  modint operator-(const long val) const { return modint{v - val}; }
  modint operator*(const long val) const { return modint{(long)(v * (val % mod))}; }
  modint operator/(const long val) const { return modint{(long)v * inv(val)}; }
  modint& operator+=(const long val) { return *this = *this + val; }
  modint& operator-=(const long val) { return *this = *this - val; }
  modint& operator*=(const long val) { return *this = *this * val; }
  modint& operator/=(const long val) { return *this = *this / val; }
  bool operator==(const modint& val) const { return v == val.v; }
  bool operator!=(const modint& val) const { return !(*this == val); }
  bool operator==(const long val) const { return v == norm(val % mod + mod); }
  bool operator!=(const long val) const { return !(*this == val); }
  unsigned int operator()() const { return v; }
  friend modint operator+(const long val, const modint& n) { return n + val; }
  friend modint operator-(const long val, const modint& n) { return modint{val - n()}; }
  friend modint operator*(const long val, const modint& n) { return n * val; }
  friend modint operator/(const long val, const modint& n) { return modint{val} / n; }
  friend bool operator==(const long val, const modint& n) { return n == val; }
  friend bool operator!=(const long val, const modint& n) { return !(val == n); }
  friend istream& operator>>(istream& is, modint& n) {
    unsigned int v;
    return is >> v, n = v, is;
  }
  friend ostream& operator<<(ostream& os, const modint& n) { return (os << n()); }
  friend modint mod_pow(modint x, long n) {
    modint ans = 1;
    while (n) {
      if (n & 1) ans *= x;
      x *= x, n >>= 1;
    }
    return ans;
  }
};

// constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
using mint = modint<MOD>;

template <typename T, T (*op)(T, T), T (*i_el)(), typename U, T (*mapp)(U, T), U (*comp)(U, U), U (*i_ty)()> class LazySegmentTree {
private:
  int N, size, log;
  vector<T> D;
  vector<U> L;
  void apply(int k) { D.at(k) = op(D.at(2 * k), D.at(2 * k + 1)); }
  void update_all(int k, U f) {
    D.at(k) = mapp(f, D.at(k));
    if (k < size) L.at(k) = comp(L.at(k), f);
  }
  void push(int k) {
    update_all(2 * k, L.at(k));
    update_all(2 * k + 1, L.at(k));
    L.at(k) = i_ty();
  }
  int ceil_pow(int n) {
    int x = 0;
    while ((1U << x) < (unsigned int)(n)) x++;
    return x;
  }

public:
  LazySegmentTree() : LazySegmentTree(0) {}
  LazySegmentTree(int n) : LazySegmentTree(vector<T>(n, i_el())) {}
  LazySegmentTree(const vector<T>& v) : N(int(v.size())) {
    log = ceil_pow(N);
    size = 1 << log;
    D = vector<T>(2 * size, i_el());
    L = vector<U>(size, i_ty());
    for (int i = 0; i < N; i++) D.at(size + i) = v.at(i);
    for (int i = size - 1; i >= 1; i--) apply(i);
  }
  void set(int p, T x) {
    p += size;
    for (int i = log; i >= 1; i--) push(p >> i);
    D.at(p) = x;
    for (int i = 1; i <= log; i++) apply(p >> i);
  }
  T get(int p) {
    p += size;
    for (int i = log; i >= 1; i--) push(p >> i);
    return D.at(p);
  }
  T query(int l, int r) {
    r++;
    if (l == r) return i_el();
    l += size, r += size;
    for (int i = log; i >= 1; i--) {
      if (((l >> i) << i) != l) push(l >> i);
      if (((r >> i) << i) != r) push(r >> i);
    }
    T sml = i_el(), smr = i_el();
    while (l < r) {
      if (l & 1) sml = op(sml, D.at(l++));
      if (r & 1) smr = op(D.at(--r), smr);
      l >>= 1, r >>= 1;
    }
    return op(sml, smr);
  }
  T query_all() { return D.at(1); }
  void update(int p, U f) {
    p += size;
    for (int i = log; i >= 1; i--) push(p >> i);
    D.at(p) = mapp(f, D.at(p));
    for (int i = 1; i <= log; i++) apply(p >> i);
  }
  void update(int l, int r, U f) {
    r++;
    if (l == r) return;
    l += size, r += size;
    for (int i = log; i >= 1; i--) {
      if (((l >> i) << i) != l) push(l >> i);
      if (((r >> i) << i) != r) push((r - 1) >> i);
    }
    {
      int l2 = l, r2 = r;
      while (l < r) {
        if (l & 1) update_all(l++, f);
        if (r & 1) update_all(--r, f);
        l >>= 1, r >>= 1;
      }
      l = l2, r = r2;
    }
    for (int i = 1; i <= log; i++) {
      if (((l >> i) << i) != l) apply(l >> i);
      if (((r >> i) << i) != r) apply((r - 1) >> i);
    }
  }
  template <bool (*g)(T)> int max_right(int l) {
    return max_right(l, [](T x) { return g(x); });
  }
  template <class G> int max_right(int l, G g) {
    if (l == N) return N;
    l += size;
    for (int i = log; i >= 1; i--) push(l >> i);
    T sm = i_el();
    do {
      while (l % 2 == 0) l >>= 1;
      if (!g(op(sm, D.at(l)))) {
        while (l < size) {
          push(l);
          l = (2 * l);
          if (g(op(sm, D.at(l)))) sm = op(sm, D.at(l++));
        }
        return l - size;
      }
      sm = op(sm, D.at(l++));
    } while ((l & -l) != l);
    return N;
  }
  template <bool (*g)(T)> int min_left(int r) {
    return min_left(r, [](T x) { return g(x); });
  }
  template <class G> int min_left(int r, G g) {
    if (r == 0) return 0;
    r += size;
    for (int i = log; i >= 1; i--) push((r - 1) >> i);
    T sm = i_el();
    do {
      r--;
      while (r > 1 && (r % 2)) r >>= 1;
      if (!g(op(D.at(r), sm))) {
        while (r < size) {
          push(r);
          r = (2 * r + 1);
          if (g(op(D.at(r), sm))) sm = op(D.at(r--), sm);
        }
        return r + 1 - size;
      }
      sm = op(D.at(r), sm);
    } while ((r & -r) != r);
    return 0;
  }
};

// monoid setting

using el = pair<mint, int>;
el op(el l, el r) {
  mint val = l.first * mod_pow((mint)10, r.second) + r.first;
  int len = l.second + r.second;
  return {val, len};
}
el i_el() { return {0, 0}; }

// mapping setting

using type = int;
el mapp(type f, el e) {
  if (f == 0) return e;
  e.first = (mod_pow((mint)10, e.second) - 1) / 9 * f;
  return e;
}
type comp(type f1, type f2) {
  if (f2 == 0) return f1;
  return f2;
}
type i_ty() { return 0; }

// setting end

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int N, Q;
  cin >> N >> Q;

  vector<el> V(N, {1, 1});
  LazySegmentTree<el, op, i_el, type, mapp, comp, i_ty> ST(V);

  for (int i = 0; i < Q; i++) {
    int L, R, D;
    cin >> L >> R >> D, L--, R--;
    ST.update(L, R, D);
    cout << ST.query_all().first << "\n";
  }
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.