
    Given a list of delivery routes with their efficiency scores and a number of priority routes n, reorganize the first n routes so that all delayed routes (with negative efficiency scores) are handled before the on-schedule routes (with positive efficiency scores), while maintaining the original sequence within both delayed and on-schedule categories. The remaining routes beyond the first n should remain unchanged in their original positions.
    

    
def re_arrange_array(arr, n):
    """
    Given a list of delivery routes with their efficiency scores and a number of priority routes n, reorganize the first n routes so that all delayed routes (with negative efficiency scores) are handled before the on-schedule routes (with positive efficiency scores), while maintaining the original sequence within both delayed and on-schedule categories. The remaining routes beyond the first n should remain unchanged in their original positions.
    

    """
def re_arrange_array(arr, n):
    """
    Given a list of delivery routes with their efficiency scores and a number of priority routes n, reorganize the first n routes so that all delayed routes (with negative efficiency scores) are handled before the on-schedule routes (with positive efficiency scores), while maintaining the original sequence within both delayed and on-schedule categories. The remaining routes beyond the first n should remain unchanged in their original positions.
    

    """
    j = 0
    for i in range(0, n):
        if arr[i] < 0:
            temp = arr[i]
            arr[i] = arr[j]
            arr[j] = temp
            j = j + 1
    return arr