Language: C++

#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;
const int mod998 = 998244353;

int N, M, X, res;
vector<int>v[100000];

int main() {
	cin >> N >> M;
	for (int i = 0; i < N; ++i) {
		cin >> X;
		v[X % M].push_back(X);
	}
	res += v[0].size() / 2;
	for (int i = 1; i < M; ++i) {
		if (i + i == M) {
			res += v[i].size() / 2;
		}
		else if (v[i].size() > v[M - i].size() || (v[i].size() == v[M - i].size() && i <= M - i)) {
			res += v[M - i].size();
			map<int, int>mp;
			for (int j : v[i]) {
				++mp[j];
			}
			unsigned int c = 0;
			for (auto it = mp.begin(); it != mp.end(); ++it) {
				c += it->second / 2;
			}
			res += min((v[i].size() - v[M - i].size()) / 2, c);
		}
	}
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:35: error: no matching function for call to 'min(std::vector<int>::size_type, unsigned int&)'
   38 |                         res += min((v[i].size() - v[M - i].size()) / 2, c);
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:38:35: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int')
   38 |                         res += min((v[i].size() - v[M - i].size()) / 2, c);
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:38:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   38 |                         res += min((v[i].size() - v[M - i].size()) / 2, c);
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~