Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define plll pair <pair <ll, ll>, ll>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define all(a) a.begin(), a.end()

typedef long long ll;

typedef long double ld;

using namespace std;

const ll maxn = 4e3 + 100;
const ll shift = 5e3;
const ll inf = 1e9;

ll n, m, k;

bool AB[maxn * maxn];

bool BC[maxn * maxn];

bool AC[maxn * maxn];

int main() {
    ll q, w, e, d;
    // pyshnapyshnakaa;
    string a, b, c;
    cin >> a >> b >> c;
    for (q = 0; q < a.length(); q++) {
        for (w = 0; w < b.length(); w++) {
            if (a[q] == '?' || b[w] == '?') {
                continue;
            }
            if (a[q] != b[w]) {
                AB[w - q + shift] = 1;
            }
        }
    }
    for (q = 0; q < a.length(); q++) {
        for (w = 0; w < c.length(); w++) {
            if (a[q] == '?' || c[w] == '?') {
                continue;
            }
            if (a[q] != c[w]) {
                AC[w - q + shift] = 1;
            }
        }
    }
    for (q = 0; q < b.length(); q++) {
        for (w = 0; w < c.length(); w++) {
            if (b[q] == '?' || c[w] == '?') {
                continue;
            }
            if (b[q] != c[w]) {
                BC[w - q + shift] = 1;
            }
        }
    }
    // cout << AC[-2 + shift] << endl;
    // cout << AB[shift + ]
    ll ans = inf;
    for (q = -maxn; q < maxn; q++) {
        for (w = -maxn; w < maxn; w++) {
            ll sab = q;
            ll sac = w;
            ll sbc = w - q;
            ll len =  max((ll)a.length(), max(q + b.length(), w + c.length())) 
            - min(0LL, min(q, w));
            if (!AB[-q + shift] && !AC[-w + shift] && !BC[q - w + shift]) {
                // if (q == 2)cout << q << " " << w << endl;
                if (len < ans) {
                    // cout << q << " " << w << endl;
                    ans = len;
                }
                // ans = min(ans, len);
            }
        }
    }
    cout << ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:77:26: error: no matching function for call to 'max(ll, const long long unsigned int&)'
   77 |             ll len =  max((ll)a.length(), max(q + b.length(), w + c.length()))
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: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:77:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   77 |             ll len =  max((ll)a.length(), max(q + b.length(), w + c.length()))
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:77:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   77 |             ll len =  max((ll)a.length(), max(q + b.length(), w + c.length()))
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~