Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

bool isin(int st, int ed, int j){
    return st <= j && j <= ed;
}
void aa(string a, string b, vector<bool>& result){
    int N = 10000;
    int bst = 4000;
    int ben = bst + b.size()-1;
    for(int ast = 0;ast <= N - a.size();ast++){
        int aen = ast + a.size() - 1;
        bool flag = false;
        for (int j = 0; j < N; j++){
            if(isin(ast,aen,j) && isin(bst,ben,j)){
                if(a[j-ast] != b[j-bst] && a[j-ast] != '?' && b[j-bst] != '?'){
                    result.push_back(false);
                    break;
                }
            }
        }
        result.push_back(true);
    }
}
int main(){
    string as,bs,cs;cin>>as>>bs>>cs;
    int N = 10000;
    vector<bool> A;
    vector<bool> B;
    aa(as,cs,A);
    aa(bs,cs,B);
    int result = 10000;
    for(int a = 0;a < N;a++){
        for (int b = 0; b < N; b++)
        {
            if(A[a] && B[b]){
                result = min(result, max(a+as.size()-1, max(b+bs.size()-1,4000+cs.size()-1)) - min(a,min(b,4000)));
            }
        }
        
    }
    cout<<result<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:29: error: no matching function for call to 'min(int&, long unsigned int)'
   40 |                 result = min(result, max(a+as.size()-1, max(b+bs.size()-1,4000+cs.size()-1)) - min(a,min(b,4000)));
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:40:29: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long unsigned int')
   40 |                 result = min(result, max(a+as.size()-1, max(b+bs.size()-1,4000+cs.size()-1)) - min(a,min(b,4000)));
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:3:
/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:40:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   40 |                 result = min(result, max(a+as.size()-1, max(b+bs.size()-1,4000+cs.size()-1)) - min(a,min(b,4000)));
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~