#include <cstdio>
#include <algorithm>
using namespace std;
int h[100005];
int main()
{
int m,n,l;
scanf("%d %d %d",&m,&n,&l);
for (int i=0; i<m; i++)
{
scanf("%d",&h[i]);
}
sort(h,h+m);
int cc=0;
for (int i=0; i<n; i++)
{
int x, y;
scanf("%d %d", &x, &y);
if (y>l)
continue;
int ci=lower_bound(h,h+m,x)-h;
if (ci<m)
{
if (abs(h[ci]-x)+y <= l)
{
cc++;
continue;
}
}
if (ci>0)
{
if (abs(h[ci-1]-x)+y <= l)
{
cc++;
}
}
}
printf("%d\n",cc);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: