Language: C++

/*
Loading:{
        https://codeforces.com/problemset/problem/1234/F
}
*/
#include <bits/stdc++.h>

using namespace std;

#define ll int
#define endl '\n'
const int N = 1e6 + 5;
ll a[305];
ll dp[305][305][305]; // id, used to donate, used to receive;
ll mod = 998244353; // fucking mod 1e9 + 7
ll n, k, cnt = 0;
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("GUARDS.INP", "r")){
                freopen("GUARDS.INP", "r", stdin);
                freopen("GUARDS.OUT", "w", stdout);
        }
        string s;
        cin >> s;
        n = s.length();
        cin >> k;
        ll cur = 0;
        ll cnt1 = 0;
        for (int i = s.length() - 1; i >= 0; i--){
                if (s[i] == '1') {
                        cur++;
                        cnt1++;
                }
                else {
                        cnt++;
                        a[cnt] = cur;
                        cur = 0;
                }
        }
        cnt++;
        a[cnt] = cur;
        //memset(dp, -1, sizeof(dp));
        k = min(k, cnt1);
        for (int i = a[1]; i >= max(0ll, a[1] - k); i--){
                dp[1][a[1] - i][0] = 1;
        }
        ll sum = a[1];
        for (int i = 1; i < cnt; i++){
                for (int j = 0; j <= sum; j++){
                        for (int t = 0; t <= j; t++){
                                dp[i + 1][j][t] = (dp[i + 1][j][t] + dp[i][j][t]) % mod;
                                for (int x = a[i + 1] - 1; x >= max(0ll, (a[i + 1] - (k - j))); x--){
                                        dp[i + 1][j + a[i + 1] - x][t] = (dp[i + 1][j + a[i + 1] - x][t] + dp[i][j][t]) % mod;
                                }
                                for (int x = a[i + 1] + 1; x <= a[i + 1] + (j - t); x++){
                                        dp[i + 1][j][t + x - a[i + 1]] = (dp[i + 1][j][t + x - a[i + 1]] + dp[i][j][t]) % mod;
                                }
                        }
                }
                sum += a[i + 1];
        }
        ll ans = 0;
        for (int i = 0; i <= k; i++) {
                ans = (ans + dp[cnt][i][i]) % mod;
                //cout << dp[cnt][i][i] << " ";
        }
        cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:36: error: no matching function for call to 'max(long long int, int)'
   45 |         for (int i = a[1]; i >= max(0ll, a[1] - k); 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:6:
/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:45:36: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   45 |         for (int i = a[1]; i >= max(0ll, a[1] - k); 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:45:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   45 |         for (int i = a[1]; i >= max(0ll, a[1] - k); i--){
      |                                 ~~~^~~~~~~~~~~~~~~
a.cc:53:68: error: no matching function for call to 'max(long long int, int)'
   53 |                                 for (int x = a[i + 1] - 1; x >= max(0ll, (a[i + 1] - (k - j))); x--){
      |                                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:53:68: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   53 |                                 for (int x = a[i + 1] - 1; x >= max(0ll, (a[i + 1] - (k - j))); x--){
      |                                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:53:68: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   53 |                                 for (int x = a[i + 1] - 1; x >= max(0ll, (a[i + 1] - (k - j))); x--){
      |                                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~