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

Code 1:
/**

 *  Author: Abhishek Jha

**/

#include <bits/stdc++.h>

#define int long long

using namespace std;

 

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

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

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

#define ft first

#define sd second

#define pb push_back



typedef vector<int> vi;typedef vector<vi> vvi;typedef pair<int, int> pii;typedef vector<pii> vii;typedef vector<vii> vvii;typedef long long ll;

 

const int MOD = 1e9+7;const int INFLL = 1e18+5;const int INF = 1e9;const int maxN = 101;const int maxK = 8001;



void printbit(int x, int len) {string s="\n";while(len--){s=((x%2)?'1':'0')+s;x/=2;} cout<<s;}

 

template<class T>

istream& operator>>(istream&in, vector<T>&v){for (T& x:v) in>>x;return in;}

template<class T>

ostream& operator<<(ostream&out, vector<T>&v){for (T& x:v) out<<x<<' ';cout<<'\n';return out;}



/*---------------------------------------------------------------------------------*/

ll countSetBits(ll n){return __builtin_popcount(n);}



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);}



bool isPrime(ll n) {if(n==2)    return true;if(n<2)return false;if(n%2 == 0) return false;for(int i=3; i*i<= n; i+= 2)if(n%i==0) return false;return true;}



ll factorial(ll n){return (n==1 || n==0) ? 1: n * factorial(n - 1);}



int smallestDivisor(int n){if (n % 2 == 0) return 2;for (int i = 3; i * i <= n; i += 2) {if (n % i == 0) return i;} return n;}



int largestDivisor(int n){return n/smallestDivisor(n);} 



ll nCr(ll n, ll r){if(r>n)return 0;long long p = 1, k = 1;if(n - r < r)r = n - r;if (r != 0) { while (r) {p *= n;k *= r;ll m = __gcd(p, k);p /= m;k /= m;n--;r--;}}else  p = 1;return p;}

/*------------------------------------------------------------------------------------------------------------------*/



void solve(){

    ll n,l,r;

    cin>>n>>l>>r;

    vi a(n);

    cin>>a;

    vi b;

    vi c;

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

        b.push_back(a[i]);

    }

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

        c.push_back(a[i]);

    }

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

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

    ll bans = 0;

    ll cans = 0;

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

        bans += b[i];

        cans += c[i];

    }

    cout<<min(bans,cans)<<endl;

    

}



/*------------------------------------------------------------------------------------------------------------------*/



signed main() {

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);

    cout.tie(nullptr);



    int t=1, i = 1;

    cin>>t;

    while(t--){

        solve();

    }



    return 0;

}

Code 2:
/**

 *  Author: Abhishek Jha

**/

#include <bits/stdc++.h>

#define int long long

using namespace std;

 

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

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

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

#define ft first

#define sd second

#define pb push_back



typedef vector<int> vi;typedef vector<vi> vvi;typedef pair<int, int> pii;typedef vector<pii> vii;typedef vector<vii> vvii;typedef long long ll;

 

const int MOD = 1e9+7;const int INFLL = 1e18+5;const int INF = 1e9;const int maxN = 101;const int maxK = 8001;



void printbit(int x, int len) {string s="\n";while(len--){s=((x%2)?'1':'0')+s;x/=2;} cout<<s;}

 

template<class T>

istream& operator>>(istream&in, vector<T>&v){for (T& x:v) in>>x;return in;}

template<class T>

ostream& operator<<(ostream&out, vector<T>&v){for (T& x:v) out<<x<<' ';cout<<'\n';return out;}



/*---------------------------------------------------------------------------------*/

ll countSetBits(ll n){return __builtin_popcount(n);}



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);}



bool isPrime(ll n) {if(n==2)    return true;if(n<2)return false;if(n%2 == 0) return false;for(int i=3; i*i<= n; i+= 2)if(n%i==0) return false;return true;}



ll factorial(ll n){return (n==1 || n==0) ? 1: n * factorial(n - 1);}



int smallestDivisor(int n){if (n % 2 == 0) return 2;for (int i = 3; i * i <= n; i += 2) {if (n % i == 0) return i;} return n;}



int largestDivisor(int n){return n/smallestDivisor(n);} 



ll nCr(ll n, ll r){if(r>n)return 0;long long p = 1, k = 1;if(n - r < r)r = n - r;if (r != 0) { while (r) {p *= n;k *= r;ll m = __gcd(p, k);p /= m;k /= m;n--;r--;}}else  p = 1;return p;}

/*------------------------------------------------------------------------------------------------------------------*/



void solve(){

    ll n,l,r;

    cin>>n>>l>>r;

    vi a(n);

    cin>>a;

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

    ll ans = 0;

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

        ans += a[i];

    }

    cout<<ans<<endl;

    

}



/*------------------------------------------------------------------------------------------------------------------*/



signed main() {

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);

    cout.tie(nullptr);



    int t=1, i = 1;

    cin>>t;

    while(t--){

        solve();

    }



    return 0;

}

Answer: 1