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()))
a_all=0
for i in range(N):
    a_all^=a[i]
ans=[]
for j in range(N):
    ans.append(a_all^a[j])
print(*ans)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
a_all=0
for i in range(N):
	a_all=a_all^a[i]
ans=[]
for j in range(N):
	ans.append(a_all^a[j])
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]
b = [0] * n
for i in range(n):
  b[i] = s ^ a[i]

print(*b)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int, input().split()))
s = 0
for a in A:
  s ^= a
ans = list()
for a in A:
  ans.append(s ^ a)
print(" ".join(map(str, ans)))

Submission status: Accepted

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

Submission status: Accepted

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

for x in A:
    xor ^= x

for v in  A:
    print(xor^v, end=' ')

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    s = 0
    for a in A:
        s ^= a
    for a in A:
        print(s ^ a)
    
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
import sys
### stdin
def input(): return sys.stdin.readline()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
#OutH = print(' '.join(map(str, lst)))
OutV = lambda x: print(*x, sep='\n')
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

## 数値リストを与えるとそのxorを計算する
## xors([1,2,3]) = 0
def xors(num_lst):
  xor = 0
  for i in range(len(num_lst)):
    xor = xor ^ num_lst[i]
  return xor

N = iIn()
A = iInLH()

allxor = xors(A)
lst = []
for i in range(N):
    eachxor = allxor ^ A[i]
    lst.append(eachxor)

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in range(n):
    ans = (ans ^ l[i])

for i in range(n):
    print(ans ^ l[i])

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline())
A = list(map(int,stdin.readline().split()))
xor=A[0]

for t in range(1,N):
    xor=xor^A[t]

for u in A:
    print(xor^u,end=' ')

Submission status: Accepted

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

Submission status: Accepted

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

xor_all = 0
for an in a:
    xor_all = xor_all ^ an

anss = [str(xor_all ^ an) for an in a]
print(" ".join(anss))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*len(a)
c=a[0]
for i in range(1,n):
  c^=a[i]
for j in range(n):
  ans[j]=str(c^a[j])
print(" ".join(ans))

Submission status: Accepted

Solution code:
#coding: utf-8
N = int(input())
A = list(map(int,input().split()))
B = A[0]
for i in range(1,N):
    B = B^A[i]
ans = []
for i in range(N):
    ans.append(str(B^A[i]))

print(' '.join(ans))

Submission status: Accepted

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

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

out = []
for a in A:
    out.append(str(x ^ a))

print(' '.join(out))

Submission status: Accepted

Solution code:
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
#import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

mod=10**9+7
#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))

n=int(input())
tmp=list(map(int,input().split()))
a=[]
al=0
for each in tmp:
    al^=each
    a.append(each)

ans=[]
for each in (tmp):
    ans.append(str(each^al))

print(" ".join(ans))

Submission status: Accepted

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

x=0

for i in arr:
	x^=i


ans=[]

for i in arr:
	ans.append(x^i)

print(*ans)

Submission status: Accepted

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

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

for i in a:
    print(sum^i,end=' ')

Submission status: Accepted

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

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

ans = list()
for i in a:
	s = Xsum ^ i
#	print(s)
	ans.append(str(s))

