Language: C++

#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define nl '\n'
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define dcit cin.sync_with_stdio(0);cin.tie(0);
#define frp(x, y) freopen(x, "r", stdin);freopen(y, "w", stdout);
typedef pair<int, int> pii;
typedef long long ll;

#ifdef LOCAL_PROJECT

#define gc getchar()
#define pc(x) putchar(x)

#endif
#ifndef LOCAL_PROJECT

#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)

#endif

template<typename T> void scani(T &x) {x = 0;register bool _=0;register T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printi(T n) {register bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);pc(10);}
string nextstring() { string r; register char c=gc;while(c==32||c==10) c = gc;while(!(c==32||c==10)) { r += c;c = gc; }return r; }
char nextgetchar(){ register char c = gc; while(c==32 || c==10) c = gc; return c;}
void prints(string k){ for (int i = 0; i < k.length(); i++)pc(k[i]); }

void scani() {}

template<typename First, typename ... Ints>
void scani(First &arg, Ints&... rest) { scani(arg);scani(rest...); }

int N, M, dp[3002][3002], maxi; string a, b, ans;


int main(){
    a = nextstring();
    b = nextstring();
    for (int i = 1; i <= a.size(); i++) {
        for (int j = 1; j <= b.size(); j++) {
            if(a[i-1]==b[j-1]) dp[i][j] = dp[i-1][j-1]+1;
            else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
    int i = a.size(), j = b.size();
    int index = dp[i][j];
    char lcs[index+1];
    lcs[index]='\0';
    while (i > 0 && j > 0) {
        if (a[i-1] == b[j-1]) {
            lcs[index-1] = a[i-1];
            i--; j--; index--;
        }
        else if (dp[i-1][j] > dp[i][j-1])i--;
        else j--;
    }

    printf("%s", lcs);
    return 

Compiler output:
a.cc: In function 'void scani(T&)':
a.cc:28:60: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   28 | template<typename T> void scani(T &x) {x = 0;register bool _=0;register T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
      |                                                            ^
a.cc:28:75: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   28 | template<typename T> void scani(T &x) {x = 0;register bool _=0;register T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
      |                                                                           ^
a.cc: In function 'void printi(T)':
a.cc:29:54: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   29 | template<typename T> void printi(T n) {register bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);pc(10);}
      |                                                      ^
a.cc: In function 'std::string nextstring()':
a.cc:30:47: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 | string nextstring() { string r; register char c=gc;while(c==32||c==10) c = gc;while(!(c==32||c==10)) { r += c;c = gc; }return r; }
      |                                               ^
a.cc: In function 'char nextgetchar()':
a.cc:31:35: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   31 | char nextgetchar(){ register char c = gc; while(c==32 || c==10) c = gc; return c;}
      |                                   ^
a.cc: In function 'int main()':
a.cc:65:11: error: expected primary-expression at end of input
   65 |     return
      |           ^
a.cc:65:11: error: expected ';' at end of input
   65 |     return
      |           ^
      |           ;
a.cc:65:11: error: expected '}' at end of input
a.cc:42:11: note: to match this '{'
   42 | int main(){
      |           ^