Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
lli n,m;
string s;
vector<lli> sum;
vector<lli> rightend;
vector<vector<lli> > dp;
int main(){
    cin >> n >> m;
    cin >> s;
    sum = vector<lli> (n+1);
    rightend = vector<lli> (n+1);
    for(lli i = 1;i <= n;i++){
        rightend[i] = i;
    }
    for(lli i = 0;i < n;i++){
        sum[i+1] = sum[i] + (s[i] - '0');
    }
    for(lli i = 0;i < m;i++){
        lli l,r;
        cin >> l >> r;
        for(lli j = l,j <= r;j++) rightend[j] = max(rightend[j],r);
    }
    dp = vector<vector<lli> > (n+1,vector<lli> (n+1));
    dp[0][0] = 1;
    for(lli i = 0;i < n;i++){
        lli b,e;
        b = max(0,i - (rightend[i] - sum[rightend[i]]));
        e = min(i,sum[rightend[i]]);
        for(lli j = b;j <= e;j++){
            dp[i+1][j] += dp[i][j];dp[i+1][j] %= 1000000007;
            dp[i+1][j+1] += dp[i][j];dp[i+1][j] %= 1000000007;
        }
    }
    cout < dp[n][sum[n]] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: expected ';' before '<=' token
   23 |         for(lli j = l,j <= r;j++) rightend[j] = max(rightend[j],r);
      |                        ^~~
      |                        ;
a.cc:23:25: error: expected primary-expression before '<=' token
   23 |         for(lli j = l,j <= r;j++) rightend[j] = max(rightend[j],r);
      |                         ^~
a.cc:29:16: error: no matching function for call to 'max(int, lli)'
   29 |         b = max(0,i - (rightend[i] - sum[rightend[i]]));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:1:
/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:29:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'lli' {aka 'long long int'})
   29 |         b = max(0,i - (rightend[i] - sum[rightend[i]]));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:29:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   29 |         b = max(0,i - (rightend[i] - sum[rightend[i]]));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:36:26: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator<<'
   36 |     cout < dp[n][sum[n]] << endl;