Language: C++

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
int n,m;
string ch;
int dp[100005];
ll fun(int pos)
{
    if(pos==n)
    {
        return dp[pos]=0;
    }
    if(pos>n)
    {
        return dp[pos]=1e8;
    }
    if(dp[pos]!=-1)
    {
        return dp[pos];
    }
    int req=1e8;
    for(int i=1; (pos+i)<=n; i++)
    {
        if(i>m)
            break;
        if(ch[pos+i]=='0')
        {
            req=min(req,1+fun(pos+i));
        }
    }
    return dp[pos]=req;
}
vector<int> razib;
int res;
void path(int pos)
{
    if(pos==n)
    {
        return;
    }
    for(int i=1; (pos+i)<=n; i++)
    {
        if(i>m)
            break;
        if(ch[pos+i]=='0')
        {
            ll req=dp[pos+i];
            //cout<<req<<" req "<<res<<endl;
            if((req+1)==res)
            {
                res--;
                razib.push_back(i);
                path(pos+i);
                break;
            }
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m>>ch;
    memset(dp,-1,sizeof dp);
    res=fun(0);

    if(res==1e8)
    {
        cout<<-1<<"\n";
    }
    else
    {
        razib.clear();
        path(0);
        //cout<<ans.size()<<endl;
        for(int i=0; i<razib.size(); i++)
        {
            cout<<razib[i]<<" ";
        }
        cout<<"\n";
    }


    return 0;
}


Compiler output:
a.cc: In function 'll fun(int)':
a.cc:31:20: error: no matching function for call to 'min(int&, ll)'
   31 |             req=min(req,1+fun(pos+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: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:31:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   31 |             req=min(req,1+fun(pos+i));
      |                 ~~~^~~~~~~~~~~~~~~~~~
/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:31:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   31 |             req=min(req,1+fun(pos+i));
      |                 ~~~^~~~~~~~~~~~~~~~~~