Language: C++

#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}
int comb(int n, int k) {
	k = min(k, n - k);
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

bool check(char a, char b) {
	if (a == b) return true;
	if (a == '?' || b == '?') return true;
	else return false;
}

bool check(char a, char b, char c) {
	if (a == b && b == c) return true;
	else if (a == '?') return check(b, c);
	else if (b == '?') return check(a, c);
	else if (c == '?') return check(a, b);
	else return false;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int mi = INF;
	string A, B, C;
	string a, b, c;
	cin >> A >> B >> C;
	rep(x, 6) {
		if (x == 0) {
			a = A; b = B, c = C;
		}
		if (x == 1) {
			a = A; b = C, c = B;
		}
		if (x == 2) {
			a = B; b = A, c = C;
		}
		if (x == 3) {
			a = B; b = C, c = A;
		}
		if (x == 4) {
			a = C; b = A, c = B;
		}
		if (x == 5) {
			a = C; b = B, c = A;
		}
		for (int i = 0; i <= a.size(); i++) {
			bool ok = true;
			for (int j = i; j < a.size(); j++) {
				if (!check(a[j], b[j - i])) {
					ok = false;
					break;
				}
			}
			if (ok) {
				for (int j = 0; j <= i + b.size(); j++) {
					bool neok = true;
					for (int k = j; k < a.size(); k++) {
						if (!check(a[k], c[k - j])) {
							neok = false;
							break;
						}
					}
					for (int k = max(i, j); k < min(i + b.size() - 1, j + c.size() - 1); k++) {
						if (!check(b[k - i], c[k - j])) {
							neok = false;
							break;
						}
					}
					if (neok) {
						mi = min(mi, j + c.size());
					}
				}
			}
		}
	}
	cout << mi << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:165:57: error: no matching function for call to 'min(long long int&, long long unsigned int)'
  165 |                                                 mi = min(mi, j + c.size());
      |                                                      ~~~^~~~~~~~~~~~~~~~~~
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:3:
/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:165:57: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
  165 |                                                 mi = min(mi, j + c.size());
      |                                                      ~~~^~~~~~~~~~~~~~~~~~
/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:165:57: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  165 |                                                 mi = min(mi, j + c.size());
      |                                                      ~~~^~~~~~~~~~~~~~~~~~