



"""simple docstring"""






def     _lowercase       (						__snake_case      ,__snake_case			)		->     Optional[Any]:
			return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2


def     _lowercase       (						__snake_case      ,__snake_case=0			)		->     Optional[int]:
			return sorted(__snake_case      ,key=lambda __snake_case			: x[column]			)


def     _lowercase       (						__snake_case      ,__snake_case      ,__snake_case=float("inf"			)			)		->     Union[str, Any]:

			for i in range(points_counts - 1			):
						for j in range(i + 1      ,__snake_case			):
									__lowerCAmelCase   :						str				= euclidean_distance_sqr(points[i]      ,points[j]			)
									if current_dis < min_dis:
												__lowerCAmelCase   :						Union[str, Any]				= current_dis
			return min_dis


def     _lowercase       (						__snake_case      ,__snake_case      ,__snake_case=float("inf"			)			)		->     int:

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


def     _lowercase       (						__snake_case      ,__snake_case      ,__snake_case			)		->     Optional[Any]:

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

			# recursion
			__lowerCAmelCase   :						Union[str, Any]				= points_counts // 2
			__lowerCAmelCase   :						Tuple				= closest_pair_of_points_sqr(
			    __snake_case      ,points_sorted_on_y[:mid]      ,__snake_case			)
			__lowerCAmelCase   :						Tuple				= closest_pair_of_points_sqr(
			    __snake_case      ,points_sorted_on_y[mid:]      ,points_counts - mid			)
			__lowerCAmelCase   :						Any				= min(__snake_case      ,__snake_case			)
			__lowerCAmelCase   :						List[Any]				= []
			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			)

			__lowerCAmelCase   :						int				= dis_between_closest_in_strip(
			    __snake_case      ,len(__snake_case			)      ,__snake_case			)
			return min(__snake_case      ,__snake_case			)


def     _lowercase       (						__snake_case      ,__snake_case			)		->     Optional[Any]:
			__lowerCAmelCase   :						Any				= column_based_sort(__snake_case      ,column=0			)
			__lowerCAmelCase   :						List[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__":
	__snake_case							:     Tuple   =					[(2, 3), (12, 30), (40, 50), (5, 1), (12, 10), (3, 4)]
	print('Distance:', closest_pair_of_points(points, len(points)))




"""simple docstring"""






def     _lowercase       (						__snake_case      ,__snake_case			)		->     list:
			__lowerCAmelCase   :						List[str]				= len(__snake_case			)
			__lowerCAmelCase   :						Dict				= []
			for i in range(len(__snake_case			) - pat_len + 1			):
						__lowerCAmelCase   :						List[Any]				= True
						for j in range(__snake_case			):
									if s[i + j] != pattern[j]:
												__lowerCAmelCase   :						Union[str, Any]				= False
												break
						if match_found:
									position.append(__snake_case			)
			return position


if __name__ == "__main__":
	assert naive_pattern_search('ABCDEFG', 'DE') == [3]
	print(naive_pattern_search('ABAAABCDBBABCDDEBCABC', 'ABC'))