Problem:


Score : 500 points

Problem Statement

There are N Snuke Cats numbered 1, 2, \ldots, N, where N is even.

Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.

Recently, they learned the operation called xor (exclusive OR).

What is xor?

For n non-negative integers x_1, x_2, \ldots, x_n, their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows:

 When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. 

For example, 3~\textrm{xor}~5 = 6.

They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf.

We know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i.
Using this information, restore the integer written on the scarf of each Snuke Cat.

Constraints

All values in input are integers.

2 \leq N \leq 200000

N is even.

0 \leq a_i \leq 10^9

There exists a combination of integers on the scarfs that is consistent with the given information.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 \ldots a_N

Output

Print a line containing N integers separated with space.

The i-th of the integers from the left should represent the integer written on the scarf of Snuke Cat i.

If there are multiple possible solutions, you may print any of them.

Sample Input 1

4
20 11 9 24

Sample Output 1

26 5 7 22

5~\textrm{xor}~7~\textrm{xor}~22 = 20

26~\textrm{xor}~7~\textrm{xor}~22 = 11

26~\textrm{xor}~5~\textrm{xor}~22 = 9

26~\textrm{xor}~5~\textrm{xor}~7 = 24

Thus, this output is consistent with the given information.



Sample input:
4
20 11 9 24


Sample output:
26 5 7 22

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int, a: "List[int]"):
    s = 0
    for v in a:
        s = s ^ v
    ret = []
    for v in a:
        ret.append(s ^ v)
    print(*ret, sep=' ')
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

xor = lambda x, y:x^y

X = reduce(xor, a)

ans = [0]*N
for i, x in enumerate(a):
    ans[i] = X^x
