def label_id_to_cluster_id(label_id, C, unused_labels):
    """Map the label id to the cluster id according to clustering matrix.
    
    Args:
        label_id: the label id.
        C: the cluster matrix of shape L x C.
        unused_labels: used to adjust the label id.
    
    Returns:
        the cluster id.
    """
    # count how many unused labels that are smaller than label_id
    offset = sum([l < label_id for l in unused_labels])
    row_id = label_id - offset
    assert C.indptr[row_id] + 1 == C.indptr[row_id + 1]
    cluster_id = C.indices[C.indptr[row_id]]
    return cluster_id