






def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int    )						->      str:





    """simple docstring"""

    __A         =	abs(__lowerCAmelCase    )
    __A         =	0
    while n > 0:
        res += n % 1_0
        n //= 1_0
    return res



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int    )						->      int:





    """simple docstring"""

    __A         =	abs(__lowerCAmelCase    )
    return n if n < 1_0 else n % 1_0 + sum_of_digits(n // 1_0    )



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int    )						->      Dict:





    """simple docstring"""

    return sum(int(__lowerCAmelCase    ) for c in str(abs(__lowerCAmelCase    )    )    )



def 			_SCREAMING_SNAKE_CASE						( )						->      Tuple:





    """simple docstring"""

    from collections.abc import Callable
    from timeit import timeit

    def benchmark_a_function(__lowercase   :			Callable			,				__lowercase   :			int    ) -> None:
        __A         =	f"{func.__name__}({value})"
        __A         =	timeit(f"__main__.{call}"			,				setup="""import __main__"""    )
        print(f"{call:56} = {func(__lowerCAmelCase    )} -- {timing:.4f} seconds"    )

    for value in (2_6_2_1_4_4, 1_1_2_5_8_9_9_9_0_6_8_4_2_6_2_4, 1_2_6_7_6_5_0_6_0_0_2_2_8_2_2_9_4_0_1_4_9_6_7_0_3_2_0_5_3_7_6):
        for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
            benchmark_a_function(__lowerCAmelCase			,				__lowerCAmelCase    )
        print()


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   benchmark()












import random
import sys

import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap

__a      :       List[Any]				  =   "Usage of script: script_name <size_of_canvas:int>"

__a      :       Dict				  =   [0] * 100 + [1] * 10
random.shuffle(choice)



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int    )						->      list[list[bool]]:





    """simple docstring"""

    __A         =	[[False for i in range(__lowercase    )] for j in range(__lowercase    )]
    return canvas



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			list[list[bool]]    )						->      None:





    """simple docstring"""

    for i, row in enumerate(__lowercase    ):
        for j, _ in enumerate(__lowercase    ):
            __A         =	bool(random.getrandbits(1    )    )



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			list[list[bool]]    )						->      list[list[bool]]:





    """simple docstring"""

    __A         =	np.array(__lowercase    )
    __A         =	np.array(create_canvas(current_canvas.shape[0]    )    )
    for r, row in enumerate(__lowercase    ):
        for c, pt in enumerate(__lowercase    ):
            __A         =	__judge_point(
                __lowercase			,				current_canvas[r - 1 : r + 2, c - 1 : c + 2]    )

    __A         =	next_gen_canvas
    del next_gen_canvas  # cleaning memory as we move on.
    __A         =	current_canvas.tolist()
    return return_canvas



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			bool			,				__lowercase   :			list[list[bool]]    )						->      bool:





    """simple docstring"""

    __A         =	0
    __A         =	0
    # finding dead or alive neighbours count.
    for i in neighbours:
        for status in i:
            if status:
                alive += 1
            else:
                dead += 1

    # handling duplicate entry for focus pt.
    if pt:
        alive -= 1
    else:
        dead -= 1

    # running the rules of game here.
    __A         =	pt
    if pt:
        if alive < 2:
            __A         =	False
        elif alive == 2 or alive == 3:
            __A         =	True
        elif alive > 3:
            __A         =	False
    else:
        if alive == 3:
            __A         =	True

    return state


if __name__ == "__main__":
  if len(sys.argv) != 2:
    raise Exception(usage_doc)

  __a      :       str				  =   int(sys.argv[1])
  # main working structure of this module.
  __a      :       List[Any]				  =   create_canvas(canvas_size)
  seed(c)
  __a  ,__a      :       int				  =   plt.subplots()
  fig.show()
  __a      :       Union[str, Any]				  =   ListedColormap(["w", "k"])
  try:
    while True:
      __a      :       Dict				  =   run(c)
      ax.matshow(c, cmap=cmap)
      fig.canvas.draw()
      ax.cla()
  except KeyboardInterrupt:
    # do nothing.
    pass




