
    Design a fraud detection function that analyzes a customer's transaction history to identify the highest-risk sequence of increasing transaction amounts leading up to a specific checkpoint, while also considering a future transaction of interest. The function should evaluate all transactions from the start until the checkpoint index, ensuring each transaction in the sequence is larger than the previous one, and must include the transaction at position k which occurs after the checkpoint. The goal is to calculate the maximum sum of such a transaction sequence to help identify potential fraudulent patterns, where higher sums may indicate escalating suspicious activity. The transaction sequence must maintain strictly increasing order to detect the pattern of progressively larger unauthorized charges that are common in fraud cases.
    

    
def max_sum_increasing_subseq(a, n, index, k):
    """
    Design a fraud detection function that analyzes a customer's transaction history to identify the highest-risk sequence of increasing transaction amounts leading up to a specific checkpoint, while also considering a future transaction of interest. The function should evaluate all transactions from the start until the checkpoint index, ensuring each transaction in the sequence is larger than the previous one, and must include the transaction at position k which occurs after the checkpoint. The goal is to calculate the maximum sum of such a transaction sequence to help identify potential fraudulent patterns, where higher sums may indicate escalating suspicious activity. The transaction sequence must maintain strictly increasing order to detect the pattern of progressively larger unauthorized charges that are common in fraud cases.
    

    """
def max_sum_increasing_subseq(a, n, index, k):
    """
    Design a fraud detection function that analyzes a customer's transaction history to identify the highest-risk sequence of increasing transaction amounts leading up to a specific checkpoint, while also considering a future transaction of interest. The function should evaluate all transactions from the start until the checkpoint index, ensuring each transaction in the sequence is larger than the previous one, and must include the transaction at position k which occurs after the checkpoint. The goal is to calculate the maximum sum of such a transaction sequence to help identify potential fraudulent patterns, where higher sums may indicate escalating suspicious activity. The transaction sequence must maintain strictly increasing order to detect the pattern of progressively larger unauthorized charges that are common in fraud cases.
    

    """
    dp = [[0 for i in range(n)] for i in range(n)]
    for i in range(n):
        if a[i] > a[0]:
            dp[0][i] = a[i] + a[0]
        else:
            dp[0][i] = a[i]
    for i in range(1, n):
        for j in range(n):
            if a[j] > a[i] and j > i:
                if dp[i - 1][i] + a[j] > dp[i - 1][j]:
                    dp[i][j] = dp[i - 1][i] + a[j]
                else:
                    dp[i][j] = dp[i - 1][j]
            else:
                dp[i][j] = dp[i - 1][j]
    return dp[index][k]