stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < n; i++)

#define REPR(i, n) for(int i = n; i >= 0; i--)

#define FOR(i, m, n) for(int i = m; i < n; i++)

#define FORR(i ,m, n) for(int i = m; i >= n; i--)

#define pb(a) push_back(a)

#define mk(a,b) make_pair(a,b)

#define ll long long

#define INF 999999999

#define IOS cin.tie(0); ios::sync_with_stdio(false)

using namespace std;

typedef pair<int, int> P;

typedef pair<int, P> PP;

typedef pair<ll,ll> LP;

typedef pair<ll,LP> LPP;



int dy[] = {0, 0, 1, -1};

int dx[] = {1, -1, 0, 0};

int gcd(int a,int b){return b ? gcd(b,a%b) : a;}

int lcm(int a,int b){return a/gcd(a,b)*b;}



int main() {

    

    int N; cin >> N;

    vector<int> T; vector<int> b; int count=0;

    vector<int> A(200020);

    for(int i=0;i<N;i++){

        int a; cin >> a;

        T.push_back(a);

    }

    

    for(int i=N-1;i>=0;i--){

        if(T[i]==A[i+1]%2);

        else{

            for(int j=1;j*j <= i+1;j++){

                if((i+1)%j==0){

                    A[j]++;

                    if(j*j != i+1)A[(i+1)/j]++;

                }

            }

            b.push_back(i+1); count++;

        }

    }

    reverse(b.begin(),b.end());

    cout << count << endl;

    for(int i=0;i<b.size();i++)

    cout << b[i] << " " << flush;

    if(b.size()!=0)cout << endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <algorithm>

#include <vector>

#include <iomanip>

#include <math.h>

#include <complex>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <unordered_map>

#include <set>

#include <bitset>

#include <functional>

#include <assert.h>

using ll=long long;

#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)

#define rep(i,b) rng(i,0,b)

#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)

#define per(i,b) gnr(i,0,b)

#define eb emplace_back

#define all(x) x.begin(),x.end()

#define SZ(x) ((int)x.size())

#define fi first

#define se second

const int INF = 1e15;

using namespace std;



template<class T> using vc=vector<T>;

template<class T> using vvc=vc<vc<T>>;



using pi=pair<int,int>;

using vi=vc<int>;



template<class T>

inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}

template<class T>

inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}



signed main() {

    cin.tie(0);

    ios::sync_with_stdio(0);

    cout<<fixed<<setprecision(20);



    int N; cin >> N;

    int A[N];

    rep(i,N) cin >> A[i];

    int B[N];

    vi ans;

    per(i,N){

        int cnt=0;

        int pos=2*(i+1);

        while(N>=pos){

            cnt+=B[pos-1];

            pos+=i+1;

        }

        cnt%=2;

        B[i]=cnt^A[i];

        if(cnt^A[i]) ans.eb(i+1);

    }

    cout << ans.size() << endl;

    for(auto a:ans){

        cout << a << " ";

    }

    cout << endl;



}


// Fastest known solution for this problem:
// Original C++ solution (slower):
// ABC134-D

#include <bits/stdc++.h>

#define endl "\n"

#define rep(i,n) for(int i=0;i<int(n);i++)

#define SZ(x) ((int)(x).size())

#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long ll;

typedef long double ld;

typedef pair<int,int> ipair;

typedef pair<ll,ll> lpair;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る

{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る

void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る



vector<int> a(200010,0);

vector<int> c(200010,0); 

vector<bool> sh(200010,false); //ボールを入れる

int ball=0;

int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    cout << fixed << setprecision(12);



    int n;

    cin>>n;

    rep(i,n) cin>>a[i+1];

    for(int i=n;i>=1;i=i-1){

        if(c[i]%2!=a[i]){

            ball++;

            sh[i]=true;

            for(int j=1;j*j<=i;j++){

                if(i%j==0){

                    c[j]++;

                    if(j*j!=i) c[i/j]++;

                }

            }

        }

    }

    cout<<ball<<endl;

    if(ball!=0){

        rep(i,n){

            if(sh[i+1]) cout<<i+1<<" ";

        }

        cout<<endl;

    }

    return 0;

}

// Optimized solution to the same problem (faster):
// ABC134-D

#include <bits/stdc++.h>

#define endl "\n"

