#include #include #include using namespace std; #define ll long long #define N 200005 int T,n,m,t,s; ll l,r,ans; ll a[N],b[N]; ll shit(ll x,ll y){ x=max(x,l);y=min(y,r); if(x>y)return 0; return y-x+1; } ll fuck(int i){ if (i==1) return shit(l,min(b[1],a[1])); if (i==2) return shit(a[1]+1,min(b[1],a[2])); if (i==n) return shit(max(a[n-1]+a[n-2],a[n-1]+1),min(a[n]-a[n-1],a[n])); if (i==n+1) return shit(max(a[n-1]+a[n],a[n]+1),r); return shit(max(a[i-2]+a[i-1],a[i-1]+1),min(b[i-1],a[i])); } int main(){ scanf("%d",&T); while (T--) { scanf("%d%I64d%I64d",&n,&l,&r); for (int i=1;i<=n;i++) scanf("%I64d",&a[i]); sort(a+1,a+n+1); b[n-1]=a[n]-a[n-1]; for (int i=n-2;i;i--)b[i]=min(b[i+1],a[i+1]-a[i]); ans=0; if (n==2){ ans+=fuck(1)+fuck(3); ans+=shit(a[1]+1,min(a[2]-a[1],a[2])); printf("%I64d\n",ans); continue; } for (int i=1;i<=n+1;i++) ans+=fuck(i); printf("%I64d\n",ans); } }