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

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

    qc.ry(2 * acos(1 / sqrt(3)), 0)

    qc.h(1)
    qc.cx(1, 2)

    qc.cx(1, 2)

    qc.x(0)

    return qc
'''


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

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

    qc.ry(2 * acos(1 / sqrt(3)), 0)

    qc.h(1)
    qc.cx(1, 2)

    qc.cx(0, 1)

    qc.x(0)

    return qc
'''


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

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

    qc.ry(1.231, 0)

    qc.x(0)

    qc.ch(0,1)
    qc.x(1)
    qc.cx(1, 2)

    qc.ccx([0,1],2)

    qc.x(0)
    qc.x(1)

    return qc
'''


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

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

    qc.ry(2*acos(1/sqrt(3)), 0)

    qc.x(0)

    qc.ch(0,1)
    qc.x(1)
    qc.cx(1, 2)

    qc.ccx([0,1],2)

    qc.x(0)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    # Calculate angles
    theta1 = 2 * math.acos(1 / math.sqrt(3))
    theta2 = 2 * math.acos(1 / math.sqrt(2))

    # Apply gates to create the W state
    qc.u(theta1, 0, 0, 0)       # Apply R_y rotation on qubit 0
    qc.cx(0, 1)                 # CNOT with qubit 0 as control and qubit 1 as target
    qc.u(theta2, 0, 0, 1)       # Apply R_y rotation on qubit 1
    qc.cx(1, 2)                 # CNOT with qubit 1 as control and qubit 2 as target

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    # Calculate angle for first rotation
    theta1 = 2 * math.acos(1 / math.sqrt(3))  # Rotation to create superposition with desired amplitudes

    # Apply rotation on qubit 0 to create partial superposition
    qc.ry(theta1, 0)

    # Apply CNOT gates to entangle qubits
    qc.cx(0, 1)  # Control on qubit 0, target on qubit 1
    qc.ry(2 * math.acos(1 / math.sqrt(2)), 1)  # Adjust the amplitude on qubit 1
    qc.cx(1, 2)  # Control on qubit 1, target on qubit 2

    return qc
'''


'''python
import math
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    # Define rotation angles for controlled-Ry gates
    theta1 = 2 * math.atan(math.sqrt(2))  # Angle to create superposition on first target
    theta2 = 2 * math.atan(1)              # Angle to balance amplitudes between states

    # Start with the initial state by flipping qubit 0
    qc.x(0)

    # Apply controlled-Ry rotation with qubit 0 as control and qubit 1 as target
    qc.cry(theta1, 0, 1)

    # Apply CNOT with qubit 1 as control and qubit 0 as target to entangle states
    qc.cx(1, 0)

    # Apply controlled-Ry with qubit 1 as control and qubit 2 as target
    qc.cry(theta2, 1, 2)

    # Apply CNOT with qubit 2 as control and qubit 1 as target
    qc.cx(2, 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    th = math.atan(math.sqrt(2))

    qc.ry(th)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.cx(1, 2)
    qc.cx(0, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    th = math.arctan(math.sqrt(2))

    qc.ry(th)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.cx(1, 2)
    qc.cx(0, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    th = math.artan(math.sqrt(2))

    qc.ry(th, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.cx(1, 2)
    qc.cx(0, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    th = math.atan(math.sqrt(2))

    qc.ry(th, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.cx(1, 2)
    qc.cx(0, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    th = 2 * math.atan(math.sqrt(2))

    qc.ry(th, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.cx(1, 2)
    qc.cx(0, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    th = 2 * math.atan(math.sqrt(2))

    qc.ry(th, 0)
    qc.ch(0, 1)
    qc.x(2)
    qc.cx(1, 0)
    qc.cx(1, 2)
    qc.cx(0, 2)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    prob_amp = np.sqrt(1 / 3)
    rot_ang = 2 * np.arccos(prob_amp)
    qc.x(0)

    for i in range(2):
        comp_amp = np.sqrt(1 - i / 3)
        rot_ang = 2 * np.arccos(prob_amp / (comp_amp))
        qc.cry(rot_ang, i, i + 1)
        qc.cx(i + 1, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6) / (3 + math.sqrt(3)))

    qc.ry(theta, 0)

    qc.ch(0, 1)

    qc.cx(1, 0)

    qc.x(0)
    qc.x(1)

    qc.ccx(0,1,2)

    qc.x(0)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6) / (3 + math.sqrt(3)))

    qc.ry(theta, 0)

    qc.ch(0, 1)

    qc.cx(1, 0)

    qc.x(0)
    qc.x(1)

    qc.ccx(0,1,2)

    qc.x(0)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.ry(-math.asin(1/3), 0)
    qc.h(0)
    qc.cx(0, 1)
    qc.x(0)
    qc.ch(1, 2)
    qc.cx(2, 1)

    return qc
'''


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

