



'''simple docstring'''





from collections.abc import Sequence





def   a_   (		_UpperCAmelCase    :      Optional[int] ,_UpperCAmelCase    :      Dict = False				)    ->  Optional[Any]:
      if not arr:
            return 0

      __snake_case :   int													=    0 if allow_empty_subarrays else float('-inf'				)
      __snake_case :   Tuple													=    0.0
      for num in arr:
            __snake_case :   Dict													=    max(0 if allow_empty_subarrays else num ,curr_sum + num				)
            __snake_case :   Optional[int]													=    max(UpperCamelCase_ ,UpperCamelCase_				)

      return max_sum


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

    testmod()

    A__    :   Dict           =					[-2, 1, -3, 4, -1, 2, 1, -5, 4]
    print(F"""{max_subarray_sum(nums) = }""")







'''simple docstring'''
__SCREAMING_SNAKE_CASE					:				Optional[int]									=		{
    '''a''': '''AAAAA''',
    '''b''': '''AAAAB''',
    '''c''': '''AAABA''',
    '''d''': '''AAABB''',
    '''e''': '''AABAA''',
    '''f''': '''AABAB''',
    '''g''': '''AABBA''',
    '''h''': '''AABBB''',
    '''i''': '''ABAAA''',
    '''j''': '''BBBAA''',
    '''k''': '''ABAAB''',
    '''l''': '''ABABA''',
    '''m''': '''ABABB''',
    '''n''': '''ABBAA''',
    '''o''': '''ABBAB''',
    '''p''': '''ABBBA''',
    '''q''': '''ABBBB''',
    '''r''': '''BAAAA''',
    '''s''': '''BAAAB''',
    '''t''': '''BAABA''',
    '''u''': '''BAABB''',
    '''v''': '''BBBAB''',
    '''w''': '''BABAA''',
    '''x''': '''BABAB''',
    '''y''': '''BABBA''',
    '''z''': '''BABBB''',
    ''' ''': ''' ''',
}


__SCREAMING_SNAKE_CASE					:				Tuple									=		{value: key for key, value in encode_dict.items()}







def       a_				(	UpperCamelCase_ ):
							A_			    =		""
							for letter in word.lower():
														if letter.isalpha() or letter == " ":
																					encoded += encode_dict[letter]
														else:
																					raise Exception("encode() accepts only letters of the alphabet and spaces" )
							return encoded







def       a_				(	UpperCamelCase_ ):
							if set(UpperCamelCase_ ) - {"A", "B", " "} != set():
														raise Exception("decode() accepts only 'A', 'B' and spaces" )
							A_			    =		""
							for word in coded.split():
														while len(UpperCamelCase_ ) != 0:
																					decoded += decode_dict[word[:5]]
																					A_			    =		word[5:]
														decoded += " "
							return decoded.strip()


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

							testmod()





