

from heapq import heappop, heappush

import numpy as np







def 						lowerCamelCase__      ( __A    :np.ndarray	,__A    :tuple[int, int]	,__A    :tuple[int, int]	,__A    :bool	,):


       """simple docstring"""




       __snake_case	,    __snake_case       	=							grid.shape
       __snake_case       	=							[-1, 1, 0, 0]
       __snake_case       	=							[0, 0, -1, 1]
       if allow_diagonal:
              dx += [-1, -1, 1, 1]
              dy += [-1, 1, -1, 1]

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

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

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

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

       return np.inf, []


if __name__ == "__main__":
    import doctest

    doctest.testmod()




def 						lowerCamelCase__      ( __A    :int	,__A    :float	,__A    :float		):


       """simple docstring"""




       return round(float(moles / volume		) * nfactor		)







def 						lowerCamelCase__      ( __A    :float	,__A    :float	,__A    :float		):


       """simple docstring"""




       return round(float((moles * 0.0_821 * temperature) / (volume)		)		)







def 						lowerCamelCase__      ( __A    :float	,__A    :float	,__A    :float		):


       """simple docstring"""




       return round(float((moles * 0.0_821 * temperature) / (pressure)		)		)







def 						lowerCamelCase__      ( __A    :float	,__A    :float	,__A    :float		):


       """simple docstring"""




       return round(float((pressure * volume) / (0.0_821 * moles)		)		)


if __name__ == "__main__":
    import doctest

    doctest.testmod()

