Language: C++

//セグ木基本
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 998244353LL
using vi = vector<ll>;
using vvi = vector<vi>;
const ll llMAX=9223372036854775807LL; 
const ll llMIN=-9223372036854775808LL;

ll n,k;

class SegTree
{
  public:
  ll n2,ln2;//2のべき乗になる数でn以上の数//n2のlog2値
  vector<ll> data;//●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
  vector<int> indexdata;
  SegTree(){}
  void Init(ll inn){
    ln2=ceil(log2(inn));
    n2=1<<ln2;
    data.resize(n2*2);
    indexdata.resize(n2*2);
    for(ll i=0;i<n2*2;i++)
      data[i]=Initval();//●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
    for(int i=0;i<n2;i++)
      indexdata[i+n2]=i;
    
  }
  //配列内初期化●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
  ll Initval(){
    return llMAX;
  }
  //min関数的な
  //●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
  ll SGTfunc(ll d0,ll d1){
    return min(d0,d1);
  }
  //データをセットして内部更新 O(logn)
  void Updata(ll posi,ll d)
  {
    ll myi=posi+n2;
    data[myi]=d;//葉
    for(ll i=0;i<ln2;i++){//中間要素
      myi/=2;
      data[myi]=SGTfunc(data[myi*2],data[myi*2+1]);
      if (data[myi*2]==data[myi]){
        indexdata[myi]=indexdata[myi*2];
      }else{
        indexdata[myi]=indexdata[myi*2+1];
      }
    }
  }
  void Delete(ll posi)//1要素削除して初期化
  {
    Updata(posi,Initval());
  }

  //lを含むrを含まないところまでの区間
  ll GetMin(ll l,ll r)
  {
    l=max(l,0);
    r=max(r,0);
    ll ret=data[l+n2];//ここは比較するならMAXかMINを、合計するなら0を●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
    ll l_=l;
    ll r_=r;
    for(ll i=0;(l_+r_)>0;i++){
      ll offset=1<<(ln2-i);
      if (r_%2==1){
          if (r_-1>=l_){
            ret=SGTfunc(ret,data[offset+r_-1]);
            r_--;
          }
      }
      if (l_%2==1){
          if (l_<r_){
            ret=SGTfunc(ret,data[offset+l_]);
            l_++;
          }
      }
      r_>>=1;
      l_>>=1;
    }
    return ret;
  }
  ll GetAll()//0～最後の要素まで
  {
    return GetMin(0,n2);
  }

  
  //lを含むrを含まないところまでの区間で_最小_の値をもつindexを返す
  int GetMinIndex(ll l,ll r)
  {
    int retindex=l;
    ll ret=data[l+n2];//ここは比較するならMAXかMINを、合計するなら0を●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
    ll l_=l;
    ll r_=r;
    for(ll i=0;(l_+r_)>0;i++){
      ll offset=1<<(ln2-i);
      if (r_%2==1){
          if (r_-1>=l_){
            ll ret_tmp=SGTfunc(ret,data[offset+r_-1]);
            if (ret!=ret_tmp){
              retindex=indexdata[offset+r_-1];
              ret=ret_tmp;
            }
            r_--;
          }
      }
      if (l_%2==1){
          if (l_<r_){
            ll ret_tmp=SGTfunc(ret,data[offset+l_]);
            if (ret!=ret_tmp){
              retindex=indexdata[offset+l_];
              ret=ret_tmp;
            }
            l_++;
          }
      }
      r_>>=1;
      l_>>=1;
    }
    return retindex;
  }
  int GetAllIndex()//0～最後の要素まで
  {
    return GetMinIndex(0,n2);
  }
};




int main(){
  ll ans=0;
  cin>>n>>k;
  vi R(k),L(k);
  REP(i,k){
    cin>>L[i]>>R[i];
    L[i]--;
    R[i]--;
  }
  vi dp(n);
  dp[0]=1;


  SegTree segtree;
  segtree.Init(n);

  segtree.Updata(0,1);

  for(ll i=1;i<n;i++){
    
    for(ll j=0;j<k;j++){
      ll val=segtree.GetMin(i-R[j],i-L[j]+1);
      dp[i]+=val;
    }
    dp[i]=dp[i]%MOD;
    segtree.Updata(i,dp[i]);
  }
  
  /*
  ll val=segtree.GetAll();
  cout<<val<<endl;
  int idx=segtree.GetAllIndex();
  cout<<idx<<endl;

  val=segtree.GetMin(1,3);
  cout<<val<<endl;

  idx=segtree.GetMinIndex(1,3);
  cout<<idx<<endl;
*/
  return 0;
}

Compiler output:
a.cc:10:17: warning: integer constant is so large that it is unsigned
   10 | const ll llMIN=-9223372036854775808LL;
      |                 ^~~~~~~~~~~~~~~~~~~~~
a.cc: In member function 'long long int SegTree::GetMin(long long int, long long int)':
a.cc:64:10: error: no matching function for call to 'max(long long int&, int)'
   64 |     l=max(l,0);
      |       ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:64:10: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   64 |     l=max(l,0);
      |       ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:64:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   64 |     l=max(l,0);
      |       ~~~^~~~~
a.cc:65:10: error: no matching function for call to 'max(long long int&, int)'
   65 |     r=max(r,0);
      |       ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:65:10: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   65 |     r=max(r,0);
      |       ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:65:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   65 |     r=max(r,0);
      |       ~~~^~~~~