# https://www.hackerrank.com/challenges/maxsubarray

import sys


def maxsubarray_contiguous(numbers):
    max_ending_here = numbers[0]
    max_so_far = numbers[0]
    for n in numbers[1:]:
        max_ending_here = max(n, max_ending_here + n)
        max_so_far = max(max_ending_here, max_so_far)
    return max_so_far


def maxsubarray_noncontiguous(numbers):
    max_number = numbers[0]
    max_possitive_sum = max(0, numbers[0])
    for n in numbers[1:]:
        max_number = max(n, max_number)
        max_possitive_sum += max(n, 0)
    return max_possitive_sum if max_possitive_sum > 0 else max_number


def maxsubarray(numbers):
    return maxsubarray_contiguous(numbers), maxsubarray_noncontiguous(numbers)


if __name__ == '__main__':
    f = sys.stdin
    T = int(f.readline())
    for t in range(T):
        N = int(f.readline())
        numbers = list(map(int, f.readline().rstrip().split()))
        print(' '.join(map(str, maxsubarray(numbers))))

@@ -386,33 +386,32 @@
 s%5B0%5D%0A    max_pos
-s
 itive_sum = max(
@@ -498,33 +498,32 @@
 %0A        max_pos
-s
 itive_sum += max
@@ -539,33 +539,32 @@
   return max_pos
-s
 itive_sum if max
@@ -567,17 +567,16 @@
  max_pos
-s
 itive_su

Fix typo