Language: C++

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

bool match(char x, char y) {
	return (x == '?' || y == '?' || x == y);
}

#define rep(i, n) for (int i = 0; i < (n); i++)

void Main() {
	string A, B, C; cin >> A >> B >> C;
	int a = A.size(), b = B.size(), c = C.size();
	int off = 50000;
	vector<bool> ab(100000, true);
	vector<bool> ac(100000, true);
	vector<bool> bc(100000, true);

	rep(i, a) rep(j, b) ab[i-j+off] &= match(A[i], B[j]);
	rep(i, a) rep(j, c) ac[i-j+off] &= match(A[i], C[j]);
	rep(i, b) rep(j, c) bc[i-j+off] &= match(B[i], C[j]);
	
	int ans = 6000;
	for (int i = -4000; i <= 4000; i++) {
		for (int j = -4000; j <= 4000; j++) {
			if (ab[i+off] && ac[j+off] && bc[j-i+off]) {
				int L = min({0, i, j});
				int R = max({a, i + b, j + c});
				chmin(ans, R - L);
			}
		}
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:67:41: error: no match for 'operator&=' (operand types are 'std::vector<bool>::reference' and 'bool')
   67 |         rep(i, a) rep(j, b) ab[i-j+off] &= match(A[i], B[j]);
      |                             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41,
                 from a.cc:1:
/usr/include/c++/14/cstddef:173:3: note: candidate: 'constexpr std::byte& std::operator&=(byte&, byte)'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/cstddef:173:20: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::byte&'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/ios_base.h:109:3: note: candidate: 'constexpr const std::_Ios_Fmtflags& std::operator&=(_Ios_Fmtflags&, _Ios_Fmtflags)'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:109:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Fmtflags&'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:159:3: note: candidate: 'constexpr const std::_Ios_Openmode& std::operator&=(_Ios_Openmode&, _Ios_Openmode)'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:159:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Openmode&'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:206:3: note: candidate: 'constexpr const std::_Ios_Iostate& std::operator&=(_Ios_Iostate&, _Ios_Iostate)'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:206:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Iostate&'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176:
/usr/include/c++/14/future:181:18: note: candidate: 'constexpr std::launch& std::operator&=(launch&, launch)'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                  ^~~~~~~~
/usr/include/c++/14/future:181:37: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::launch&'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:198:
/usr/include/c++/14/charconv:650:3: note: candidate: 'constexpr std::chars_format& std::operator&=(chars_format&, chars_format)'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/charconv:650:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::chars_format&'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~
a.cc:68:41: error: no match for 'operator&=' (operand types are 'std::vector<bool>::reference' and 'bool')
   68 |         rep(i, a) rep(j, c) ac[i-j+off] &= match(A[i], C[j]);
      |                             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/cstddef:173:3: note: candidate: 'constexpr std::byte& std::operator&=(byte&, byte)'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/cstddef:173:20: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::byte&'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:109:3: note: candidate: 'constexpr const std::_Ios_Fmtflags& std::operator&=(_Ios_Fmtflags&, _Ios_Fmtflags)'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:109:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Fmtflags&'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:159:3: note: candidate: 'constexpr const std::_Ios_Openmode& std::operator&=(_Ios_Openmode&, _Ios_Openmode)'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:159:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Openmode&'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:206:3: note: candidate: 'constexpr const std::_Ios_Iostate& std::operator&=(_Ios_Iostate&, _Ios_Iostate)'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:206:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Iostate&'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/future:181:18: note: candidate: 'constexpr std::launch& std::operator&=(launch&, launch)'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                  ^~~~~~~~
/usr/include/c++/14/future:181:37: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::launch&'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                             ~~~~~~~~^~~
/usr/include/c++/14/charconv:650:3: note: candidate: 'constexpr std::chars_format& std::operator&=(chars_format&, chars_format)'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/charconv:650:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::chars_format&'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~
a.cc:69:41: error: no match for 'operator&=' (operand types are 'std::vector<bool>::reference' and 'bool')
   69 |         rep(i, b) rep(j, c) bc[i-j+off] &= match(B[i], C[j]);
      |                             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/cstddef:173:3: note: candidate: 'constexpr std::byte& std::operator&=(byte&, byte)'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/cstddef:173:20: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::byte&'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:109:3: note: candidate: 'constexpr const std::_Ios_Fmtflags& std::operator&=(_Ios_Fmtflags&, _Ios_Fmtflags)'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:109:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Fmtflags&'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:159:3: note: candidate: 'constexpr const std::_Ios_Openmode& std::operator&=(_Ios_Openmode&, _Ios_Openmode)'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:159:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Openmode&'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:206:3: note: candidate: 'constexpr const std::_Ios_Iostate& std::operator&=(_Ios_Iostate&, _Ios_Iostate)'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:206:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Iostate&'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/future:181:18: note: candidate: 'constexpr std::launch& std::operator&=(launch&, launch)'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                  ^~~~~~~~
/usr/include/c++/14/future:181:37: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::launch&'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                             ~~~~~~~~^~~
/usr/include/c++/14/charconv:650:3: note: candidate: 'constexpr std::chars_format& std::operator&=(chars_format&, chars_format)'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/charconv:650:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::chars_format&'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~