Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
//#define len length()
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect 

int calc_dp(string &s, string &t) {
    bool dp[s.size() + 1][t.size() + 1];
    loop(i, s.size() + 1)
        loop(j, t.size() + 1)
            dp[i][j] = (j == 0);
    loop1(i, s.size())
        loop1(j, t.size())
            dp[i][j] = (dp[i - 1][j - 1] && (s[i - 1] == t[j - 1] || s[i - 1] == '?' || t[j - 1] == '?'));
    for (int i = t.size(); i >= 0; --i)
        if (dp[s.size()][i])
            return i;
}

void solve() {
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    int ans = s[0].size() + s[1].size() + s[2].size();
    loop(a, 3)
        loop(b, 3)
            loop(c, 3) {
                if (a == b || a == c || b == c) continue;
                ans = min(ans, s[0].size() + s[1].size() + s[2].size() - calc_dp(s[a], s[b]) - calc_dp(s[b], s[c]));
            }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:62:26: error: no matching function for call to 'min(ll&, long long unsigned int)'
   62 |                 ans = min(ans, s[0].size() + s[1].size() + s[2].size() - calc_dp(s[a], s[b]) - calc_dp(s[b], s[c]));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:62:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   62 |                 ans = min(ans, s[0].size() + s[1].size() + s[2].size() - calc_dp(s[a], s[b]) - calc_dp(s[b], s[c]));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:6:
/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:62:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   62 |                 ans = min(ans, s[0].size() + s[1].size() + s[2].size() - calc_dp(s[a], s[b]) - calc_dp(s[b], s[c]));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'll calc_dp(std::string&, std::string&)':
a.cc:52:1: warning: control reaches end of non-void function [-Wreturn-type]
   52 | }
      | ^