Problem:


Score : 500 points

Problem Statement

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

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

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

What is xor?

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

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

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

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

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

Constraints

All values in input are integers.

2 \leq N \leq 200000

N is even.

0 \leq a_i \leq 10^9

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

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 \ldots a_N

Output

Print a line containing N integers separated with space.

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

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

Sample Input 1

4
20 11 9 24

Sample Output 1

26 5 7 22

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

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

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

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

Thus, this output is consistent with the given information.



Sample input:
4
20 11 9 24


Sample output:
26 5 7 22

Submission status: Accepted

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

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import Fraction               # Fraction(a, b) => a / b ∈ Q. note: Fraction(0.1) do not returns Fraciton(1, 10). Fraction('0.1') returns Fraction(1, 10)
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79e+308
    # inf = 2 ** 63 - 1             # (for fast JIT compile in PyPy) 9.22e+18
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def isp():   return input().split()
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    def solve(n, L):
        # if n == 2:
        #     return list(reversed(L))
        # else:
        #     ans = [0] * n
        #     for i in range(n):
        #         num = L[i] ^ (L[(i+1) % n] ^ L[(i+2) % n])
        #         ans[(i-1) % n] = num
        #         # print(ans)
        #     return ans
        ans = [0] * n
        total = 0
        for i in range(n):
            total ^= L[i]
        for i in range(n):
            ans[i] = L[i] ^ total
        return ans

    
    # def check(n, L, seq):
    #     for i in range(n):
    #         x = 0
    #         for j in range(n):
    #             if j != i:
    #                 x ^= seq[j]
    #         if L[i] != x:
    #             return False
    #     return True


    # from random import randint
    # def debug_search():
    #     for n in range(2, 10, 2):
    #         for _ in range(5):
    #             L = [randint(0, 100) for _ in range(n)]
    #             seq = solve(n, L)
    #             if not check(n, L, seq):
    #                 print(f'found! n: {n} L: {L} generated: {seq}')
        
    

    n = ii()
    L = lmi()
    seq = solve(n, L)
    print(*seq, sep=' ')
    
    # debugging
    # debug_search()



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, = map(int, input().split())
X = list(map(int, input().split()))
t=0
for x in X:
    t=x^t
R=[]
for x in X:
    R.append(x^t)
print(*R)

Submission status: Accepted

Solution code:
N = int(input())

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


# A_sum = sum(A)
A_sum = 0
for ai in A:
    A_sum ^= ai

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# E - Red Scarf
from functools import reduce
from operator import xor


def main():
    _, *A = map(int, open(0).read().split())
    total_xor = reduce(xor, A)
    res = [a ^ total_xor for a in A]
    print(" ".join(map(str, res)))


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(1,n):
    S ^=A[i]
b = [S^a  for a in A]
print(*b)

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

N = i()
a = l()
A = 0
for i in range(N):
    A = A^a[i]
bit = bin(A)[2:]
n = len(bit)
bits = []
for i in range(N):
    bits.append(bin(a[i])[2:])
ans = []
maxlen = len(bin(max(a))[2:])
bit = list(bit.zfill(maxlen))[::-1]
for i in range(N):
    b = list(bits[i].zfill(maxlen))[::-1]
    num = 0
    for j in range(maxlen):
        if bit[j] != b[j]:
            num += 2**j
    ans.append(num)
print(*ans)

Submission status: Accepted

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

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

# print(p)

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

print(' '.join(ans))

Submission status: Accepted

Solution code:
n=int(input())
a_list=list(map(int,input().split()))
count=0
for i in a_list :
  count=count^i
list1=[]
for i in a_list :
  list1.append(count^i)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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 A:
    print(s^i,end=" ")
print("\n")

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

Submission status: Accepted

Solution code:
import sys

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

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()
    a = list(in_nn())

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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

l = []

for a in A:
  ans = a^num
  l.append(ans)
print(*l)

Submission status: Accepted

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

# xorの性質を使う
# すべての値のxorを求める
x_sum = 0
for i in range(len(a)):
    x_sum ^= a[i]
# すべての値のxorと自分以外のxorから自分を求める
ans = []
for i in a:
    ans.append(x_sum ^ i)

for i in ans:
    print(i)

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]

num = []
for i in range(N):
    num.append(S ^ a[i])

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

Submission status: Accepted

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

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

ans=[0]*N
i=0
while i<N:
    ans[i]=All_Xor^A[i]
    i+=1

print(*ans)

Submission status: Accepted

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

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

s = A[0]

