human
Can you provide a the Python program you requested given the following:
I found an interesting problem on https://leetcode.com/problems/split-array-largest-sum/:
Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest sum among these m subarrays.

Note:
If n is the length of array, assume the following constraints are satisfied:

1 ≤ n ≤ 1000
1 ≤ m ≤ min(50, n)


Examples: 

Input:
nums = [7,2,5,10,8]
m = 2

Output:
18

Explanation:
There are four ways to split nums into two subarrays.
The best way is to split it into [7,2,5] and [10,8],
where the largest sum among the two subarrays is only 18.

I tried it in Python, but could not do it. Can you solve it?
assistant
#Here is the Python program you requested.

class Solution:
     def splitArray(self, pages, k):
         """
         :type nums: List[int]
         :type m: int
         :rtype: int
         """
         if not pages or k == 0:
             return 0
 
         pre = sums = [0] + pages[:]
         for i in range(1, len(sums)):
             sums[i] += sums[i-1]
 
         for n in range(2, k + 1):
             if n > len(pages):
                 break
 
             cur = [sys.maxsize] * len(pre)
             i, j = n - 1, n
             while j < len(pre):
                 left, right = pre[i], sums[j] - sums[i]
                 cur[j] = min(cur[j], max(left, right))
                 if i + 1 < j and max(pre[i+1], sums[j] - sums[i+1]) < cur[j]:
                     i += 1
                 else:
                     j += 1
 
             pre = cur
 
         return pre[-1]