

from __future__ import annotations

import math
def 						_snake_case(   SCREAMING_SNAKE_CASE__      :     int   ,      SCREAMING_SNAKE_CASE__      :     int   ,      SCREAMING_SNAKE_CASE__      :     bool   ,      SCREAMING_SNAKE_CASE__      :     list[int]   ,      SCREAMING_SNAKE_CASE__      :     float				)							->				int:





    '''simple docstring'''






    if depth < 0:
        raise ValueError('Depth cannot be less than 0'				)

    if len(lowerCAmelCase__				) == 0:
        raise ValueError('Scores cannot be empty'				)

    if depth == height:
        return scores[node_index]

    if is_max:
        return max(
            minimax(depth + 1   ,      node_index * 2   ,      lowerCAmelCase__   ,      lowerCAmelCase__   ,      lowerCAmelCase__				)   ,      minimax(depth + 1   ,      node_index * 2 + 1   ,      lowerCAmelCase__   ,      lowerCAmelCase__   ,      lowerCAmelCase__				)   ,      )

    return min(
        minimax(depth + 1   ,      node_index * 2   ,      lowerCAmelCase__   ,      lowerCAmelCase__   ,      lowerCAmelCase__				)   ,      minimax(depth + 1   ,      node_index * 2 + 1   ,      lowerCAmelCase__   ,      lowerCAmelCase__   ,      lowerCAmelCase__				)   ,      )
def 						_snake_case(   )							->				None:





    '''simple docstring'''






    A__   				=       [90, 23, 6, 33, 21, 65, 123, 34423]
    A__   				=       math.log(len(lowerCAmelCase__				)   ,      2				)
    print('Optimal value : '   ,      end=''				)
    print(minimax(0   ,      0   ,      lowerCAmelCase__   ,      lowerCAmelCase__   ,      lowerCAmelCase__				)				)


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     main()




from collections.abc import Sequence
def 						_snake_case(   SCREAMING_SNAKE_CASE__      :     Sequence[int] | None = None				)							->				int:





    '''simple docstring'''






    if nums is None or not nums:
        raise ValueError('Input sequence should not be empty'				)

    A__   				=       nums[0]
    for i in range(1   ,      len(SCREAMING_SNAKE_CASE__				)				):
        A__   				=       nums[i]
        A__   				=       max(SCREAMING_SNAKE_CASE__   ,      ans + num   ,      SCREAMING_SNAKE_CASE__				)

    return ans


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     # Try on a sample input from the user
     lowercase_			=  int(input("Enter number of elements : ").strip())
     lowercase_			=  list(map(int, input("\nEnter the numbers : ").strip().split()))[:n]
     print(max_subsequence_sum(array))

