






"""simple docstring"""



def        _lowerCAmelCase						(							UpperCAmelCase__    :   float,  UpperCAmelCase__    :   float )						->float:
						if mass < 0:
												raise ValueError("""The mass of a body cannot be negative""" )
						return 0.5 * mass * abs(UpperCAmelCase__ ) * abs(UpperCAmelCase__ )


if __name__ == "__main__":
						import doctest

						doctest.testmod(verbose=True)














"""simple docstring"""



from __future__ import annotations

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

from matplotlib import pyplot as plt




def        _lowerCAmelCase						(							UpperCAmelCase__    :   Sequence[float],  UpperCAmelCase__    :   int,  UpperCAmelCase__    :   int )						->tuple[int | None, int | None, float]:
						if not arr:
												return None, None, 0
						if low == high:
												return low, high, arr[low]

						A__  :					Optional[int]											=					(low + high) // 2
						A__					,					A__					,					A__  :					List[Any]											=					max_subarray(UpperCAmelCase__,  UpperCAmelCase__,  UpperCAmelCase__ )
						A__					,					A__					,					A__  :					Union[str, Any]											=					max_subarray(UpperCAmelCase__,  mid + 1,  UpperCAmelCase__ )
						A__					,					A__					,					A__  :					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        _lowerCAmelCase						(							UpperCAmelCase__    :   Sequence[float],  UpperCAmelCase__    :   int,  UpperCAmelCase__    :   int,  UpperCAmelCase__    :   int )						->tuple[int, int, float]:
						A__					,					A__  :					Dict											=					float("""-inf""" ), -1
						A__					,					A__  :					Optional[Any]											=					float("""-inf""" ), -1

						A__  :					int | float											=					0
						for i in range(UpperCAmelCase__,  low - 1,  -1 ):
												summ += arr[i]
												if summ > left_sum:
																		A__  :					Optional[int]											=					summ
																		A__  :					Union[str, Any]											=					i

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

						return max_left, max_right, (left_sum + right_sum)




def        _lowerCAmelCase						(							UpperCAmelCase__    :   int )						->float:
						A__  :					Union[str, Any]											=					[randint(1,  UpperCAmelCase__ ) for _ in range(UpperCAmelCase__ )]
						A__  :					Any											=					time.time()
						max_subarray(UpperCAmelCase__,  0,  input_size - 1 )
						A__  :					List[Any]											=					time.time()
						return end - start




def        _lowerCAmelCase						(							)						->None:
						A__  :					List[Any]											=					[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__  :					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()






