using prefix sum & binary search-C++-O(nlogn)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int waysToSplit(vector<int>& nums) {\n        int n=nums.size();\n        int ans=0;\n        vector<int> pre(n,0);\n           pre[0]=nums[0];\n        for(int i=1;i<n;i++)\n        pre[i]=pre[i-1]+nums[i];\n        int mod=1e9+7;\n        // 1 3 5 7 12 12 \n        for(int i=0;i<n;i++)\n        {\n           int low=lower_bound(pre.begin()+i+1,pre.end(),2*pre[i])-pre.begin();//it will return min boundary if we have middle subarray sum equal to first sub array sum(we are checking 2*pre[i] because it is prefix sum and we do not have to conside first subarray sum i.e pre[i])\n           int up=upper_bound(pre.begin()+i+1,pre.begin()+n-1,pre[i]+((pre[n-1]-pre[i])/2))-pre.begin();//max for second subarray will (remaing part)/2 \n           ans+=(max(0,(up-low)))%mod;\n           ans=ans%mod;\n        }\n      return ans;\n    }\n};\n```
['Binary Search', 'Prefix Sum', 'C++']