
"""simple docstring"""




def     __magic_name__		(					UpperCamelCase     :		int     )     ->						bool:
    a__		=			(1 + 24 * n) ** 0.5
    return ((1 + root) / 6) % 1 == 0



def     __magic_name__		(					UpperCamelCase     :		int = 5000     )     ->						int:
    a__		=			[(i * (3 * i - 1)) // 2 for i in range(1							,		UpperCamelCase     )]
    for i, pentagonal_i in enumerate(UpperCamelCase     ):
        for j in range(UpperCamelCase							,		len(UpperCamelCase     )     ):
            a__		=			pentagonal_nums[j]
            a__		=			pentagonal_i + pentagonal_j
            a__		=			pentagonal_j - pentagonal_i
            if is_pentagonal(UpperCamelCase     ) and is_pentagonal(UpperCamelCase     ):
                return b

    return -1


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




"""simple docstring"""




import operator



def     __magic_name__		(					UpperCamelCase     :		list							,		UpperCamelCase     :		bool = False							,		UpperCamelCase     :		list | None = None     )     ->						list:
    a__		=			operator.lt if reverse else operator.gt
    a__		=			solution or []

    if not arr:
        return solution

    a__		=			[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:
            a__		=			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]


