#C2525. Maximum Subarray Sum

    ID: 45851 Type: Default 1000ms 256MiB

Maximum Subarray Sum

Maximum Subarray Sum

You are given an array of integers. Your task is to find the maximum sum of any continuous subarray. Formally, given an array A of n elements, you need to compute
\( \max_{1 \le i \le j \le n} \sum_{k=i}^{j} A[k] \) .

If the array is empty, the answer is defined as 0. This problem can include negative numbers, and the subarray must consist of contiguous elements.

inputFormat

The input is given from standard input. The first line contains a single integer n (0 \(\le n \le 10^5\)) representing the number of elements in the array. If n > 0, the second line contains n space-separated integers, which are the elements of the array.

outputFormat

Output a single integer — the maximum sum of any continuous subarray. Print the answer to standard output.

## sample
1
5
5

</p>