Java, binary search solution
\npublic int waysToSplit(int[] nums) {\n        for(int i=1;i<nums.length;i++){\n            nums[i]=nums[i-1]+nums[i];\n        }\n        long mod=(long)1e9+7
```\npublic int waysToSplit(int[] nums) {\n        for(int i=1;i<nums.length;i++){\n            nums[i]=nums[i-1]+nums[i];\n        }\n        long mod=(long)1e9+7;\n        long res=0;\n        for(int i=0;i<nums.length;i++){\n            int first=nums[i];\n            int lowerBound=2*nums[i];\n            int higherBound=(nums[nums.length-1]+nums[i])/2;\n            if(lowerBound>higherBound) continue;\n            int left=binarySearch1(nums,lowerBound);\n            int right=binarySearch2(nums,higherBound);\n\t\t\t// following two lines are for edge cases\n            if(left<=i) left=i+1;\n            if(right==nums.length-1) right--;\n            if(right<left) continue;\n            res=(res+(right-left+1)%mod)%mod;\n        }\n        return (int)res;\n    }\n    \n    int binarySearch1(int[] nums,int target){\n        int lo=0,hi=nums.length;\n        while(lo<hi){\n            int mid=lo+(hi-lo)/2;\n            if(nums[mid]==target) hi=mid;\n            else if(nums[mid]<target) lo=mid+1;\n            else hi=mid;\n        }\n        return lo;\n    }\n    \n    int binarySearch2(int[] nums,int target){\n        int lo=0,hi=nums.length;\n        while(lo<hi){\n            int mid=lo+(hi-lo)/2;\n            if(nums[mid]==target) lo=mid+1;\n            else if(nums[mid]<target) lo=mid+1;\n            else hi=mid;\n        }\n        return lo-1;\n    }\n```
[]