print(*ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
x = 0
for i in a:
    x ^= i
ans = [x ^ a[i] for i in range(n)]
print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
*A, = map(int,input().split())

ans = 0
for a in A:
    ans ^= a

for a in A:
    print(ans^a)

Submission status: Accepted

Solution code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# import numpy as np
sys.setrecursionlimit(int(pow(10,6)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

# @lru_cache(None)
n=l()[0]
A=l()
x=A[0]
for i in range(1,n):
    x=x^A[i]
B=[x^A[i] for i in range(n)]
print(*B)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
xor = 0
for i in a:
    xor ^= i
for i in a:
    print(i^xor,end=' ')

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
f = []
b = []
now = 0
for ai in a:
    now ^= ai
    f.append(now)
now = 0
for ai in reversed(a):
    now ^= ai
    b.append(now)
b.reverse()
for i in range(n):
    ans = 0
    if i > 0:
        ans ^= f[i-1]
    if i < n-1:
        ans ^= b[i+1]
    print(ans, end=' ' if i < n - 1 else '\n')

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
ans=[]
s=a[0]
for i in a[1:]:
  s^=i
for i in a:
  ans.append(i^s)
print(*ans)

Submission status: Accepted

Solution code:
n = int(input())

a = list(map(int, input().split()))

s = 0
for i in range(n):
    s = s ^ a[i]

ans = []
for i in range(n):
    ans.append(s^a[i])

print(*ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int,input().split()))
# B = []
# for i in range(n-1):
#     B.append(A[i]^A[i+1])

# print(B)

# ANS = [26]
# for i in range(n-1):
#     ANS.append(ANS[-1]^B[i])

# print(ANS)

an = 0
for i in range(n):
    an ^= A[i]

ANS = []
for i in range(n):
    ANS.append(an^A[i])
print(*ANS)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
xorsm = 0
for x in a: xorsm ^= x
res = [0] * N
for i in range(N): res[i] = a[i] ^ xorsm
print(*res)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
x = 0
for i in a:
    x ^= i
ans = []
for i in a:
    ans.append(i^x)
print(*ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq


def solve(N, As):
    k = 0
    for a in As:
        k ^= a
    ans = []
    for a in As:
        ans.append(str(k ^ a))
    return " ".join(ans)


# assert(solve(4 , [20, 11, 9, 24]) == "26 5 7 22")
# assert(solve(2 , [0, 0]) == "0 0")
# assert(solve(2 , [0, 1]) == "1 0")
# assert(solve(2 , [1, 2, 4]) == "")
#
# print("OK")
if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(N, As))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

input()

A = input().split(' ')
A = list(map(int, A))

total_xor = 0

for a in A:
    total_xor = total_xor^a

A = [a^total_xor for a in A]
print(' '.join(map(str, A)))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

A = 0

for elem in a:
    A ^= elem

ans = [elem ^ A for elem in a]

print(*ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

val = 0
for x in a:
    val ^= x

for i in range(n):
    if(i < n - 1):
        print(val ^ a[i], end=' ')
    else:
        print(val ^ a[i])

Submission status: Accepted

Solution code:
N = int(input())
a_list = list(map(int, input().split()))

total = 0
for a in a_list:
	total ^= a

print(*(a ^ total for a in a_list))

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor

N = int(input())
As = list(map(int, input().split()))

X = reduce(xor, As)

anss = [X^A for A in As]

print(' '.join(map(str, anss)))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    arr = list(map(int,input().split()))
    xor = 0
    for i in arr:
        xor = xor^i

    ans = []
    for i in arr:
        ans.append(xor^i)

    for i in ans:
        print(i,end = ' ')


main()

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor

N = int(input())
A = list(map(int, input().split()))
xor_sum = reduce(xor, A)

for a in A:
    print(xor(a, xor_sum), end=" ")
print()

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
total = 0
for i in range(n):
    total ^= A[i]

ans = [0] * n
for i in range(n):
    ans[i] = total ^ A[i]

print(*ans, sep=" ")

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))

    mask = 0
    for i in range(n):
        mask = mask ^ a[i]

    ans = [0 for _ in range(n)]
    for i in range(n):
        ans[i] = a[i] ^ mask

    print(' '.join([str(x) for x in ans]))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    v = A[0]
    for a in A[1:]:
        v ^= a
    ans = []
    for a in A:
        ans.append(v ^ a)
    print(*ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x in input().split()]

sm = 0
for x in a:
    sm ^= x

ans = [a[i]^sm for i in range(n)]

print(*ans)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    res = 0
    a = list(map(int, input().split()))
    for i in a:
        res ^= i
    for i in a:
        print(res ^ i, end=' ')
    print()


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
(N,) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
xorAll = 0
for x in A:
    xorAll ^= x

print(" ".join(str(xorAll ^ x) for x in A))

Submission status: Accepted

Solution code:
import sys 
from collections import defaultdict
input = lambda:sys.stdin.readline().strip()
n = int(input())
a = list(map(int,input().split()))
all_ = 0
for i in a:
    all_^=i 
for i in range(n):
    print(a[i]^all_,end=" ")
print()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,*a = map(int,read().split())

from functools import reduce
from operator import xor

v = reduce(xor,a)

a = [i^v for i in a]
print(*a)

Submission status: Accepted

Solution code:
from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math


def get_int():
    return int(stdin.readline().strip())


def get_tuple():
    return map(int, stdin.readline().split())


def get_list():
    return list(map(int, stdin.readline().split()))


def solve():
    return

def main():
    n = get_int()
    ls = get_list()
    ans = []
    xor = 0
    for val in ls:
        xor ^= val
    for val in ls:
        ans.append(xor^val)
    print(*ans)


TestCases = False

if TestCases:
    for i in range(get_int()):
        main()
else:
    main()

Submission status: Accepted

Solution code:
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    xor = 0
    for a in A:
        xor ^= a
    ans = [xor ^ a for a in A]
    print(*ans)
resolve()

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline

n = int(input())
a = [int(x) for x in input().split()]
res = 0

for x in a:
    res ^= x

for x in a:
    print(res ^ x, end = ' ')

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = lr()
num = A[0]
for a in A[1:]:
    num ^= a

answer = [None] * N
for i, a in enumerate(A):
    answer[i] = num^a

print(*answer)

Submission status: Accepted

Solution code:
# Contest No.: ABC171
# Problem No.: E
# Solver:      JEMINI
# Date:        20200621

import sys
import heapq

def main():
    n = int(input())
    nums = list(map(int, sys.stdin.readline().split()))

    refVal = nums[0]
    for i in range(1, n):
        refVal ^= nums[i]
    for i in nums:
        print(refVal ^ i, end = " ")
    return

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
a = inpl()
all_num = 0
for i in a:
    all_num ^= i
ans = []
for i in a:
    ans.append(all_num ^ i)
print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

X = 0

for x in a:
    X ^= x

ans = [X ^ a[i] for i in range(N)]

print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

tmp = 0
for a in A:
    tmp ^= a

ans = [0] * N
for i in range(N):
    ans[i] = tmp ^ A[i]

print (*ans)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

n = int(input())
A = list(map(int, input().split()))
xor = 0
for i in range(n):
    xor ^= A[i]

ans = [0]*n
for i in range(n):
    ans[i] = xor ^ A[i]

print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

t = 0
for e in a:
    t ^= e

print(*[e ^ t for e in a])

Submission status: Accepted

Solution code:
from bisect import *
from collections import *
from heapq import *

N = int(input())
a = list(map(int, input().split()))
A = 0
for x in a:
    A ^= x
ans = [A^x for x in a]
print(*ans, sep=" ")

Submission status: Accepted

Solution code:
N = int(input())
arr = list(map(int, input().split(" ")))
all_xor = 0 
for a in arr :
    all_xor ^= a 

for a in arr :
    print (all_xor^a, end= " ")

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=0
for i in range(n):
    b=b^a[i]
for i in range(n):
    print(b^a[i],end=' ')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62


def solve(N: int, a: "List[int]"):
    total_xor = 0
    for v in a:
        total_xor = total_xor ^ v

    # for v in a:
    #     print(total_xor ^ v)
    print(" ".join((str(total_xor^v) for v in a)))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(N):
    s ^= a[i]
ans = []
for i in range(N):
    ans.append(a[i]^s)
print(*ans)

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
val = 0
for num in a:
    val = val ^ num
ans = [None]*n
for i,num in enumerate(a):
    ans[i] = val^num
write(" ".join(map(str, ans)))

Submission status: Accepted

Solution code:

from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

MOD = 10 ** 9 + 7
INF = 10 ** 18

N = int(input())
#N, M = map(int, input().split())
A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
#ABC = [list(map(int, input().split())) for _ in range(N)]

xorA = 0
for a in A:
    xorA ^= a

answer = []
for a in A:
    answer.append(xorA ^ a)
    
print(*answer)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    tot=0
    for a in A:
        tot^=a
    ans=[a^tot for a in A]
    print(*ans)





if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))

