version 1.0 qubits 8 .Encoding cnot q[0],q[1] cnot q[0],q[2] .Introduce_Error Rx q[5:7],0.45 measure q[5:7] {c-x b[5],q[0] | c-x b[6],q[1] | c-x b[7],q[2]} .Error_Detection cnot q[0],q[3] cnot q[1],q[3] cnot q[0],q[4] cnot q[2],q[4] measure q[3,4] #prep_z q[3,4] .Error_Correction # Both b[3]=b[4]=0 #do nothing # b[3]=b[4]=1 c-x b[3,4], q[0] # b[3]=1,b[4]=0 not b[4] c-x b[3,4],q[1] not b[4] # b[3]=0,b[4]=1 not b[3] c-x b[3,4],q[2] not b[3] .Measurement measure q[0:2]