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

Code 1:
#include <bits/stdc++.h>
#define MOD 1000000007
#define loop(i, a, b) for (int i = a; i < b; i++)
#define append push_back
#define vi vector<int>
#define mi map<int, int>
#define sortv(a) sort(a.begin(), a.end())
#define int long long

typedef unsigned long long ull;

using namespace std;

void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

// <-----------SidZRed-------------->
// <----Why are you reading this---->

signed main() {
    fast_io();

    int t;
    cin >> t;

    while (t--) {
        string a, b, c;
        cin >> a >> b >> c;

        int n = a.length(), m = b.length(), k = c.length();

        // DP table: dp[x][i] -> min changes for first x chars of c using first i chars of a
        vector<vector<int>> dp(k + 1, vector<int>(n + 1, INT_MAX));
        dp[0][0] = 0; 

        for (int x = 1; x <= k; x++) {
            if (x <= m) {
                dp[x][0] = dp[x - 1][0] + (c[x - 1] != b[x - 1]);
            }
        }

        for (int i = 1; i <= n; i++) {
            if (i <= k) {
                dp[i][i] = dp[i - 1][i - 1] + (c[i - 1] != a[i - 1]);
            }
        }

        for (int x = 1; x <= k; x++) {
            for (int i = 0; i <= min(x, n); i++) {
                int j = x - i; 
                if (j > m) continue; 

                if (j > 0 && x - 1 >= 0) {
                    dp[x][i] = min(dp[x][i], dp[x - 1][i] + (c[x - 1] != b[j - 1]));
                }

                if (i > 0 && x - 1 >= 0) {
                    dp[x][i] = min(dp[x][i], dp[x - 1][i - 1] + (c[x - 1] != a[i - 1]));
                }
            }
        }

        int ans = INT_MAX;
        for (int i = 0; i <= n; i++) {
            ans = min(ans, dp[k][i]);
        }

        cout << ans << endl;
    }
    return 0;
}


Code 2:
#include <bits/stdc++.h>

#define MOD 1000000007
#define loop(i,a,b) for(int i = a;i < b;i++)
#define append push_back
#define vi vector<int>
#define mi map<int, int>
#define sort(a) sort(a.begin(), a.end())
#define int long long

typedef unsigned long long ull;

using namespace std;

void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

// <-----------SidZRed-------------->
// <----Why are you reading this---->


signed main(){
    fast_io();

    int t;
    cin>>t;
    
    while(t--){
        string a, b, c;
        cin>>a>>b>>c;

        vector<vector<int>> dp(c.length()+1, vector<int>(a.length() + 1, INT_MAX));
        // dp[x][i] represents the minimum number of changes needed to create the first x characters of c using the first i characters of a and first x-i characters of b.

        dp[0][0] = 0;

        for(int x=1;x<=c.length();x++){
            dp[x][0] = dp[x-1][0] + (c[x-1] != b[x-1]);
        }
        for(int i=1;i<=a.length();i++){
            dp[i][i] = dp[i-1][i-1] + (c[i-1] != a[i-1]);
        }
        
        for(int x=1;x<=c.length();x++){
            for(int i=1;i<=min(x, (int)a.length());i++){
                dp[x][i] = min(dp[x-1][i] + (c[x-1] != b[x-i-1]), dp[x-1][i-1] + (c[x-1] != a[i-1]));
            }
        }

        int ans = *min_element(dp[c.length()].begin(), dp[c.length()].end());
        cout<<ans<<endl;
    }
    return 0;
}

Answer: 1