"""simple docstring"""







from queue import PriorityQueue
from typing import Any

import numpy as np


def      __lowerCAmelCase(		__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,):






	"""simple docstring"""





	for nxt, d in graph[v]:
		if nxt in visited_forward:
			continue
		_lowercase :    int							=							cst_fwd.get(__UpperCAmelCase     ,np.inf			)
		_lowercase :    List[str]							=							cst_fwd[v] + d
		if new_cost_f < old_cost_f:
			queue.put((new_cost_f, nxt)			)
			_lowercase :    Union[str, Any]							=							new_cost_f
			_lowercase :    Union[str, Any]							=							v
		if nxt in visited_backward:
			if cst_fwd[v] + d + cst_bwd[nxt] < shortest_distance:
				_lowercase :    Optional[int]							=							cst_fwd[v] + d + cst_bwd[nxt]
	return shortest_distance


def      __lowerCAmelCase(		__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			):






	"""simple docstring"""





	_lowercase :    Any							=							-1

	_lowercase :    Optional[int]							=							set()
	_lowercase :    List[Any]							=							set()
	_lowercase :    Union[str, Any]							=							{source: 0}
	_lowercase :    Any							=							{destination: 0}
	_lowercase :    Dict							=							{source: None}
	_lowercase :    Optional[int]							=							{destination: None}
	_lowercase :    PriorityQueue[Any]							=							PriorityQueue()
	_lowercase :    PriorityQueue[Any]							=							PriorityQueue()

	_lowercase :    Dict							=							np.inf

	queue_forward.put((0, source)			)
	queue_backward.put((0, destination)			)

	if source == destination:
		return 0

	while not queue_forward.empty() and not queue_backward.empty():
		_lowercase				,      _lowercase :    Optional[Any]							=							queue_forward.get()
		visited_forward.add(__UpperCAmelCase			)

		_lowercase				,      _lowercase :    Optional[Any]							=							queue_backward.get()
		visited_backward.add(__UpperCAmelCase			)

		_lowercase :    Any							=							pass_and_relaxation(
		    __UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,)

		_lowercase :    List[str]							=							pass_and_relaxation(
		    __UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,)

		if cst_fwd[v_fwd] + cst_bwd[v_bwd] >= shortest_distance:
			break

	if shortest_distance != np.inf:
		_lowercase :    Optional[Any]							=							shortest_distance
	return shortest_path_distance


SCREAMING_SNAKE_CASE									=						{
    'B': [['C', 1]],
    'C': [['D', 1]],
    'D': [['F', 1]],
    'E': [['B', 1], ['G', 2]],
    'F': [],
    'G': [['F', 1]],
}
SCREAMING_SNAKE_CASE									=						{
    'B': [['E', 1]],
    'C': [['B', 1]],
    'D': [['C', 1]],
    'F': [['D', 1], ['G', 1]],
    'E': [[None, np.inf]],
    'G': [['E', 2]],
}

if __name__ == "__main__":
						import doctest

						doctest.testmod()




"""simple docstring"""







from typing import Any


def      __lowerCAmelCase(		__UpperCAmelCase			):






	"""simple docstring"""





	if not input_list:
		return []
	_lowercase :    List[str]							=							[input_list.count(__UpperCAmelCase			) for value in input_list]
	_lowercase :    Optional[int]							=							max(__UpperCAmelCase			)  # Gets the maximum count in the input list.
	# Gets values of modes
	return sorted({input_list[i] for i, value in enumerate(__UpperCAmelCase			) if value == y}			)


if __name__ == "__main__":
						import doctest

						doctest.testmod()



