Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
 
vector<string,int> v;

int main(){
	
	int n,m;cin>>n>>m;
	rep(i,n)
	{
		string s;cin >> s;
		v.push_back(make_pair(s,1));
	}
	
	rep(i,m)
	{
		string s;cin >> s;
		v.push_back(make_pair(s,-1));
	}
	
	sort(v.begin(),v.end());
	int anss = 0;
	int ans = v[0].second;
	FOR(i,1,n+m-1)
	{
		if(v[i].firts == v[i-1].first) ans +=v[i].second;
		else ans = v[i].second;
		anss = max(anss,ans);
	}
	
	cout << anss << endl;
}

//cout << ans << endl;

Compiler output:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<std::__cxx11::basic_string<char>, int>':
/usr/include/c++/14/bits/stl_vector.h:428:11:   required from 'class std::vector<std::__cxx11::basic_string<char>, int>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:9:20:   required from here
    9 | vector<string,int> v;
      |                    ^
/usr/include/c++/14/bits/stl_vector.h:87:28: error: 'int' is not a class, struct, or union type
   87 |         rebind<_Tp>::other _Tp_alloc_type;
      |                            ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:89:9: error: 'int' is not a class, struct, or union type
   89 |         pointer;
      |         ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<std::__cxx11::basic_string<char>, int>':
a.cc:9:20:   required from here
    9 | vector<string,int> v;
      |                    ^
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<std::__cxx11::basic_string<char>, int>::_Base'
  518 |       using _Base::_M_allocate;
      |                    ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<std::__cxx11::basic_string<char>, int>::_Base'
  519 |       using _Base::_M_deallocate;
      |                    ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<std::__cxx11::basic_string<char>, int>::_Base'
  521 |       using _Base::_M_get_Tp_allocator;
      |                    ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = std::__cxx11::basic_string<char>; _Alloc = int]':
a.cc:9:20:   required from here
    9 | vector<string,int> v;
      |                    ^
/usr/include/c++/14/bits/stl_vector.h:136:24: error: 'int' is not a class, struct, or union type
  136 |         _Vector_impl() _GLIBCXX_NOEXCEPT_IF(
      |                        ^~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:17:28: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char>, int>::push_back(std::pair<std::__cxx11::basic_string<char>, int>)'
   17 |                 v.push_back(make_pair(s,1));
      |                 ~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = int; value_type = std::__cxx11::basic_string<char>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<std::__cxx11::basic_string<char>, int>' to 'const std::vector<std::__cxx11::basic_string<char>, int>::value_type&' {aka 'const std::__cxx11::basic_string<char>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = int; value_type = std::__cxx11::basic_string<char>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<std::__cxx11::basic_string<char>, int>' to 'std::vector<std::__cxx11::basic_string<char>, int>::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:23:28: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char>, int>::push_back(std::pair<std::__cxx11::basic_string<char>, int>)'
   23 |                 v.push_back(make_pair(s,-1));
      |                 ~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = int; value_type = std::__cxx11::basic_string<char>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<std::__cxx11::basic_string<char>, int>' to 'const std::vector<std::__cxx11::basic_string<char>, int>::value_type&' {aka 'const std::__cxx11::basic_string<char>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = int; value_type = std::__cxx11::basic_string<char>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<std::__cxx11::basic_string<char>, int>' to 'std::vector<std::__cxx11::basic_string<char>, int>::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:26:16: error: 'class std::vector<std::__cxx11::basic_string<char>, int>' has no member named 'begin'
   26 |         sort(v.begin(),v.end());
      |                ^~~~~
a.cc:26:26: error: 'class std::vector<std::__cxx11::basic_string<char>, int>' has no member named 'end'
   26 |         sort(v.begin(),v.end());
      |                          ^~~
a.cc:28:20: error: no match for 'operator[]' (operand types are 'std::vector<std::__cxx11::basic_string<char>, int>' and 'int')
   28 |         int ans = v[0].second;
      |                    ^
a.cc:31:21: error: no match for 'operator[]' (operand types are 'std::vector<std::__cxx11::basic_string<char>, int>' and 'int')
   31 |                 if(v[i].firts == v[i-1].first) ans +=v[i].second;
      |                     ^
a.cc:31:35: error: no match for 'operator[]' (operand types are 'std::vector<std::__cxx11::basic_string<char>, int>' and 'int')
   31 |                 if(v[i].firts == v[i-1].first) ans +=v[i].second;
      |                                   ^
a.cc:31:55: error: no match for 'operator[]' (operand types are 'std::vector<std::__cxx11::basic_string<char>, int>' and 'int')
   31 |                 if(v[i].firts == v[i-1].first) ans +=v[i].second;
      |                                                       ^
a.cc:32:29: error: no match for 'operator[]' (operand types are 'std::vector<std::__cxx11::basic_string<char>, int>' and 'int')
   32 |                 else ans = v[i].second;
      |                             ^
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = std::__cxx11::basic_string<char>; _Alloc = int]':
/usr/include/c++/14/bits/stl_vector.h:314:7:   required from here
  314 |       _Vector_base() = default;
      |       ^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:141:26: error: 'int' is not a class, struct, or union type
  141 |         : _Tp_alloc_type()
      |                          ^