Problem p02631 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define int LL
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for (int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for (int i = (b); i >= (int)(e); --i)

#define sim template <class n
sim, class s > ostream &operator<<(ostream &p, pair<n, s> x) {
  return p << "<" << x.f << ", " << x.s << ">";
}
sim > auto operator<<(ostream &p, n y) ->
      typename enable_if<!is_same<n, string>::value,
                         decltype(y.begin(), p)>::type {
  int o = 0;
  p << "{";
  for (auto c : y) {
    if (o++)
      p << ", ";
    p << c;
  }
  return p << "}";
}
void dor() { cerr << endl; }
sim, class... s > void dor(n p, s... y) {
  cerr << p << " ";
  dor(y...);
}
sim, class s > void mini(n &p, s y) {
  if (p > y)
    p = y;
}
sim, class s > void maxi(n &p, s y) {
  if (p < y)
    p = y;
}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif

#define I(x) #x " =", (x), " "
#define A(a, i) #a "[" #i " =", i, "] =", a[i], " "

const int MXN = 1e5 + 5;
int in[MXN];

int32_t main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int x = 0;
  REP(i, n) {
    cin >> in[i];
    x ^= in[i];
  }
  REP(i, n) cout << (x ^ in[i]) << " ";
}

/*

4

1101
1110
1011
0111

*/

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define int LL
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for (int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for (int i = (b); i >= (int)(e); --i)

#define sim template <class n
sim, class s > ostream &operator<<(ostream &p, pair<n, s> x) {
  return p << "<" << x.f << ", " << x.s << ">";
}
sim > auto operator<<(ostream &p, n y) ->
      typename enable_if<!is_same<n, string>::value,
                         decltype(y.begin(), p)>::type {
  int o = 0;
  p << "{";
  for (auto c : y) {
    if (o++)
      p << ", ";
    p << c;
  }
  return p << "}";
}
void dor() { cerr << endl; }
sim, class... s > void dor(n p, s... y) {
  cerr << p << " ";
  dor(y...);
}
sim, class s > void mini(n &p, s y) {
  if (p > y)
    p = y;
}
sim, class s > void maxi(n &p, s y) {
  if (p < y)
    p = y;
}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif

#define I(x) #x " =", (x), " "
#define A(a, i) #a "[" #i " =", i, "] =", a[i], " "

const int MXN = 3e5 + 5;
int in[MXN];

int32_t main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int x = 0;
  REP(i, n) {
    cin >> in[i];
    x ^= in[i];
  }
  REP(i, n) cout << (x ^ in[i]) << " ";
}

/*

4

1101
1110
1011
0111

*/