
    Design a friend recommendation algorithm that identifies the most compatible group of users by finding the subsequence of users with strictly increasing similarity scores that yields the highest overall compatibility score when multiplied together. The similarity scores represent the strength of shared interests between consecutive users in the potential friend group, and your task is to maximize the group's collective compatibility by selecting users whose connection strengths form an increasing pattern.
    

    
def max_product(arr):
    """
    Design a friend recommendation algorithm that identifies the most compatible group of users by finding the subsequence of users with strictly increasing similarity scores that yields the highest overall compatibility score when multiplied together. The similarity scores represent the strength of shared interests between consecutive users in the potential friend group, and your task is to maximize the group's collective compatibility by selecting users whose connection strengths form an increasing pattern.
    

    """
def max_product(arr):
    """
    Design a friend recommendation algorithm that identifies the most compatible group of users by finding the subsequence of users with strictly increasing similarity scores that yields the highest overall compatibility score when multiplied together. The similarity scores represent the strength of shared interests between consecutive users in the potential friend group, and your task is to maximize the group's collective compatibility by selecting users whose connection strengths form an increasing pattern.
    

    """
    n = len(arr)
    mpis = arr[:]
    for i in range(n):
        current_prod = arr[i]
        j = i + 1
        while j < n:
            if arr[j - 1] > arr[j]:
                break
            current_prod *= arr[j]
            if current_prod > mpis[j]:
                mpis[j] = current_prod
            j = j + 1
    return max(mpis)