





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

import torch_xla.distributed.xla_multiprocessing as xmp


def  SCREAMING_SNAKE_CASE   ( )    ->  Any:
    lowerCamelCase__					:   List[Any]      				=	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  SCREAMING_SNAKE_CASE   ( )    ->  Tuple:
    lowerCamelCase__					:   Union[str, Any]      				=	parse_args()

    # Import training_script as a module.
    lowerCamelCase__					:   Dict      				=	Path(args.training_script				)
    sys.path.append(str(script_fpath.parent.resolve()				)				)
    lowerCamelCase__					:   List[str]      				=	script_fpath.stem
    lowerCamelCase__					:   Optional[int]      				=	importlib.import_module(_UpperCAmelCase				)

    # Patch sys.argv
    lowerCamelCase__					:   int      				=	[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()












from collections import defaultdict
from math import ceil, sqrt


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase = 100_0000		,			_UpperCAmelCase = 10				)    ->  int:
    lowerCamelCase__					:   defaultdict      				=	defaultdict(_UpperCAmelCase				)

    for outer_width in range(3		,			(t_limit // 4) + 2				):
        if outer_width * outer_width > t_limit:
            lowerCamelCase__					:   List[str]      				=	max(
                ceil(sqrt(outer_width * outer_width - t_limit				)				)		,			1				)
        else:
            lowerCamelCase__					:   int      				=	1

        hole_width_lower_bound += (outer_width - hole_width_lower_bound) % 2

        for hole_width in range(_UpperCAmelCase		,			outer_width - 1		,			2				):
            count[outer_width * outer_width - hole_width * hole_width] += 1

    return sum(1 for n in count.values() if 1 <= n <= 10				)


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





