alexjercan/bugnet huggingface dataset:
Problem p02631 (C++) — buggy submission, verdict: Runtime Error


// Problem : E - Red Scarf
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\\n", __FUNCTION__, __LINE__)
#define File(x)                                                                \\
  freopen(x ".in", "r", stdin);                                                \\
  freopen(x ".out", "w", stdout)
#define int long long

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;

inline int gi() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-')
      f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = x * 10 + c - '0', c = getchar();
  return f * x;
}

inline LL gl() {
  LL f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-')
      f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = x * 10 + c - '0', c = getchar();
  return f * x;
}

const int INF = 0x3f3f3f3f, N = 1000003, M = N << 1;

int n, m;
int a[N];

signed main() {
  // File("");
  n = gi();
  int sum = 0;
  for (int i = 1; i <= n; i += 1)
    a[i] = gi(), sum ^= a[i];
  for (int i = 1; i <= n; i += 1)
    cout << (sum ^ a[i]) << ' ';
  return 0;
}

Error: WA

Fixed submission:


// Problem : E - Red Scarf
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\\n", __FUNCTION__, __LINE__)
#define File(x)                                                                \\
  freopen(x ".in", "r", stdin);                                                \\
  freopen(x ".out", "w", stdout)
#define int long long

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;

inline int gi() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-')
      f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = x * 10 + c - '0', c = getchar();
  return f * x;
}

