Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

typedef string str;



const ll INF = 3e18;



const int INFI = 1e9, N = 200100;



const ld PI = 3.1415926535897, EPS = 1e-9;



class Hash {

private:

    const ll MOD1 = 1e9 + 7;

    const ull MOD2 = 1e9 + 9;

    vector<ll> hash1, pow1;

    vector<ull> hash2, pow2;

public:

    void build(const string& s) {

        hash1.resize(s.size() + 1, 0);

        hash2.resize(s.size() + 1, 0);

        pow1.resize(s.size() + 1, 1);

        pow2.resize(s.size() + 1, 1);

        pow1[1] = pow2[1] = 57;

        for (int i = 1; i <= s.size(); i++) {

            hash1[i] = (hash1[i - 1] * pow1[1] % MOD1 + s[i - 1]) % MOD1;

            hash2[i] = (hash2[i - 1] * pow2[1] % MOD2 + s[i - 1]) % MOD2;

            pow1[i] = (pow1[i - 1] * pow1[1]) % MOD1;

            pow2[i] = (pow2[i - 1] * pow2[1]) % MOD2;

        }

    }

    pair<ll, ull> sub_hash(int l, int r) {

        return {(hash1[r] - hash1[l] * pow1[r - l] % MOD1 + MOD1) % MOD1, (hash2[r] - hash2[l] * pow2[r - l] % MOD2 + MOD2) % MOD2};

    }

};



struct Line{

    ll a, b, c;



    bool is_in_line(ld x, ld y) {

        return (a * x + b * y + c == 0);

    }

};



struct Point {

    ld x, y;



    ld distance(Point a) {

        return (sqrt((a.x - x) * (a.x - x) + (a.y - y) * (a.y - y)));

    }



    ld scalar(Point a) {

        return(a.x * x + a.y * y);

    }



    ld kosoe(Point a) {

        return (x * a.y - y * a.x);

    }



    ld angle(Point a) {

        Point b = {this -> x, this -> y};

        return abs(atan2(a.kosoe(b),a.scalar(b)));

    }



    Line create_line(Point b){

        Line line;

        line.a = y - b.y;

        line.b = b.x - x;

        line.c = x * b.y - b.x * y;

        return line;

    }



    Point make_point(Point b) {

        return {b.x - x, b.y - y};

    }



    ld triangle_square(Point b,Point c) {

        Point a = {this -> x, this -> y}, ab = a.make_point(b), ac = a.make_point(c);

        return abs(ab.kosoe(ac) / 2);

    }



    ld len() {

        return(x * x + y * y);

    }



    long double point_line_dist(Line a) {

        long double del = sqrt(a.a * a.a + a.b * a.b);

        return abs(a.a * x + a.b * y + a.c) / del;

    }



    bool is_in_triangle(Point a, Point b, Point c) {

        Point xex = {this -> x, this -> y};

        ld trs = a.triangle_square(b, c);

        ld tmp = xex.triangle_square(a, b) + xex.triangle_square(b, c) + xex.triangle_square(a, c);

        return (abs(trs - tmp) < EPS);

    }

};



istream& operator>>(istream& in,Point& p) {

    in >> p.x >> p.y;

    return in;

}



istream& operator>>(istream& in,Line& l) {

    in >> l.a >> l.b >> l.c;

    return in;

}



ostream& operator<<(ostream& out,Point& p) {

    out << p.x << " " << p.y;

    return out;

}



#define f first

#define s second

#define pb push_back

#define ub upper_bound

#define lb lower_bound

#define stop exit(0);

#define mp make_pair



ll bin_pow(ll a, ll b, ll MOD = INF) {

    ll ans = 1;

    while (b) {

        if (b % 2) {

            ans = (ans * a) % MOD;

            --b;

        }

        else {

            b /= 2;

            a = (a * a) % MOD;

        }

    }

    return (ans % MOD);

}



vector<ll> prefix_function(string s) {

    ll tmp, k;

    vector<ll> ans(s.size() + 1, 0);

    for (int i = 1; i < s.size(); ++i) {

        k = ans[i];

        while (k && s[i] != s[k])

            k = ans[k];

        s[i] == s[k] ? ans[i + 1] = k + 1 : ans[i + 1] = 0;

    }

    return ans;

}



void dfs_color(vector<int>g[], int c[], int color, int v) {

    c[v] = color;

    for (auto& i : g[v])

        if (!c[i])

            dfs_color(g, c, color, i);

}



void dfs(vector<ll> g[], ll v, bool used[]){

    used[v] = 1;

    for (auto& i : g[v])

        if (!used[i])

            dfs(g, i, used);

}



ll time_now = 0;



void dfs_time(vector<ll> g[], ll v, int colors[], pair<ll, ll> timers[]) {

    timers[v].f = time_now++;

    colors[v] = 1;

    for (auto& i : g[v])

        if (!colors[i])

            dfs_time(g, i, colors, timers);

    colors[v] = 2;

    timers[v].s = time_now++;

}



void floid(ll n,ll g[N][N]){

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

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

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

                g[v][u] = min(g[v][u], g[v][i] + g[i][u]);

} // Индексация с 1



ll dijkstra(vector<pair<ll,ll>> g[], ll s, ll n) {

    set<pair<ll,ll>> q;

    vector<ll> dist(n + 10, INF);

    dist[s] = 0;

    q.insert({0,s});

    while (q.size()){

        auto p = *q.begin();

        q.erase(q.begin());

        ll v = p.s;

        for (auto& pp : g[v]) {

            auto to = pp.f;

            auto w = pp.s;

            if (dist[to] > dist[v] + w) {

                q.erase({dist[to], to});

                dist[to] = dist[v] + w;

                q.insert({dist[to], to});

            }

        }

    }

    return dist[n];

} // При ненахождении пути,функция возвращает INF



ll isqrt(ll n) {

    ll l = -1, r = 1e9 + 1000;

    while (l + 1 < r) {

        ll mid = (l + r) / 2;

        mid * mid <= n ?  l = mid : r = mid;

    }

    return l;

}



int isqrt(int n) {

    int l = 0, r = 45000;

    while (l + 1 < r) {

        int mid = (l + r) / 2;

        mid * mid <= n ? l = mid : r = mid;

    }

    return l;

}



ll cnk(ll n, ll k, ll MOD = INF) {

    ll ans = 1;

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

        ans = (ans * (n - i)) % MOD;

        ans = (ans / (i + 1)) % MOD;

    }

    return ans % MOD;

}



void bfs(vector<int> g[], ll dist[], int s){

    queue<ll> q;

    dist[s] = 0;

    q.push(s);

    while (q.size()) {

        ll curr = q.front();

        q.pop();

        for (auto& v : g[curr])

            if (dist[curr] + 1 < dist[v]) {

                q.push(v);

                dist[v] = dist[curr] + 1;

            }

    }

}



void solve() {

    int n, l, r;

    std::cin >> n >> l >> r;

    long long sum = 0;

    std::vector<long long> a(n);

    for (auto& i : a)

        std::cin >> i;

    r -= l;

    std::sort(a.begin(), a.end());

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

        sum += a[i];

    std::cout << sum << '\n';

}



int main() {

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

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

    srand(0);

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);

    cout << fixed;

    cout.precision(20);

    ll t = 1;

    cin >> t;

    while (t--)

        solve();

}