Problem:


Score : 500 points

Problem Statement

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

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

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

What is xor?

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

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

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

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

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

Constraints

All values in input are integers.

2 \leq N \leq 200000

N is even.

0 \leq a_i \leq 10^9

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

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 \ldots a_N

Output

Print a line containing N integers separated with space.

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

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

Sample Input 1

4
20 11 9 24

Sample Output 1

26 5 7 22

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

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

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

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

Thus, this output is consistent with the given information.



Sample input:
4
20 11 9 24


Sample output:
26 5 7 22

Submission status: Accepted

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

Submission status: Accepted

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

all = 0

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

r = []
for aa in a:
  r.append(t ^ aa)
print(*r, sep=' ')

Submission status: Accepted

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

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

#print(xor_a)

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

print(*ans)

Submission status: Accepted

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

s = 0
for i in range(n):
    s ^= a[i]
print(' '.join([str(i^s) for i in a]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
maxl = len(bin(max(A))[2:])
ans = [['0'] * N for _ in range(maxl)]
for n in range(N):
    for d, a in enumerate(bin(A[n])[2:].zfill(maxl)):
        ans[d][n] = a

for dn in range(maxl):
    n1 = sum([1 for d in ans[dn] if d == '1'])
    if n1 % 2 == 1:
        for n in range(N):
            ans[dn][n] = '0' if ans[dn][n] == '1' else '1'

prt = [int(''.join([ans[d][n] for d in range(maxl)]), 2) for n in range(N)]
print(' '.join(map(str, prt)))

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
arr=list(map(int,input().split()))
xors = 0
for val in arr: #あらかじめすべての要素のxorを求めておく
 xors^=val #(ai xor aj = bi xor bj)となるのですべてのxorを合わせると、b0^b1^b2^...^bn
ans=[]
for i in range(n): #各aiについて、ai xor (すべての要素のxor)がi番目に書かれた値に等しい
 ans.append(xors^arr[i])
print(*ans)

Submission status: Accepted

Solution code:
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd

n = ni()
A = list(ma())
tot = 0
for a in A:
    tot = tot^a
ans = []
for a in A:
    ans.append(tot^a)
print(*ans)

Submission status: Accepted

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

# aの要素すべてのXOR、sを求めます
s = a[0]
for num in a[1:]:
    s ^= num

# i番目のすぬけくんは、s xor a_iです
res = [0] * n
for i, num in enumerate(a):
    res[i] = s ^ num

print(*res)

Submission status: Accepted

Solution code:
from functools import reduce

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

s = int(reduce(lambda i,j: i^j, a))
print(' '.join(list(map(lambda x: str(x^s), a))))

Submission status: Accepted

Solution code:
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase


"""def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)"""

"""def pw(a,b):
    result=1
    while(b>0):
        if(b%2==1): result*=a
        a*=a
        b//=2
    return result"""



def inpt():
    return [int(k) for k in input().split()]


def main():
    n=int(input())
    ar=inpt()
    xor=0
    for i in ar:
        xor^=i
    for i in ar:
        print(xor^i,end=' ')















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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

m = max(a)
ans = [0] * n
z = 1
while True:
  b = False
  for i in range(n):
    if a[i] & z:
      b = not b
  for i in range(n):
    if not b:
      if a[i] & z:
        ans[i] |= z
    else:
      if not (a[i] & z):
        ans[i] |= z

  z <<= 1
  if z > m:
    break

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

Submission status: Accepted

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

# XOR演算子　^
# aの要素全てのXORを計算、それをSとする
S = 0
for aa in a:
    S ^= aa

# i番目の番号はaiとSのXORで表される
ans = []
for ai in a:
    ans.append(S ^ ai)

print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
S = 0
for aa in a:
    S ^= aa
ans = ""
for ai in a:
    ans += f'{str(S ^ ai)} '
print(ans.rstrip())

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
S = 0
for aa in a:
    S ^= aa
ans = ""
for ai in a:
    ans += f'{str(S ^ ai)} '
print(ans.rstrip())

Submission status: Accepted

Solution code:
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[i], end=" ")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import sys 

readline = sys.stdin.readline 

N = int(input())
A = np.array(readline().split(), np.int64)
all_xor = 0
for a in A:
    all_xor = all_xor^a

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

Submission status: Accepted

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

r1=0
for jj in range(n):
  r1=r1^a[jj]

r=[0]*n
for ii in range(n):
  r[ii]=r1^a[ii]
"""
for ii in range(n):
  print(bin(a[ii]),bin(r[ii]))
"""
print(*r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = LI()

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

    rr = []
    for c in a:
        rr.append(s ^ c)


    return JA(rr, ' ')


print(main())

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
A = [int(n) for n in input().split()]
X = reduce(int.__xor__, A)
ans = [X^a for a in A]
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

for j in range(N):
    b.append(S^a[j])

print(*b)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(' '.join(ans))

Submission status: Accepted

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

    x ^= a[0]
    xors = [x]
    for i in range(1, N):
        x ^= a[i-1]
        x ^= a[i]
        xors.append(x)

    print(' '.join(str(x) for x in xors))


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input(""))
a=[]
ans=[1]
ain=input("").split(" ")
for i in range(n):
    a+=[int(ain[i])]
s=a[1]
for i in range(n-2):
    s^=a[i+2]
ans[0]=s
for i in range(n-1):
    s=s^a[i]
    s^=a[i+1]
    ans+=[s]
b=[]
for i in range(n):
    b+=[str(ans[i])]
print(" ".join(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ans = 0
for a in a_ls:
    ans ^= a
print(" ".join([str(ans ^ a) for a in a_ls]))

Submission status: Accepted

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

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

for ai in a:
    X ^= ai

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

Submission status: Accepted

Solution code:
# n=int(input())
# n,k=map(int,input().split())
# arr=list(map(int,input().split()))
#ls=list(map(int,input().split()))
#for i in range(m):
# for _ in range(int(input())):
#from collections import Counter
#from fractions import Fraction
n=int(input())
arr=list(map(int,input().split()))
var=arr[0]
for i in range(1,n):
    var^=arr[i]
for i in range(n):
    print(arr[i]^var,end=" ")

#ls = [list(map(int, input().split())) for i in range(n)]
#for _ in range(int(input())):

Submission status: Accepted

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

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

Submission status: Accepted

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

xor_all = 0

for a in A:
    xor_all ^= a

#print(bin(xor_all))

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

print(' '.join(ans))

Submission status: Accepted

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

s = li[0]

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

ans = []

for i in li:
    tmp = s^i
    ans.append(tmp)
    
print(*ans)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
a = np.array(list(map(int,input().split())))

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

for i in a:
    print(xor^i)

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)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

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

s = 0
for ai in a:
    s = s^ai
ans = []
for ai in a:
    ans.append(s^ai)
print(' '.join(map(str,ans)))

Submission status: Accepted

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

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

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

print(*ans)

Submission status: Accepted

Solution code:
#ABC 171 E - Red Scarf

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

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

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

Submission status: Accepted

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

s=0
for i in a:
  s^=i
 
t=[]
for i in a:
  t_=i^s
  t.append(t_)
  
print(' '.join(map(str,t)))

Submission status: Accepted

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

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

ans = a[:]
for i in range(N):
  ans[i] ^= tmp
print(*ans)

Submission status: Accepted

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

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

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

print(*ans)

Submission status: Accepted

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

XOR = 0

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

B = []

for i in range (0, N):
	B.append(XOR^A[i])

print(*B)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
a = LI()

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

for i in range(N):
    anss.append(ans_base ^ a[i])


anss = map(str, anss)
print(" ".join(anss))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
#xor_a = [bin(x) for x in a]
#print(xor_a)
x = 0
for i in a:
    x ^= i
b = [x^y for y in a]
print(' '.join(map(str, b))) #' 'joinにより空白を間にいれる。mapにより文字列に直す
#atcoderではforを使った普通の縦の並びでもいいらしい

Submission status: Accepted

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

Submission status: Accepted

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

s = a[0]

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

ans = [0]*n

for i, num in enumerate(a):
	ans[i] = s^num

print(*ans)

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    A = list(map(int, input().split()))
    S = 0
    for a in A:
        S = S ^ a
    answer = []
    for a in A:
        answer.append(S ^ a)
    print(*answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = 0
    for a in A:
        B ^= a

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

    print(*ans, sep=" ")


if __name__ == "__main__":
    main()

Submission status: Accepted

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


def main() -> None:
    N = ri()
    a = rmi()
    assert len(a) == N
    result = []
    all_xor = 0
    for item in a:
        all_xor ^= item
    for item in a:
        result.append(item ^ all_xor)
    w(' '.join(map(str, result)))


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(r())


def rmi(delim: str = ' ') -> tuple:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(*data, delim: str = ' ') -> None:
    print(delim.join(map(str, data)))


if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10 ** 9)
    main()

Submission status: Accepted

Solution code:
def resolve():
    import sys
    sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
    to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
    print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数
    print_list_with_space = lambda x: print(*x, sep=" ")

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

    def map_int_input(): return map(int, input())

    MII = map_int_input

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

    def MII_to_index(): return map(to_index, input())

    def MII_split_to_index(): return map(to_index, input().split())

    # 入力全てを整数に変換したものの配列を受け取る
    def list_int_inputs(): return list(map(int, input()))

    LII = list_int_inputs

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

    # 2次元リスト化
    def LII_2D(rows_number): return [LII() for _ in range(rows_number)]

    def LII_split_2D(rows_number): return [LII_split() for _ in range(rows_number)]

    N = input_int()
    a_list = LII_split()
    b_list = []

    xor_all = a_list[0]
    for a in a_list[1:]:
        xor_all ^= a

    for a in a_list:
        b_list.append(a^xor_all)
    # print(b_list)
    print_list_with_space(b_list)
    
resolve()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    n = ini()
    a = inl()
    x = 0
    for y in a:
        x ^= y
    b = [x ^ y for i, y in enumerate(a)]
    return b


print(*solve())

Submission status: Accepted

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

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

arr = [i^total for i in arr]
print(*arr)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,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()))

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

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