inline LL gl() {
  LL f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-')
      f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = x * 10 + c - '0', c = getchar();
  return f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 1;

int n, m;
int a[N];

signed main() {
  // File("");
  n = gi();
  int sum = 0;
  for (int i = 1; i <= n; i += 1)
    a[i] = gi(), sum ^= a[i];
  for (int i = 1; i <= n; i += 1)
    cout << (sum ^ a[i]) << ' ';
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int n;
  cin >> n;
  ll a[n], res = 0;

  REP(i, n) {
    cin >> a[i];
    res ^= a[i];
  }

  REP(i, n) {
    cout << (res ^ a[i]);
    if (i != n - 1)
      cout << " ";
  }
  cout << endl;

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int n;
  cin >> n;
  ll a[n];
  REP(i, n) cin >> a[i];

  ll res = 0;
  REP(i, n) {
    res = 0;
    REP(j, n - 1) { res ^= a[(i + j + 1) % n]; }
    cout << res;
    if (i != n - 1)
      cout << " ";
  }
  cout << endl;

  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int allxor = 0;
  rep(i, n) {
    cin >> a[i];
    allxor = allxor ^ a[i];
  }
  rep(i, n) {
    if (i == n - 1)
      cout << (allxor ^ a[i]) << endl;
    else
      cout << (allxor ^ a[i]) << " ";
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) { cin >> a[i]; }
  int ans;
  rep(i, n) {
    ans = 0;
    rep(j, n) {
      if (i == j)
        continue;
      ans = ans ^ a[j];
    }
    if (i == n - 1)
      cout << ans << endl;
    else
      cout << ans << " ";
  }

  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define f first
#define s second
const int MAXN = 200100;
const int MAXK = 19;
const int INF = 1e9;
const ll MOD = 998244353;

ll N, a, b, c, d, e, f;
ll A[MAXN];
ll B[MAXN];

int main() {
  cin >> N;
  ll T = 0;
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
    T ^= A[i];
  }
  for (int i = 1; i <= N; ++i)
    cout << (T ^ A[i]) << ' ';
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define f first
#define s second
const int MAXN = 301;
const int MAXK = 19;
const int INF = 1e9;
const ll MOD = 998244353;

ll N, a, b, c, d, e, f;
ll A[MAXN];
ll B[MAXN];

int main() {
  cin >> N;
  ll T = 0;
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
    T ^= A[i];
  }
  for (int i = 1; i <= N; ++i)
    cout << (T ^ A[i]) << ' ';
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

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

bool isprime(ll a) {
  ll count = 0;
  for (int i = 1; i * i <= a; i++) {
    if (a % i == 0)
      count += 2;
    if (i * i == a)
      count--;
  }

  if (count == 2)
    return true;
  else
    return false;
}

vector<ll> d(151, 0);
ll digitsum(ll n) {
  ll s = 0;
  while (n > 0) {
    s += n % 10;
    n = n / 10;
  }
  return s;
}
void solve() {

  ll n;
  cin >> n;
  ll a[n], ans[n], x = 0;

  for (ll i = 0; i < n; i++)
    cin >> a[i], x ^= a[i];

  for (int i = 0; i < n; i++) {
    ans[i] = x ^ a[i];
  }

  for (auto i : ans)
    cout << i << " ";
}

int main() {

  ios::sync_with_stdio(0);
  cin.tie(0);

  solve();

  return 0;
}


Error: TLE

Fixed submission:

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

bool isprime(ll a) {
  ll count = 0;
  for (int i = 1; i * i <= a; i++) {
    if (a % i == 0)
      count += 2;
    if (i * i == a)
      count--;
  }

  if (count == 2)
    return true;
  else
    return false;
}

vector<ll> d(151, 0);
ll digitsum(ll n) {
  ll s = 0;
  while (n > 0) {
    s += n % 10;
    n = n / 10;
  }
  return s;
}
void solve() {

  ll n;
  cin >> n;
  ll a[n], ans[n];

  for (ll i = 0; i < n; i++)
    cin >> a[i];

  ll x = 0;
  for (ll i = 1, k = n - 1; i < n; i++, k--) {
    x = a[1];
    if (k == 1)
      x = 0;
    for (int j = 2; j < n; j++) {
      if (j == k)
        continue;
      x = x ^ a[j];
    }

    ans[k] = a[0] ^ x;
  }
  ans[0] = x ^ a[1];

  for (auto i : ans)
    cout << i << " ";
}

int main() {

  ios::sync_with_stdio(0);
  cin.tie(0);

  solve();

  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

//  SMOKE SHISHA PLAY FIFA  //
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;

#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
#define pll pair<ll, ll>
#define MP make_pair
#define ff first
#define ss second
#define PB push_back
#define mod 1000000007
#define lp(i, start, end) for (ll i = start; i <= end; i++)
#define deb1(a) cout << #a << " = " << (a) << endl;
#define deb2(a, b)                                                             \\
  cout << #a << " = " << (a) << ", " << #b << " = " << (b) << endl;
#define deb3(a, b, c)                                                          \\
  cout << #a << " = " << (a) << ", " << #b << " = " << (b) << ", " << #c       \\
       << " = " << (c) << endl;

ll modu(ll a, ll b) {
  ll ans = 1;
  while (b > 0) {
    if (b & 1)
      ans = (ans * a) % mod;
    b /= 2;
    a = (a * a) % mod;
  }
  return ans;
}

int main() {
  fastio ll n;
  cin >> n;
  ll a[n];
  ll al;
  cin >> a[0] >> a[1];
  al = a[0] ^ a[1];
  lp(i, 2, n - 1) {
    cin >> a[i];
    al = al ^ a[i];
  }
  for (ll i = 0; i < n; i++)
    cout << (al ^ a[i]) << " ";
  cout << endl;

  return 0;
}


Error: -11

Fixed submission:

//  SMOKE SHISHA PLAY FIFA  //
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;

#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
#define pll pair<ll, ll>
#define MP make_pair
#define ff first
#define ss second
#define PB push_back
#define mod 1000000007
#define lp(i, start, end) for (ll i = start; i <= end; i++)
#define deb1(a) cout << #a << " = " << (a) << endl;
#define deb2(a, b)                                                             \\
  cout << #a << " = " << (a) << ", " << #b << " = " << (b) << endl;
#define deb3(a, b, c)                                                          \\
  cout << #a << " = " << (a) << ", " << #b << " = " << (b) << ", " << #c       \\
       << " = " << (c) << endl;

ll modu(ll a, ll b) {
  ll ans = 1;
  while (b > 0) {
    if (b & 1)
      ans = (ans * a) % mod;
    b /= 2;
    a = (a * a) % mod;
  }
  return ans;
}

int main() {
  fastio ll n;
  ll a[n];
  ll al;
  cin >> a[0] >> a[1];
  al = a[0] ^ a[1];
  lp(i, 2, n - 1) {
    cin >> a[i];
    al = al ^ a[i];
  }
  for (ll i = 0; i < n; i++)
    cout << (al ^ a[i]) << " ";
  cout << endl;

  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    ans ^= a[i];
  }
  for (int i = 0; i < N; i++) {
    long long aans = ans;
    aans ^= a[i];
    cout << aans << endl;
  }
}

Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
  for (int i = 0; i < N; i++) {
    long long ans = 0;
    for (int j = 0; j < N; j++) {
      if (j == i)
        continue;
      ans ^= a[j];
    }
    cout << ans << endl;
  }
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main(void) {
  int num;
  cin >> num;

  int array[num];
  int all = 0;

  for (int i = 0; i < num; i++) {
    cin >> array[i];
    all = all ^ array[i];
    //    cout << array[i] << '\\n';
  }

  for (int i = 0; i < num; i++) {
    cout << (all ^ array[i]) << ' ';
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  int num;
  cin >> num;

  int array[num];

  for (int i = 0; i < num; i++) {
    cin >> array[i];
    //    cout << array[i] << '\\n';
  }

  for (int i = 0; i < num; i++) {
    int ans = 0;
    for (int j = 0; j < num; j++) {
      if (i != j) {
        ans = ans ^ array[j];
      }
    }
    cout << ans << ' ';
  }

  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  int zor = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    zor = zor ^ arr[i];
  }
  for (int i = 0; i < n; i++) {
    int x = zor ^ arr[i];
    cout << x << " ";
  }
  cout << endl;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    int x = 0;
    for (int j = 0; j < n; j++) {
      if (j != i) {
        x = x ^ arr[j];
      }
    }
    cout << " " << x;
  }
  cout << endl;
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  long long N, p, t, j, f, ans;
  cin >> N;
  f = -1;
  vector<long long> a(N), b(1000);
  for (int i = 0; i < 999; i++) {
    b[i] = 0;
  }
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    p = a[i];
    j = 0;
    while (p > 0) {
      b[j] += p % 2;
      p /= 2;
      j++;
    }
  }
  for (int i = 0; i < 999; i++) {
    if (b[i] != 0) {
      f = i;
    }
  }
  if (f >= 0) {
    for (int i = 0; i < N; i++) {
      j = 0;
      ans = 0;
      t = 1;
      while (j <= f) {
        ans += t * ((a[i] % 2 + b[j]) % 2);
        a[i] /= 2;
        t *= 2;
        j++;
      }
      cout << ans;
      if (i != N - 1) {
        cout << " ";
      }
    }
    cout << endl;
  } else {
    for (int i = 0; i < N; i++) {
      cout << 0;
      if (i != N - 1) {
        cout << " ";
      }
    }
  }
}