for a in A[1:]:
    s ^= a

ret = []

for a in A:
    ret.append(s^a)

print(*ret)

Submission status: Accepted

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

x_sum = a[0]
for i in range(1,len(a)):
    x_sum ^= a[i]

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

for i in ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = tuple(map(int, input().split()))
    ar = a[0]
    for i1 in range(1, n):
        ar ^=  a[i1]
    res = []
    for i1 in range(n):
        rt = ar ^ a[i1]
        res.append(rt)
    print(*res)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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(s^i,end=" ")

Submission status: Accepted

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

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

answer = ''
for a in a_int:
    answer += str(all_xor ^ a) + ' '

print(answer)

Submission status: Accepted

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

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

ans = list(map(lambda x: x ^ S, A))

print(*ans)

Submission status: Accepted

Solution code:
"""
~~ Author : Bhaskar
~~ Dated : 10~06~2020
"""

import sys
from bisect import *
from math import floor,sqrt,ceil,factorial as F,gcd,pi
from itertools import chain,combinations,permutations,accumulate
from collections import Counter,defaultdict,OrderedDict,deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
mod = 1000000007
ch = "abcdefghijklmnopqrstuvwxyz"
lcm = lambda a,b : (a*b)//gcd(a,b)
setbit = lambda x : bin(x)[2:].count("1")
input = lambda : sys.stdin.readline()

def solve():
    n = int(sys.stdin.readline())
    a = list(map(int, sys.stdin.readline().split()))
    s = 0
    for i in a:
        s ^= i
    for i in a:
        print(s^i,end = " ")
    print()



if __name__ == "__main__":
    try:
        sys.stdin = open('input.txt','r')
        sys.stdout = open('output.txt','w')
    except:
       pass
    solve()

Submission status: Accepted

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

a = arr[0]
for i in range(1, len(arr)):
    a ^= arr[i]


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

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(s^i)

Submission status: Accepted

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

S = reduce(xor, A)
ans = []
for a in A:
  ans.append(S^a)
print(' '.join(map(str, ans)))

Submission status: Accepted

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

s = 0
for i in lis:
    s = s^i
lis = list(map(lambda x: str(s^x), lis))
st = ' '.join(lis)
print(st)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(' '.join([str(s ^ i) for i in a]))

Submission status: Accepted

Solution code:
n = int(input().rstrip())

line = input().rstrip().split(' ')
a = []
for i in range(n):
    a.append(int(line[i]))

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

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

print()

Submission status: Accepted

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

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

ans=[0]*n
for i in range(n):
    ans[i]=c^a[i]
L=[str(a) for a in ans]
L=" ".join(L)
print(L)

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

Submission status: Accepted

Solution code:
import numpy as np
import math
import collections
import bisect
import itertools
from collections import Counter

suf_xor_dict = {}
pre_xor_dict = {}


def suf_xor(N, p):
    # print(p)
    global xor_dict
    if N - len(p) + 1 in suf_xor_dict:
        return suf_xor_dict[N - len(p) + 1]

    if len(p) == 0:
        return 0
    if len(p) == 1:
        suf_xor_dict[N] = p[0]
        return p[0]
    if len(p) == 2:
        suf_xor_dict[N] = p[1]
        suf_xor_dict[N - 1] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[0] ^ suf_xor(N, p[1:])
        suf_xor_dict[N - len(p) + 1] = ret
        return ret


def pre_xor(N, p):
    global pre_xor_dict
    if len(p) in pre_xor_dict:
        return pre_xor_dict[len(p)]

    if len(p) == 0:
        return 0
    if len(p) == 1:
        pre_xor_dict[1] = p[0]
        return p[0]
    if len(p) == 2:
        pre_xor_dict[1] = p[0]
        pre_xor_dict[2] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[-1] ^ pre_xor(N, p[:-1])
        pre_xor_dict[len(p)] = ret
        return ret


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

    pre_xor_list = pre_xor_list[1:]
    suf_xor_list = suf_xor_list[1:]

    for i in range(N):
        ans.append((0 if i - 1 < 0 else pre_xor_list[i - 1]) ^ (0 if i >= N - 1 else suf_xor_list[N - i - 2]))

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(N):
    B[i]=A[i]^ALL
B=map(str,B)
print(" ".join(B))

Submission status: Accepted

