


import os
from argparse import ArgumentParser
from typing import List

import torch.utils.data

from datasets import Dataset, IterableDataset
from datasets.distributed import split_dataset_by_node


UpperCAmelCase_      : Optional[int]  					=       4
UpperCAmelCase_      : Dict  					=       3
class  SCREAMING_SNAKE_CASE__  (				lowercase__			):
      pass







def        SCREAMING_SNAKE_CASE_						(			__A :			List[str]				)	->		Union[str, Any]:

       """simple docstring"""

       for shard in shards:
              for i in range(__A				):
                     yield {"i": i, "shard": shard}







def        SCREAMING_SNAKE_CASE_						(			)	->		Optional[Any]:

       """simple docstring"""

       a_					:		List[str]							=  int(os.environ['RANK']				)
       a_					:		List[str]							=  int(os.environ['WORLD_SIZE']				)

       a_					:		List[Any]							=  ArgumentParser()
       parser.add_argument('--streaming'  ,    type=__A				)
       parser.add_argument('--local_rank'  ,    type=__A				)
       parser.add_argument('--num_workers'  ,    type=__A  ,    default=0				)
       a_					:		Any							=  parser.parse_args()
       a_					:		Tuple							=  args.streaming
       a_					:		str							=  args.num_workers

       a_					:		Union[str, Any]							=  {'shards': [F"""shard_{shard_idx}""" for shard_idx in range(__A				)]}
       a_					:		List[str]							=  IterableDataset.from_generator(__A  ,    gen_kwargs=__A				)
       if not streaming:
              a_					:		Union[str, Any]							=  Dataset.from_list(list(__A				)				)

       a_					:		Tuple							=  split_dataset_by_node(__A  ,    rank=__A  ,    world_size=__A				)
       a_					:		Optional[Any]							=  torch.utils.data.DataLoader(__A  ,    num_workers=__A				)

       a_					:		Any							=  NUM_SHARDS * NUM_ITEMS_PER_SHARD
       a_					:		str							=  full_size // world_size
       expected_local_size += int(rank < (full_size % world_size)				)

       a_					:		Optional[Any]							=  sum(1 for _ in dataloader				)
       if local_size != expected_local_size:
              raise FailedTestError(F"""local_size {local_size} != expected_local_size {expected_local_size}"""				)


if __name__ == "__main__":
   main()








def __UpperCamelCase			(       _A = 1000000  ):
						lowerCAmelCase_      			=  1
						lowerCAmelCase_      			=  1
						lowerCAmelCase_      			=  {1: 1}

						for inputa in range(2 ,  _A  ):
												lowerCAmelCase_      			=  0
												lowerCAmelCase_      			=  inputa

												while True:
																		if number in counters:
																								counter += counters[number]
																								break
																		if number % 2 == 0:
																								number //= 2
																								counter += 1
																		else:
																								lowerCAmelCase_      			=  (3 * number) + 1
																								counter += 1

												if inputa not in counters:
																		lowerCAmelCase_      			=  counter

												if counter > pre_counter:
																		lowerCAmelCase_      			=  inputa
																		lowerCAmelCase_      			=  counter
						return largest_number


if __name__ == "__main__":
						print(solution(int(input().strip())))




