






from __future__ import annotations

import time
from collections.abc import Sequence
from random import randint

from matplotlib import pyplot as plt



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			Sequence[float]			,				__lowercase   :			int			,				__lowercase   :			int    )						->      tuple[int | None, int | None, float]:





    """simple docstring"""

    if not arr:
        return None, None, 0
    if low == high:
        return low, high, arr[low]

    __A         =	(low + high) // 2
    __A    ,	__A    ,	__A         =	max_subarray(__lowercase			,				__lowercase			,				__lowercase    )
    __A    ,	__A    ,	__A         =	max_subarray(__lowercase			,				mid + 1			,				__lowercase    )
    __A    ,	__A    ,	__A         =	max_cross_sum(__lowercase			,				__lowercase			,				__lowercase			,				__lowercase    )
    if left_sum >= right_sum and left_sum >= cross_sum:
        return left_low, left_high, left_sum
    elif right_sum >= left_sum and right_sum >= cross_sum:
        return right_low, right_high, right_sum
    return cross_left, cross_right, cross_sum



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			Sequence[float]			,				__lowercase   :			int			,				__lowercase   :			int			,				__lowercase   :			int    )						->      tuple[int, int, float]:





    """simple docstring"""

    __A    ,	__A         =	float("""-inf"""    ), -1
    __A    ,	__A         =	float("""-inf"""    ), -1

    __A         =	0
    for i in range(__lowercase			,				low - 1			,				-1    ):
        summ += arr[i]
        if summ > left_sum:
            __A         =	summ
            __A         =	i

    __A         =	0
    for i in range(mid + 1			,				high + 1    ):
        summ += arr[i]
        if summ > right_sum:
            __A         =	summ
            __A         =	i

    return max_left, max_right, (left_sum + right_sum)



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int    )						->      float:





    """simple docstring"""

    __A         =	[randint(1			,				__lowercase    ) for _ in range(__lowercase    )]
    __A         =	time.time()
    max_subarray(__lowercase			,				0			,				input_size - 1    )
    __A         =	time.time()
    return end - start



def 			_SCREAMING_SNAKE_CASE						( )						->      None:





    """simple docstring"""

    __A         =	[1_0, 1_0_0, 1_0_0_0, 1_0_0_0_0, 5_0_0_0_0, 1_0_0_0_0_0, 2_0_0_0_0_0, 3_0_0_0_0_0, 4_0_0_0_0_0, 5_0_0_0_0_0]
    __A         =	[time_max_subarray(__lowercase    ) for input_size in input_sizes]
    print("""No of Inputs\t\tTime Taken"""    )
    for input_size, runtime in zip(__lowercase			,				__lowercase    ):
        print(__lowercase			,				"""\t\t"""			,				__lowercase    )
    plt.plot(__lowercase			,				__lowercase    )
    plt.xlabel("""Number of Inputs"""    )
    plt.ylabel("""Time taken in seconds"""    )
    plt.show()


if __name__ == "__main__":
  from doctest import testmod

  testmod()












__a      :       List[Any]				  =   8.3_1_4_4_5_9_8



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			float			,				__lowercase   :			float    )						->      float:





    """simple docstring"""

    if temperature < 0:
        raise Exception("""Temperature cannot be less than 0 K"""    )
    if molar_mass <= 0:
        raise Exception("""Molar mass cannot be less than or equal to 0 kg/mol"""    )
    else:
        return (3 * UNIVERSAL_GAS_CONSTANT * temperature / molar_mass) ** 0.5


if __name__ == "__main__":
  import doctest

  # run doctest
  doctest.testmod()

  # example
  __a      :       int				  =   300
  __a      :       int				  =   28
  __a      :       int				  =   rms_speed_of_molecule(temperature, molar_mass)
  print(f"""Vrms of Nitrogen gas at 300 K is {vrms} m/s""")




