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:
N=int(input())
A=list(map(int,input().split()))

X=0
for i in A:
    X^=i
#print(X)

L=[]
for i in A:
    L.append(X^i)
print(*L)

Submission status: Accepted

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

Submission status: Accepted

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

ans = [0] * N
for i in range(N):
    ans[i] = total ^ a[i]

print(*ans)

Submission status: Accepted

Solution code:
N, *A = map(int, open(0).read().split())

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]

result = []
res = A[1]
for a in A[2:N]:
    res ^= a
result.append(str(res))

for i in range(0, N-1):
    res = A[i] ^ A[i+1] ^ res
    result.append(str(res))

print(" ".join(result))

Submission status: Accepted

Solution code:
from functools import reduce
n=int(input())
l=[int(x) for x in input().split(" ")]
e= reduce(lambda x, y: x ^ y, l)
for x in l:
    print(x^e,end=" ")

Submission status: Accepted

Solution code:
N = int(input())
a = [int(x) for x in input().split()]
cnt = 0
for i in a:
  cnt ^= i
s = []
for i in a:
  b = str(cnt^i)
  s.append(b)
print(" ".join(s))

Submission status: Accepted

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

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

ans = [0] * N

for i, a in enumerate(A):
    ans[i] = total ^ a

print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    N = int(input())
    a = list(map(int, input().split()))

    #output
    x = a[0]
    for i in range(1, N):
        x = x^a[i]

    c = [x^aa for aa in a]
    for s in c:
        print(int(float(s)), end = " ")

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#output
x = a[0]
for i in range(1, N):
    x = x^a[i]

c = [x^aa for aa in a]
for s in c:
    print(int(float(s)), end = " ")

Submission status: Accepted

Solution code:
def constructXOR(A, n): 
    XOR = 0
    for i in range(0, n): 
        XOR ^= A[i] 
    for i in range(0, n): 
        A[i] = XOR ^ A[i] 
  
n=int(input())
A=list(map(int,input().strip().split()))
constructXOR(A, n) 
for i in range(0,n): 
    print(A[i], end =" ")

Submission status: Accepted

Solution code:
n = int(input())
values = list(map(int, input().split()))
# values = [i for i in range(5)]

allXor = 0


def output_b(v):
    return format(v, '08b') +":" + format(v)

for a in values:
    allXor = allXor ^ a

for a in values:
    result = allXor ^ a
    print(result)

Submission status: Accepted

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

a_xor = ali[0]
for i in ali[1:]:
    a_xor = a_xor^i

ans = []
for i in ali:
    ans.append(a_xor^i)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
s = len(bin(max(a)))-2

box = [0] * s
bbbox = [] * n
for i in range(n):
    bbbox.append(format(a[i],'b').zfill(s))
    for j in range(s):
        box[j] += int(bbbox[-1][-j-1])


ans = [0] * n
for i in range(s):
    for j in range(n):
        if box[i] % 2 == 0:
            if bbbox[j][-1-i] == '1':
                ans[j] += 2 ** i
        else:
            if bbbox[j][-1-i] == '0':
                ans[j] += 2 ** i
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
p = 0
for a in A[1:]:
    p ^= a
ans = [p]
l = A[0]
for i in range(1, N):
    k = l
    l = A[i]
    h = k ^ l
    ans.append(ans[i-1] ^ h)

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

Submission status: Accepted

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

# N = 4
# A = [20, 11, 9, 24]

xorAll = 0
for a in A:
    xorAll = xorAll^a
#    print(bin(a))
#    print(bin(xorAll))
#    print(xorAll)
for a in A:
    mem = bin(xorAll)
    ans = xorAll^a
    print(ans, end=' ')

Submission status: Accepted

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

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

s = []

if n % 2 == 0:
    x = a[0]
    for i in range(1, n):
        x = x ^ a[i]

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

else:
    x = a[0]
    for i in range(1, n-1):
        x = x ^ a[i]

    for i in range(n-1):
        s.append(x ^ a[i])

    #最後だけ
    y = a[1]
    for i in range(1, n):
        y = y ^ a[i]

    s.append(y ^ a[n-1])

t = list(map(str, s))

print(" ".join(t))

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    x = A[0]
    for a in A[1:]:
        x ^= a
    ans = []
    for a in A:
        ans.append(str(x^a))
    print(" ".join(ans))

if __name__ == '__main__':
    main()

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]
xor=[X]*N
for i in range(N):
    xor[i]^=a[i]
print(*xor)

Submission status: Accepted

Solution code:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

n=I()
a=L()
xorall=a[0]
for i in range(1,n):
    xorall=xorall^a[i]
for i in a:
    print(xorall^i,end=" ")
print()

Submission status: Accepted

Solution code:
from functools import reduce

