We have to find first and last index by upper and lower bound

#include
#include
using namespace std;
int main()
{
int siz;
cin>>siz;
int arr[siz];
for(int i=0;i<siz;i++)
{
cin>>arr[i];
}
int n;
cin>>n;
int q[n];
for(int i=0;i<n;i++)
{
cin>>q[i];
}
for(int i=0;i<n;i++)
{
int *lb=lower_bound(arr,arr+siz,q[i]);
if(lb-arr==siz)
{
cout<<"-1"<<" “;
}
else
{
cout<<lb-arr<<” “;
}
int *ub=upper_bound(arr,arr+siz,q[i]);
if(ub-arr==siz && lb-arr==siz)
{
cout<<”-1"<<endl;
}
else
{
cout<<(ub-arr-1)<<endl;
}
}
return 0;
}

what is the error in this code

@Happy.Vashisht123 please share your code using CB IDE

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.