maximum subsequence sum in c plus plus