题目链接
#include<bits/stdc++.h>
using namespace std;
const int N = 1000010;
//#define int long long
int n,k;
struct cmp
{
bool operator () (const int & a,const int &b)const
{
if(abs(a-b)<=k)return false;
return a<b;
}
};
set<int,cmp>s;
signed main()
{
scanf("%d%d",&n,&k);
char str[N];
int x;
while(n--)
{
scanf("%s",str);
scanf("%d",&x);
if(str[0]=='a')s.insert(x);
else if(str[0]=='q')
{
if(s.count(x))printf("Yes\n");
else printf("No\n");
}
else if(str[0]=='d')
{
s.erase(x);
}
}
}