Simple C++ solution, Bianry Search with Explanantion
First start with creating a prefix sum array.\nOur aim to to split array into two parts in sucah a way that sums of the three parts are non decreasing.\nWe are 
First start with creating a prefix sum array.\nOur aim to to split array into two parts in sucah a way that sums of the three parts are non decreasing.\nWe are using for loop to make the partition of the firs part, and then using binary search to find the max and min 2nd seperation that will sastify the condition.\n```\nclass Solution {\npublic:\n    int mod=1e9+7;\n    int waysToSplit(vector<int>& arr) {\n        int n = arr.size();\n        for(int i=1;i<n;i++) arr[i]+=arr[i-1]; // creating the prefix sum array\n    int ans=0;\n    for(int i=0;i<n-2;i++){ // for loop for making the first partition\n        int a=arr[i],mx=-1,mn=-1;\n        int l=i+1,r=n-2;\n        while(l<=r){ // binary search to find the max 2nd partition \n            int m= l +(r-l)/2;\n            if(arr[m]-a > arr[n-1]-arr[m]){\n                r=m-1;\n            }\n            else{\n                if(arr[m]-a >= a){\n                    mx=m;\n                    l=m+1;\n                }\n                else l=m+1;\n            }\n        }\n        l = i+1; r=n-2;\n         while(l<=r){ // binary search to find the min 2nd partition \n            int m= l +(r-l)/2;\n            if(arr[m]-a > arr[n-1]-arr[m]){\n                r=m-1;\n            }\n            else{\n                if(arr[m]-a >= a){\n                    mn=m;\n                    r=m-1;\n                }\n                else l = m+1;\n            }\n        }\n        if(mx!=-1 and mn!=-1) ans+=(mx-mn+1); \n\t\t/* any length of 2nd partion between \n\t\tmx and mn will satisfy this condition, \n\t\ttotal number of ways is (mx-mn+1);*/\n\t\t\n        ans%=mod;\n    }\n    return ans;\n    }\n};\n```
['C', 'Binary Tree', 'Prefix Sum']