Language: C++

/* -----KAUN_MEET--------*/

#include <bits/stdc++.h>
using namespace std;
void binary_rock()
{
    int n, m;
    string a, b;
    cin >> a >> b;
    int i, j, k, l;

    n = a.size();
    m = b.size();
    string ans[n][m];
    for (i = 0; i < n; i++)
        for (j = 0; j < m; j++)
            ans[i][j] = "";

    if (a[0] == b[0])
    {
        // ans[0][0] = 1;
        ans[0][0].PB(a[0]);
    }
    // i=0
    i=0;
    for(j=1;j<m;j++){
        if(ans[i][j-1].size()==1) ans[i][j]=ans[i][j-1];
        else{
            if(a[i]==b[j])
            {
                ans[i][j].PB(a[i]);
            }
            else{
                
            }
        }
    }
    j=0;
    for(i=1;i<n;i++){

        if(ans[i-1][j].size()==1) ans[i][j]=ans[i-1][j];
        else{
            if(a[i]==b[j]){
                ans[i][j].PB(a[i]);
            }
            else{

            }
        }
    }
    
    for (i = 1; i < n; i++)
    {
        for (j = 1; j < m; j++)
        {
            if (i == 0 || j == 0)
                continue;
            int upar = INT_MIN;
            int left = INT_MIN;

            int tedha = INT_MIN;

            if (i > 0)
                left = ans[i - 1][j].size();
            if (j > 0)
                upar = ans[i][j - 1].size();
            if (i > 0 && j > 0)
                tedha = ans[i - 1][j - 1].size();

            if (a[i] == b[j])
            {
                int ff = max(max(left, upar), tedha + 1);
                if (ff == left)
                {
                    ans[i][j] = ans[i - 1][j];
                }
                else if (ff == upar)
                {
                    ans[i][j] = ans[i][j - 1];
                }
                else
                {
                    ans[i][j] = ans[i - 1][j - 1];
                    ans[i][j].PB(a[i]);
                }
                // ans[i][j]=;
            }
            else
            {
                int ff = max(left, upar);
                if (ff == left)
                {
                    ans[i][j] = ans[i - 1][j];
                }
                else if (ff == upar)
                {
                    ans[i][j] = ans[i][j - 1];
                }

                // ans[i][j] = max(left, upar);
            }
        }
    }
    if (ans[n - 1][m - 1].size() >= 0)
        cout << ans[n - 1][m - 1] << endl;
    else
        cout << " " << endl;


        // for(i=0;i<n;i++){
        //     for(j=0;j<m;j++)
        //     cout<<i<<" "<<j<<" "<<ans[i][j]<<" ";
        //     cout<<endl;
        // }
}

signed main()
{
    fastio
        clock_t t1 = clock();

    int t = 1;
    // cin >> t;
    while (t--)
    {
        binary_rock();
    }

    clock_t t2 = clock();
    // cout << "Time-Taken: " << ((t2 - t1) / (double)CLOCKS_PER_SEC) << endl;
    // cout << CLOCKS_PER_SEC << endl;
    return 0;
}


Compiler output:
a.cc: In function 'void binary_rock()':
a.cc:22:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'PB'
   22 |         ans[0][0].PB(a[0]);
      |                   ^~
a.cc:31:27: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'PB'
   31 |                 ans[i][j].PB(a[i]);
      |                           ^~
a.cc:44:27: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'PB'
   44 |                 ans[i][j].PB(a[i]);
      |                           ^~
a.cc:84:31: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'PB'
   84 |                     ans[i][j].PB(a[i]);
      |                               ^~
a.cc: In function 'int main()':
a.cc:119:5: error: 'fastio' was not declared in this scope
  119 |     fastio
      |     ^~~~~~