Language: C++

#include <bits/stdc++.h>
using namespace std;

vector<long long> A;
long long n;
long long pairs = 0;

bool whatever(vector<long long> some) {
	for (long long i = 0; i < n; ++i) {
		int t = A[i];
		for (long long ii = 0; ii < n; ++ii) {
			if (i != ii && t == A[ii]) {
				++pairs;
				A.erase(i);
				A.erase(ii);
				return false;
			}
		}
	}
	return true;
}

int main () {
	long long ans = 0;

	scanf("%ld", &n);
	for (long long i = 0; i < n; ++i) {
		scanf("%ld", &A[i]);
	}

	while (!whatever(A)) {
	};

	ans = (pairs % 2 == 0) ? pairs / 2 : (pairs / 2) + 1;
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'bool whatever(std::vector<long long int>)':
a.cc:14:40: error: no matching function for call to 'std::vector<long long int>::erase(long long int&)'
   14 |                                 A.erase(i);
      |                                 ~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'long long int' to 'std::vector<long long int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
a.cc:15:40: error: no matching function for call to 'std::vector<long long int>::erase(long long int&)'
   15 |                                 A.erase(ii);
      |                                 ~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'long long int' to 'std::vector<long long int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided