
    Design an algorithm to identify the most effective learning streak (consecutive assessment scores with highest total) in a personalized learning module that repeats k times to accommodate multiple learning cycles, where each cycle contains the same sequence of n assessment points measuring student performance. The learning streak can span across cycle boundaries, helping educators identify optimal periods of student engagement and mastery.
    

    
def max_sub_array_sum_repeated(a, n, k):
    """
    Design an algorithm to identify the most effective learning streak (consecutive assessment scores with highest total) in a personalized learning module that repeats k times to accommodate multiple learning cycles, where each cycle contains the same sequence of n assessment points measuring student performance. The learning streak can span across cycle boundaries, helping educators identify optimal periods of student engagement and mastery.
    

    """
def max_sub_array_sum_repeated(a, n, k):
    """
    Design an algorithm to identify the most effective learning streak (consecutive assessment scores with highest total) in a personalized learning module that repeats k times to accommodate multiple learning cycles, where each cycle contains the same sequence of n assessment points measuring student performance. The learning streak can span across cycle boundaries, helping educators identify optimal periods of student engagement and mastery.
    

    """
    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