Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define int long long
#define f(i,l,n) for(int i=l;i<n;i++) 
#define E "\n"
const int Mod = 99844353;
const int M=2e5+5;
vector<int> dp(M,-1);

int Pow(int b, int n, int d) {
    int ans=1,x=b; //here ans and x should be long long 
    if(n==0) return 1LL;
    while(n)
    {
        if(n%2==1) ans=((ans*x)%d+d)%d;
        x=((x*x)%d+d)%d;
        n=n>>1;
    }
    if(x==0) ans=0;
    return (int)ans;
}


int n,q;
vector<int> a;

struct data
{
    //Use required attributes
    int mn,len,ten;

    //Default Values
    data() : mn(0),len(0),ten(1) {};
};

struct SegTree
{
    int N;
    vector<data> st;
    vector<bool> cLazy;
    vector<int> lazy;

    void init(int n)
    {
        N = n;
        st.resize(4 * N + 5);
        cLazy.assign(4 * N + 5, false);
        lazy.assign(4 * N + 5, 0);
    }

    //Write reqd merge functions
    void merge(data &cur, data &l, data &r) 
    {
        cur.mn = (l.mn+r.mn)%Mod;
        cur.ten=(l.ten+r.ten)%Mod;
    }
    
    //Handle lazy propagation appriopriately
    void propagate(int node, int L, int R)
    {
        if(L != R)
        {
            cLazy[node*2] = 1;
            cLazy[node*2 + 1] = 1;
            lazy[node*2] =(lazy[node])%Mod;
            lazy[node*2 + 1] =(lazy[node])%Mod; 
        }
        int additional=(lazy[node]*st[node].ten)%Mod;
        st[node].mn =(additional)%Mod;
        lazy[node]=0;
        cLazy[node] = 0;
    }

    void build(int node, int L, int R)
    {
        //cout<<node<<" "<<L<<" "<<R<<E;
        if(L==R)
        {
            st[node].mn = Pow(10,n-L,Mod);
            st[node].ten = Pow(10,n-L,Mod);

            return;
        }
        int M=(L + R)/2;
        build(node*2, L, M);
        build(node*2 + 1, M + 1, R);
        merge(st[node], st[node*2], st[node*2+1]);
    }

    data Query(int node, int L, int R, int i, int j)
    {
        if(cLazy[node])
            propagate(node, L, R);
        if(j<L || i>R)
            return data();
        if(i<=L && R<=j)
            return st[node];
        int M = (L + R)/2;
        data left=Query(node*2, L, M, i, j);
        data right=Query(node*2 + 1, M + 1, R, i, j);
        data cur;
        merge(cur, left, right);
        return cur;
    }

    data pQuery(int node, int L, int R, int pos)
    {
        if(cLazy[node])
            propagate(node, L, R);
        if(L == R)
            return st[node];
        int M = (L + R)/2;
        if(pos <= M)
            return pQuery(node*2, L, M, pos);
        else
            return pQuery(node*2 + 1, M + 1, R, pos);
    }    

    void Update(int node, int L, int R, int i, int j, int val)
    {
        if(cLazy[node])
            propagate(node, L, R);
        if(j<L || i>R)
            return;
        if(i<=L && R<=j)
        {
            cLazy[node] = 1;
            lazy[node] = (val);
            propagate(node, L, R);
            return;
        }
        int M = (L + R)/2;
        Update(node*2, L, M, i, j, val);
        Update(node*2 + 1, M + 1, R, i, j, val);
        merge(st[node], st[node*2], st[node*2 + 1]);
    }

    void pUpdate(int node, int L, int R, int pos, int val)
    {
        if(cLazy[node])
            propagate(node, L, R);
        if(L == R)
        {
            cLazy[node] = 1;
            lazy[node] = val;
            propagate(node, L, R);
            return;
        }
        int M = (L + R)/2;
        if(pos <= M)
            pUpdate(node*2, L, M, pos, val);
        else
            pUpdate(node*2 + 1, M + 1, R, pos, val);
        merge(st[node], st[node*2], st[node*2 + 1]);
    }

    data query(int pos)
    {
        return pQuery(1, 1, N, pos);
    }

