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

#include <cstdio>

#include <algorithm>

#define IsDigit(x) ((x) >= '0' && (x) <= '9')

#define LowBit(x) ((x) & -(x))

using namespace std;



int n, m;

int tree[100002];

struct Interval{

	int l, r;

	Interval() {}

	Interval(int x, int y)

		: l(x), r(y)

	{}

	bool operator<(const Interval &x) const{ return r - l < x.r - x.l; }

}sou[300000];





int Read(void)

{

	int c, ret(0);

	

	c = getchar();

	while (!IsDigit(c))

		c = getchar();

	do

		ret = ret * 10 + c - '0';

	while ((c = getchar()) && IsDigit(c));

	return ret;

}





void Add(const int val, int pos)

{

	while (pos <= m + 1) {

		tree[pos] += val;

		pos += LowBit(pos);

	}

	return;

}





int Sum(int pos)

{

	int ret(0);

	

	while (pos) {

		ret += tree[pos];

		pos -= LowBit(pos);

	}

	return ret;

}





int main()

{

	int l, r, pos(0), ans;

	

	n = Read();

	m = Read();

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

		l = Read();

		r = Read();

		sou[i] = Interval(l, r);

	}

	sort(sou, sou + n);

	for (int step = 1; step <= m; ++step) {

		while (pos < n && sou[pos].r - sou[pos].l + 1 < step) {

			Add(1, sou[pos].l);

			Add(-1, sou[pos].r + 1);

			++pos;

		}

		ans = n - pos;

		for (int i = step; i <= m; i += step)

			ans += Sum(i);

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

	}

	return 0;

}




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

#include<cctype>

#include<algorithm>

const int N=300007,M=100007;

int read(){int x=0,c=getchar();while(!isdigit(c))c=getchar();while(isdigit(c))x=x*10+c-48,c=getchar();return x;}

struct node{int l,r;}a[N];

int n,m,ans[M],t[M];

void add(int p,int v){for(;p<=m;p+=p&-p)t[p]+=v;}

void upd(int l,int r){add(l,1);if(r<m)add(r+1,-1);}

int ask(int p){int s=0;for(;p;p^=p&-p)s+=t[p];return s;}

int main()

{

    n=read(),m=read();

    for(int i=1;i<=n;++i) a[i].l=read(),a[i].r=read();

    std::sort(a+1,a+n+1,[](node&a,node&b){return a.r-a.l<b.r-b.l;});

    for(int i=1,p=1,s;i<=m;++i)

    {

	for(s=0;p<=n&&a[p].r-a[p].l<i;++p) upd(a[p].l,a[p].r);

	for(int j=i;j<=m;j+=i) s+=ask(j);

	printf("%d\n",n-p+1+s);

    }

}


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

using namespace std;

#define N 500007

#define ll long long

int sum[N],n,m;

struct str

{

    int l,r,d;

}p[N];

bool operator <(str a,str b)

{

    return a.d<b.d;

}

void add(int x,int d)

{

    if(!x)return;

    for(;x<=m;x+=x&-x)

	sum[x]+=d;

}

void mody(int l,int r,int d)

{

    add(l,d),add(r+1,-d);

}

int query(int x)

{

    int ans=0;

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

	ans+=sum[x];

    return ans;

}

int main()

{

    scanf("%d%d",&n,&m);

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

	scanf("%d%d",&p[i].l,&p[i].r),p[i].d=p[i].r-p[i].l;

    sort(p+1,p+n+1);

    int j=1;

    for(int d=1;d<=m;d++)

    {

	while(j<=n&&p[j].d<d)mody(p[j].l,p[j].r,1),j++;

	int ans=n-j+1;

	for(int i=d;i<=m;i+=d)

	    ans+=query(i);

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

    }

    return 0;

}


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

#include<cctype>

#include<algorithm>

const int N=300007,M=100007;

int read(){int x=0,c=getchar();while(!isdigit(c))c=getchar();while(isdigit(c))x=x*10+c-48,c=getchar();return x;}

struct node{int l,r;}a[N];

int n,m,ans[M],t[M];

void add(int p,int v){for(;p<=m;p+=p&-p)t[p]+=v;}

void upd(int l,int r){add(l,1);if(r<m)add(r+1,-1);}

