Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<stack>

using namespace std;

const int Nmax = 3001;
int max(int a, int b,int c) return a>b&&a>c?a:(b>c?b:c);

vector< vector<int> > lcs(Nmax);

void lon_comm_seqs(string s,string t){
	int s_size=s.size(),t_size=t.size();
  	lcs[0][0] = (s[0]==t[0])?1:0;
  	for(int i=1;i<t_size;i++)	lcs[0][i] = (s[0]==t[i])?1:lcs[0][i-1];
  	for(int i=1;i<s_size;i++)	lcs[i][0] = (s[i]==t[0])?1:lcs[i-1][0];
  
  	for(int i=1;i<s_size();i++){
    	for(int j=1;j<t_size;j++){
        	if(s[i]==t[j]) lcs[i][j] = lcs[i-1][j-1]+1;
			else lcs[i][j] = lcs[i-1][j-1];
          	
          	lcs[i][j] = max(lcs[i][j],lcs[i-1][j],lcs[i][j-1]);
     }
     stack<char> ans;
     for(int i=s_size;i>=0;i--){
    	for(int j=t_size;j>0;j--){
        	if(s[i]==t[j] && lcs[i][j] = lcs[i-1][j-1]+1) { ans.push_back(s[i--]); }
			else if(lcs[i][j] == lcs[i-1][j]) {j++;i--;}
     }
     while(!ans.empty()) { cout << ans.top();ans.pop(); }
}
  
int main(){
	string s,t;cin>>s>>t;
  	lon_comm_seqs(s,t);
  	return 0;
}

Compiler output:
a.cc: In function 'int max(int, int, int)':
a.cc:9:29: error: named return values are no longer supported
    9 | int max(int a, int b,int c) return a>b&&a>c?a:(b>c?b:c);
      |                             ^~~~~~
a.cc:14:20: error: 's' was not declared in this scope
   14 |         int s_size=s.size(),t_size=t.size();
      |                    ^
a.cc:15:9: error: 'lcs' was not declared in this scope
   15 |         lcs[0][0] = (s[0]==t[0])?1:0;
      |         ^~~
a.cc:15:28: error: 't' was not declared in this scope
   15 |         lcs[0][0] = (s[0]==t[0])?1:0;
      |                            ^
a.cc:16:23: error: 't_size' was not declared in this scope; did you mean 's_size'?
   16 |         for(int i=1;i<t_size;i++)       lcs[0][i] = (s[0]==t[i])?1:lcs[0][i-1];
      |                       ^~~~~~
      |                       s_size
a.cc:19:29: error: 's_size' cannot be used as a function
   19 |         for(int i=1;i<s_size();i++){
      |                       ~~~~~~^~
a.cc:20:23: error: 't_size' was not declared in this scope; did you mean 's_size'?
   20 |         for(int j=1;j<t_size;j++){
      |                       ^~~~~~
      |                       s_size
a.cc:28:19: error: 't_size' was not declared in this scope; did you mean 's_size'?
   28 |         for(int j=t_size;j>0;j--){
      |                   ^~~~~~
      |                   s_size
a.cc:29:69: error: 'class std::stack<char>' has no member named 'push_back'
   29 |                 if(s[i]==t[j] && lcs[i][j] = lcs[i-1][j-1]+1) { ans.push_back(s[i--]); }
      |                                                                     ^~~~~~~~~
a.cc:35:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   35 | int main(){
      |         ^~
a.cc:35:9: note: remove parentheses to default-initialize a variable
   35 | int main(){
      |         ^~
      |         --
a.cc:35:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:35:11: error: a function-definition is not allowed here before '{' token
   35 | int main(){
      |           ^
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:19:36: note: to match this '{'
   19 |         for(int i=1;i<s_size();i++){
      |                                    ^
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:13:38: note: to match this '{'
   13 | void lon_comm_seqs(string s,string t){
      |                                      ^
a.cc:39:2: warning: no return statement in function returning non-void [-Wreturn-type]
   39 | }
      |  ^