Submission status: Accepted

Solution code:
n=int(input())
lst=list(map(int,input().split()))
p=0
for i in range(n):
    p=(p^lst[i]) #全体のxor

ans=[]

for i in range(n):
    q=(p^lst[i]) #自分の数値
    ans.append(str(q))
    
print(" ".join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = 0

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

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

Submission status: Accepted

Solution code:
N = int(input())
aaa = list(map(int, input().split()))
a_all = 0
for a in aaa:
    a_all ^= a
print(*list(a_all ^ a for a in aaa))

Submission status: Accepted

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

numbers = []

s = A[0]
for i in range(1, N):
    s = s ^ A[i]
for i in range(N):
    numbers.append(s ^ A[i])

print(*numbers)

Submission status: Accepted

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

temp = 0
for i in A:
  temp ^= i
  
for i in A:
  print(temp ^ i)

Submission status: Accepted

Solution code:
def xsum(A):
    total=0
    for i in range(len(A)):
        total^=A[i]
    return total

n=int(input())
A=list(map(int,input().split()))
B=[0]*n
total=xsum(A)
for i in range(n):
    B[i]=total^A[i]
B_str=[str(i) for i in B]
print(' '.join(B_str))

Submission status: Accepted

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

for r in a:
	x ^= r
print(' '.join([str(x^r) for r in a]))

Submission status: Accepted

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

for r in a:
	x ^= r
a = [str(x^r) for r in a]
a = ' '.join(a)
print(a)

Submission status: Accepted

Solution code:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

n=ii()
a=ll()
xor=0
for i in a:
    xor^=i
for i in a:
    print(xor^i,end=" ")

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()
xor = 0
for x in a:
    xor ^= x
for x in a:
    print(xor^x,end=' ')
print()

Submission status: Accepted

Solution code:
#create date: 2020-06-29 22:59

import sys
stdin = sys.stdin

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

def main():
    n = ni()
    a = na()
    a_xor = 0
    for ai in a:
        a_xor ^= ai
    for ai in a:
        print(a_xor^ai, end=" ")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

def nim(x):
  bx = [format(i,'030b') for i in x]
  bz = ''.join([str( sum([int(bx[xi][i]) for xi in range(len(x))]) % 2)  for i in range(30)])
  return int(bz, 2)

nima = nim(a)
ans = [ str(nim([nima,aa])) for aa in a ]
print(' '.join(ans) )

Submission status: Accepted

Solution code:
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

N=II()
a=LI()
A=0
for elem in a:
  A^=elem
ans=[A^elem for elem in a]
print(*ans)

Submission status: Accepted

Solution code:
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict


n=IN()
a=LI()
ans=0
for i in range(n):
    ans^=a[i]
for i in range(n):
    print(ans^a[i],end=" ")

Submission status: Accepted

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

Submission status: Accepted

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

Ans = ""
for i in range(N):
    print(S^a[i])

Submission status: Accepted

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

s=0
for i in range(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()))
x=0
for a in A:
    x^=a
ans=''
for a in A:
    ans+=str(x^a)+' '
print(ans)

Submission status: Accepted

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

all_xor = alphas[0] ^ alphas[1]
for i in range(2, N):
    all_xor = all_xor ^ alphas[i]
    
ans_list = []
for i in range(N):
    num_i = all_xor ^ alphas[i]
    ans_list.append(str(num_i))
    
ans = " ".join(ans_list)
print(ans)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

#print(tx)

ans = [""] * N
for i in range(N):
  ans[i] = str(tx ^ A[i])
  
print(" ".join(ans))

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
S=A[0]
B=[0 for i in range(N)]
for i in range(1,N):
    S=S^A[i]
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()))

s = a[0]
for i in range(1,len(a)):
    s  = s^a[i]
x = [s^a[i] for i in range(len(a))]
print(" ".join(map(str,x)))

Submission status: Accepted

Solution code:
mod = int(1e9+7)
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
    #A, B = [int(x) for x in raw_input().split()]
    n = int(raw_input())
    
    arr = [int(x) for x in raw_input().split()]
    
    ans = [-1] * n
    
    total_xor = 0
    
    for num in arr:
        total_xor ^= num
    
    for i in range(n):
        ans[i] = total_xor ^ arr[i]
        ans[i] = str(ans[i])
    
    print(' '.join(ans))
    