int ask(int p){int s=0;for(;p;p^=p&-p)s+=t[p];return s;}

int main()

{

    n=read(),m=read();

    for(int i=1;i<=n;++i) a[i].l=read(),a[i].r=read();

    std::sort(a+1,a+n+1,[](node&a,node&b){return a.r-a.l<b.r-b.l;});

    for(int i=1,p=1,s;i<=m;++i)

    {

	for(s=0;p<=n&&a[p].r-a[p].l<i;++p) upd(a[p].l,a[p].r);

	for(int j=i;j<=m;j+=i) s+=ask(j);

	printf("%d\n",n-p+1+s);

    }

}


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

#include <cstdio>

#include <algorithm>

#include <iostream>

#include <cstring>

#include <limits>

#include <map>

#include <vector>

#include <queue> 

#define LL long long

#define ft first

#define sd second

#define mp(x,y) make_pair(x,y)

//#define int LL

using namespace std;

const int N   = 3e5+10;

//const int mod = ;

const int INF =numeric_limits<int >::max();



#define rep(i,x,y) for (int i=x;i<=y;++i)

void read(int &x)

{

	x=0;

	char ch=getchar();

	int f=1;

	while (!isdigit(ch)) (ch=='-'?f=-1:0),ch=getchar();

	while ( isdigit(ch)) x=x*10+ch-'0',ch=getchar();

	x*=f;

}

int buf[30];

void write(int x)

{

    if (x<0) putchar('-'),x=-x;

    buf[0]=0;

    while (x) buf[++buf[0]]=x%10,x/=10;

    if (!buf[0]) buf[0]=1,buf[1]=0;

    while (buf[0]) putchar('0'+buf[buf[0]--]);

}



int n,m,l[N],r[N];

int cnt[N];

void wk(int L,int R)

{

	for (int k=1;k<=m;)

	{

		int b=(L-1)/k;

		int c=L-1-k*b;

		int len=b?(c/b+1):100000;

		++cnt[k];--cnt[min(R/(b+1),k+len-1)+1];

		k+=len;		

	}

	return ;

}



signed main()

{

	

	read(n);read(m);

	rep(i,1,n) read(l[i]),read(r[i]);

	rep(i,1,n) wk(l[i],r[i]);

	rep(i,1,m) cnt[i]+=cnt[i-1];

	rep(i,1,m) write(cnt[i]),putchar('\n');

	return 0;

}

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

#include <algorithm>

using namespace std;

#define N 2000000

#define M 100050

int n,m,i,j,c[M],b[M];

struct lwn{

	int l,r,opt;

	bool operator < (const lwn &jb)const{

		return r<jb.r||r==jb.r&&opt<jb.opt;

	}

} a[N];

inline int rd()

{

	char ch=getchar();int ret=0;

	while (ch<'0' || ch>'9') ch=getchar();

	while (ch>='0' && ch<='9') ret=(ret<<3)+(ret<<1)+ch-'0',ch=getchar();

	return ret;

}

int main()

{

	n=rd();m=rd();int q=n;

	for (i=1;i<=n;i++) a[i].l=rd(),a[i].r=rd();

	for (i=1;i<=m;i++)

	for (j=0;j<=m/i;j++) n++,a[n].l=i*j,a[n].r=min(i*(j+1)-1,m),a[n].opt=i;

	sort(a+1,a+n+1);int psz=0;

	for (i=1;i<=n;i++) if (a[i].opt){

		int tot=0;

		for (j=a[i].l;j>=1;j-=(j&(-j))) tot+=c[j];

		b[a[i].opt]+=psz-tot;

	}else{

		psz++;

		for (j=a[i].l;j<=m;j+=(j&(-j))) c[j]++;

	}

	for (i=1;i<=m;i++) printf("%d\n",q-b[i]);

	return 0;

}

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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int N=300005,M=100005;

int n,m;

struct Node

{

    int l,r,len;

}a[N];

bool cmp(Node x,Node y)

{

    return x.len<y.len;

}

struct Binary_Indexed_Tree

{

    int tree[M];

    Binary_Indexed_Tree()

    {

        memset(tree,0,sizeof(tree));

        return;

    }

    int lowbit(int x)

    {

        return x&-x;

    }

    void add(int x,int y)

