


"""simple docstring"""




from __future__ import annotations

from typing import Generic, TypeVar

lowercase_			     =  TypeVar("T")
class 					__lowerCAmelCase					(   Generic[T]       ):


		'''simple docstring'''



		def __init__(  self							, _a      ):
				__a           =			data
				__a           =			self
				__a           =			0







class 					__lowerCAmelCase					(   Generic[T]       ):


		'''simple docstring'''



		def __init__(  self      ):
				# map from node name to the node object
				__a           =			{}

		def 			__UpperCAmelCase       (  self							, _a      ):
				# create a new set with x as its member
				__a           =			DisjointSetTreeNode(a_      )

		def 			__UpperCAmelCase       (  self							, _a      ):
				# find the set x belongs to (with path-compression)
				__a           =			self.map[data]
				if elem_ref != elem_ref.parent:
						__a           =			self.find_set(elem_ref.parent.data      )
				return elem_ref.parent

		def 			__UpperCAmelCase       (  self							, _a							, _a      ):
				# helper function for union operation
				if nodea.rank > nodea.rank:
						__a           =			nodea
				else:
						__a           =			nodea
						if nodea.rank == nodea.rank:
								nodea.rank += 1





		def 			__UpperCAmelCase       (  self							, _a							, _a      ):
				# merge 2 disjoint sets
				self.link(self.find_set(a_      )							, self.find_set(a_      )      )







class 					__lowerCAmelCase					(   Generic[T]       ):


		'''simple docstring'''



		def __init__(  self      ):
				# connections: map from the node to the neighbouring nodes (with weights)
				__a           =			{}

		def 			__UpperCAmelCase       (  self							, _a      ):
				# add a node ONLY if its not present in the graph
				if node not in self.connections:
						__a           =			{}

		def 			__UpperCAmelCase       (  self							, _a							, _a							, _a      ):
				# add an edge with the given weight
				self.add_node(a_      )
				self.add_node(a_      )
				__a           =			weight
				__a           =			weight





		def 			__UpperCAmelCase       (  self      ):
				__a           =			[]
				__a           =			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
				__a           =			DisjointSetTree[T]()
				for node in self.connections:
						disjoint_set.make_set(a_      )

				# MST generation
				__a           =			0
				__a           =			0
				__a           =			GraphUndirectedWeighted[T]()
				while num_edges < len(self.connections      ) - 1:
						__a           =			edges[index]
						index += 1
						__a           =			disjoint_set.find_set(a_      )
						__a           =			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""")



