int Solution::search(const vector<int> &A, int B) {
vector<pair<long int,long int>> b;
long int i,j;
for(i=0;i<A.size();i++)
{
b.push_back(make_pair(A[i],i));
}
sort(b.begin(),b.end());
long int l,h,m;
l=0,h=A.size()-1;
while(l<=h)
{
m=(l+h)/2;
if(b[m].first==B)
{
return b[m].second;
}
if(b[m].second<B)
{
l=m+1;
}
else
{
h=m-1;
}
}
return -1;
// 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
}