Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Compilation error):
// #ifndef ONLINE_JUDGE
// #include "debug/debud.h"
// #endif
// #ifdef ONLINE_JUDGE
// #define dbg(x)
// #define dbgs(...)
// #endif

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(nullptr)
#define ll long long
#define loop(i, a, b) for (int i = a; i < b; i += 1)
#define rloop(i, a, b) for (int i = b - 1; i >= a; i -= 1)
#define yn(f) (f) ? cout << "YES\n" : cout << "NO\n"
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define cmax(a, b) a = max(a, b)
#define cmin(a, b) a = min(a, b)
#define in(...)      \
    int __VA_ARGS__; \
    input(__VA_ARGS__);
#define endl '\n'
const long long int modu = 1000000007;
template <typename... Args>
void input(Args&... args) {
    ((cin >> args), ...);
}
template <typename T1, typename T2>
istream& operator>>(istream& istream, pair<T1, T2>& p) {
    return (istream >> p.first >> p.second);
}
template <typename T>
istream& operator>>(istream& istream, vector<T>& v) {
    for (auto& it : v) cin >> it;
    return istream;
}
template <typename T>
ostream& operator<<(ostream& ostream, const vector<T>& c) {
    for (auto& it : c) ostream << it << " ";
    return ostream;
}
#define int ll

void solve() {
    string a, b, c;
    cin >> a >> b >> c;

    int ans = 1e9;

    auto f = [&](int i, int j, string& ss) {
        if (i + j == c.size()) {
            int t = 0;
            for (int k = 0; k < c.size(); ++k) {
                t += (ss[k] != c[k]);
            }
            ans = min(ans, t);
            return;
        }

        if (i < a.size()) {
            ss.push_back(a[i]);
            f(i + 1, j, ss);
            ss.pop_back();
        }
        if (j < b.size()) {
            ss.push_back(b[j]);
            f(i, j + 1, ss);
            ss.pop_back();
        }
    };

    string ss = "";
    f(0, 0, ss);

    cout << ans << endl;
}

signed main() {
    fast_io;
    int t = 1;
    cin >> t;
    for (int i = 1; i < t + 1; i++) {
        // cerr << "----- TC " << i << " -----" << endl;
        solve();
    }
}

Submission (verdict: Time limit exceeded on test 6):
// #ifndef ONLINE_JUDGE
// #include "debug/debud.h"
// #endif
// #ifdef ONLINE_JUDGE
// #define dbg(x)
// #define dbgs(...)
// #endif

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(nullptr)
#define ll long long
#define loop(i, a, b) for (int i = a; i < b; i += 1)
#define rloop(i, a, b) for (int i = b - 1; i >= a; i -= 1)
#define yn(f) (f) ? cout << "YES\n" : cout << "NO\n"
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define cmax(a, b) a = max(a, b)
#define cmin(a, b) a = min(a, b)
#define in(...)      \
    int __VA_ARGS__; \
    input(__VA_ARGS__);
#define endl '\n'
const long long int modu = 1000000007;
template <typename... Args>
void input(Args&... args) {
    ((cin >> args), ...);
}
template <typename T1, typename T2>
istream& operator>>(istream& istream, pair<T1, T2>& p) {
    return (istream >> p.first >> p.second);
}
template <typename T>
istream& operator>>(istream& istream, vector<T>& v) {
    for (auto& it : v) cin >> it;
    return istream;
}
template <typename T>
ostream& operator<<(ostream& ostream, const vector<T>& c) {
    for (auto& it : c) ostream << it << " ";
    return ostream;
}
#define int ll

void solve() {
    string a, b, c;
    cin >> a >> b >> c;

    int ans = 1e9;

    function<void(int, int, string&)> f = [&](int i, int j, string& ss) {
        if (i + j == c.size()) {
            int t = 0;
            for (int k = 0; k < c.size(); ++k) {
                t += (ss[k] != c[k]);
            }
            ans = min(ans, t);
            return;
        }

        if (i < a.size()) {
            ss.push_back(a[i]);
            f(i + 1, j, ss);
            ss.pop_back();
        }
        if (j < b.size()) {
            ss.push_back(b[j]);
            f(i, j + 1, ss);
            ss.pop_back();
        }
    };

    string ss = "";
    f(0, 0, ss);

    cout << ans << endl;
}

signed main() {
    fast_io;
    int t = 1;
    cin >> t;
    for (int i = 1; i < t + 1; i++) {
        // cerr << "----- TC " << i << " -----" << endl;
        solve();
    }
}