[C] 3 ptrs | Time: O(n), Space: O(1)
```C []
#define MOD ((int)1e9 + 7)

int waysToSplit(const int * const nums, const int numsLen){
	if (!( numsLen >= 3 )){
		return 0;
	}

	int splitWayCnt = 0;

	int rightSum = 0; //[2] to end
	for (int i = 2; i < numsLen; i += 1){
		rightSum += nums[i];
	}
	int rightFirst = 2;

	int maxMiddleSum = nums[1];
	int minMiddleStart = 1; //middleSum <= rightSum

	int maxLeftSum = nums[0], minMiddleSum = nums[1];
	int maxMiddleStart = 1; //leftSum <= middleSum

	while (1){
		while (
			maxMiddleSum > rightSum &&
			minMiddleStart + 1 < rightFirst
		){
			maxMiddleSum -= nums[minMiddleStart];
			minMiddleStart += 1;
		}

		while (
			maxMiddleStart + 1 < rightFirst &&
			maxLeftSum + nums[maxMiddleStart] <=
				minMiddleSum - nums[maxMiddleStart]
		){
			minMiddleSum -= nums[maxMiddleStart];
			maxLeftSum += nums[maxMiddleStart];
			maxMiddleStart += 1;
		}

		if (
			maxMiddleSum <= rightSum &&
			maxLeftSum <= minMiddleSum &&
			minMiddleStart <= maxMiddleStart
		){
			const int curWay = maxMiddleStart + 1 - minMiddleStart;
			splitWayCnt = (splitWayCnt + curWay) % MOD;
		}

		if (numsLen - 1 == rightFirst){
			break;
		}
		//move [rightFirst] from right to middle
		rightSum -= nums[rightFirst];
		maxMiddleSum += nums[rightFirst];
		minMiddleSum += nums[rightFirst];
		rightFirst += 1;
	}

	return splitWayCnt;
}
```
['C']