def flatten_3d_to_2d(raw_file_data):
    """
    Flatten the raw 3D file data to 2D.

    Args:
        raw_file_data: A 3D nested list.

    Returns:
        file_data_2d: A 2D nested list
        lens: A list of integers recording the number of files in each CL.
    """
    file_data_2d = []
    lens = []
    for lst in raw_file_data:
        lens.append(len(lst))
        for e in lst:
            file_data_2d.append(e)
    return file_data_2d, lens