
import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute





def 		SCREAMING_SNAKE_CASE__      ( __lowerCAmelCase = 1      ,						__lowerCAmelCase = 1							):
    if isinstance(__lowerCAmelCase      ,						__lowerCAmelCase							) or isinstance(__lowerCAmelCase      ,						__lowerCAmelCase							):
        raise TypeError("inputs must be integers."							)
    if (bit_a < 0) or (bit_a < 0):
        raise ValueError("inputs must be positive."							)
    if (math.floor(__lowerCAmelCase							) != bit_a) or (math.floor(__lowerCAmelCase							) != bit_a):
        raise ValueError("inputs must be exact integers."							)
    if (bit_a > 1) or (bit_a > 1):
        raise ValueError("inputs must be less or equal to 1."							)

    # build registers
    snake_case__  =			QuantumRegister(2      ,						"qr"							)
    snake_case__  =			ClassicalRegister(2      ,						"cr"							)

    snake_case__  =			QuantumCircuit(__lowerCAmelCase      ,						__lowerCAmelCase							)

    # entanglement the qubits
    quantum_circuit.h(1							)
    quantum_circuit.cx(1      ,						0							)

    # send the information
    snake_case__  =			str(__lowerCAmelCase							) + str(__lowerCAmelCase							)

    if c_information == "11":
        quantum_circuit.x(1							)
        quantum_circuit.z(1							)
    elif c_information == "10":
        quantum_circuit.z(1							)
    elif c_information == "01":
        quantum_circuit.x(1							)
    else:
        quantum_circuit.i(1							)

    # unentangled the circuit
    quantum_circuit.cx(1      ,						0							)
    quantum_circuit.h(1							)

    # measure the circuit
    quantum_circuit.measure(__lowerCAmelCase      ,						__lowerCAmelCase							)

    snake_case__  =			Aer.get_backend("aer_simulator"							)
    snake_case__  =			execute(__lowerCAmelCase      ,						__lowerCAmelCase      ,						shots=1_000							)

    return job.result().get_counts(__lowerCAmelCase							)


if __name__ == "__main__":
     print(F'''Counts for classical state send: {superdense_coding(1,1)}''')





from __future__ import annotations

from PIL import Image

# Define the first generation of cells
# fmt: off
__magic_name__           =					[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]





def 		SCREAMING_SNAKE_CASE__      ( __lowerCAmelCase							):
    return [int(__lowerCAmelCase							) for c in F"""{ruleset:08}"""[:8]]





def 		SCREAMING_SNAKE_CASE__      ( __lowerCAmelCase      ,						__lowerCAmelCase      ,						__lowerCAmelCase							):
    snake_case__  =			len(cells[0]							)  # 31
    snake_case__  =			[]
    for i in range(__lowerCAmelCase							):
        # Get the neighbors of each cell
        # Handle neighbours outside bounds by using 0 as their value
        snake_case__  =			0 if i == 0 else cells[time][i - 1]
        snake_case__  =			0 if i == population - 1 else cells[time][i + 1]
        # Define a new cell and add it to the new generation
        snake_case__  =			7 - int(F"""{left_neighbor}{cells[time][i]}{right_neighbor}"""      ,						2							)
        next_generation.append(rule[situation]							)
    return next_generation





def 		SCREAMING_SNAKE_CASE__      ( __lowerCAmelCase							):
    snake_case__  =			Image.new("RGB"      ,						(len(cells[0]							), len(__lowerCAmelCase							))							)
    snake_case__  =			img.load()
    # Generates image
    for w in range(img.width							):
        for h in range(img.height							):
            snake_case__  =			255 - int(255 * cells[h][w]							)
            snake_case__  =			(color, color, color)
    return img


if __name__ == "__main__":
     __magic_name__           =					bin(int(input('''Rule:\n''').strip()))[2:]
     __magic_name__           =					format_ruleset(int(rule_num))
     for time in range(16):
          CELLS.append(new_generation(CELLS, rule, time))
     __magic_name__           =					generate_image(CELLS)
     # Uncomment to save the image
     # img.save(f"rule_{rule_num}.png")
     img.show()



