
"""simple docstring"""







import operator
def     __lowerCAmelCase				(_UpperCamelCase       ,  _UpperCamelCase = False       ,  _UpperCamelCase = None		):
	__lowerCAmelCase			:						int									=      operator.lt if reverse else operator.gt
	__lowerCAmelCase			:						str									=      solution or []

	if not arr:
		return solution

	__lowerCAmelCase			:						Union[str, Any]									=      [arr.pop(0		)]
	for i, item in enumerate(lowerCAmelCase__		):
		if _operator(lowerCAmelCase__       ,  sublist[-1]		):
			sublist.append(lowerCAmelCase__		)
			arr.pop(lowerCAmelCase__		)

    #  merging sublist into solution list
	if not solution:
		solution.extend(lowerCAmelCase__		)
	else:
		while sublist:
			__lowerCAmelCase			:						Tuple									=      sublist.pop(0		)
			for i, xx in enumerate(lowerCAmelCase__		):
				if not _operator(lowerCAmelCase__       ,  lowerCAmelCase__		):
					solution.insert(lowerCAmelCase__       ,  lowerCAmelCase__		)
					break
			else:
				solution.append(lowerCAmelCase__		)

	strand_sort(lowerCAmelCase__       ,  lowerCAmelCase__       ,  lowerCAmelCase__		)
	return solution


if __name__ == "__main__":
							assert strand_sort([4, 3, 5, 1, 2]) == [1, 2, 3, 4, 5]
							assert strand_sort([4, 3, 5, 1, 2], reverse=True) == [5, 4, 3, 2, 1]
"""simple docstring"""






from __future__ import annotations


def 			UpperCAmelCase__       (				lowerCAmelCase__     :list[int]		) ->    int:
      '''simple docstring'''


      if not nums:
            return 0
      lowercase														=	nums[0]
      lowercase														=	0
      for num in nums[1:]:
            lowercase							,							lowercase														=	(
                max_excluding + num,
                max(lowerCAmelCase__					,		lowerCAmelCase__		),
            )
      return max(lowerCAmelCase__					,		lowerCAmelCase__		)


if __name__ == "__main__":
       import doctest

       doctest.testmod()



