





_lowerCamelCase       =	[
    [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
]






def  SCREAMING_SNAKE_CASE__							(				UpperCamelCase__:							int    ,      UpperCamelCase__:							int    ,      UpperCamelCase__:							int    ,      UpperCamelCase__:							int			):
		return 0 <= row < rows and 0 <= col < cols






def  SCREAMING_SNAKE_CASE__							(				UpperCamelCase__:							int    ,      UpperCamelCase__:							int    ,      UpperCamelCase__:							set    ,      UpperCamelCase__:							list[list[int]]			):
		SCREAMING_SNAKE_CASE__								=					len(UpperCamelCase__			)
		SCREAMING_SNAKE_CASE__								=					len(mat[0]			)
		if is_safe(UpperCamelCase__    ,      UpperCamelCase__    ,      UpperCamelCase__    ,      UpperCamelCase__			) and (row, col) not in seen and mat[row][col] == 1:
				seen.add((row, col)			)
				return (
				    1
				    + depth_first_search(row + 1    ,      UpperCamelCase__    ,      UpperCamelCase__    ,      UpperCamelCase__			)
				    + depth_first_search(row - 1    ,      UpperCamelCase__    ,      UpperCamelCase__    ,      UpperCamelCase__			)
				    + depth_first_search(UpperCamelCase__    ,      col + 1    ,      UpperCamelCase__    ,      UpperCamelCase__			)
				    + depth_first_search(UpperCamelCase__    ,      col - 1    ,      UpperCamelCase__    ,      UpperCamelCase__			)
				)
		else:
				return 0






def  SCREAMING_SNAKE_CASE__							(				UpperCamelCase__:							list[list[int]]			):
		SCREAMING_SNAKE_CASE__								=					set()

		SCREAMING_SNAKE_CASE__								=					0
		for row, line in enumerate(UpperCamelCase__			):
				for col, item in enumerate(UpperCamelCase__			):
						if item == 1 and (row, col) not in seen:
								# Maximizing the area
								SCREAMING_SNAKE_CASE__								=					max(UpperCamelCase__    ,      depth_first_search(UpperCamelCase__    ,      UpperCamelCase__    ,      UpperCamelCase__    ,      UpperCamelCase__			)			)
		return max_area


if __name__ == "__main__":
	import doctest

	print(find_max_area(matrix))  # Output -> 6
	doctest.testmod()






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
)


_lowerCamelCase       =	{
    'configuration_gptsan_japanese': ['GPTSAN_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTSanJapaneseConfig'],
    'tokenization_gptsan_japanese': ['GPTSanJapaneseTokenizer'],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_lowerCamelCase       =	[
	    'GPTSAN_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'GPTSanJapaneseForConditionalGeneration',
	    'GPTSanJapaneseModel',
	    'GPTSanJapanesePreTrainedModel',
	]
	_lowerCamelCase       =	[
	    'GPTSanJapaneseTokenizer',
	]


if TYPE_CHECKING:
	from .configuration_gptsan_japanese import GPTSAN_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTSanJapaneseConfig
	from .tokenization_gptsan_japanese import GPTSanJapaneseTokenizer

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_gptsan_japanese import (
		    GPTSAN_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST,
		    GPTSanJapaneseForConditionalGeneration,
		    GPTSanJapaneseModel,
		    GPTSanJapanesePreTrainedModel,
		)
		from .tokenization_gptsan_japanese import GPTSanJapaneseTokenizer


else:
	import sys

	_lowerCamelCase       =	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)