




from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_lowerCamelCase    				=		{
    'configuration_musicgen': [
        'MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'MusicgenConfig',
        'MusicgenDecoderConfig',
    ],
    'processing_musicgen': ['MusicgenProcessor'],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _lowerCamelCase    				=		[
     'MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST',
     'MusicgenForConditionalGeneration',
     'MusicgenForCausalLM',
     'MusicgenModel',
     'MusicgenPreTrainedModel',
 ]

if TYPE_CHECKING:
 from .configuration_musicgen import (
     MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP,
     MusicgenConfig,
     MusicgenDecoderConfig,
 )
 from .processing_musicgen import MusicgenProcessor

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_musicgen import (
      MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST,
      MusicgenForCausalLM,
      MusicgenForConditionalGeneration,
      MusicgenModel,
      MusicgenPreTrainedModel,
  )

else:
 import sys

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











_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   )						->							bool:
    return 0 <= row < rows and 0 <= col < cols




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		int ,  __UpperCamelCase    :		int ,  __UpperCamelCase    :		set ,  __UpperCamelCase    :		list[list[int]]   )						->							int:
    UpperCAmelCase_											=  len(__UpperCamelCase   )
    UpperCAmelCase_											=  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]]   )						->							int:
    UpperCAmelCase_											=  set()

    UpperCAmelCase_											=  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
                UpperCAmelCase_											=  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()





