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

Code 1:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PB push_back
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define Q int tt; cin>>tt ; for(int qq=1; qq <= tt; qq++)
#define endl "\n"

//PBDS start
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update>//sudhu less dile uniqe element rakhbe ,,less_equal dile duplicate value rakhbe
new_data_set;
//it=s.find_by_order(k) return the iterator of k'th elemet , counting from 0(k'th index itertor)
//int cnt=s.oeder_of_key(k); return the number of elements strictly less than k

//PBDS end
 

//Debug start
template<typename A, typename B> ostream& operator<<(ostream& os, const pair<A, B>& p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream& os, const T_container& v) { os << '{'; string sep; for (const T& x : v) os << sep << x, sep = ", "; return os << '}'; }
 
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#ifdef LOCAL
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
//Debug End
 

const ll mod=998244353;
ll inf=1e18;

long long big_mod(long long a,long long b,long long m)//[(a^b)%m] here b is very large number almost 1e9
{
    if(b==0)return (1%m);
    long long x=big_mod(a,b/2,m);
    x=(x*x)%m;
    if(b%2==1)x=(x*a)%m;
    return x;
}

vector<vector<int>>dp;

int solve(int i,int j,string a, string b, string c)
{
  if(i>=a.size() && j>=b.size())return 0;
  if(dp[i][j]!=-1)return dp[i][j];
  int ans,ans1=1e7, ans2=1e7;
  if(i<a.size() )
  {
    int d=0;
    if(a[i]!=c[i+j])d=1;
    ans1=d+solve(i+1,j,a,b,c);

  }
  if(j<b.size())
  {
    int d=0;
    if(b[j]!=c[i+j])d=1;
    ans2=d+solve(i,j+1,a,b,c);

  }
  ans=min(ans1,ans2);
  dp[i][j]=ans;
  return dp[i][j];

}


int main()
{
  fast;
  Q
  {
    string a,b,c;
    cin>>a>>b>>c;
    int n=a.size(),m=b.size();
    dp.assign(n+1,vector<int>(m+1,-1));
    int ans= solve(0,0,a,b,c);
    cout<<ans<<endl;
    
  }
return 0;
}

Code 2:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PB push_back
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define Q int tt; cin>>tt ; for(int qq=1; qq <= tt; qq++)
#define endl "\n"

//PBDS start
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update>//sudhu less dile uniqe element rakhbe ,,less_equal dile duplicate value rakhbe
new_data_set;
//it=s.find_by_order(k) return the iterator of k'th elemet , counting from 0(k'th index itertor)
//int cnt=s.oeder_of_key(k); return the number of elements strictly less than k

//PBDS end
 

//Debug start
template<typename A, typename B> ostream& operator<<(ostream& os, const pair<A, B>& p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream& os, const T_container& v) { os << '{'; string sep; for (const T& x : v) os << sep << x, sep = ", "; return os << '}'; }
 
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#ifdef LOCAL
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
//Debug End
 

const ll mod=998244353;
ll inf=1e18;

long long big_mod(long long a,long long b,long long m)//[(a^b)%m] here b is very large number almost 1e9
{
    if(b==0)return (1%m);
    long long x=big_mod(a,b/2,m);
    x=(x*x)%m;
    if(b%2==1)x=(x*a)%m;
    return x;
}

vector<vector<int>>dp;

int solve(int i,int j,string &a, string &b, string &c)
{
  if(i>=a.size() && j>=b.size())return 0;
  if(dp[i][j]!=-1)return dp[i][j];
  int ans,ans1=1e7, ans2=1e7;
  if(i<a.size() )
  {
    int d=0;
    if(a[i]!=c[i+j])d=1;
    ans1=d+solve(i+1,j,a,b,c);

  }
  if(j<b.size())
  {
    int d=0;
    if(b[j]!=c[i+j])d=1;
    ans2=d+solve(i,j+1,a,b,c);

  }
  ans=min(ans1,ans2);
  dp[i][j]=ans;
  return dp[i][j];

}


int main()
{
  fast;
  Q
  {
    string a,b,c;
    cin>>a>>b>>c;
    int n=a.size(),m=b.size();
    dp.assign(n+1,vector<int>(m+1,-1));
    int ans= solve(0,0,a,b,c);
    cout<<ans<<endl;
    
  }
return 0;
}

Answer: 2