


"""simple docstring"""







import math

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




def        UpperCAmelCase__	(lowerCAmelCase_ = 3       ):




					'''simple docstring'''


					if isinstance(lowerCAmelCase_  ,						lowerCAmelCase_       ):
										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(lowerCAmelCase_       ) != number_of_qubits:
										raise ValueError("number of qubits must be exact integer."       )
					if number_of_qubits > 10:
										raise ValueError("number of qubits too large to simulate(>10)."       )

					__SCREAMING_SNAKE_CASE						       =    QuantumRegister(lowerCAmelCase_  ,						"qr"       )
					__SCREAMING_SNAKE_CASE						       =    ClassicalRegister(lowerCAmelCase_  ,						"cr"       )

					__SCREAMING_SNAKE_CASE						       =    QuantumCircuit(lowerCAmelCase_  ,						lowerCAmelCase_       )

					__SCREAMING_SNAKE_CASE						       =    number_of_qubits

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

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

					# measure all the qubits
					quantum_circuit.measure(lowerCAmelCase_  ,						lowerCAmelCase_       )
					# simulate with 10000 shots
					__SCREAMING_SNAKE_CASE						       =    Aer.get_backend("qasm_simulator"       )
					__SCREAMING_SNAKE_CASE						       =    execute(lowerCAmelCase_  ,						lowerCAmelCase_  ,						shots=1_0000       )

					return job.result().get_counts(lowerCAmelCase_       )


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




"""simple docstring"""







from datetime import datetime

import requests




def        UpperCAmelCase__	(lowerCAmelCase_       ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE						       =    "https://downloadgram.net/wp-json/wppress/video-downloader/video?url="
					__SCREAMING_SNAKE_CASE						       =    requests.get(base_url + url       ).json()[0]["urls"][0]["src"]
					return requests.get(lowerCAmelCase_       ).content


if __name__ == "__main__":
		a__    :							str            =					input('''Enter Video/IGTV url: ''').strip()
		a__    :							List[Any]            =					F"{datetime.now():%Y-%m-%d_%H:%M:%S}.mp4"
		with open(file_name, '''wb''') as fp:
				fp.write(download_video(url))
		print(F"Done. Video saved to disk as {file_name}.")
