/**
 * The function takes an integer n and a list lst as input. It modifies the list by adding n to each element of the list,
 * then it removes all negative elements from the list, and finally it squares each remaining element.
 *
 * @param n An integer to be added to each element of the list
 * @param lst A list containing elements to be modified
 * @return The modified list after performing the specified operations
 *
 * Example:
 * modifyListElements(3, listOf(1, -2, 4, -5, 6))
 * Output: [16, 9, 49, 36]
 */
fun modifyListElements(n: Int, lst: List<Int>): List<Int> {

    // Adding n to each element of the list
    var modifiedList = lst.map { it + n }

    // Removing negative elements from the list
    modifiedList = modifiedList.filter { it >= 0 }

    // Squaring each remaining element
    modifiedList = modifiedList.map { it * it }

    return modifiedList
}
/**
 * The function takes an integer n and a list lst as input. It modifies the list by adding n to each element of the list,
 * then it removes all negative elements from the list, and finally it squares each remaining element.
 *
 * @param n An integer to be added to each element of the list
 * @param lst A list containing elements to be modified
 * @return The modified list after performing the specified operations
 *
 * Example:
 * modifyListElements(3, listOf(1, -2, 4, -5, 6))
 * Output: [16, 9, 49, 36]
 */
fun modifyListElements(n: Int, lst: List<Int>): List<Int> {
/**
 * The function takes an integer n and a list lst as input. It modifies the list by adding n to each element of the list,
 * then it removes all negative elements from the list, and finally it squares each remaining element.
 *
 * @param n An integer to be added to each element of the list
 * @param lst A list containing elements to be modified
 * @return The modified list after performing the specified operations
 *
 * Example:
 * modifyListElements(3, listOf(1, -2, 4, -5, 6))
 * Output: [16, 9, 49, 36]
 */
fun modifyListElements(n: Int, lst: List<Int>): List<Int> {

    // Adding n to each element of the list
    var modifiedList = lst.map { it + n }

    // Removing negative elements from the list
    modifiedList = modifiedList.filter { it >= 0 }

    // Squaring each remaining element
    modifiedList = modifiedList.map { it * it }

    return modifiedList
}