Error: 0

Fixed submission:

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

int main() {
  long long N, p, t, j, f, ans;
  cin >> N;
  vector<long long> a(N), b(1000);
  for (int i = 0; i < 999; i++) {
    b[i] = 0;
  }
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    p = a[i];
    j = 0;
    while (p > 0) {
      b[j] += p % 2;
      p /= 2;
      j++;
    }
  }
  for (int i = 0; i < 999; i++) {
    if (b[i] != 0) {
      f = i;
    }
  }
  for (int i = 0; i < N; i++) {
    j = 0;
    ans = 0;
    t = 1;
    while (j <= f) {
      ans += t * ((a[i] % 2 + b[j]) % 2);
      a[i] /= 2;
      t *= 2;
      j++;
    }
    cout << ans;
    if (i != N - 1) {
      cout << " ";
    }
  }
  cout << endl;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int num[200005];
int main() {
  int n;
  scanf("%d", &n);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &num[i]);
    ans = ans ^ num[i];
  }
  for (int i = 1; i <= n; i++) {

    printf("%d ", ans ^ num[i]);
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int num[200005] = {0};
  for (int i = 1; i <= n; i++)
    scanf("%d", &num[i]);
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int j = 1; j <= n; j++) {
      if (j == i)
        continue;
      ans = ans ^ num[j];
    }
    printf("%d ", ans);
  }
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cstdio>
#include <vector>
#define ll long long
#define N 200005
#define inf 1000000000
using namespace std;
int n;
int a[N], c[N];
int q;
int main() {
  scanf("%d", &n);
  int sum = 0;
  for (int i = 1; i <= n; ++i)
    scanf("%d", &a[i]), sum ^= a[i];
  for (int i = 1; i <= n; ++i)
    printf("%d ", a[i] ^ sum);
  return 0;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <vector>
#define ll long long
#define N 100005
#define inf 1000000000
using namespace std;
int n;
int a[N], c[N];
int q;
int main() {
  scanf("%d", &n);
  int sum = 0;
  for (int i = 1; i <= n; ++i)
    scanf("%d", &a[i]), sum ^= a[i];
  for (int i = 1; i <= n; ++i)
    printf("%d ", a[i] ^ sum);
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string.h>
using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  int a[200001];
  long long res = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    res = res ^ a[i];
  }

  for (int i = 0; i < n; i++) {
    printf("%lld ", res ^ a[i]);
  }
  printf("\\n");
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string.h>
using namespace std;

static bool r = false;

void f(int s[], int num[], int n, int m, int res[], int p) {
  if (r) {
    return;
  }
  bool bres = true;
  for (int i = 0; i < n; i++) {
    int k;
    for (int j = 0; j < n; j++) {
      if (j != i) {
        if (i == 0 && j == 1) {
          k = s[j];
        } else if (j == 0) {
          k = s[j];
        } else {
          k = k ^ s[j];
        }
      }
    }
    if (k != num[i]) {
      bres = false;
      break;
    }
  }
  if (bres) {
    for (int i = 0; i < n; i++) {
      res[i] += p * s[i];
    }
    r = true;
  } else {
    if (m == n) {
      return;
    }
    int mm = m;
    m++;
    s[mm] = 0;
    f(s, num, n, m, res, p);
    s[mm] = 1;
    f(s, num, n, m, res, p);
  }
}

int main() {
  int n;
  scanf("%d", &n);
  int a[200001];
  int res[200001];
  memset(res, 0, sizeof(res));
  int nMaxIndex = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[nMaxIndex] < a[i]) {
      nMaxIndex = i;
    }
  }
  int p = 1;
  while (a[nMaxIndex]) {
    int nums[1000];
    int s[1000];
    for (int i = 0; i < n; i++) {
      nums[i] = a[i] % 2;
      a[i] /= 2;
      s[i] = 0;
    }
    r = false;
    f(s, nums, n, 0, res, p);
    p *= 2;
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", res[i]);
  }
  printf("\\n");
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
using ll = long long;
#define rep(i, a, b) for (ll i = a; i < ll(b); i++)
#define repr(i, a, b) for (ll i = a; i >= ll(b); i--)
#define endl "\\n"
#define ALL(x) x.begin(), x.end()
#define ALLR(x) x.rbegin(), x.rend()
using namespace std;

