





'''simple docstring'''


from collections.abc import Sequence


def 	__a(SCREAMING_SNAKE_CASE_  :					Sequence[float]		,       SCREAMING_SNAKE_CASE_  :					bool = 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(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_    )

    return max_sum


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

       testmod()

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









'''simple docstring'''


def 	__a(SCREAMING_SNAKE_CASE_  :					list[int]		,       SCREAMING_SNAKE_CASE_  :					list[int]		,       SCREAMING_SNAKE_CASE_  :					int    ):



    '''simple docstring'''





    return not any(
        neighbour == 1 and colored_vertices[i] == color
        for i, neighbour in enumerate(SCREAMING_SNAKE_CASE_    )    )


def 	__a(SCREAMING_SNAKE_CASE_  :					list[list[int]]		,       SCREAMING_SNAKE_CASE_  :					int		,       SCREAMING_SNAKE_CASE_  :					list[int]		,       SCREAMING_SNAKE_CASE_  :					int    ):



    '''simple docstring'''





    if index == len(SCREAMING_SNAKE_CASE_    ):
        return True

    # Recursive Step
    for i in range(SCREAMING_SNAKE_CASE_    ):
        if valid_coloring(graph[index]		,       SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_    ):
            # Color current vertex
            _lowerCAmelCase				=      i
            # Validate coloring
            if util_color(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       index + 1    ):
                return True
            # Backtrack
            _lowerCAmelCase				=      -1
    return False





def 	__a(SCREAMING_SNAKE_CASE_  :					list[list[int]]		,       SCREAMING_SNAKE_CASE_  :					int    ):



    '''simple docstring'''





    _lowerCAmelCase				=      [-1] * len(SCREAMING_SNAKE_CASE_    )

    if util_color(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_		,       0    ):
        return colored_vertices

    return []


