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

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll, ll>
#define mii map<pii, ll>
#define all(a) (a).begin(), (a).end()
#define fi first
#define si second
#define sz(x) (ll) x.size()
#define endl '\\n'
#define mod 1000000007
#define mset(m, v) memset(m, v, sizeof(m))
using namespace std;
ll power(ll a, ll b, ll modi) {
  a %= modi;
  ll res = 1;
  while (b) {
    if (b % 2) {
      res = (res * a) % modi;
    }
    b /= 2;
    a = (a * a) % modi;
  }
  return res;
}
// ll a[100001];
ll a[200001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  // cin>>t;
  while (t--) {
    ll n;
    cin >> n;
    for (ll i = 0; i < n; i++)
      cin >> a[i];
    ll x = 0;
    for (ll i = 0; i < n; i++)
      x ^= a[i];
    for (ll i = 0; i < n; i++)
      a[i] = a[i] ^ x;
    for (ll i = 0; i < n; i++)
      cout << a[i] << " ";
  }
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll, ll>
#define mii map<pii, ll>
#define all(a) (a).begin(), (a).end()
#define fi first
#define si second
#define sz(x) (ll) x.size()
#define endl '\\n'
#define mod 1000000007
#define mset(m, v) memset(m, v, sizeof(m))
using namespace std;
ll power(ll a, ll b, ll modi) {
  a %= modi;
  ll res = 1;
  while (b) {
    if (b % 2) {
      res = (res * a) % modi;
    }
    b /= 2;
    a = (a * a) % modi;
  }
  return res;
}
// ll a[100001];
ll a[100001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  // cin>>t;
  while (t--) {
    ll n;
    cin >> n;
    for (ll i = 0; i < n; i++)
      cin >> a[i];
    ll x = 0;
    for (ll i = 0; i < n; i++)
      x ^= a[i];
    for (ll i = 0; i < n; i++)
      a[i] = a[i] ^ x;
    for (ll i = 0; i < n; i++)
      cout << a[i] << " ";
  }
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
#define IOS                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define ull unsigned long long
#define int long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define endl "\\n"
#define Max(x, y, z) max(x, max(y, z))
#define Min(x, y, z) min(x, min(y, z))
#define MAX 1e18
#define PI 3.14159265
const int mod = 1e9 + 7;

int power(int x, int y) {
  int res = 1;

  while (y > 0) {

    if (y & 1)
      res = (long long)(res * x);

    y = y >> 1;

    if (x <= 100000000)
      x = (long long)(x * x);

    // cout<<x<<'\\n';
  }
  return res;
}

void solve() {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {

    ans = ans ^ v[i];
  }

  for (int i = 0; i < n; i++) {

    v[i] = ans ^ v[i];
    cout << v[i] << " ";
  }

  return;
}

int32_t main() {
  IOS;
  solve();
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
#define IOS                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define ull unsigned long long
#define int long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define endl "\\n"
#define Max(x, y, z) max(x, max(y, z))
#define Min(x, y, z) min(x, min(y, z))
#define MAX 1e18
#define PI 3.14159265
const int mod = 1e9 + 7;

int power(int x, int y) {
  int res = 1;

  while (y > 0) {

    if (y & 1)
      res = (long long)(res * x);

    y = y >> 1;

    if (x <= 100000000)
      x = (long long)(x * x);

    // cout<<x<<'\\n';
  }
  return res;
}

void solve() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans ^= a[i];
  }

  int b[n];

  for (int i = 1; i <= n; i++) {

    b[i] = ans ^ a[i];
  }

  for (int i = 1; i <= n; i++) {
    cout << b[i] << " ";
  }

  return;
}

int32_t main() {
  IOS;
  solve();
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;

  int i;

  vector<int> a(n);

  long long ans;

  cin >> a[0];
  ans = a[0];

  for (i = 1; i < n; i++) {
    cin >> a[i];
    ans = ans ^ a[i];
  }

  int j;

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;

  int i;

  vector<int> a(n);

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

  long long ans;

  int j;

  for (i = 0; i < n; i++) {
    if (i == 0) {
      ans = a[1];
      for (j = 2; j < n; j++) {
        ans = ans ^ a[j];
      }
    } else {
      ans = a[0];
      for (j = 1; j < n; j++) {
        if (i != j) {
          ans = ans ^ a[j];
        }
      }
    }

    cout << ans << " ";
  }
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define endl "\\n"
#define ll long long
int main() {
  ll n;
  cin >> n;
  ll arr[n];
  ll o = 0;
  for (ll i = 0; i < n; i++) {
    cin >> arr[i];
    o ^= arr[i];
  }
  for (ll i = 0; i < n; i++) {
    cout << (arr[i] ^ o) << " ";
  }
  cout << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define endl "\\n"
#define ll long long
int main() {
  ll n;
  cin >> n;
  ll arr[n];
  for (ll i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (ll i = 0; i < n; i++) {
    ll ans = 0;
    for (ll j = 0; j < n; j++) {
      if (j == i) {
        continue;
      } else {
        ans ^= arr[j];
      }
    }
    cout << ans << " ";
  }
  cout << endl;
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using int64 = long long;

struct aaa {
  aaa() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} aaa;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int all = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    all ^= a[i];
  }
  for (int i = 0; i < n; i++) {
    if (i != 0)
      cout << " ";
    cout << (all ^ a[i]);
  }
  cout << endl;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using int64 = long long;

struct aaa {
  aaa() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} aaa;

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

// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimze("02")
using namespace std;
using ll = long long;
const ll maxn = 2e5 + 5, inf = 1e18 + 18;
ll n, ans, a[maxn];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ans = ans ^ a[i];
  }
  for (int i = 0; i < n; i++) {
    ans = ans ^ a[i];
    cout << ans << endl;
    ans = ans ^ a[i];
  }
}


Error: WA

Fixed submission:

// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimze("02")
using namespace std;
using ll = long long;
const ll maxn = 1e5 + 5, inf = 1e18 + 18;
ll n, ans, a[maxn];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ans = ans ^ a[i];
  }
  for (int i = 0; i < n; i++) {
    ans = ans ^ a[i];
    cout << ans << endl;
    ans = ans ^ a[i];
  }
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int N;
  cin >> N;

  vector<int> Nums(N);
  rep(i, N) cin >> Nums.at(i);

  int all = 0;
  rep(i, N) all ^= Nums.at(i);
  rep(i, N) Nums.at(i) ^= all;

  rep(i, N) cout << Nums.at(i) << endl;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

int ruijo2(int i) {
  int ans = 1;
  for (int j = 0; j < i; j++)
    ans *= 2;

  return ans;
} // OK

void int_bit(int num, bitset<19> &bit) {
  for (int i = 0; num != 0; i++) {
    if (num % 2) {
      bit.set(i);
    }
    num /= 2;
  }
} // OK

int bit_int(bitset<19> &bit) {
  int conv = 0;

  for (int i = 0; i < 19; i++) {
    if (bit.test(i)) {
      conv += ruijo2(i);
    }
  }
  return conv;
} // OK

bitset<19> exor(vector<bitset<19>> const &bits, int N) {
  bitset<19> ans;
  ans.reset();

  rep(j, 19) {
    int count = 0;
    rep(i, (int)bits.size()) {
      if ((i != N) && (bits.at(i).test(j))) {
        count++;
      }
    }
    if (count % 2) {
      ans.set(j);
      // cout << ans << endl;
    }
  }
  // cout << endl;
  return ans;
} // OK

int main() {
  int N;
  cin >> N;

  vector<int> Nums(N);
  rep(i, N) cin >> Nums.at(i);

  vector<bitset<19>> bits(N);

  rep(i, N) { int_bit(Nums.at(i), bits.at(i)); } // OK

  vector<bitset<19>> ans(N);
  rep(i, N) { ans.at(i).reset(); } // OK

  rep(i, N) { ans.at(i) = exor(bits, i); } // OK

  rep(i, N) {
    cout << bit_int(ans.at(i));
    if (i != N - 1) {
      cout << " ";
    }
  }
  cout << endl;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>

namespace ABC171 {
class E {
public:
  E() = default;
  ~E() = default;

  void Run() {
    int N = {};
    std::cin >> N;

    static int X[200001] = {};
    static int A[200001] = {};
    int sum = {};
    for (int i = 0; i < N; ++i) {
      std::cin >> A[i];
      sum ^= A[i];
    }

    for (int i = 0; i < N; ++i) {
      int answer = sum ^ A[i];
      std::cout << answer << std::endl;
    }
  }
};

} // namespace ABC171

int main() {

  ABC171::E prob;
  prob.Run();

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
#include <string>

namespace ABC171 {
class E {
public:
  E() = default;
  ~E() = default;

  void Run() {
    int N = {};
    std::cin >> N;

    static int X[200001] = {};
    static int A[200001] = {};
    for (int i = 0; i < N; ++i) {
      std::cin >> A[i];
      for (int j = 0; j < N; ++j) {
        if (i != j) {
          X[j] ^= A[i];
        }
      }
    }

    for (int i = 0; i < N; ++i) {
      std::cout << X[i] << std::endl;
    }
  }
};

} // namespace ABC171

int main() {

  ABC171::E prob;
  prob.Run();

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

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

void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}

void solve() {
  int n;
  cin >> n;
  long long int arr[n];
  for (int i = 0; i < n; i++)
    cin >> arr[i];

  long long int tot = 0;
  for (int i = 0; i < n; i++)
    tot = tot ^ arr[i];

  for (int i = 0; i < n; i++) {
    int res = arr[i] ^ tot;
    cout << res << " ";
  }
  cout << endl;
}

int main() {
  fast();
  solve();
  return 0;
}

Error: TLE

Fixed submission:

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

void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}

void solve() {
  int n;
  cin >> n;
  long long int arr[n];
  for (int i = 0; i < n; i++)
    cin >> arr[i];

  for (int i = 0; i < n; i++) {
    int res = 0;
    for (int j = 0; j < n; j++) {
      if (i != j)
        res = res ^ arr[j];
    }
    cout << res << " ";
  }
  cout << endl;
}

int main() {
  fast();
  solve();
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  ll sum = 0;
  rep(i, n) {
    cin >> a[i];
    sum = sum ^ a[i];
  }
  rep(i, n) {
    int ans = 0;
    ans = sum ^ a[i];
    cout << ans << endl;
  }
}

Error: TLE

Fixed submission:

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

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

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef map<ll, ll> ml;
#define modulo 1000000007
#define maxN 100001
#define PI 3.14159265
#define fast                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);

void solve() {
  int n;
  cin >> n;
  vector<int> arr(n), ans;
  int s = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    s = s ^ arr[i];
  }
  for (int i = 0; i < n; i++) {
    ans.emplace_back(s ^ arr[i]);
  }
  for (int i : ans)
    cout << i << " ";
  cout << endl;
}

int main() {

  fast;
  int t;
  // cin>>t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef map<ll, ll> ml;
#define modulo 1000000007
#define maxN 100001
#define PI 3.14159265
#define fast                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);

void solve() {
  int n;
  cin >> n;
  vector<int> arr(n), ans;
  for (int i = 0; i < n; i++)
    cin >> arr[i];
  int num = arr[1];
  for (int i = 2; i < n; i++) {
    num = num ^ arr[i];
  }
  ans.emplace_back(num);
  for (int i = 1; i < n - 1; i++) {
    int num = arr[0];
    for (int j = 1; j < n; j++) {
      if (j != i) {
        num = num ^ arr[j];
      }
    }
    ans.emplace_back(num);
  }
  num = arr[n - 2];
  for (int i = 0; i < n - 2; i++) {
    num = num ^ arr[i];
  }
  ans.push_back(num);
  for (int i : ans)
    cout << i << " ";
  cout << endl;
}

int main() {

  fast;
  int t;
  // cin>>t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MOD = 1000000007;
const ll INF = 1LL << 60;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<ll> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  ll bits = 0;
  for (int j = 0; j < n; j++) {
    bits = bits ^ v[j];
  }
  for (int i = 0; i < n; i++) {
    ll pin = v[i];
    bits = bits ^ v[i];
    cout << bits << " ";
    bits = bits ^ v[i];
  }
  cout << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MOD = 1000000007;
const ll INF = 1LL << 60;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<ll> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }

  for (int i = 0; i < n; i++) {
    ll pin = v[i];
    ll bits = 0;
    for (int j = 0; j < n; j++) {
      if (v[i] != v[j])
        bits = bits ^ v[j];
    }
    cout << bits << " ";
  }
  cout << endl;
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200000 + 5;
ll a[N];

int main() {
  ll n;
  scanf("%lld", &n);
  ll sum = 0;
  for (ll i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    sum ^= a[i];
  }
  for (ll i = 0; i < n; i++) {
    cout << (sum ^ a[i]);
    if (sum == n - 1)
      cout << endl;
    else
      cout << " ";
  }
  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200000 + 5;
ll a[N];

int main() {
  ll n;
  scanf("%d", &n);
  ll sum = 0;
  for (ll i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum ^= a[i];
  }
  for (ll i = 0; i < n; i++) {
    cout << (sum ^ a[i]);
    if (sum == n - 1)
      cout << endl;
    else
      cout << " ";
  }
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
#define ll long long
map<int, int> mo;
const int maxn = 2e5 + 5;
int a[maxn], b[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  int xsum = a[0];
  for (int i = 1; i < n; i++) {
    xsum ^= a[i];
  }
  for (int i = 0; i < n; i++) {
    cout << (a[i] ^ xsum) << " ";
  }
}

Error: WA

Fixed submission:

#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
#define ll long long
map<int, int> mo;
const int maxn = 1e5 + 5;
int a[maxn], b[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  int xsum = a[0];
  for (int i = 1; i < n; i++) {
    xsum ^= a[i];
  }
  for (int i = 0; i < n; i++) {
    cout << (a[i] ^ xsum) << " ";
  }
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  ll n;
  cin >> n;
  ll arr[n];
  ll temp = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    temp ^= arr[i];
  }

  ll res[n];
  for (int i = 0; i < n; i++) {
    res[i] = temp ^ arr[i];
  }

  for (int i = 0; i < n; i++)
    cout << res[i] << " ";
  cout << "\\n";
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  ll n;
  cin >> n;
  ll arr[n];
  for (int i = 0; i < n; i++)
    cin >> arr[i];

  ll res[n];
  for (int i = 0; i < n; i++) {
    ll temp = 0;
    for (int j = 0; j < n; j++) {
      if (i != j)
        temp ^= arr[j];
    }
    res[i] = temp;
  }

  for (int i = 0; i < n; i++)
    cout << res[i] << " ";
  cout << "\\n";
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main(void) {

  int n;
  cin >> n;
  vector<int> a(n);
  int xsum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    xsum ^= a.at(i);
  }
  for (int i = 0; i < n; i++) {
    int result = xsum ^ a.at(i);
    cout << result << " ";
  }
  cout << endl;
}


Error: TLE

Fixed submission:

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

int main(void) {

  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < n; i++) {
    int result = 0;
    for (int j = 0; j < n; j++) {
      if (i != j)
        result ^= a.at(j);
    }
    cout << result << " ";
  }
  cout << endl;
}
Problem p02631 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define INF 0x3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int, int> PII;
typedef double db;
const ll mod = 1000000007;
const double PI = acos(-1.0);
const double epsilon = PI / 180.0; // 角度转弧度
ll powmod(ll a, ll b) {
  ll res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1)
      res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
const int N = 2e5 + 10;
int a[N];
int main() {
  int n;
  cin >> n;
  int sum = 0;
  rep(i, 1, n + 1) scanf("%d", &a[i]), sum ^= a[i];
  rep(i, 1, n + 1) cout << (sum ^ a[i]) << " ";
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define INF 0x3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int, int> PII;
typedef double db;
const ll mod = 1000000007;
const double PI = acos(-1.0);
const double epsilon = PI / 180.0; // 角度转弧度
ll powmod(ll a, ll b) {
  ll res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1)
      res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
const int N = 1e5 + 10;
int a[N];
int main() {
  int n;
  cin >> n;
  int sum = 0;
  rep(i, 1, n + 1) scanf("%d", &a[i]), sum ^= a[i];
  rep(i, 1, n + 1) cout << (sum ^ a[i]) << " ";
  return 0;
}
Problem p02631 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
  ll n, suff = 0;
  cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    suff ^= a[i];
  }
  ll ori = suff;
  ll xorr = 0;
  for (int i = 0; i < n; i++) {
    a[i] = suff ^ a[i];
    cout << a[i] << " ";
  }
  cout << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
  ll n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  ll xorr = 0;
  for (int i = 0; i < n; i++) {
    ll suff = 0;
    for (int j = i + 1; j < n; j++) {
      suff ^= a[j];
    }
    ll t = a[i];
    a[i] = xorr ^ suff;
    xorr ^= t;
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}