Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7, inf = 2e18;
ll n, a, b, x[100005], za, zb;
vector<ll> ca, cb;

ll getA (ll X) {
	if(X < za) return 0;
	if(za) return (ca[X] - ca[za-1] + mod) % mod;
	return ca[X];
}

ll getB (ll X) {
	if(X < zb) return 0;
	if(zb) return (cb[X] - cb[zb-1] + mod) % mod;
	return cb[X];
}

int main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	for(int i=1;i<=n;i++) {
		scanf("%lld",&x[i]);
	}
	x[0] = -inf;
	ca.push_back(1);
	cb.push_back(1);
	for(int i=2;i<=n;i++) {
		ll fa = min(upper_bound(x, x+n+1, x[i]-a) - x - 1, i - 2ll);
		ll fb = min(upper_bound(x, x+n+1, x[i]-b) - x - 1, i - 2ll);
		ca.push_back((getB(fb)+ca.back())%mod);
		cb.push_back((getA(fa)+cb.back())%mod);
		if(x[i-1] + a > x[i]) zb = i-1;
		if(x[i-1] + b > x[i]) za = i-1;
	}
	printf("%lld\n",(getA(n-1)+getB(n-1)) % mod);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:28: error: no matching function for call to 'min(long int, long long int)'
   30 |                 ll fa = min(upper_bound(x, x+n+1, x[i]-a) - x - 1, i - 2ll);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:30:28: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   30 |                 ll fa = min(upper_bound(x, x+n+1, x[i]-a) - x - 1, i - 2ll);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:30:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   30 |                 ll fa = min(upper_bound(x, x+n+1, x[i]-a) - x - 1, i - 2ll);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:28: error: no matching function for call to 'min(long int, long long int)'
   31 |                 ll fb = min(upper_bound(x, x+n+1, x[i]-b) - x - 1, i - 2ll);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:31:28: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   31 |                 ll fb = min(upper_bound(x, x+n+1, x[i]-b) - x - 1, i - 2ll);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:31:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   31 |                 ll fb = min(upper_bound(x, x+n+1, x[i]-b) - x - 1, i - 2ll);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~