






"""simple docstring"""
def 			__UpperCamelCase	(		snake_case__   ,   snake_case__					):
	return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2






def 			__UpperCamelCase	(		snake_case__   ,   snake_case__=0					):
	return sorted(snake_case__   ,   key=lambda snake_case__					: x[column]					)






def 			__UpperCamelCase	(		snake_case__   ,   snake_case__   ,   snake_case__=float("""inf"""					)					):

	for i in range(points_counts - 1					):
		for j in range(i + 1   ,   snake_case__					):
			A_		:						Optional[int]	    =   euclidean_distance_sqr(points[i]   ,   points[j]					)
			if current_dis < min_dis:
				A_		:						Optional[Any]	    =   current_dis
	return min_dis






def 			__UpperCamelCase	(		snake_case__   ,   snake_case__   ,   snake_case__=float("""inf"""					)					):

	for i in range(min(6   ,   points_counts - 1					)   ,   snake_case__					):
		for j in range(max(0   ,   i - 6					)   ,   snake_case__					):
			A_		:						Optional[Any]	    =   euclidean_distance_sqr(points[i]   ,   points[j]					)
			if current_dis < min_dis:
				A_		:						str	    =   current_dis
	return min_dis






def 			__UpperCamelCase	(		snake_case__   ,   snake_case__   ,   snake_case__					):

	# base case
	if points_counts <= 3:
		return dis_between_closest_pair(snake_case__   ,   snake_case__					)

	# recursion
	A_		:						List[Any]	    =   points_counts // 2
	A_		:						List[Any]	    =   closest_pair_of_points_sqr(
	    snake_case__   ,   points_sorted_on_y[:mid]   ,   snake_case__					)
	A_		:						Optional[int]	    =   closest_pair_of_points_sqr(
	    snake_case__   ,   points_sorted_on_y[mid:]   ,   points_counts - mid					)
	A_		:						List[Any]	    =   min(snake_case__   ,   snake_case__					)
	A_		:						List[str]	    =   []
	for point in points_sorted_on_x:
		if abs(point[0] - points_sorted_on_x[mid][0]					) < closest_pair_dis:
			cross_strip.append(snake_case__					)

	A_		:						int	    =   dis_between_closest_in_strip(
	    snake_case__   ,   len(snake_case__					)   ,   snake_case__					)
	return min(snake_case__   ,   snake_case__					)






def 			__UpperCamelCase	(		snake_case__   ,   snake_case__					):
	A_		:						Dict	    =   column_based_sort(snake_case__   ,   column=0					)
	A_		:						Any	    =   column_based_sort(snake_case__   ,   column=1					)
	return (
	    closest_pair_of_points_sqr(
	        snake_case__   ,   snake_case__   ,   snake_case__					)
	) ** 0.5


if __name__ == "__main__":
							_lowerCAmelCase         =							[(2, 3), (12, 30), (40, 50), (5, 1), (12, 10), (3, 4)]
							print("Distance:", closest_pair_of_points(points, len(points)))









"""simple docstring"""
def 			__UpperCamelCase	(		snake_case__   ,   snake_case__   ,   snake_case__					):
	return not any(
	    neighbour == 1 and colored_vertices[i] == color
	    for i, neighbour in enumerate(snake_case__					)					)






def 			__UpperCamelCase	(		snake_case__   ,   snake_case__   ,   snake_case__   ,   snake_case__					):

	# Base Case
	if index == len(snake_case__					):
		return True

	# Recursive Step
	for i in range(snake_case__					):
		if valid_coloring(graph[index]   ,   snake_case__   ,   snake_case__					):
			# Color current vertex
			A_		:						Dict	    =   i
			# Validate coloring
			if util_color(snake_case__   ,   snake_case__   ,   snake_case__   ,   index + 1					):
				return True
			# Backtrack
			A_		:						Union[str, Any]	    =   -1
	return False






def 			__UpperCamelCase	(		snake_case__   ,   snake_case__					):
	A_		:						int	    =   [-1] * len(snake_case__					)

	if util_color(snake_case__   ,   snake_case__   ,   snake_case__   ,   0					):
		return colored_vertices

	return []

