Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iterator>
#include <set>
#include <map>
#include <numeric>
#include <unordered_set>
#include <cstring> 
#include <bitset>
#include <climits>
#include <tuple>
#include <deque>
#include <queue>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
 
#define PB push_back
#define F first
#define S second
const ll M = 1e9 + 7;

void solve() {
    string a, b, c;
    cin >> a >> b >> c; a = " " + a; b = " " + b; c = " " + c;
    int n = a.size(), m = b.size();
    vector<vector<ll> > dp(n + 1, vector<ll> (m + 1, 0));
    dp[0][0] = 0;
    for (ll i = 0; i <= n; i++) {
        for (ll j = 0; j <= m; j++) {
            if (i == 0 && j == 0) {continue;}
            dp[i][j] = INT_MAX;
            if (i != 0) {
                if (c[i + j] == a[i]) {
                    dp[i][j] = dp[i - 1][j];
                }
                else {
                    dp[i][j] = dp[i - 1][j] + 1;
                }
            }
            if (j != 0) {
                if (c[i + j] == b[j]) {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1]);
                }
                else {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
                }
            }
            // cerr << dp[i][j] << " "; 
        } //cerr << "\n"; 
    }
    // cerr << "\n";
    cout << dp[n][m] << "\n";
}

 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t; 
    cin >> t;
    while(t--) {solve();}
    // solve();
    return 0;
}

Submission (verdict: Accepted):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iterator>
#include <set>
#include <map>
#include <numeric>
#include <unordered_set>
#include <cstring> 
#include <bitset>
#include <climits>
#include <tuple>
#include <deque>
#include <queue>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
 
#define PB push_back
#define F first
#define S second
const ll M = 1e9 + 7;

void solve() {
    string a, b, c;
    
    cin >> a >> b >> c; 
    int n = a.size(), m = b.size();
    a = " " + a; b = " " + b; c = " " + c;
    vector<vector<ll> > dp(n + 1, vector<ll> (m + 1, 0));
    dp[0][0] = 0;
    for (ll i = 0; i <= n; i++) {
        for (ll j = 0; j <= m; j++) {
            if (i == 0 && j == 0) {continue;}
            dp[i][j] = INT_MAX;
            if (i != 0) {
                if (c[i + j] == a[i]) {
                    dp[i][j] = dp[i - 1][j];
                }
                else {
                    dp[i][j] = dp[i - 1][j] + 1;
                }
            }
            if (j != 0) {
                if (c[i + j] == b[j]) {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1]);
                }
                else {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
                }
            }
            // cout << dp[i][j] << " "; 
        } //cout << "\n"; 
    }
 
    cout << dp[n][m] << "\n";
}

 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t; 
    cin >> t;
    while(t--) {solve();}
    // solve();
    return 0;
}