n = int(input())
a = tuple(map(int, input().split()))

res = reduce(lambda x, y: x ^ y, a)
ans = [res ^ i for i in a]
print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(n) for n in input().split()]

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

for a in A:
    print(a ^ total)

Submission status: Accepted

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

for j in range(n):
    ans.append(str(total^list[j]))
print(" ".join(ans))

Submission status: Accepted

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

N = ri()
a = ri_()
s = 100000000000000
for i in range(N):
    if s == 100000000000000:
        s = a[i]
    else:
        s = s ^ a[i]
ans = [0] * N
for i in range(N):
    print(s ^ a[i], end = ' ' if i < N - 1 else '\n')

Submission status: Accepted

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

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

for y in a:
    print(y ^ xor_sum)

Submission status: Accepted

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

goukei = 0

for i in a:
    goukei ^= i

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

Submission status: Accepted

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

sum = 0

for i in a:
    sum = sum^i
#print(sum)
#print(20^11^9^24)

l = []

for j in a:
    l.append(sum^j)

print(" ".join(map(str, l)))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
temp = a[0]
for n in range(1, N):
    temp = temp ^ a[n]
rui = temp
for el in a:
    print(rui ^ el, end=" ")

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
"""
全員が自分以外の全員のxorを把握しているので、全員の値を求めよ
nは偶数

桁ごとに独立に考える。
テストケースで検証すると、
その桁において1の数が偶数個の場合は、自分自身の桁の数字を入れる
奇数個の場合は、自分自身の桁の値をbit反転したものを入れる
ことが正解であることが分かる。
これを実装するだけ。
"""
n = int(readline())
lst1 = list(map(int,readline().split()))
limit = 33 #制約10**9は2**32内に収まる。
ans = []
parity = [0]*limit
for i in lst1:
    for j in range(limit):
        parity[j] += i>>j

for i in range(limit):
    parity[i] %= 2

for i in lst1:
    res = 0
    for j in range(limit):
        p = i>>j&1
        if parity[j]== 0 and p== 1:
            res += 1<<j
        elif parity[j] == 1 and p == 0:
            res += 1<<j
    ans.append(res)
print(*ans)

Submission status: Accepted

Solution code:
import sys, collections, bisect, itertools, heapq, math, copy
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    a = LI()

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

    print(*[sum ^ i for i in a])

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    a = list(map(int,input().split()))
    ANS = ""
    xor_all = 0
    for i in range(N):
        xor_all = xor_all^a[i]
    for i in range(N):
        if ANS != "":
            ANS += " "
        ANS += str(xor_all^a[i])
    print(ANS)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

answer = []
for a in A:
  answer.append(all_xor ^ a)
  
print(" ".join(map(str, answer)))

Submission status: Accepted

Solution code:
n = int(input())
aa = list(map(int,input().split()))
x = 0
for a in aa:
  x^=a
print(" ".join([str(x^a) for a in aa ]))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**6)
input = sys.stdin.readline
#read = sys.stdin.buffer.read

def main():
    N = int(input())
    A = list(map(int, input().split()))
    base = 0
    for a in A:
        base ^= a
    ans = []
    for i in range(N):
        ans.append(base^A[i])

    print(*ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  a = list(map(int, input().split()))
  ans = 0
  for i in a:
    ans = ans^i
  for i in a:
    print(ans^i)
    
if __name__ == "__main__":
  main()

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])

Submission status: Accepted

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

Submission status: Accepted

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


def solve(N: int, a: "List[int]"):
    allXor = a[0]^a[1]
    for i in range(2,N):
        allXor ^= a[i]
    s = ""
    for i in range(len(a)):
        isLast = (len(a) -1 ==i)
        c = str(allXor^a[i])
        if not isLast:
            s += c + " "
        else:
            s+=c
    print(s)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
ans=[]
for a in A:
    S^=a
for a in A:
    ans.append(S^a)
print(*ans)

Submission status: Accepted

Solution code:


def main():
    N = int(input())
    a = list(map(int, input().split()))
    xor = 0
    for i in range(0, len(a)):
        xor = xor ^ a[i]
    for i in range(0, len(a)):
        if i != 0:
            print(' ', end='')
        print(xor ^ a[i], end='')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

b=[]
for i in a:
    b.append(i^c)
print(*b)

Submission status: Accepted

Solution code:
from functools import reduce
n=int(input())
k=list(map(int,input().split()))
c=reduce(lambda a,b:a^b,k)
for i in range(n):
  print(k[i]^c,end=" ")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 21 22:04:00 2020

