





def   a_   (			lowerCAmelCase_				:      int     ):
   __lowerCAmelCase							     =     [0] * len(_lowerCamelCase     )
   __lowerCAmelCase							     =     []
   __lowerCAmelCase							     =     []
   __lowerCAmelCase							     =     0

   for values in graph.values():
      for i in values:
         indegree[i] += 1

   for i in range(len(_lowerCamelCase     )     ):
      if indegree[i] == 0:
         queue.append(_lowerCamelCase     )

   while queue:
      __lowerCAmelCase							     =     queue.pop(0     )
      cnt += 1
      topo.append(_lowerCamelCase     )
      for x in graph[vertex]:
         indegree[x] -= 1
         if indegree[x] == 0:
            queue.append(_lowerCamelCase     )

   if cnt != len(_lowerCamelCase     ):
      print('Cycle exists'     )
   else:
      print(_lowerCamelCase     )


# Adjacency List of Graph
_snake_case  :   Optional[Any]						   =  {0: [1, 2], 1: [3], 2: [3], 3: [4, 5], 4: [], 5: []}




topological_sort(graph)







from collections.abc import Sequence

def   a_   (			lowerCAmelCase_				:      Sequence[float],     lowerCAmelCase_				:      bool = False     ):
   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(lowerCAmelCase_,     lowerCAmelCase_     )

   return max_sum


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

     testmod()

     _snake_case  :   Optional[Any]						   =  [-2, 1, -3, 4, -1, 2, 1, -5, 4]
     print(F"""{max_subarray_sum(nums) = }""")

