


import logging
import os

from .state import PartialState




class A    (  logging.LoggerAdapter	):






      @staticmethod
      def 			lowerCamelCase			(   lowercase_		:	str					)   ->		Union[str, Any]:
             """simple docstring"""




             _lowerCamelCase			:						Any            =PartialState()
             return not main_process_only or (main_process_only and state.is_main_process)






      def 			lowerCamelCase			(   self		:	Tuple     ,  lowercase_		:	List[Any]     ,  lowercase_		:	List[str]     ,  *lowercase_		:	Optional[Any]     ,  **lowercase_		:	List[str]					)   ->		Tuple:
             """simple docstring"""




             if PartialState._shared_state == {}:
                    raise RuntimeError(
                        'You must initialize the accelerate state by calling either `PartialState()` or `Accelerator()` before using the logging utility.'					)
             _lowerCamelCase			:						Dict            =kwargs.pop('main_process_only'     ,  __A					)
             _lowerCamelCase			:						Optional[int]            =kwargs.pop('in_order'     ,  __A					)

             if self.isEnabledFor(__A					):
                    if self._should_log(__A					):
                           _lowerCamelCase			:						Optional[int]            =self.process(__A     ,  __A					)
                           self.logger.log(__A     ,  __A     ,  *__A     ,  **__A					)

                    elif in_order:
                           _lowerCamelCase			:						Tuple            =PartialState()
                           for i in range(state.num_processes					):
                                  if i == state.process_index:
                                         _lowerCamelCase			:						int            =self.process(__A     ,  __A					)
                                         self.logger.log(__A     ,  __A     ,  *__A     ,  **__A					)
                                  state.wait_for_everyone()




def       a_ (       SCREAMING_SNAKE_CASE__   : str						,     SCREAMING_SNAKE_CASE__   : str = None	):
       '''simple docstring'''





       if log_level is None:
              _lowerCamelCase			:						List[str]            =os.environ.get('ACCELERATE_LOG_LEVEL'						,     UpperCAmelCase_	)
       _lowerCamelCase			:						List[str]            =logging.getLogger(UpperCAmelCase_	)
       if log_level is not None:
              logger.setLevel(log_level.upper()	)
              logger.root.setLevel(log_level.upper()	)
       return MultiProcessAdapter(UpperCAmelCase_						,     {}	)




from collections.abc import Sequence
def 							SCREAMING_SNAKE_CASE_	(					UpperCAmelCase_	:     Sequence[int] | None = None				)			->						int:
       if nums is None or not nums:
              raise ValueError('''Input sequence should not be empty'''				)

       SCREAMING_SNAKE_CASE_							:				Tuple		=nums[0]
       for i in range(1			,							len(UpperCAmelCase_				)				):
              SCREAMING_SNAKE_CASE_							:				Any		=nums[i]
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=max(UpperCAmelCase_			,							ans + num			,							UpperCAmelCase_				)

       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))
