Language: C++

#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=998244353;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
string s;
vi a,b;

int main(){
	cin>>s;
	n=s.size();
	for(int i=0;i<n;i++){
		if(s[i]=='0'){
			a.push_back(i);
			a.push_back(i);
		}
		if(s[i]=='1'){
			a.push_back(i);
			b.push_back(i);
		}
		if(s[i]=='2'){
			b.push_back(i);
			b.push_back(i);
		}
	}
	int h=a.size(),w=b.size();
	vvi dp(h+1,vi(w+1));
	dp[0][0]++;
	for(int i=0;i<=h;i++) for(int j=0;j<=w;j++){
		if(i<h&&a[i]<=(lower_bound(a.begin(),a.end(),a[i])-a.begin())+min(j,(lower_bound(b.begin(),b.end(),a[i])-b.begin()))) (dp[i+1][j]+=dp[i][j])%=mod;
		if(j<w&&b[j]<=min(i,(lower_bound(a.begin(),a.end(),b[j])-a.begin()))+(lower_bound(b.begin(),b.end(),b[j])-b.begin())) (dp[i][j+1]+=dp[i][j])%=mod;
	}
	cout<<dp[h][w]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:82: error: no matching function for call to 'min(int&, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
   53 |                 if(i<h&&a[i]<=(lower_bound(a.begin(),a.end(),a[i])-a.begin())+min(j,(lower_bound(b.begin(),b.end(),a[i])-b.begin()))) (dp[i+1][j]+=dp[i][j])%=mod;
      |                                                                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:53:82: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'})
   53 |                 if(i<h&&a[i]<=(lower_bound(a.begin(),a.end(),a[i])-a.begin())+min(j,(lower_bound(b.begin(),b.end(),a[i])-b.begin()))) (dp[i+1][j]+=dp[i][j])%=mod;
      |                                                                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:53:82: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   53 |                 if(i<h&&a[i]<=(lower_bound(a.begin(),a.end(),a[i])-a.begin())+min(j,(lower_bound(b.begin(),b.end(),a[i])-b.begin()))) (dp[i+1][j]+=dp[i][j])%=mod;
      |                                                                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:54:34: error: no matching function for call to 'min(int&, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
   54 |                 if(j<w&&b[j]<=min(i,(lower_bound(a.begin(),a.end(),b[j])-a.begin()))+(lower_bound(b.begin(),b.end(),b[j])-b.begin())) (dp[i][j+1]+=dp[i][j])%=mod;
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:54:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'})
   54 |                 if(j<w&&b[j]<=min(i,(lower_bound(a.begin(),a.end(),b[j])-a.begin()))+(lower_bound(b.begin(),b.end(),b[j])-b.begin())) (dp[i][j+1]+=dp[i][j])%=mod;
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:54:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   54 |                 if(j<w&&b[j]<=min(i,(lower_bound(a.begin(),a.end(),b[j])-a.begin()))+(lower_bound(b.begin(),b.end(),b[j])-b.begin())) (dp[i][j+1]+=dp[i][j])%=mod;
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~