    {

        if(x==0) return;

        for(int i=x;i<=m;i+=lowbit(i))

            tree[i]+=y;

        return;

    }

    void add(int a,int b,int val)

    {

        if(a>b) return;

        add(a,val);

        add(b+1,-val);

        return;

    }

    int getsum(int x)

    {

        int res=0;

        for(int i=x;i>0;i-=lowbit(i))

            res+=tree[i];

        return res;

    }

}T;

int main()

{

    scanf("%d%d",&n,&m);

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

    {

        scanf("%d%d",&a[i].l,&a[i].r);

        a[i].len=a[i].r-a[i].l+1;

    }

    sort(a+1,a+n+1,cmp);

    int j=1;

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

    {

        while(j<=n&&a[j].len<i)

        {

            T.add(a[j].l,a[j].r,1);

            j++;

        }

        int ans=n-j+1;

        for(int k=i;k<=m;k+=i)

            ans+=T.getsum(k);

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

    }

    return 0;

}


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

using namespace std;



const int N=310000;

int n,m,tr[N],Ans[N];

struct suv 

{

	int l,r;

	bool operator < (const suv& tp) const

	{

		return r-l<tp.r-tp.l;

	}

}p[N];



void Add(int x,int s)

{

	while(x<=m+1) tr[x]+=s, x+=(x&(-x));

}



int Query(int x)

{

	int ret=0;

	while(x) ret+=tr[x], x-=(x&(-x));

	return ret;

}



int main()

{

	scanf("%d%d",&n,&m);

	for(int i=1;i<=n;++i) scanf("%d%d",&p[i].l,&p[i].r), ++p[i].l, ++p[i].r;

	sort(p+1,p+n+1);

	for(int i=1;i<=n;++i) Add(p[i].l,1), Add(p[i].r+1,-1);

	for(int d=m,cur=n;d>=1;--d)

	{

		while(p[cur].r-p[cur].l+1>=d && cur) Add(p[cur].l,-1), Add(p[cur--].r+1,1);

		Ans[d]=n-cur;// cout<<Ans[d]<<endl;

		for(int i=0;i*d<=m;++i)

			Ans[d] += Query(i*d+1);

	}

	for(int i=1;i<=m;++i) printf("%d\n",Ans[i]);

	return 0;

}

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

#include<cstring>

#include<vector>

#include<algorithm>

using namespace std;

int n,m,l[310000],r[310000],tree[110000];

vector<int> vec[110000];

void add(int x,int y){

    for (;x<=m;x+=x&-x) tree[x]+=y;

}

int getsum(int x){

    int sum=0;

    for (;x;x-=x&(-x)) sum+=tree[x];

    return sum;

}

int main(){

    scanf("%d%d",&n,&m);

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

        scanf("%d%d",&l[i],&r[i]);

        vec[r[i]-l[i]+1].push_back(i);

    }

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

        int ans=0;

        for (int j=0;j<(int)vec[i].size();j++)

            add(l[vec[i][j]],1),add(r[vec[i][j]]+1,-1);

        for (int j=i;j<=m;j+=i) ans+=getsum(j);

        n-=vec[i].size();

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

    }

    return 0;

}






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



using namespace std;

const int Nmax = 3e5 + 5;

struct line

{

    int l,r;

    bool operator < (const line &b) const

    {

        return r - l < b.r - b.l;

    }

};

line a[Nmax];

int ans[Nmax];

int cnt[Nmax];

int T[Nmax];

int n,m;



void update(int i, int val)

{

    while (i <= m)

    {

        T[i] += val;

        i += i & -i;

    }

}



int get(int i)

{

    int res = 0;

    while (i > 0)

    {

        res += T[i];

        i -= i & -i;

    }

    return res;

}



int main()

{

    //freopen("file.inp","r",stdin);

    cin >> n >> m;

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

    {

        cin >> a[i].l >> a[i].r;

    }

    sort(a + 1, a + n + 1);

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

    {

        ans[1]++;

        ans[a[i].r - a[i].l + 2]--;

    }

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

    {

        ans[i] += ans[i - 1];

    }

    int j = 1;

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

    {

        while (j <= n && a[j].r - a[j].l + 1 < i)

        {

            update(a[j].l, 1);

            update(a[j].r + 1, -1);

            j++;

        }

        for (int k = i; k <= m; k += i)

        {

            ans[i] += get(k);

        }

    }

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

    {

        cout << ans[i] << "\n";

    }

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
//© 2017 Jazengm/Zeng Xiangru, All Rights Reserved

#include<bits/stdc++.h>

using namespace std;



#define Re return

#define In inline

#define St static

#define Rg register

#define Op operator

#define Ct continue

#define inc(l, i, r) for(Rg int i=l; i<r; ++i)

#define dec(l, i, r) for(Rg int i=r; r>l; --i)

typedef long long ll;

typedef double db;



const int mxn = 3<<17;



int main()

{

    St int n, m;

    scanf("%d%d", &n, &m);

    St int c[mxn];

    inc(0, i, n)

    {

        St int l, r;

        scanf("%d%d", &l, &r), --l;

        for(Rg int i=1; i<=l;)

        {

            Rg int i_=min(l/(l/i), r/(r/i))+1;

            if(l/i!=r/i)

                ++c[i], --c[i_];

            i=i_;

        }

/*        for(Rg int i=1; i<=l;)

        {

            Rg int i_=r/(l/i+1), i__=l/(l/i)+1;

            if(i_>=i)

                ++c[i], --c[min(i_+1, i__)];

            i=i__;

        }*/

        ++c[l+1], --c[r+1];

    }

    Rg int ans=0;

    inc(1, i, m+1)

        printf("%d\n", ans+=c[i]);

    Re 0;

}


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

#include<algorithm>

#include<cstring>

using namespace std;

int sum[400005],lazy[400005],n,m;;

struct obj

{

    int l,r;

}p[300005];

bool cmp(obj x,obj y)

{

    return x.r-x.l<y.r-y.l;

}

void push_down(int k,int l,int r)

{

    if(l==r)

    {

        sum[k]+=lazy[k];

    }

    else

    {

        lazy[k<<1]+=lazy[k];

        lazy[k<<1|1]+=lazy[k];

        sum[k]+=lazy[k]*(r-l+1);

    }

    lazy[k]=0;

}

void change(int k,int l,int r,int x,int y,int w)

{

    if(l>=x&&r<=y)

    {

        lazy[k]+=w;

    }

    else

    {

        push_down(k,l,r);

        int mid=(l+r)>>1;

        if(y>=l&&x<=mid)

        {                 

            change(k<<1,l,mid,x,y,w);

        }             

        if(y>=mid+1&&x<=r)

        {                

            change(k<<1|1,mid+1,r,x,y,w);

    	}

    }

}

int query(int k,int l,int r,int x)

{

    push_down(k,l,r);

    if(l==r)

    {

        return sum[k];

    }

    int mid=(l+r)>>1;

    if(x<=mid)

    {

        return query(k<<1,l,mid,x);

    }

    return query(k<<1|1,mid+1,r,x);

}

int main()

{

    scanf("%d%d",&n,&m);

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

    {

        scanf("%d%d",&p[i].l,&p[i].r);

    }

    int i=0;

    sort(p,p+n,cmp);

    for(int d=1;d<=m;d++)

    {

        while(i<n&&p[i].r-p[i].l<d)

        {

            change(1,1,m,p[i].l,p[i].r,1);

            i++;

        }

        int ans=n-i;

        for(int k=d;k<=m;k+=d)

        {

            ans+=query(1,1,m,k);

        }

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

    }

    return 0;

}

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

#include<cstring>

#include<cstdio>

#include<algorithm>

#include<vector>

#define N 300010

#define gc getchar()

#define lb(x) (x&-x)

#define debug(x) cerr<<#x<<"="<<x

#define sp <<" "

#define ln <<endl

using namespace std;

inline int inn()

{

    int x,ch;while((ch=gc)<'0'||ch>'9');

    x=ch^'0';while((ch=gc)>='0'&&ch<='9')

        x=(x<<1)+(x<<3)+(ch^'0');return x;

}

int l[N],r[N],b[N],ans[N];vector<int> v[N];

inline int update(int x,int n,int v) { for(;x<=n;x+=lb(x)) b[x]+=v;return 0; }

inline int update(int x,int y,int n,int v) { return update(x,n,v),update(y+1,n,-v); }

inline int query(int x,int v=0) { for(;x;x-=lb(x)) v+=b[x];return v; }

int main()

{

    int n=inn(),m=inn();

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

        l[i]=inn(),r[i]=inn(),v[r[i]-l[i]+1].push_back(i);

    for(int d=1;d<=m;d++)

    {

        for(int i=d;i<=m;i+=d) ans[d]+=query(i);

        for(int i=0,id;i<(int)v[d].size();i++)

            id=v[d][i],update(l[id],r[id],m,1);

    }

    for(int d=m,cnt=0;d;d--)

        cnt+=(int)v[d].size(),ans[d]+=cnt;

    for(int i=1;i<=m;i++) printf("%d\n",ans[i]);

    return 0;

}

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

#include<algorithm>

#include<cstring>

using namespace std;

int sum[400005],lazy[400005],n,m;;

struct obj

{

    int l,r;

}p[300005];

bool cmp(obj x,obj y)

{

    return x.r-x.l<y.r-y.l;

}

void push_down(int k,int l,int r)

{

    if(l==r)

    {

        sum[k]+=lazy[k];

    }

    else

    {

        lazy[k<<1]+=lazy[k];

        lazy[k<<1|1]+=lazy[k];

        sum[k]+=lazy[k]*(r-l+1);

    }

    lazy[k]=0;

}

void change(int k,int l,int r,int x,int y,int w)

{

    if(l>=x&&r<=y)

    {

        lazy[k]+=w;

    }

    else

    {

        push_down(k,l,r);

        int mid=(l+r)>>1;

        if(y>=l&&x<=mid)

        {                 

            change(k<<1,l,mid,x,y,w);

        }             

        if(y>=mid+1&&x<=r)

        {                

            change(k<<1|1,mid+1,r,x,y,w);

    	}

    }

}

int query(int k,int l,int r,int x)

{

    push_down(k,l,r);

    if(l==r)

    {

        return sum[k];

    }

    int mid=(l+r)>>1;

    if(x<=mid)

    {

        return query(k<<1,l,mid,x);

    }

    return query(k<<1|1,mid+1,r,x);

}

int main()

{

    scanf("%d%d",&n,&m);

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

    {

        scanf("%d%d",&p[i].l,&p[i].r);

    }

    int i=0;

    sort(p,p+n,cmp);

    for(int d=1;d<=m;d++)

    {

        while(i<n&&p[i].r-p[i].l<d)

        {

            change(1,1,m,p[i].l,p[i].r,1);

            i++;

        }

        int ans=n-i;

        for(int k=d;k<=m;k+=d)

        {

            ans+=query(1,1,m,k);

        }

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

    }

    return 0;

}

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

#include<algorithm>

#include<vector>

#include<queue>

#include<unordered_map>

#include<unordered_set>

using namespace std;

typedef long long ll;

#define chmin(a,b) a=min(a,b)

#define chmax(a,b) a=max(a,b)

#define mod 1000000007

#define mad(a,b) a=(a+b)%mod;

#define mul(a,b) a=a*b%mod;

#define N 300010

#define M 100010

namespace bit{

    ll dat[N];

    void init(){

        for(int i=0;i<N;i++)dat[i]=0;

    }

    void add(ll i){

        for(;i<N;i+=i&-i){

            dat[i]++;

        }

    }

    ll sum(ll i){

        ll res=0;

        for(;i>0;i-=i&-i){

            res+=dat[i];

        }

        return res;

    }

}

vector<ll> v[2*M];

ll n,m;

ll ans[2*M];

int main(){

  cin>>n>>m;

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

      ll l,r; cin>>l>>r;

      v[r].push_back(l);

  }

  bit::init();

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

      vector<ll> di;

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

          if(i%j==0){

              di.push_back(j);

              if(j*j!=i){

                  di.push_back(i/j);

              }

          }

      }

      for(auto d:di){

          ans[d]+=bit::sum(i-1)-bit::sum(i-d);

          //cout<<"---"<<d<<" "<<ans[d]<<endl;

      }

      for(auto l:v[i]){

          bit::add(l);

      }

      //for(int j=1;j<=m;j++)cout<<bit::sum(j)<<" "; cout<<endl;

  }

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

      cout<<n-ans[i]<<endl;

  }

  return 0;

}


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

