https://www.codechef.com/LRNDSA07/problems/FROGV

```
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define mod 1e9+7
#define ff first
#define ss second
#define ins insert
#define endl "\n"
#define pie_op ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define tc int t;cin>>t;while(t--)
#define pb push_back
#define input(n) int arr[n];for(int i1=0;i1<n;i1++)cin>>arr[i1]
int main()
{
pie_op;
ll n,p,k;cin>>n>>p>>k;
vector<ll> arr(n);
set<ll> st;
for(ll i=0;i<n;i++){
cin>>arr[i];
st.ins(arr[i]);
}
arr.clear();
for(auto x: st){
arr.pb(x);
}
vector<ll> v(arr.size(),0);
for(ll i=1;i<arr.size();i++){
if(arr[i]-arr[i-1]<=k){
v[i]+=v[i-1]+1;
}
else{
v[i]=0;
}
}
while(p--){
ll a,b;cin>>a>>b;
if(v[b-1]>=(b-a)) cout<<"YES";
else cout<<"NO";
cout<<endl;
}
return 0;
}
```

Can anyone tell me what i am doing wrong?