C++ solution.
\n#define ll long long\n\nclass Solution {\npublic:\n    int waysToSplit(vector<int>& nums) {\n        ll n = nums.size(), pref[100005], mod = 1e9+7;;\n        
```\n#define ll long long\n\nclass Solution {\npublic:\n    int waysToSplit(vector<int>& nums) {\n        ll n = nums.size(), pref[100005], mod = 1e9+7;;\n        pref[0] = nums[0];\n        for(int i = 1; i < n; i++) pref[i] = pref[i-1]+nums[i];\n        int cnt = 0;\n        for(int i = 0; i < n-2; i++) {\n            ll left = pref[i];\n            ll rest = pref[n-1]-pref[i];\n            auto lb = lower_bound(pref+i+1,pref+n-1,2*left);\n            auto ub = upper_bound(pref+i+1,pref+n-1,rest/2+left);\n            if(ub-lb > 0) cnt += ub-lb; \n            cnt %= mod;\n        }\n        \n        return cnt%mod;\n    }\n};\n```
[]