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:
def resolve():
    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__":
    resolve()

Submission status: Accepted

Solution code:
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

tot = 0
for i in A:
    tot ^=  i

for i in A:
    print(tot ^ i, sep = " ")

Submission status: Accepted

Solution code:
from math import log2
N = int(input())
a = list(map(int, input().split()))
Maxa = max(a)
if(Maxa == 0):
  for i in range(N):
    print(0, end = " ")
else:
  J = int(log2(Maxa)) + 1
  A = [format(x, 'b').zfill(J) for x in a]
  S = [0] * J
  for j in range(J):
    for i in range(N):
      S[j] += int(A[i][j])
    S[j] %= 2

  X = [""] * N
  for i in range(N):
    for j in range(J):
      X[i] += str(int((int(A[i][j]) != S[j])))
    print(int(X[i], 2), end = " ")

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    a = list(map(int, input().split(" ")))
    all = 0
    for ele in a:
        all ^= ele
    for ele in a:
        print(all ^ ele,end = " ")
    print()



if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans = []
for i in range(n):
  ans.append(str(x^l[i]))
  
print(' '.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor
N = int(input())
A = list(map(int, input().split()))

XorA = reduce(xor, A)

B = []
for a in A:
    B.append(XorA ^ a)

print(*B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
Created on 2020/09/03

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=int(pin())
  a=list(map(int,pin().split()))
  s=0
  for i in a:
    s=s^i 
  ansl=[]
  for j in a:
    ansl.append(str(s^j))
  ans=" ".join(ansl)
  print(ans)
  return 
main()

Submission status: Accepted

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

for i in range(n):
    print(sub ^ a[i],end = ' ')

Submission status: Accepted

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

Submission status: Accepted

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

X=[]
b=a[0]
for i in range(1,n) :
    b^=a[i]

for i in range(n) :
    x=b^a[i]
    X.append(x)

for i in X :
    print(i,end=" ")

Submission status: Accepted

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

Submission status: Accepted

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

all_xor = a[0]

for i in range(1,n):
  all_xor = all_xor ^ a[i]
  
ans = [a[i] ^ all_xor for i in range(n)]

for i in range(n):
  print(ans[i],end=' ')

Submission status: Accepted

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, As):
    all_xor = 0
    for A in As:
        all_xor ^= A
    ans = ''
    for A in As:
        ans += str(A ^ all_xor) + ' '
    print(ans[:-1])


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, As)

Submission status: Accepted

Solution code:
import array
from functools import reduce
from operator import xor

N = int(input())
A = array.array("L", map(int, input().split()))

Q = array.array("L", [0]) * N

R = reduce(xor, A)
for i in range(N):
    print(R^A[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int( input() )
a = list( map(int, input().split()) )
x = 0
for i in a:
    x ^= i
print( * list( map( lambda y: x^y , a ) ) )

Submission status: Accepted

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

def main():
    n = int( input() )
    input_a = list ( map( int, input().split() ) )
    a = deque( input_a )

    while( len(a) != 1 ):
        x = a.popleft()
        y = a.popleft()
        z = x ^ y
        a.append(z)
    sum = a.popleft()
    ans = []
    for i in input_a:
        x = i ^ sum
        ans.append(x)

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



main()

Submission status: Accepted

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

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

Submission status: Accepted

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

t = lis[0]
for i in range(1, n):
    t ^= lis[i]

ans = [0] * n
for i , j in enumerate(lis):
    ans[i] = t ^ j

print(*ans)

Submission status: Accepted

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

Submission status: Accepted

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

s = a[0]
for i in a[1:]:
  s ^= i

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

print(*ans)

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))
x = 0
for i in arr:
	x ^= i
print(*(list(map(lambda y: x ^ y, arr))))

Submission status: Accepted

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

for i in a:
  x=s^i
  ans+=str(x)
  ans+=' '

print(ans[:-1])

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    xor_all = A[0]
    
    for i in range(1, N):
        xor_all ^= A[i]

    for i in range(N):
        if i != N - 1:
            print(A[i]^xor_all, end=" ")
        else:
            print(A[i]^xor_all)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
