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

Code 1:
//#include "dec24_1.h"

#include <algorithm>
#include <iostream>
#include <string>
#include <string_view>
#include <vector>

using namespace std;

int SolveHelper(std::vector<std::vector<int>>& dp, std::string_view string1,
                std::string_view string2, std::string_view string3, int p1,
                int p2, int p3) {
  if (dp[p1][p2] != -1) return dp[p1][p2];
  if (p1 == string1.size()) {
    if (dp[p1][p2] != -1) return dp[p1][p2];
    int count = 0;
    for (int i = p2; i < string2.size(); i++) {
      if (string2[i] != string3[p1 + i]) {
        count++;
      }
    }
    dp[p1][p2] = count;
    return count;
  }

  if (p2 == string2.size()) {
    int count = 0;
    for (int i = p1; i < string1.size(); i++) {
      if (string1[i] != string3[p2 + i]) {
        count++;
      }
    }
    dp[p1][p2] = count;
    return count;
  }
  int x;
  if (string1[p1] == string3[p3]) {
    x = SolveHelper(dp, string1, string2, string3, p1 + 1, p2, p3 + 1);
  } else {
    x = SolveHelper(dp, string1, string2, string3, p1 + 1, p2, p3 + 1) + 1;
  }
  if (string2[p2] == string3[p3]) {
    x = std::min(x,
          SolveHelper(dp, string1, string2, string3, p1, p2 + 1, p3 + 1));
  } else {
    x = std::min(x,
          SolveHelper(dp, string1, string2, string3, p1, p2 + 1, p3 + 1) + 1);
  }
  dp[p1][p2] = x;
  return x;
}

class Problem {
 public:
  Problem() = default;
  int Solve(std::vector<std::vector<int>>& dp,
            std::string_view string1,
            std::string_view string2,
            std::string_view string3) {
    return SolveHelper(dp, string1, string2, string3, 0, 0, 0);
  }
};

int main() {
  int n;
  cin >> n;
  std::vector<int> output;
  for (int i = 0; i < n; i++) {
    std::string string1, string2, string3;
    Problem problem;
    cin >> string1;
    cin >> string2;
    cin >> string3;
    std::vector<std::vector<int>> matrix(string1.size() + 1,
                                          std::vector<int>(string2.size() + 1,
                                                           -1));
    output.push_back(problem.Solve(matrix, std::string_view(string1),
                                   std::string_view(string2),
                                   std::string_view(string3)));
  }
  for (int i = 0; i < n; i++) {
    cout << output[i] << endl;
  }

  return 0;
}


Code 2:
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int min_val = 1000000000;
void SolveHelper(std::string& string1, std::string& string2,
                std::string& string3, int p1, int p2, int p3, int current) {
    if (p3 == string3.size()) {
      if (current < min_val) min_val = current;
      return;
    }

    if (p1 == string1.size()) {
      if (string2[p2] == string3[p3]) {
        SolveHelper(string1, string2, string3, p1, p2 + 1, p3 + 1, current);
      } else {
        SolveHelper(string1, string2, string3, p1, p2 + 1, p3 + 1, current + 1);
      }
      return;
    }
    if (p2 == string2.size()) {
      if (string1[p1] == string3[p3]) {
        SolveHelper(string1, string2, string3, p1 + 1, p2, p3 + 1, current);
      } else {
        SolveHelper(string1, string2, string3, p1 + 1, p2, p3 + 1, current + 1);
      }
      return;
    }

    if (string1[p1] == string3[p3]) {
      SolveHelper(string1, string2, string3, p1 + 1, p2, p3 + 1, current);
    }
    if (string2[p2] == string3[p3]) {
      SolveHelper(string1, string2, string3, p1, p2 + 1, p3 + 1, current);
    }
    SolveHelper(string1, string2, string3, p1 + 1, p2, p3 + 1, current + 1);
    SolveHelper(string1, string2, string3, p1, p2 + 1, p3 + 1, current + 1);
}

class Problem {
 public:
  Problem() = default;
  int Solve(std::string& string1, std::string& string2, std::string& string3) {
    min_val = 1000000000;
    SolveHelper(string1, string2, string3, 0, 0, 0, 0);
    return min_val;
  }
};

int main() {
  /*
     std::string line;
    std::vector<std::string> tokens;

    for (int i = 0; i < 3; i++) {
        std::getline(std::cin, line);
        std::istringstream iss(line);
        std::string token;

        while (std::getline(iss, token, ' ')) {
            tokens.push_back(token);
        }

        for (const std::string& tok : tokens) {
            std::cout << stoi(tok) << std::endl;
        }
        tokens.clear(); // Clear tokens for the next line
    }
    return 0;
  */
  int n;
  cin >> n;
  std::vector<int> output;
  for (int i = 0; i < n; i++) {
    std::string string1, string2, string3;
    Problem problem;
    cin >> string1;
    cin >> string2;
    cin >> string3;
    output.push_back(problem.Solve(string1, string2, string3));
  }
  for (int i = 0; i < n; i++) {
    cout << output[i] << endl;
  }

  return 0;
}


Answer: 1