





'''simple docstring'''




import pytest

from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs
@pytest.mark.parametrize(
    "kwargs, expected"			,     [
        ({"num_shards": 0, "max_num_jobs": 1}, []),
        ({"num_shards": 10, "max_num_jobs": 1}, [range(10       )]),
        ({"num_shards": 10, "max_num_jobs": 10}, [range(__lowercase			,     i + 1       ) for i in range(10       )]),
        ({"num_shards": 1, "max_num_jobs": 10}, [range(1       )]),
        ({"num_shards": 10, "max_num_jobs": 3}, [range(0			,     4       ), range(4			,     7       ), range(7			,     10       )]),
        ({"num_shards": 3, "max_num_jobs": 10}, [range(0			,     1       ), range(1			,     2       ), range(2			,     3       )]),
    ]			,     )
def 	UpperCAmelCase_							(					__lowercase							:      int			,     __lowercase							:      Dict       )		->       List[Any]:


     '''simple docstring'''



     _UpperCAmelCase     							=   _distribute_shards(**__lowercase       )
     assert out == expected
@pytest.mark.parametrize(
    "gen_kwargs, max_num_jobs, expected"			,     [
        ({"foo": 0}, 10, [{"foo": 0}]),
        ({"shards": [0, 1, 2, 3]}, 1, [{"shards": [0, 1, 2, 3]}]),
        ({"shards": [0, 1, 2, 3]}, 4, [{"shards": [0]}, {"shards": [1]}, {"shards": [2]}, {"shards": [3]}]),
        ({"shards": [0, 1]}, 4, [{"shards": [0]}, {"shards": [1]}]),
        ({"shards": [0, 1, 2, 3]}, 2, [{"shards": [0, 1]}, {"shards": [2, 3]}]),
    ]			,     )
def 	UpperCAmelCase_							(					__lowercase							:      Dict			,     __lowercase							:      Optional[Any]			,     __lowercase							:      int       )		->       str:


     '''simple docstring'''



     _UpperCAmelCase     							=   _split_gen_kwargs(__lowercase			,     __lowercase       )
     assert out == expected






@pytest.mark.parametrize(
    "gen_kwargs, expected"			,     [
        ({"foo": 0}, 1),
        ({"shards": [0]}, 1),
        ({"shards": [0, 1, 2, 3]}, 4),
        ({"shards": [0, 1, 2, 3], "foo": 0}, 4),
        ({"shards": [0, 1, 2, 3], "other": (0, 1)}, 4),
        ({"shards": [0, 1, 2, 3], "shards2": [0, 1]}, RuntimeError),
    ]			,     )
def 	UpperCAmelCase_							(					__lowercase							:      Optional[Any]			,     __lowercase							:      List[Any]       )		->       List[Any]:


     '''simple docstring'''



     if expected is RuntimeError:
          with pytest.raises(__lowercase       ):
               _number_of_shards_in_gen_kwargs(__lowercase       )
     else:
          _UpperCAmelCase     							=   _number_of_shards_in_gen_kwargs(__lowercase       )
          assert out == expected











def 		A_				(     _lowerCAmelCase = 50     )						-> int:
 UpperCamelCase	:					List[Any]       	=   [[0] * 3 for _ in range(length + 1     )]

 for row_length in range(length + 1     ):
  for tile_length in range(2							,   5     ):
   for tile_start in range(row_length - tile_length + 1     ):
    different_colour_ways_number[row_length][tile_length - 2] += (
        different_colour_ways_number[row_length - tile_start - tile_length][
            tile_length - 2
        ]
        + 1
    )

 return sum(different_colour_ways_number[length]     )


if __name__ == "__main__":
    print(f"""{solution() = }""")
