




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					):


      '''simple docstring'''



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

      lowerCamelCase_							=   (low + high) // 2
      lowerCamelCase_					,    lowerCamelCase_					,    lowerCamelCase_							=   max_subarray(lowercase     ,							lowercase     ,							lowercase					)
      lowerCamelCase_					,    lowerCamelCase_					,    lowerCamelCase_							=   max_subarray(lowercase     ,							mid + 1     ,							lowercase					)
      lowerCamelCase_					,    lowerCamelCase_					,    lowerCamelCase_							=   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					):


      '''simple docstring'''



      lowerCamelCase_					,    lowerCamelCase_							=   float('-inf'					), -1
      lowerCamelCase_					,    lowerCamelCase_							=   float('-inf'					), -1

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

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

      return max_left, max_right, (left_sum + right_sum)

def       _SCREAMING_SNAKE_CASE      (							lowercase     :	int					):


      '''simple docstring'''



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

def       _SCREAMING_SNAKE_CASE      (							):


      '''simple docstring'''



      lowerCamelCase_							=   [10, 1_00, 10_00, 1_00_00, 5_00_00, 10_00_00, 20_00_00, 30_00_00, 40_00_00, 50_00_00]
      lowerCamelCase_							=   [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()









import math

def       _SCREAMING_SNAKE_CASE      (							lowercase     :	int					):


      '''simple docstring'''



      lowerCamelCase_							=   0
      lowerCamelCase_							=   0
      while num > 0:
            lowerCamelCase_							=   num % 8
            lowerCamelCase_							=   octal + (remainder * math.floor(math.pow(10     ,							lowercase					)					))
            counter += 1
            lowerCamelCase_							=   math.floor(num / 8					)  # basically /= 8 without remainder if any
            # This formatting removes trailing '.0' from `octal`.
      return f"""0o{int(lowercase					)}"""

def       _SCREAMING_SNAKE_CASE      (							):


      '''simple docstring'''



      print('\n2 in octal is:'					)
      print(decimal_to_octal(2					)					)  # = 2
      print('\n8 in octal is:'					)
      print(decimal_to_octal(8					)					)  # = 10
      print('\n65 in octal is:'					)
      print(decimal_to_octal(65					)					)  # = 101
      print('\n216 in octal is:'					)
      print(decimal_to_octal(2_16					)					)  # = 330
      print('\n512 in octal is:'					)
      print(decimal_to_octal(5_12					)					)  # = 1000
      print('\n'					)


if __name__ == "__main__":
 main()



