Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;


ull N, Q;


const ull mod = ull(998244353);

int S[200001];
const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };

ull get_subst_value(ull i, ull j) {
	ull d = j - i - 1;
	ull v = 0;
	
	for (ull k = i; k < j; k++) {
		v += tens[d] * S[k];
		d--;
	}
	return v;
}

ull stride = 8;
ull dstride = tens[stride];

vector<ull> ans;

int main() {
	cin >> N >> Q;

	for (ull i = 0; i < N; i++)
		S[i] = 1;

	for (ull q = 0; q < Q; q++) {
		ull L, R, D;
		cin >> L >> R >> D;

		for (ull k = L-1; k <= R-1; k++) {
			S[k] = D;
		}

		ull aa = 0;
		if (N < stride) {
			aa = get_subst_value(0, N) % mod;
		}
		else {

			for (ull i = 0; i <= N - stride; i += stride) {
				//cout << "aa=" << aa << " get=" << get_subst_value(i, i + stride) << endl;
				ull a = aa * dstride + get_subst_value(i, i + stride);
				//cout << "a=" << a << endl;
				aa = a % mod;
			}
		}
		ans.push_back(aa);

	}


	for (auto a : ans) {
		cout << a << endl;
	}
}

Compiler output:
a.cc:21:27: error: narrowing conversion of '1.0e+1' from 'double' to 'ull' {aka 'long long unsigned int'} [-Wnarrowing]
   21 | const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };
      |                           ^~~
a.cc:21:32: error: narrowing conversion of '1.0e+2' from 'double' to 'ull' {aka 'long long unsigned int'} [-Wnarrowing]
   21 | const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };
      |                                ^~~
a.cc:21:37: error: narrowing conversion of '1.0e+3' from 'double' to 'ull' {aka 'long long unsigned int'} [-Wnarrowing]
   21 | const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };
      |                                     ^~~
a.cc:21:41: error: narrowing conversion of '1.0e+4' from 'double' to 'ull' {aka 'long long unsigned int'} [-Wnarrowing]
   21 | const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };
      |                                         ^~~
a.cc:21:45: error: narrowing conversion of '1.0e+5' from 'double' to 'ull' {aka 'long long unsigned int'} [-Wnarrowing]
   21 | const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };
      |                                             ^~~
a.cc:21:49: error: narrowing conversion of '1.0e+6' from 'double' to 'ull' {aka 'long long unsigned int'} [-Wnarrowing]
   21 | const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };
      |                                                 ^~~
a.cc:21:53: error: narrowing conversion of '1.0e+7' from 'double' to 'ull' {aka 'long long unsigned int'} [-Wnarrowing]
   21 | const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };
      |                                                     ^~~
a.cc:21:57: error: narrowing conversion of '1.0e+8' from 'double' to 'ull' {aka 'long long unsigned int'} [-Wnarrowing]
   21 | const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };
      |                                                         ^~~
a.cc:21:61: error: narrowing conversion of '1.0e+9' from 'double' to 'ull' {aka 'long long unsigned int'} [-Wnarrowing]
   21 | const ull tens[10] = { 1, 1E1, 1E2, 1E3,1E4,1E5,1E6,1E7,1E8,1E9 };
      |                                                             ^~~