




'''simple docstring'''





from heapq import heappop, heappush

import numpy as np


def      UpperCamelCase_(	snake_case							:       np.ndarray							,				snake_case							:       tuple[int, int]							,				snake_case							:       tuple[int, int]							,				snake_case							:       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=snake_case     )
							snake_case_						=      None

							while queue:
														((snake_case_)					,      (snake_case_))						=      heappop(snake_case     )
														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(snake_case     )  # add the source manually
																					path.reverse()
																					return matrix[destination], path

														for i in range(len(snake_case     )     ):
																					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(snake_case							,				(dist + 1, (nx, ny))     )
																																			snake_case_						=      dist + 1
																																			snake_case_						=      (x, y)

							return np.inf, []


if __name__ == "__main__":
		import doctest

		doctest.testmod()







from __future__ import annotations




def 			UpperCAmelCase__				(			_A      : float	,      _A      : float	,      _A      : float	,      ):





  '''simple docstring'''







  if (stress, tangential_force, area).count(0							) != 1:
    raise ValueError('''You cannot supply more or less than 2 values'''							)
  elif stress < 0:
    raise ValueError('''Stress cannot be negative'''							)
  elif tangential_force < 0:
    raise ValueError('''Tangential Force cannot be negative'''							)
  elif area < 0:
    raise ValueError('''Area cannot be negative'''							)
  elif stress == 0:
    return (
        "stress",
        tangential_force / area,
    )
  elif tangential_force == 0:
    return (
        "tangential_force",
        stress * area,
    )
  else:
    return (
        "area",
        tangential_force / stress,
    )


if __name__ == "__main__":
       import doctest

       doctest.testmod()
