




"""simple docstring"""
import qiskit





def 						UpperCAmelCase				(			A__:    int							,				A__:    int     )  ->     qiskit.result.counts.Counts:
			__lowerCamelCase					:	int	       =				qiskit.Aer.get_backend('aer_simulator'     )

			__lowerCamelCase					:	Dict	       =				qiskit.QuantumCircuit(4							,				2     )
			# encode inputs in qubits 0 and 1
			if bita == 1:
						qc_ha.x(0     )
			if bita == 1:
						qc_ha.x(1     )
			qc_ha.barrier()

			# use cnots to write XOR of the inputs on qubit2
			qc_ha.cx(0							,				2     )
			qc_ha.cx(1							,				2     )

			# use ccx / toffoli gate to write AND of the inputs on qubit3
			qc_ha.ccx(0							,				1							,				3     )
			qc_ha.barrier()

			# extract outputs
			qc_ha.measure(2							,				0     )  # extract XOR value
			qc_ha.measure(3							,				1     )  # extract AND value

			# Execute the circuit on the qasm simulator
			__lowerCamelCase					:	Any	       =				qiskit.execute(A__							,				A__							,				shots=1000     )

			# Return the histogram data of the results of the experiment
			return job.result().get_counts(A__     )


if __name__ == "__main__":
					a_				:    str										=     half_adder(1, 1)
					print(F"""Half Adder Output Qubit Counts: {counts}""")









"""simple docstring"""
from cva import destroyAllWindows, imread, imshow, waitKey





def 						UpperCAmelCase				(			A__:    Tuple     )  ->     Union[str, Any]:
			# getting number of pixels in the image
			__lowerCamelCase       ,      __lowerCamelCase					:	Optional[Any]	       =				img.shape[0], img.shape[1]

			# converting each pixel's color to its negative
			for i in range(A__     ):
						for j in range(A__     ):
									__lowerCamelCase					:	Optional[Any]	       =				[255, 255, 255] - img[i][j]

			return img


if __name__ == "__main__":
					# read original image
					a_				:    Dict										=     imread('''image_data/lena.jpg''', 1)

					# convert to its negative
					a_				:    str										=     convert_to_negative(img)

					# show result image
					imshow('''negative of original image''', img)
					waitKey(0)
					destroyAllWindows()