aa=0
for i in A:
	aa^=i
ans=[0]*n
for i in range(n):
	ans[i]=aa^A[i]
print(' '.join(map(str,ans)))

Submission status: Accepted

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

Submission status: Accepted

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

# form bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter
# import numpy as np


def solve(N: int, A: "List[int]"):
    total = 0
    for a in A:
        total ^= a
    return [total ^ a for a in A]


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    # N, a = map(int, line.split())
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    ans = solve(N, A)
    print(" ".join([str(a) for a in ans]))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#import numpy as np
N = int(input())
a = list(map(int, input().split()))
all_xor = 0
for _a in a:
    all_xor = all_xor ^ _a
for _a in a:
    print(all_xor ^ _a)

Submission status: Accepted

Solution code:
#排他的論理和 x^y
n=int(input())
a=list(map(int,input().split()))
k=0
for i in range(0,n-1,2):
  k=k^a[i]^a[i+1]

for i in range(n):
  print(k^a[i],end=" ")

Submission status: Accepted

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

    scarf_0 = 0
    for a in A[1:]:
        scarf_0 ^= a
    
    scarf_all = scarf_0 ^ A[0]
    
    ans = [scarf_all^a for a in A]
    
    print(*ans, sep=" ")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor

# via https://drken1215.hatenablog.com/entry/2020/06/22/122500

N, *A = map(int, open(0).read().split())
B = reduce(xor, A)
print(*map(lambda a: B^a, A))

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor

N, *A = map(int, open(0).read().split())
B = reduce(xor, A)
print(*map(lambda a: B^a, A))

Submission status: Accepted

Solution code:
N = int(input())
a = [int(s) for s in input().split()]
b = a[0]
c = []
for i in range(1,N):
  b = b ^ a[i]

for i in range(N):
  c.append(str(b ^ a[i]))
 
d = ' '.join(c)

print(d)

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
a = LI()

b = 0
for i in range(N):
    b ^= a[i]

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

Submission status: Accepted

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

ans = 0
for a in A:
    ans ^= a
#print(ans)
for a in A:
  	print(ans^a)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

all = 0
for a_i in A:
    all ^= a_i

ans = []
for a_i in A:
    ans.append(all ^ a_i)

print(*ans)

Submission status: Accepted

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

xor_base = A[0]
for a in A[1:]:
    xor_base ^= a

result = []
for a in A:
    result.append(a ^ xor_base)

print(*result)

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 j in range(n):
    tmp = s^a[j]
    ans.append(tmp)

print(*ans)

Submission status: Accepted

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

Submission status: Accepted

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

t = 0
for c in A:
    t ^= c

ans = []
for b in A:
    ans.append(t^b)

print(*ans)

Submission status: Accepted

Solution code:
def main():
   n = int(input())
   a = list(map(int,input().split()))
   b = [0 for i in range(n)]
   c = 0
   for i in range(n):
       c ^= a[i]
   for i in range(n):
       b[i] = c ^ a[i]
   for i in range(n):
       if i == n - 1:
           print(b[i])
       else:
           print(b[i], end = ' ')
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

ALL = 0
for a in As:
    ALL ^= a
ans = [ALL^a for a in As]
print(*ans)

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 range(N):
    print(x^A[i], end=" ")

Submission status: Accepted

Solution code:
N = int(input())

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

ans = A[0]

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

memo = []

for i in range(N):
    memo.append(ans ^ A[i])

print(*memo)

Submission status: Accepted

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

Submission status: Accepted

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


ans = []
for a in al:
    v = asum^a
    ans.append(v)

print(*ans)

Submission status: Accepted

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

a = 0

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

