import random


def update_correct(xs, pbcids_to_adjust, nonsample_sizes, num_winners, risk_limit):
    """
    Update how much to extend the county's sampling by.

    With probability 1 - (1-alpha)^(num_winners), we decrease the sampling since all
    the winners are correct. If not, keep the same value.
    """
    update = {}
    for pbcid in xs:
        if xs[pbcid] == 0:
            update[pbcid] = xs[pbcid]
        elif random.random() < 1-(1-risk_limit)**num_winners:
            update[pbcid] = (xs[pbcid]-1)
        else:
            update[pbcid] = (xs[pbcid])
    return update