def F_gate(circ,i,j,n,k) :
  theta = np.arccos(np.sqrt(1/(n-k+1)))
  circ.ry(-theta,j)
  circ.cz(i,j)
  circ.ry(theta,j)

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    qc.x(2)
    F_gate(qc,2,1,3,1)
    F_gate(qc,1,0,3,2)
    qc.cx(1, 2)
    qc.cx(0, 1)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    qc.x(1)
    qc.h(0)
    qc.cx(0,1)
    qc.x(1)
    qc.cx(1,2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    qc.cx(0,1)
    qc.x(2)
    qc.ccx(0,1,2)
    qc.cx(0,1)
    qc.x(2)

    qc.x(1)
    qc.x(2)
    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    qc.cx(0,1)
    qc.cx(0,2)

    qc.x(1)
    qc.x(2)

    qc.ccx(1,2,0)

    qc.x(1)
    qc.x(0)
    qc.x(2)

    qc.h(0)
    qc.h(1)
    qc.h(2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    qc.h(2)
    qc.cx(2, 1)
    qc.cx(2, 0)
    qc.x(1)
    qc.x(0)
    qc.barrier()

    qc.h(2)
    qc.cx(2, 1)
    qc.cx(2, 0)
    qc.h(2)
    qc.barrier()

    qc.x(2)
    qc.cx(1, 0)
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit

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


'''python
from qiskit import QuantumCircuit

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


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import HGate
import numpy as np

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * np.arccos(1 / np.sqrt(3))
    qc.ry(theta, 0)
    h_gate = HGate()
    ch_gate = h_gate.control(1)
    qc.append(ch_gate, [0, 1])
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
      theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x(2)
    qc.cx(0,2)
    qc.cx(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
      theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x()
    qc.cx(0,2)
    qc.cx(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import mat

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
      theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x(2)
    qc.cx(0,2)
    qc.cx(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
      theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x(2)
    qc.cx(0,2)
    qc.cx(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x(2)
    qc.cx(0,2)
    qc.cx(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(0,2)
    qc.cx(1,2)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(0, 1)
    qc.cx(1, 2)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(0, 1)
    qc.cx(1, 2)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(0, 1)
    qc.cx(1, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(0, 1)
    qc.cx(1, 2)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.u(2 * math.acos(1 / math.sqrt(3)), 0, 0, 0)  # 量子ビット 0 に U を適用
    qc.cx(0, 1)  # 制御NOTでビット 1 と 0 をエンタングル
    qc.cx(0, 2)  # 制御NOTでビット 2 と 0 をエンタングル
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4*math.atan(math.sqrt(6)/(3+math.sqrt(3)))
    qc.x(2)
    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.cx(0, 2)
    qc.cx(1, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    t = 2*math.acos(math.sqrt(2/3))
    qc.ry(t, 1)
    qc.cx(1,0)
    qc.ch(1,2)
    qc.cx(2,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math
import numpy

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

    qc.x(0)
    for i in range(n - 1):
        theta = 2 * numpy.arccos(math.sqrt(1/(n - i)))
        qc.cry(theta, i, i + 1)

    for i in range(n - 1):
        qc.cx(i + 1, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as m
from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.UnitaryGate((1/m.sqrt(3))matrix, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as m
from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.UnitaryGate((1/m.sqrt(3))*matrix, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as m
#from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.UnitaryGate((1/m.sqrt(3))*matrix, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as m
#from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.UnitaryGate((1/m.sqrt(3))*mat, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as m
#from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.UnitaryGate((1/sqrt(3))*mat, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as m
from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.UnitaryGate((1/msqrt(3))*mat, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as m
from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.UnitaryGate((1/sqrt(3))*mat, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
#import math as m
#from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.unitary((1/sqrt(3))*mat, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as math
#from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.unitary((1/math.sqrt(3))*mat, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as math
#from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,1],
       [0,0,0,0],
       [0,0,0,0],
       [0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.unitary((1/math.sqrt(3))*mat, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as math
#from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,1,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.unitary((1/math.sqrt(3))*mat, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as math
#from qiskit.circuit.library import UnitaryGate

mat = [[0,1,1,0,0,0,0,1],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0],
       [0,0,0,0,0,0,0,0]]

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.unitary((1/math.sqrt(3))*mat, [0,1,2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
#import numpy as np
import math as math
#from qiskit.circuit.library import UnitaryGate

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.h(0)
    qc.cx(0, 1)
    qc.cx(0, 2)
    qc.u1(-2 * np.arccos(1/np.sqrt(3)), 0)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.ch(0,2)
    qc.cx(0,1)
    qc.cx(2,1)
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.ch(0,2)
    qc.cx(0,1)
    qc.cx(2,1)
    qc.x(0)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    prob_amp = np.sqrt(1 / 3)
    rot_ang = 2 * np.arccos(prob_amp)
    qc.x(0)

    for i in range(2):
        comp_amp = np.sqrt(1 - i / 3)
        rot_ang = 2 * np.arccos(prob_amp / (comp_amp))
        qc.cry(rot_ang, i, i + 1)
        qc.cx(i + 1, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * math.atan(math.sqrt(2))
    qc.ry(theta, 0)
    qc.ch(0,1)
    qc.x(0)
    qc.x(2)
    qc.cx(0, 2)
    qc.cx(1, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * acos(sqrt(1/3))
    qc.ry(theta, 0)

    qc.cx(0, 1)
    qc.cx(0, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    qc.h(1)
    qc.h(2)

    qc.cx(1,2)
    qc.cx(0,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    qc.cx(0, 1)
    qc.cx(0, 2)

    angle = 2 * math.acos(1 / math.sqrt(3))
    qc.ry(angle, 1)  # Rotate qubit 1
    qc.ry(angle, 2)  # Rotate qubit 2

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    qc.cx(0, 1)
    qc.cx(0, 2)

    angle = 2 * math.acos(1 / math.sqrt(3))
    qc.ry(angle, 1)  # Rotate qubit 1
    qc.ry(angle, 2)  # Rotate qubit 2

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    qc.cx(0, 1)
    qc.cx(0, 2)

    qc.ccx(1,2,0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(2* (1/math.sqrt(3)),0)

    qc.cx(0, 1)
    qc.cx(0, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    qc.cx(0,1)
    qc.cx(0,2)

    qc.rz(2 * (math.pi/3),1)
    qc.rz(2 * (math.pi/3),2)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta_1 = 2 *np.arccos(1/ np.sqrt(3))
    qc.ry(theta_1,0)

    theta_2 = 2 * np.arccos(1/np.sqrt(2))
    qc.cry(theta_2,0,1)

    qc.cry(theta_2,0, 2)

    qc.x(2)
    qc.cx(0,2)
    qc.cx(1,0)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    theta_1 = 2 * np.arccos(1 / np.sqrt(3))
    qc.ry(theta_1, 0)
    theta_2 = 2 * np.arccos(1 / np.sqrt(2))
    qc.cry(theta_2, 0, 1)
    qc.cry(theta_2, 0, 2)
    qc.cx(0, 1)
    qc.cx(0, 2)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)
    qc.cx(0,1)
    qc.cx(0,2)
    qc.h(1)
    qc.cx(1,2)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)
    qc.cx(0,1)
    qc.cx(0,2)
    qc.h(1)
    qc.h(2)
    qc.ccx(1,2,0)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)
    qc.cx(0, 1)
    qc.cx(0, 2)

    qc.p(math.pi / 3, 0)
    qc.h(0)

    qc.p(-math.pi / 3, 1)

    return qc
'''


'''python
import math
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(math.acos(math.sqrt(3)/3), 0)
    qc.cry(math.acos(1/math.sqrt(2)), 0, 1)
    qc.cx(1, 2)
    qc.x(0)
    return qc

if __name__ == "__main__":
    qc = solve()
    print(qc)
'''


'''python
import math
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(math.acos(math.sqrt(3)/2), 0)
    qc.cry(math.acos(1/math.sqrt(2)), 0, 1)
    qc.cx(1, 2)
    qc.x(0)
    return qc

if __name__ == "__main__":
    qc = solve()
    print(qc)
'''


'''python
import math
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(math.acos(math.sqrt(3)/2) * 2, 0)
    qc.cry(math.acos(1/math.sqrt(2)) * 2, 0, 1)
    qc.cx(1, 2)
    qc.x(0)
    return qc

if __name__ == "__main__":
    qc = solve()
    print(qc)
'''


'''python
import math
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(math.acos(math.sqrt(2/3)) * 2, 0)
    qc.cry(math.acos(1/math.sqrt(2)) * 2, 0, 1)
    qc.cx(1, 2)
    qc.x(0)
    return qc

if __name__ == "__main__":
    qc = solve()
    print(qc)
'''


'''python
import math
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(math.acos(math.sqrt(2/3)) * 2, 0)
    qc.cx(0, 1)
    qc.x(0)
    qc.cry(math.acos(math.sqrt(1/2)) * 2, 1, 2)
    qc.cx(2, 1)
    return qc

if __name__ == "__main__":
    qc = solve()
    print(qc)
'''


'''python
import math
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(math.asin(math.sqrt(2/3)) * 2, 0)
    qc.cx(0, 1)
    qc.x(0)
    qc.cry(math.asin(math.sqrt(1/2)) * 2, 1, 2)
    qc.cx(2, 1)
    return qc

if __name__ == "__main__":
    qc = solve()
    print(qc)
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.ry(acos(sqrt(1/3)) * 2, 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)
    return qc

# from qiskit.quantum_info import Statevector
# if __name__ == "__main__":
#     qc = solve()
#     print(Statevector(qc))
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta1 = 2 * np.arccos(1/np.sqrt(3))
    theta2 = 2 * np.arccos(1/np.sqrt(2))

    qc.ry(theta1, 0)
    qc.cx(0, 1)
    qc.ry(theta2, 1)
    qc.cx(1, 2)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    angle=np.arcsin(1/np.sqrt(3))
    qc.ry(2*angle, 0)
    qc.barrier()
#1,2成分をBell状態の|01>+|10>にする
    qc.h(1)
    qc.cx(1,2)
    qc.x(1)

#Aliceが1のときBob, Charlieを|00>、入力状態に戻すために逆変換している（controlled x-gateはcx.()そのものである）
    qc.cx(0,1)
    qc.ccx(0,1,2)
    qc.ch(0,1)
    # Write your code here:

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.x(0)
    qc.x(2)
    qc.cx(2, 1)
    qc.cx(0, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.x(0)
    qc.x(2)
    qc.cx(1, 2)
    qc.cx(0, 2)

    return qc
'''


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

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

    qc.x(0)
    qc.cry(math.acos(1/3), 0, 2)
    qc.cx(2, 0)

    qc.cry(math.acos(0), 0, 1)
    qc.cx(1, 0)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(np.arccos(1/np.sqrt(3))*2, 0)
    qc.cry(np.arccos(1/np.sqrt(2))*2, [0,1])
    qc.x(2)
    qc.cx(0,2)
    qc.cx(1, 0)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(np.arccos(1/np.sqrt(3))*2, 0)
    qc.cry(np.arccos(1/np.sqrt(2))*2, 0, 1)
    qc.x(2)
    qc.cx(0,2)
    qc.cx(1, 0)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.ry(2 * np.arccos(np.sqrt(1/3)), 0)
    qc.cry(2 * np.arccos(np.sqrt(1/2)), 0, 1)
    # |001>の成分を作る

    qc.x(1)
    qc.x(2)

    qc.ccx(0, 1, 2)

    qc.x(0)
    qc.x(2)
    qc.x(1)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.ry(2 * np.arccos(np.sqrt(1/3)), 0)
    qc.cry(2 * np.arccos(np.sqrt(1/2)), 0, 1)
    # |001>の成分を作る

    qc.x(1)
    qc.x(2)

    qc.ccx(0, 1, 2)

    qc.x(0)
    qc.x(2)
    qc.x(1)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    import numpy as np
    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    #000 -> 001
    qc.x(0)
    qc.x(1)
    qc.mcx([0, 1], 2)
    qc.x(0)
    qc.x(1)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    q = QuantumRegister(n)

    # Define a F_gate
    def F_gate(circ,q,i,j,n,k) :
        theta = np.arccos(np.sqrt(1/(n-k+1)))
        circ.ry(-theta,q[j])
        circ.cz(q[i],q[j])
        circ.ry(theta,q[j])
        circ.barrier(q[i])
    # Define the cxrv gate which uses reverse CNOT instead of CNOT
    def  cxrv(circ,q,i,j) :
        circ.h(q[i])
        circ.h(q[j])
        circ.cx(q[j],q[i])
        circ.h(q[i])
        circ.h(q[j])
        circ.barrier(q[i],q[j])

    qc.x(q[2]) #start is |100>
    F_gate(qc,q,2,1,3,1) # Applying F12
    F_gate(qc,q,1,0,3,2) # Applying F23

    if flag_qx2 : # option ibmqx2
        W_states.cx(q[1],q[2]) # cNOT 21
        W_states.cx(q[0],q[1]) # cNOT 32

    else :        # option ibmqx4
        cxrv(W_states,q,1,2)
        cxrv(W_states,q,0,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    q = QuantumRegister(n)

    # Define a F_gate
    def F_gate(circ,q,i,j,n,k) :
        theta = np.arccos(np.sqrt(1/(n-k+1)))
        circ.ry(-theta,q[j])
        circ.cz(q[i],q[j])
        circ.ry(theta,q[j])
        circ.barrier(q[i])
    # Define the cxrv gate which uses reverse CNOT instead of CNOT
    def  cxrv(circ,q,i,j) :
        circ.h(q[i])
        circ.h(q[j])
        circ.cx(q[j],q[i])
        circ.h(q[i])
        circ.h(q[j])
        circ.barrier(q[i],q[j])

    qc.x(q[2]) #start is |100>
    F_gate(qc,q,2,1,3,1) # Applying F12
    F_gate(qc,q,1,0,3,2) # Applying F23

    if flag_qx2 : # option ibmqx2
        qc.cx(q[1],q[2]) # cNOT 21
        qc.cx(q[0],q[1]) # cNOT 32

    else :        # option ibmqx4
        cxrv(qc,q,1,2)
        cxrv(qc, q,0,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    q = QuantumRegister(3)

    # Define a F_gate
    def F_gate(circ,q,i,j,n,k) :
        theta = np.arccos(np.sqrt(1/(n-k+1)))
        circ.ry(-theta,q[j])
        circ.cz(q[i],q[j])
        circ.ry(theta,q[j])
        circ.barrier(q[i])
    # Define the cxrv gate which uses reverse CNOT instead of CNOT
    def  cxrv(circ,q,i,j) :
        circ.h(q[i])
        circ.h(q[j])
        circ.cx(q[j],q[i])
        circ.h(q[i])
        circ.h(q[j])
        circ.barrier(q[i],q[j])

    qc.x(q[2]) #start is |100>
    F_gate(qc,q,2,1,3,1) # Applying F12
    F_gate(qc,q,1,0,3,2) # Applying F23

    if flag_qx2 : # option ibmqx2
        qc.cx(q[1],q[2]) # cNOT 21
        qc.cx(q[0],q[1]) # cNOT 32

    else :        # option ibmqx4
        cxrv(qc,q,1,2)
        cxrv(qc,q,0,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    # qc = QuantumCircuit(3)
    # # Write your code here:
    # q = QuantumRegister(3)

    def F_gate(circ,q,i,j,n,k) :
        theta = np.arccos(np.sqrt(1/(n-k+1)))
        circ.ry(-theta,q[j])
        circ.cz(q[i],q[j])
        circ.ry(theta,q[j])
        circ.barrier(q[i])
    # Define the cxrv gate which uses reverse CNOT instead of CNOT
    def  cxrv(circ,q,i,j) :
        circ.h(q[i])
        circ.h(q[j])
        circ.cx(q[j],q[i])
        circ.h(q[i])
        circ.h(q[j])
        circ.barrier(q[i],q[j])

    # 3-qubit W state
    flag_qx2 = True

    n = 3
    q_w = QuantumRegister(n)

    W_states = QuantumCircuit(q_w)

    W_states.x(q_w[2]) #start is |100>
    F_gate(W_states,q_w,2,1,3,1) # Applying F12
    F_gate(W_states,q_w,1,0,3,2) # Applying F23

    if flag_qx2 : # option ibmqx2
        W_states.cx(q_w[1],q_w[2]) # cNOT 21
        W_states.cx(q_w[0],q_w[1]) # cNOT 32

    else :        # option ibmqx4
        cxrv(W_states,q_w,1,2)
        cxrv(W_states,q_w,0,1)
    # print(W_states)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # # Write your code here:
    # q = QuantumRegister(3)

    def F_gate(circ,q,i,j,n,k) :
        theta = np.arccos(np.sqrt(1/(n-k+1)))
        circ.ry(-theta,q[j])
        circ.cz(q[i],q[j])
        circ.ry(theta,q[j])
        circ.barrier(q[i])
    # Define the cxrv gate which uses reverse CNOT instead of CNOT
    def  cxrv(circ,q,i,j) :
        circ.h(q[i])
        circ.h(q[j])
        circ.cx(q[j],q[i])
        circ.h(q[i])
        circ.h(q[j])
        circ.barrier(q[i],q[j])

    # 3-qubit W state
    flag_qx2 = True

    n = 3
    q_w = QuantumRegister(n)

    qc = QuantumCircuit(q_w)

    qc.x(q_w[2]) #start is |100>
    F_gate(qc,q_w,2,1,3,1) # Applying F12
    F_gate(qc,q_w,1,0,3,2) # Applying F23

    if flag_qx2 : # option ibmqx2
        qc.cx(q_w[1],q_w[2]) # cNOT 21
        qc.cx(q_w[0],q_w[1]) # cNOT 32

    else :        # option ibmqx4
        cxrv(qc,q_w,1,2)
        cxrv(qc,q_w,0,1)
    # print(qc)
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # # Write your code here:
    # q = QuantumRegister(3)

    def F_gate(circ,q,i,j,n,k) :
        theta = np.arccos(np.sqrt(1/(n-k+1)))
        circ.ry(-theta,q[j])
        circ.cz(q[i],q[j])
        circ.ry(theta,q[j])
        circ.barrier(q[i])
    # Define the cxrv gate which uses reverse CNOT instead of CNOT
    def  cxrv(circ,q,i,j) :
        circ.h(q[i])
        circ.h(q[j])
        circ.cx(q[j],q[i])
        circ.h(q[i])
        circ.h(q[j])
        circ.barrier(q[i],q[j])

    # 3-qubit W state
    flag_qx2 = True

    n = 3
    q_w = QuantumRegister(n)

    qc = QuantumCircuit(q_w)

    qc.x(q_w[2]) #start is |100>
    F_gate(qc,q_w,2,1,3,1) # Applying F12
    F_gate(qc,q_w,1,0,3,2) # Applying F23

    if flag_qx2 : # option ibmqx2
        qc.cx(q_w[1],q_w[2]) # cNOT 21
        qc.cx(q_w[0],q_w[1]) # cNOT 32

    else :        # option ibmqx4
        cxrv(qc,q_w,1,2)
        cxrv(qc,q_w,0,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    theta = math.atan(math.sqrt(2)) * 2

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(0, 2)
    qc.x(0)
    qc.cx(1, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.h(0)
    qc.ch(0, 1)
    qc.x(1)
    qc.ccx(0, 1, 2)
    qc.x(0)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.x(0)
    qc.x(1)
    qc.ccx(0, 1, 2)
    qc.x(0)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.cx(0, 2)
    qc.cx(1, 2)
    qc.x(2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    a = (1 / 3) ** 0.5
    qc.ry(2 * math.acos(a), 0)
    qc.ch(0, 1)
    qc.x(2)
    qc.cx(0, 2)
    qc.cx(1, 0)
    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import acos

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.ry(acos(-1/3), 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.x(0)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import acos

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.ry(acos(-1/3), 0)
    qc.x(0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.x(0)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import acos

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.ry(acos(-1/3), 0)
    qc.x(0)
    qc.ch(0, 1)
    qc.x(0)

    qc.cx(1, 2)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import acos

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.ry(acos(1/3), 0)
    qc.x(0)
    qc.ch(0, 1)
    qc.x(0)

    qc.cx(1, 2)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import acos

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.ry(acos(1/3), 0)
    qc.x(0)
    qc.ch(0, 1)
    qc.x(0)

    qc.cx(1, 2)
    qc.x(1)
    qc.cx(0, 1)

    return qc
'''


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

def solve() -> QuantumCircuit:
	qc = QuantumCircuit(3)
	theta = 2 * acos(1 / sqrt(3))
	qc.x(0)
	qc.cry(theta, 0, 1)
	qc.ch(1, 0)
	qc.cz(0, 1)
	qc.x(0)
	qc.x(1)
	qc.ccx(0, 1, 2, ctrl_state = 0)
	return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)
    qc.x(1)
    qc.ch(0,2)
    qc.cx(0,1)
    qc.cx(2,0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 0)
    qc.x(1)
    qc.ch(0,2)
    qc.cx(0,1)
    qc.cx(2,0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    desired_state = Statevector([0, 1/3**0.5, 0, 0, 1/3**0.5, 0, 0, 1/3**0.5])
    qc.initialize(desired_state, [0, 1, 2])

    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import HGate, UGate

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)

    qc.append(UGate(2 * (3 ** -0.5), 0, 0).control(1), [0, 1])
    qc.append(UGate(2 * (3 ** -0.5), 0, 0).control(1), [0, 2])

    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import UGate

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)

    amplitude = 2 * (1/3)**0.5
    qc.append(UGate(amplitude, 0, 0).control(1), [0, 1])
    qc.append(UGate(amplitude, 0, 0).control(1), [0, 2])

    qc.append(UGate(amplitude, 0, 0).control(1), [1, 2])

    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import  HGate, CCX

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)
    qc.cx(0, 2)
    qc.cx(0, 1)
    qc.ccx(0, 1, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import  HGate, CCX

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)
    qc.cx(0, 2)
    qc.cx(0, 1)
    qc.ccx(0, 1, 2)
    angle = 2 * (-1.0 / 3)
    qc.rz(angle, 0)
    qc.rz(angle, 1)
    qc.rz(angle, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import HGate, CXGate, CCX

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)

    qc.cx(0, 2)
    qc.cx(0, 1)
    qc.ccx(0, 1, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import HGate, CXGate

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)

    qc.cx(0, 2)
    qc.cx(0, 1)
    qc.ccx(0, 1, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import HGate, CXGate

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)

    qc.cx(0, 2)
    qc.cx(0, 1)
    qc.ccx(0, 1, 2)
    qc.h(0)
    qc.h(1)
    qc.h(2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    qc.h(0)

    qc.cx(0, 2)
    qc.cx(0, 1)
    qc.ccx(0, 1, 2)
    qc.h(0)
    qc.h(1)
    qc.h(2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(2 * math.atan(math.sqrt(2)), 0, 1)
    qc.cx(0,1)
    qc.cry(math.pi, 1, 2)
    qc.cx(2,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(2 * math.atan(math.sqrt(2)), 0, 1)
    qc.cx(0,1)
    qc.cry(math.pi / 2, 1, 2)
    qc.cx(2,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(2 * math.atan(math.sqrt(2)), 0, 1)
    qc.cx(1,0)
    qc.cry(math.pi / 2, 1, 2)
    qc.cx(2,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    qc.h(0)
    qc.x(1)
    qc.cx(0,1)

    qc.cx(2,0)
    qc.cx(2,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    qc.h(0)
    qc.x(1)
    qc.cx(0,1)
    qc.cx(1,2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 0)
    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 1)
    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 2)

    return qc
'''


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

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

    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 0)
    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 1)
    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 2)

    return qc
'''


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

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

    qc.ry(2 * arccos(1 / np.sqrt(3)), 0)
    qc.ry(2 * arccos(1 / np.sqrt(3)), 1)
    qc.ry(2 * arccos(1 / np.sqrt(3)), 2)

    return qc
'''


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

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

    qc.h(0)
    qc.h(1)
    qc.h(2)

    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 0)
    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 1)
    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 2)

    return qc
'''


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

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

    qc.h(0)  # Hadamard on qubit 0
    qc.cry(2 * np.arccos(1 / np.sqrt(3)), 0, 1)
    qc.cry(2 * np.arccos(1 / np.sqrt(3)), 0, 2)

    return qc
'''


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

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

    qc.h(0)  # Hadamard on qubit 0
    qc.ccx(0,1,2).inverse(True)
    qc.ccx(0,2,1).inverse(True)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.h(0)
    qc.h(1)
    qc.ccx(0,1,2)
    qc.h(0)
    qc.h(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(np.arctan(np.sqrt(2))*2, 0, 1)
    qc.cx(1,0)
    qc.cry(np.arctan(1)*2, 1,2)
    qc.cx(2,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc = QuantumCircuit(3)
    qc.x(2)
    qc.cry(np.arctan(np.sqrt(2))*2, 2, 1)
    qc.cx(1,2)
    qc.cry(np.arctan(1)*2, 1,0)
    qc.cx(0,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(2)
    qc.cry(np.arctan(np.sqrt(2))*2, 2, 1)
    qc.cx(1,2)
    qc.cry(np.arctan(1)*2, 1,0)
    qc.cx(0,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(np.arctan(np.sqrt(2))*2, 0, 1)
    qc.cx(1,0)
    qc.cry(np.arctan(1)*2, 1, 2)
    qc.cx(2,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(np.arctan(np.sqrt(2))*2, 0, 1)
    qc.cx(1, 0)
    qc.cry(np.arctan(1)*2, 1, 2)
    qc.cx(2, 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(np.arctan(np.sqrt(2))*2, 0, 1)
    qc.cx(1, 0)
    #qc.cry(np.arctan(1)*2, 1, 2)
    qc.cry(np.pi/2, 1, 2)
    qc.cx(2, 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(1.91, 0, 1)
    qc.cx(1, 0)
    #qc.cry(np.arctan(1)*2, 1, 2)
    qc.cry(np.pi/2, 1, 2)
    qc.cx(2, 1)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(np.arctan(np.sqrt(2))*2, 0, 1)
    #qc.cry(1.91, 0, 1)
    qc.cx(1, 0)
    qc.cry(np.arctan(1)*2, 1, 2)
    #qc.cry(np.pi/2, 1, 2)
    qc.cx(2, 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    qc.x(0)
    theta = 2 * math.acos(1 / math.sqrt(3))
    qc.ry(theta, 1)
    qc.ch(1, 2)
    qc.cx(1, 0)
    qc.cx(2, 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    qc.x(0)
    theta = 2 * math.acos(1 / math.sqrt(3))
    qc.ry(theta, 1)
    qc.ch(1, 2)
    qc.cx(1, 0)
    qc.cx(2, 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(2 * math.atan(math.sqrt(2)),0,1)
    qc.cx(1,0)
    qc.cry(math.pi / 2,1,2)
    qc.cx(2,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    # Apply a Hadamard gate to the first qubit to create superposition
    qc.h(0)

    # Apply controlled rotations to create the desired amplitudes
    # We will use a combination of RY gates to adjust the amplitudes
    theta = math.acos(1 / math.sqrt(3))  # This is the angle for the RY gate

    # Apply RY gates to the second and third qubits
    qc.ry(2 * theta, 1)  # Apply RY to the second qubit
    qc.ry(2 * theta, 2)  # Apply RY to the third qubit

    # Apply CNOT gates to entangle the qubits
    qc.cx(0, 1)  # Control on qubit 0, target qubit 1
    qc.cx(0, 2)  # Control on qubit 0, target qubit 2

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Step 1: Ry(2*arccos(1/√3)) on qubit 0
    theta1 = 2 * np.arccos(1/np.sqrt(3))
    qc.ry(theta1, 0)
    # Step 2: CNOT from qubit 0 to qubit 1
    qc.cx(0, 1)
    # Step 3: Ry(π/2) on qubit 1
    qc.ry(np.pi/2, 1)
    # Step 4: CNOT from qubit 1 to qubit 2
    qc.cx(1, 2)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Step 1: Ry(2*arccos(1/√3)) on qubit 0
    theta1 = 2 * np.arccos(1/np.sqrt(3))
    qc.x(0)
    qc.ry(theta1, 0)
    # Step 2: CNOT from qubit 0 to qubit 1
    qc.cx(0, 1)
    # Step 3: Ry(π/2) on qubit 1
    qc.ry(np.pi/2, 1)
    # Step 4: CNOT from qubit 1 to qubit 2
    qc.cx(1, 2)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Step 1: Ry(2*arccos(1/√3)) on qubit 0
    theta1 = 2 * np.arccos(1/np.sqrt(3))

    qc.ry(theta1, 0)
    # Step 2: CNOT from qubit 0 to qubit 1
    qc.x(0)
    qc.cx(0, 1)
    qc.x(0)
    # Step 3: Ry(π/2) on qubit 1
    qc.ry(np.pi/2, 1)
    # Step 4: CNOT from qubit 1 to qubit 2
    qc.x(1)
    qc.cx(1, 2)
    qc.x(1)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Step 1: Ry(2*arccos(1/√3)) on qubit 0
    theta1 = 2 * np.arctan(np.sqrt(2))
    qc.ry(theta1, 0)
    # Step 2: CNOT from qubit 0 to qubit 1
    qc.x(0)
    qc.cx(0, 1)
    qc.x(0)
    # Step 3: Ry(π/2) on qubit 1
    qc.ry(np.pi/2, 1)
    # Step 4: CNOT from qubit 1 to qubit 2
    qc.x(1)
    qc.cx(1, 2)
    qc.x()
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    # Apply Hadamard to the first qubit
    qc.h(0)

    # Apply controlled rotations to create the superposition
    qc.cx(0, 1)  # Control from qubit 0 to qubit 1
    qc.cx(0, 2)  # Control from qubit 0 to qubit 2

    # Normalize the state by applying a rotation
    qc.rz(math.acos(1/3), 0)  # Rotate to adjust the amplitude

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(2 * acos(sqrt(1/3)), 0) #Rotar
    qc.cx(0, 1) #ENtrelazar
    qc.cx(1, 2)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.h(0) #Superposicion
    # Aplicamos CNOT
    qc.cx(0, 1)
    qc.cx(0, 2)

    return qc
'''


'''python
import math
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta1 = 2 * math.atan(math.sqrt(2))
    theta2 = 2 * math.atan(1)

    qc.x(0)
    qc.cry(theta1, 0, 1)
    qc.cx(1, 0)
    qc.cry(theta2, 1, 2)
    qc.cx(2, 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = math.asin(1.0 / math.sqrt(3.0))
    qc.ry(2.0 * theta, 1)
    qc.x(1)
    qc.ch(1, 2)
    qc.x(1)

    qc.x(1)
    qc.x(2)

    qc.cx([1, 2], 0)
    qc.x(1)
    qc.x(2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = math.asin(1.0 / math.sqrt(3.0))
    qc.ry(2.0 * theta, 1)
    qc.x(1)
    qc.ch(1, 2)
    qc.x(1)

    qc.x([1, 2])
    qc.ccx(1, 2, 0)
    qc.x([1, 2])

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    qc.ry(2 * math.acos(math.sqrt(2)/math.sqrt(3)), 0)
    qc.x(0)
    qc.ch(0, 1)
    qc.x(0)

    qc.cx(0, 2)
    qc.x(0)
    qc.cx(1, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta, 1)
    qc.ch(1,2)
    qc.x(0)
    qc.cx(1,0)
    qc.cx(2,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * acos(1 / (3**0.5))

    qc.ry(theta, 0)
    qc.cry(pi / 2, 0, 1)
    qc.mcx([0, 1], 2)
    qc.x([0, 1])
    qc.cx(0, 1)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * acos(1 / (3**0.5))

    qc.ry(theta, 0)
    qc.cry(pi / 2, 0, 1)
    qc.mcx([0, 1], 2)
    qc.x([0, 1])
    qc.cx(0, 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    qc.ry(4 * math.atan(math.sqrt(6) / (3 + math.sqrt(3))), 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    qc.ry(4 * math.atan(math.sqrt(6) / (3 + math.sqrt(3))), 2)
    qc.ch(2, 1)
    qc.cx(2, 0)
    qc.cx(1, 0)
    qc.x(2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6) / (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.x(1)
    qc.cx(0, 1)
    qc.ch(0, 2)
    qc.cx(2, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x(0)
    qc.x(1)
    qc.mcx([0, 1], 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x(0)
    qc.x(1)
    qc.mcx([0, 1], 2)
    qc.x(0)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x(0)
    qc.x(1)
    qc.ccx([0, 1], 2)
    qc.x(0)
    qc.x(1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    theta = 2 * math.acos(1/ math.sqrt(3))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x([0, 1])
    qc.ccx(0, 1, 2)
    qc.x([0, 1])

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x([0, 1])
    qc.toffoli(0, 1, 2)
    qc.x([0, 1])

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x([0, 1])
    # qc.ccx(0, 1, 2)
    qc.x([0, 1])

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)s
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x([0, 1])
    qc.ccx(0, 1, 2)
    qc.x([0, 1])

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)s
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x([0, 1])
    qc.ccx(0, 1, 2)
    qc.x([0, 1])

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)s
    qc.ch(0, 1)
    qc.cx(1, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x([0, 1])
    # qc.ccx(0, 1, 2)
    # qc.x([0, 1])

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x([0, 1])
    qc.ccx(0, 1, 2)
    # qc.x([0, 1])

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x([0, 1])
    qc.ccx(0, 1, 2)
    qc.x([0, 1])

    return qc
'''


'''python
import math
from qiskit import QuantumCircuit

def make_three_uniform() -> QuantumCircuit:
    qc = QuantumCircuit(2)
    qc.h(0)
    qc.ry(math.asin(1 / 3), 0)
    qc.ch(0, 1)
    qc.x(0)
    return qc

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    qc.compose(make_three_uniform(), inplace=True)
    qc.x([0, 1])
    qc.ccx(0, 1, 2)
    qc.x([0, 1])
    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import XGate, HGate, CXGate, MCPhaseGate
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    qc.ry(2 * math.acos(1/math.sqrt(3)), 0)
    qc.ch([0], [1])
    qc.cx([1], [2])
    qc.cx([0], [1])
    qc.x([0])
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(2*math.acos(1/math.sqrt(3)), 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.ch(0, 1)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(2*math.acos(1/math.sqrt(3)), 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.ch(0, 1)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import mat

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(2*math.acos(1/math.sqrt(3)), 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(2*math.acos(1/math.sqrt(3)), 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    # Definir el vector de estado deseado
    desired_state = [0]*8  # Hay 2^3 = 8 estados base computacionales
    desired_state[1] = 1/sqrt(3)  # Estado |001⟩
    desired_state[2] = 1/sqrt(3)  # Estado |010⟩
    desired_state[4] = 1/sqrt(3)  # Estado |100⟩

    # Inicializar los qubits al estado deseado
    qc.initialize(desired_state, [0, 1, 2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import sqrt

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    # Definir el vector de estado deseado
    desired_state = [0]*8  # Hay 2^3 = 8 estados base computacionales
    desired_state[1] = 1/sqrt(3)  # Estado |001⟩
    desired_state[2] = 1/sqrt(3)  # Estado |010⟩
    desired_state[4] = 1/sqrt(3)  # Estado |100⟩

    # Inicializar los qubits al estado deseado
    qc.initialize(desired_state, [0, 1, 2])
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math as math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(2*math.acos(1/math.sqrt(3)), 0)
    qc.ch(0, 1)
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * np.arcsin(np.sqrt(1/3))
    qc.ry(theta, 0)
    qc.cx(0, 1)
    qc.cx(0, 2)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * np.arcsin(np.sqrt(1/3))
    qc.ry(theta, 0)
    qc.cx(0, 1)
    qc.cx(0, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    theta = 2 * math.asin(math.sqrt(1/3))
    qc.ry(theta, 0)

    qc.cx(0, 1)
    qc.cx(0, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    theta = 2 * math.asin(math.sqrt(1/3))  # 角度 θ = 2 * arcsin(√(1/3))
    qc.ry(theta, 0)  # 量子ビット0に対してRyゲートを適用

    # 量子ビット0が1のときに量子ビット1と2をエンタングルメント
    qc.cx(0, 1)
    qc.cx(0, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import sqrt

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.initialize([0, sqrt(1/3), sqrt(1/3), 0, sqrt(1/3), 0, 0, 0], [0, 1, 2])

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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

    qc.h(0)

    # 位相を調整するために、第0量子ビットにRZゲートを適用
    qc.rz(2 * pi / 3, 0)

    # それぞれの状態に重ね合わせを作るためにCNOTを使う
    qc.cx(0, 1)
    qc.cx(0, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

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


'''python
from qiskit import QuantumCircuit

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


'''python
from qiskit import QuantumCircuit

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


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.h(0)
    qc.h(1)
    qc.x(2)
    qc.mcp(math.pi,list(range(1,3)),0)
    qc.cx(0,2)
    qc.cx(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

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


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    t =np.arccos(1/np.sqrt(3))
    qc.ry(t*2,0)
    tt =np.arccos(1/np.sqrt(2))
    qc.cry(tt*2,0,1)
    qc.x(2)
    qc.cx(0,2)
    qc.cx(1,0)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math
#from qiskit.quantum_info import Statevector

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta,0)
    qc.ch(0,1)
    qc.cx(1,2)
    qc.cx(0,1)
    qc.x(0)
    return qc

#if __name__ == "__main__":
#    qc = solve()
#    print(Statevector(qc))
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(0.9553166181245092*2)[0].cry(0.7853981633974484*2)[0,1].x[2].cx[0, 2].cx[1, 0]
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(0.9553166181245092*2)[0]
    qc.cry(0.7853981633974484*2)[0,1]
    qc.x[2]
    qc.cx[0, 2]
    qc.cx[1, 0]
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(0.9553166181245092*2)[0]
    qc.cry(0.7853981633974484*2)[0,1]
    qc.x[2]
    qc.cx[0, 2]
    qc.cx[1, 0]
    return qc
'''


'''python
from qiskit import QuantumCircuit,math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(0.9553166181245092*2)[0]
    qc.cry(0.7853981633974484*2)[0,1]
    qc.x[2]
    qc.cx[0, 2]
    qc.cx[1, 0]
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(0.9553166181245092*2,0)
    qc.cry(0.7853981633974484*2,0,1)
    qc.x(2)
    qc.cx(0, 2)
    qc.cx(1, 0)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * math.atan(math.sqrt(2))
    qc.ry(theta, 0)
    qc.cx(0, 1)
    qc.x(1)
    qc.ch(0, 2)
    qc.cx(2, 0)
    return qc
'''


'''python
from qiskit import QuantumCircuit

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

    qc.h(0)
    qc.h(1)
    qc.cx(0, 2)
    qc.cx(1, 2)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.x(3)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.x(2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.x(2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
    qc.cx(1,2)
    qc.x(2)
    qc.cx(0,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    qc.r(2*math.acos(1.0/math.sqrt(3.0)), math.pi/2, 0)
    qc.ch(0, 1)
    qc.x(1)
    qc.ccx(0, 1, 2)
    qc.x(1)
    qc.x(0)
    return qc
'''


'''python
from math import acos, pi

from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(2)
    # Write your code here:
    theta = acos((2 / 3) ** 0.5)
    qc.ry(theta, 0)
    qc.cx(0, 1)
    qc.x(0)
    phi = pi / 2
    qc.cry(phi, 0, 2)
    qc.x(1)
    qc.cx(1, 0)
    qc.x(1)
    return qc
'''


'''python
from math import acos, pi

from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = acos((2 / 3) ** 0.5)
    qc.ry(theta, 0)
    qc.cx(0, 1)
    qc.x(0)
    phi = pi / 2
    qc.cry(phi, 0, 2)
    qc.x(1)
    qc.cx(1, 0)
    qc.x(1)
    return qc
'''


'''python
from math import acos, pi

from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * acos((2 / 3) ** 0.5)
    qc.ry(theta, 0)
    qc.cx(0, 1)
    qc.x(0)
    phi = pi / 2
    qc.cry(phi, 0, 2)
    qc.x(1)
    qc.cx(1, 0)
    qc.x(1)
    return qc
'''


'''python
from math import acos, pi

from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2 * acos((2 / 3) ** 0.5)
    qc.ry(theta, 0)
    qc.cx(0, 1)
    qc.x(0)
    phi = pi / 2
    qc.cry(phi, 0, 2)
    qc.cx(2, 0)
    return qc
'''


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

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

    a = np.array([0,1,1,0,1,0,0,0])
    a = a/(sum(abs(a)**2)**0.5)
    qc.initialize(a,range(0,3))
    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import HGate

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        if i == 0:
            qc.h(i)
        else:
            qc.append(HGate().control(i), list(range(i+1)))
        qc.x(i)
    for i in range(n):
        qc.x(i)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2*np.arccos(1/np.sqrt(3))
    qc.ry(theta, 0)
    h_gate = HGate()
    ch_gate = h_gate.control(1)
    qc.append(ch_gate, [0, 1])
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2*np.arccos(1/np.sqrt(3))
    qc.ry(theta, 0)
    h_gate = qiskit.circuit.library.HGate()
    ch_gate = h_gate.control(1)
    qc.append(ch_gate, [0, 1])
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import HGate
import numpy as np

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 2*np.arccos(1/np.sqrt(3))
    qc.ry(theta, 0)
    h_gate = HGate()
    ch_gate = h_gate.control(1)
    qc.append(ch_gate, [0, 1])
    qc.cx(1, 2)
    qc.cx(0, 1)
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(2)
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 1)

    qc.ch(1,0)

    qc.cx(1,2)
    qc.cx(0,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(2)
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 1)

    qc.ch(1,0)

    qc.cx(1,2)
    qc.cx(0,)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import mat

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(2)
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 1)

    qc.ch(1,0)

    qc.cx(1,2)
    qc.cx(0,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(2)
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 1)

    qc.ch(1,0)

    qc.cx(1,2)
    qc.cx(0,1)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from qiskit.circuit.library.standard_gates import RYGate
import math
# from qiskit.quantum_info import Statevector

def solve() -> QuantumCircuit:
    n = 3
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.ry(math.asin(1/math.sqrt(n))*2, 0)
    for i in range(1, n):
        for j in range(i):
            qc.x(j)
        qc.append(RYGate(math.asin(1/math.sqrt(n-i))*2).control(i), range(i+1))
        for j in range(i):
            qc.x(j)
    return qc

# if __name__ == "__main__":
#     qc = solve(3)
#     print(Statevector(qc))
'''


'''python
from qiskit import QuantumCircuit

from qiskit.circuit.library import HGate, ZGate, XGate, PhaseGate
import math

def solve() -> QuantumCircuit:
  qc = QuantumCircuit(3)
  qc.ry(math.acos(-1/3), 0)
  qc.swap(0, 1)
  qc.cx(1,0)
  qc.ch(0,2)
  qc.x(0)
  qc.cx(2, 1)

  return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.ch(1, 2)
    qc.cx(2, 1)
    qc.cx(1, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math
import matplotlib.pyplot as plt
from qiskit.quantum_info import Statevector

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.ch(1, 2)
    qc.cx(2, 1)
    qc.cx(2, 0)
    qc.cx(1, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.ch(1, 2)
    qc.cx(2, 1)
    qc.cx(2, 0)
    qc.cx(1, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.x(0)
    qc.ry(theta, 1)
    qc.ch(1, 2)
    qc.cx(2, 1)
    qc.cx(2, 0)
    qc.cx(1, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.h(0)
    qc.ch(0,1)
    qc.ccx(0,1,2)
    qc.cx(0,1)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta,0)
    qc.ch(0,1)
    qc.ccx(0,1,2)
    qc.cx(0,1)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.ry(theta,0)
    qc.ch(0,1)
    qc.ccx(0,1,2)
    qc.cx(0,1)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x(2)
    qc.cx(0,2)
    qc.cx(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))

    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)

    qc.x(2)
    qc.cx(0,2)
    qc.cx(1,2)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = 1/3
    qc.ry(0, np.acos(p))
    qc.cx(0,1)
    qc.x(0)
    qc.x(2)
    qc.cx(1,2)
    qc.x(2)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = 1/3
    qc.ry(np.acos(p),0)
    qc.cx(0,1)
    qc.x(0)
    qc.x(2)
    qc.cx(1,2)
    qc.x(2)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = 1/3
    qc.ry(np.cos(p),0)
    qc.cx(0,1)
    qc.x(0)
    qc.x(2)
    qc.cx(1,2)
    qc.x(2)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = 1/3
    qc.ry(np.acos(p),0)
    qc.cx(0,1)
    qc.x(0)

    qc.ch(1,2)

    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = 1/3
    qc.ry(-np.acos(p),0)
    qc.cx(0,1)
    qc.x(0)

    qc.ch(1,2)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = -1/3
    qc.ry(np.acos(p),0)
    qc.cx(0,1)

    qc.ch(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = -1/3
    qc.ry(math.acos(p),0)
    qc.cx(0,1)
    qc.x(0)

    qc.ch(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = 1/3
    qc.ry(math.acos(p),0)
    qc.cx(0,1)
    qc.x(0)

    qc.ch(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = 1/3
    qc.ry(2*math.acos(p),0)
    qc.cx(0,1)
    qc.x(0)

    qc.ch(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = 1/3
    qc.ry(math.acos(2*p),0)
    qc.cx(0,1)
    qc.x(0)

    qc.ch(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = -1/3
    qc.ry(math.acos(2*p),0)
    qc.cx(0,1)
    qc.x(0)

    qc.ch(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = -1/3
    qc.ry(2*math.acos(p),0)
    qc.cx(0,1)
    qc.x(0)

    qc.ch(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = math.sqrt(2/3)
    qc.ry(2*math.acos(p),0)
    qc.cx(0,1)
    qc.x(0)

    qc.ch(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = math.sqrt(1/3)
    qc.ry(2 * math.acos(p), 0)
    qc.cx(0, 1)
    qc.x(0)
    qc.ch(1, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = math.sqrt(1/3)
    qc.ry( math.acos(p), 0)
    qc.cx(0, 1)
    qc.x(0)
    qc.ch(1, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    p = math.sqrt(1/3)
    qc.ry(2*math.acos(p), 0)
    qc.cx(0, 1)
    qc.x(0)
    qc.ch(1, 2)
    qc.cx(2, 1)
    return qc
'''


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

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)

    # Write your code here:
    root_3 = np.sqrt(3)
    phi = 2 * np.arccos(1/root_3)

    qc.ry(phi, 0)
    qc.ch(0, 1)
    qc.cx(1,2)
    qc.cx(0,1)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import atan, sqrt

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * atan(sqrt(6) / (3 + sqrt(3)))
    qc.x(0)
    qc.ry(theta, 1)
    qc.ch(1, 2)
    qc.cx(1, 0)
    qc.cx(2, 1)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    # 量子ビット0にアダマールゲートを適用
    qc.h(0)

    # 量子ビット1に制御NOTゲートを適用
    qc.cx(0, 1)

    # 量子ビット2に制御NOTゲートを適用
    qc.cx(0, 2)

    # 量子ビット0を1/√3の位相に調整
    qc.u1(-2 * 3.14159 / 3, 0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    # 量子ビット0を|1⟩にするためにXゲートを適用
    qc.x(0)

    # 量子ビット0にアダマールゲートを適用
    qc.h(0)

    # 量子ビット1にHゲートを適用
    qc.h(1)

    # 量子ビット2にHゲートを適用
    qc.h(2)

    # 各状態の位相を調整
    pi = 3.14159
    qc.rz(pi / 3, 0)  # |100⟩
    qc.rz(pi / 3, 1)  # |010⟩
    qc.rz(pi / 3, 2)  # |001⟩

    return qc
'''


'''python
from qiskit import QuantumCircuit

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


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
    qc.cx(0,1)
    qc.cx(0,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.ry(2 * np.arccos(1 / np.sqrt(3)), 0)
    qc.cx(0,1)
    qc.cx(0,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.ry(2 * math.atan(pow(2,0.5), 1))
    qc.cx(1,0)
    qc.cry(2*math.atan(1),1,2)
    qc.cx(2,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(2 * math.atan(pow(2,0.5), 0,1))
    qc.cx(1,0)
    qc.cry(2*math.atan(1),1,2)
    qc.cx(2,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(2 * math.atan(math.sqrt(2), 0,1))
    qc.cx(1,0)
    qc.cry(2*math.atan(1),1,2)
    qc.cx(2,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(3)
    # Write your code here:
    qc.x(0)
    qc.cry(2 * math.atan(math.sqrt(2)), 0,1)
    qc.cx(1,0)
    qc.cry(2*math.atan(1),1,2)
    qc.cx(2,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit

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


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(2)
    # Write your code here:
    theta=4*math.atan(math.sqrt(6)/(3+math.sqrt(3)))
    qc.ry(theta,0)
    qc.cx(0,1)
    qc.ry(theta,1)
    qc.cx(1,2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(2)
    # Write your code here:
    theta=4*math.atan(math.sqrt(6)/(3+math.sqrt(3)))
    qc.ry(theta,0)
    qc.ch(0,1)
    qc.cx(1,0)
    qc.ry(theta,1)
    qc.ch(1,2)
    qc.cx(2,1)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve() -> QuantumCircuit:
    qc = QuantumCircuit(2)
    # Write your code here:
    theta=4*math.atan(math.sqrt(6)/(3+math.sqrt(3)))
    qc.ry(theta,0)
    qc.cx(0, 1)
    qc.cx(0, 2)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)

    theta = math.asin(1.0 / math.sqrt(n))
    qc.ry(2.0 * theta, 0)
    qc.x(0)
    qc.cx(0, 1)
    qc.x(0)

    for i in range(1, n - 1):
        theta = math.asin(1.0 / math.sqrt(n-i))
        qc.cry(2.0*theta, i, i+1)
        qc.cx(i, i+1)
        qc.cx(i+1, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.x(0)
    for i in range(1,n):
        theta=math.atan(2*math.atan(n-i))
        qc.cry(theta,i-1,i)
        qc.cx(i,i-1)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.x(0)
    for i in range(1,n):
        theta=math.atan(2*math.atan(math.sqrt(n-i)))
        qc.cry(theta,i-1,i)
        qc.cx(i,i-)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.x(0)
    for i in range(1,n):
        theta=math.atan(2*math.atan(math.sqrt(n-i)))
        qc.cry(theta,i-1,i)
        qc.cx(i,i-1)
    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    theta=[2*math.atan(math.sqrt(i)) for i in range(n-1,0,-1)]
    qc.x(0)
    for i in range(n-1):
        qc.cry(theta[i],i,i+1)
        qc.cx(i+1,i)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    theta=[2*math.atan(math.sqrt(i)) for i in range(n-1,0,-1)]
    qc.x(0)
    for i in range(n-1):
        qc.cry(theta[i],i,i+1)
        qc.cx(i+1,i)
    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import acos

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)

    qc.ry(acos(1-2/n), 0)
    qc.x(0)
    for i in range(1, n-1):
        qc.cry(acos(1 - 2 / (n-i)), i-1, i)
        qc.x(i)
    for i in range(n-1):
        qc.x(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import acos

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)

    qc.ry(acos(1-2/n), 0)
    qc.x(0)
    for i in range(1, n):
        qc.cry(acos(1 - 2 / (n-i)), i-1, i)
        qc.x(i)
    for i in range(n):
        qc.x(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.h(range(n))

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)

    # Define angles for controlled-Ry gates
    theta = [2 * math.atan(math.sqrt(i)) for i in range(1, n)]  # Generate angles for controlled-Ry gates

    # Start with the initial state by flipping the first qubit to |1⟩
    qc.x(0)

    # Apply controlled-Ry rotations and CNOT gates
    for i in range(n - 1):
        qc.cry(theta[i], i, i + 1)  # Apply controlled-Ry on qubits i and i+1
        qc.cx(i + 1, i)             # Apply CNOT between qubits i+1 (control) and i (target)

    return qc
'''


'''python
import math

from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)

    theta = [2 * math.atan(math.sqrt(i)) for i in range(n - 1, 0, -1)]

    qc.x(0)

    for i in range(n - 1):
        qc.cry(theta[i], i, i + 1)
        qc.cx(i + 1, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.x(0)
    for i in range(n-1):
        qc.cry(2*math.acos(1/math.sqrt(n-i)),i, i+1)
        qc.cx(i+1, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.x(0)
    for i in range(n-1):
        qc.cry(2*math.acos(1/math.sqrt(n-i)),i, i+1)
        qc.cx(i+1, i)

    return qc
'''


'''python
from qiskit import QuantumCircuit
from math import acos

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    theta = acos((2 - n)/n)
    qc.u(theta, 0 , 0, 0)
    for m in range(0, n - 2):
      theta = acos((3 + m - n)/(n - m - 1))
      qc.cu(theta, 0, 0, 0, m, m+1)
    for m in range(n - 1):
      qc.mcx(list(range(n - m - 1)), n - m - 1)
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.ry(2*acos(1/sqrt(n-i)),0);
    for i in range(1,n-1):
        qc.cry(2*acos(1/sqrt(n-i)),i-1,i)
    for i in range(n-1,0,-1):
        qc.cx(i-1,i)
    qc.x(0)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.ry(2*math.acos(1/math.sqrt(n)),0)
    for i in range(1,n-1):
        qc.cry(2*math.acos(1/math.sqrt(n-i)),i-1,i)
    for i in range(n-1,0,-1):
        qc.cx(i-1,i)
    qc.x(0)
    return qc
'''


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

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)

    for i in range(n):
        if i:
            qc.cry(acos(sqrt(1/(n-i))) * 2, i-1, i)
        else:
            qc.ry(acos(sqrt(1/(n-i))) * 2, i)

    for i in range(n-1, 0, -1):
        qc.cx(i-1, i)
    qc.x(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.h(0)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    for i in range(n):
        qc.h(i)

    return qc
'''


'''python
from qiskit import QuantumCircuit

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    amplitude = 1 /math.sqrt(n)

    for i in range(n):
        qc.ry(2 * amplitude, i)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    amplitude = 1 /math.sqrt(n)

    for i in range(n):
        qc.ry(2 * amplitude, i)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    amplitude = 1 /math.sqrt(n)

    state = [0] * (2**n)

    for i in range(n):
        state[2**i] = amplitude
    qc.initialize(state)
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.append(HGate(), [0])

    for i in range(1,n):
        qc.append(CXGate(),[0,i])
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    qc.append(HGate(), [0])

    for i in range(1,n):
        qc.append(CXGate(), [0, i])
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
     qc.append(HGate(), [0])  # H on the first qubit

    for i in range(1, n):
        qc.append(CXGate(), [0, i])
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here
    for i in range(n):
        qc.h(i)
    qc.measure_all()
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here
    qc.h(0)
    for i in range(1,n):
        qc.cx(0,i)
    qc.measure_all()
    return qc
'''


'''python
from qiskit import QuantumCircuit
import math

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here
    qc.h(0)
    for i in range(1,n):
        qc.cx(0,i)
    return qc
'''


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

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    # Write your code here:
    prob_amp = np.sqrt(1 / n)
    rot_ang = 2 * np.arccos(prob_amp)

    qc.x(0)

    for i in range(n - 1):
        comp_amp = np.sqrt(1 - i / n)
        rot_ang = 2 * np.arccos(prob_amp / (comp_amp))
        qc.cry(rot_ang, i, i + 1)
        qc.cx(i + 1, i)

    return qc
'''


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

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    qc.x(0)
    angle = [0] * n
    for i in range(n+1):
        angle[i]=np.arccos(1/np.sqrt(i))
    for i in range(n):
        if i>n-2:
            qc.cry(angle[n-i]*2,i,i+1)
        else:
            qc.cx(n-3,n-2)
            qc.ch(n-2,n-1)
            qc.cx(n-1,n-2)
    for i in range(n):
        if i<4:
            pass
        else:
            for j in range(i):
                qc.cx(n-j,n-i)
    return qc
'''


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

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    qc.x(0)
    angle = [0] * n
    for i in range(n):
        angle[i+1]=np.arccos(1/np.sqrt(i+1))
    for i in range(n):
        if i>n-2:
            qc.cry(angle[n-i]*2,i,i+1)
        else:
            qc.cx(n-3,n-2)
            qc.ch(n-2,n-1)
            qc.cx(n-1,n-2)
    for i in range(n):
        if i<4:
            pass
        else:
            for j in range(i):
                qc.cx(n-j,n-i)
    return qc
'''


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

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    qc.x(0)
    angle = [0] * n

    for i in range(n):
        if i==0:
            pass
        else:
            angle[i]=np.arccos(1/np.sqrt(i))

    for i in range(n):
        if i<n-2:
            qc.cry(angle[n-i]*2,i,i+1)
        else:
            qc.cx(n-3,n-2)
            qc.ch(n-2,n-1)
            qc.cx(n-1,n-2)
    for i in range(n):
        if i<4:
            pass
        else:
            for j in range(i):
                qc.cx(n-j,n-i)
    return qc
'''


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

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    qc.x(0)
    angle = [0] * n

    for i in range(n+1):
        if i==0:
            pass
        else:
            angle[i]=np.arccos(1/np.sqrt(i))

    for i in range(n):
        if i<n-2:
            qc.cry(angle[n-i]*2,i,i+1)
        else:
            qc.cx(n-3,n-2)
            qc.ch(n-2,n-1)
            qc.cx(n-1,n-2)
    for i in range(n):
        if i<4:
            pass
        else:
            for j in range(i):
                qc.cx(n-j,n-i)
    return qc
'''


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

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    qc.x(0)
    angle = [0] * n

    for i in range(n+1):
        if i==0:
            pass
        else:
            angle[i]=np.arccos(1/np.sqrt(i))

    for i in range(n):
        if i<n-2:
            qc.cry(angle[n-i]*2,i,i+1)
        else:
            qc.cx(n-2,n-3)
            qc.ch(n-2,n-1)
            qc.cx(n-1,n-2)
    for i in range(n):
        if i<4:
            pass
        else:
            for j in range(i):
                qc.cx(n-j,n-i)
    return qc
'''


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

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    qc.x(0)
    angle = [0] * n

    for i in range(n+1):
        if i==0:
            pass
        else:
            angle[i]=np.arccos(1/np.sqrt(i))

    for i in range(n):
        if i<n-2:
            qc.cry(angle[n-i]*2,i,i+1)
        else:
            qc.cx(n-2,n-3)
            qc.ch(n-2,n-1)
            qc.cx(n-1,n-2)
    for i in range(n+1):
        if i<4:
            pass
        else:
            for j in range(i):
                qc.cx(n-j,n-i)
    return qc
'''


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

def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(n)
    qc.x(0)
    angle = [0] * (n+1)

    for i in range(n+1):
        if i==0:
            pass
        else:
            angle[i]=np.arccos(1/np.sqrt(i))

    for i in range(n-2):
        qc.cry(angle[n-i]*2,i,i+1)

    qc.cx(n-2,n-3)
    qc.ch(n-2,n-1)
    qc.cx(n-1,n-2)

    for i in range(n+1):
        if i<4:
            pass
        else:
            for j in range(i-1):
                qc.cx(n-1-j,n-i)
    return qc
'''