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

Code 1:
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define _mp make_pair
#define vt vector
#define MAXN 200002
using namespace std;
typedef long long LL;
ll mod=1e9+7;
//     f[0]=f[1]=inv[0]=inv[1]=1;
// for(int i=2;i<MAXN;i++) f[i]=(LL)f[i-1]*i%mod,inv[i]=(LL)(mod-mod/i)*inv[mod%i]%mod;
// for(int i=1;i<MAXN;i++) inv[i]=(LL)inv[i-1]*inv[i]%mod;
ll f[MAXN],inv[MAXN];

ll C(const int n,const int m){return n<m?0:(LL)f[n]*inv[m]%mod*inv[n-m]%mod;}

ll power(ll num, ll p)
{
    if (p == 0)
        return 1;
    if (p == 1)
        return num;
    ll n = power(num, p / 2);
    if (p % 2 == 0)
        return (n * n)%(998244353) ;
    return (num*((n*n)%(998244353)))%(998244353);
}
ll fact(ll val)
{
    if (val <= 1)
        return 1;
    return (val * fact(val - 1));
}
ll ncr(ll n, ll r)
{
    if (n < r)
        return 0;
    ll p = 1, k = 1;
    if ((n - r) < r)
        r = n - r;

    if (r != 0)
    {
        while (r)
        {
            p = (p * n)%mod;
            k = (k * r)%mod;
            ll m = __gcd(p, k);
            p /= m;
            k /= m;
            n--;
            r--;
        }
    }
    else
        p = 1;
    return p;
}
// bool cmp(pair<int,int> v1, pair<int,int> v2)
// {
//     if(v1.first==v2.first)return v1.second>v2.second;
//     return v1.first<v2.first;
// }
bool isFact(ll n)
{
  for (ll i = 1;; i++) {
    if (n % i == 0) {
      n /= i;
    }
    else {
      break;
    }
  }
 
  if (n == 1LL) {
    return true;
  }
  else {
    return false;
  }
}
int lcs(string s, string t, int m, int n)
{
    if (m==0||n==0)return 0;
    if (s[m-1]==t[n-1])return 1 + lcs(s, t, m - 1, n - 1);
    else return max(lcs(s, t, m, n - 1),lcs(s, t, m - 1, n));
}
pair<ll,ll> maxSubArraySum(vector<ll>&a, int size)
{
    ll max_so_far = 0, max_ending_here = 0;
     int num=0,mx_len=0;
    for (int i = 0; i < size; i++) {
        max_ending_here = (max_ending_here + a[i]);
        num++;
        if (max_so_far < max_ending_here)
            {max_so_far = max_ending_here;mx_len=num;}
        else{
            max_ending_here=0;num=0;
        }
    }
    if(mx_len==size)max_so_far=0;
    return {max_so_far,mx_len};
}
bool isPrime(ll N){
    int flag = 1;

    double sqroot = sqrt(N);

    // Iterate from 2 to sqrt(n)
    for (int i = 2; i <= sqroot; i++) {

        // If n is divisible by any number between 2 and
        // sqrt(n), it is not prime
        if (N % i == 0) {
            flag = 0;
            break;
        }
    }
    return flag;
}
void rev(int start,int ind,int end,vt<int>&vec){
int val=ind+1;
while(val>0){
    for(int i=start;i<end;i++)swap(vec[i],vec[i+1]);
    val--;
}
}
int gcdExtended(ll a, ll b, ll* x, ll* y)
{

    // Base Case
    if (a == 0) {
        *x = 0, *y = 1;
        return b;
    }

    // To store results of recursive call
    ll x1, y1;
    int gcd = gcdExtended(b % a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b / a) * x1;
    *y = x1;

    return gcd;
}
ll modInverse(ll A, ll M)
{
    ll x, y;
    ll g = gcdExtended(A, M, &x, &y);
    if (g != 1)
        return -1;
    else {

        // m is added to handle negative x
        ll res = (x % M + M) % M;
        return res;
    }
}



// bool fun(int a,int b,int X,int Y){
//     double dis1=
// }


bool cmp(pair<int,int>a,pair<int,int>b){
    if(a.second<b.second)return true;
    else return a.first<b.first;
}
int countAndMerge(vector<int>& arr, int l, int m, int r) {
  
    // Counts in two subarrays
    int n1 = m - l + 1, n2 = r - m;

    // Set up two vectors for left and right halves
    vector<int> left(n1), right(n2);
    for (int i = 0; i < n1; i++)
        left[i] = arr[i + l];
    for (int j = 0; j < n2; j++)
        right[j] = arr[m + 1 + j];

    // Initialize inversion count (or result) and merge two halves
    int res = 0;
    int i = 0, j = 0, k = l;
    while (i < n1 && j < n2) {

        // No increment in inversion count if left[] has a 
        // smaller or equal element
        if (left[i] <= right[j]) 
            arr[k++] = left[i++];
      
        // If right is smaller, then it is smaller than n1-i 
          // elements because left[] is sorted
        else {
            arr[k++] = right[j++];
            res += (n1 - i);
        }
    }

    // Merge remaining elements
    while (i < n1)
        arr[k++] = left[i++];
    while (j < n2)
        arr[k++] = right[j++];

    return res;
}

