SIMPLE GREEDY + PREFIX SUM BASED SOLUTION
\nclass Solution {\npublic:\n    int waysToSplit(vector<int>& nums) {\n        int sum=0;\n        \n        vector<int>pre(nums.size(),0);\n        \n        f
```\nclass Solution {\npublic:\n    int waysToSplit(vector<int>& nums) {\n        int sum=0;\n        \n        vector<int>pre(nums.size(),0);\n        \n        for(int i=0;i<nums.size();i++)\n        {\n            sum+=nums[i];\n            pre[i]=sum;\n        }\n        \n        long long int ans=0,left,rem,a,b,k=0;\n        for(int i=0;i<nums.size();i++)\n        {\n          left=pre[i];\n          rem=pre[nums.size()-1]-left;\n          a=lower_bound(pre.begin()+i+1,pre.end(),2*left)-pre.begin();\n          b=upper_bound(pre.begin()+i+1,pre.begin()+nums.size()-1,left+rem/2)-pre.begin();\n            \n            ans+=max(k,(b-a));\n        }\n        return ans%1000000007;\n    }\n};\n```
['C', 'Binary Tree']