Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    map<int,bool>ab,ac,bc;
    string a,b,c;
    cin>>a>>b>>c;
    for(int i=-(int)b.size();i<=a.size();i++){
        int mn=max(0ll,i);
        int mx=min((long long)a.size(),b.size()+i);
        for(int j=mn;j<mx;j++){
            if(a[j]!=b[j-i]&&a[j]!='?'&&b[j-i]!='?'){
                ab[i]=1;
                break;
            }
        }
    }
    for(int i=-(int)c.size();i<=a.size();i++){
        int mn=max(0ll,i);
        int mx=min((long long)a.size(),c.size()+i);
        for(int j=mn;j<mx;j++){
            if(a[j]!=c[j-i]&&a[j]!='?'&&c[j-i]!='?'){
                ac[i]=1;
                break;
            }
        }
    }
    for(int i=-(int)c.size();i<=b.size();i++){
        int mn=max(0ll,i);
        int mx=min((long long)b.size(),c.size()+i);
        for(int j=mn;j<mx;j++){
            if(b[j]!=c[j-i]&&b[j]!='?'&&c[j-i]!='?'){
                bc[i]=1;
                break;
            }
        }
    }
    int ans=6000;
    for(int i=-(long long)(b.size()+c.size());i<=a.size()+c.size();i++){
        if(ab[i])
            continue;
        for(int j=-(long long)(b.size()+c.size());j<=a.size()+b.size();j++){
            if(ac[j])
                continue;
            if(bc[j-i])
                continue;
            int mn=min({0ll,i,j});
            int mx=max({(long long)a.size(),b.size()+i,c.size()+j});
            ans=min(ans,mx-mn);
        }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: no matching function for call to 'min(long long int, long long unsigned int)'
   11 |         int mx=min((long long)a.size(),b.size()+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:11:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   11 |         int mx=min((long long)a.size(),b.size()+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:11:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   11 |         int mx=min((long long)a.size(),b.size()+i);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:21:19: error: no matching function for call to 'min(long long int, long long unsigned int)'
   21 |         int mx=min((long long)a.size(),c.size()+i);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:21:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   21 |         int mx=min((long long)a.size(),c.size()+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
/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:21:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |         int mx=min((long long)a.size(),c.size()+i);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:19: error: no matching function for call to 'min(long long int, long long unsigned int)'
   31 |         int mx=min((long long)b.size(),c.size()+i);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   31 |         int mx=min((long long)b.size(),c.size()+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
/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:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   31 |         int mx=min((long long)b.size(),c.size()+i);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:49:23: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   49 |             int mx=max({(long long)a.size(),b.size()+i,c.size()+j});
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:49:23: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'long long unsigned int')
   49 |             int mx=max({(long long)a.size(),b.size()+i,c.size()+j});
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided