Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
//******************************************************//
//*                AUTHOR: NAMAN OSTWAL                *//
//******************************************************//
//______________________________________________________________________________________________________//
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
long long int mod = 1e9+7;
const int N = 1e6+7;
vector<bool> isprime(N, true);

inline void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void print(vector<ll>&v) { for(auto it : v) cout<<it<<' '; }
void sort(vector < ll > &v) { sort(v.begin() , v.end()); }
void rsort(vector < ll > &v) { sort(v.begin() , v.end(), greater<int>()); }
ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) { return ((a % mod) + (b % mod) + mod) % mod; }
ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
ll lcm(ll a, ll b) { return ((a * b) / (__gcd(a,b))); }

ll bin_expo(ll a, ll b) {
    a %= mod;
    ll ans = 1;
    while (b > 0) {
        if (b & 1) {
            ans = (ans * a) % mod;
        }
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans % mod;
}

void sieve_of_eratosthenes() {
    isprime[0] = isprime[1] = false;
    for(int i = 2; i<=N; i++) {
        if(isprime[i] == true) {
            for(int j = 2*i; j<=N; j+=i) {
                isprime[j] = false;
            }
        }
    }
}

bool ispal(string s) {
    int n = s.size();
    for (int i = 0; i < n / 2; ++i) {
        if (s[i] != s[n - i - 1]) {
            return false;
        }
    }
    return true;
}

void DFSUtil(ll node, vector<vector<ll>>& adj, vector<bool>& visited, vector<ll>& dfs) {
    visited[node] = true;
    dfs.push_back(node);
    for (ll neighbor : adj[node]) {
        if (!visited[neighbor]) {
            DFSUtil(neighbor, adj, visited, dfs);
        }
    }
}

void dfs(vector<vector<ll>>& adj, ll n, vector<ll>& dfs) {
    vector<bool> visited(n, false);
    for (ll i = 0; i < n; ++i) {
        if (!visited[i]) {
            DFSUtil(i, adj, visited, dfs);
        }
    }
}

void bfs(vector<vector<ll>>& adj, ll n, vector<ll>& bfs) {
    queue<ll> q;
    vector<bool> visited(n, false);
    visited[0] = true;
    q.push(0);
    while (!q.empty()) {
        ll node = q.front();
        q.pop();
        bfs.push_back(node);
        for (auto it : adj[node]) {
            if (!visited[it]) {
                visited[it] = true;
                q.push(it);
            }
        }
    }
}

int main() {
    fast_io();
    int t;
    cin >> t;
    while (t--) {
        ll n, l, r;
        cin >> n >> l >> r;
        vector < ll > v(n);
        for(int i = 0 ; i < n ; i++) cin >> v[i];

        sort(v);
        ll ct = r - l + 1, ans = 0;
        for(int i = 0 ; i < n && ct > 0; i++) {
            ans += v[i];
            ct--;
        }

        cout << ans << endl;
    }
    return 0;
}