    data query(int l, int r)
    {
        return Query(1, 1, N, l, r);
    }

    void update(int pos, int val)
    {
        pUpdate(1, 1, N, pos, val);
    }

    void update(int l, int r, int val)
    {
        Update(1, 1, N, l, r, val);
    }
};

 
  




        






int32_t main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif



    SegTree s;
    cin >> n >> q;
    s.init(n);
    s.build(1,1,n);    

    while(q--)
    {
        int l,r,d;
        cin >> l >> r >> d;
        s.update(l,r,d);
        cout<<s.query(1,n).mn<<E;
    }
    

     return 0;
}

Compiler output:
a.cc:41:16: error: template argument 1 is invalid
   41 |     vector<data> st;
      |                ^
a.cc:41:16: error: template argument 2 is invalid
a.cc:54:16: error: reference to 'data' is ambiguous
   54 |     void merge(data &cur, data &l, data &r)
      |                ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:29:8: note:                 'struct data'
   29 | struct data
      |        ^~~~
a.cc:54:16: error: 'data' has not been declared
   54 |     void merge(data &cur, data &l, data &r)
      |                ^~~~
a.cc:54:27: error: reference to 'data' is ambiguous
   54 |     void merge(data &cur, data &l, data &r)
      |                           ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:29:8: note:                 'struct data'
   29 | struct data
      |        ^~~~
a.cc:54:27: error: 'data' has not been declared
   54 |     void merge(data &cur, data &l, data &r)
      |                           ^~~~
a.cc:54:36: error: reference to 'data' is ambiguous
   54 |     void merge(data &cur, data &l, data &r)
      |                                    ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:29:8: note:                 'struct data'
   29 | struct data
      |        ^~~~
a.cc:54:36: error: 'data' has not been declared
   54 |     void merge(data &cur, data &l, data &r)
      |                                    ^~~~
a.cc:92:5: error: reference to 'data' is ambiguous
   92 |     data Query(int node, int L, int R, int i, int j)
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:29:8: note:                 'struct data'
   29 | struct data
      |        ^~~~
a.cc:108:5: error: reference to 'data' is ambiguous
  108 |     data pQuery(int node, int L, int R, int pos)
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:29:8: note:                 'struct data'
   29 | struct data
      |        ^~~~
a.cc:159:5: error: reference to 'data' is ambiguous
  159 |     data query(int pos)
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:29:8: note:                 'struct data'
   29 | struct data
      |        ^~~~
a.cc:164:5: error: reference to 'data' is ambiguous
  164 |     data query(int l, int r)
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:29:8: note:                 'struct data'
   29 | struct data
      |        ^~~~
a.cc: In member function 'void SegTree::init(long long int)':
a.cc:48:12: error: request for member 'resize' in '((SegTree*)this)->SegTree::st', which is of non-class type 'int'
   48 |         st.resize(4 * N + 5);
      |            ^~~~~~
a.cc: In member function 'void SegTree::merge(int&, int&, int&)':
a.cc:56:13: error: request for member 'mn' in 'cur', which is of non-class type 'int'
   56 |         cur.mn = (l.mn+r.mn)%Mod;
      |             ^~
a.cc:56:21: error: request for member 'mn' in 'l', which is of non-class type 'int'
   56 |         cur.mn = (l.mn+r.mn)%Mod;
      |                     ^~
a.cc:56:26: error: request for member 'mn' in 'r', which is of non-class type 'int'
   56 |         cur.mn = (l.mn+r.mn)%Mod;
      |                          ^~
a.cc:57:13: error: request for member 'ten' in 'cur', which is of non-class type 'int'
   57 |         cur.ten=(l.ten+r.ten)%Mod;
      |             ^~~
a.cc:57:20: error: request for member 'ten' in 'l', which is of non-class type 'int'
   57 |         cur.ten=(l.ten+r.ten)%Mod;
      |                    ^~~
a.cc:57:26: error: request for member 'ten' in 'r', which is of non-class type 'int'
   57 |         cur.ten=(l.ten+r.ten)%Mod;
      |                          ^~~
a.cc: In member function 'void SegTree::propagate(long long int, long long int, long long int)':
a.cc:70:38: error: invalid types 'int[long long int]' for array subscript