Language: C++

#include<iostream>
#include<string.h>
#include<algorithm>
bool fun(string a, string b){
  return a+b<b+a;
}

using name space std;
int main(){
  int n,l;
  cin>>n>>l;
  string a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n,fun);
  for(int i=0;i<n;i++){
    cout<<a[i];
  }
  return 0;
}

Compiler output:
a.cc:4:10: error: 'string' was not declared in this scope
    4 | bool fun(string a, string b){
      |          ^~~~~~
a.cc:4:10: 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:4:20: error: 'string' was not declared in this scope
    4 | bool fun(string a, string b){
      |                    ^~~~~~
a.cc:4:20: 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:4:28: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | bool fun(string a, string b){
      |                            ^
a.cc:8:7: error: expected nested-name-specifier before 'name'
    8 | using name space std;
      |       ^~~~
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   11 |   cin>>n>>l;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:3: error: 'string' was not declared in this scope
   12 |   string a[n];
      |   ^~~~~~
a.cc:12:3: 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:14:10: error: 'a' was not declared in this scope
   14 |     cin>>a[i];
      |          ^
a.cc:16:8: error: 'a' was not declared in this scope
   16 |   sort(a,a+n,fun);
      |        ^
a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   16 |   sort(a,a+n,fun);
      |   ^~~~
      |   std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:18:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   18 |     cout<<a[i];
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~