ll N;
int main() {
  scanf("%lld", &N);
  ll a[N];
  rep(i, 0, N) scanf("%lld", &a[i]);

  ll AllXor = a[0];
  rep(i, 1, N) AllXor ^= a[i];

  rep(i, 0, N) {
    printf("%lld", AllXor ^ a[i]);
    if (i != N - 1)
      printf(" ");
  }
  printf("\\n");
  return 0;
}


Error: -11

Fixed submission:

#include <cstdio>
using ll = long long;
#define rep(i, a, b) for (ll i = a; i < ll(b); i++)
#define repr(i, a, b) for (ll i = a; i >= ll(b); i--)
#define endl "\\n"
#define ALL(x) x.begin(), x.end()
#define ALLR(x) x.rbegin(), x.rend()
using namespace std;

ll N, a[1000000010];
int main() {
  scanf("%lld", &N);
  rep(i, 0, N) scanf("%lld", &a[i]);

  ll AllXor = a[0];
  rep(i, 1, N) AllXor ^= a[i];

  rep(i, 0, N) {
    printf("%lld", AllXor ^ a[i]);
    if (i != N - 1)
      printf(" ");
  }
  printf("\\n");
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define pb push_back
#define mp make_pair
#define N 2 * 10e5
#define precise cout << fixed << setprecision(10)
#pragma GCC optimize("O0")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("-ffloat-store")
#define rep(i, a, b) for (int i = a; i < b; i++)
#define min3(a, b, c) min(a, min(b, c))
#define nl cout << "\\n";
#define all(v) v.begin(), v.end()
#define F first
#define S second
typedef unsigned long long ll;
typedef vector<long long> vl;
typedef vector<pair<long, long>> vp;
void get(ll arr[], ll n) {
  for (ll i = 0; i < n; i++)
    cin >> arr[i];
}
ll gcd(ll a, ll b);
ll binpow(ll a, ll b);
void solve() {
  ll n;
  cin >> n;
  ll arr[n];
  get(arr, n);
  ll b[n];
  ll num = 0;
  rep(i, 0, n) num = num ^ arr[i];
  ll prev = 0;
  rep(i, 0, n) {
    b[i] = num ^ arr[i];
    // prev=prev^num;
  }
  rep(i, 0, n) cout << b[i] << " ";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll t;
  t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
  // cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC <<
  // "ms\\n";
}
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define pb push_back
#define mp make_pair
#define N 2 * 10e5
#define precise cout << fixed << setprecision(10)
#pragma GCC optimize("O0")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("-ffloat-store")
#define rep(i, a, b) for (int i = a; i < b; i++)
#define min3(a, b, c) min(a, min(b, c))
#define nl cout << "\\n";
#define all(v) v.begin(), v.end()
#define F first
#define S second
typedef unsigned long long ll;
typedef vector<long long> vl;
typedef vector<pair<long, long>> vp;
void get(ll arr[], ll n) {
  for (ll i = 0; i < n; i++)
    cin >> arr[i];
}
ll gcd(ll a, ll b);
ll binpow(ll a, ll b);
void solve() {
  ll n;
  cin >> n;
  ll arr[n];
  get(arr, n);
  ll b[n];
  rep(i, 0, n) {
    ll num = 0;
    rep(j, 0, n) {
      if (j != i)
        num = num ^ arr[j];
    }
    b[i] = num;
  }
  rep(i, 0, n) cout << b[i] << " ";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll t;
  t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
  // cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC <<
  // "ms\\n";
}
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vv = vector<vector<ll>>;
template <class _t> inline bool chmax(_t &a, _t b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class _t> inline bool chmin(_t &a, _t b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

const int INF = 2147483647;
const long long inf = 1ll << 60;
const long long mod = 1000000007;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};
int main() {
  int n;
  cin >> n;
  vector<int> a(n), ans(n);
  int bit;
  rep(i, n) {
    cin >> a[i];
    if (i == 0) {
      bit = a[i];
    } else {
      bit = bit ^ a[i];
    }
  }
  for (int i = 0; i < n; i++) {
    ans[i] = bit ^ a[i];
    cout << ans[i] << " ";
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vv = vector<vector<ll>>;
template <class _t> inline bool chmax(_t &a, _t b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class _t> inline bool chmin(_t &a, _t b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

const int INF = 2147483647;
const long long inf = 1ll << 60;
const long long mod = 1000000007;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int t = 0;
  for (int i = 0; i < n; i++) {
    int bit = -1;
    for (int j = 0; j < n; j++) {
      if (j == i)
        continue;
      if (bit == -1) {
        bit = a[j];
        continue;
      }
      bit = bit ^ a[j];
    }
    cout << bit << " ";
  }
  return 0;
}