Language: C++

//インクルード
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>

//型宣言
typedef long long ll;
typedef unsigned long long ull;
typedef std::string string;
typedef ull answerType;

//変数宣言
ll N;
ll M;
std::vector<string> s;
std::vector<string> t;
answerType answer;

//関数のプロトタイプ宣言
//入力の取得
void getInput();
//答えを求める
answerType calcAnswer();

//メイン関数
int main() {
	//入力の取得
	getInput();

	//答え
	answerType answer = calcAnswer();

	//答えの出力
	std::cout << answer << std::endl;

	//正常終了
	return EXIT_SUCCESS;
}

//入力の取得
void getInput() {
	std::cin >> N;

	for(ll i=0; i<N; ++i) {
		string temp;
		std::getline(std::cin, temp);
		s.push_back(temp);
	}

	std::cin >> M;

	for(ll i=0; i<M; ++i) {
		string temp;
		std::getline(std::cin, temp);
		t.push_back(temp);
	}
}

//答えを求める
answerType calcAnswer() {
	ull maxValue = 0;
	std::vector<string> word;
	for(ull i=0; i<s.size(); i++) {
		const string target = s[i];
		if(std::find(word.begin(), word.end(), target) != word.end()) {
			continue;
		}
		std::vector<string> tempAdd;
		std::vector<string> tempSub;
		copy_if(s.begin(), t.end(), back_inserter(tempAdd), [](string x, string target){return x == target;});
		copy_if(s.begin(), t.end(), back_inserter(tempSub), [](string x, string target){return x == target;});
		if(maxValue < tempAdd.size() - tempSub.size()) {
			maxValue = tempAdd.size() - tempSub.size();
		}
	}
	return maxValue;
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_OIter std::copy_if(_IIter, _IIter, _OIter, _Predicate) [with _IIter = __gnu_cxx::__normal_iterator<__cxx11::basic_string<char>*, vector<__cxx11::basic_string<char> > >; _OIter = back_insert_iterator<vector<__cxx11::basic_string<char> > >; _Predicate = calcAnswer()::<lambda(string, string)>]':
a.cc:73:10:   required from here
   73 |                 copy_if(s.begin(), t.end(), back_inserter(tempAdd), [](string x, string target){return x == target;});
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:658:19: error: no match for call to '(calcAnswer()::<lambda(string, string)>) (std::__cxx11::basic_string<char>&)'
  658 |         if (__pred(*__first))
      |             ~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:658:19: note: candidate: 'bool (*)(string, string)' {aka 'bool (*)(std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>)'} (conversion)
/usr/include/c++/14/bits/stl_algo.h:658:19: note:   candidate expects 3 arguments, 2 provided
a.cc:73:69: note: candidate: 'calcAnswer()::<lambda(string, string)>'
   73 |                 copy_if(s.begin(), t.end(), back_inserter(tempAdd), [](string x, string target){return x == target;});
      |                                                                     ^
a.cc:73:69: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_OIter std::copy_if(_IIter, _IIter, _OIter, _Predicate) [with _IIter = __gnu_cxx::__normal_iterator<__cxx11::basic_string<char>*, vector<__cxx11::basic_string<char> > >; _OIter = back_insert_iterator<vector<__cxx11::basic_string<char> > >; _Predicate = calcAnswer()::<lambda(string, string)>]':
a.cc:74:10:   required from here
   74 |                 copy_if(s.begin(), t.end(), back_inserter(tempSub), [](string x, string target){return x == target;});
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:658:19: error: no match for call to '(calcAnswer()::<lambda(string, string)>) (std::__cxx11::basic_string<char>&)'
  658 |         if (__pred(*__first))
      |             ~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:658:19: note: candidate: 'bool (*)(string, string)' {aka 'bool (*)(std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>)'} (conversion)
/usr/include/c++/14/bits/stl_algo.h:658:19: note:   candidate expects 3 arguments, 2 provided
a.cc:74:69: note: candidate: 'calcAnswer()::<lambda(string, string)>'
   74 |                 copy_if(s.begin(), t.end(), back_inserter(tempSub), [](string x, string target){return x == target;});
      |                                                                     ^
a.cc:74:69: note:   candidate expects 2 arguments, 1 provided