def METHOD_NAME(idx, length, is_first_in_pair, attr):
    for i in numba.prange(length - 1):  # pylint: disable=not-an-iterable
        if is_first_in_pair[i]:
            if attr[idx[i]] < attr[idx[i + 1]]:
                idx[i], idx[i + 1] = idx[i + 1], idx[i]