#define rep(i,n) for(int i=0;i<int(n);i++)

#define SZ(x) ((int)(x).size())

#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long ll;

typedef long double ld;

typedef pair<int,int> ipair;

typedef pair<ll,ll> lpair;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る

{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る

void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る



vector<bool> sh(200010,false);

vector<int> a(200010,0);

int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    cout << fixed << setprecision(12);



    int n;

    cin>>n;

    int ball=0;

    for(int i=1;i<=n;i++) cin>>a[i];

    for(int i=n;i>=1;i=i-1){

        int j=i;

        int baisu=0;

        while(j<=n){

            if(sh[j]) baisu++;

            j+=i;

        }

        if(baisu%2!=a[i]) sh[i]=true,ball++;

    }

    cout<<ball<<endl;

    if(ball!=0){

        for(int i=1;i<=n;i++){

            if(sh[i]) cout<<i<<" ";

        }

        cout<<endl;

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define maxn 200005

using namespace std;



int arr[maxn], box[maxn];

vector<int> ans;

int n;



int main() {

    scanf("%d", &n);

    for(int i = 1; i <= n; i++) {

        scanf("%d", arr + i);

    }

    ans.clear();

    memset(box, 0, sizeof(box));

    for(int i = n; i > 0; i--) {

        int sum = 0;

        for(int j = i + i; j <= n; j += i) {

            sum += box[j];

        }

        if(sum % 2 != arr[i]) box[i] = 1;

        if(box[i]) ans.push_back(i);

    }

    printf("%d\n", (int)ans.size());

    for(int i = 0; i < (int)ans.size(); i++) {

        printf("%d%c", ans[i], " \n"[i == (int)ans.size() - 1]);

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std ;







int main(){

    bool v[200100] ;

    int n,z ;

    cin >> n ;

    for(int i=0 ; i<n ; i++){

        cin >> v[i] ;

    }

    for(int i=n-1 ; i>0 ; i--){

        if(v[i] == 1){

         // here

         z = i +1 ;

             for (int j=1; j<=sqrt(z); j++)

                {

                    if (z%j == 0)

                    {

                        // If divisors are equal, print only one

                        if (z/j == j)

                            //printf("%d ", i);

                            v[j-1] = -1*(v[j-1]) +1 ;



                        else {

                             v[j-1] = -1*(v[j-1]) +1 ;

                             v[(z/j)-1] = -1*(v[(z/j)-1]) +1 ;

                        }// Otherwise print both

                            //printf("%d %d ", i, n/i);

                    }

                }



          // end

          v[i] = 1 ;

        }







    }

    int ans =0 ;

    for(int i=0 ; i<n ; i++){

        if(v[i] == 1){

            ans ++ ;

        }

    }

    cout << ans << endl ;

    if(ans != 0){

        for(int i=0 ; i<n ; i++){

            if(v[i] == 1){

                cout << i+1 << " " ;

            }

        }

    }



    return 0 ;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define MAX_N 200000 + 1

using namespace std;



int N, number[MAX_N], ans[MAX_N];



bool check(){

	for(int i = 1; i <= N; i++){

		int cnt = 0;

		for(int j = i; j <= N; j += i)

			cnt += ans[j];

		cnt %= 2;

		if(cnt ^ number[i]) return false;

	}

	return true;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	

	while(cin >> N){

		for(int i = 1; i <= N; i++)

			cin >> number[i];

		

		for(int i = N; i > 0; i--){

			int cnt = 0;

			for(int j = i; j <= N; j += i)

				cnt += ans[j];

			cnt %= 2;

			ans[i] = cnt ^ number[i];

		}

		

		if(check()){

			int sum = 0;

			for(int i = 1; i <= N; i++)

				if(ans[i]) sum++;

			cout << sum << endl;

			if(sum){

				for(int i = 1; i <= N; i++)

					if(ans[i]) cout << i << " ";

				cout << endl;

			}

		}

		else

			cout << -1 << endl;

		

		memset(number, 0, sizeof(number));

		memset(ans, 0, sizeof(ans));

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std ;







int main(){

    bool v[200100] ;

    int n,z ;

    cin >> n ;

    for(int i=0 ; i<n ; i++){

        cin >> v[i] ;

    }

    for(int i=n-1 ; i>0 ; i--){

        if(v[i] == 1){

         // here

         z = i +1 ;

             for (int j=1; j<=sqrt(z); j++)

                {

                    if (z%j == 0)

                    {

                        // If divisors are equal, print only one

                        if (z/j == j)

                            //printf("%d ", i);

                            v[j-1] = -1*(v[j-1]) +1 ;



                        else {

                             v[j-1] = -1*(v[j-1]) +1 ;

                             v[(z/j)-1] = -1*(v[(z/j)-1]) +1 ;

                        }// Otherwise print both

                            //printf("%d %d ", i, n/i);

                    }

                }



          // end

          v[i] = 1 ;

        }







    }

    int ans =0 ;

    for(int i=0 ; i<n ; i++){

        if(v[i] == 1){

            ans ++ ;

        }

    }

    cout << ans << endl ;

    if(ans != 0){

        for(int i=0 ; i<n ; i++){

            if(v[i] == 1){

                cout << i+1 << " " ;

            }

        }

    }



    return 0 ;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using ll = long long;

using namespace std;

ll mod=1e9+7;



int main(){

  int N;

  ll a[300001];

  ll b[300001];

  int cnt(0);

  cin>>N;

  for (int i(1);i<=N;i++)cin>>b[i];

  for (int i(N/2+1);i<=N;i++){

    a[i]=b[i];

    if (a[i]==1)cnt+=1;

  }

  for (int i(N/2);i>0;i--){

    // a[i] is needed

    int sum(0);

    for (int j(i*2);j<=N;j+=i){

      sum+=a[j];

    }

    // cout <<sum << " " <<  b[i] << endl;

    if (sum%2==b[i]) a[i]=0;

    else {

      a[i]=1;

      cnt+=1;

    }

  }



  cout << cnt << endl;

  for (int i(1);i<=N;i++){

    if (a[i]==1){

      cout << i << endl;

    }

  }

  return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>



using ll = long long;

using namespace std;

const int INFint = 2e9+1;

const ll INFll = 2e18+1;

ll MOD=1e9+7;



int main(){

  int N;

  cin>>N;

  vector<int> A(N+1);

  for(int i(1);i<=N;i++) cin>>A[i];

  vector<int> ans(N+1);

  int cnt(0);

  for(int i(N);i>=1;i--){

    int tmp(i);

    int tmpi(0);

    while(N >= tmp){

      tmpi += ans[tmp];

      tmp += i;

    }

    //cout << tmpi << endl;

    if(A[i] != tmpi%2){

      ans[i] = 1;

      cnt++;

    }

    else ans[i] = 0;

  }

  cout << cnt << endl;

  for(int i(1);i<=N;i++){

    if(ans[i]) cout << i << " ";

  }

  cout << endl;

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using ll = long long;

using namespace std;

ll mod=1e9+7;



int main(){

  int N;

  ll a[300001];

  ll b[300001];

  int cnt(0);

  cin>>N;

  for (int i(1);i<=N;i++)cin>>b[i];

  // for (int i(N/2+1);i<=N;i++){

  //   a[i]=b[i];

  //   if (a[i]==1)cnt+=1;

  // }

  for (int i(N);i>0;i--){

    // a[i] is needed

    int sum(0);

    for (int j(i*2);j<=N;j+=i){

      sum+=a[j];

    }

    // cout <<sum << " " <<  b[i] << endl;

    if (sum%2==b[i]) a[i]=0;

    else {

      a[i]=1;

      cnt+=1;

    }

  }



  cout << cnt << endl;

  for (int i(1);i<=N;i++){

    if (a[i]==1){

      cout << i << endl;

    }

  }

  return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>



using ll = long long;

using namespace std;

const int INFint = 2e9+1;

const ll INFll = 2e18+1;

ll MOD=1e9+7;



int main(){

  int N;

  cin>>N;

  vector<int> A(N+1);

  for(int i(1);i<=N;i++) cin>>A[i];

  vector<int> ans(N+1);

  int cnt(0);

  for(int i(N);i>=1;i--){

    int tmp(i);

    int tmpi(0);

    while(N >= tmp){

      tmpi += ans[tmp];

      tmp += i;

    }

    //cout << tmpi << endl;

    if(A[i] != tmpi%2){

      ans[i] = 1;

      cnt++;

    }

    else ans[i] = 0;

  }

  cout << cnt << endl;

  for(int i(1);i<=N;i++){

    if(ans[i]) cout << i << " ";

  }

  cout << endl;

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#define fr first

#define sc second

#define mk make_pair

#define pb push_back

#define pf push_front

#define pii pair <int ,int>

#define all(s) s.begin (), s.end ()

#define int long long



using namespace std;



const int N = 1e5 + 5, mod = 1e9 + 7;



int n, a, b, dp[2][N], l = 1, ar[N], L[N];



main()

{

    cin >> n >> a >> b;



    if (a > b) swap(a, b);



    dp[0][1] = dp[1][1] = 1;



    for (int i = 1; i <= n; i++)

        scanf("%lld", &ar[i]);



    L[1] = 1;



    for (int i = 2; i <= n; i++)

    {

        if ( ar[i] - ar[i - 1] >= a )

            L[i] = L[i - 1];

        else

            L[i] = i;

    }

    ar[0] = -1e18;



    for (int i = 2; i <= n; i++)

    {

        if (ar[i] - ar[i - 1] >= a)

            dp[0][i] = (dp[0][i - 1] + dp[1][i - 1]) % mod;



        else if (ar[i] - ar[i - 2] >= a)

            dp[0][i] = dp[1][i - 1];



        else if (i > 2)

        {

            puts("0");

            return 0;

        }



        while (ar[i] - ar[l] >= b) l++;



        if (l == i)

            dp[1][i] = (dp[0][i - 1] + dp[1][i - 1]) % mod;



        else if ( L[i - 1] <= l)

            dp[1][i] = dp[0][l];

    }

    cout << ( dp[1][n] + dp[0][n] ) % mod;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

using namespace std;

const int MAXN=1010000;

const int MOD=1e9+7;

long long n,a,b;

long long c[MAXN];

long long f[MAXN],s[MAXN];

int main()

{

//	freopen("test.in","r",stdin);

//	freopen("test.out","w",stdout);

    scanf("%lld%lld%lld",&n,&a,&b);

    if(a>b)swap(a,b);

    for(int i=1;i<=n;i++)

    {

        scanf("%lld",&c[i]);

        if(i>2&&c[i]-c[i-2]<a)

        {

            printf("0");

            return 0;

        }

    }	

    f[0]=s[0]=1;

    for(int i=1,l=0,r=0;i<=n;i++)

    {

        while(i>1&&c[i]-c[r+1]>=b)r++;

        if(l<=r)

        {	

            f[i]=s[r];

            if(l!=0)f[i]=(f[i]+MOD-s[l-1])%MOD;

        }

        s[i]=(s[i-1]+f[i])%MOD;

        if(i>1&&c[i]-c[i-1]<a)l=i-1;

    }

    long long ans=0;

    for(int i=n;i>=0;i--)

    {

        ans=(ans+f[i])%MOD;

        if(i<n&&a>c[i+1]-c[i])break;

    }

    printf("%lld",ans);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstdlib>

#include<cstring>

using namespace std;

int n;

long long a,b;

long long e[100010];

int lsta[100010],lstb[100010];

long long dp1[100010],dp2[100010];

const long long md=1e9+7;

int lst1,lst2;

void pls(long long& x,long long y)

{

	x+=y;

	if(x>md)x-=md;

}

int main()

{

	scanf("%d%lld%lld",&n,&a,&b);

	for(int i=1;i<=n;i++)

	{

		scanf("%lld",e+i);

	}

	for(int i=2;i<=n;i++)

	{

		for(lsta[i]=lsta[i-1];e[lsta[i]+1]+a<=e[i];lsta[i]++);

		for(lstb[i]=lstb[i-1];e[lstb[i]+1]+b<=e[i];lstb[i]++);

	}

	dp1[0]=dp2[0]=1;

	for(int i=2;i<=n;i++)

	{

		long long ax=dp2[min(i-2,lsta[i])],ay=dp1[min(i-2,lstb[i])];

		if(lsta[i]!=i-1)

		{

			for(int j=lst1;j<=i-2;j++)dp1[j]=0;

			lst1=i-1;

		}

		if(lstb[i]!=i-1)

		{

			for(int j=lst2;j<=i-2;j++)dp2[j]=0;

			lst2=i-1;

		}

		pls(dp1[i-1],ax+dp1[i-2]);

		pls(dp2[i-1],ay+dp2[i-2]);

	}

	long long ans=(dp1[n-1]+dp2[n-1])%md;

	printf("%lld",ans);

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

using namespace std;

const int MAXN=1010000;

const int MOD=1e9+7;

long long n,a,b;

long long c[MAXN];

long long f[MAXN],s[MAXN];

int main()

{

//	freopen("test.in","r",stdin);

//	freopen("test.out","w",stdout);

    scanf("%lld%lld%lld",&n,&a,&b);

    if(a>b)swap(a,b);

    for(int i=1;i<=n;i++)

    {

        scanf("%lld",&c[i]);

        if(i>2&&c[i]-c[i-2]<a)

        {

            printf("0");

            return 0;

        }

    }	

    f[0]=s[0]=1;

    for(int i=1,l=0,r=0;i<=n;i++)

    {

        while(i>1&&c[i]-c[r+1]>=b)r++;

        if(l<=r)

        {	

            f[i]=s[r];

            if(l!=0)f[i]=(f[i]+MOD-s[l-1])%MOD;

        }

        s[i]=(s[i-1]+f[i])%MOD;

        if(i>1&&c[i]-c[i-1]<a)l=i-1;

    }

    long long ans=0;

    for(int i=n;i>=0;i--)

    {

        ans=(ans+f[i])%MOD;

        if(i<n&&a>c[i+1]-c[i])break;

    }

    printf("%lld",ans);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cmath>

#include<cstring>

#include<cstdlib>

#include<algorithm>

#define ll long long

using namespace std;



const int mod=1000000007;

const int N=100005;



int n,k,l,r,ans;

ll x,y;

int dp1[N],dp2[N],f[2][N],p1[N],p2[N];

ll a[N];



void add(bool b,int x,int y){

	for (;x<=n+2;x+=x&-x){

		f[b][x]+=y;

		(f[b][x]>=mod)?f[b][x]-=mod:0;

	}

}



int query(bool b,int x){

	int s=0;

	for (;x;x-=x&-x){

		s+=f[b][x];

		(s>=mod)?s-=mod:0;

	}

	return s;

}



int ask(bool b,int x,int y){

	int s;

	if (x>y) return 0;

	s=(query(b,y)-query(b,x-1)+mod)%mod;

	return s;

}



int main(){

	scanf("%d%lld%lld",&n,&x,&y);

	if (x>y) swap(x,y);

	for (int i=1;i<=n;i++) scanf("%lld",&a[i]);

	l=r=n;

	for (int i=n;i>=1;i--){

		if (a[i+1]-a[i]<x) l=i;

		if (a[i+1]-a[i]<y) r=i;

		p1[i]=l;

		p2[i]=r;

	}

	for (int i=n;i>1;i--){

		if (p2[i]==n) dp1[i]=1;

		if (p1[i]==n) dp2[i]=1;

		

		l=lower_bound(a+1,a+1+n,a[i-1]+x)-a; l=max(l,i+1);

		r=p2[i]+1;

		dp1[i]+=ask(1,l,r);

		(dp1[i]>=mod)?dp1[i]-=mod:0;

		

		l=lower_bound(a+1,a+1+n,a[i-1]+y)-a; l=max(l,i+1);

		r=p1[i]+1;

		dp2[i]+=ask(0,l,r);

		(dp2[i]>=mod)?dp2[i]-=mod:0;

		

		add(0,i,dp1[i]);

		add(1,i,dp2[i]);

		if (p1[1]>=i-1) ans+=dp1[i];

		(ans>=mod)?ans-=mod:0;

		if (p2[1]>=i-1) ans+=dp2[i];

		(ans>=mod)?ans-=mod:0;

	}

	if (p1[1]==n) ans++;

	if (p2[1]==n) ans++;

	ans%=mod;

	printf("%d\n",ans);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

const int MAXN=100005,MOD=1000000007;

const long long LLF=0x3F3F3F3F3F3F3F3FLL;



int N;

long long A,B,S[MAXN];

int f[MAXN],sum[MAXN];



int main()

{

	scanf("%d%lld%lld",&N,&A,&B);

	for(int i=1;i<=N;i++)

		scanf("%lld",&S[i]);

	if(A>B)

		swap(A,B);

	for(int i=3;i<=N;i++)

		if(S[i]-S[i-2]<A)

		{

			puts("0");

			return 0;

		}

	S[N+1]=LLF;

	

	f[0]=sum[0]=1;

	int l=0,r=0;

	for(int i=1;i<=N+1;i++)

	{

		while(r<i-1&&S[i]-S[r+1]>=B)

			r++;

		if(l<=r)

			(f[i]+=(sum[r]-(l==0?0:sum[l-1])+MOD)%MOD)%=MOD;

		sum[i]=(sum[i-1]+f[i])%MOD;

		if(i!=1&&S[i]-S[i-1]<A)

			l=i-1;

	}

	printf("%d\n",f[N+1]);

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cmath>

#include<math.h>

#include<ctype.h>

#include<algorithm>

#include<bitset>

#include<cassert>

#include<cctype>

#include<cerrno>

#include<cfloat>

#include<ciso646>

#include<climits>

#include<clocale>

#include<complex>

#include<csetjmp>

#include<csignal>

#include<cstdarg>

#include<cstddef>

#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<ctime>

#include<cwchar>

#include<cwctype>

#include<deque>

#include<exception>

#include<fstream>

#include<functional>

#include<iomanip>

#include<ios>

#include<iosfwd>

#include<iostream>

#include<istream>

#include<iterator>

#include<limits>

#include<list>

#include<locale>

#include<map>

#include<memory>

#include<new>

#include<numeric>

#include<ostream>

#include<queue>

#include<set>

#include<sstream>

#include<stack>

#include<stdexcept>

#include<streambuf>

#include<string>

#include<typeinfo>

#include<utility>

#include<valarray>

#include<vector>

#include<string.h>

#include<stdlib.h>

#include<stdio.h>

using namespace std;

const int Mod=1000000007;

int n,pa[100010],pb[100010],fx[100010],fy[100010];

long long a,b,s[100010],px,py,xi,yi;

int main()

{

	scanf("%d%lld%lld",&n,&a,&b);

	if (a<=b)

	{

		swap(a,b);

	}

	for (int i=1;i<=n;i++)

	{

		scanf("%lld",&s[i]);

	}

	fx[0]=fy[0]=1;

	int sa,sb;

	sa=sb=1;

	for (int i=1;i<=n;i++)

	{

		while (s[sa]+a<=s[i])

		{

			sa++;

		}

		while (s[sb]+b<=s[i])

		{

			sb++;

		}

		pa[i]=sa-1;

		pb[i]=sb-1;

	}

	for (int i=2;i<=n;i++)

	{

		xi=fy[min(i-2,pa[i])];

		yi=fx[min(i-2,pb[i])];

		if (pa[i]<i-1)

		{

			memset(fx+px,0,i-px-1<<2);

			px=i-1;

		}

		if (pb[i]<i-1)

		{

			memset(fy+py,0,i-py-1<<2);

			py=i-1;

		}

		fx[i-1]=(fx[i-1]+fx[i-2]+xi)%Mod;

		fy[i-1]=(fy[i-1]+fy[i-2]+yi)%Mod;

	}

	printf("%d\n",(fx[n-1]+fy[n-1])%Mod);

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

const int MAXN=100005,MOD=1000000007;

const long long LLF=0x3F3F3F3F3F3F3F3FLL;



int N;

long long A,B,S[MAXN];

int f[MAXN],sum[MAXN];



int main()

{

	scanf("%d%lld%lld",&N,&A,&B);

	for(int i=1;i<=N;i++)

		scanf("%lld",&S[i]);

	if(A>B)

		swap(A,B);

	for(int i=3;i<=N;i++)

		if(S[i]-S[i-2]<A)

		{

			puts("0");

			return 0;

		}

	S[N+1]=LLF;

	

	f[0]=sum[0]=1;

	int l=0,r=0;

	for(int i=1;i<=N+1;i++)

	{

		while(r<i-1&&S[i]-S[r+1]>=B)

			r++;

		if(l<=r)

			(f[i]+=(sum[r]-(l==0?0:sum[l-1])+MOD)%MOD)%=MOD;

		sum[i]=(sum[i-1]+f[i])%MOD;

		if(i!=1&&S[i]-S[i-1]<A)

			l=i-1;

	}

	printf("%d\n",f[N+1]);

	

	return 0;

}


// Fastest known solution for this problem: