# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, execute, Aer, IBMQ
from qiskit.compiler import transpile, assemble
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *

# useful to have pi
import math
pi=math.pi

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

device = provider.get_backend('ibmq_5_yorktown')

qc=QuantumCircuit(3)
qc.ccx(0,1,2)
new_circuit = transpile(qc,backend=device)
new_circuit.draw(output='mpl')

qc = QuantumCircuit(3)
theta = pi # Theta can be anything (pi chosen arbitrarily)

# qc.h(2) gets replaced with
qc.rz(pi/2, 2)
qc.sx(2)
qc.rz(pi/2, 2)
#already basic gate
qc.cx(1,2)
# qc.tdg(2) gets replaced with
qc.rz(7*pi/4, 2)
#already basic gate
qc.cx(0,2)
# qc.t(2) gets replaced with
qc.rz(pi/4, 2)
#Already a basic gate
qc.cx(1,2)
# qc.tdg(2) gets replaced with
qc.rz(7*pi/4, 2)
#already a basic gate
qc.cx(0,2)
# qc.t(1) gets replaced with
qc.rz(pi/4, 1)
# qc.t(2) gets replaced with
qc.rz(pi/4, 2)
# qc.h(2) gets replaced with
qc.rz(pi/2, 2)
qc.sx(2)
qc.rz(pi/2, 2)
#Already a basic gate
qc.cx(0,1)
# qc.t(0) gets replaced with
qc.rz(pi/4, 0)
# qc.tdg(1) gets replaced with
qc.rz(pi/4, 1)
#already a basic gate
qc.cx(0,1)

qc.draw()