





"""simple docstring"""





class    _lowerCAmelCase  :  # Public class to implement a graph
       """simple docstring"""




       def __init__(       self       ,					__UpperCAmelCase       ,					__UpperCAmelCase       ,					__UpperCAmelCase ):



         '''simple docstring'''

         lowerCAmelCase__     :Optional[int]											=				row
         lowerCAmelCase__     :Optional[int]											=				col
         lowerCAmelCase__     :int											=				graph






       def 	snake_case		(       self       ,					__UpperCAmelCase       ,					__UpperCAmelCase       ,					__UpperCAmelCase ):



         '''simple docstring'''

         return (
             0 <= i < self.ROW
             and 0 <= j < self.COL
             and not visited[i][j]
             and self.graph[i][j]
         )






       def 	snake_case		(       self       ,					__UpperCAmelCase       ,					__UpperCAmelCase       ,					__UpperCAmelCase ):



         '''simple docstring'''

         lowerCAmelCase__     :int											=				[-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
         lowerCAmelCase__     :Tuple											=				[-1, 0, 1, -1, 1, -1, 0, 1]
         lowerCAmelCase__     :Dict											=				True  # Make those cells visited
         for k in range(8 ):
           if self.is_safe(i + row_nbr[k]       ,					j + col_nbr[k]       ,					__UpperCAmelCase ):
             self.diffs(i + row_nbr[k]       ,					j + col_nbr[k]       ,					__UpperCAmelCase )






       def 	snake_case		(       self ):  # And finally, count all islands.



         '''simple docstring'''

         lowerCAmelCase__     :Optional[int]											=				[[False for j in range(self.COL )] for i in range(self.ROW )]
         lowerCAmelCase__     :Union[str, Any]											=				0
         for i in range(self.ROW ):
           for j in range(self.COL ):
             if visited[i][j] is False and self.graph[i][j] == 1:
               self.diffs(__UpperCAmelCase       ,					__UpperCAmelCase       ,					__UpperCAmelCase )
               count += 1
         return count

"""simple docstring"""


from .imports import is_rich_available


if is_rich_available():
	from rich.traceback import install

	install(show_locals=False)

else:
	raise ModuleNotFoundError('To use the rich extension, install rich with `pip install rich`')


