/**
 * Compute the current balance of an accountant given a list of transactions.
 * A transaction is represented as a tuple containing a description and an amount.
 * The accountant initially has a balance of 0.
 * If a transaction amount is positive, it represents a deposit.
 * If a transaction amount is negative, it represents a withdrawal.
 * The accountant can only withdraw money if the current balance is at least 1000.
 * If the balance drops below 1000, the accountant should stop processing further transactions.
 */
fun calculateBalance(transactions: List<Pair<String, Int>>): Int {

    var balance = 0
    for (transaction in transactions) {
        val amount = transaction.second
        if (amount > 0) {
            balance += amount
        } else {
            if (balance >= 1000) {
                balance += amount
            } else {
                break
            }
        }
    }
    return balance
}
/**
 * Compute the current balance of an accountant given a list of transactions.
 * A transaction is represented as a tuple containing a description and an amount.
 * The accountant initially has a balance of 0.
 * If a transaction amount is positive, it represents a deposit.
 * If a transaction amount is negative, it represents a withdrawal.
 * The accountant can only withdraw money if the current balance is at least 1000.
 * If the balance drops below 1000, the accountant should stop processing further transactions.
 */
fun calculateBalance(transactions: List<Pair<String, Int>>): Int {
/**
 * Compute the current balance of an accountant given a list of transactions.
 * A transaction is represented as a tuple containing a description and an amount.
 * The accountant initially has a balance of 0.
 * If a transaction amount is positive, it represents a deposit.
 * If a transaction amount is negative, it represents a withdrawal.
 * The accountant can only withdraw money if the current balance is at least 1000.
 * If the balance drops below 1000, the accountant should stop processing further transactions.
 */
fun calculateBalance(transactions: List<Pair<String, Int>>): Int {

    var balance = 0
    for (transaction in transactions) {
        val amount = transaction.second
        if (amount > 0) {
            balance += amount
        } else {
            if (balance >= 1000) {
                balance += amount
            } else {
                break
            }
        }
    }
    return balance
}