



"""simple docstring"""


def  lowercase	(      _SCREAMING_SNAKE_CASE   :						list[list[int]]					,     _SCREAMING_SNAKE_CASE   :						int					,     _SCREAMING_SNAKE_CASE   :						int					,     _SCREAMING_SNAKE_CASE   :						set				):






				'''simple docstring'''



				_UpperCAmelCase		,						_UpperCAmelCase					=    len(_SCREAMING_SNAKE_CASE				), len(grid[0]				)
				if (
				    min(_SCREAMING_SNAKE_CASE					,     _SCREAMING_SNAKE_CASE				) < 0
				    or row == row_length
				    or col == col_length
				    or (row, col) in visit
				    or grid[row][col] == 1
				):
								return 0
				if row == row_length - 1 and col == col_length - 1:
								return 1

				visit.add((row, col)				)

				_UpperCAmelCase					=    0
				count += depth_first_search(_SCREAMING_SNAKE_CASE					,     row + 1					,     _SCREAMING_SNAKE_CASE					,     _SCREAMING_SNAKE_CASE				)
				count += depth_first_search(_SCREAMING_SNAKE_CASE					,     row - 1					,     _SCREAMING_SNAKE_CASE					,     _SCREAMING_SNAKE_CASE				)
				count += depth_first_search(_SCREAMING_SNAKE_CASE					,     _SCREAMING_SNAKE_CASE					,     col + 1					,     _SCREAMING_SNAKE_CASE				)
				count += depth_first_search(_SCREAMING_SNAKE_CASE					,     _SCREAMING_SNAKE_CASE					,     col - 1					,     _SCREAMING_SNAKE_CASE				)

				visit.remove((row, col)				)
				return count


if __name__ == "__main__":
					import doctest

					doctest.testmod()








"""simple docstring"""


from typing import Optional

from .. import Features, NamedSplit
from ..packaged_modules.text.text import Text
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc import AbstractDatasetReader
class 			_a (					lowerCAmelCase):
			"""simple docstring"""



			def __init__(		self     :    List[str]				,   __UpperCamelCase     :    NestedDataStructureLike[PathLike]				,   __UpperCamelCase     :    Optional[NamedSplit] = None				,   __UpperCamelCase     :    Optional[Features] = None				,   __UpperCamelCase     :    str = None				,   __UpperCamelCase     :    bool = False				,   __UpperCamelCase     :    bool = False				,   __UpperCamelCase     :    Optional[int] = None				,   **__UpperCamelCase     :    Optional[Any]				,   )->Any:
							super().__init__(
							    __UpperCamelCase				,   split=__UpperCamelCase				,   features=__UpperCamelCase				,   cache_dir=__UpperCamelCase				,   keep_in_memory=__UpperCamelCase				,   streaming=__UpperCamelCase				,   num_proc=__UpperCamelCase				,   **__UpperCamelCase				,   )
							_UpperCAmelCase					=    path_or_paths if isinstance(__UpperCamelCase				,   __UpperCamelCase   ) else {self.split: path_or_paths}
							_UpperCAmelCase					=    Text(
							    cache_dir=__UpperCamelCase				,   data_files=__UpperCamelCase				,   features=__UpperCamelCase				,   **__UpperCamelCase				,   )



			def  lowercase__						(		self     :    Optional[Any]   )->str:
							# Build iterable dataset
							if self.streaming:
											_UpperCAmelCase					=    self.builder.as_streaming_dataset(split=self.split   )
							# Build regular (map-style) dataset
							else:
											_UpperCAmelCase					=    None
											_UpperCAmelCase					=    None
											_UpperCAmelCase					=    None
											_UpperCAmelCase					=    None

											self.builder.download_and_prepare(
											    download_config=__UpperCamelCase				,   download_mode=__UpperCamelCase				,   verification_mode=__UpperCamelCase				,   base_path=__UpperCamelCase				,   num_proc=self.num_proc				,   )
											_UpperCAmelCase					=    self.builder.as_dataset(
											    split=self.split				,   verification_mode=__UpperCamelCase				,   in_memory=self.keep_in_memory   )
							return dataset



