Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespase std;
static const int N = 1000;

int lcs(string X, string Y) {
    int c[N + 1][N + 1];
    int m = X.size();
    int n = Y.size();
    int maxl = 0;
    X = ' ' + X;
    Y = ' ' + Y;
    for ( int i = 0; i <= m; i++ ) c[i][0] = 0;
    for ( int j = 1; j <= n; j++ ) c[0][j] = 0;
    
    for ( int i = 1; i <= m; i++ ){
        for ( int j = 1; j <= n; j++ ){
            if ( X[i] == Y[j] ){
                c[i][j] = c[i - 1][j - 1] + 1;
            } else {
                c[i][j] = max(c[i - 1][j], c[i][j - 1]);
            }
            maxl = max(maxl, c[i][j]);
        }
    }
    
    return maxl;
}

int main() {
    string s1, s2;
    int n; cin >> n;
    
    for ( i = 0; i < n; i++ ){
        cin >> s1 >> s2;
        cout << lcs(s1, s2) << sndl;
    }
    return 0;
}

Compiler output:
a.cc:4:7: error: expected nested-name-specifier before 'namespase'
    4 | using namespase std;
      |       ^~~~~~~~~
a.cc:7:9: error: 'string' was not declared in this scope
    7 | int lcs(string X, string Y) {
      |         ^~~~~~
a.cc:7:9: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:7:19: error: 'string' was not declared in this scope
    7 | int lcs(string X, string Y) {
      |                   ^~~~~~
a.cc:7:19: note: suggested alternatives:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:7:27: error: expression list treated as compound expression in initializer [-fpermissive]
    7 | int lcs(string X, string Y) {
      |                           ^
a.cc: In function 'int main()':
a.cc:32:5: error: 'string' was not declared in this scope
   32 |     string s1, s2;
      |     ^~~~~~
a.cc:32:5: note: suggested alternatives:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:33:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   33 |     int n; cin >> n;
      |            ^~~
      |            std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:35:11: error: 'i' was not declared in this scope
   35 |     for ( i = 0; i < n; i++ ){
      |           ^
a.cc:36:16: error: 's1' was not declared in this scope
   36 |         cin >> s1 >> s2;
      |                ^~
a.cc:36:22: error: 's2' was not declared in this scope
   36 |         cin >> s1 >> s2;
      |                      ^~
a.cc:37:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   37 |         cout << lcs(s1, s2) << sndl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:37:20: error: 'lcs' cannot be used as a function
   37 |         cout << lcs(s1, s2) << sndl;
      |                 ~~~^~~~~~~~
a.cc:37:32: error: 'sndl' was not declared in this scope
   37 |         cout << lcs(s1, s2) << sndl;
      |                                ^~~~