'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import CXGate, ZGate
from math import sqrt, acos, pi

def solve(*args) -> QuantumCircuit:
	qc = QuantumCircuit(1)
	qc.x(0)
	return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
    # Write your code here:
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
    # Write your code here:
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
    # Write your code here:

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
    qc.x(0)

    return qc
'''


'''python
from math import (
    pi,
    # degrees,
    # radians,
    # asin,
    # acos,
    # atan2,
    # sqrt,
    # sin,
    # cos,
    # tan
)
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister

# from qiskit.circuit.library.standard_gates import (
#     C3XGate,
#     C3SXGate,
#     C4XGate,
#     CCXGate,
#     DCXGate,
#     CHGate,
#     CPhaseGate,
#     CRXGate,
#     CRYGate,
#     CRZGate,
#     CSwapGate,
#     CSXGate,
#     CUGate,
#     CU1Gate,
#     CU3Gate,
#     CXGate,
#     CYGate,
#     CZGate,
#     CCZGate,
#     HGate,
#     IGate,
#     MCPhaseGate,
#     PhaseGate,
#     RCCXGate,
#     RC3XGate,
#     RXGate,
#     RXXGate,
#     RYGate,
#     RYYGate,
#     RZGate,
#     RZZGate,
#     RZXGate,
#     XXMinusYYGate,
#     XXPlusYYGate,
#     ECRGate,
#     SGate,
#     SdgGate,
#     CSGate,
#     CSdgGate,
#     SwapGate,
#     iSwapGate,
#     SXGate,
#     SXdgGate,
#     TGate,
#     TdgGate,
#     UGate,
#     U1Gate,
#     U2Gate,
#     U3Gate,
#     XGate,
#     YGate,
#     ZGate,
# )

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
    # Write your code here:

    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
    # Write your code here:
    qc.h(0)
    qc.cx(0,0)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
    # Write your code here:
    qc.h(0)
    qc.cx(0,1)
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.append(o)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, qubits=[*x, y[0]], inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, qubits=[*x, y[0]], inplace=True)
    qc.z(y[0])
    qc.compose(o, qubits=[*x, y[0]], inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.cz(x[0], y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.z(x[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.cz(o[0], y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(x)
    qc.cz(x[0], y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
    qc.h(x)
        qc.cz(x[i], y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
        qc.cz(x[i], y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
        qc.z(x[i])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace= True)
    qc.z(y[0])

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(x)

    qc.compose(o, inplace= True)
    qc.z(y[0])

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace= True)
    qc.z(y[0])
    qc.compose(o.inverse, inplace = True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace= True)
    qc.z(y[0])
    qc.compose(o, inplace= True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import GlobalPhaseGate, CXGate, ZGate
from math import sqrt, acos, pi

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
	x, y = QuantumRegister(n), QuantumRegister(1)
	qc = QuantumCircuit(x, y)
	qc.compose(o, inplace = True)
	for i in range(n):
		qc.append(GlobalPhaseGate(pi / n).control(y[0]), x[i])
	return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import GlobalPhaseGate, CXGate, ZGate
from math import sqrt, acos, pi

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
	x, y = QuantumRegister(n), QuantumRegister(1)
	qc = QuantumCircuit(x, y)
	qc.compose(o, inplace = True)
	for i in range(n):
		qc.append(PhaseGate(pi / n).control(y[0]), x[i])
	return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import GlobalPhaseGate, CXGate, ZGate
from math import sqrt, acos, pi

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
	x, y = QuantumRegister(n), QuantumRegister(1)
	qc = QuantumCircuit(x, y)
	qc.compose(o, inplace = True)
	for i in range(n):
		qc.append(PhaseGate(pi / n).control(), [y[0], x[i]])
	return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import GlobalPhaseGate, CXGate, ZGate
from math import sqrt, acos, pi

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
	x, y = QuantumRegister(n), QuantumRegister(1)
	qc = QuantumCircuit(x, y)
	qc.compose(o, qubits = x, inplace = True)
	for i in range(n):
		qc.append(PhaseGate(pi / n).control(), [y[0], x[i]])
	return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import PhaseGate, CXGate, ZGate
from math import sqrt, acos, pi

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
	x, y = QuantumRegister(n), QuantumRegister(1)
	qc = QuantumCircuit(x, y)
	qc.compose(o, inplace = True)
	for i in range(n):
		qc.append(PhaseGate(pi / n).control(), [y[0], x[i]])
	return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import PhaseGate, CXGate, ZGate
from math import sqrt, acos, pi

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
	x, y = QuantumRegister(n), QuantumRegister(1)
	qc = QuantumCircuit(x, y)
	qc.compose(o, inplace = True)
	for i in range(n):
		qc.append(PhaseGate(pi).control(), [y[0], x[i]])
	return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import MCXGate, PhaseGate, CXGate, ZGate
from math import sqrt, acos, pi

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
	x, y = QuantumRegister(n), QuantumRegister(1)
	qc = QuantumCircuit(x, y)
	qc.compose(o, inplace = True)
	qc.z(y)
	qc.compose(o, inplace = True)
	return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.x(y)
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    qc.x(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(y)
    qc.append(o, range(n+1))
    qc.cz(x[0], y)
    qc.h(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(y)
    qc.h(x)
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    qc.h(x)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(y)
    qc.h(x)
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    qc.h(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(y)
    qc.h(x)
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    qc.x(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(y)
    qc.h(x)
    qc.h(y)
    qc.compose(x, inplace=True)
    qc.h(y)
    qc.x(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x = QuantumRegister(n, 'x')
    y = QuantumRegister(1, 'y')
    qc = QuantumCircuit(x, y)

    qc.x(y)
    qc.h(y)

    qc.compose(o, inplace=True)

    return qc
'''


'''python
import math
from qiskit import QuantumCircuit
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cz(x[i], y[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)

    qc.z(0)

    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)

    qc.z(y)

    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o.inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)
    qc.z(y[0])

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    for c in range(2 ** n):
        # compute
        for i in range(n):
            if (1 << i) & c:
                qc.x(i)
        # oracle
        qc.compose(o, inplace=True)
        # un-compute
        for i in range(n):
            if (1 << i) & c:
                qc.x(i)
        # barrier
        qc.barrier()

    qc = qc.reverse_bits()
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    for c in range(2 ** n):
        # compute
        for i in range(n):
            if (1 << i) & c:
                qc.x(i)
        # oracle
        qc.compose(o, inplace=True)
        qc.z(y)
        # un-compute
        for i in range(n):
            if (1 << i) & c:
                qc.x(i)
        # barrier
        qc.barrier()

    qc = qc.reverse_bits()
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    for c in range(2 ** n):
        # compute
        for i in range(n):
            if (1 << i) & c:
                qc.x(i)
        # oracle
        qc.compose(o, inplace=True)
        qc.cz(y, x[0])
        # un-compute
        for i in range(n):
            if (1 << i) & c:
                qc.x(i)
        # barrier
        qc.barrier()

    qc = qc.reverse_bits()
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)
    qc.cz(y, x[0])

    qc = qc.reverse_bits()
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from math import pi
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cry(2*pi, n, i)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cz(n, i)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(1, n+1):
        qc.x(i)
        qc.cz(0, i)
        qc.x(i)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.z(0)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(1, n+1):
        qc.x(i)
        qc.cz(0, i)
        qc.x(i)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.z(n)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(0, n):
        qc.x(i)
        qc.cz(n, i)
        qc.x(i)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from math import pi
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.ry(2*pi, n)
    for i in range(n):
        qc.cry(2*pi, n, i)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(y)
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    qc.x(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.x(y)
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    qc.x(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(y)
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    qc.x(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n, 'x'), QuantumRegister(1, 'y')
    qc = QuantumCircuit(x, y)
    qc.compose(o, inplace=True)
    qc.z(y[0]).c_if(y, 1)
    qc.compose(o.inverse(), inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(y)
    qc.compose(o, inplace=True)
    qc.cz(x[0], y[0])
    qc.x(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o, inplace=True)
    qc.z(n)
    qc = qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(n)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o.inverse(), inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x = QuantumRegister(n, 'x')
    y = QuantumRegister(1, 'y')
    qc = QuantumCircuit(x, y)

    # Step 1: Apply Hadamard gates to create superposition
    qc.h(x)

    # Step 2: Apply the oracle
    qc.compose(o, inplace=True)

    # Step 3: Apply Hadamard gates again to the x register
    qc.h(x)

    # Step 4: Apply a controlled-Z gate to flip the phase
    qc.cz(x, y)

    # Step 5: Apply Hadamard gates one more time to the x register
    qc.h(x)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x = QuantumRegister(n, 'x')
    y = QuantumRegister(1, 'y')
    qc = QuantumCircuit(x, y)

    # Step 1: Apply Hadamard gates to create superposition
    qc.h(x)

    # Step 2: Apply the oracle
    qc.compose(o, inplace=True)

    # Step 3: Apply Hadamard gates to the ancillary qubit
    qc.h(y)

    # Step 4: Apply a controlled-Z gate to flip the phase
    qc.cz(x, y)

    # Step 5: Apply Hadamard gates to the ancillary qubit again
    qc.h(y)

    # Step 6: Apply Hadamard gates to the x register again
    qc.h(x)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y[0])
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o,implace=True)
    qc.z(n)
    qc.x(n)
    qc.compose(o,implace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o,implace=True)
    qc.z(y)

    qc.compose(o,implace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o,implace=True)
    qc.z(y)
    qc.compose(o,implace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import GlobalPhaseGate
import numpy as np
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""
def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)
    qc.cp(math.pi, y, x[0])
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import GlobalPhaseGate
import numpy as np
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""
def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.x(y)
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    qc.x(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
        qc.cx(n,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
        qc.cz(n,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cz(n,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cz(n,i)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cz(n,i)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(n)
    qc.x(n)
    qc.compose(o, inplace=True)
    qc.x(n)
    qc.h(n)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    y.h(0)
    y.x(0)
    qc.compose(o, inplace=True)
    y.x(0)
    y.h(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(n)
    qc.z(n)
    qc.compose(o, inplace=True)
    qc.z(n)
    qc.h(n)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.compose(o, inplace=True)
    qc.z(n)
    qc.x(n)

    # Write your code here:

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.compose(o, inplace=True)
    qc.z(n)
    qc.compose(o, inplace=True)

    # Write your code here:

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cz(y[0],x[0])
    qc.x(x[0])
    qc.cz(y[0],x[0])
    qc.x(x[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cz(y[0],x[0])
    qc.x(x[0])
    qc.cz(y[0],x[0])
    qc.x(x[0])
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.h(y)
    qc.x(y)
    qc.h(y)

    qc.compose(o, inplace=True)

    qc.h(y)
    qc.x(y)
    qc.h(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.mcz(list(range(n - 1)), n)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.mcz(list(range(n - 1)), n - 1)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.mcz(list(range(n - 1)), n - 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    mcz = ZGate().control(n)
    qc.append(mcz, range(n + 1))

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    mcz = ZGate().control(n)
    qc.append(mcz, range(n + 1))
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    mcz = ZGate().control(n)
    qc.append(mcz, range(n + 1))
    qc.compose(o, inplace=True)
    assert n > 1

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    mcz = ZGate().control(list(range(n)))
    qc.append(mcz, range(n + 1))
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    # qc.compose(o, inplace=True)
    mcz = ZGate().control(list(range(n)))
    qc.append(mcz, range(n + 1))
    # qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    # qc.compose(o, inplace=True)
    mcz = ZGate().control(n)
    qc.append(mcz, range(n + 1))
    # qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    mcz = ZGate().control(n)
    qc.append(mcz, range(n + 1))
    qc.compose(o.inverse(), inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    mcz = ZGate().control(n)
    qc.append(mcz, range(n + 1))
    qc.mcx(list(range(n)), n)
    qc.compose(o.inverse(), inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    mcz = ZGate().control(n)
    qc.append(mcz, range(n + 1))
    qc.mcx(list(range(n)), n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cz(n)
    qc.mcx(list(range(n)), n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cz(n)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import ZGate

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(n)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
        qc.h()

    for i in range(1,n):
        qc.cz(1,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
        qc.h()

    for i in range(o,n):
        qc.cz(1,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y[0])
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.cx(y, x[0])
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.cx(y, x[0])
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.mcp(math.pi, y, x)
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library.standard_gates import MCPhaseGate
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.mcp(math.pi, y, x)
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library.standard_gates import MCPhaseGate
import mat

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.append(MCPhaseGate(math.pi, n), n+1)
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library.standard_gates import MCPhaseGate
import mat

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.mcp(-1*math.pi, y, x)
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library.standard_gates import MCPhaseGate
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.mcp(-1*math.pi, y, x)
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library.standard_gates import MCPhaseGate
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.append(MCPhaseGate(-1*math.pi, n), range(n+1))
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library.standard_gates import MCPhaseGate
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    for q in range(n):
        qc.cz(y, q)
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library.standard_gates import MCPhaseGate
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library.standard_gates import MCPhaseGate
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o)
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library.standard_gates import MCPhaseGate
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc = qc.compose(o, inplace=True)
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    qc.cz(y, x[0])
    qc.cx(y, x[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cz(y, x[-1])
    qc.cx(y, x[-1])
    qc.cz(y, x[-1])
    qc.cx(y, x[-1])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.ch(y, x[-1])
    qc.mcx(list(range(n-1)), n-1)
    qc.ch(y, x[-1])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.ch(y, x[-1])
    qc.mcx(list(range(n-1)), n-1)
    qc.ch(y, x[-1])
    qc.reset(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.ch(n, n-1)
    qc.mcx(list(range(n-1)), n-1)
    qc.ch(n, n-1)
    qc.reset(n)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.x(x[0])
    qc.h(x[0])
    qc.cx(y, x[0])
    qc.h(x[0])
    qc.x(x[0])
    qc.reset(n)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cz(y, 0)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(n)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cry(np.pi*2, n+1, 0)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import numpy as np

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cry(np.pi*2, n+1, 0)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import numpy as np

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.cry(np.pi*2, n, 0)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    # Paso 1: Aplicar el oráculo O
    qc.compose(o, qubits=x[:] + y[:], inplace=True)

    # Paso 2: Aplicar la puerta Z al qubit auxiliar y[0]
    qc.z(y[0])

    # Paso 3: Aplicar nuevamente el oráculo O
    qc.compose(o, qubits=x[:] + y[:], inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
        qc.h(i)
    qc.compose(o, inplace=True)
    qc.z(n+1)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
        qc.h(i)
    qc.compose(o, inplace=True)
    qc.z(n)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)
    qc.z(n+)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)
    qc.z(n)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.compose(o, inplace=True)
    qc.z(y[0])
    qc.x(y[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.compose(o, inplace=True)
    qc.cz(y[0])
    qc.cx(y[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.compose(o, inplace=True)
    qc.cz(y[0], x[0])
    qc.cx(y[0], y[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.compose(o, inplace=True)
    qc.z(y[0])
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:」

    qc.compose(o, qubits=x[:] + [y[0]], inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    #私はqc.compose(o, inplace=True)を今初めて知りました。mergeぐらいしか知らねぇ

    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)

    qc.z(y[0])

    qc.compose(o.inverse(), inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    for i in range(n):
        qc.h(i)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(n)
    qc.compose(o, inplace=True)
    qc.h(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(n)
    qc.compose(o, inplace=True)
    qc.x(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(0)
    qc.compose(o, inplace=True)
    qc.h(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, x, inplace=True)
    qc.z(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, range(n), inplace=True)
    qc.z(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(n)
    qc.compose(o, range(n) inplace=True)
    qc.h(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(n)
    qc.compose(o, [range(n)], inplace=True)
    qc.h(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(n)
    qc.h(n)
    qc.compose(o, inplace=True)
    qc.h(n)
    qc.x(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cz(y[0], x[i])

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    for i in range(n):
        qc.x(y[0])
        qc.cz(y[0], x[i])
        qc.x(y[0])
        qc.cz(y[0], x[i])

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    for i in range(n):
        qc.x(x[i])
        qc.cz(y[0], x[i])
        qc.x(x[i])
        qc.cz(y[0], x[i])

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    from qiskit import ClassicalRegister
    c = ClassicalRegister(1)
    circ = QuantumCircuit(y, c)
    qc.compose(o, inplace=True)

    if circ.measure(y, c) == 1:
        x = -x

    qc = QuantumCircuit(x, y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    c = QuantumRegister(1)
    circ = QuantumCircuit(c)
    circ.x(0)

    if y == c:
        x = -x

    qc = QuantumCircuit(x, y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.x(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=Tr)
    qc.z(y)
    qc.cx(0, y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=Tr)
    qc.z(y)
    qc.cx(x[0], y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.x(y[0])
    qc.h(y[0])

    qc.compose(o, inplace=True)

    qc.h(y[0])
    qc.x(y[0])

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    # Apply the oracle O
    qc.compose(o, inplace=True)

    # Apply a CNOT gate controlled by the first qubit of x (which represents f(x))
    # and targeting the second qubit (y).
    # We assume that the oracle has been designed such that the first qubit of x
    # will represent f(x) after the oracle is applied.
    qc.cx(x[0], y[0])  # CNOT gate: control = x[0], target = y[0]

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)
    qc.z(n)
    qc.x(n, n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.compose(o, inplace=True)
    qc.z(n)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    qc.cz(y, x[0])

    return qc
'''


'''python
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    qc.cz(y, x[0])
    qc.compose(o, inplace=True)

    return qc
'''


'''python
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    qc.mcp(np.pi, x, y)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    qc.mcp(np.pi, x, y)
    qc.compose(o.inverse(), inplace=True)

    return qc
'''


'''python
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o.inverse(), inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.z(y)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import math

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.p(math.pi,y)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from math import (
    pi,
    # degrees,
    # radians,
    # asin,
    # acos,
    # atan2,
    # sqrt,
    # sin,
    # cos,
    # tan
)
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister

# from qiskit.circuit.library.standard_gates import (
#     C3XGate,
#     C3SXGate,
#     C4XGate,
#     CCXGate,
#     DCXGate,
#     CHGate,
#     CPhaseGate,
#     CRXGate,
#     CRYGate,
#     CRZGate,
#     CSwapGate,
#     CSXGate,
#     CUGate,
#     CU1Gate,
#     CU3Gate,
#     CXGate,
#     CYGate,
#     CZGate,
#     CCZGate,
#     HGate,
#     IGate,
#     MCPhaseGate,
#     PhaseGate,
#     RCCXGate,
#     RC3XGate,
#     RXGate,
#     RXXGate,
#     RYGate,
#     RYYGate,
#     RZGate,
#     RZZGate,
#     RZXGate,
#     XXMinusYYGate,
#     XXPlusYYGate,
#     ECRGate,
#     SGate,
#     SdgGate,
#     CSGate,
#     CSdgGate,
#     SwapGate,
#     iSwapGate,
#     SXGate,
#     SXdgGate,
#     TGate,
#     TdgGate,
#     UGate,
#     U1Gate,
#     U2Gate,
#     U3Gate,
#     XGate,
#     YGate,
#     ZGate,
# )

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)

    return qc
'''


'''python
from math import (
    pi,
    # degrees,
    # radians,
    # asin,
    # acos,
    # atan2,
    # sqrt,
    # sin,
    # cos,
    # tan
)
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister

# from qiskit.circuit.library.standard_gates import (
#     C3XGate,
#     C3SXGate,
#     C4XGate,
#     CCXGate,
#     DCXGate,
#     CHGate,
#     CPhaseGate,
#     CRXGate,
#     CRYGate,
#     CRZGate,
#     CSwapGate,
#     CSXGate,
#     CUGate,
#     CU1Gate,
#     CU3Gate,
#     CXGate,
#     CYGate,
#     CZGate,
#     CCZGate,
#     HGate,
#     IGate,
#     MCPhaseGate,
#     PhaseGate,
#     RCCXGate,
#     RC3XGate,
#     RXGate,
#     RXXGate,
#     RYGate,
#     RYYGate,
#     RZGate,
#     RZZGate,
#     RZXGate,
#     XXMinusYYGate,
#     XXPlusYYGate,
#     ECRGate,
#     SGate,
#     SdgGate,
#     CSGate,
#     CSdgGate,
#     SwapGate,
#     iSwapGate,
#     SXGate,
#     SXdgGate,
#     TGate,
#     TdgGate,
#     UGate,
#     U1Gate,
#     U2Gate,
#     U3Gate,
#     XGate,
#     YGate,
#     ZGate,
# )

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:

    qc.x(y)
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    qc.x(y)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    You can apply oracle as follows:
    qc.z(y)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y, z = QuantumRegister(n), QuantumRegister(1), QuantumRegister(1)
    qc = QuantumCircuit(x, y, z)
    # Write your code here:

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
form math import pi
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y, z)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cry(2*pi,y,x[i])

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
form math import pi
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y, z)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(y)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from math import pi
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y, z)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        rc.cry(2*pi, y, x[i])
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from math import pi
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y, z)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cry(2*pi, y, x[i])
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from math import pi
"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    for i in range(n):
        qc.cry(2*pi, y, x[i])
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(2)
    qc.barrier()
    qc.compose(o, inplace=True)
    qc.barrier()
    qc.h(2)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(y)
    qc.barrier()
    qc.compose(o, inplace=True)
    qc.barrier()
    qc.h(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(0)
    qc.barrier()
    qc.compose(o, inplace=True)
    qc.barrier()
    qc.h(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(y)
    qc.h(y)
    qc.barrier()
    qc.compose(o, inplace=True)
    qc.barrier()
    qc.h(y)
    qc.x(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from math import pi, acos, sqrt

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(n)
    qc.h(n)
    qc.compose(o, inplace=True)
    qc.h(n)
    qc.x(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y, z = QuantumRegister(n), QuantumRegister(1), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.add_bits(z)
    qc.compose(o, inplace=True)
    qc.cx(n, n+1)
    qc.cz(n+1, n)
    qc.cx(n, n+1)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.compose(o, inplace=True)
    qc.z(n)
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(n)
    qc.h(n)
    qc.compose(o, inplace=True)
    qc.h(n)
    qc.x(n)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.z(n)
    qc.cx(n, n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.z(n)
    # qc.cx(n, n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.z(n)
    qc.measure(n)
    qc.x(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.z(n)
    qc.measure([n])
    qc.x(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    qc.x(n)
    qc.z(n)
    qc.x(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)

    qc.add_bits(QuantumRegister(1))
    qc.cx(n, n+1)
    qc.z(n+1)
    qc.cx(n, n+1)
    qc.x(n)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(1)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    qc.z(n)
    qc.compose(o, inplace=True)

    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.z(x[0])
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.cx(x[0],y)
    qc.z(y)
    qc.cx(x[0],y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.x(y)
    qc.cz(x[0], y)
    qc.x(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.compose(o, inplace=True)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister

"""
You can apply oracle as follows:
qc.compose(o, inplace=True)
"""

def solve(n: int, o: QuantumCircuit) -> QuantumCircuit:
    x, y = QuantumRegister(n), QuantumRegister(1)
    qc = QuantumCircuit(x, y)
    # Write your code here:
    qc.h(y)
    qc.compose(o, inplace=True)
    qc.h(y)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
import numpy as np
# from qiskit.quantum_info import Statevector

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.ry(T[i]*2,i)

    return qc

# if __name__ == "__main__":
#     T=[np.pi/6,np.pi/3,np.pi/2]
#     qc = solve(3,T)
#     print(Statevector(qc))
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    for i in range(n):
        theta = 2 * T[i]
        qc.ry(theta, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    j=len(T)
    for i in range(j):
        qc.h(i)
        qc.ry(T[i],i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.ry(T[i],i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.ry(2*T[i],i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.rx(2*T[i],i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.rx(T[i],i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.rz(T[i],i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.p(T[i],i)
        qc.h(i)
        qc.p(T[i],i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.p(2*T[i],i)
        qc.h(i)
        qc.p(2*T[i],i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.p(2*T[i],i)
        qc.h(i)
        qc.p(pi,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.p(2*T[i],i)
        qc.h(i)
        qc.p(math.pi,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.p(T[i],i)
        qc.h(i)
        qc.p(math.pi/2,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.h(i)
        qc.p(2*T[i],i)
        qc.h(i)
        qc.p(math.pi/2,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        # Aplicar una rotación Ry con ángulo 2*T[i] al qubit i
        qc.ry(2 * T[i], i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import numpy as np

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        theta = 2 * T[i]  # Calcular el ángulo
        qc.ry(theta, i)   #Aplicar rotacion

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        theta = 2 * T[i]
        qc.u(theta, 0, 0, i)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(len(T)):
        theta = 2 / T[i]
        qc.ry(theta, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(len(T)):
        theta = 2 * T[i]
        qc.ry(theta, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.ry(theta=2*T[i], qubit=i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for _ in range(n):
        qc.ry(T[_] * 2, _)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.ry(2*T[i],i)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        theta = abs(T[i])*2
        qc.ry(theta, i)
        if T[i]<0:
            qc.z(i)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:

    for i in range(n):
        qc.ry(2 * T[i], i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for qubit,t in enumerate(T):
        qc.ry(t, qubit)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for qubit,t in enumerate(T):
        qc.ry(2t, qubit)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for qubit,t in enumerate(T):
        i = 2t
        qc.ry(i, qubit)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for qubit,t in enumerate(T):
        i = 2*t
        qc.ry(i, qubit)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.ry(2*T[i], 1)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.ry(2*T[i], i)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.h(i)
        qc.rz(2*T[i],i)
        qc.S(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(2*T[i],i)
        qc.S(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-):
        qc.h(i)
        qc.rz(2*T[i],i)
        qc.s(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(2*T[i],i)
        qc.s(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(-2*T[i],i)
        qc.s(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(T[i],i)
        qc.s(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(2*T[i],i)
        qc.h(0)
        qc.s(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(2*T[i],i)
        qc.h(i)
        qc.s(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(-2*T[i],i)
        qc.h(i)
        qc.s(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(-2*T[i],i)
        qc.h(i)
        #qc.s(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(-2*T[i],i)
        qc.h(i)
        qc.P(-math.pi/2,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import mat

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    theta=math.pi
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(-2*T[i],i)
        qc.h(i)
        qc.P(-theta/2,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    theta=math.pi
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(-2*T[i],i)
        qc.h(i)
        qc.p(-theta/2,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    theta=math.pi
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(2*T[i],i)
        qc.h(i)
        qc.p(-theta/2,i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n-1):
        qc.h(i)
        qc.rz(2*T[i],i)
        qc.h(i)
        qc.s(i)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.h(i)
        qc.rz(2*T[i],i)
        qc.h(i)
        qc.s(i)
    return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import , PhaseGate, CXGate, ZGate
from math import sqrt, acos, pi

def solve(n: int, T: list[float]) -> QuantumCircuit:
	qc = QuantumCircuit(n)
	for i in range(n):
		qc.ry(T[i] * 2, i)
	return qc
'''


'''python
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import PhaseGate, CXGate, ZGate
from math import sqrt, acos, pi

def solve(n: int, T: list[float]) -> QuantumCircuit:
	qc = QuantumCircuit(n)
	for i in range(n):
		qc.ry(T[i] * 2, i)
	return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.ry(2*T[i],i)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)

    for i in range(n):
        qc.ry(2*T[i], i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.rx(T[i], i)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int, T: list[float]) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.ry(2*T[i], i)
    return qc
'''