/**
 * Given a list and an index, delete the element at the index and return
 * the element that was deleted. Finally, access the first element of the
 * modified list and return it.
 *
 * @param lst The input list.
 * @param index The index of the element to delete.
 * @return The element deleted at the specified index followed by the first
 * element of the modified list.
 *
 * Example:
 * deleteAndAccessElements(listOf(1, 2, 3, 4, 5), 3) returns (4, 1)
 */
fun deleteAndAccessElements(lst: MutableList<Int>, index: Int): Pair<Int, Int> {

    // Delete the element at the given index and store it in a variable
    val deletedElement = lst.removeAt(index)

    // Access the first element of the modified list
    val firstElement = lst[0]

    return Pair(deletedElement, firstElement)
}
/**
 * Given a list and an index, delete the element at the index and return
 * the element that was deleted. Finally, access the first element of the
 * modified list and return it.
 *
 * @param lst The input list.
 * @param index The index of the element to delete.
 * @return The element deleted at the specified index followed by the first
 * element of the modified list.
 *
 * Example:
 * deleteAndAccessElements(listOf(1, 2, 3, 4, 5), 3) returns (4, 1)
 */
fun deleteAndAccessElements(lst: MutableList<Int>, index: Int): Pair<Int, Int> {
/**
 * Given a list and an index, delete the element at the index and return
 * the element that was deleted. Finally, access the first element of the
 * modified list and return it.
 *
 * @param lst The input list.
 * @param index The index of the element to delete.
 * @return The element deleted at the specified index followed by the first
 * element of the modified list.
 *
 * Example:
 * deleteAndAccessElements(listOf(1, 2, 3, 4, 5), 3) returns (4, 1)
 */
fun deleteAndAccessElements(lst: MutableList<Int>, index: Int): Pair<Int, Int> {

    // Delete the element at the given index and store it in a variable
    val deletedElement = lst.removeAt(index)

    // Access the first element of the modified list
    val firstElement = lst[0]

    return Pair(deletedElement, firstElement)
}