// Function to count inversions in the array
ll countInv(vector<int>& arr, int l, int r){
    ll res = 0;
    if (l < r) {
        int m = (r + l) / 2;

        // Recursively count inversions in the left and 
        // right halves
        res += countInv(arr, l, m);
        res += countInv(arr, m + 1, r);

        // Count inversions such that greater element is in 
          // the left half and smaller in the right half
        res += countAndMerge(arr, l, m, r);
    }
    return res;
}

ll inversionCount(vector<int>& arr) {
      int n = arr.size();
      return countInv(arr, 0, n-1);
}
ll p(ll x,ll y){
    if(y==0)return 1;
    if(y==1)return x;
    ll z=p(x,y/2);
    ll r=(z*z)%(998244353);
    if(y%2)r=(r*x)%(998244353);
    return r;
}
void _solve1()
{
    int t;cin>>t;
    while(t--){
    int n,l,r;
    cin>>n>>l>>r;
    vt<int>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    sort(v.begin(),v.end());
    ll sum=0;
    for(int i=0;i<(r-l+1);i++)sum+=v[i];
    cout<<sum<<'\n'; 
    }
} 
void _solve2(){
int a=134,b=132,c=137;
cout<<((a^b)+(b^c)+(c^a))<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _solve1();
    // _solve2();
}

Code 2:
#include <bits/stdc++.h>

#define ll long long int

#define pb push_back

#define _mp make_pair

#define vt vector

#define MAXN 200002

using namespace std;

typedef long long LL;

ll mod=1e9+7;

//     f[0]=f[1]=inv[0]=inv[1]=1;

// for(int i=2;i<MAXN;i++) f[i]=(LL)f[i-1]*i%mod,inv[i]=(LL)(mod-mod/i)*inv[mod%i]%mod;

// for(int i=1;i<MAXN;i++) inv[i]=(LL)inv[i-1]*inv[i]%mod;

ll f[MAXN],inv[MAXN];



ll C(const int n,const int m){return n<m?0:(LL)f[n]*inv[m]%mod*inv[n-m]%mod;}



ll power(ll num, ll p)

{

    if (p == 0)

        return 1;

    if (p == 1)

        return num;

    ll n = power(num, p / 2);

    if (p % 2 == 0)

        return (n * n)%(998244353) ;

    return (num*((n*n)%(998244353)))%(998244353);

}

ll fact(ll val)

{

    if (val <= 1)

        return 1;

    return (val * fact(val - 1));

}

ll ncr(ll n, ll r)

{

    if (n < r)

        return 0;

    ll p = 1, k = 1;

    if ((n - r) < r)

        r = n - r;



    if (r != 0)

    {

        while (r)

        {

            p = (p * n)%mod;

            k = (k * r)%mod;

            ll m = __gcd(p, k);

            p /= m;

            k /= m;

            n--;

            r--;

        }

    }

    else

        p = 1;

    return p;

}

// bool cmp(pair<int,int> v1, pair<int,int> v2)

// {

//     if(v1.first==v2.first)return v1.second>v2.second;

//     return v1.first<v2.first;

// }

bool isFact(ll n)

{

  for (ll i = 1;; i++) {

    if (n % i == 0) {

      n /= i;

    }

    else {

      break;

    }

  }

 

  if (n == 1LL) {

    return true;

  }

  else {

    return false;

  }

}

int lcs(string s, string t, int m, int n)

{

    if (m==0||n==0)return 0;

    if (s[m-1]==t[n-1])return 1 + lcs(s, t, m - 1, n - 1);

    else return max(lcs(s, t, m, n - 1),lcs(s, t, m - 1, n));

}

pair<ll,ll> maxSubArraySum(vector<ll>&a, int size)

{

    ll max_so_far = 0, max_ending_here = 0;

     int num=0,mx_len=0;

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

        max_ending_here = (max_ending_here + a[i]);

        num++;

        if (max_so_far < max_ending_here)

            {max_so_far = max_ending_here;mx_len=num;}

        else{

            max_ending_here=0;num=0;

        }

    }

    if(mx_len==size)max_so_far=0;

    return {max_so_far,mx_len};

}

