def cumulative_sum(t):
    """
    Return a new list where the ith element is the sum of all elements up to that
    position in the list. Ex: [1, 2, 3] returns [1, 3, 6]
    """
    res = [t[0]]
    for i in range(1, len(t)):
        res.append(res[-1] + t[i])
    return res