print(' '.join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce

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

z = reduce(lambda x,y:x^y, A)
print(*[a^z for a in A], sep=' ')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
        

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

    all_xor = A_s[0]

    for i in range(1, N):
        all_xor = (all_xor ^ A_s[i])

    ans_list = []

    for i in range(N):
        ans = (all_xor ^ A_s[i])
        ans_list.append(ans)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# Problem E - Red Scarf

# input
N = int(input())
a_nums = list(map(int, input().split()))

# initialization
xor_sum = 0
# xor sum
for a in a_nums:
    xor_sum = xor_sum ^ a
ans = []

# xor check
for a in a_nums:
    tmp = xor_sum ^ a
    ans.append(tmp)

# output
print(" ".join(list(map(str, ans))))

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    a=list(map(int,readline().split()))

    b=[0]*n

    s_xor=0
    i_1=0
    i_2=0
    for j in range(n):
        if j==0:
            for _ in range(n-1):
                s_xor^=a[i_1]
                i_1+=1
            b[i_1]=s_xor
        else:
            s_xor^=a[i_2]
            i_2+=1
            i_2%=n

            s_xor^=a[i_1]
            i_1+=1
            i_1%=n
            b[i_1]=s_xor

    print(*b)

if __name__=="__main__":
    main()

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    a=LI()
    ALL=0
    for i in range(N):
        ALL=ALL^a[i]
        
    ans=[0]*N
    for i in range(N):
        ans[i]=ALL^a[i]
        
    print(' '.join(map(str, ans)))

main()

Submission status: Accepted

Solution code:
input()
xors = [int(num) for num in input().strip().split(' ')]

totXor = xors[0]

for i in range(1, len(xors)): totXor ^= xors[i]

result = [totXor^xor  for xor in xors]

ans = "";
for result in result:
    ans += str(result)+ " "

print(ans.strip())

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 = [a ^ xor for a in A]
    print(*ans)
resolve()

Submission status: Accepted

Solution code:
import sys
import numpy as np
import math
import collections
from collections import deque 
from functools import reduce

# input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
axor = 0
for ai in a:
    axor ^= ai
ans = []
for ni in range(n):
    ans.append(str(axor ^ a[ni]))
print(" ".join(ans))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
xorsum = 0
for a in A:
    xorsum = xorsum^a
ans = [xorsum] * N
for i,a in enumerate(A):
    ans[i] = ans[i] ^ a
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(" ".join([str(ai ^ a_xor) for ai in a]))

Submission status: Accepted

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

# すべての XOR
x = 0
for a in A:
    x ^= a

res = []
# 一つずつ構成
for a in A:
    res.append(a^x)

print(*res)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split(" ")]
t = a[0]
for i in a[1:]:
    t = t ^ i
ans = [t^i for i in a]
print(" ".join(map(str, ans)))

Submission status: Accepted

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

for i in range(N):
  if (i != 0):
    print(" ", end = "")
  print(S^aList[i], end = "")

Submission status: Accepted

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

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

