Problem: 2050E - Three Strings
Language: c++20 

Code 1:
#include <climits>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")

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

typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long long int ll;
typedef unsigned long long int ull;
typedef priority_queue<ll> mxhpl;
typedef priority_queue<int> mxhpi;
typedef priority_queue<ll, vector<ll>, greater<ll>> mnhpl;
typedef priority_queue<int, vector<int>, greater<int>> mnhpi;

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()
#define REP(i, start, end) for (ll i = start; i <= end; ++i)
#define RREP(i, end, start) for (ll i = end; i >= start; --i)
#define parr(a, n)           \
    rep(i, 0, n) {           \
        cout << a[i] << " "; \
    }                        \
    cout << "\n"
#define sarr(a, n) rep(i, 0, n) cin >> a[i]
#define pb push_back
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define mset(a, x) memset(a, x, sizeof(a))
#define ps(x, y) \
    fixed << setprecision(y) << x  // cout << ps(ans, decimal places);
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)

// DEBUGGING
void __print(int x) {
    cerr << x;
}
void __print(long x) {
    cerr << x;
}
void __print(long long x) {
    cerr << x;
}
void __print(unsigned x) {
    cerr << x;
}
void __print(unsigned long x) {
    cerr << x;
}
void __print(unsigned long long x) {
    cerr << x;
}
void __print(float x) {
    cerr << x;
}
void __print(double x) {
    cerr << x;
}
void __print(long double x) {
    cerr << x;
}
void __print(char x) {
    cerr << '\'' << x << '\'';
}
void __print(const char* x) {
    cerr << '\"' << x << '\"';
}
void __print(const string& x) {
    cerr << '\"' << x << '\"';
}
void __print(bool x) {
    cerr << (x ? "true" : "false");
}

template <typename T, typename V>
void __print(const pair<T, V>& x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T& x) {
    int f = 0;
    cerr << '{';
    for (auto& i : x)
        cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() {
    cerr << "]\n";
}
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

// Fast IO
void IO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}

#define MOD 1000000007

// CODE
/*******************************************************/
#define MX 1003  // TODO:

ll an, bn, cn;
string a, b, c;

ll dp[MX][MX];

ll recFun(ll i = 0, ll j = 0, ll k = 0, ll miss = 0) {
    if (dp[i][j] != INT_MAX && miss >= dp[i][j]) return dp[i][j];
    if (i >= an) {
        while (j < bn) {
            if (b[j] != c[k]) miss++;
            j++;
            k++;
        }
        return dp[i][j] = miss;
    }
    if (j >= bn) {
        while (i < an) {
            if (a[i] != c[k]) miss++;
            i++;
            k++;
        }
        return dp[i][j] = miss;
    }
    if (k >= cn) {
        return INT_MAX;
    }
    ll inc1 = a[i] == c[k] ? 0 : 1;
    ll inc2 = b[j] == c[k] ? 0 : 1;
    ll ans1 = recFun(i + 1, j, k + 1, miss + inc1);
    ll ans2 = recFun(i, j + 1, k + 1, miss + inc2);
    ans1 = min(ans1, ans2);
    dp[i][j] = min(dp[i][j], ans1);
    return dp[i][j];
}

void solve() {
    cin >> a >> b >> c;
    an = sz(a);
    bn = sz(b);
    cn = sz(c);
    ll* begin = &dp[0][0];
    size_t size = sizeof(dp) / sizeof(**dp);

    fill_n(begin, size, INT_MAX);

    cout << recFun() << endl;
}

int main() {
    IO();
    int t = 1;

    cin >> t;

    while (t--) {
        solve();
    }
    return 0;
}

/*******************************************************/


Code 2:
#include <climits>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")

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

typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long long int ll;
typedef unsigned long long int ull;
typedef priority_queue<ll> mxhpl;
typedef priority_queue<int> mxhpi;
typedef priority_queue<ll, vector<ll>, greater<ll>> mnhpl;
typedef priority_queue<int, vector<int>, greater<int>> mnhpi;

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()
#define REP(i, start, end) for (ll i = start; i <= end; ++i)
#define RREP(i, end, start) for (ll i = end; i >= start; --i)
#define parr(a, n)           \
    rep(i, 0, n) {           \
        cout << a[i] << " "; \
    }                        \
    cout << "\n"
#define sarr(a, n) rep(i, 0, n) cin >> a[i]
#define pb push_back
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define mset(a, x) memset(a, x, sizeof(a))
#define ps(x, y) \
    fixed << setprecision(y) << x  // cout << ps(ans, decimal places);
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)

// DEBUGGING
void __print(int x) {
    cerr << x;
}
void __print(long x) {
    cerr << x;
}
void __print(long long x) {
    cerr << x;
}
void __print(unsigned x) {
    cerr << x;
}
void __print(unsigned long x) {
    cerr << x;
}
void __print(unsigned long long x) {
    cerr << x;
}
void __print(float x) {
    cerr << x;
}
void __print(double x) {
    cerr << x;
}
void __print(long double x) {
    cerr << x;
}
void __print(char x) {
    cerr << '\'' << x << '\'';
}
void __print(const char* x) {
    cerr << '\"' << x << '\"';
}
void __print(const string& x) {
    cerr << '\"' << x << '\"';
}
void __print(bool x) {
    cerr << (x ? "true" : "false");
}

template <typename T, typename V>
void __print(const pair<T, V>& x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T& x) {
    int f = 0;
    cerr << '{';
    for (auto& i : x)
        cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() {
    cerr << "]\n";
}
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

// Fast IO
void IO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}

#define MOD 1000000007

// CODE
/*******************************************************/
#define MX 1003  // TODO:

ll an, bn, cn;
string a, b, c;

ll dp[MX][MX];

ll recFun(ll i = 0, ll j = 0, ll k = 0) {
    if (dp[i][j] != -1) return dp[i][j];
    if (i >= an && j >= bn) return 0;
    ll inc1 = a[i] == c[k] ? 0 : 1;
    ll inc2 = b[j] == c[k] ? 0 : 1;
    ll res = MOD;
    if (i < an) {
        ll ans1 = recFun(i + 1, j, k + 1) + inc1;
        res = min(res, ans1);
    }
    if (j < bn) {
        ll ans2 = recFun(i, j + 1, k + 1) + inc2;
        res = min(res, ans2);
    }
    dp[i][j] = res;
    return dp[i][j];
}

void solve() {
    cin >> a >> b >> c;
    an = sz(a);
    bn = sz(b);
    cn = sz(c);
    ll* begin = &dp[0][0];
    size_t size = sizeof(dp) / sizeof(**dp);

    fill_n(begin, size, -1);

    cout << recFun() << endl;
}

int main() {
    IO();
    int t = 1;

    cin >> t;

    while (t--) {
        solve();
    }
    return 0;
}

/*******************************************************/


Answer: 2