Language: C++

//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cin(x) cin >> x
//最大化問題最小化問題
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll N = 0, K =0;
    cin >> N >> K;

    vll L(K), R(K);
    REP(i,K){
        cin >> L[i] >> R[i];
    }
    //本文

    vector<mint> dp[N+1];
    vector<mint> dpsum[N+1];
    dp[1]=1;
    dpsum[1] = 1;

    //出力
    FOR(i,2,N){
        REP(j,K){
            int li = i-R[j];
            int ri = i-L[j];
            li = max(1,li);
            if(ri<0) continue;
            dp[i]+=dpsum[ri]-dpsum[li-1];
            dpsum[i]=dpsum[i-1]+dp[i];
        }
    }
    cout << dp[N] << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:135:11: error: no match for 'operator=' (operand types are 'std::__debug::vector<mint>' and 'int')
  135 |     dp[1]=1;
      |           ^
In file included from /usr/include/c++/14/vector:76,
                 from /usr/include/c++/14/functional:64,
                 from a.cc:11:
/usr/include/c++/14/debug/vector:255:7: note: candidate: 'std::__debug::vector<_Tp, _Allocator>& std::__debug::vector<_Tp, _Allocator>::operator=(const std::__debug::vector<_Tp, _Allocator>&) [with _Tp = mint; _Allocator = std::allocator<mint>]'
  255 |       operator=(const vector&) = default;
      |       ^~~~~~~~
/usr/include/c++/14/debug/vector:255:17: note:   no known conversion for argument 1 from 'int' to 'const std::__debug::vector<mint>&'
  255 |       operator=(const vector&) = default;
      |                 ^~~~~~~~~~~~~
/usr/include/c++/14/debug/vector:258:7: note: candidate: 'std::__debug::vector<_Tp, _Allocator>& std::__debug::vector<_Tp, _Allocator>::operator=(std::__debug::vector<_Tp, _Allocator>&&) [with _Tp = mint; _Allocator = std::allocator<mint>]'
  258 |       operator=(vector&&) = default;
      |       ^~~~~~~~
/usr/include/c++/14/debug/vector:258:17: note:   no known conversion for argument 1 from 'int' to 'std::__debug::vector<mint>&&'
  258 |       operator=(vector&&) = default;
      |                 ^~~~~~~~
/usr/include/c++/14/debug/vector:262:7: note: candidate: 'std::__debug::vector<_Tp, _Allocator>& std::__debug::vector<_Tp, _Allocator>::operator=(std::initializer_list<_Tp>) [with _Tp = mint; _Allocator = std::allocator<mint>]'
  262 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/debug/vector:262:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<mint>'
  262 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:136:16: error: no match for 'operator=' (operand types are 'std::__debug::vector<mint>' and 'int')
  136 |     dpsum[1] = 1;
      |                ^
/usr/include/c++/14/debug/vector:255:7: note: candidate: 'std::__debug::vector<_Tp, _Allocator>& std::__debug::vector<_Tp, _Allocator>::operator=(const std::__debug::vector<_Tp, _Allocator>&) [with _Tp = mint; _Allocator = std::allocator<mint>]'
  255 |       operator=(const vector&) = default;
      |       ^~~~~~~~
/usr/include/c++/14/debug/vector:255:17: note:   no known conversion for argument 1 from 'int' to 'const std::__debug::vector<mint>&'
  255 |       operator=(const vector&) = default;
      |                 ^~~~~~~~~~~~~
/usr/include/c++/14/debug/vector:258:7: note: candidate: 'std::__debug::vector<_Tp, _Allocator>& std::__debug::vector<_Tp, _Allocator>::operator=(std::__debug::vector<_Tp, _Allocator>&&) [with _Tp = mint; _Allocator = std::allocator<mint>]'
  258 |       operator=(vector&&) = default;
      |       ^~~~~~~~
/usr/include/c++/14/debug/vector:258:17: note:   no known conversion for argument 1 from 'int' to 'std::__debug::vector<mint>&&'
  258 |       operator=(vector&&) = default;
      |                 ^~~~~~~~
/usr/include/c++/14/debug/vector:262:7: note: candidate: 'std::__debug::vector<_Tp, _Allocator>& std::__debug::vector<_Tp, _Allocator>::operator=(std::initializer_list<_Tp>) [with _Tp = mint; _Allocator = std::allocator<mint>]'
  262 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/debug/vector:262:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<mint>'
  262 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:145:29: error: no match for 'operator-' (operand types are 'std::__debug::vector<mint>' and 'std::__debug::vector<mint>')
  145 |             dp[i]+=dpsum[ri]-dpsum[li-1];
      |                    ~~~~~~~~~^~~~~~~~~~~~
      |                            |           |
      |                            |           vector<[...]>
      |                            vector<[...]>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:145:40: note:   'std::__debug::vector<mint>' is not derived from 'const std::reverse_iterator<_Iterator>'
  145 |             dp[i]+=dpsum[ri]-dpsum[li-1];
      |                                        ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:145:40: note:   'std::__debug::vector<mint>' is not derived from 'const std::move_iterator<_IteratorL>'
  145 |             dp[i]+=dpsum[ri]-dpsum[li-1];
      |                                        ^
In file included from a.cc:9:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
  370 |     operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:370:5: note:   template argument deduction/substitution failed:
a.cc:145:40: note:   'std::__debug::vector<mint>' is not derived from 'const std::complex<_Tp>'
  145 |             dp[i]+=dpsum[ri]-dpsum[li-1];
      |                                        ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
  379 |     operator-(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:379:5: note:   template argument deduction/substitution failed:
a.cc:145:40: note:   'std::__debug::vector<mint>' is not derived from 'const std::complex<_Tp>'
  145 |             dp[i]+=dpsum[ri]-dpsum[li-1];
      |                                        ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
  388 |     operator-(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:388:5: note:   template argument deduction/substitution failed:
a.cc:145:40: note:   'std::__debug::vector<mint>' is not derived from 'const std::complex<_Tp>'
  145 |             dp[i]+=dpsum[ri]-dpsum[li-1];
      |                                        ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
  465 |     operator-(const complex<_Tp>& __x)
      |     ^~~~~~~~
/usr/include/c++/14/complex:465:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/valarray:605,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:25:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
a.cc:145:40: note:   'std::__debug::vector<mint>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
  145 |             dp[i]+=dpsum[ri]-dpsum[li-1];
      |                                        ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
a.cc:145:40: note:   'std::__debug::vector<mint>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
  145 |             dp[i]+=dpsum[ri]-dpsum[li-1];
      |                                        ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
a.cc:145:40: note:   'std::__debug::vector<mint>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
  145 |             dp[i]+=dpsum[ri]-dpsum[li-1];
      |                                        ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type>