



from heapq import heappop, heappush

import numpy as np

def 	SCREAMING_SNAKE_CASE_							(	_snake_case	:np.ndarray	,   _snake_case	:tuple[int, int]	,   _snake_case	:tuple[int, int]	,   _snake_case	:bool	,   )  ->     tuple[float | int, list[tuple[int, int]]]:
   _A  ,    _A      =       grid.shape
   _A      =       [-1, 1, 0, 0]
   _A      =       [0, 0, -1, 1]
   if allow_diagonal:
      dx += [-1, -1, 1, 1]
      dy += [-1, 1, -1, 1]

   _A  ,    _A      =       [(0, source)], set()
   _A      =       np.full((rows, cols)	,   np.inf				)
   _A      =       0
   _A      =       np.empty((rows, cols)	,   dtype=_snake_case				)
   _A      =       None

   while queue:
      ((_A)  ,    (_A))      =       heappop(_snake_case				)
      if (x, y) in visited:
         continue
      visited.add((x, y)				)

      if (x, y) == destination:
         _A      =       []
         while (x, y) != source:
            path.append((x, y)				)
            _A  ,    _A      =       predecessors[x, y]
         path.append(_snake_case				)  # add the source manually
         path.reverse()
         return matrix[destination], path

      for i in range(len(_snake_case				)				):
         _A  ,    _A      =       x + dx[i], y + dy[i]
         if 0 <= nx < rows and 0 <= ny < cols:
            _A      =       grid[nx][ny]
            if next_node == 1 and matrix[nx, ny] > dist + 1:
               heappush(_snake_case	,   (dist + 1, (nx, ny))				)
               _A      =       dist + 1
               _A      =       (x, y)

   return np.inf, []


if __name__ == "__main__":
   import doctest

   doctest.testmod()







"""simple docstring"""
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments

def 				_snake_case      (   ):




   """simple docstring"""







   _lowerCamelCase	:					Any   =		HfArgumentParser(__snake_case   )
   _lowerCamelCase	:					int   =		parser.parse_args_into_dataclasses()[0]
   _lowerCamelCase	:					Dict   =		TensorFlowBenchmark(args=__snake_case   )
   try:
      _lowerCamelCase	:					Optional[int]   =		parser.parse_args_into_dataclasses()[0]
   except ValueError as e:
      _lowerCamelCase	:					Union[str, Any]   =		"""Arg --no_{0} is no longer used, please use --no-{0} instead."""
      _lowerCamelCase	:					List[str]   =		""" """.join(str(__snake_case   ).split(""" """   )[:-1]   )
      _lowerCamelCase	:					Dict   =		""""""
      _lowerCamelCase	:					List[Any]   =		eval(str(__snake_case   ).split(""" """   )[-1]   )
      _lowerCamelCase	:					Tuple   =		[]
      for arg in depreciated_args:
         # arg[2:] removes '--'
         if arg[2:] in TensorFlowBenchmark.deprecated_args:
            # arg[5:] removes '--no_'
            full_error_msg += arg_error_msg.format(arg[5:]   )
         else:
            wrong_args.append(__snake_case   )
      if len(__snake_case   ) > 0:
         _lowerCamelCase	:					Tuple   =		full_error_msg + begin_error_msg + str(__snake_case   )
      raise ValueError(__snake_case   )
   benchmark.run()


if __name__ == "__main__":
 main()

