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

Solution 1 (runtime: 78 ms):
// Don’t cry in a corner, if you want something, mehnat kar, best ban, aur cheen le.
// Boy's Nobody come here to save you , you have to fight alone with a smile face.

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/tree_policy.hpp>
#define M 1000000007
#define ll long long
#define int long long
#define nn int n;cin >> n;
#define string1 string s;cin >> s;
#define loop(n) for (auto i = 0; i < n; i++)
#define lop(n) for (auto j = 0; j < n; j++)
#define takearr(n)  for (auto i = 0; i < n; i++){cin>>v[i];}
#define takestr(n) for(int i=0;i<n;i++){char ch; cin>>ch; s+=ch;}
#define srt   sort(v.begin(),v.end());
#define srtr   sort(v.rbegin(),v.rend());
#define loophalf(n) for (int i = n / 2 - 1; i < n; i++)
#define lop2(n) for (auto j = 1; j <= n; j++)
#define dgb(...) ;
#define debug(...) ;
#define crndl
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
// #define p priority_queue<int,vector<int>,greater<int>>p;
int sieve[1000005];
int v[1000005];

void sieveOfEratosthenes() {
	memset(sieve, 0, sizeof(sieve));
	sieve[0] = 0;
	sieve[1] = 0;
	for (int i = 2; i < 1000005; i++) {
		if (sieve[i] != 0) {
			continue;
		}
		for (int j = i; j < 1000005; j += i) {
			if (sieve[j] == 0) sieve[j] = i;
		}
	}
}
string lshift(string s) {
	return s.substr(1, s.length() - 1) + s.substr(0, 1);
}
string rshift(string s) {
	return s.back() + s.substr(0, s.length() - 1);
}
struct point {
	int x, y;
	bool operator<(const point &p) {
		if (x == p.x) return y < p.y;
		else return x < p.x;
	}
};
bool isprime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)
			return false;
	}
	return true;
}
bool cmp(vector<int>&a , vector<int>&b) {
	return a < b;
}
int fin(int n) {
	return (n * (n + 1)) / 2;
}
int powM(int x , int n) {
	x %= M;
	if (n == 0) return 1;
	else if (n == 1) return x;
	int y = powM(x * x , n / 2);
	if (n % 2) {
		return y * x % M;
	}
	else {
		return y;
	}
}
int pow(int x , int n) {
	if (n == 0) return 1;
	else if (n == 1) return x;
	int y = pow(x * x , n / 2);
	if (n & 1) {
		return y * x;
	}
	else {
		return y;
	}
}
int fun(vector<int>&arr1 , vector<int>&arr2) {

	auto it = remove_if(arr2.begin(), arr2.end(), [&arr1](int num) {
		return find(arr1.begin(), arr1.end(), num) != arr1.end();
	});
	arr2.erase(it, arr2.end());
	return arr2.size();
}
bool allEqual( vector<int>&v) {
	for (int i = 1; i < v.size(); i++) {
		if (v[i] != v[i - 1]) {
			return false;
		}
	}
	return true;
}

int msb(int n) {
	for (int i = 32; i > 0; i--) {
		if (n & (1LL << i)) {
			return i;
		}
	}
	return 0;

}
void solve()
{
	int n, l, r;
	cin >> n >> l >> r;
	vector<int>a(n);
	for (auto &i : a)
		cin >> i;
	auto b = a;
	sort(a.begin(), a.begin() + r);
	int sum1 = 0, sum2 = 0;
	sort(b.begin() + l - 1, b.end());
	for (int i = 0; i < r - l + 1; i++)
		sum1 += a[i];
	for (int i = l - 1; i < r - l + 1 + l - 1; i++)
		sum2 += b[i];
	cout << min(sum1, sum2) << endl;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin >> t;
	while (t-- > 0)
	{
		debug(testcase, tc);
		solve();
		crndl;
	}
	return 0;
}

Solution 2 (runtime: 187 ms):
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int a[N];
typedef long long ll;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,l,r;
		cin>>n>>l>>r;
		for(int i=1;i<=n;i++){
			cin>>a[i];
		} 
		vector<int> L,R,M;
		for(int i=1;i<l;i++){
			L.push_back(a[i]);
		}
		for(int i=l;i<=r;i++){
			M.push_back(a[i]);
		}
		for(int i=r+1;i<=n;i++){
			R.push_back(a[i]);
		}
		sort(M.begin(),M.end());
		sort(L.begin(),L.end());
		sort(R.begin(),R.end());
//		for(int i=0;i<R.size();i++){
//			cout<<R[i]<<" ";
//		}
//		cout<<endl;
		int p=M.size()-1,q=0,t=L.size();
		ll ans1=0;
		while(p!=-1){
			if(q!=t&&L[q]<M[p]){
				ans1+=L[q];
				q++;
			}
			else ans1+=M[p];
			p--;
		}
		p=M.size()-1,q=0,t=R.size();
		ll ans2=0;
		while(p!=-1){
			if(q!=t&&R[q]<M[p]){
				ans2+=R[q];
				
//				cout<<R[q]<<endl;
				q++;
			}
			else {
//				cout<<M[p]<<endl;
				ans2+=M[p];
			}
			p--;
		}
		ans1=min(ans1,ans2);
		cout<<ans1<<endl;
	}
	return 0;
}