#include <iostream>
#include <algorithm>
using namespace std;
#define MOD 1000000009
long long v[10000001];
int main()
{
long long n,m,i,rasp,st;
cin>>n>>m;
for(i=1;i<=n;i++) cin>>v[i];
sort(v+1,v+n+1);
rasp=1;st=1;
for(i=1;i<=n;i++){
while(st<i && v[st]+m<v[i])
st++;
rasp=(rasp*(i-st+1))%MOD;
}
cout<<rasp;
return 0;
}
#include <iostream>
#include <algorithm>
using namespace std;
#define MOD 1000000009
long long v[10000001];
int main()
{
long long n,m,i,rasp,st;
cin>>n>>m;
for(i=1;i<=n;i++) cin>>v[i];
sort(v+1,v+n+1);
rasp=1;st=1;
for(i=1;i<=n;i++){
while(st<i && v[st]+m<v[i])
st++;
rasp=(rasp*(i-st+1))%MOD;
}
cout<<rasp;
return 0;
}
Compilation message
tower.cpp:30:11: error: redefinition of 'long long int v [10000001]'
30 | long long v[10000001];
| ^
tower.cpp:7:11: note: 'long long int v [10000001]' previously declared here
7 | long long v[10000001];
| ^
tower.cpp:32:5: error: redefinition of 'int main()'
32 | int main()
| ^~~~
tower.cpp:9:5: note: 'int main()' previously defined here
9 | int main()
| ^~~~