Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 8):
    #include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define ull unsigned long long
    #define pb push_back
    #define eb emplace_back
    #define mp make_pair
    #define fi first
    #define se second
    #define vmax(v) (*max_element((v).begin(), (v).end()))
    #define vmin(v) (*min_element((v).begin(), (v).end()))
    #define all(v) (v).begin(), (v).end()
    #define rall(v) (v).rbegin(), (v).rend()
    #define sz(x) (int)(x).size()
    #define endl '\n'
    #define rep(i, a, b) for (int i = a; i < (b); ++i)
    #define repr(i, a, b) for (int i = a; i >= (b); --i)
    #define rep0(i, n) for (int i = 0; i < (n); ++i)
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    const ull MOD = 1e10;

    void vecprint(vector<int>vec){
        int size = vec.size();
        for(int i=0; i<size; i++){
            cout<<vec[i]<<" ";
        }
        cout<<endl; 
        return;
    }

    //dont write too much if else 
    void solve() {
        //INITIALIZING VARIABLES 
        unsigned long long sum1=0, sum2=0, n, l, r; cin>>n>>l>>r;
        vector<int>vec(n);
        for(int i=0; i<n; i++){cin>>vec[i];}

        //MAIN ALGORITHM
        vector<int>brr, crr;
        brr = vec; crr = vec;
        sort(brr.begin()+(l-1), brr.end());
        sort(crr.begin(), crr.begin()+(r), greater<int>());
        //vecprint(brr);
        //vecprint(crr);

        for(int i=l-1; i<r; i++){
            sum1+=brr[i]; 
            sum2+=crr[i];
        }   
        int mini = min(sum1,sum2);
        cout<<mini<<endl;
        return;
    }


    int main() {
    IOS;

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w",              stdout);    
    #endif

    int test;
    cin >> test;
    while (test--) {
        solve();
    }

    return 0;
    }

/*
6
2 1 1
2 1
3 2 3
1 2 3
3 1 3
3 1 2
4 2 3
1 2 2 2
5 2 5
3 3 2 3 5
6 1 3
3 6 6 4 3 2




*/

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

    using namespace std;

    #define ll long long

    #define ull unsigned long long

    #define pb push_back

    #define eb emplace_back

    #define mp make_pair

    #define fi first

    #define se second

    #define vmax(v) (*max_element((v).begin(), (v).end()))

    #define vmin(v) (*min_element((v).begin(), (v).end()))

    #define all(v) (v).begin(), (v).end()

    #define rall(v) (v).rbegin(), (v).rend()

    #define sz(x) (int)(x).size()

    #define endl '\n'

    #define rep(i, a, b) for (int i = a; i < (b); ++i)

    #define repr(i, a, b) for (int i = a; i >= (b); --i)

    #define rep0(i, n) for (int i = 0; i < (n); ++i)

    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    const ull MOD = 1e10;



    void vecprint(vector<int>vec){

        int size = vec.size();

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

            cout<<vec[i]<<" ";

        }

        cout<<endl; 

        return;

    }



    //dont write too much if else 

    void solve() {

        //INITIALIZING VARIABLES 

        unsigned long long sum1=0, sum2=0, n, l, r; cin>>n>>l>>r;

        vector<unsigned long long>vec(n);

        for(int i=0; i<n; i++){cin>>vec[i];}



        //MAIN ALGORITHM

        vector<unsigned long long>brr, crr;

        brr = vec; crr = vec;

        sort(brr.begin()+(l-1), brr.end());

        sort(crr.begin(), crr.begin()+(r), greater<int>());

        //vecprint(brr);

        //vecprint(crr);



        for(int i=l-1; i<r; i++){

            sum1+=brr[i]; 

            sum2+=crr[i];

        }   

        int mini = min(sum1,sum2);

        cout<<mini<<endl;

        return;

    }





    int main() {

    IOS;



    #ifndef ONLINE_JUDGE

    freopen("input.txt", "r", stdin);

    freopen("output.txt", "w",              stdout);    

    #endif



    int test;

    cin >> test;

    while (test--) {

        solve();

    }



    return 0;

    }



/*

6

2 1 1

2 1

3 2 3

1 2 3

3 1 3

3 1 2

4 2 3

1 2 2 2

5 2 5

3 3 2 3 5

6 1 3

3 6 6 4 3 2









*/