Why it shows memeory limit exceeded

vector<int> Solution::searchRange(const vector<int> &a, int b) {
int l=0,h=a.size()-1,m;
vector<int> v;
while(l<=h)
{
    m=(l+h)/2;
    if((m==0 || a[m-1]<b) && a[m]==b)
        v.push_back(m);
    else if(a[m]<b)
        l=m+1;
    else 
        h=m-1;
}
if(v.size()==0)
{
    v.push_back(-1);
}
l=0,h=a.size()-1,m;
while(l<=h)
{
    m=(l+h)/2;
    if((m==a.size()-1 || a[m+1]>b) && a[m]==b)
        v.push_back(m);
    else if(a[m]<b)
        l=m+1;
    else 
        h=m-1;
}
if(v.size()==1)
{
    v.push_back(-1);
}
return v;
// Do not write main() function.
// Do not read input, instead use the arguments to the function.
// Do not print the output, instead return values as specified
// Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for more details

}

Click here to start solving coding interview questions