#include<algorithm>

#include<vector>

#include<queue>

#include<unordered_map>

#include<unordered_set>

using namespace std;

typedef long long ll;

#define chmin(a,b) a=min(a,b)

#define chmax(a,b) a=max(a,b)

#define mod 1000000007

#define mad(a,b) a=(a+b)%mod;

#define mul(a,b) a=a*b%mod;

#define N 200010

namespace bit{

  ll dat[N];

  void init(){

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

          dat[i]=0;

      }

  }

  void add(ll i,ll x){

      for(;i<N;i+=i&-i){

          dat[i]+=x;

      }

  }

  ll sum(ll i){

      ll res=0;

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

          res+=dat[i];

      }

      return res;

  }

};

ll n,m;

struct qry{

    ll l,r,id;

    bool operator<(const qry&key)const{

        if(this->r==key.r)return this->id<key.id;

        return this->r<key.r;

    }

};

ll ans[N];

int main(){

  cin>>n>>m;

  vector<qry> v;

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

      qry p;

      cin>>p.l>>p.r;

      p.id=0;

      v.push_back(p);

  }

  for(int d=1;d<=m;d++){

      ans[d]=n;

      for(int i=0;i<=m;i+=d){

          qry p;

          p.l=i,p.r=i+d-1;

          p.id=d;

          v.push_back(p);

      }

  }

  sort(v.begin(),v.end());

  bit::init();

  for(auto p:v){

      if(p.id==0){

          bit::add(p.l,+1);

      }

      else{

          ans[p.id]-=(bit::sum(p.r)-bit::sum(p.l));

      }

  }

  for(int d=1;d<=m;d++)cout<<ans[d]<<endl;

  return 0;

}




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

