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

Solution 1 (runtime: 62 ms):
#include<bits/stdc++.h>
using namespace std;

#define ll        long long
#define ld        long duble
#define ull       unsigned ll
#define vi      vector<int>
#define vll       vector<ll>
#define vld       vector<ld>
#define vstr      vector<string>
#define vvi     vector<vector<int>>
#define vvll    vector<vector<ll>>
#define vvld    vector<vector<ld>>
#define pii       pair<int, int>
#define pll       pair<ll, ll>
#define mp        make_pair
#define pb        push_back
#define sz(x)     (int) x.size()
#define all(a)         a.begin(), a.end()
#define all_0(x)       memset(x,0,sizeof(x))
#define all_neg(x)     memset(x,-1,sizeof(x))
#define all_1(x)       memset(x,1,sizeof(x))
#define  bitcount(x)   (int)__builtin_popcount(x)
#define  Lsb(x)      (int)__builtin_ctzll(x)
#define fr0(i, p, n)     for(ll i = p; i < n; i++)
#define fr1(i, p, n)     for(ll i = p; i <=n; i++)
#define fast           ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define in(n)          long long n;   cin >> n
#define ins(s)         string s;   cin >> s
#define csp(x)         cout<<(x)<<" "
#define c1(x)          cout<<(x)<<endl
#define c2(x,y)        cout<<(x)<<" "<<(y)<<endl
#define c3(x,y,z)      cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define c4(a,b,c,d)    cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

#define YES            cout<<"YES"<<endl
#define Yes            cout<<"Yes"<<endl
#define NO             cout<<"NO"<<endl
#define No             cout<<"No"<<endl
#define nl             printf("\n")
#define ff             first
#define ss             second
#define endl           "\n"

const int mod = (int) 1e9 + 7;
const int inf = (int) 2e9 + 5;
const ll  Inf = (ll) 2e18 + 5;
const int N   = (int) 2e5 + 5;

int solve() {

  int n,l,r;
  cin>>n>>l>>r;
  int a[n+2],b[n+2];
  for(int i=1;i<=n;i++){
  	cin>>a[i];
  	b[i] = a[i];
  }

  sort(a+1,a+r+1);
  sort(b+l,b+1+n);
  ll sum1 =0, sum2 =0;
  for(int i=1;i<=(r-l)+1;i++){
  	sum1+=a[i];
  }
  for(int i=l;i<=r;i++){
  	sum2+=b[i];
  }
  cout<<min(sum1,sum2)<<endl;


  return 0;
}

int main() {
  fast;
  int test = 1;
  cin >> test;
  while (test--) {
    solve();
  }
  return 0;
}






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

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

void start() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cout << setprecision(12) << fixed;
    srand(time(nullptr));
}



int n, l, r;
vector<long long> v;

void read() {
    cin>>n>>l>>r;
    v.resize(n+1);
    for (int i=1; i<=n; i++){
        cin>>v[i];
    }
}



void solve() {
    read();

    vector<int> before, after;

    for (int i=1; i<=r; i++){
        before.push_back(v[i]);
    }

    for (int i=l; i<=n; i++){
        after.push_back(v[i]);
    }

    sort(before.begin(), before.end());
    sort(after.begin(), after.end());

    long long min_a = 0;
    long long min_b = 0;
    for (int i=0; i<=r-l; i++){
        min_b += before[i];
        min_a += after[i];
    }

    cout<<min(min_a, min_b)<<'\n';
}



int main(){
    start();

    int t = 1;
    cin>>t;

    for (int i=1; i<=t; i++){
        solve();
    }

    return 0;
}