Language: C++

#include<bits/stdc++.h>
using namespace std;
#include<map>
//#define MEM(var,val) memset(var,(val),sizeof(var))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define nitro   ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define F first
#define S second
string s,d;
ll a,b;

vector<string>dp(3001);
string rec(ll i,ll j)
{
    if(i>=a||j>=b)return "";
     if(dp[i][j]!="")
    return dp[i][j];

   if(s[i]==d[j])
    {return dp[i][j]=s[i]+rec(i+1,j+1);}
    if(rec(i+1,j).length()>rec(i,j+1).length())
        dp[i][j]=rec(i+1,j);
    else dp[i][j]=rec(i,j+1);
    return dp[i][j];

}
int main()
{
   cin>>s>>d;
//   MEM(dp,"");
 
  for(int i=0;i<3001;i++)
    dp[i].resize(3001);
   MEM(dp,"");
    a=s.length();
    b=d.length();
    string ans=rec(0,0);
    cout<<ans;
}


Compiler output:
a.cc: In function 'std::string rec(long long int, long long int)':
a.cc:22:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |      if(dp[i][j]!="")
a.cc:23:19: error: could not convert '(& dp.std::vector<std::__cxx11::basic_string<char> >::operator[](((std::vector<std::__cxx11::basic_string<char> >::size_type)i)))->std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)j))' from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   23 |     return dp[i][j];
      |                   ^
      |                   |
      |                   __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:26:26: error: cannot convert 'std::__cxx11::basic_string<char>' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   26 |     {return dp[i][j]=s[i]+rec(i+1,j+1);}
a.cc:28:21: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   28 |         dp[i][j]=rec(i+1,j);
      |                  ~~~^~~~~~~
      |                     |
      |                     std::string {aka std::__cxx11::basic_string<char>}
a.cc:29:22: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   29 |     else dp[i][j]=rec(i,j+1);
      |                   ~~~^~~~~~~
      |                      |
      |                      std::string {aka std::__cxx11::basic_string<char>}
a.cc:30:19: error: could not convert '(& dp.std::vector<std::__cxx11::basic_string<char> >::operator[](((std::vector<std::__cxx11::basic_string<char> >::size_type)i)))->std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)j))' from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   30 |     return dp[i][j];
      |                   ^
      |                   |
      |                   __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc: In function 'int main()':
a.cc:40:4: error: 'MEM' was not declared in this scope
   40 |    MEM(dp,"");
      |    ^~~