






import qiskit
from qiskit.providers import Backend



def 						lowercase   (    __snake_case    :			int		, __snake_case    :			int     ):
		lowercase_			:			Optional[Any]								=       bin(__snake_case     )[2:], bin(__snake_case     )[2:]  # Remove leading '0b'

		# Ensure that both strings are of the same length
		if len(__snake_case     ) > len(__snake_case     ):
				lowercase_			:			str								=       y.zfill(len(__snake_case     )     )
		else:
				lowercase_			:			List[Any]								=       x.zfill(len(__snake_case     )     )

		# We need (3 * number of bits in the larger number)+1 qBits
		# The second parameter is the number of classical registers, to measure the result
		lowercase_			:			Optional[Any]								=       qiskit.QuantumCircuit((len(__snake_case     ) * 3) + 1		, len(__snake_case     ) + 1     )

		# We are essentially "not-ing" the bits that are 1
		# Reversed because it's easier to perform ops on more significant bits
		for i in range(len(__snake_case     )     ):
				if x[::-1][i] == "1":
						circuit.x(__snake_case     )
		for j in range(len(__snake_case     )     ):
				if y[::-1][j] == "1":
						circuit.x(len(__snake_case     ) + j     )

		return circuit, x, y



def 						lowercase   (    __snake_case    :			qiskit.QuantumCircuit		, __snake_case    :			int		, __snake_case    :			int		, __snake_case    :			int		, __snake_case    :			int		, ):
		circuit.ccx(__snake_case		, __snake_case		, __snake_case     )
		circuit.cx(__snake_case		, __snake_case     )
		circuit.ccx(__snake_case		, __snake_case		, __snake_case     )
		circuit.cx(__snake_case		, __snake_case     )
		circuit.cx(__snake_case		, __snake_case     )



def 						lowercase   (    __snake_case    :			int		, __snake_case    :			int		, __snake_case    :			Backend = qiskit.Aer.get_backend('''aer_simulator'''     )		, ):







		if vala < 0 or vala < 0:
				raise ValueError('''Both Integers must be positive!'''     )

		# Store the Integers
		lowercase_			:			Tuple								=       store_two_classics(__snake_case		, __snake_case     )
		for i in range(len(__snake_case     )     ):
				full_adder(__snake_case		, __snake_case		, len(__snake_case     ) + i		, len(__snake_case     ) + len(__snake_case     ) + i		, len(__snake_case     ) + len(__snake_case     ) + i + 1     )
				circuit.barrier()  # Optional, just for aesthetics

		# Measure the resultant qBits
		for i in range(len(__snake_case     ) + 1     ):
				circuit.measure([(len(__snake_case     ) * 2) + i]		, [i]     )

		lowercase_			:			Union[str, Any]								=       qiskit.execute(__snake_case		, __snake_case		, shots=1     ).result()

		# The result is in binary. Convert it back to int
		return int(list(res.get_counts()     )[0]		, 2     )


if __name__ == "__main__":
						import doctest

						doctest.testmod()











"""simple docstring"""



def 						lowercase   (    __snake_case    :			str = "mytext.txt"		, __snake_case    :			bool = False     ):
		import socket

		lowercase_			:			List[str]								=       1_2_3_1_2  # Reserve a port for your service.
		lowercase_			:			Dict								=       socket.socket()  # Create a socket object
		lowercase_			:			int								=       socket.gethostname()  # Get local machine name
		sock.bind((host, port)     )  # Bind to the port
		sock.listen(5     )  # Now wait for client connection.

		print('''Server listening....'''     )

		while True:
				lowercase_	, lowercase_			:			int								=       sock.accept()  # Establish connection with client.
				print(F'''Got connection from {addr}'''     )
				lowercase_			:			List[Any]								=       conn.recv(1_0_2_4     )
				print(F'''Server received: {data = }'''     )

				with open(__snake_case		, '''rb'''     ) as in_file:
						lowercase_			:			List[Any]								=       in_file.read(1_0_2_4     )
						while data:
								conn.send(__snake_case     )
								print(F'''Sent {data!r}'''     )
								lowercase_			:			List[Any]								=       in_file.read(1_0_2_4     )

				print('''Done sending'''     )
				conn.close()
				if testing:  # Allow the test to complete
						break

		sock.shutdown(1     )
		sock.close()


if __name__ == "__main__":
						send_file()