Solution code:
def main():
    _ = int(input())
    a = tuple(map(int, input().split()))

    res = 0
    for i in a:
        res ^= i
    ans = tuple(res ^ i for i in a)
    print(*ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

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

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
x = 0
ans=[]
for a in A:
    x ^= a
for i in A:
    ans.append(x^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 = [A^x for x in a]
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n-1):
    s = s ^ li[i+1]

for i in li:
    ans.append(s ^ i)

print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    _ = int(input())
    a = tuple(map(int, input().split()))

    res = 0
    for i in a:
        res ^= i
    ans = [res ^ i for i in a]
    print(*ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(n):
    s=s^a[i]
ans=[0]*n
for i in range(n):
    ans[i]=a[i]^s
print(*ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import reduce
from operator import xor, add


def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def solve(N, A):
    S = reduce(xor, A)
    for a in A:
        print(S ^ a, end=" ")


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Submission status: Accepted

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

    res = 0
    for i in a:
        res ^= i
    ans = [res ^ i for i in a]
    print(*ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from functools import reduce
from operator import xor

N = int(input())
AS = list(map(int, input().split()))
total = reduce(xor, AS)
print(*[a ^ total for a in AS])

Submission status: Accepted

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

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

B = [0]*N

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

Submission status: Accepted

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

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

All = ans[0]^A[0]

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

for i in range(N):
    print(ans[i])

Submission status: Accepted

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

for i in range(2, N):
    counter = counter^a[i]

for i in range(N):
    answer.append(counter^a[i])

test = map(str, answer)

result = ' '.join(test)
print(result)

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]

l = []
for i in range(N):
    l.append(x ^ A[i])
print(" ".join(map(str, l)))

Submission status: Accepted

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

r = []
for e in a:
  r.append(e^x)
print(*r, sep=" ")

Submission status: Accepted

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

Submission status: Accepted

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

xor = a[0] ^ a[1]
for i in range(2, n):
    xor ^= a[i]
    #print(bin(xor))
for i in range(n):
    print(xor ^ a[i], end=' ')

Submission status: Accepted

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

Submission status: Accepted

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

sumAll = 0

for aa in a:
  sumAll ^= aa

for aa in a:
  print(sumAll^aa, end=" ")

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    N = int(input())
    aa = list(map(int,input().split()))
    S = aa[0]
    for a in aa[1::]:
        S ^= a
    ans = []
    for a in aa:
        ans.append(str(S ^ a))
    print(" ".join(ans))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.buffer.readline


def solver(A):
    c = 0
    for a in A:
        c ^= a

    ans = [a ^ c for a in A]
    return ans


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

    ans = solver(A)

    print(*ans)


run()

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 a:
    ans.append(S^i)
print(*ans, sep="\n")

Submission status: Accepted

Solution code:
from functools import reduce


def main():
    _ = int(input())
    a = tuple(map(int, input().split()))

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


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 = []

for a in A:
	ans += [str(a ^ s)]
print(' ' .join(ans))

Submission status: Accepted

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

ans = [0 for _ in range(N)]

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

ans = [a ^ c for a in A]

print(*ans)

Submission status: Accepted

Solution code:

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

zentai=0
for i in range(N):
    zentai = zentai^a[i]
#print('zentai:', zentai)  ####

out=[]
for j in range(N):
    out.append(str(a[j]^zentai))

print(' '.join(out))

Submission status: Accepted

Solution code:

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    x=0
    for a in arr:
        x=x^a
    
    ans=[]
    for a in arr:
        ans.append(str(x^a))
    print(" ".join(ans))
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Accepted

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

Submission status: Accepted

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

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

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

ans2 = ''
for i in range(n):
    ans2 += str(ans^a[i]) + ' '

print(ans2)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
#print(bin(11^9^24))
B=a[0]
for i in range(1,n):
    B=B^a[i]
ans=[]
for j in range(n):
    x=B^a[j]
    ans.append(x)
print(*ans)

Submission status: Accepted

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

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

s = [x^j for j in a]
  
print(*s)

Submission status: Accepted

Solution code:
N = int(input())
*a, = map(int, input().split())
b = 0
for v in a:
    b ^= v

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

Submission status: Accepted

Solution code:
n=int(input())
*a,=map(int, input().split())
x=0
for ai in a:
    x^=ai

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

lis = []
for a in A:
    Y = X ^ a
    lis.append(Y)
print(*lis)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N=II()

xorsm=0
AS=LI()
for i in AS:
    xorsm ^= i
res = []
for i in AS:
    res.append("{}".format(xorsm ^ i))

print(" ".join(res))

Submission status: Accepted

Solution code:
def main():

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

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


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

for i in a:
    print(t ^ i)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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