def max_contig_sum(L):
    """ L, a list of integers, at least one positive
    Returns the maximum sum of a contiguous subsequence in L """
    sizeL=len(L)
    max_so_far,max_ending_here=0,0
    for i in range(sizeL):
        max_ending_here+=L[i]
        if max_ending_here<0:
            max_ending_here=0
        elif max_so_far<max_ending_here:
            max_so_far=max_ending_here
    return max_so_far