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:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def fact(N):
        res = {}
        tmp = N
        for i in range(2, int(N ** 0.5 + 1) + 1):
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if cnt > 0:
                res[i] = cnt
        if tmp != 1:
            res[tmp] = 1
        if res == {}:
            res[N] = 1
        return res


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N = Scanner.int()
    A = Scanner.map_int()
    S = 0
    for a in A:
        S ^= a
    B = [0 for _ in range(N)]
    for i in range(N):
        B[i] = S ^ A[i]
    print(*B)


def main():
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from functools import reduce

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

tot_xor = reduce(lambda x, y: x ^ y, arr)
print(" ".join(list(map(str, [tot_xor ^ i for i in arr]))))

Submission status: Accepted

Solution code:
"""
NTC here
"""
 
 
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase

profile = 0
pypy = 1
 
 
def iin(): return int(input())


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


def main():
    n = iin()
    a = lin()
    sm = 0
    for i in range(0, n, 2):
        sm = sm^a[i]^a[i+1]
    a = [i^sm for i in a]
    print(*a)






    




                

        

 
 
 
 
 
 
# region fastio
 
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")
 
if pypy:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
    input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
if __name__ == "__main__":
    if profile:
        import cProfile
        cProfile.run('main()')
    else:
        main()

Submission status: Accepted

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

print(*ans)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(x) for x in input().split()]
s=0
for c in a:
    s=s^c
b=[str(s^x) for x in a]
print(" ".join(b))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
aa = np.array(list(map(int, input().split())))
ret = np.zeros(n, int)
coeff = 1
while aa.sum() > 0:
    if ((aa%2).sum())%2 == 0:
        ret += coeff * (aa%2)
    else:
        ret += coeff * (1-aa%2)
    aa = aa//2
    coeff *= 2
ret = [str(r) for r in ret]
print(' '.join(ret))

Submission status: Accepted

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

ans = []
for ai in a:
    ans.append((s & ~ai) + (~s & ai))
print(*ans)

Submission status: Accepted

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

xorall = 0
for i in xorz:
    xorall ^= i

numx = [0]*N
for i in range(N):
    numx[i] = xorall ^ xorz[i]

for i in range(N):
    print(numx[i]),

Submission status: Accepted

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

xo = li[0]

for i in range(1, N):
    xo = xo ^ li[i]
for i in range(N):
    print(li[i] ^ xo, end = " ")

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
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 [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

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

  sm=l[0]
  for x in l[1:]:
    sm^=x

  ans=[]
  for x in l:
    sm^=x
    ans.append(sm)
    sm^=x

  return ' '.join(str(x) for x in ans)


# main()
print(main())

Submission status: Accepted

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

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

    print(*ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import log, ceil
def main():
    n = int(input())
    l = [int(j) for j in input().split()]
    x = 0
    for i in range(n):
        x = x^l[i]
    for i in range(n):
        print(x^l[i], end = " ")
    print()

    # for t in range(int(input())):
        # n = int(input())
        

# "Ashishgup" if he wins, and "FastestFinger"

# for #!/usr/bin/env python
# import os
# import sys
# from io import BytesIO, IOBase


# # region fastio

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

# # endregion

if __name__ == "__main__":
    main()

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(' '.join(map(str, ans)))

Submission status: Accepted

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

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

cnt = 0
for i in a:
    cnt ^= i
for i in a:
    print(cnt ^ i)

Submission status: Accepted

Solution code:

import collections
n = int(raw_input())
nums = map(int,raw_input().split(' '))
r = reduce(lambda x,y : x^y, nums)
print ' '.join(map(str,[r^bi for bi in nums]))

Submission status: Accepted

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

for i in range(n):
  print(S^num[i],end="")
  if i!=n:
    print(" ",end="")

Submission status: Accepted

Solution code:
from math import *
from collections import *
n=int(input())
a=list(map(int,input().split()))
x=0
for i in a:
    x=x^i
for i in a:
    print(x^i,end=" ")

Submission status: Accepted

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

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

n = int(input())
a = lmp()
num = 0
for i in range(n):
    num ^= a[i]
for i in range(n):
    print(num ^ a[i])

Submission status: Accepted

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

for i in A:
  s ^= i

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

print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
def ReplaceElements(arr, n): 
  
    X = 0
  
    # Calculate the xor of all the elements 
    for i in range(n): 
        X ^= arr[i] 
  
    # Replace every element by the 
    # xor of all other elements 
    for i in range(n): 
        arr[i] = X ^ arr[i]
n=int(input())
a=list(map(int,input().split()))
ReplaceElements(a,n)
print(*a)

Submission status: Accepted

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

xor_all=0
for a in alist:
  xor_all^=a
#print(xor_all)

answer_list=[]
for a in alist:
  answer_list.append(a^xor_all)
  
print(*answer_list)

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())
a = [int(i) for i in input().split()]
s = a[0]
for i in range(1,n):
    s = s^a[i]
#print(s)
for i in range(n):
    if i != n-1:
        print(s^a[i],end = " ")
    else:
        print(s^a[i])

Submission status: Accepted

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

prefXor = [arr[0]]
for i in arr[1:]:
	prefXor += [prefXor[-1] ^ i]

out = []
for i in range(n):
	out += [prefXor[-1] ^ arr[i]]

print(*out)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

al = 0

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

ans = []

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

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

Submission status: Accepted

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

b = [0 for _ in range(len(a))]
xor = 0

for ai in a:
  xor ^= ai
  
b = 0
ans = ""
for j in range(len(a)):
  b = xor ^ a[j]
  ans += str(b)
  if j == len(a)-1:
    break
  ans +=" "

print(ans)

Submission status: Accepted

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

check = 0

for a in A:
    check ^= a

ans = []

for a in A:
    ans.append(str(a ^ check))

print(" ".join(ans))

Submission status: Accepted

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

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

for i in range(N):
    ans = xorsum ^ A[i]
    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]

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

