🔥 Super Clean 4-Line C++ Solution | One-Pass Magic!
IntuitionThe problem requires determining the number of valid ways to split the array such that the sum of elements on the left side is greater than or equal to
# Intuition
The problem requires determining the number of valid ways to split the array such that the sum of elements on the left side is greater than or equal to the sum of elements on the right side. The key insight is that we can compute the prefix sum and suffix sum efficiently by traversing the array once and updating these values dynamically.

# Approach
1. Calculate the total sum of the array (suffixSum) initially using accumulate().
2. Traverse the array from left to right, updating: prefixSum by adding the current element. suffixSum by subtracting the current element.
3. After each update, check if prefixSum is greater than or equal to suffixSum. If true, increment the count (ans).
4. Return the count at the end of the traversal.

# Complexity
- Time complexity: $$O(n)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(1)$$ 
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int waysToSplitArray(vector<int>& nums) {
        long long ss = accumulate(nums.begin(), nums.end(), 0ll), ps = 0;
        int ans = 0;
        for (int i = 0; i < nums.size() - 1; i++) {
            ps += nums[i];
            ss -= nums[i];
            if (ps >= ss) ans++;
        }
        return ans;
    }
};

```
['Array', 'Prefix Sum', 'C++']