#include <vector>

#include <algorithm>

#include <string>



using namespace  std;

typedef long long int ll;

typedef pair<ll, ll> pll;



int main()

{

	ll N, A, B, C, D;

	cin >> N >> A >> B >> C >> D;



	vector<pll> area(N);

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

	{

		ll m = std::max((ll)0, 2 * C - (D - C)*(N - 2));

		ll l = (D - C)*(N - 1);

		ll max = D * (N - 1) - (m + l)*i;



		pll p(max, max - l);

		area[i] = p;

	}



	string ans = "NO";

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

	{

		if (area[i].first >= (B - A) && area[i].second <= (B - A))

		{

			ans = "YES";

			break;

		}

	}

	cout << ans << endl;

	return 0;

}

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



using namespace std;



typedef long long int ll;

typedef pair<ll, ll> pll;



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

#define REP(i, n) FOR(i,n,0)

#define OF64 std::setprecision(10)



const ll MOD = 1000000007;

const ll INF = (ll) 1e15;



int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    ll N, A, B, C, D;

    cin >> N >> A >> B >> C >> D;



    B = abs(B - A);

    ll u = D * (N - 1);

    ll d = C * (N - 1);

    REP(i, N) {

        if (d <= B && B <= u) {

            cout << "YES" << endl;

            return 0;

        }

        u -= (C + D);

        d -= (C + D);

    }

    cout << "NO" << endl;

    return 0;

}

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

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

#define per(i,n) for ((i)=n;(i)>=(1);(i)--)

using namespace std;

long long n,i,a,b,c,d,t,l,r;

int main()

{

	cin>>n>>a>>b>>c>>d;

	b-=a;n--;

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

	{

		t=c*i-c*(n-i);

		l=t-(d-c)*(n-i);

		r=t+(d-c)*i;

		if(l<=b&&b<=r)

		{

			puts("YES");

			return 0;

		}

	}

	puts("NO");

	return 0;

}

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

#include <algorithm>

#include <ctime>

using namespace std;



#define int long long



int n,a,b,c,d;



inline int read(){

	int s=0,t=1;

	char c=getchar();

	while((c<'0'||c>'9')&&c!='-')c=getchar(),t=-1;

	if(c=='-')c=getchar(),t=-1;

	while(c>='0'&&c<='9')s=(s<<1)+(s<<3)+(c^48),c=getchar();

	return s*t;

}



signed main(void){

	n=read();

	a=read();

	b=read();

	c=read();

	d=read();

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

		if(i*c-(n-1-i)*d<=b-a&&b-a<=i*d-(n-1-i)*c){

			printf("YES");

			return 0;

		}

	}

	printf("NO");

} 

// Fastest known solution for this problem: