
    Design a fraud detection algorithm that analyzes transaction sequences to identify the highest-risk combination of increasing transaction amounts leading up to a specific checkpoint, while also considering a suspicious transaction that occurred after this checkpoint. The algorithm should evaluate all possible subsequences of increasing transaction amounts from the start of the sequence up to the checkpoint position, ensuring that the subsequence includes the suspicious transaction amount at position k. The goal is to calculate the maximum sum of such transaction sequences to help identify potential fraudulent patterns in banking activities. The solution must consider all transactions in chronological order and maintain the increasing nature of transaction amounts in the identified subsequence.
    

    
def max_sum_increasing_subseq(a, n, index, k):
    """
    Design a fraud detection algorithm that analyzes transaction sequences to identify the highest-risk combination of increasing transaction amounts leading up to a specific checkpoint, while also considering a suspicious transaction that occurred after this checkpoint. The algorithm should evaluate all possible subsequences of increasing transaction amounts from the start of the sequence up to the checkpoint position, ensuring that the subsequence includes the suspicious transaction amount at position k. The goal is to calculate the maximum sum of such transaction sequences to help identify potential fraudulent patterns in banking activities. The solution must consider all transactions in chronological order and maintain the increasing nature of transaction amounts in the identified subsequence.
    

    """
def max_sum_increasing_subseq(a, n, index, k):
    """
    Design a fraud detection algorithm that analyzes transaction sequences to identify the highest-risk combination of increasing transaction amounts leading up to a specific checkpoint, while also considering a suspicious transaction that occurred after this checkpoint. The algorithm should evaluate all possible subsequences of increasing transaction amounts from the start of the sequence up to the checkpoint position, ensuring that the subsequence includes the suspicious transaction amount at position k. The goal is to calculate the maximum sum of such transaction sequences to help identify potential fraudulent patterns in banking activities. The solution must consider all transactions in chronological order and maintain the increasing nature of transaction amounts in the identified subsequence.
    

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