A method performed by one or more classical computers, comprising: transforming a n-qubit quantum computation of the form C 2 M ( a,Z i) C 1 exp(i φZ i) C 0 |0〉 ⊗ n, where C k are Clifford operators and the exponentials represent single qubit rotations, to a sequence of exponentials and measurements of the form M ( a, P 2) exp( iφP 1)|0〉 ⊗n, in which P 1 and P 2 are multiple qubit Pauli operators, and M ( a, P 2) = ( I + a P)/2 denotes measurement of the multiple qubit Pauli operator P 2 with outcome a = ±1, where I is the identity matrix, where P 1 = C 0 † Z i 1 C 0, P 2 = C 1 C 0 † M a Z i 2 C 1 C 0; constructing a tree ( V, E) with root node r ∈ V, the tree describing a 2D grid of qubits, in which each vertex in V describes a qubit in the 2D grid, and vertices describing nearest neighbor qubits in the 2D grid are connected by an edge in E; and configuring a quantum computer comprising the 2D grid of qubits to implement the sequence of exponentials and measurements using: one qubit measurements and one qubit Clifford unitaries, either controlled Z-gates or two qubit measurements on nearest neighbor qubits described by vertices in V connected by an edge in E, or being used to perform multi-target Controlled-Z gates, and each Clifford C and C † such that CZ r C † = P being constructed using multi-target Controlled-Z gates, single qubit rotations that are only performed on the qubit described by the root node r. transforming a n-qubit quantum computation of the form C 2 M ( a,Z i) C 1 exp(i φZ i) C 0 |0〉 ⊗ n, where C k are Clifford operators and the exponentials represent single qubit rotations, to a sequence of exponentials and measurements of the form M ( a, P 2) exp( iφP 1)|0〉 ⊗n, in which P 1 and P 2 are multiple qubit Pauli operators, and M ( a, P 2) = ( I + a P)/2 denotes measurement of the multiple qubit Pauli operator P 2 with outcome a = ±1, where I is the identity matrix, where P 1 = C 0 † Z i 1 C 0, P 2 = C 1 C 0 † M a Z i 2 C 1 C 0; constructing a tree ( V, E) with root node r ∈ V, the tree describing a 2D grid of qubits, in which each vertex in V describes a qubit in the 2D grid, and vertices describing nearest neighbor qubits in the 2D grid are connected by an edge in E; and configuring a quantum computer comprising the 2D grid of qubits to implement the sequence of exponentials and measurements using: one qubit measurements and one qubit Clifford unitaries, either controlled Z-gates or two qubit measurements on nearest neighbor qubits described by vertices in V connected by an edge in E, or being used to perform multi-target Controlled-Z gates, and each Clifford C and C † such that CZ r C † = P being constructed using multi-target Controlled-Z gates, single qubit rotations that are only performed on the qubit described by the root node r. one qubit measurements and one qubit Clifford unitaries, either controlled Z-gates or two qubit measurements on nearest neighbor qubits described by vertices in V connected by an edge in E, or being used to perform multi-target Controlled-Z gates, and each Clifford C and C † such that CZ r C † = P being constructed using multi-target Controlled-Z gates, single qubit rotations that are only performed on the qubit described by the root node r.