



'''simple docstring'''





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  (       UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase			):



    """simple docstring"""





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

    lowerCAmelCase__ :  Union[str, Any]							      =					(low + high) // 2
    lowerCAmelCase__      ,   lowerCAmelCase__      ,   lowerCAmelCase__ :  Dict							      =					max_subarray(UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase			)
    lowerCAmelCase__      ,   lowerCAmelCase__      ,   lowerCAmelCase__ :  int							      =					max_subarray(UpperCamelCase							,    mid + 1							,    UpperCamelCase			)
    lowerCAmelCase__      ,   lowerCAmelCase__      ,   lowerCAmelCase__ :  Union[str, Any]							      =					max_cross_sum(UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase			)
    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  (       UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase			):



    """simple docstring"""





    lowerCAmelCase__      ,   lowerCAmelCase__ :  Any							      =					float("""-inf"""			), -1
    lowerCAmelCase__      ,   lowerCAmelCase__ :  str							      =					float("""-inf"""			), -1

    lowerCAmelCase__ :  int | float							      =					0
    for i in range(UpperCamelCase							,    low - 1							,    -1			):
        summ += arr[i]
        if summ > left_sum:
            lowerCAmelCase__ :  Optional[int]							      =					summ
            lowerCAmelCase__ :  List[Any]							      =					i

    lowerCAmelCase__ :  Optional[Any]							      =					0
    for i in range(mid + 1							,    high + 1			):
        summ += arr[i]
        if summ > right_sum:
            lowerCAmelCase__ :  Optional[Any]							      =					summ
            lowerCAmelCase__ :  List[str]							      =					i

    return max_left, max_right, (left_sum + right_sum)
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase			):



    """simple docstring"""





    lowerCAmelCase__ :  Optional[Any]							      =					[randint(1							,    UpperCamelCase			) for _ in range(UpperCamelCase			)]
    lowerCAmelCase__ :  Union[str, Any]							      =					time.time()
    max_subarray(UpperCamelCase							,    0							,    input_size - 1			)
    lowerCAmelCase__ :  str							      =					time.time()
    return end - start
def    _SCREAMING_SNAKE_CASE  (       ):



    """simple docstring"""





    lowerCAmelCase__ :  Any							      =					[10, 100, 1000, 10000, 50000, 100000, 200000, 300000, 400000, 500000]
    lowerCAmelCase__ :  List[Any]							      =					[time_max_subarray(UpperCamelCase			) for input_size in input_sizes]
    print("""No of Inputs\t\tTime Taken"""			)
    for input_size, runtime in zip(UpperCamelCase							,    UpperCamelCase			):
        print(UpperCamelCase							,    """\t\t"""							,    UpperCamelCase			)
    plt.plot(UpperCamelCase							,    UpperCamelCase			)
    plt.xlabel("""Number of Inputs"""			)
    plt.ylabel("""Time taken in seconds"""			)
    plt.show()


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

 testmod()










import numpy as np







def 		SCREAMING_SNAKE_CASE							(					__lowerCAmelCase			) ->	np.array:
     return 1 / (1 + np.exp(-vector			))







def 		SCREAMING_SNAKE_CASE							(					__lowerCAmelCase			) ->	np.array:
     return vector * sigmoid(1.7_0_2 * vector			)


if __name__ == "__main__":
 import doctest

 doctest.testmod()