human
Check if original Array is retained after performing XOR with M exactly K times | Function to check if original Array can be retained by performing XOR with M exactly K times.
Check if O is present or not.
If K is odd and 0 is not present then the answer will always be No ..
Else it will be Yes.
Driver Code"
Solution in Python:
assistant
#Here is code to check if original Array is retained after performing XOR with M exactly K times and the other steps required.
 def check ( Arr , n , M , K ) :
	flag = 0
	for i in range ( n ) :
		if ( Arr [ i ] == 0 ) :
			flag = 1
	if ( K % 2 != 0 and flag == 0 ) :
		return " No "
	else :
		return " Yes " ;
if __name__ == ' _ _ main _ _ ' :
	Arr = [ 1 , 1 , 2 , 4 , 7 , 8 ]
	M = 5 ;
	K = 6 ;
	n = len ( Arr ) ;
	print ( check ( Arr , n , M , K ) )