/**
 * This function is used by a police officer to calculate the updated penalties for a citation using left and right shift operators and addition assignment operator.
 *
 * @param penalties a list of penalties for the violation types
 * @param citation a Pair containing the violation type index and the penalty points to be added
 * @return updated_penalties a list of penalties after updating based on the citation
 */
fun calculatePenalties(penalties: MutableList<Int>, citation: Pair<Int, Int>): MutableList<Int> {

    // Extract the violation type index and penalty points from the citation
    val (violationIndex, penaltyPoints) = citation

    // Shift the penalties list to the right by violation index times 2 using right shift operator
    repeat(violationIndex * 2) {
        penalties.add(0, penalties.removeAt(penalties.size - 1))
    }

    // Shift the penalties list to the left by violation index times 3 using left shift operator
    repeat(violationIndex * 3) {
        penalties.add(penalties.removeAt(0))
    }

    // Update the penalty at the violation index by adding penalty points using addition assignment operator
    penalties[violationIndex] += penaltyPoints

    return penalties
}
/**
 * This function is used by a police officer to calculate the updated penalties for a citation using left and right shift operators and addition assignment operator.
 *
 * @param penalties a list of penalties for the violation types
 * @param citation a Pair containing the violation type index and the penalty points to be added
 * @return updated_penalties a list of penalties after updating based on the citation
 */
fun calculatePenalties(penalties: MutableList<Int>, citation: Pair<Int, Int>): MutableList<Int> {
/**
 * This function is used by a police officer to calculate the updated penalties for a citation using left and right shift operators and addition assignment operator.
 *
 * @param penalties a list of penalties for the violation types
 * @param citation a Pair containing the violation type index and the penalty points to be added
 * @return updated_penalties a list of penalties after updating based on the citation
 */
fun calculatePenalties(penalties: MutableList<Int>, citation: Pair<Int, Int>): MutableList<Int> {

    // Extract the violation type index and penalty points from the citation
    val (violationIndex, penaltyPoints) = citation

    // Shift the penalties list to the right by violation index times 2 using right shift operator
    repeat(violationIndex * 2) {
        penalties.add(0, penalties.removeAt(penalties.size - 1))
    }

    // Shift the penalties list to the left by violation index times 3 using left shift operator
    repeat(violationIndex * 3) {
        penalties.add(penalties.removeAt(0))
    }

    // Update the penalty at the violation index by adding penalty points using addition assignment operator
    penalties[violationIndex] += penaltyPoints

    return penalties
}