allxor = 0
for a in A:
    allxor ^= a

print(*[x^allxor for x in A])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
x = 0
for a in A:
    x ^= a

ans = []
for a in A:
    ans.append(x^a)
print(*ans)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))

s = 0
for a in A:
    s = s^a

ans = [0]*n
for i in range(n):
    ans[i] = s^A[i]
print(' '.join(str(i) for i in ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import functools


def restore_array(bs):
    all_xor = functools.reduce(lambda x, y: x ^ y, bs)
    res = [all_xor ^ b for b in bs]
    return res


def main():
    n = int(input())
    bs = [int(b) for b in input().split()]
    print(*restore_array(bs))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():

    N = int(input())
    a = list(map(int, input().split()))

    all = 0
    for v in a: all ^= v

    ans = []
    for v in a:
        ans.append(v^all)
    return " ".join(map(str, ans))


if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
S = 0
for x in A:
    S ^= x
print(*[S^x for x in A])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

s = 0
for ai in a:
    s = s ^ ai

ans = [s ^ ai for ai in a]
print(*ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
p = 0
for x in a:
    p ^= x
ans = [0] * n
for i, x in enumerate(a):
    ans[i] = p ^ x
print(*ans)

Submission status: Accepted

Solution code:

n = int(input())
l = list(map(int, input().split()))
ans = l[0]
for i in range(1, n):
    ans ^= l[i]
for i in l:
    print(ans ^ i, end=' ')

Submission status: Accepted

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
s = 0
for a in A:
    s ^= a
print(*[a^s for a in A])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n):
    res = [None] * n
    for i in range(n):
        res[i] = II()
    return res
def LIR(n):
    res = [None] * n
    for i in range(n):
        res[i] = LI()
    return res
def FR(n):
    res = [None] * n
    for i in range(n):
        res[i] = IF()
    return res
def LIR(n):
    res = [None] * n
    for i in range(n):
        res[i] = IF()
    return res
def LIR_(n):
    res = [None] * n
    for i in range(n):
        res[i] = LI_()
    return res
def SR(n):
    res = [None] * n
    for i in range(n):
        res[i] = S()
    return res
def LSR(n):
    res = [None] * n
    for i in range(n):
        res[i] = LS()
    return res
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n = II()
    a = LI()
    ans = 0
    for i in range(n):
        ans ^= a[i]
    tmp = []
    for j in range(n):
        tmp.append(ans ^ a[j])
    print(*tmp)
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
def examA():
    S = SI()
    if S in alphabet:
        ans = "a"
    else:
        ans = "A"
    print(ans)
    return

def examB():
    N, K = LI()
    P = LI()
    P.sort()
    ans = sum(P[:K])
    print(ans)
    return

def examC():
    N = I()
    ans = ""
    while(N>0):
        N -= 1
        ans += alphabet[N%26]
        N //= 26
        if N==0:
            break
    print(ans[::-1])
    return

def examD():
    N = I()
    A = LI()
    D = defaultdict(int)
    for a in A:
        D[a] += 1
    S = sum(A)
    q = I()
    ans = [0]*q
    for i in range(q):
        a, b = LI()
        if not a in D:
            ans[i] = S
            continue
        S += (b-a)*D[a]
        D[b] += D[a]
        D[a] = 0
        ans[i] = S

    for v in ans:
        print(v)
    return

def examE():
    N = I()
    A = LI()
    S = 0
    for a in A:
        S ^= a
    #print(S)
    ans = [0]*N
    for i in range(N):
        ans[i] = S^A[i]
    print(" ".join(map(str,ans)))
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examE()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

s = 0
for x in a:
  s ^= x
ans = [x^s for x in a]
print(" ".join(map(str, ans)))

Submission status: Accepted

Solution code:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = np.array(read().split(), np.int64)

def main(A):
    N = len(A)
    if N % 2 == 0:
        S = np.bitwise_xor.reduce(A)
        return A ^ S
    return A

B = main(A)
print(' '.join(map(str, B.tolist())))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

X = 0
for a in A:
    X ^= a

ans = []
for a in A:
    ans.append(X^a)

print(*ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    *A, = map(int, input().split())

    all_xor = 0
    for x in A:
        all_xor ^= x

    ans = (x ^ all_xor for x in A)

    print(*ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))
acc = 0
for e in arr:
  acc ^= e
print(*[acc ^ e for e in arr])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
X = 0
for i in range(n):
    X = X^a[i]
ans = []
for i in range(n):
    ans.append(X^a[i])
print(*ans)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n = ni()
    a = nl()
    e = 0
    for x in a:
        e ^= x
    b = [e^x for x in a]
    print(*b)
    return

solve()

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
def xor(x,y):
    return x^y
s = 0
for val in a:
    s = xor(s,val)
res = []
for val in a:
    res.append(s^val)
print(*res)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
t = 0
for x in a:
	t ^= x
print(*[x^t for x in a])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

x = 0
for e in a:
    x ^= e

ans = [e ^ x for e in a]
print(*ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

tot_xor = 0
for num in a:
    tot_xor ^= num

ans = [0] * n
for i in range(n):
    ans[i] = a[i] ^ tot_xor
print(*ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
s = 0
for i in a:
    s ^= i
b = [s^i for i in a]
print(*b)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

S = 0
for a in A:
    S ^= a

print(*[S ^ a for a in A])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
a = list(map(int, input().split()))
xor = 0
for x in a:
    xor ^= x
b = [xor ^ x for x in a]
print(*b)

Submission status: Accepted

Solution code:
N = int ( input().strip() ) ;
arr = list ( map ( int , input().strip().split(" ") ) ) ;

c0 = 0 ;
for v in arr :
	c0 = c0 ^ v ;

arr2 = list ( map ( lambda x:c0^x , arr ) ) ;
print ( " ".join(  map( str , arr2 ) ) ) ;

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = ans^a[i]
for i in range(n):
    print(ans^a[i], end=" ")

Submission status: Accepted

Solution code:
N=int(input())
X=0
a=list(map(int,input().split()))
for i in range(N):
    X^=a[i]
ans=[X^a[i] for i in range(N)]
print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

m = 0
for a in A:
    m ^= a

ans = []
for a in A:
    ans.append(a ^ m)

print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

t = 0
for i in a:
  t ^= i

for i in a:
  print(t ^ i)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
X=0
for i in range(N):
  X=X^A[i]
P=[]
for i in range(N):
  P.append(A[i]^X)
print(*P)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    s = 0
    for i in a:
        s ^= i
    ans = [s^i for i in a]
    print(*ans)
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
b = 0
for i in a:
    b ^=i
ans = [i ^ b for i in a]
print(*ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()

x = 0
for v in a:
    x ^= v
b = []
for i in range(n):
    b.append(a[i]^x)
print(" ".join(map(str, b)))

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
x=0
for i in a:x^=i
for i in a:print(x^i)