Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) lower_bound(x.begin(),x.end(),v)
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

vector<ll> ab, ac, ba, bc, ca, cb;

vector<ll> conc1(string x, string y) {
	vector<ll> res;
	rep(i, x.length()+1) {
		bool flg = true;
		rep(j, y.length()) {
			if (i+j >= x.length()) break;
			// if (i == 2 && j == 0) cout << x[i+j] << " " << y[j] << endl;
			if (x[i+j] != y[j] && x[i+j] != '?' && y[j] != '?') {
				flg = false;
				break;
			}
		}
		if (flg) res.emplace_back(i);
	}
	// rep(i, (int)res.size()) {
	// 	cout << res[i] << " ";
	// }
	// cout << endl;
	return res;
}



ll conc(string x, string y, string z, vector<ll> xy, vector<ll> xz, vector<ll> yz) {
	ll res = INF;
	rep(i, x.length()+1) {
		rep(j, y.length()+1) {
			if (binary_search(xy.begin(), xy.end(), i) && !binary_search(xz.begin(), xz,end(), i+j) && !binary_search(yz.begin(), yz.end(), j)) {
				ll m1 = max((ll)x.length(), i+(ll)y.length());
				ll m2 = max(m1, i+j+(ll)z.length());
				res = min(res, m2);
				cout << i << " " << j << "  "  << m1 << " " << m2 << " " << res << endl;
			}
		}
	}
	return res;
}

void solve(string a, string b, string c){
	ab = conc1(a, b);
	ac = conc1(a, c);
	ba = conc1(b, a);
	bc = conc1(b, c);
	ca = conc1(c, a);
	cb = conc1(c, b);
	ll res = INF;
	res = min(res, conc(a, b, c, ab, ac, bc));
	res = min(res, conc(a, c, b, ac, ab, cb));
	res = min(res, conc(b, a, c, ba, bc, ac));
	res = min(res, conc(b, c, a, bc, ba, ca));
	res = min(res, conc(c, a, b, ca, cb, ab));
	res = min(res, conc(c, b, a, cb, ca, ba));
	cout << res << endl;
}

int main(){	
	string c;
	string b;
	string a;
	cin >> a;
	cin >> b;
	cin >> c;
	solve(a, b, c);
	return 0;
}



Compiler output:
a.cc: In function 'll conc(std::string, std::string, std::string, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
a.cc:53:104: error: no matching function for call to 'end()'
   53 |                         if (binary_search(xy.begin(), xy.end(), i) && !binary_search(xz.begin(), xz,end(), i+j) && !binary_search(yz.begin(), yz.end(), j)) {
      |                                                                                                     ~~~^~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
                 from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
/usr/include/c++/14/initializer_list:99:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  106 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
 1249 |     end(valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1249:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1265:5: note:   candidate expects 1 argument, 0 provided