


"""simple docstring"""







from __future__ import annotations




def    UpperCAmelCase__       (lowerCAmelCase_   ):




					'''simple docstring'''


					create_state_space_tree(lowerCAmelCase_  ,						[]  ,						0  ,						[0 for i in range(len(lowerCAmelCase_   )   )]   )




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_  ,						lowerCAmelCase_  ,						lowerCAmelCase_  ,						):




					'''simple docstring'''


					if index == len(lowerCAmelCase_   ):
										print(lowerCAmelCase_   )
										return

					for i in range(len(lowerCAmelCase_   )   ):
										if not index_used[i]:
															current_sequence.append(sequence[i]   )
															__SCREAMING_SNAKE_CASE						   =				True
															create_state_space_tree(lowerCAmelCase_  ,						lowerCAmelCase_  ,						index + 1  ,						lowerCAmelCase_   )
															current_sequence.pop()
															__SCREAMING_SNAKE_CASE						   =				False
a__				:							list[int | str]						=     [3, 1, 2, 4]
generate_all_permutations(sequence)

a__				:							list[int | str]						=     ["A", "B", "C"]



generate_all_permutations(sequence_a)







'''simple docstring'''

from collections.abc import Sequence





def lowerCamelCase						(     __lowerCamelCase :    Sequence[float]					,       __lowerCamelCase :    bool = False    )						->float:
    if not arr:
        return 0

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

    return max_sum


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

      testmod()

      lowercase_					= [-2, 1, -3, 4, -1, 2, 1, -5, 4]
      print(f"""{max_subarray_sum(nums) = }""")



