Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=1ll*x*x%p)if(k&1)res=1ll*res*x%p;return res;}
const int maxn=1e5+5,mod=1e9+7;
int n;
ll A,B,x[maxn];
int sum[maxn<<2][2],tag[maxn<<2][2];
void M(int x,int l,int r,int num,int id){
	tag[x][id]=num;
	sum[x][id]=1ll*num*(r-l+1)%mod;
}
void PD(int x,int l,int r){
	rep(i,0,1)if(tag[x][i]!=-1){
		M(ls,l,mid,tag[x][i],i);
		M(rs,mid+1,r,tag[x][i],i);
		tag[x][i]=-1;
	}
}
void U(int x){
	rep(i,0,1)sum[x][i]=(sum[ls][i]+sum[rs][i])%mod;
}
void M(int x,int l,int r,int ll,int rr,int num,int id){
	if(l==ll&&r==rr){
		M(x,l,r,num,id);
		return;
	}
	PD(x,l,r);
	if(rr<=mid)M(ls,l,mid,ll,rr,num,id);
	else if(ll>mid)M(rs,mid+1,r,ll,rr,num,id);
	else M(ls,l,mid,ll,mid,num,id),M(rs,mid+1,r,mid+1,rr,num,id);
	U(x);
}
int Q(int x,int l,int r,int ll,int rr,int id){
	if(l==ll&&r==rr)return sum[x][id];
	PD(x,l,r);
	if(rr<=mid)return Q(ls,l,mid,ll,rr,id);
	else if(ll>mid)return Q(rs,mid+1,r,ll,rr,id);
	else return (Q(ls,l,mid,ll,mid,id)+Q(rs,mid+1,r,mid+1,rr,id))%mod;
}
int main(){
	memset(tag,-1,sizeof tag);
	read(n);
	read(A);read(B);
	rep(i,1,n)read(x[i]);
	x[0]=-1e18;
	M(1,0,n,0,0,1,0);
	M(1,0,n,0,0,1,1);
	rep(i,1,n-1){
		ll mind=x[i+1]-(B-1);
		int pos=min(i-1,lower_bound(x,x+n+1,mind)-x-1);
		M(1,0,n,i,i,Q(1,0,n,0,pos,0),1);
		if(x[i+1]-x[i]<A)M(1,0,n,0,i-1,0,0);
		
		mind=x[i+1]-(A-1);
		pos=min(i-1,lower_bound(x,x+n+1,mind)-x-1);
		M(1,0,n,i,i,Q(1,0,n,0,pos,1),0);
		if(x[i+1]-x[i]<B)M(1,0,n,0,i-1,0,1);
	}
	printf("%d\n",(Q(1,0,n,0,n-1,0)+Q(1,0,n,0,n-1,1))%mod);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:28: error: no matching function for call to 'min(int, long int)'
   70 |                 int pos=min(i-1,lower_bound(x,x+n+1,mind)-x-1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:70:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   70 |                 int pos=min(i-1,lower_bound(x,x+n+1,mind)-x-1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:70:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   70 |                 int pos=min(i-1,lower_bound(x,x+n+1,mind)-x-1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:75:24: error: no matching function for call to 'min(int, long int)'
   75 |                 pos=min(i-1,lower_bound(x,x+n+1,mind)-x-1);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:75:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   75 |                 pos=min(i-1,lower_bound(x,x+n+1,mind)-x-1);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:75:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   75 |                 pos=min(i-1,lower_bound(x,x+n+1,mind)-x-1);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~