Submission status: Accepted

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
X=[]
for k in range(32):
    pp=0
    for a in A:
        pp+=(a>>k)&1
    if pp%2:
        for i in range(N):
            A[i]=A[i]^2**(k)
print(" ".join([str(x) for x in A]))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
ans = []
total = 0
for aele in a:
    total = total ^ aele
for aele in a:
    print(total^aele, end=' ')
print()

Submission status: Accepted

Solution code:
n = int(input())

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

x = a[0]
for i in range(n-1):
    x = x^a[i+1]
ans = []
if n % 2 == 0:
    for i in range(n):
        pp = a[i]^x
        ans.append(pp)
else:
    ans = a
print(*ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
an = [0 for i in range(30)]
ans = []
for i in a:
    c = bin(i)
    d = len(c)-1
    count = 0
    while c[d] != 'b':
        if c[d] == '1':
            an[count] += 1
            an[count] %= 2
        d-=1
        count+=1
tmp = 0
for i in range(len(an)):
    if an[i] == 1:
        tmp += 2**i
for i in a:
    ans.append(i ^ tmp)
print(*ans)

Submission status: Accepted

Solution code:
import itertools
import decimal
import math
from collections import Counter
import sys
input = sys.stdin.readline

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

master=0
for i in range(N):
    master=master^ListA[i]
    #print(bin(ListA[i])) 

#print(bin(master) 

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n=input()
a=input()
s=eval(a.replace(' ','^'))
print(*[s^i for i in map(int,a.split())])

Submission status: Accepted

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

Ans = [0 for i in range(N)]

X = 0

for i in A:
  X ^= i

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    l = [int(x) for x in input().split()]
    a_all = l[0]
    for i in l[1:]:
        a_all = a_all^i
    for i in l:
        print(i^a_all)
main()

Submission status: Accepted

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

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

for ai in a:
    x ^= ai

ans = []

for ai in a:
    ans.append(ai^x)

print(*ans)

Submission status: Accepted

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

left = [0] * (N+1)
right = [0] * (N+1)

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

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

ans = []
for i in range(N):
    if i-1 >= 0:
        l = left[i-1]
    else:
        l = 0
    if i+1 < N:
        r = right[i+2]
    else:
        r = 0
    ans.append(l^r)
print(*ans, sep=" ")

Submission status: Accepted

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

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

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

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):
    L = list(accumulate(A, xor))
    R = list(accumulate(A[::-1], xor))[::-1]
    ans = [0 for i in range(N)]
    for i in range(N):
        a = 0
        l = L[i-1] if i > 0 else 0
        a ^= l
        r = R[i+1] if i+1 < N else 0
        a ^= r
        ans[i] = a
    print(*ans)


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

Submission status: Accepted

Solution code:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()

N=int(input())
A=list(map(int,input().split()))
lst=[]
for i in range(0,N,2):
    lst.append(A[i]^A[i+1])

z=0
for l in lst:
    z^=l

rlst=[]

