



'''simple docstring'''


import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute






def  UpperCAmelCase_       (		lowercase__ = 3       ):


     '''simple docstring'''







     if isinstance(lowercase__       ,	lowercase__       ):
          raise TypeError("number of qubits must be a integer."       )
     if number_of_qubits <= 0:
          raise ValueError("number of qubits must be > 0."       )
     if math.floor(lowercase__       ) != number_of_qubits:
          raise ValueError("number of qubits must be exact integer."       )
     if number_of_qubits > 1_0:
          raise ValueError("number of qubits too large to simulate(>10)."       )

     a_       		=QuantumRegister(lowercase__       ,	"qr"       )
     a_       		=ClassicalRegister(lowercase__       ,	"cr"       )

     a_       		=QuantumCircuit(lowercase__       ,	lowercase__       )

     a_       		=number_of_qubits

     for i in range(lowercase__       ):
          quantum_circuit.h(number_of_qubits - i - 1       )
          counter -= 1
          for j in range(lowercase__       ):
               quantum_circuit.cp(np.pi / 2 ** (counter - j)       ,	lowercase__       ,	lowercase__       )

     for k in range(number_of_qubits // 2       ):
          quantum_circuit.swap(lowercase__       ,	number_of_qubits - k - 1       )

     # measure all the qubits
     quantum_circuit.measure(lowercase__       ,	lowercase__       )
     # simulate with 10000 shots
     a_       		=Aer.get_backend("qasm_simulator"       )
     a_       		=execute(lowercase__       ,	lowercase__       ,	shots=1_0_0_0_0       )

     return job.result().get_counts(lowercase__       )


if __name__ == "__main__":
  print(
      F"""Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}"""
  )







'''simple docstring'''


import os

# Precomputes a list of the 100 first triangular numbers
lowercase							       =			[int(0.5 * n * (n + 1)) for n in range(1, 101)]






def  UpperCAmelCase_       (		):


     '''simple docstring'''







     a_       		=os.path.dirname(os.path.realpath(lowercase__       )       )
     a_       		=os.path.join(lowercase__       ,	"words.txt"       )

     a_       		=""
     with open(lowercase__       ) as f:
          a_       		=f.readline()

     a_       		=[word.strip("\""       ) for word in words.strip("\r\n"       ).split(","       )]
     a_       		=[
         word
         for word in [sum(ord(lowercase__       ) - 6_4 for x in word       ) for word in words]
         if word in TRIANGULAR_NUMBERS
     ]
     return len(lowercase__       )


if __name__ == "__main__":
  print(solution())