ans = [val^i for i in L]
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    flg = ["0"] * 40
    for i in range(40):
        cnt = 0
        for a in A:
            if (a >> i) & 1:
                cnt += 1
        if cnt % 2 != 0:
            flg[i] = "1"

    flg = int("".join(flg[::-1]), 2)
    res = [a ^ flg for a in A]
    print(*res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
import math

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n = int(rl())
	S = 0
	A = list(rli())
	for x in A:
		S ^= x
	ans = []
	for i in range(n):
		ans.append(S ^ A[i])
	print(" ".join(str(x) for x in ans))
	stdout.close()

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
import bisect

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


Sum_xor = a[0]
for i in range(N-1):
    Sum_xor = Sum_xor ^ a[i+1]
    

for i in range(N):
    print(Sum_xor ^ a[i])

Submission status: Accepted

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

total = 0
for num in S:
    total ^= num
ans = [0]*N
for i in range(N):
    ans[i] = total^S[i]
print(" ".join(map(str, ans)))

Submission status: Accepted

Solution code:
N = int(input())
a = 0
l = []
for i in map(int,input().split()):
  l.append(i)
  a = a ^ i
for i in l:
  print(a ^ i)

Submission status: Accepted

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

x_1_n = 0
for a_i in a:
    x_1_n ^= a_i

for a_i in a:
    print(-1 - ~(x_1_n ^ a_i))

Submission status: Accepted

Solution code:
ans = ""
n = int(input())
l = list(map(int, input().split()))
s = 0
for a in l:
  s ^= a
for a in l:
  ans += str(s^a) + " "
print(ans[:-1])

Submission status: Accepted

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

for i in a:
    s = s ^ i

for i in a:
    print(i ^ s)

Submission status: Accepted

Solution code:
# E
#
n = int(input())
a = list(map(int, input().split()))
ans=a[0]
#S=allxor(a)を求める
for i in range(1,n):
    ans = ans ^ a[i]
# print(ans)
b = []
for i in range(n):
    b.append(ans ^ a[i])
print(*b)

Submission status: Accepted

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

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

L = []

for x in a:
  L.append(str(int(x^s)))

print(" ".join(L))

Submission status: Accepted

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

Submission status: Accepted

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

from functools import reduce

def func(x,y):
    return x^y

all_ = reduce(func,A)

li = [0]*N

for i,a in enumerate(A):
    li[i]=a^all_

print(*li)

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n=ni()
a=nl()

s = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

def xor(x,y):
    return x^y

N = i()
A = l()
ans = []
S = xor(A[0],A[1])

for i in range(len(A)-2):
    S = xor(S,A[i+2])

for i in A:
    ans.append(str(xor(S,i)))

print(" ".join(ans))

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
def xor(x,y):
    return x^y
S=xor(A[0],A[1])
for i in range(len(A)-2):
    S=xor(S,A[i+2])
ans=[]
for a in A:
    ans.append(xor(S,a))
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
a = list(map(int,input().split()))
s = 0
for v in a: s ^= v
for v in a: print(s^v)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
s = 0
for v in a:
  s ^= v
for v in a:
  print(s^v)

Submission status: Accepted

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

xors = 0

for num in nums:
  xors = xors ^ num

for i in range(n):
  nums[i] = str(nums[i] ^ xors)

print(" ".join((nums)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#関数リスト
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

q = I()
mylist = LI()
result = 0
for i in mylist:
    result = result ^ i

for i in mylist:
    print(result ^ i)

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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

    S = 0
    for a in A:
        S ^= a
    B = []
    for a in A:
        B.append(a^S)
    print(*B)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

s = a[0]
for i in range(N - 1):
    s ^= a[i + 1]

b = [s ^ a[i] for i in range(N)]
print(*b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = a[0]
    for i in range(1,n):
        b = b^a[i]
    ans = []
    for i in range(n):
        ans.append(b^a[i])
    print(*ans)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
#import random
#sys.setrecursionlimit(1000000)
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

n=inp()
ara=inara()

xor=0
for num in ara:
	xor^=num

xor^=ara[n-1]

ans=[0]*n
ans[n-1]=xor

for i in range(n-2,-1,-1):
	xor^=ara[i]^ara[i+1]
	ans[i]=xor

print(*ans)

Submission status: Accepted

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

b=[x^i for i in a]
for i in b:
    print(i,end=" ")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
x=0
for i in a:
    x^=i
b=[x^i for i in a]
for i in b:
    print(i,end=" ")

Submission status: Accepted

Solution code:
import sys
import time
import math
st = time.perf_counter()
def inpl():
    return list(map(int, input().split()))
# ------------------------------

N = int(input())
ls = inpl()

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

for i in ls:
    print(i ^ a, end=' ')
print()

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    xored = 0
    for a in A:
        xored ^= a
    ans = [str(xored^a) for a in A]
    print(' '.join(ans))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.buffer.readline())
a = list(map(int, stdin.buffer.readline().split()))
axor = 0
for i in a:
    axor ^= i
ans = [axor^x for x in a]
print(*ans)

Submission status: Accepted

Solution code:
def solve(A,N):
    xor_sum = 0
    for i in range(N):
        xor_sum ^= A[i]

    B = [xor_sum ^ A[i] for i in range(N)]

    return B

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

    ans = solve(A,N)

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor

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

xorsum = reduce(xor, list_a)
list_n = [xor(xorsum, a) for a in list_a]

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

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
S = reduce(lambda a, b: a^b , A)
print(*[a ^ S for a in A])

Submission status: Accepted

Solution code:
# 解法　XORの性質が大事になる．XORを同じものに２回繰り返すと000000になり次の数はそのままになる.
# a ^ b ^ b

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

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

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

print(' '.join(X))

Submission status: Accepted

Solution code:
N= int(input())
nums = list(map(int, input().split()))
#print(nums)
total = 0

for n in nums:
    total ^= n
#print(total)

orig = [total ^ n for n in nums]

print(' '.join(str(n) for n in orig))

Submission status: Accepted

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

ma = max(a)
tmp = 1
m = 0
while True:
    if tmp >= ma:
        break
    tmp *= 2
    m += 1

memo = [0 for i in range(m+1)]

for j in range(m+1):
    cnt0 = 0
    cnt1 = 0
    for ai in a:
        if ai & (1 << j):
            cnt1 += 1
        else:
            cnt0 += 1
    if cnt1 % 2 == 0 and cnt0 % 2 == 0:
        memo[j] = 1

ans = []


for ai in a:
    ansi = 0
    for j in range(m+1):
        if ai & (1 << j):
            if memo[j]:
                ansi += 2 ** j
        else:
            if memo[j] == 0:
                ansi += 2 ** j

    ans.append(str(ansi))

print(" ".join(ans))

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
all_xor =0
for i in a:
    all_xor ^=i
for i in a:
    print(all_xor ^i,end=" ")

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    an = list(map(int, input().split()))
    from functools import reduce
    anxor = reduce(lambda lhs, rhs: lhs ^ rhs, an)

    print(*[anxor ^ a for a in an])

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

brr=[]
for i in range(n):
    brr.append(ans^arr[i])
print(*(brr),sep=" ")

Submission status: Accepted

Solution code:

from __future__ import print_function
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    s = 0
    for ai in a:
        s ^= ai
    ans = []
    for ai in a:
        ans.append(s ^ ai)
    print(*ans)
    return




n = RN()
a = RA()
solve()

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
all_xor = a[0]
for j in range(1, len(a)):
    all_xor = all_xor ^ a[j]
answer = [0] * N
for i in range(N):
    answer[i] = all_xor ^ a[i]
    
print(' '.join(map(str, answer)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import numpy as np
input = sys.stdin.readline
n=int(input())
A =  list(map(int,input().split()))
B = []
ans = A[0]
for i in range(1,n):
    ans = ans ^ A[i]


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

Submission status: Accepted

Solution code:
n = int(input())
a_li = [int(w) for w in input().split()]

S = a_li[0]
for a in a_li[1:]:
    S ^= a

for a in a_li:
    print(a ^ S, end=" ")

Submission status: Accepted

Solution code:
#Red Scarf
N = int(input())
A = list(map(int, input().split()))
output = list()

axor = A[0]
for i in range(1,N):
    axor ^= A[i]

for i in range(N):
    output.append(axor^A[i])
print(*output)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

for i in a:
    t^=i

for i in a:
    print(t^i,end=" ")

Submission status: Accepted

Solution code:
import sys
from functools import reduce
from operator import xor
readline = sys.stdin.buffer.readline

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

s = reduce(xor, a[1:], a[0])
# print(s)
b = tuple(str(s ^ v) for v in a)
print(' '.join(b))

Submission status: Accepted

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

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

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

    print(*ans)


if __name__ == '__main__':
	main()

exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
a=map(int,input().split())
a=[int(b) for b in a]
answers=[]
answer=a[0]
for n in range(1,N):
    answer=answer^a[n]
for a_ in a:
    answers.append(answer^a_)
print(*answers)

Submission status: Accepted

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

S = 0
for a in A:
    S = S ^ a
ans = [str(S^a) for a in A]
s = " ".join(ans)
print(s)

Submission status: Accepted

Solution code:
n = int(input())
cats = list(map(int, input().split()))
key = cats[0]
for c in cats[1:]:
    key ^= c

res = []
for c in cats:
    res.append(str(c ^ key))
print(' '.join(res))

Submission status: Accepted

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

Submission status: Accepted

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

tmp = 0
for item in ai:
    tmp = tmp ^ item
for item in ai:
    print(item ^ tmp, end=" ")

Submission status: Accepted

Solution code:
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))


# https://atcoder.jp/contests/abc171/tasks/abc171_e
def solve(n, a):
    xor = a[0]
    for item in a[1:]:
        xor ^= item

    return map(lambda x: xor ^ x, a)


if __name__ == "__main__":
    n = int_in()
    a = arr_in()
    arr_out(solve(n, a))