

import operator as op


lowerCAmelCase							:  Optional[int]            =						"""scaler.pt"""
lowerCAmelCase							:  Optional[Any]            =						"""pytorch_model"""
lowerCAmelCase							:  int            =						"""random_states"""
lowerCAmelCase							:  Union[str, Any]            =						"""optimizer"""
lowerCAmelCase							:  Optional[int]            =						"""scheduler"""
lowerCAmelCase							:  List[Any]            =						"""pytorch_model.bin"""
lowerCAmelCase							:  Tuple            =						"""pytorch_model.bin.index.json"""
lowerCAmelCase							:  List[str]            =						"""model.safetensors"""
lowerCAmelCase							:  Union[str, Any]            =						"""model.safetensors.index.json"""
lowerCAmelCase							:  Any            =						"""1.10.2"""
lowerCAmelCase							:  str            =						"""py38"""
lowerCAmelCase							:  Optional[int]            =						"""4.17.0"""
lowerCAmelCase							:  Optional[Any]            =						["""ml.p3.16xlarge""", """ml.p3dn.24xlarge""", """ml.p4dn.24xlarge"""]
lowerCAmelCase							:  int            =						["""FULL_SHARD""", """SHARD_GRAD_OP""", """NO_SHARD""", """HYBRID_SHARD""", """HYBRID_SHARD_ZERO2"""]
lowerCAmelCase							:  int            =						["""TRANSFORMER_BASED_WRAP""", """SIZE_BASED_WRAP""", """NO_WRAP"""]
lowerCAmelCase							:  str            =						["""BACKWARD_PRE""", """BACKWARD_POST""", """NO_PREFETCH"""]
lowerCAmelCase							:  List[str]            =						["""FULL_STATE_DICT""", """LOCAL_STATE_DICT""", """SHARDED_STATE_DICT"""]
lowerCAmelCase							:  Optional[Any]            =						"""2.0.1"""
lowerCAmelCase							:  Dict            =						["""pdsh""", """standard""", """openmpi""", """mvapich"""]
lowerCAmelCase							:  Union[str, Any]            =						["""default""", """reduce-overhead""", """max-autotune"""]

lowerCAmelCase							:  int            =						{""">""": op.gt, """>=""": op.ge, """==""": op.eq, """!=""": op.ne, """<=""": op.le, """<""": op.lt}

# These are the args for `torch.distributed.launch` for pytorch < 1.9
lowerCAmelCase							:  str            =						[
    """nnodes""",
    """nproc_per_node""",
    """rdzv_backend""",
    """rdzv_endpoint""",
    """rdzv_id""",
    """rdzv_conf""",
    """standalone""",
    """max_restarts""",
    """monitor_interval""",
    """start_method""",
    """role""",
    """module""",
    """m""",
    """no_python""",
    """run_path""",
    """log_dir""",
    """r""",
    """redirects""",
    """t""",
    """tee""",
    """node_rank""",
    """master_addr""",
    """master_port""",
]

lowerCAmelCase							:  Any            =						["""DEEPSPEED""", """MULTI_GPU""", """FSDP""", """MEGATRON_LM"""]
lowerCAmelCase							:  Any            =						["""DEEPSPEED""", """MULTI_XPU""", """FSDP"""]








import os

# Precomputes a list of the 100 first triangular numbers
lowerCAmelCase							:  Optional[int]            =						[int(0.5 * n * (n + 1)) for n in range(1, 101)]







def       A_				(   ):
						SCREAMING_SNAKE_CASE_:			List[str]  		=	os.path.dirname(os.path.realpath(_UpperCAmelCase   )   )
						SCREAMING_SNAKE_CASE_:			Union[str, Any]  		=	os.path.join(_UpperCAmelCase    ,     "words.txt"   )

						SCREAMING_SNAKE_CASE_:			Dict  		=	""
						with open(_UpperCAmelCase   ) as f:
												SCREAMING_SNAKE_CASE_:			int  		=	f.readline()

						SCREAMING_SNAKE_CASE_:			Optional[int]  		=	[word.strip("\""   ) for word in words.strip("\r\n"   ).split(","   )]
						SCREAMING_SNAKE_CASE_:			List[Any]  		=	[
						    word
						    for word in [sum(ord(_UpperCAmelCase   ) - 64 for x in word   ) for word in words]
						    if word in TRIANGULAR_NUMBERS
						]
						return len(_UpperCAmelCase   )


if __name__ == "__main__":
						print(solution())






