import numpy as np

# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile, Aer, IBMQ
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *
from qiskit.providers.aer import QasmSimulator

# Loading your IBM Quantum account(s)
provider = IBMQ.load_account()

circ=QuantumCircuit(2,2)
circ.h(0)
circ.cx(0,1)
circ.x(0)
circ.barrier(range(2))
circ.cx(0,1)
circ.h(0)
circ.measure(range(2),range(2))
circ.draw()

backend_sim=Aer.get_backend('qasm_simulator')
ch_sim=backend_sim.run(transpile(circ, backend_sim), shots=1024)
result_sim=ch_sim.result()
counts=result_sim.get_counts(circ)
print(counts)                    

