





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


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase=0				)    ->  Optional[int]:
    return sorted(__a		,			key=lambda _UpperCAmelCase				: x[column]				)


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase		,			_UpperCAmelCase=float('inf'				)				)    ->  Optional[Any]:




    for i in range(points_counts - 1				):
        for j in range(i + 1		,			__a				):
            lowerCamelCase__					:   Dict      				=	euclidean_distance_sqr(points[i]		,			points[j]				)
            if current_dis < min_dis:
                lowerCamelCase__					:   Any      				=	current_dis
    return min_dis


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase		,			_UpperCAmelCase=float('inf'				)				)    ->  Any:




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


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase		,			_UpperCAmelCase				)    ->  Union[str, Any]:




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

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

    lowerCamelCase__					:   Optional[Any]      				=	dis_between_closest_in_strip(
        __a		,			len(__a				)		,			__a				)
    return min(__a		,			__a				)


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase				)    ->  List[str]:
    lowerCamelCase__					:   Any      				=	column_based_sort(__a		,			column=0				)
    lowerCamelCase__					:   Optional[int]      				=	column_based_sort(__a		,			column=1				)
    return (
        closest_pair_of_points_sqr(
            __a		,			__a		,			__a				)
    ) ** 0.5


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












from collections import defaultdict
from math import ceil, sqrt


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase = 100_0000		,			_UpperCAmelCase = 10				)    ->  int:
    lowerCamelCase__					:   defaultdict      				=	defaultdict(_UpperCAmelCase				)

    for outer_width in range(3		,			(t_limit // 4) + 2				):
        if outer_width * outer_width > t_limit:
            lowerCamelCase__					:   List[str]      				=	max(
                ceil(sqrt(outer_width * outer_width - t_limit				)				)		,			1				)
        else:
            lowerCamelCase__					:   int      				=	1

        hole_width_lower_bound += (outer_width - hole_width_lower_bound) % 2

        for hole_width in range(_UpperCAmelCase		,			outer_width - 1		,			2				):
            count[outer_width * outer_width - hole_width * hole_width] += 1

    return sum(1 for n in count.values() if 1 <= n <= 10				)


if __name__ == "__main__":
    print(F"""{solution() = }""")





