


"""simple docstring"""






def __lowercase     (      lowerCamelCase_  :      Tuple						,					lowerCamelCase_  :      Dict  ):
				return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2


def __lowercase     (      lowerCamelCase_  :      Optional[int]						,					lowerCamelCase_  :      str=0  ):
				return sorted(lowerCamelCase_						,					key=lambda lowerCamelCase_  : x[column]  )


def __lowercase     (      lowerCamelCase_  :      Tuple						,					lowerCamelCase_  :      str						,					lowerCamelCase_  :      List[str]=float("inf"  )  ):

				for i in range(points_counts - 1  ):
								for j in range(i + 1						,					lowerCamelCase_  ):
												SCREAMING_SNAKE_CASE__     							=				euclidean_distance_sqr(points[i]						,					points[j]  )
												if current_dis < min_dis:
																SCREAMING_SNAKE_CASE__     							=				current_dis
				return min_dis


def __lowercase     (      lowerCamelCase_  :      int						,					lowerCamelCase_  :      List[Any]						,					lowerCamelCase_  :      Optional[Any]=float("inf"  )  ):

				for i in range(min(6						,					points_counts - 1  )						,					lowerCamelCase_  ):
								for j in range(max(0						,					i - 6  )						,					lowerCamelCase_  ):
												SCREAMING_SNAKE_CASE__     							=				euclidean_distance_sqr(points[i]						,					points[j]  )
												if current_dis < min_dis:
																SCREAMING_SNAKE_CASE__     							=				current_dis
				return min_dis


def __lowercase     (      lowerCamelCase_  :      Union[str, Any]						,					lowerCamelCase_  :      int						,					lowerCamelCase_  :      str  ):

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

				# recursion
				SCREAMING_SNAKE_CASE__     							=				points_counts // 2
				SCREAMING_SNAKE_CASE__     							=				closest_pair_of_points_sqr(
				    lowerCamelCase_						,					points_sorted_on_y[:mid]						,					lowerCamelCase_  )
				SCREAMING_SNAKE_CASE__     							=				closest_pair_of_points_sqr(
				    lowerCamelCase_						,					points_sorted_on_y[mid:]						,					points_counts - mid  )
				SCREAMING_SNAKE_CASE__     							=				min(lowerCamelCase_						,					lowerCamelCase_  )
				SCREAMING_SNAKE_CASE__     							=				[]
				for point in points_sorted_on_x:
								if abs(point[0] - points_sorted_on_x[mid][0]  ) < closest_pair_dis:
												cross_strip.append(lowerCamelCase_  )

				SCREAMING_SNAKE_CASE__     							=				dis_between_closest_in_strip(
				    lowerCamelCase_						,					len(lowerCamelCase_  )						,					lowerCamelCase_  )
				return min(lowerCamelCase_						,					lowerCamelCase_  )


def __lowercase     (      lowerCamelCase_  :      Optional[Any]						,					lowerCamelCase_  :      Tuple  ):
				SCREAMING_SNAKE_CASE__     							=				column_based_sort(lowerCamelCase_						,					column=0  )
				SCREAMING_SNAKE_CASE__     							=				column_based_sort(lowerCamelCase_						,					column=1  )
				return (
				    closest_pair_of_points_sqr(
				        lowerCamelCase_						,					lowerCamelCase_						,					lowerCamelCase_  )
				) ** 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"""






import json
from typing import Iterator, List, Union

from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers
from tokenizers.implementations.base_tokenizer import BaseTokenizer
from tokenizers.models import Unigram
from tokenizers.processors import TemplateProcessing


class 			lowerCamelCase_		(			lowercase   ):





				"""simple docstring"""







				def __init__(						self       ,		UpperCAmelCase__ = "▁"       ,		UpperCAmelCase__ = True       ,		UpperCAmelCase__ = "<unk>"       ,		UpperCAmelCase__ = "</s>"       ,		UpperCAmelCase__ = "<pad>"       ,		):
								SCREAMING_SNAKE_CASE__     							=				{
								    "pad": {"id": 0, "token": pad_token},
								    "eos": {"id": 1, "token": eos_token},
								    "unk": {"id": 2, "token": unk_token},
								}

								SCREAMING_SNAKE_CASE__     							=				[None] * len(self.special_tokens     )
								for token_dict in self.special_tokens.values():
												SCREAMING_SNAKE_CASE__     							=				token_dict["token"]

								SCREAMING_SNAKE_CASE__     							=				Tokenizer(Unigram()     )

								SCREAMING_SNAKE_CASE__     							=				normalizers.Sequence(
								    [
								        normalizers.Nmt(),
								        normalizers.NFKC(),
								        normalizers.Replace(Regex(" {2,}"     )       ,		" "     ),
								        normalizers.Lowercase(),
								    ]     )
								SCREAMING_SNAKE_CASE__     							=				pre_tokenizers.Sequence(
								    [
								        pre_tokenizers.Metaspace(replacement=UpperCAmelCase__       ,		add_prefix_space=UpperCAmelCase__     ),
								        pre_tokenizers.Digits(individual_digits=UpperCAmelCase__     ),
								        pre_tokenizers.Punctuation(),
								    ]     )
								SCREAMING_SNAKE_CASE__     							=				decoders.Metaspace(replacement=UpperCAmelCase__       ,		add_prefix_space=UpperCAmelCase__     )

								SCREAMING_SNAKE_CASE__     							=				TemplateProcessing(
								    single=f'''$A {self.special_tokens["eos"]["token"]}'''       ,		special_tokens=[(self.special_tokens["eos"]["token"], self.special_tokens["eos"]["id"])]       ,		)

								SCREAMING_SNAKE_CASE__     							=				{
								    "model": "SentencePieceUnigram",
								    "replacement": replacement,
								    "add_prefix_space": add_prefix_space,
								}

								super().__init__(UpperCAmelCase__       ,		UpperCAmelCase__     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__ = 8000       ,		UpperCAmelCase__ = True       ,		):
								SCREAMING_SNAKE_CASE__     							=				trainers.UnigramTrainer(
								    vocab_size=UpperCAmelCase__       ,		special_tokens=self.special_tokens_list       ,		show_progress=UpperCAmelCase__       ,		)

								if isinstance(UpperCAmelCase__       ,		UpperCAmelCase__     ):
												SCREAMING_SNAKE_CASE__     							=				[files]
								self._tokenizer.train(UpperCAmelCase__       ,		trainer=UpperCAmelCase__     )

								self.add_unk_id()



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__ = 8000       ,		UpperCAmelCase__ = True       ,		):
								SCREAMING_SNAKE_CASE__     							=				trainers.UnigramTrainer(
								    vocab_size=UpperCAmelCase__       ,		special_tokens=self.special_tokens_list       ,		show_progress=UpperCAmelCase__       ,		)

								self._tokenizer.train_from_iterator(UpperCAmelCase__       ,		trainer=UpperCAmelCase__     )

								self.add_unk_id()






				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				json.loads(self._tokenizer.to_str()     )

								SCREAMING_SNAKE_CASE__     							=				self.special_tokens["unk"]["id"]

								SCREAMING_SNAKE_CASE__     							=				Tokenizer.from_str(json.dumps(UpperCAmelCase__     )     )
