!pip install -U qiskit
!pip install -U qiskit_ibm_provider

from qiskit import transpile
from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit_ibm_runtime.fake_provider import FakeManilaV2

q = QuantumRegister(2,'q')
c = ClassicalRegister(2,'c')
circuit = QuantumCircuit(q,c)
circuit.h(q)
circuit.cx(q[0], q[1])
circuit.measure(q,c)

fake_manila = FakeManilaV2()
pm = generate_preset_pass_manager(backend=fake_manila, optimization_level=1)

isa_qc = pm.run(circuit)

print(isa_qc)

new_circuit = transpile(circuit, fake_manila)
job = fake_manila.run(new_circuit, shots=100)

res = job.result()
print('Result:', res)