// An OpenQASM 2 program as exporters write it: qelib1.inc's u2, u1 and cu1, // and every qubit measured at once. u2(0,π) is a Hadamard; with q[1] in |1⟩, // cu1(π) kicks a phase of −1 back onto q[0], which the second Hadamard turns // to |1⟩. rx(π/3) leaves q[2] reading 1 with probability 1/4. OPENQASM 2.0; include "qelib1.inc"; qreg q[3]; creg c[3]; u2(0,pi) q[0]; x q[1]; cu1(pi) q[0],q[1]; u2(0,pi) q[0]; rx(pi/3) q[2]; measure q -> c;