Unable to find out whats wrong with this code?

#include
#include
using namespace std;

int main(){

int n, key;
cin >> n;
int a[n];
for(int i = 0; i < n; i++){
    cin >> a[i];
}

int k;
cin >> k;
for(int i = 1; i <= k; i++){

    cin >> key;
    int *it1 = lower_bound(a, a+n, key);
    int *it2 = upper_bound(a, a+n, key);
    if((it1-a) == n){
        cout << -1 << " " << -1 << endl;
    }
    else{
        cout << it1-a << " " << it2-a-1 << endl;
    }
}

return 0;

}

Please save your code on ide.codingblocks.com and share the link

i think you have sent the wrong code link here.

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.