@author: NEC-PCuser
"""

N = int(input())

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

sum_a = 0

for i in a:
    sum_a ^= i

ans_list = []
for i in a:
    ans_list.append(str(sum_a ^ i))

print(' '.join(ans_list))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
tmp=a[0]
for i in range(1,n):
    tmp=tmp^a[i]
ans=[]
for i in range(n):
  ans.append(str(a[i]^tmp))
print(' '.join(ans))

Submission status: Accepted

Solution code:
n=int(input())
x=[int(x) for x in input().split()]
s=x[0]
for i in range(1,len(x)):
	s=s^x[i]
z=[]
for i in range(len(x)):
	z.append(s^x[i])
print(*z)

Submission status: Accepted

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

x = 0
for l in lst:
    x ^= l
out = ''
for l in lst:
    out += ' ' + str(x^l)
print(out[1:])

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
ans=[0]*n

tmp=A[0]

for i in range(1,n):
    tmp=tmp^A[i]

for i in range(n):
    ans[i]=A[i]^tmp
    
print(*ans)

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor

input()
a = tuple(map(int, input().split()))
s = reduce(xor, a)
print(*(s ^ x for x in a))

Submission status: Accepted

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

if N==2:
  print(a[1], a[0])
  exit()
  
ans=[0]*N
tmp=a[1]^a[2]
for i in range(3, N):
  tmp=tmp^a[i]
  
ans[0]=tmp
for i in range(1, N):
  tmp=a[i-1]^a[i]
  ans[i]=tmp^ans[i-1]
  
print(*ans, sep=' ')

Submission status: Accepted

Solution code:
from functools import reduce

n = int(input())
nums  = list(map(int, input().split()))

sum_xor = reduce(lambda a, b: a ^ b, nums)
print(*[sum_xor ^ x for x in nums])

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N = int(input())
    A = list(map(int, input().split()))
    allxor = 0
    ans = [0] * N
    for k in range(N):
        allxor ^= A[k]
    for i in range(N):
        ans[i] = allxor ^ A[i]
    print(*ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if n == 2:
    print(*arr[::-1])
else:
    res = [0 for i in range(n)]
    temp = 0
    for i in range(1,n):
        temp ^= arr[i]^arr[i-1]
        res[i] = temp   #arr[0]^arr(i)
    # print(res)
    allxor = 0
    for e in res:
        allxor ^= e
    first = allxor^arr[0]
    ans = []
    for e in res:
        ans.append(e^first)
    print(*ans)

Submission status: Accepted

Solution code:
from functools import reduce

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

all = reduce(lambda x, y: x ^ y, a)
ans = [all ^ i for i in a]
print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
cumsum = [0]
for a in A:
  cumsum.append(cumsum[-1]^a)

res = []
for i in range(N):
  res.append(cumsum[-1]^A[i])

print(" ".join(map(str, res)))

Submission status: Accepted

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

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

for a in A:
    print(L ^ a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
x=0
for i in a:
  x^=i
print(*[x^i for i in a],sep=' ')

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
  if n%2:
    use=A[i]
  else:
    use=A[i]^ans
  print(use)

Submission status: Accepted

Solution code:
import sys
N=int(sys.stdin.readline().strip())
A=map(int, sys.stdin.readline().split())

for i,a in enumerate(A):
    if i==0:
        total=a
    else:
        total^=a

for a in A:
    print a^total,

Submission status: Accepted

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

Submission status: Accepted

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

ans = []
for i in range(n):
  ans.append(str(xor^a[i]))
print(" ".join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    a = list(geta(int))

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

    print(*[s ^ ai for ai in a], sep=" ")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

ans=[]
for ai in a:
    ans.append(a_xor_sum ^ ai)

print(*ans)

Submission status: Accepted

Solution code:
not_dict = {"0": "1", "1": "0"}
n = int(input())
a_list_0d = list(map(int, input().split()))
bit_sum = [0]
a_list_0b = list(map(lambda x: bin(x)[2:], a_list_0d))
max_bit = max(map(len, a_list_0b))
a_list_str = list(map(lambda x: x.zfill(max_bit), a_list_0b))
all_sum = 0
for i in range(n):
    all_sum ^= a_list_0d[i]
all_sum_str = bin(all_sum)[2:].zfill(max_bit)

new_list = ["0b" for _ in range(n)]
for b in range(max_bit):
    if all_sum_str[b] == '1':
        for i in range(n):
            new_list[i] += not_dict[a_list_str[i][b]]
    else:
        for i in range(n):
            new_list[i] += a_list_str[i][b]
    # print(new_list)


for i in range(n):
    print(int(new_list[i], 0), end=" ")

Submission status: Accepted

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

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

ans = [] 
for a in A:
  ans.append(all_xor^a)
  
ans = [str(a) for a in ans]
ans = " ".join(ans)
print(ans)

Submission status: Accepted

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

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

results = []

for a in A:
    results.append(str(all_xor ^ a))

print(' '.join(results))

Submission status: Accepted

Solution code:
import sys
from operator import ixor
from functools import reduce


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    s = reduce(ixor, a)
    res = [s ^ a[i] for i in range(n)]
    print(*res)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


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

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

print(*ans,sep=" ")

Submission status: Accepted

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

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

res = []
for a in al:
    res.append(x^a)

print(*res)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
a = np.array([int(i) for i in input().split()])

ans = np.zeros_like(a)
for i in range(len(f'{np.max(a):b}')):
    p = (a >> i & 1)
    cnt = np.count_nonzero(p)
    ans += ((cnt - p) % 2) * 2**i

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = int(input())
    a_list = input_to_int_tuple()

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

    ret = ""
    for v in a_list:
        ret += str(all ^ v) + " "

    print(ret.rstrip())


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

arr = [int(x) for x in input().split()]

left = [0]
for i in range(1,n):
  left.append(left[-1]^arr[i-1])
arr = arr[::-1]
right = [0]
for i in range(1,n):
  right.append(right[-1]^arr[i-1])
right = right[::-1]
arr  = arr[::-1]

ans = []
for i in range(n):
  ans.append(left[i]^right[i])

for num in ans:
  print(num,end=" ")

Submission status: Accepted

Solution code:
from math import log
n=int(input())
arr=list(map(int,input().split()))
c=0
for i in arr:
    c=c^i
for i in arr:
    print(c^i,end=" ")

Submission status: Accepted

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

s = 0
for ai in a:
    s ^= ai
print(' '.join(map(lambda x: str(s ^ x), a)))

Submission status: Accepted

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

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

results = []
for a in A:
    results.append(str(xor ^ a))

print(' '.join(results))

Submission status: Accepted

Solution code:
import os
import sys
from io import BytesIO, IOBase
# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------------------

from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def RL(): return map(int, sys.stdin.readline().rstrip().split())
def RLL(): return list(map(int, sys.stdin.readline().rstrip().split()))
def N(): return int(input())
def comb(n, m): return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0
def perm(n, m): return factorial(n) // (factorial(n - m)) if n >= m else 0
def mdis(x1, y1, x2, y2): return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

# ------------------------------
# f = open('../input.txt')
# sys.stdin = f

def main():
    n = N()
    arr = RLL()

    sm = 0
    for i in arr:
        sm^=i
    res = []

    for i in arr:
        res.append(i^sm)

    print(*res)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import log
n=int(input())
arr=list(map(int,input().split()))
c=0
for i in arr:
    c=c^i
for i in arr:
    print(c^i,end=" ")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    init = 0
    for a in A:
        init ^=a
    for a in A:
        print(init^a,end=" ")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


#隣接リスト 1-order
def make_adjlist_d(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
        res[edge[1]].append(edge[0])
    return res


def make_adjlist_nond(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
    return res


#nCr
def cmb(n, r):
    return math.factorial(n) // math.factorial(r) // math.factorial(n - r)


def main():
    N = NI()
    A = NLI()
    all_xor = 0
    for a in A:
        all_xor ^= a
    L = list(map(lambda x: x^all_xor, A))
    print(" ".join(map(str, L)))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(*ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
from collections import Counter

n = int(input())
a = [int(item) for item in input().split()]

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

ans = [0] * n
for i, item in enumerate(a):
    ans[i] = total ^ item
print(*ans)

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor

N = int(input())
AS = list(map(int, input().split()))
if N == 2:
    print(*AS, sep=" ")
    exit()
if N == 3:
    r0 = 0
    r1 = r0 ^ AS[2]
    r2 = r1 ^ AS[0]
    print(r0, r1, r2)
    exit()

"""
input
0b00000000000000000000000010100
0b00000000000000000000000001011
0b00000000000000000000000001001
0b00000000000000000000000011000

output
0b00000000000000000000000011010
0b00000000000000000000000000101
0b00000000000000000000000000111
0b00000000000000000000000010110

myanswer
0b00000000000000000000000000000
0b00000000000000000000000011111
0b00000000000000000000000011101
0b00000000000000000000000001100
"""
# for a in AS:
#     print(f"{a:#031b}")
r = [0] * N
for i in range(1, N):
    r[i] = r[i - 1] ^ AS[i - 1] ^ AS[i]

# for a in r:
#     print(f"{a:#031b}")

rest = reduce(xor, r[1:])
d = AS[0] ^ rest
for i in range(N):
    r[i] ^= d

print(*r)
# check
# total = reduce(xor, r)
# for i in range(N):
#     print(total ^ r[i] == AS[i])

Submission status: Accepted

Solution code:
n,a,s=int(input()),list(map(int,input().split())),0
for x in a:
	s ^= x
print(' '.join(list(map(str,[x^s for x in a]))))