#include #include #include #include #include #define LL long long #define pii pair #define xx first #define yy second using namespace std; const int N = 100100; LL a[N]; pii b[N]; int main () { // freopen ("in.txt", "r", stdin); int T; cin >> T; while (T--) { int n; LL l, r; cin >> n >> l >> r; l--; for (int i = 1; i<= n; i++) scanf ("%I64d", &a[i]); sort (a + 1, a + 1 + n); for (int i = 1; i < n; i++) { b[i] = pii (a[i + 1] - a[i] + 1, a[i + 1] + a[i] - 1); } sort (b + 1, b + n); LL nowl = 0, nowr = 0; LL sum = 0, resl = 0, resr = 0; for (int i = 1; i < n; i++) { // cout << b[i].xx << ' ' << b[i].yy << endl; if (b[i].xx <= nowr) { nowr = max (nowr, b[i].yy); } else { if (nowl <= l && l <= nowr) resl = sum + l - nowl + 1; if (nowl <= r && r <= nowr) resr = sum + r - nowl + 1; sum += nowr - nowl + 1; if (l > nowr && l < b[i].xx) resl = sum; if (r > nowr && r < b[i].xx) resr = sum; nowl = b[i].xx, nowr = b[i].yy; } } if (nowl <= l && l <= nowr) resl = sum + l - nowl + 1; if (nowl <= r && r <= nowr) resr = sum + r - nowl + 1; sum += nowr - nowl + 1; if (l > nowr) resl = sum; if (r > nowr) resr = sum; // if (l >= nowr) l = sum; // if (r >= nowr) r = sum; // cout << resl << ' ' << resr << endl; cout << r - l - (resr - resl) << endl; } }