ans = []
for i in range(n):
    ans.append(a ^ arr[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 = X^A[i]
ans = []
for i in range(N):
  temp = X^A[i]
  ans.append(temp)
print(*ans)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
now = a[0]
for i in range(1,n):
    now ^= a[i]
for i in range(n):
    print(now ^ a[i])

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()
a = LI()

b = 0
for i in range(N):
    b ^= a[i]

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

Submission status: Accepted

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

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

ans = [0]*n
for j in range(n):
  ans[j] = s ^ a[j]

print(*ans)

Submission status: Accepted

Solution code:
N = int(input())

P = 0

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

for i in range(N):
    P = P ^ A[i]

ans = [A[i] ^ P for i in range(N)]

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
sum_xor = A[0]

for i in range(1,N):
  sum_xor ^= A[i]
  
for j in range(N):
  print(sum_xor ^ A[j], end=" ")

Submission status: Accepted

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

M = [0] * N
S = 0
for i in range(N):
    S = S^A[i]

for i in range(N):
    M[i] = S^A[i]

print(*M)

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
m = reduce(lambda a, b: a^b, A)
l = list(map(str, [a ^ m for a in A]))
ans = ' '.join(l)
print(ans)

Submission status: Accepted

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

print(*ans)

Submission status: Accepted

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

input = sys.stdin.readline

N = int(input())
a = list(map(int, input().split()))
s = reduce(xor, a)
print(' '.join([str(xor(s, i)) for i in a]))

Submission status: Accepted

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

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

    s = 0
    for i in a:
        s ^= i
    
    for i in a:
        ans = s ^ i
        print(ans, sep=' ', end=' ')

main()

Submission status: Accepted

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

def solve():
    """
    スカーフをそれぞれs[1]...s[N]とする
    Nは偶数より、
    必ず a[1]^...^a[N] = s[1]^...^s[N] (=Sと置く) になる。

    よって、s[1]が求めたかったら、s[1] = S ^ a[1]で求められる。
    """
    import sys
    N = int(sys.stdin.readline())
    As = list(map(int, sys.stdin.readline().split()))

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

    # 答え
    anss = []
    for i in range(N):
        anss.append(str(S^As[i]))

    ans = " ".join(anss)
    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

pop=0 #xorのpopにする
while(xor >> pop >=1):
    pop += 1

sum_xor=xor #各猫の排他的論理和

ans=[]
for i in a:
    x=i^sum_xor
    ans.append(x)

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

Submission status: Accepted

Solution code:
from functools import reduce
n=int(input())
A=list(map(int, input().split()))
sumxor=reduce(lambda x,y:x^y,A)
for AA in A:
  print(sumxor ^ AA)

Submission status: Accepted

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

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

ans = []
for i in a:
    ans.append(b ^ i)
print(" ".join(map(str, ans)))

Submission status: Accepted

Solution code:
N = int(input())
a_list = list(map(int, input().split()))
all_xor = 0
res = []

for a in a_list:
    all_xor ^= a

for a in a_list:
    res.append(a ^ all_xor)

print(*res)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    a = list(map(int, input().split()))
 
    total = 0
    for other in a:
        total ^= other
 
    print(*[(other ^ total) for other in a])
 
 
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = A[0]
for i in range(1, N):
    B = B ^ A[i]
#print(B)
for j in A:
    print(B ^ j)

Submission status: Accepted

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

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(a ^ x)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = [0 for _ in range(N//2)]
for i in range(0,N,2):
    B[i//2] = A[i]^A[i+1]
tot = 0
for i in range(N//2):
    tot = tot^B[i]
X = [0 for _ in range(N)]
for i in range(N//2):
    y = tot^B[i]
    X[2*i]=A[2*i+1]^y
    X[2*i+1]=A[2*i]^y
print(*X)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())
    allxor = a[0]
    for ae in a[1:]:
        allxor = allxor ^ ae
    for ae in a:
        print(allxor ^ ae, end = ' ')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

l = [all_fav_num_xor ^ a for a in A]

print(*l)

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = []
for i in A:
    tmp = s
    tmp ^= i
    ans.append(tmp)
print(*ans)

Submission status: Accepted

Solution code:
# N%2 == 0
# 2 < N < 2 * 10**5
# 全員のxorは全部足せば求まる?
# 1100のとき、0, 100の時1 0100のとき1, 100の時1
# 100, 100, 110, 110は1, 1, 0, 0

# 1110のとき1
# 110 0, 110 0, 110 0, 111 1
# 1がN, 0がMなら(N-1)個1があるのがN個、(N)個1があるのがM個
# N^2 - N + N*M Nが奇数ならかならず奇数(1) Nが偶数なら必ず偶数(0)
# 自分が1なら偶奇が変わる
# 自分が0なら偶奇は変わらない
# Nが奇数ならMが偶数なら1, Mが奇数なら0

#100なら全体で1
# 10は1, 10は1, 00は0
# 110なら全体で0
# 11 0, 10 1, 10 1

# 奇数回でた箇所と偶数回出た箇所がわかる
N = int(input())
a = [int(i) for i in input().split()]
p = 0b0
for i in range(N):
    p = p ^ a[i]
for i in range(N):
    print(p^a[i])

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
    print(now^A[i], end=" ")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    total = 0
    for a in A:
        total ^= a
    ans = []
    for a in A:
        ans.append(total^a)
    return ans
print(*solve())

Submission status: Accepted

Solution code:
def abc171_e():
    n = int(input())
    A = list(map(int, input().split()))
    cum = 0
    for a in A:
        cum ^= a
    B = [0] * n
    for i, a in enumerate(A):
        B[i] = cum ^ a
    print(*B, sep=' ')

if __name__ == '__main__':
    abc171_e()

Submission status: Accepted

Solution code:
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
b = 0
for x in a:
    b ^= x
ans = []
for x in a:
    ans.append(b^x)
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

for i in range(N):
    a = a^A[i]

for i in range(N):
    print(a^A[i], end=" ")

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

from functools import reduce

def main():
  n = int(input())
  la = list(map(int, input().strip().split()))
  x = reduce(lambda x, y: x ^ y, la)
  print(' '.join([str(x ^ a) for a in la]))

if __name__=='__main__':
  main()

Submission status: Accepted

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

sumxor = 0
for a in aaa:
    sumxor = sumxor^a
bbb = [a^sumxor for a in aaa]
print(" ".join([str(b) for b in bbb]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

b = [0]*N

xorsum = 0
for i in range(1,N):
    b[i] = b[i-1] ^ a[i-1] ^ a[i]
    xorsum = xorsum ^ b[i]

b[0] = xorsum ^ a[0]

for i in range(1,N):
    b[i] = b[i-1] ^ a[i-1] ^ a[i]

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

Submission status: Accepted

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

all_xor=a[0]
for i in range(1,N):
    all_xor=all_xor^a[i]
    
ans=[all_xor^a[i] for i in range(N)]
print(' '.join(list(map(str,ans))))

Submission status: Accepted

Solution code:
N=int(input())
L=list(map(int,input().split()))
s=0
R=list()
for i in range(N):
  s=s^L[i]
for i in range(N):
  R.append(str(s^L[i]))
print(" ".join(R))

Submission status: Accepted

Solution code:
# import sys
# input = sys.stdin.readline
import itertools
import collections
from decimal import Decimal
from functools import reduce


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    n = int(input())
    numbers = input_list()
    ans = []
    s = reduce(lambda a, b: a ^ b, numbers)
    for i in range(n):
        ans.append(s ^ numbers[i])
    print(*ans)


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def bfs(H, W, black_cells, dist):
    d = 0
    while black_cells:
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:
                dist[new_h][new_w] = d + 1
                black_cells.append((new_h, new_w))
    return d


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans = []
for i in range(N):
    s = val ^ A[i]
    ans.append(s)

print(*ans)

Submission status: Accepted

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

sum_A = 0
for item in A:
  sum_A ^= item

ans = [str(sum_A ^ item) for item in A]
print(" ".join(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 j in range(n):
    print(x^a[j],end=" ")

Submission status: Accepted

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

Submission status: Accepted

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

s=a[0]
for i in range(1,n):
    s^=a[i]
ans=[]
for i in range(n):
    ans.append(s^a[i])
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
S = A[0]
for i in range(1,N):
    S = S^A[i]
B = []
for j in range(N):
    B.append(str(S^A[j]))
print(' '.join(B))