






import operator


def        _a  (     UpperCamelCase_					:				list    ,   UpperCamelCase_					:				bool = False    ,   UpperCamelCase_					:				list | None = None   ) ->   list:
						"""simple docstring"""







						lowerCAmelCase__       =						operator.lt if reverse else operator.gt
						lowerCAmelCase__       =						solution or []

						if not arr:
												return solution

						lowerCAmelCase__       =						[arr.pop(0   )]
						for i, item in enumerate(UpperCamelCase_   ):
												if _operator(UpperCamelCase_    ,   sublist[-1]   ):
																		sublist.append(UpperCamelCase_   )
																		arr.pop(UpperCamelCase_   )

    #  merging sublist into solution list
						if not solution:
												solution.extend(UpperCamelCase_   )
						else:
												while sublist:
																		lowerCAmelCase__       =						sublist.pop(0   )
																		for i, xx in enumerate(UpperCamelCase_   ):
																								if not _operator(UpperCamelCase_    ,   UpperCamelCase_   ):
																														solution.insert(UpperCamelCase_    ,   UpperCamelCase_   )
																														break
																		else:
																								solution.append(UpperCamelCase_   )

						strand_sort(UpperCamelCase_    ,   UpperCamelCase_    ,   UpperCamelCase_   )
						return solution


if __name__ == "__main__":
	assert strand_sort([4, 3, 5, 1, 2]) == [1, 2, 3, 4, 5]
	assert strand_sort([4, 3, 5, 1, 2], reverse=True) == [5, 4, 3, 2, 1]














# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.:
#   python ./utils/get_modified_files.py utils src tests examples
#
# it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered
# since the output of this script is fed into Makefile commands it doesn't print a newline after the results

import re
import subprocess
import sys


a_							=    subprocess.check_output('''git merge-base main HEAD'''.split()).decode('''utf-8''')
a_							=    subprocess.check_output(F"git diff --name-only {fork_point_sha}".split()).decode('''utf-8''').split()

a_							=    '''|'''.join(sys.argv[1:])
a_							=    re.compile(rF"^({joined_dirs}).*?\.py$")

a_							=    [x for x in modified_files if regex.match(x)]
print(''' '''.join(relevant_modified_files), end='''''')






