Language: C++

bool compare(const std::string& _lhs, const std::string& _rhs)
{
	for (int i = 0; i < _lhs.size(); i++)
	{
		if (i >= _rhs.size() ) return false;
		if (_lhs[i] > _rhs[i]) return false;
		else if (_lhs[i] < _rhs[i]) return true;
	}

	return _lhs.size() <= _rhs.size();
}


int main()
{
	int N, L = -1;

	std::vector<std::string> inputVector;
	
	std::string first;
	std::getline(std::cin, first);
	std::istringstream ifst(first);

	ifst >> N >> L;

	for (int i = 0; i < N; i++)
	{
		std::string s;
		std::getline(std::cin, s);
		std::istringstream iss(s);
		inputVector.push_back(iss.str());
	}


	std::sort(inputVector.begin(), inputVector.end(), compare);

	std::ostringstream os;
	std::copy(inputVector.begin(), inputVector.end(), std::ostream_iterator<std::string>(os));
	std::string s = os.str();

	std::cout << s << std::endl;
  
	return 0;
}

Compiler output:
a.cc:1:25: error: 'string' in namespace 'std' does not name a type
    1 | bool compare(const std::string& _lhs, const std::string& _rhs)
      |                         ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | bool compare(const std::string& _lhs, const std::string& _rhs)
a.cc:1:50: error: 'string' in namespace 'std' does not name a type
    1 | bool compare(const std::string& _lhs, const std::string& _rhs)
      |                                                  ^~~~~~
a.cc:1:45: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | bool compare(const std::string& _lhs, const std::string& _rhs)
      |                                             ^~~
a.cc: In function 'bool compare(const int&, const int&)':
a.cc:3:34: error: request for member 'size' in '_lhs', which is of non-class type 'const int'
    3 |         for (int i = 0; i < _lhs.size(); i++)
      |                                  ^~~~
a.cc:5:31: error: request for member 'size' in '_rhs', which is of non-class type 'const int'
    5 |                 if (i >= _rhs.size() ) return false;
      |                               ^~~~
a.cc:6:25: error: invalid types 'const int[int]' for array subscript
    6 |                 if (_lhs[i] > _rhs[i]) return false;
      |                         ^
a.cc:6:35: error: invalid types 'const int[int]' for array subscript
    6 |                 if (_lhs[i] > _rhs[i]) return false;
      |                                   ^
a.cc:7:30: error: invalid types 'const int[int]' for array subscript
    7 |                 else if (_lhs[i] < _rhs[i]) return true;
      |                              ^
a.cc:7:40: error: invalid types 'const int[int]' for array subscript
    7 |                 else if (_lhs[i] < _rhs[i]) return true;
      |                                        ^
a.cc:10:21: error: request for member 'size' in '_lhs', which is of non-class type 'const int'
   10 |         return _lhs.size() <= _rhs.size();
      |                     ^~~~
a.cc:10:36: error: request for member 'size' in '_rhs', which is of non-class type 'const int'
   10 |         return _lhs.size() <= _rhs.size();
      |                                    ^~~~
a.cc: In function 'int main()':
a.cc:18:14: error: 'vector' is not a member of 'std'
   18 |         std::vector<std::string> inputVector;
      |              ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | bool compare(const std::string& _lhs, const std::string& _rhs)
a.cc:18:26: error: 'string' is not a member of 'std'
   18 |         std::vector<std::string> inputVector;
      |                          ^~~~~~
a.cc:18:26: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:18:34: error: 'inputVector' was not declared in this scope
   18 |         std::vector<std::string> inputVector;
      |                                  ^~~~~~~~~~~
a.cc:20:14: error: 'string' is not a member of 'std'
   20 |         std::string first;
      |              ^~~~~~
a.cc:20:14: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:21:14: error: 'getline' is not a member of 'std'
   21 |         std::getline(std::cin, first);
      |              ^~~~~~~
