def lowerCamelCase  (       SCREAMING_SNAKE_CASE  ,      SCREAMING_SNAKE_CASE     ):
    '''simple docstring'''







    assert x is not None
    assert y is not None

    __UpperCamelCase					:List[str]        =		len(SCREAMING_SNAKE_CASE     )
    __UpperCamelCase					:List[str]        =		len(SCREAMING_SNAKE_CASE     )

    # declaring the array for storing the dp values
    __UpperCamelCase					:List[Any]        =		[[0] * (n + 1) for _ in range(m + 1     )]  # noqa: E741

    for i in range(1  ,      m + 1     ):
        for j in range(1  ,      n + 1     ):
            __UpperCamelCase					:Any        =		1 if x[i - 1] == y[j - 1] else 0

            __UpperCamelCase					:List[str]        =		max(l[i - 1][j]  ,      l[i][j - 1]  ,      l[i - 1][j - 1] + match     )

    __UpperCamelCase					:List[Any]        =		''''''
    __UpperCamelCase					:Optional[int]        =		m, n
    while i > 0 and j > 0:
        __UpperCamelCase					:Union[str, Any]        =		1 if x[i - 1] == y[j - 1] else 0

        if l[i][j] == l[i - 1][j - 1] + match:
            if match == 1:
                __UpperCamelCase					:Optional[Any]        =		x[i - 1] + seq
            i -= 1
            j -= 1
        elif l[i][j] == l[i - 1][j]:
            i -= 1
        else:
            j -= 1

    return l[m][n], seq


if __name__ == "__main__":
    __lowercase										= '''AGGTAB'''
    __lowercase										= '''GXTXAYB'''
    __lowercase										= 4
    __lowercase										= '''GTAB'''

    __lowercase			,	__lowercase										= longest_common_subsequence(a, b)
    print('''len =''', ln, ''', sub-sequence =''', subseq)
    import doctest

    doctest.testmod()






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'''







    __UpperCamelCase					:int        =		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=SCREAMING_SNAKE_CASE  ,      default=1  ,      help='''Number of TPU cores to use (1 or 8).'''     )

    # positional
    parser.add_argument(
        '''training_script'''  ,      type=SCREAMING_SNAKE_CASE  ,      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=SCREAMING_SNAKE_CASE     )

    return parser.parse_args()



def lowerCamelCase  (       ):
    '''simple docstring'''







    __UpperCamelCase					:Tuple        =		parse_args()

    # Import training_script as a module.
    __UpperCamelCase					:Dict        =		Path(args.training_script     )
    sys.path.append(str(script_fpath.parent.resolve()     )     )
    __UpperCamelCase					:Any        =		script_fpath.stem
    __UpperCamelCase					:Union[str, Any]        =		importlib.import_module(SCREAMING_SNAKE_CASE     )

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





