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

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define  ull unsigned long long 
#define int long long

int32_t main() {
	std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

	ull t;cin >> t;
    
    while (t--) {
        
        string a, b, c; cin >>a >> b >> c;
        int l1 = a.length(),l2=b.length(),l3=c.length();
        vector<int> prev(l3,0),curr(l3);
        for (int i = 0;i < l1;i++) {
            for (int j = 0;j < l3;j++) {
                if (j != 0){
                    if (a[i] == c[j]) curr[j] = 1 + prev[j - 1];
                    else curr[j] = max(curr[j - 1], prev[j]);
                }
                else {
                    if (a[i] == c[j]) curr[j] = 1 ;
                    else curr[j] = prev[j];
                }
                
            }
            prev = curr;
        }
        int a1 = curr[l3 - 1];string n;
        int count = 0;vector<int>r;
        for (int j = 0;j < l3;j++) {
            if (curr[j] <=count) {
                
                n += string(1,c[j]);
            }
            else count = curr[j];
        }
        l3 = n.size();
        vector<int> prev1(l3, 0), curr1(l3);
        for (int i = 0;i < l2;i++) {
            for (int j = 0;j < l3;j++) {
                if (j != 0) {
                    if (b[i] == n[j]) curr1[j] = 1 + prev1[j - 1];
                    else curr1[j] = max(curr1[j - 1], prev1[j]);
                }
                else {
                    if (b[i] == n[j]) curr1[j] = 1;
                    else curr1[j] = prev1[j];
                }

            }
            prev1 = curr1;
        }
        int a2 = curr[l3 - 1];
        cout << c.size() - a1 - a2<<endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define  ull unsigned long long 
#define int long long

int32_t main() {
	std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

	ull t;cin >> t;
    
    while (t--) {
        
        string a, b, c; cin >>a >> b >> c;
        int l1 = a.length(),l2=b.length(),l3=c.length();
        vector<int> prev(l3,0),curr(l3);
        for (int i = 0;i < l1;i++) {
            for (int j = 0;j < l3;j++) {
                if (j != 0){
                    if (a[i] == c[j]) curr[j] = 1 + prev[j - 1];
                    else curr[j] = max(curr[j - 1], prev[j]);
                }
                else {
                    if (a[i] == c[j]) curr[j] = 1 ;
                    else curr[j] = prev[j];
                }
                
            }
            prev = curr;
        }
        int a1 = curr[l3 - 1];string n;
        int count = 0;vector<int>r;
        for (int j = 0;j < l3;j++) {
            if (curr[j] <=count) {
                
                n += string(1,c[j]);
            }
            else count = curr[j];
        }
        l3 = n.size();
        vector<int> prev1(l3, 0), curr1(l3);
        for (int i = 0;i < l2;i++) {
            for (int j = 0;j < l3;j++) {
                if (j != 0) {
                    if (b[i] == n[j]) curr1[j] = 1 + prev1[j - 1];
                    else curr1[j] = max(curr1[j - 1], prev1[j]);
                }
                else {
                    if (b[i] == n[j]) curr1[j] = 1;
                    else curr1[j] = prev1[j];
                }

            }
            prev1 = curr1;
        }
        int a2 = curr1[l3 - 1];
        cout << c.size() - a1 - a2<<endl;
    }
    return 0;
}