for i in range(N):
    rlst.append(z^lst[i//2]^A[i+(1 if (i&1==0) else -1)])
    #print(i//2,i+(1 if (i&1==0) else -1))
print(" ".join([str(i) for i in rlst]))

Submission status: Accepted

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

# 入力のXORを取って、個別とのXORを出力

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

xor = A[0]
for i in range(1,len(A)):
  xor ^= A[i]
  
ans = [-1] * N
for i in range(N):
  ans[i] = A[i] ^ xor
  
print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
n = 0
for i in a:
    n ^= i
b = 1
ans = [0]*N
for _ in range(30):
    for i,v in enumerate(a):
        ans[i] += (v & b) ^ (n & b)
    b <<= 1
print(*ans)

Submission status: Accepted

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [-int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    N = NI()
    a = LI()

    x = 0
    for b in a:
        x ^= b
    ans = []
    for b in a:
        ans.append(x^b)
    print(*ans,sep=' ')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    total = 0
    for a in A:
        total ^= a
    Ans = [-1] * N
    for i, a in enumerate(A):
        Ans[i] = total ^ a
    print(*Ans, sep = " ")

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
ret=[0]*n
now=1
for i in range(max(l).bit_length()):
    z=0
    for j in range(n):
        if l[j]%2:
            z+=1
    for j in range(n):
        ret[j]+=(l[j]%2+z)%2*now
        l[j]//=2
    now*=2
print(*ret,sep=" ")

Submission status: Accepted

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

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

Submission status: Accepted

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

ALL=0
for i in L:
    ALL^=i
#print(ALL)
ans=[]
for i in L:
    ans.append(ALL^i)
print(*ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
l = [0] * (n + 2)
for i in range(n):
    l[i + 1] = l[i] ^ a[i]
r = [0] * (n + 2)
for i in range(1, n + 1)[::-1]:
    r[i] = r[i + 1] ^ a[i - 1]
ans = [0] * n
for i in range(n):
    ans[i] = l[i] ^ r[i + 2]
print(*ans, sep=" ")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")

EPS = 1e-8


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

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

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
from decimal import *
import heapq
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

n = INT()
a = LIST()
m = a[0] ^ a[1]
for i in range(2, n):
    m = m ^ a[i]
ans = []
for i in range(n):
    ans.append(str(m ^ a[i]))
#print(m)
print(' '.join(ans))

Submission status: Accepted

Solution code:


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    (N-1)
    (a_1^a_2^...^a_n)**(N-1) = a_1^a_2^...^a_n
    """
    N = read_int()
    A = read_ints()
    total = 0
    for a in A:
        total ^= a
    return ' '.join(map(str, (total^a for a in A)))


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

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

ans=[s^x for x in a]

print(*ans,sep=' ')

Submission status: Accepted

Solution code:
def xor_operate(a_list):
    result = 0
    for a in a_list:
        result ^= int(a)
    return result



if __name__ == "__main__":
    N = input()
    a_list = input()

    a_list = a_list.split(" ")

    bit_value = xor_operate(a_list)

    i_list = []
    for a in a_list:
        i_list.append(str(bit_value ^ int(a)))
    print(" ".join(i_list))

Submission status: Accepted

Solution code:
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    n = inp()
    a = inlt()
    q = 0
    for i in range(len(a)):
        q = q ^ a[i]
    for i in range(len(a)):
        a[i] = a[i] ^ q
    print(*a)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * 100000
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

#-----------------------------------------------------------------------#  
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()

def main():
    N=ii()
    A = list(mi())

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

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

    print(*ans,sep=' ')


if __name__ == "__main__":
  main()

Submission status: Accepted

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

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

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

for i in range(N):
	R.append(pre^suff)
	pre ^= A[i]

	if i != N-1:
		suff ^= A[i+1]
	else:
		suff = 0

print(*R)

Submission status: Accepted

Solution code:
n = int(input())
aa = tuple(map(int, input().split()))

v = aa[0]
for i in range(1, n):
    v ^= aa[i]
print(' '.join([str(v ^ a) for a in aa]))

Submission status: Accepted

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

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

ans = [0]*n
for i, a in enumerate(A):
    ans[i] = t^a
print(*ans)

Submission status: Accepted

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

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


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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
xor=[]
for i in range(n-1):
    xor.append(a[i]^a[i+1])
f=0
for i in range(0,len(xor),2):
    f^=xor[i]
first=f^a[0]
ans=[first]
k=first
print(first,end=' ')
for i in xor:
    print(k^i,end=' ')
    k=k^i

Submission status: Accepted

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

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

T=[]
for a in A:
    T.append(S^a)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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