Problem p03607 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x)                                                              \
  T x;                                                                         \
  cin >> x;
#define CINS(T, x, N)                                                          \
  vector<T> x(N);                                                              \
  for (int i = 0; i < (N); i++) {                                              \
    cin >> x[i];                                                               \
  }
#define SHOW(x)                                                                \
  for (int i = 0; i < x.size(); i++) {                                         \
    cout << x[i] << " ";                                                       \
  }                                                                            \
  cout << "\n";
#define SHOW2(x)                                                               \
  for (int j = 0; j < x.size(); j++) {                                         \
    SHOW(x[j]);                                                                \
  }                                                                            \
  cout << "\n";

int main() {

  vector<int> A(1e9 + 1, 0);
  CIN(int, N);

  int ans = 0;
  for (int i = 0; i < N; i++) {
    int temp;
    cin >> temp;
    if (A[temp] == 0) {
      A[temp] = 1;
      ans++;
    } else {
      A[temp] = 0;
      ans--;
    }
  }

  cout << ans << "\n";
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x)                                                              \
  T x;                                                                         \
  cin >> x;
#define CINS(T, x, N)                                                          \
  vector<T> x(N);                                                              \
  for (int i = 0; i < (N); i++) {                                              \
    cin >> x[i];                                                               \
  }
#define SHOW(x)                                                                \
  for (int i = 0; i < x.size(); i++) {                                         \
    cout << x[i] << " ";                                                       \
  }                                                                            \
  cout << "\n";
#define SHOW2(x)                                                               \
  for (int j = 0; j < x.size(); j++) {                                         \
    SHOW(x[j]);                                                                \
  }                                                                            \
  cout << "\n";

int main() {

  map<int, int> A;
  CIN(int, N);

  int ans = 0;
  for (int i = 0; i < N; i++) {
    int temp;
    cin >> temp;
    if (A[temp] == 0) {
      A[temp] = 1;
      ans++;
    } else {
      A[temp] = 0;
      ans--;
    }
  }

  cout << ans << "\n";
  return 0;
}