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

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

#define ll long long
#define pb push_baci+j
#define ppb pop_baci+j
#define mp mai+je_pair
#define vi vector<int>
#define vll vector<long long>

#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define all(v) v.begin(), v.end()

#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for (int i = a; i >= b; --i)
#define fori(n) for (int i = 0; i < n; ++i)

#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define Yes { cout << "YES\n"; return; }
#define No { cout << "NO\n"; return; }

template<typename T> void print_value(const vector<T>& vec) { for (const auto& element : vec) cout << element << " "; }
template<typename T> void print_value(const T& value) { cout << value << " "; }
template<typename T, typename... Args> void print_value(const T& value, const Args&... args) { print_value(value); print_value(args...); }
template<typename T, typename... Args> void print(const T& value, const Args&... args) { print_value(value, args...); cout << endl; }

template<typename T> void debug_value(const vector<T>& vec) { cout << "[ "; for (const auto& element : vec) cout << element << " "; cout << "] "; }
template<typename T> void debug_value(const T& value) { cout << "# " << value << " "; }
template<typename T, typename... Args> void debug_value(const T& value, const Args&... args) { debug_value(value); debug_value(args...); }
template<typename T, typename... Args> void debug(const T& value, const Args&... args) { debug_value(value, args...); cout << endl; }

const int MOD = 1e9 + 7, INF = INT_MAX;


//------------------------Code Starts-------------------------

int rec(string a, string b, string c, int i, int j){

    if (i+j == c.size()) return 0;

    //come from a
    int sc1;

    if (c[i+j]==a[i]){
        sc1 = rec(a,b,c,i+1,j);
    }
    else{
        sc1 = 1 + rec(a,b,c,i+1,j);
    }

    //come from b
    int sc2;

    if (c[i+j]==b[j]){
        sc2 = rec(a,b,c,i,j+1);
    }
    else{
        sc2 = 1 + rec(a,b,c,i,j+1);
    }

    return min(sc1, sc2);

}


void solve(){
    string a,b,c; cin>>a>>b>>c;
    print(rec(a,b,c,0,0));
}


//------------------------Code Ends---------------------------


int main() {
    fastio;
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}

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

#define ll long long
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define vi vector<int>
#define vll vector<long long>

#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define all(v) v.begin(), v.end()

#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for (int i = a; i >= b; --i)
#define fori(n) for (int i = 0; i < n; ++i)

#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define Yes { cout << "YES\n"; return; }
#define No { cout << "NO\n"; return; }

template<typename T> void print_value(const vector<T>& vec) { for (const auto& element : vec) cout << element << " "; }
template<typename T> void print_value(const T& value) { cout << value << " "; }
template<typename T, typename... Args> void print_value(const T& value, const Args&... args) { print_value(value); print_value(args...); }
template<typename T, typename... Args> void print(const T& value, const Args&... args) { print_value(value, args...); cout << endl; }

const int MOD = 1e9 + 7, INF = INT_MAX;

//------------------------Code Starts-------------------------

int rec(string& a, string& b, string& c, int i, int j, vector<vector<int>>& dp) {
    if (i + j == c.size()) return 0;
    if (dp[i][j] != -1) return dp[i][j];

    int sc1 = INF, sc2 = INF;

    if (i < a.size() && c[i + j] == a[i]) {
        sc1 = rec(a, b, c, i + 1, j, dp);
    } else if (i < a.size()) {
        sc1 = 1 + rec(a, b, c, i + 1, j, dp);
    }

    if (j < b.size() && c[i + j] == b[j]) {
        sc2 = rec(a, b, c, i, j + 1, dp);
    } else if (j < b.size()) {
        sc2 = 1 + rec(a, b, c, i, j + 1, dp);
    }

    return dp[i][j] = min(sc1, sc2);
}

void solve() {
    string a, b, c;
    cin >> a >> b >> c;
    vector<vector<int>> dp(a.size() + 1, vector<int>(b.size() + 1, -1));
    print(rec(a, b, c, 0, 0, dp));
}

//------------------------Code Ends---------------------------

int main() {
    fastio;
    int T = 1;
    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}


Answer: 2