bool isPrime(ll N){

    int flag = 1;



    double sqroot = sqrt(N);



    // Iterate from 2 to sqrt(n)

    for (int i = 2; i <= sqroot; i++) {



        // If n is divisible by any number between 2 and

        // sqrt(n), it is not prime

        if (N % i == 0) {

            flag = 0;

            break;

        }

    }

    return flag;

}

void rev(int start,int ind,int end,vt<int>&vec){

int val=ind+1;

while(val>0){

    for(int i=start;i<end;i++)swap(vec[i],vec[i+1]);

    val--;

}

}

int gcdExtended(ll a, ll b, ll* x, ll* y)

{



    // Base Case

    if (a == 0) {

        *x = 0, *y = 1;

        return b;

    }



    // To store results of recursive call

    ll x1, y1;

    int gcd = gcdExtended(b % a, a, &x1, &y1);



    // Update x and y using results of recursive

    // call

    *x = y1 - (b / a) * x1;

    *y = x1;



    return gcd;

}

ll modInverse(ll A, ll M)

{

    ll x, y;

    ll g = gcdExtended(A, M, &x, &y);

    if (g != 1)

        return -1;

    else {



        // m is added to handle negative x

        ll res = (x % M + M) % M;

        return res;

    }

}







// bool fun(int a,int b,int X,int Y){

//     double dis1=

// }





bool cmp(pair<int,int>a,pair<int,int>b){

    if(a.second<b.second)return true;

    else return a.first<b.first;

}

int countAndMerge(vector<int>& arr, int l, int m, int r) {

  

    // Counts in two subarrays

    int n1 = m - l + 1, n2 = r - m;



    // Set up two vectors for left and right halves

    vector<int> left(n1), right(n2);

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

        left[i] = arr[i + l];

    for (int j = 0; j < n2; j++)

        right[j] = arr[m + 1 + j];



    // Initialize inversion count (or result) and merge two halves

    int res = 0;

    int i = 0, j = 0, k = l;

    while (i < n1 && j < n2) {



        // No increment in inversion count if left[] has a 

        // smaller or equal element

        if (left[i] <= right[j]) 

            arr[k++] = left[i++];

      

        // If right is smaller, then it is smaller than n1-i 

          // elements because left[] is sorted

        else {

            arr[k++] = right[j++];

            res += (n1 - i);

        }

    }



    // Merge remaining elements

    while (i < n1)

        arr[k++] = left[i++];

    while (j < n2)

        arr[k++] = right[j++];



    return res;

}



// Function to count inversions in the array

ll countInv(vector<int>& arr, int l, int r){

    ll res = 0;

    if (l < r) {

        int m = (r + l) / 2;



        // Recursively count inversions in the left and 

        // right halves

        res += countInv(arr, l, m);

        res += countInv(arr, m + 1, r);



        // Count inversions such that greater element is in 

          // the left half and smaller in the right half

        res += countAndMerge(arr, l, m, r);

    }

    return res;

}



ll inversionCount(vector<int>& arr) {

      int n = arr.size();

      return countInv(arr, 0, n-1);

}

ll p(ll x,ll y){

    if(y==0)return 1;

    if(y==1)return x;

    ll z=p(x,y/2);

    ll r=(z*z)%(998244353);

    if(y%2)r=(r*x)%(998244353);

    return r;

}

void _solve1()

{

    int t;cin>>t;

    while(t--){

    int n,l,r;

    cin>>n>>l>>r;

    vt<int>v(n);

    for(int i=0;i<n;i++)cin>>v[i];

    vt<int>s1,s2,s3;

    for(int i=0;i<l-1;i++)s1.pb(v[i]);

    for(int i=l-1;i<r;i++)s2.pb(v[i]);

    for(int i=r;i<n;i++)s3.pb(v[i]);

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

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

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

    vt<ll>prea(s1.size()+1,0);

    vt<ll>preb(s2.size()+1,0);

    vt<ll>prec(s3.size()+1,0);

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

     prea[i]=prea[i-1]+s1[i-1];

    }

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

     preb[i]=preb[i-1]+s2[i-1];

    }

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

     prec[i]=prec[i-1]+s3[i-1];

    }

    ll sum=1e15;

    for(int i=0;i<=min((int)s1.size(),(r-l+1));i++){

       sum=min(sum,prea[i]+preb[s2.size()-i]);

    }

    for(int i=0;i<=min((int)s3.size(),(r-l+1));i++){

        sum=min(sum,prec[i]+preb[s2.size()-i]);

    }

    cout<<sum<<'\n';

    }

} 

void _solve2(){

int a=134,b=132,c=137;

cout<<((a^b)+(b^c)+(c^a))<<'\n';

}

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    _solve1();

    // _solve2();

}

Answer: 2