CodeLink->https://ide.codingblocks.com/s/244542
I write code on the basis of DIvide & conquer.
MaxSubarraySum shows TLE
in your code inside your merge function what you have to do is find maximum valued subarray that must include arr[mid] in it , but in your function you have while (i <= mid) {
which may or may not include mid in its computation so you need to have your condition something like while(i>=s) with i intialzed as mid which makes sure as mid is included in the subarray whose sum you are computing
also, a good programming practice is to avoid using global variable as much as you can as it makes your program harder to debug
try to correct what i said yourself , in case of any doubt feel free to ask