Simple c++ solution
\nclass Solution {\npublic:\n    int waysToSplit(vector<int>& nums) {\n        long long n = nums.size(),ans=0,mod=1e9+7;\n        // Here we are using prefix s
```\nclass Solution {\npublic:\n    int waysToSplit(vector<int>& nums) {\n        long long n = nums.size(),ans=0,mod=1e9+7;\n        // Here we are using prefix sum\n        for(int i=1;i<n;i++) nums[i] += nums[i-1];\n        for(int i=0;i<n;i++){\n            int j1=i+1,j2=n-1,ans1=0,ans2=0;\n            // ans1 will find the minimum index at which \n            // the sum of second subsequence will be greater than first subsequence containing \n            // 1st i  elements\n            while(j1<=j2){\n                int m = (j1+j2)/2;\n\t            if(nums[m]>=2*nums[i]) ans1=m,j2=m-1;\n\t            else j1=m+1;\n            }\n            // ans2 will be the last index till which sum will be third\n            // subsequence sum will be greater than second\n            j1=i+1,j2=n-1;\n            while(j1<j2){\n                int m = (j1+j2)/2;\n\t            if(nums[n-1]>=2*nums[m]-nums[i]) ans2=m,j1=m+1;\n\t            else j2=m;\n            }\n            // any indices that are in between ans1 and ans2 can be considered valid\n            if(ans1>ans2 || ans1==0 || ans2==0 || ans1<i || ans2<i) continue;\n            ans = (ans + (ans2 - ans1 + 1)%mod)%mod;\n        }\n        return ans;\n    }\n};\n```
['C', 'Binary Tree', 'Prefix Sum']