Language: C++

#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx")
#include <iostream>

constexpr int buffer_size = 1 << 18;
static int input_pos = buffer_size;
static int output_pos = 0;
char Input[buffer_size];
char Output[buffer_size];

#define READ fread_unlocked
#define WRITE fwrite_unlocked

inline char get_char(void){
    if(input_pos == buffer_size){ READ(Input, 1, buffer_size, stdin); input_pos = 0; }
    return Input[input_pos++];
}

inline int getint(void){
    int res = 0, c; while((c = get_char() - '0') >= 0) res = 10 * res + c;
    return res;
}
inline char get_c(void){
    const char c = get_char(); get_char();
    return c;
}

inline void put_char(const char c){
    if(output_pos == buffer_size){ WRITE(Output, 1, buffer_size, stdout); output_pos = 0; }
    Output[output_pos++] = c;
}
inline void println(int x){
    if(x){
        static char bbb[20];
        char t = 0; do{ bbb[t++] = x % 10; } while(x /= 10);
        while(t--){ put_char(bbb[t] ^ 48); }
    }
    else put_char('0');
    put_char('\n');
}


constexpr int mod = 998244353;

int height = 0;
int length;
int sum_arr[1 << 20];
int value[1 << 20];
char belong[1 << 20];

void build(int n){
    height = 31 - __builtin_clz(n); if((length = (1 << height)) < n){ length *= 2; ++height; }

    for(int i = n - 1, v = 1; i >= 0; --i){ sum_arr[i + length] = v; v = 10LL * v % mod; }
    for(int i = length - 1; i > 0; --i){
        sum_arr[i] = sum_arr[2 * i] + sum_arr[2 * i + 1];
        if(sum_arr[i] >= mod) sum_arr[i] -= mod;
    }
}

inline void propagate(const int x){
    for(int shift = height; shift ; --shift){
        const int idx = x >> shift;
        if(belong[idx]){
            belong[2 * idx] = belong[idx];
            belong[2 * idx + 1] = belong[idx];
            value[idx] = static_cast<long long int>(sum_arr[idx]) * belong[idx] % mod;
            belong[idx] = 0;
        }
    }
    if(belong[x]){ value[x] = static_cast<long long int>(sum_arr[x]) * belong[x] % mod; belong[x] = 0; }
}

inline void calculateData(int x){
    while(x >>= 1){
        const int c1 = 2 * x, c2 = c1 + 1;
        const int a = belong[c1] ? static_cast<long long int>(sum_arr[c1]) * belong[c1] % mod : value[c1];
        const int b = belong[c2] ? static_cast<long long int>(sum_arr[c2]) * belong[c2] % mod : value[c2];
        value[x] = a + b; if(value[x] >= mod) value[x] -= mod;
    }
}

inline void update(int l, int r, char c){
    propagate(l += length); propagate(r += length - 1);
    for(int li = l, ri = r + 1; li < ri; li >>= 1, ri >>= 1){
        if(li & 1) belong[li++] = c;
        if(ri & 1) belong[--ri] = c;
    }
    calculateData(l); calculateData(r);
}

inline int sum_all(void){
    return value[1];
}


int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    std::cout << std::fixed << std::setprecision(16);
    int n = getint(), q = getint();
    build(n);
    update(0, n, 1);

    while(q--){
        const int l = getint() - 1;
        const int r = getint();
        const char c = get_c() ^ '0';
        update(l, r, c);
        println(sum_all());
    }
    WRITE(Output, 1, output_pos, stdout);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:99:37: error: 'setprecision' is not a member of 'std'
   99 |     std::cout << std::fixed << std::setprecision(16);
      |                                     ^~~~~~~~~~~~
a.cc:4:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    3 | #include <iostream>
  +++ |+#include <iomanip>
    4 |