


"""simple docstring"""


import importlib
import sys
from argparse import REMAINDER, ArgumentParser
from pathlib import Path

import torch_xla.distributed.xla_multiprocessing as xmp


def _lowerCamelCase			(	):

			'''simple docstring'''




			__lowerCAmelCase       					=    ArgumentParser(
			    description=(
			        "PyTorch TPU distributed training launch helper utility that will spawn up multiple distributed processes"
			    )   )

			# Optional arguments for the launch helper
			parser.add_argument("--num_cores"					,				type=_UpperCamelCase					,				default=1					,				help="Number of TPU cores to use (1 or 8)."   )

			# positional
			parser.add_argument(
			    "training_script"					,				type=_UpperCamelCase					,				help=(
			        "The full path to the single TPU training "
			        "program/script to be launched in parallel, "
			        "followed by all the arguments for the "
			        "training script"
			    )					,				)

			# rest from the training program
			parser.add_argument("training_script_args"					,				nargs=_UpperCamelCase   )

			return parser.parse_args()


def _lowerCamelCase			(	):

			'''simple docstring'''




			__lowerCAmelCase       					=    parse_args()

			# Import training_script as a module.
			__lowerCAmelCase       					=    Path(args.training_script   )
			sys.path.append(str(script_fpath.parent.resolve()   )   )
			__lowerCAmelCase       					=    script_fpath.stem
			__lowerCAmelCase       					=    importlib.import_module(_UpperCamelCase   )

			# Patch sys.argv
			__lowerCAmelCase       					=    [args.training_script] + args.training_script_args + ["--tpu_num_cores", str(args.num_cores   )]

			xmp.spawn(mod._mp_fn					,				args=()					,				nprocs=args.num_cores   )


if __name__ == "__main__":
	main()








"""simple docstring"""


from itertools import product


def _lowerCamelCase			(	_UpperCamelCase					,				_UpperCamelCase   ):

			'''simple docstring'''




			__lowerCAmelCase       					=    sides_number
			__lowerCAmelCase       					=    max_face_number * dice_number
			__lowerCAmelCase       					=    [0] * (max_total + 1)

			__lowerCAmelCase       					=    1
			__lowerCAmelCase       					=    range(_UpperCamelCase					,				max_face_number + 1   )
			for dice_numbers in product(_UpperCamelCase					,				repeat=_UpperCamelCase   ):
						__lowerCAmelCase       					=    sum(_UpperCamelCase   )
						totals_frequencies[total] += 1

			return totals_frequencies


def _lowerCamelCase			(	):

			'''simple docstring'''




			__lowerCAmelCase       					=    total_frequency_distribution(
			    sides_number=4					,				dice_number=9   )
			__lowerCAmelCase       					=    total_frequency_distribution(
			    sides_number=6					,				dice_number=6   )

			__lowerCAmelCase       					=    0
			__lowerCAmelCase       					=    9
			__lowerCAmelCase       					=    4 * 9
			__lowerCAmelCase       					=    6
			for peter_total in range(_UpperCamelCase					,				max_peter_total + 1   ):
						peter_wins_count += peter_totals_frequencies[peter_total] * sum(
						    colin_totals_frequencies[min_colin_total:peter_total]   )

			__lowerCAmelCase       					=    (4**9) * (6**6)
			__lowerCAmelCase       					=    peter_wins_count / total_games_number

			__lowerCAmelCase       					=    round(_UpperCamelCase					,				ndigits=7   )

			return rounded_peter_win_probability


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




