'''simple docstring'''

from typing import TypeVar

from .arrow_dataset import Dataset, _split_by_node_map_style_dataset
from .iterable_dataset import IterableDataset, _split_by_node_iterable_dataset


_A      :				Optional[int] 				=    TypeVar('''DatasetType''', Dataset, IterableDataset)







def 					UpperCamelCase_						( snake_case_	:	DatasetType						,		snake_case_	:	int						,		snake_case_	:	int				) ->					DatasetType:






 '''simple docstring'''

 if isinstance(snake_case_						,		snake_case_				):
  return _split_by_node_map_style_dataset(snake_case_						,		rank=snake_case_						,		world_size=snake_case_				)
 else:
  return _split_by_node_iterable_dataset(snake_case_						,		rank=snake_case_						,		world_size=snake_case_				)







'''simple docstring'''

def 					UpperCamelCase_						( snake_case_	:	int				) ->					int:






 '''simple docstring'''

 if number != int(snake_case_				):
  raise ValueError("""factorial() only accepts integral values"""				)
 if number < 0:
  raise ValueError("""factorial() not defined for negative values"""				)
 __lowerCAmelCase    							=						1
 for i in range(1						,		number + 1				):
  value *= i
 return value







def 					UpperCamelCase_						( snake_case_	:	int				) ->					int:






 '''simple docstring'''

 if not isinstance(snake_case_						,		snake_case_				):
  raise ValueError("""factorial() only accepts integral values"""				)
 if n < 0:
  raise ValueError("""factorial() not defined for negative values"""				)
 return 1 if n == 0 or n == 1 else n * factorial(n - 1				)


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 _A      :				List[Any] 				=    int(input('''Enter a positive integer: ''').strip() or 0)
 print(f'factorial{n} is {factorial(n)}')






