#include<iostream>
#include<algorithm>
#define x first
#define y second
using namespace std;
typedef pair<int,int> PII;
const int N = 1e5 + 10;
bool tr[N];
PII a[N];
int cnt[N];
int main()
{
int n, d, k;
cin >> n >> d >> k;
for(int i = 1; i <= n; i ++)cin >>a[i].x >> a[i].y;
sort(a + 1,a + 1 +n);
for(int i = 1, j = 1; i <= n; i ++)
{
int t = a[i].y;
cnt[t] ++;
while(a[i].x-a[j].x >= d)
{
cnt[a[j].y] --;
j ++;
}
if(cnt[t] >=k ){
tr[t] = true;
}
}
for(int i = 1;i <= 100010; i ++)
{
if(tr[i] == true)cout << i <<endl;
}
}
用双指针维护一段不大于d的区间,统计在这个区间内,各个id所获得的赞。