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:
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===
def main():
    n = ni()
    a = na()

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

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

    print(*ans, sep=" ")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    A = [int(x) for x in input().strip().split()]
    X = 0
    for a in A:
        X ^= a
    B = [0] * N
    for i, a in enumerate(A):
        B[i] = X ^ a
    print(*B)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

print(*ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  # log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


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


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    N = I()
    a = LI()
    ans = a[0]
    for i in range(1,N):
        ans ^= a[i]
    ansl = []
    for i in a:
        ansl.append(i^ans)
    print(" ".join(map(str, ansl)))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

n = onem()

a = l()

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

Submission status: Accepted

Solution code:
import collections
FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
 
    
    

    
N = rri()
arr = rrm()
a = arr[0]
for i in range(1, N):
    a^=arr[i]
ans = []
for i in range(N):
    ans.append(str(a^arr[i]))
print(" ".join(ans))

Submission status: Accepted

Solution code:
from collections import Counter, defaultdict
# for use in beginner level contests where speed is key

_ = int(input())

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

cnt = 0
for a in lst:
    cnt = cnt^a

res = []
for a in lst:
    res.append(str(cnt^a))

print(" ".join(res))

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys
input = sys.stdin.readline
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

n = inp()
x = ip()
ans = [0]*n
no = x[0]
for i in range(1,n):
    no = x[i]^no
for i in range(n):
    ans[i] = x[i]^no
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
Ali = list(map(int,input().split()))
s = 0

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

Submission status: Accepted

Solution code:
import sys

def read_int():
    l = sys.stdin.readline().rstrip('\n').split(' ')
    return int(l[0])

def read_int_list():
    l = sys.stdin.readline().rstrip('\n').split(' ')
    return [int(i) for i in l]

N = read_int()
A = read_int_list()

all_xor = 0                                                                                           

for a in A:                                                                                           
    all_xor ^= a                                                                                      

for a in A:                                                                                           
    print(all_xor ^ a)

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N = int(input())
    A = read_list()

    S = 0
    for a in A:
        S ^= a
    
    res = [S ^ a for a in A]

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=list(map(int,input().split()))
    
    allX=0
    for a in A:
        allX^=a
    for i in range(N):
        print(allX^A[i] ,end=" ")
    
    
    
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = inl()
x = 0
for i in range(n):
    x ^= a[i]
pad = ''
for i in range(n):
    printn(pad+str(x^a[i]))
    pad = ' '
print('')

Submission status: Accepted

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

S = 0

for i in range(N):
    S ^= A[i]
res = []
for i in range(N):
    res.append(S ^ A[i])
print(*res)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0:
    x = 0
    for i in a:
        x ^= i
    for i in a:
        print(x ^ i)
else:
    p = []
    x = 0
    for i in a[:n - 1]:
        x ^= i
    for i in a[:n - 1]:
        p.append(x ^ i)
    x = a[0]
    for i in p[1:]:
        x ^= i
    p.append(x)
    print(*p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce

N = int(input())
*a, = map(int, input().split())
v = reduce(lambda x,y:x^y, a)
ans = []
for i in a:
    ans.append(v^i)
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
l=list(map(int,input().split()))
s=0
for j in range(len(l)):
	s=s^l[j]
for j in range(len(l)):
	print(s^l[j],end=" ")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n = inp()
    a = inpl()
    x = 0
    for i in range(n):
        x = x^a[i]
    ans = [x^a[i] for i in range(n)]
    print(*ans)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    a = [int(i) for i in ipt().split()]
    sxr = 0
    for i in a:
        sxr = sxr^i
    ans = []
    for i in a:
        ans.append(str(i^sxr))
    print(" ".join(ans))

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def solve():
    N = int(readline())
    A = list(map(int, readline().split()))

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

solve()

Submission status: Accepted

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


x = 0
for a in A:
    x ^= a
ans = [x ^ a for a in A]

print(*ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# %%time
# import numpy as np
n = int(input())
a = list(map(int, input().split()))

# n = 2 * 10 ** 5
# a = np.random.randint(0, 10**9, n)

x = a[0]
for k in range(n - 1):
    x = x ^ a[k + 1]

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

Submission status: Accepted

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

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

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

print(' '.join([str(a^xor) for a in A]))

Submission status: Accepted

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

def solve(A):
    x = 0
    for a in A:
        x ^= a
    print(*[x ^ a for a in A])

solve(A)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
A = list(map(int,input().split()))
ans = []
All = A[0]
for i in range(1,N):
    All = All ^ A[i]
for i in range(N):
    a = All ^ A[i]
    ans.append(a)
print(*ans)

Submission status: Accepted

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

al = 0
for aa in a:
    al=al^aa
    
ans=[aa^al for aa in a]
print(*ans)

Submission status: Accepted

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

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

print(" ".join(ans))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    T = 0
    for a in A:
        T ^= a
    return [T ^ a for a in A]

print(*main())

Submission status: Accepted

Solution code:
import os
import sys
from io import BytesIO, IOBase

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

def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7


Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

n = int(ri())
a = Ri()

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

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

print(*ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    r = 0
    l = []
    for i in A:
        r ^= i
    for i in A:
        l.append(r^i)
    print(' '.join([str(i) for i in l]))
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    a = list(map(int, input().split()))
    L = [0]*(N+1)
    R = [0]*(N+1)
    for i in range(N):
        L[i+1] = L[i]^a[i]
        R[N-i-1] = R[N-i]^a[N-i-1]
    ans = [None]*N
    for i in range(N):
        ans[i] = L[i]^R[i+1]
    print(*ans)
    # print(L,R)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
pari = [0] * 30
for i in range(30):
    for j in a:
        pari[i] += (j&(1<<i))>>i

ans = a[:]

for i in range(30):
    if pari[i]%2:
        for j in range(n):
            if a[j]&(1<<i):
                ans[j] -= 1<<i
            else:
                ans[j] += 1<<i

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque
import math

# import copy
# from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 998244353

def solve():
    n = getN()
    nums = getList()
    xors = [[] for i in range(31)]
    for num in nums:
        for i in range(31):
            if num % 2 == 1:
                xors[i].append(1)
            else:
                xors[i].append(0)

            num //= 2
    # for xor in xors:
        # print(xor)

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

    for digit, xo in enumerate(xors):
        if sum(xo) % 2 == 0:
            # even
            for i, x in enumerate(xo):
                if x == 1:
                    ans[i] += 2 ** digit

        else:
            # odd
            for i, x in enumerate(xo):
                if x == 0:
                    ans[i] += 2 ** digit


    print(*ans)
def main():
    n = getN()
    for _ in range(n):
        solve()


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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())
    total = 0
    for a in A:
        total ^= a

    for a in A:
        print(a ^ total)

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

ans=[v^S for v in A]
print(" ".join(map(str,ans)))

Submission status: Accepted

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

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

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

#temp = ((26^5)^7)^22
#print(temp)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
b = a[0]
for i in a[1:]:
    b ^= i
ans = []
for i in a:
    ans.append(b^i)
print(*ans)

Submission status: Accepted

Solution code:
# itne me hi thakk gaye?
n = int(input())
arr = list(map(int, input().split()))
m = 0
for i in arr:
    m = m^i
b = []
for i in arr:
    b.append(m^i)
print(*b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

A = list(map(int, input().split()))
key = 0
for a in A:
    key ^= a
ans = []
for a in A:
    ans.append(a^key)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

N=int(sys.stdin.readline())

A=[int(i) for i in sys.stdin.readline().split()]

ans=[0]*N

total=0

for x in range(N):
	total^=A[x]

for y in range(N):
	ans[y]=str(total^A[y])

print(" ".join(ans))

Submission status: Accepted

Solution code:
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')



n=ii()
a=li()
x=0
for i in a:
    x^=i
    
ans=[]
for i in range(n):
    ans.append(x^a[i])
print(*ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = tuple([int(t)for t in input().split()])

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

    ans = []
    for a_i in a:
        ans.append(base^a_i)

    print(*ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

xor_left = [0]
for a in A:
    xor_left.append(xor_left[-1] ^ a)
xor_left.append(0)

xor_right = [0]
for a in A[::-1]:
    xor_right.append(xor_right[-1] ^ a)
xor_right.append(0)
xor_right = xor_right[::-1]

ans = []
for i in range(1, N + 1):
    ans.append(xor_left[i - 1] ^ xor_right[i + 1])
print(*ans, sep=' ')

Submission status: Accepted

Solution code:
from functools import *
from operator import *

N = int(input())
a = list(map(int, input().split()))
total = reduce(xor, a, 0)

print(" ".join(list(map(lambda ai: str(ai^total), a))))

Submission status: Accepted

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

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

out = []
for v in a:
   ans = base ^ v
   out.append(str(ans))
print(" ".join(out))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve(n, a_list):
    s = 0
    for i in range(n):
        a = a_list[i]
        s = s ^ a
    res_list = []
    for i in range(n):
        a = a_list[i]
        res_list.append(str(s ^ a))
    # print(res_list)
    return " ".join(res_list)


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    res = solve(n, a_list)
    print(res)


def test():
    assert solve(4, [20, 11, 9, 24]) == "26 5 7 22"


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
start = a[0]
for i in range(1, n):
    start = start ^ a[i]
ans = []
for i in range(n):
    ans_i = start ^ a[i]
    ans.append(str(ans_i))
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=X^a[i]
print(*[X^a[i] for i in range(N)])

Submission status: Accepted

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

S = As[0]
for a in As[1:]:
    S^=a
# print(S)
ans = [S^a for a in As]
print(*ans)

Submission status: Accepted

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

for a in A:
    print(a ^ res)

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:
    ans.append(s^i)

print (*ans)

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

# print(a[1]^a[2]^a[3])
ans=0
for i in range(n):
    ans^=a[i]
# print(ans)

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

Submission status: Accepted

Solution code:
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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

#処理内容
def main():
	N = int(input())
	A = getlist()
	XOR = 0
	for i in range(N):
		XOR = XOR ^ A[i]


	ans = [None] * N
	for i in range(N):
		ans[i] = XOR ^ A[i]

	print(*ans)


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor

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

s = reduce(xor, A)
print(*((s^a) for a in A))

Submission status: Accepted

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

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

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

print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin


def ni(): return int(ns())


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


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N = ni()
A_array = na()

A = 0

for a in A_array:
    A = A ^ a

ans_array = [A ^ a for a in A_array]

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    s=0
    n=II()
    aa=LI()
    for a in aa:s^=a
    ans=[]
    for a in aa:ans.append(a^s)
    print(*ans)

main()

Submission status: Accepted

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


if __name__ == '__main__':
    main()