





def   lowerCamelCase__       (       UpperCamelCase__     :    Union[str, Any]    ,      UpperCamelCase__     :    Optional[int]  )     ->	Dict:



					'''simple docstring'''




					return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2





def   lowerCamelCase__       (       UpperCamelCase__     :    Dict    ,      UpperCamelCase__     :    List[str]=0  )     ->	Any:



					'''simple docstring'''




					return sorted(UpperCamelCase__    ,      key=lambda UpperCamelCase__  : x[column]  )





def   lowerCamelCase__       (       UpperCamelCase__     :    str    ,      UpperCamelCase__     :    Any    ,      UpperCamelCase__     :    int=float('inf'  )  )     ->	Dict:



					'''simple docstring'''




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





def   lowerCamelCase__       (       UpperCamelCase__     :    Optional[Any]    ,      UpperCamelCase__     :    Dict    ,      UpperCamelCase__     :    Dict=float('inf'  )  )     ->	List[str]:



					'''simple docstring'''




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





def   lowerCamelCase__       (       UpperCamelCase__     :    Any    ,      UpperCamelCase__     :    int    ,      UpperCamelCase__     :    Tuple  )     ->	List[str]:



					'''simple docstring'''




					if points_counts <= 3:
										return dis_between_closest_pair(UpperCamelCase__    ,      UpperCamelCase__  )

					# recursion
					_snake_case													=			points_counts // 2
					_snake_case													=			closest_pair_of_points_sqr(
					    UpperCamelCase__    ,      points_sorted_on_y[:mid]    ,      UpperCamelCase__  )
					_snake_case													=			closest_pair_of_points_sqr(
					    UpperCamelCase__    ,      points_sorted_on_y[mid:]    ,      points_counts - mid  )
					_snake_case													=			min(UpperCamelCase__    ,      UpperCamelCase__  )
					_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(UpperCamelCase__  )

					_snake_case													=			dis_between_closest_in_strip(
					    UpperCamelCase__    ,      len(UpperCamelCase__  )    ,      UpperCamelCase__  )
					return min(UpperCamelCase__    ,      UpperCamelCase__  )





def   lowerCamelCase__       (       UpperCamelCase__     :    str    ,      UpperCamelCase__     :    Any  )     ->	Optional[Any]:



					'''simple docstring'''




					_snake_case													=			column_based_sort(UpperCamelCase__    ,      column=0  )
					_snake_case													=			column_based_sort(UpperCamelCase__    ,      column=1  )
					return (
					    closest_pair_of_points_sqr(
					        UpperCamelCase__    ,      UpperCamelCase__    ,      UpperCamelCase__  )
					) ** 0.5


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










from cva import destroyAllWindows, imread, imshow, waitKey





def   lowerCamelCase__       (       UpperCamelCase__     :    Dict  )     ->	Optional[Any]:



					'''simple docstring'''




					_snake_case							,       _snake_case													=			img.shape[0], img.shape[1]

					# converting each pixel's color to its negative
					for i in range(UpperCamelCase__  ):
										for j in range(UpperCamelCase__  ):
															_snake_case													=			[255, 255, 255] - img[i][j]

					return img


if __name__ == "__main__":
					# read original image
					UpperCAmelCase_ 							=       imread("""image_data/lena.jpg""", 1)

					# convert to its negative
					UpperCAmelCase_ 							=       convert_to_negative(img)

					# show result image
					imshow("""negative of original image""", img)
					waitKey(0)
					destroyAllWindows()



