/**
 * This function takes a list of board lengths, a list of desired lengths,
 * and a target number and returns a list containing the number of cuts
 * needed to achieve the desired lengths for each board.
 *
 * @param boards List of board lengths.
 * @param lengths List of desired lengths.
 * @param target Target number of cuts.
 * @return List containing the number of cuts needed for each board.
 */
fun calculateCuts(boards: List<Int>, lengths: List<Int>, target: Int): List<Int> {

    val result = mutableListOf<Int>()
    for (board in boards) {
        var count = 0
        var currentBoard = board
        while (currentBoard > 0 && count < target) {
            for (length in lengths) {
                if (length <= currentBoard) {
                    currentBoard -= length
                    count++
                    if (count == target) {
                        break
                    }
                }
            }
        }
        result.add(count)
    }
    return result
}
/**
 * This function takes a list of board lengths, a list of desired lengths,
 * and a target number and returns a list containing the number of cuts
 * needed to achieve the desired lengths for each board.
 *
 * @param boards List of board lengths.
 * @param lengths List of desired lengths.
 * @param target Target number of cuts.
 * @return List containing the number of cuts needed for each board.
 */
fun calculateCuts(boards: List<Int>, lengths: List<Int>, target: Int): List<Int> {
/**
 * This function takes a list of board lengths, a list of desired lengths,
 * and a target number and returns a list containing the number of cuts
 * needed to achieve the desired lengths for each board.
 *
 * @param boards List of board lengths.
 * @param lengths List of desired lengths.
 * @param target Target number of cuts.
 * @return List containing the number of cuts needed for each board.
 */
fun calculateCuts(boards: List<Int>, lengths: List<Int>, target: Int): List<Int> {

    val result = mutableListOf<Int>()
    for (board in boards) {
        var count = 0
        var currentBoard = board
        while (currentBoard > 0 && count < target) {
            for (length in lengths) {
                if (length <= currentBoard) {
                    currentBoard -= length
                    count++
                    if (count == target) {
                        break
                    }
                }
            }
        }
        result.add(count)
    }
    return result
}