Language: C++

#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char notes[110][10];
ll treasure[3030][3030];
ll dp[3030][3030][4];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n;
	cin >> n;
	vector<ll>a(n);
	vector<ll>card(1);
	card[0] = 1;
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	ll kaburi = 1;
	rep(i, n-2) {
		if (a[i] == a[i + 1]) {
			kaburi++;
		}
		else {
			if (kaburi % 2==0) {
				a.erase(a.begin() + i + 2);
				n--;
			}
			kaburi = 1;
		}
	}
	ll k = a.size();
	ll ans = 1;
	rep(i, k-1) {
		if (a[i] != a[i + 1])ans++;
	}
	cout << ans << endl;
	return 0;
}
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char notes[110][10];
ll treasure[3030][3030];
ll dp[3030][3030][4];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n;
	cin >> n;
	vector<ll>a(n);
	vector<ll>card(1);
	card[0] = 1;
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	ll kaburi = 1;
	rep(i, n-2) {
		if (a[i] == a[i + 1]) {
			kaburi++;
		}
		else {
			if (kaburi % 2==0) {
				a.erase(a.begin() + i + 2);
				n--;
			}
			kaburi = 1;
		}
	}
	ll k = a.size();
	ll ans = 1;
	rep(i, k-1) {
		if (a[i] != a[i + 1])ans++;
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:135:14: error: redefinition of 'const double pi'
  135 | const double pi = acos(-1.0);
      |              ^~
a.cc:30:14: note: 'const double pi' previously defined here
   30 | const double pi = acos(-1.0);
      |              ^~
a.cc:136:10: error: redefinition of 'const ll MOD'
  136 | const ll MOD = 1000000007;
      |          ^~~
a.cc:31:10: note: 'const ll MOD' previously defined here
   31 | const ll MOD = 1000000007;
      |          ^~~
a.cc:137:10: error: redefinition of 'const ll INF'
  137 | const ll INF = 1e18;
      |          ^~~
a.cc:32:10: note: 'const ll INF' previously defined here
   32 | const ll INF = 1e18;
      |          ^~~
a.cc:138:10: error: redefinition of 'const ll MAX_N'
  138 | const ll MAX_N = 201010;
      |          ^~~~~
a.cc:33:10: note: 'const ll MAX_N' previously defined here
   33 | const ll MAX_N = 201010;
      |          ^~~~~
a.cc:141:4: error: redefinition of 'll fac [201010]'
  141 | ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
      |    ^~~
a.cc:36:4: note: 'll fac [201010]' previously declared here
   36 | ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
      |    ^~~
a.cc:141:16: error: redefinition of 'll finv [201010]'
  141 | ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
      |                ^~~~
a.cc:36:16: note: 'll finv [201010]' previously declared here
   36 | ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
      |                ^~~~
a.cc:141:29: error: redefinition of 'll inv [201010]'
  141 | ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
      |                             ^~~
a.cc:36:29: note: 'll inv [201010]' previously declared here
   36 | ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
      |                             ^~~
a.cc:142:6: error: redefinition of 'void COMinit()'
  142 | void COMinit() {
      |      ^~~~~~~
a.cc:37:6: note: 'void COMinit()' previously defined here
   37 | void COMinit() {
      |      ^~~~~~~
a.cc:154:11: error: redefinition of 'long long int COM(ll, ll)'
  154 | long long COM(ll n, ll k) {
      |           ^~~
a.cc:49:11: note: 'long long int COM(ll, ll)' previously defined here
   49 | long long COM(ll n, ll k) {
      |           ^~~
a.cc:161:4: error: redefinition of 'll gcd(ll, ll)'
  161 | ll gcd(ll x, ll y) {
      |    ^~~
a.cc:56:4: note: 'll gcd(ll, ll)' previously defined here
   56 | ll gcd(ll x, ll y) {
      |    ^~~
a.cc:165:4: error: redefinition of 'll lcm(ll, ll)'
  165 | ll lcm(ll x, ll y) {
      |    ^~~
a.cc:60:4: note: 'll lcm(ll, ll)' previously defined here
   60 | ll lcm(ll x, ll y) {
      |    ^~~
a.cc:170:4: error: redefinition of 'll dx [4]'
  170 | ll dx[4] = { 0,0,-1,1 };
      |    ^~
a.cc:65:4: note: 'll dx [4]' previously defined here
   65 | ll dx[4] = { 0,0,-1,1 };
      |    ^~
a.cc:171:4: error: redefinition of 'll dy [4]'
  171 | ll dy[4] = { -1,1,0,0 };
      |    ^~
a.cc:66:4: note: 'll dy [4]' previously defined here
   66 | ll dy[4] = { -1,1,0,0 };
      |    ^~
a.cc:172:6: error: redefinition of 'char notes [110][10]'
  172 | char notes[110][10];
      |      ^~~~~
a.cc:67:6: note: 'char notes [110][10]' previously declared here
   67 | char notes[110][10];
      |      ^~~~~
a.cc:173:4: error: redefinition of 'll treasure [3030][3030]'
  173 | ll treasure[3030][3030];
      |    ^~~~~~~~
a.cc:68:4: note: 'll treasure [3030][3030]' previously declared here
   68 | ll treasure[3030][3030];
      |    ^~~~~~~~
a.cc:174:4: error: redefinition of 'll dp [3030][3030][4]'
  174 | ll dp[3030][3030][4];
      |    ^~
a.cc:69:4: note: 'll dp [3030][3030][4]' previously declared here
   69 | ll dp[3030][3030][4];
      |    ^~
a.cc:180:5: error: redefinition of 'int main()'
  180 | int main() {
      |     ^~~~
a.cc:75:5: note: 'int main()' previously defined here
   75 | int main() {
      |     ^~~~