Problem: 2063B - Subsequence Update
Language: c++17 

Solution 1 (runtime: 93 ms):
#include<bits/stdc++.h>

using namespace std;

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define endl "\n"
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define set_bits __builtin_popcountll
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
// typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update > pbds; // find_by_order, order_of_key

#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T> void _print(unordered_set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T, class V> void _print(unordered_map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T> void _print(unordered_multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(unordered_set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(unordered_multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(unordered_map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}

#define int long long

void solve(){
    int n, l, r, sum1 = 0, sum2 = 0;
    cin >> n >> l >>r;

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

    sort(a, a+r);
    sort(b+l-1, b+n);

    for(int i=0; i<=r-l; i++){
        sum1 += a[i];
        sum2 += b[l-1+i];
    }

    cout << min(sum1, sum2)<<endl;
}

signed main() {
#ifndef ONLINE_JUDGE
    freopen("debug.txt", "w", stderr);
#endif
    fastio();

    int t = 1;
    cin >> t;
    while(t--){
        solve();       
    }
    return 0;
}

Solution 2 (runtime: 93 ms):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int M=1e9+7;

#define no cout << "NO" << endl

#define yes cout << "YES" << endl

#define pb push_back

#define endl "\n"



// unsigned ll factorial(unsigned ll n)

// {

//     ll res = 1, i;

//     for (i = 2; i <= n; i++)

//         res *= i;

//     return res;

// }



// bool isPerfectSquare(long double x){

//     if (x >= 0) {

//         long long sr = sqrt(x);

//         return (sr * sr == x);

//     }

//     return false;

// }



// bool isPrime(ll n){

//     if (n <= 1)

//         return false;

//     for (int i = 2; i <= n / 2; i++)

//         if (n % i == 0)

//             return false;

//     return true;

// }



// ll gcd(ll a,ll b){

//     if(b==0){

//         return a;

//     }

//     return gcd(b,a%b);

// }



// ll lcm(ll a, ll b) {

//     return (a/__gcd(a,b))*b;

// }



// void printDivisors(ll n) 

// { 

//     for(ll i=1;i<=sqrt(n);i++) 

//     { 

//         if(n%i==0) 

//         { 

//             if(n/i==i) 

//                 cout<<" "<<i; 

//             else

//                 cout<<" "<<i<<" "<<n/i; 

//         } 

//     } 

// } 



void solve(){

    int n,l,r;

    cin>>n>>l>>r;

    vector<int>arr(n);

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

        cin>>arr[i];

    }   

    ll ans=0;

    vector<int>a,b;

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

        a.pb(arr[i]);

    }

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

        b.pb(arr[i]);

    }

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

    sort(b.begin(),b.end());

    ll sum1=0;

    ll sum2=0;

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

        sum1+=a[i];

        sum2+=b[i];

    }

    ans=min(sum1,sum2);

    cout<<ans<<endl;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    ll t;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}