



"""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		(			lowerCamelCase_:							Sequence[float]     ,		lowerCamelCase_:							int     ,		lowerCamelCase_:							int ):
						"""simple docstring"""






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

						snake_case   :			List[Any]						    = (low + high) // 2
						snake_case    ,			snake_case    ,			snake_case   :			Dict						    = max_subarray(lowerCamelCase_     ,		lowerCamelCase_     ,		lowerCamelCase_ )
						snake_case    ,			snake_case    ,			snake_case   :			str						    = max_subarray(lowerCamelCase_     ,		mid + 1     ,		lowerCamelCase_ )
						snake_case    ,			snake_case    ,			snake_case   :			Optional[Any]						    = max_cross_sum(lowerCamelCase_     ,		lowerCamelCase_     ,		lowerCamelCase_     ,		lowerCamelCase_ )
						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		(			lowerCamelCase_:							Sequence[float]     ,		lowerCamelCase_:							int     ,		lowerCamelCase_:							int     ,		lowerCamelCase_:							int ):
						"""simple docstring"""






						snake_case    ,			snake_case   :			Optional[Any]						    = float("-inf" ), -1
						snake_case    ,			snake_case   :			Tuple						    = float("-inf" ), -1

						snake_case   :			int | float						    = 0
						for i in range(lowerCamelCase_     ,		low - 1     ,		-1 ):
												summ += arr[i]
												if summ > left_sum:
																		snake_case   :			int						    = summ
																		snake_case   :			List[str]						    = i

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

						return max_left, max_right, (left_sum + right_sum)

def  __SCREAMING_SNAKE_CASE		(			lowerCamelCase_:							int ):
						"""simple docstring"""






						snake_case   :			Union[str, Any]						    = [randint(1     ,		lowerCamelCase_ ) for _ in range(lowerCamelCase_ )]
						snake_case   :			Dict						    = time.time()
						max_subarray(lowerCamelCase_     ,		0     ,		input_size - 1 )
						snake_case   :			Optional[Any]						    = time.time()
						return end - start

def  __SCREAMING_SNAKE_CASE		(			):
						"""simple docstring"""






						snake_case   :			List[str]						    = [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]
						snake_case   :			Union[str, Any]						    = [time_max_subarray(lowerCamelCase_ ) for input_size in input_sizes]
						print("No of Inputs\t\tTime Taken" )
						for input_size, runtime in zip(lowerCamelCase_     ,		lowerCamelCase_ ):
												print(lowerCamelCase_     ,		"\t\t"     ,		lowerCamelCase_ )
						plt.plot(lowerCamelCase_     ,		lowerCamelCase_ )
						plt.xlabel("Number of Inputs" )
						plt.ylabel("Time taken in seconds" )
						plt.show()


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

			testmod()








"""simple docstring"""







A		=						8.31_4462  # Unit - J mol-1 K-1

def  __SCREAMING_SNAKE_CASE		(			lowerCamelCase_:							float     ,		lowerCamelCase_:							float     ,		lowerCamelCase_:							float ):
						"""simple docstring"""






						if moles < 0 or kelvin < 0 or volume < 0:
												raise ValueError("Invalid inputs. Enter positive value." )
						return moles * kelvin * UNIVERSAL_GAS_CONSTANT / volume

def  __SCREAMING_SNAKE_CASE		(			lowerCamelCase_:							float     ,		lowerCamelCase_:							float     ,		lowerCamelCase_:							float ):
						"""simple docstring"""






						if moles < 0 or kelvin < 0 or pressure < 0:
												raise ValueError("Invalid inputs. Enter positive value." )
						return moles * kelvin * UNIVERSAL_GAS_CONSTANT / pressure


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

			testmod()



