<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calculate_A50(ctgsizes, cutoff=0, percent=50):
 """ Given an array of contig sizes, produce A50, N50, and L50 values """


    ctgsizes = np.array(ctgsizes, dtype="int")
    ctgsizes = np.sort(ctgsizes)[::-1]
    ctgsizes = ctgsizes[ctgsizes >= cutoff]

    a50 = np.cumsum(ctgsizes)

    total = np.sum(ctgsizes)
    idx = bisect(a50, total * percent / 100.)
    l50 = ctgsizes[idx]
    n50 = idx + 1

    return a50, l50, n50