<doocs>2073.Time Needed to Buy Tickets_1.py
def timeRequiredToBuy( tickets: List[int], k: int) -> int:
    ans = 0
    for i, t in enumerate(tickets):
        if i <= k:
            ans += min(tickets[k], t)
        else:
            ans += min(tickets[k] - 1, t)
    return ans
def sample_funcname ( var_0 : List [ int ] , var_3 : int ) -> int :
    var_5 = 0
    for var_7 , var_8 in enumerate ( var_0 ) :
        if var_7 <= var_3 :
            var_5 += min ( var_0 [ var_3 ] , var_8 )
        else :
            var_5 += min ( var_0 [ var_3 ] - 1 , var_8 )
    return var_5
