def make_circuit(n: int, f) -> QuantumCircuit:
    input_qubit = QuantumRegister(n, 'qc')
    target = QuantumRegister(1, 'qt')
    prog = QuantumCircuit(input_qubit, target)
    prog.x(target)
    for i in range(n):
        prog.h(input_qubit[i])
    prog.h(input_qubit[1])
    prog.h(target)
    prog.barrier()
    oracle = build_oracle(n, f)
    prog.append(oracle.to_gate(), ([input_qubit[i] for i in range(n)] + [target]))
    for i in range(n):
        prog.h(input_qubit[i])
    prog.barrier()
    prog.swap(input_qubit[1], input_qubit[0])
    prog.swap(input_qubit[1], input_qubit[0])
    prog.x(input_qubit[1])
    prog.z(input_qubit[1])
    prog.swap(input_qubit[1], input_qubit[0])
    prog.swap(input_qubit[1], input_qubit[0])
    return prog
def make_circuit(n: int, f) -> QuantumCircuit:
    input_qubit = QuantumRegister(n, 'qc')
    target = QuantumRegister(1, 'qt')
    prog = QuantumCircuit(input_qubit, target)
    prog.x(target)
    for i in range(n):
        prog.h(input_qubit[i])
    prog.h(input_qubit[1])
    prog.h(target)
    prog.barrier()
    oracle = build_oracle(n, f)
    prog.append(oracle.to_gate(), ([input_qubit[i] for i in range(n)] + [target]))
    for i in range(n):
        prog.h(input_qubit[i])
    prog.barrier()
    prog.swap(input_qubit[1], input_qubit[0])
    prog.swap(input_qubit[1], input_qubit[0])
    prog.x(input_qubit[1])
    prog.z(input_qubit[1])
    prog.swap(input_qubit[1], input_qubit[0])
    prog.swap(input_qubit[1], input_qubit[0])
    return prog