
    Given a list of delivery routes with their priority scores (where negative scores indicate urgent weather/traffic-affected routes and positive scores represent standard routes), reorganize the first n active routes so that all urgent deliveries are prioritized before standard ones while maintaining the relative sequence within each category. The reorganization should only affect the specified n routes while keeping the remaining routes unchanged.
    

    
def re_arrange_array(arr, n):
    """
    Given a list of delivery routes with their priority scores (where negative scores indicate urgent weather/traffic-affected routes and positive scores represent standard routes), reorganize the first n active routes so that all urgent deliveries are prioritized before standard ones while maintaining the relative sequence within each category. The reorganization should only affect the specified n routes while keeping the remaining routes unchanged.
    

    """
def re_arrange_array(arr, n):
    """
    Given a list of delivery routes with their priority scores (where negative scores indicate urgent weather/traffic-affected routes and positive scores represent standard routes), reorganize the first n active routes so that all urgent deliveries are prioritized before standard ones while maintaining the relative sequence within each category. The reorganization should only affect the specified n routes while keeping the remaining routes unchanged.
    

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