/**
 * You are a carpenter working on multiple projects. Each project requires specific lumber sizes.
 * Your task is to find the common lumber sizes that can be used in all of the projects.
 *
 * @param lumbers A list containing sets of lumber sizes available for each project.
 * @param projects The number of projects to consider.
 * @return A list of common lumber sizes that can be used in all of the projects.
 *
 * Example:
 * findCommonLumberSizes(listOf(setOf(4, 8, 12), setOf(8, 14, 16), setOf(4, 8, 14)), 3) -> [8]
 * findCommonLumberSizes(listOf(setOf(2, 4, 6), setOf(8, 10, 12), setOf(3, 6, 9)), 3) -> []
 */
fun findCommonLumberSizes(lumbers: List<Set<Int>>, projects: Int): List<Int> {

    val commonSizes = lumbers[0].filter { size -> lumbers.drop(1).all { size in it } }
    return commonSizes
}
/**
 * You are a carpenter working on multiple projects. Each project requires specific lumber sizes.
 * Your task is to find the common lumber sizes that can be used in all of the projects.
 *
 * @param lumbers A list containing sets of lumber sizes available for each project.
 * @param projects The number of projects to consider.
 * @return A list of common lumber sizes that can be used in all of the projects.
 *
 * Example:
 * findCommonLumberSizes(listOf(setOf(4, 8, 12), setOf(8, 14, 16), setOf(4, 8, 14)), 3) -> [8]
 * findCommonLumberSizes(listOf(setOf(2, 4, 6), setOf(8, 10, 12), setOf(3, 6, 9)), 3) -> []
 */
fun findCommonLumberSizes(lumbers: List<Set<Int>>, projects: Int): List<Int> {
/**
 * You are a carpenter working on multiple projects. Each project requires specific lumber sizes.
 * Your task is to find the common lumber sizes that can be used in all of the projects.
 *
 * @param lumbers A list containing sets of lumber sizes available for each project.
 * @param projects The number of projects to consider.
 * @return A list of common lumber sizes that can be used in all of the projects.
 *
 * Example:
 * findCommonLumberSizes(listOf(setOf(4, 8, 12), setOf(8, 14, 16), setOf(4, 8, 14)), 3) -> [8]
 * findCommonLumberSizes(listOf(setOf(2, 4, 6), setOf(8, 10, 12), setOf(3, 6, 9)), 3) -> []
 */
fun findCommonLumberSizes(lumbers: List<Set<Int>>, projects: Int): List<Int> {

    val commonSizes = lumbers[0].filter { size -> lumbers.drop(1).all { size in it } }
    return commonSizes
}