Aggressive cows

could any one please resolve the error . I took long long due to high constraints but it shows an error.

Link to the code --> https://ide.codingblocks.com/s/247555

@rahulparida933

  1. your code is giving segmentation fault because you have created an array of size 1000000000 (see line 24). Change it to long long stalls[100005];
  2. The given input array is not sorted. You can’t apply binary search directly. You need to sort it. Just write sort(stalls, stalls+n); just after taking input array. Also include algorithm header file for sort() function.
    Here is the updated code, plz check
    https://ide.codingblocks.com/s/247590