Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
  uint32_t N, *a;
  cin >> N;

  a = new uint32_t[N];
  for (uint32_t i = 0; i < N; i++) cin >> a[i];
  uint64_t sum = 0;
  for (uint32_t i = 0; i < N; i++) {
    sum += a[i];
  }
  if (a[i] == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  if (N % 3 != 0) {
    cout << "No" << endl;
  } else {
    uint32_t A = a[0];
    uint32_t i = 1;
    while (a[i] == A && i < N) ++i;
    if (A == a[i]) {
      cout << "No" << endl;
      return 0;
    }
    uint32_t B = a[i];
    uint32_t C = A ^ B;
    uint32_t ANum = 0, BNum = 0, CNum = 0;
    for (i = 0; i < N; ++i) {
      if (a[i] == A) ANum++;
      if (a[i] == B) BNum++;
      if (a[i] == C) CNum++;
    }
    if (A == 0 || B == 0) {
      if (A == 0) {
        if (BNum == 2 * ANum)
          cout << "Yes" << endl;
        else
          cout << "No" << endl;
      } else {
        if (ANum == 2 * BNum)
          cout << "Yes" << endl;
        else
          cout << "No" << endl;
      }
    } else {
      if (ANum == BNum && ANum == CNum)
        cout << "Yes" << endl;
      else
        cout << "No" << endl;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'uint32_t' was not declared in this scope
   13 |   uint32_t N, *a;
      |   ^~~~~~~~
a.cc:9:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    8 | #include <vector>
  +++ |+#include <cstdint>
    9 | 
a.cc:14:10: error: 'N' was not declared in this scope
   14 |   cin >> N;
      |          ^
a.cc:16:3: error: 'a' was not declared in this scope
   16 |   a = new uint32_t[N];
      |   ^
a.cc:16:11: error: 'uint32_t' does not name a type
   16 |   a = new uint32_t[N];
      |           ^~~~~~~~
a.cc:16:11: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:17:16: error: expected ';' before 'i'
   17 |   for (uint32_t i = 0; i < N; i++) cin >> a[i];
      |                ^~
      |                ;
a.cc:17:24: error: 'i' was not declared in this scope
   17 |   for (uint32_t i = 0; i < N; i++) cin >> a[i];
      |                        ^
a.cc:18:3: error: 'uint64_t' was not declared in this scope
   18 |   uint64_t sum = 0;
      |   ^~~~~~~~
a.cc:18:3: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:19:16: error: expected ';' before 'i'
   19 |   for (uint32_t i = 0; i < N; i++) {
      |                ^~
      |                ;
a.cc:19:24: error: 'i' was not declared in this scope
   19 |   for (uint32_t i = 0; i < N; i++) {
      |                        ^
a.cc:20:5: error: 'sum' was not declared in this scope
   20 |     sum += a[i];
      |     ^~~
a.cc:22:9: error: 'i' was not declared in this scope
   22 |   if (a[i] == 0) {
      |         ^
a.cc:29:13: error: expected ';' before 'A'
   29 |     uint32_t A = a[0];
      |             ^~
      |             ;
a.cc:30:13: error: expected ';' before 'i'
   30 |     uint32_t i = 1;
      |             ^~
      |             ;
a.cc:31:14: error: 'i' was not declared in this scope
   31 |     while (a[i] == A && i < N) ++i;
      |              ^
a.cc:31:20: error: 'A' was not declared in this scope
   31 |     while (a[i] == A && i < N) ++i;
      |                    ^
a.cc:32:9: error: 'A' was not declared in this scope
   32 |     if (A == a[i]) {
      |         ^
a.cc:32:16: error: 'i' was not declared in this scope
   32 |     if (A == a[i]) {
      |                ^
a.cc:36:13: error: expected ';' before 'B'
   36 |     uint32_t B = a[i];
      |             ^~
      |             ;
a.cc:37:13: error: expected ';' before 'C'
   37 |     uint32_t C = A ^ B;
      |             ^~
      |             ;
a.cc:38:13: error: expected ';' before 'ANum'
   38 |     uint32_t ANum = 0, BNum = 0, CNum = 0;
      |             ^~~~~
      |             ;
a.cc:39:10: error: 'i' was not declared in this scope
   39 |     for (i = 0; i < N; ++i) {
      |          ^
a.cc:40:19: error: 'A' was not declared in this scope
   40 |       if (a[i] == A) ANum++;
      |                   ^
a.cc:40:22: error: 'ANum' was not declared in this scope
   40 |       if (a[i] == A) ANum++;
      |                      ^~~~
a.cc:41:19: error: 'B' was not declared in this scope
   41 |       if (a[i] == B) BNum++;
      |                   ^
a.cc:41:22: error: 'BNum' was not declared in this scope
   41 |       if (a[i] == B) BNum++;
      |                      ^~~~
a.cc:42:19: error: 'C' was not declared in this scope
   42 |       if (a[i] == C) CNum++;
      |                   ^
a.cc:42:22: error: 'CNum' was not declared in this scope
   42 |       if (a[i] == C) CNum++;
      |                      ^~~~
a.cc:44:9: error: 'A' was not declared in this scope
   44 |     if (A == 0 || B == 0) {
      |         ^
a.cc:44:19: error: 'B' was not declared in this scope
   44 |     if (A == 0 || B == 0) {
      |                   ^
a.cc:46:13: error: 'BNum' was not declared in this scope
   46 |         if (BNum == 2 * ANum)
      |             ^~~~
a.cc:46:25: error: 'ANum' was not declared in this scope
   46 |         if (BNum == 2 * ANum)
      |                         ^~~~
a.cc:51:13: error: 'ANum' was not declared in this scope
   51 |         if (ANum == 2 * BNum)
      |             ^~~~
a.cc:51:25: error: 'BNum' was not declared in this scope
   51 |         if (ANum == 2 * BNum)
      |                         ^~~~
a.cc:57:11: error: 'ANum' was not declared in this scope
   57 |       if (ANum == BNum && ANum == CNum)
      |           ^~~~
a.cc:57:19: error: 'BNum' was not declared in this scope
   57 |       if (ANum == BNum && ANum == CNum)
      |                   ^~~~
a.cc:57:35: error: 'CNum' was not declared in this scope
   57 |       if (ANum == BNum && ANum == CNum)
      |                                   ^~~~