main()

Submission status: Accepted

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

all_ = 0
for a in a_lst:
  all_ = all_ ^ a

for a in a_lst:
  print(all_ ^ a, end=' ')

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 = 0
for a in A:
    b ^= a
ans = []
for a in A:
    ans.append(str(a^b))
print(" ".join(ans))

Submission status: Accepted

Solution code:
from functools import reduce

n = int(input())
a = list(map(int,input().split()))
b = [0]*n
a_xor=reduce(lambda x,y : x^y,a)
for i in range(n):
  b[i]=a[i]^a_xor  
##  b[i] = reduce(lambda x,y : x^y,a[0:i+1]+a[i:])

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
n = int(input())
a = [int(x) for x in input().split()]
xor = 0
for x in a:
    xor ^= x
print(*(xor ^ x for x in a))

Submission status: Accepted

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

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

print(a[0] ^ s, end="")

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

Submission status: Accepted

Solution code:
import sys
import math
import collections

def set_debug(debug_mode=False):
    if debug_mode:
        fin = open('input.txt', 'r')
        sys.stdin = fin


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


def get(s):
    return str(s % 9) + '9' * (s // 9)

if __name__ == '__main__':
    # set_debug(True)

    # t = int(input())
    t = 1

    for ti in range(1, t + 1):
        n = int(input())
        A = int_input()

        cur = 0

        for x in A:
            cur = x ^ cur

        res = []
        for x in A:
            res.append(cur ^ x)

        print(*res)

Submission status: Accepted

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