



'''simple docstring'''






from __future__ import annotations

from typing import Generic, TypeVar

A_							: Union[str, Any]						 =	TypeVar("""T""")



class 							lowercase       (  Generic[T]				):


 """simple docstring"""


 def __init__(							self  ,a_							)		->   None:
        _UpperCAmelCase  :						str			     = data
        _UpperCAmelCase  :						List[str]			     = self
        _UpperCAmelCase  :						Optional[Any]			     = 0







class 							lowercase       (  Generic[T]				):


 """simple docstring"""


 def __init__(							self							)		->   None:
        # map from node name to the node object
        _UpperCAmelCase  :						dict[T, DisjointSetTreeNode[T]]			     = {}







 def _snake_case (							self  ,a_							)		->   None:
        # create a new set with x as its member
        _UpperCAmelCase  :						Tuple			     = DisjointSetTreeNode(a_							)







 def _snake_case (							self  ,a_							)		->   DisjointSetTreeNode[T]:
        # find the set x belongs to (with path-compression)
        _UpperCAmelCase  :						str			     = self.map[data]
        if elem_ref != elem_ref.parent:
               _UpperCAmelCase  :						Tuple			     = self.find_set(elem_ref.parent.data							)
        return elem_ref.parent







 def _snake_case (							self  ,a_  ,a_							)		->   None:
        # helper function for union operation
        if nodea.rank > nodea.rank:
               _UpperCAmelCase  :						str			     = nodea
        else:
               _UpperCAmelCase  :						str			     = nodea
               if nodea.rank == nodea.rank:
                      nodea.rank += 1







 def _snake_case (							self  ,a_  ,a_							)		->   None:
        # merge 2 disjoint sets
        self.link(self.find_set(a_							)  ,self.find_set(a_							)							)







class 							lowercase       (  Generic[T]				):


 """simple docstring"""


 def __init__(							self							)		->   None:
        # connections: map from the node to the neighbouring nodes (with weights)
        _UpperCAmelCase  :						dict[T, dict[T, int]]			     = {}







 def _snake_case (							self  ,a_							)		->   None:
        # add a node ONLY if its not present in the graph
        if node not in self.connections:
               _UpperCAmelCase  :						str			     = {}







 def _snake_case (							self  ,a_  ,a_  ,a_							)		->   None:
        # add an edge with the given weight
        self.add_node(a_							)
        self.add_node(a_							)
        _UpperCAmelCase  :						Optional[int]			     = weight
        _UpperCAmelCase  :						str			     = weight







 def _snake_case (							self							)		->   GraphUndirectedWeighted[T]:
        _UpperCAmelCase  :						List[Any]			     = []
        _UpperCAmelCase  :						Tuple			     = set()
        for start in self.connections:
               for end in self.connections[start]:
                      if (start, end) not in seen:
                             seen.add((end, start)							)
                             edges.append((start, end, self.connections[start][end])							)
        edges.sort(key=lambda a_							: x[2]							)

        # creating the disjoint set
        _UpperCAmelCase  :						List[str]			     = DisjointSetTree[T]()
        for node in self.connections:
               disjoint_set.make_set(a_							)

        # MST generation
        _UpperCAmelCase  :						Tuple			     = 0
        _UpperCAmelCase  :						List[Any]			     = 0
        _UpperCAmelCase  :						List[str]			     = GraphUndirectedWeighted[T]()
        while num_edges < len(self.connections							) - 1:
               _UpperCAmelCase     ,_UpperCAmelCase     ,_UpperCAmelCase  :						Any			     = edges[index]
               index += 1
               _UpperCAmelCase  :						Optional[int]			     = disjoint_set.find_set(a_							)
               _UpperCAmelCase  :						List[str]			     = disjoint_set.find_set(a_							)
               if parent_u != parent_v:
                      num_edges += 1
                      graph.add_edge(a_  ,a_  ,a_							)
                      disjoint_set.union(a_  ,a_							)
        return graph








'''simple docstring'''






from __future__ import annotations

import typing
from collections import Counter




def     snake_case_					(     lowerCAmelCase_		)->		typing.Counter[int]:





       '''simple docstring'''


       _UpperCAmelCase  :						typing.Counter[int]			     = Counter()
       for base in range(1       ,   max_perimeter + 1		):
              for perpendicular in range(lowerCAmelCase_       ,   max_perimeter + 1		):
                     _UpperCAmelCase  :						List[str]			     = (base * base + perpendicular * perpendicular) ** 0.5
                     if hypotenuse == int(lowerCAmelCase_		):
                            _UpperCAmelCase  :						Optional[Any]			     = int(base + perpendicular + hypotenuse		)
                            if perimeter > max_perimeter:
                                   continue
                            triplets[perimeter] += 1
       return triplets




def     snake_case_					(     lowerCAmelCase_ = 1000		)->		int:





       '''simple docstring'''


       _UpperCAmelCase  :						int			     = pythagorean_triple(lowerCAmelCase_		)
       return triplets.most_common(1		)[0][0]


if __name__ == "__main__":
   print(f"""Perimeter {solution()} has maximum solutions""")



