
import math






def 				UpperCAmelCase_						(				__SCREAMING_SNAKE_CASE				):
	lowercase	    =       0
	lowercase	    =       0
	while num > 0:
		lowercase	    =       num % 8
		lowercase	    =       octal + (remainder * math.floor(math.pow(10					,				__SCREAMING_SNAKE_CASE				)				))
		counter += 1
		lowercase	    =       math.floor(num / 8				)  # basically /= 8 without remainder if any
		# This formatting removes trailing '.0' from `octal`.
	return F'''0o{int(__SCREAMING_SNAKE_CASE				)}'''






def 				UpperCAmelCase_						(				):
	print('\n2 in octal is:'				)
	print(decimal_to_octal(2				)				)  # = 2
	print('\n8 in octal is:'				)
	print(decimal_to_octal(8				)				)  # = 10
	print('\n65 in octal is:'				)
	print(decimal_to_octal(65				)				)  # = 101
	print('\n216 in octal is:'				)
	print(decimal_to_octal(216				)				)  # = 330
	print('\n512 in octal is:'				)
	print(decimal_to_octal(512				)				)  # = 1000
	print('\n'				)


if __name__ == "__main__":
	main()


from heapq import heappop, heappush

import numpy as np






def     lowerCAmelCase_			(   _SCREAMING_SNAKE_CASE     :				np.ndarray		, _SCREAMING_SNAKE_CASE     :				tuple[int, int]		, _SCREAMING_SNAKE_CASE     :				tuple[int, int]		, _SCREAMING_SNAKE_CASE     :				bool		, ):
						UpperCamelCase_,UpperCamelCase_		:							Union[str, Any]  =		grid.shape
						UpperCamelCase_		:							List[str]  =		[-1, 1, 0, 0]
						UpperCamelCase_		:							Dict  =		[0, 0, -1, 1]
						if allow_diagonal:
												dx += [-1, -1, 1, 1]
												dy += [-1, 1, -1, 1]

						UpperCamelCase_,UpperCamelCase_		:							List[Any]  =		[(0, source)], set()
						UpperCamelCase_		:							Any  =		np.full((rows, cols)		, np.inf			)
						UpperCamelCase_		:							List[str]  =		0
						UpperCamelCase_		:							Union[str, Any]  =		np.empty((rows, cols)		, dtype=_SCREAMING_SNAKE_CASE			)
						UpperCamelCase_		:							Optional[int]  =		None

						while queue:
												((UpperCamelCase_),(UpperCamelCase_))		:							Any  =		heappop(_SCREAMING_SNAKE_CASE			)
												if (x, y) in visited:
																		continue
												visited.add((x, y)			)

												if (x, y) == destination:
																		UpperCamelCase_		:							Tuple  =		[]
																		while (x, y) != source:
																								path.append((x, y)			)
																								UpperCamelCase_,UpperCamelCase_		:							Union[str, Any]  =		predecessors[x, y]
																		path.append(_SCREAMING_SNAKE_CASE			)  # add the source manually
																		path.reverse()
																		return matrix[destination], path

												for i in range(len(_SCREAMING_SNAKE_CASE			)			):
																		UpperCamelCase_,UpperCamelCase_		:							Optional[Any]  =		x + dx[i], y + dy[i]
																		if 0 <= nx < rows and 0 <= ny < cols:
																								UpperCamelCase_		:							Union[str, Any]  =		grid[nx][ny]
																								if next_node == 1 and matrix[nx, ny] > dist + 1:
																														heappush(_SCREAMING_SNAKE_CASE		, (dist + 1, (nx, ny))			)
																														UpperCamelCase_		:							Optional[Any]  =		dist + 1
																														UpperCamelCase_		:							List[Any]  =		(x, y)

						return np.inf, []


if __name__ == "__main__":
	import doctest

	doctest.testmod()