a.cc:21:27: error: 'cin' is not a member of 'std'
   21 |         std::getline(std::cin, first);
      |                           ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | bool compare(const std::string& _lhs, const std::string& _rhs)
a.cc:21:32: error: 'first' was not declared in this scope
   21 |         std::getline(std::cin, first);
      |                                ^~~~~
a.cc:22:14: error: 'istringstream' is not a member of 'std'
   22 |         std::istringstream ifst(first);
      |              ^~~~~~~~~~~~~
a.cc:1:1: note: 'std::istringstream' is defined in header '<sstream>'; this is probably fixable by adding '#include <sstream>'
  +++ |+#include <sstream>
    1 | bool compare(const std::string& _lhs, const std::string& _rhs)
a.cc:24:9: error: 'ifst' was not declared in this scope
   24 |         ifst >> N >> L;
      |         ^~~~
a.cc:28:22: error: 'string' is not a member of 'std'
   28 |                 std::string s;
      |                      ^~~~~~
a.cc:28:22: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:29:22: error: 'getline' is not a member of 'std'
   29 |                 std::getline(std::cin, s);
      |                      ^~~~~~~
a.cc:29:35: error: 'cin' is not a member of 'std'
   29 |                 std::getline(std::cin, s);
      |                                   ^~~
a.cc:29:35: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:40: error: 's' was not declared in this scope
   29 |                 std::getline(std::cin, s);
      |                                        ^
a.cc:30:22: error: 'istringstream' is not a member of 'std'
   30 |                 std::istringstream iss(s);
      |                      ^~~~~~~~~~~~~
a.cc:30:22: note: 'std::istringstream' is defined in header '<sstream>'; this is probably fixable by adding '#include <sstream>'
a.cc:31:39: error: 'iss' was not declared in this scope
   31 |                 inputVector.push_back(iss.str());
      |                                       ^~~
a.cc:35:14: error: 'sort' is not a member of 'std'
   35 |         std::sort(inputVector.begin(), inputVector.end(), compare);
      |              ^~~~
a.cc:37:14: error: 'ostringstream' is not a member of 'std'
   37 |         std::ostringstream os;
      |              ^~~~~~~~~~~~~
a.cc:37:14: note: 'std::ostringstream' is defined in header '<sstream>'; this is probably fixable by adding '#include <sstream>'
a.cc:38:14: error: 'copy' is not a member of 'std'
   38 |         std::copy(inputVector.begin(), inputVector.end(), std::ostream_iterator<std::string>(os));
      |              ^~~~
a.cc:38:64: error: 'ostream_iterator' is not a member of 'std'
   38 |         std::copy(inputVector.begin(), inputVector.end(), std::ostream_iterator<std::string>(os));
      |                                                                ^~~~~~~~~~~~~~~~
a.cc:1:1: note: 'std::ostream_iterator' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
  +++ |+#include <iterator>
    1 | bool compare(const std::string& _lhs, const std::string& _rhs)
a.cc:38:86: error: 'string' is not a member of 'std'
   38 |         std::copy(inputVector.begin(), inputVector.end(), std::ostream_iterator<std::string>(os));
      |                                                                                      ^~~~~~
a.cc:38:86: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:38:94: error: 'os' was not declared in this scope
   38 |         std::copy(inputVector.begin(), inputVector.end(), std::ostream_iterator<std::string>(os));
      |                                                                                              ^~
a.cc:39:14: error: 'string' is not a member of 'std'
   39 |         std::string s = os.str();
      |              ^~~~~~
a.cc:39:14: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:41:14: error: 'cout' is not a member of 'std'
   41 |         std::cout << s << std::endl;
      |              ^~~~
a.cc:41:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:41:22: error: 's' was not declared in this scope
   41 |         std::cout << s << std::endl;
      |                      ^
a.cc:41:32: error: 'endl' is not a member of 'std'
   41 |         std::cout << s << std::endl;
      |                                ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | bool compare(const std::string& _lhs, const std::string& _rhs)