
    Given a student's sequence of performance scores from one academic period, which repeats over k semesters, find the highest cumulative performance streak when analyzing their continuous progress across these repeated terms. The performance sequence from each semester is identical, and the streak can span across semester boundaries.
    

    
def max_sub_array_sum_repeated(a, n, k):
    """
    Given a student's sequence of performance scores from one academic period, which repeats over k semesters, find the highest cumulative performance streak when analyzing their continuous progress across these repeated terms. The performance sequence from each semester is identical, and the streak can span across semester boundaries.
    

    """
def max_sub_array_sum_repeated(a, n, k):
    """
    Given a student's sequence of performance scores from one academic period, which repeats over k semesters, find the highest cumulative performance streak when analyzing their continuous progress across these repeated terms. The performance sequence from each semester is identical, and the streak can span across semester boundaries.
    

    """
    max_so_far = -2147483648
    max_ending_here = 0
    for i in range(n * k):
        max_ending_here = max_ending_here + a[i % n]
        if max_so_far < max_ending_here:
            max_so_far = max_ending_here
        if max_ending_here < 0:
            max_ending_here = 0
    return max_so_far