/**
 * A carpenter is given a list of wood lengths available and a list of required lengths for a project.
 * This function calculates the number of wood pieces needed to fulfill the project requirements.
 * It then returns the number of wood pieces required.
 *
 * @param woodLengths A list containing the available lengths of wood pieces. Each length is an integer.
 * @param requiredLengths A list containing the required lengths for the project. Each length is an integer.
 * @return An integer representing the number of wood pieces required.
 */
fun calculateMaterials(woodLengths: MutableList<Int>, requiredLengths: List<Int>): Int {

    var count = 0 // Variable to keep track of the number of wood pieces required
    
    for (length in requiredLengths) {
        var found = false // Flag variable to check if a wood piece of required length is found
        
        for (wood in woodLengths) {
            if (wood == length) {
                found = true
                woodLengths.remove(wood) // Remove the used wood piece from the available lengths
                break
            }
        }
        
        if (!found) { // If a required length is not found in the available lengths
            count++
        }
    }
    
    return count
}
/**
 * A carpenter is given a list of wood lengths available and a list of required lengths for a project.
 * This function calculates the number of wood pieces needed to fulfill the project requirements.
 * It then returns the number of wood pieces required.
 *
 * @param woodLengths A list containing the available lengths of wood pieces. Each length is an integer.
 * @param requiredLengths A list containing the required lengths for the project. Each length is an integer.
 * @return An integer representing the number of wood pieces required.
 */
fun calculateMaterials(woodLengths: MutableList<Int>, requiredLengths: List<Int>): Int {
/**
 * A carpenter is given a list of wood lengths available and a list of required lengths for a project.
 * This function calculates the number of wood pieces needed to fulfill the project requirements.
 * It then returns the number of wood pieces required.
 *
 * @param woodLengths A list containing the available lengths of wood pieces. Each length is an integer.
 * @param requiredLengths A list containing the required lengths for the project. Each length is an integer.
 * @return An integer representing the number of wood pieces required.
 */
fun calculateMaterials(woodLengths: MutableList<Int>, requiredLengths: List<Int>): Int {

    var count = 0 // Variable to keep track of the number of wood pieces required
    
    for (length in requiredLengths) {
        var found = false // Flag variable to check if a wood piece of required length is found
        
        for (wood in woodLengths) {
            if (wood == length) {
                found = true
                woodLengths.remove(wood) // Remove the used wood piece from the available lengths
                break
            }
        }
        
        if (!found) { // If a required length is not found in the available lengths
            count++
        }
    }
    
    return count
}