



from collections.abc import Sequence

def     __lowercase(	UpperCAmelCase__   ,   UpperCAmelCase__ = False ):


      """simple docstring"""



      if not arr:
            return 0

      lowerCamelCase								=		0 if allow_empty_subarrays else float("-inf" )
      lowerCamelCase								=		0.0
      for num in arr:
            lowerCamelCase								=		max(0 if allow_empty_subarrays else num   ,   curr_sum + num )
            lowerCamelCase								=		max(UpperCAmelCase__   ,   UpperCAmelCase__ )

      return max_sum


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

     testmod()

     a_						:     Optional[int]	     =		[-2, 1, -3, 4, -1, 2, 1, -5, 4]
     print(f"""{max_subarray_sum(nums) = }""")




from __future__ import annotations

from collections.abc import Iterable, Iterator
from dataclasses import dataclass

a_						:     Optional[int]	     =		(3, 9, -1_1, 0, 7, 5, 1, -1)
a_						:     str	     =		(4, 6, 2, 0, 8, 1_0, 3, -2)





@dataclass
class    lowerCamelCase__  :
     """simple docstring"""



     _A       =			42
     _A       =			42





class    lowerCamelCase__  :
     """simple docstring"""



     def __init__(self				,			__a    ):






           '''simple docstring'''



           lowerCamelCase								=		None
           for i in sorted(__a				,			reverse=__a    ):
                 lowerCamelCase								=		Node(__a				,			self.head    )







     def __iter__(self    ):






           '''simple docstring'''



           lowerCamelCase								=		self.head
           while node:
                 yield node.data
                 lowerCamelCase								=		node.next_node







     def __len__(self    ):






           '''simple docstring'''



           return sum(1 for _ in self    )







     def __str__(self    ):






           '''simple docstring'''



           return " -> ".join([str(__a    ) for node in self]    )



def     __lowercase(	UpperCAmelCase__   ,   UpperCAmelCase__ ):


      """simple docstring"""



      return SortedLinkedList(list(UpperCAmelCase__ ) + list(UpperCAmelCase__ ) )


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     a_						:     Any	     =		SortedLinkedList
     print(merge_lists(SSL(test_data_odd), SSL(test_data_even)))