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

Code 1:
#include <bits/stdc++.h>
using namespace std;
#define setbitcounts(x)   __builtin_popcountll(x)
#define ll                long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define pll               pair<long,long>
#define vii               vector<int,int>
#define vll               vector<long,long>
#define mii               map<int,int>
#define mci               map<char,int>
#define sti               set<int>
#define stc               set<char>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem0(a)           memset(a,0,sizeof(a))
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppcll             __builtin_popcountll
#define see(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define out(x) cout << x << " ";
#define nl cout << "\n";
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M32=1e9+7;
const int32_t MM32=998244353;
const int N=0;
//ascii value A=65,Z=90,a=97,z=122


ll BS(ll l, ll r, vector<pair<ll,pair<ll,ll>>> &v, ll value){
    ll ans = -1;
    while(l <= r){
        ll mid = (l+r) >> 1L;
        if(v[mid].first < value){
            ans = mid;
            l = mid+1;
        }
        else r = mid-1;
    }
    return ans;
}


int main()
{
IOS
ll t; cin >> t;
while(t--){
ll n, l,r;
cin >> n >> l >> r;

vector<ll>v(n);
rep(i,0,n) cin >> v[i];

sort(all(v));

ll k = r-l+1;

ll ans = 0;

rep(i,0,k){
    ans += v[i];
}

cout << ans << endl;
cout << endl;
}


return 0;
}

/*

*/

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

using namespace std;

#define setbitcounts(x)   __builtin_popcountll(x)

#define ll                long long

#define pb                push_back

#define ppb               pop_back

#define pf                push_front

#define ppf               pop_front

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

#define uniq(v)           (v).erase(unique(all(v)),(v).end())

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

#define fr                first

#define sc                second

#define pii               pair<int,int>

#define pll               pair<long,long>

#define vii               vector<int,int>

#define vll               vector<long,long>

#define mii               map<int,int>

#define mci               map<char,int>

#define sti               set<int>

#define stc               set<char>

#define rep(i,a,b)        for(int i=a;i<b;i++)

#define mem0(a)           memset(a,0,sizeof(a))

#define mem1(a)           memset(a,-1,sizeof(a))

#define mem0(a)           memset(a,0,sizeof(a))

#define ppcll             __builtin_popcountll

#define see(x) cerr << "\n" << (#x) << " is " << (x) << endl

#define out(x) cout << x << " ";

#define nl cout << "\n";

#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}

template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}



const long long INF=1e18;

const int32_t M32=1e9+7;

const int32_t MM32=998244353;

const int N=0;

//ascii value A=65,Z=90,a=97,z=122





ll BS(ll l, ll r, vector<pair<ll,pair<ll,ll>>> &v, ll value){

    ll ans = -1;

    while(l <= r){

        ll mid = (l+r) >> 1L;

        if(v[mid].first < value){

            ans = mid;

            l = mid+1;

        }

        else r = mid-1;

    }

    return ans;

}





int main()

{

IOS

ll t; cin >> t;

while(t--){

ll n, l,r;

cin >> n >> l >> r;



ll k = r-l+1;



vector<ll>v(n);

rep(i,0,n) cin >> v[i];



ll ans1 = 0;

vector<ll>a;

rep(i,0,r) a.push_back(v[i]);

sort(all(a));

rep(i,0,k) ans1 += a[i];



ll ans2 = 0;

vector<ll>b;

rep(i,l-1,n) b.push_back(v[i]);

sort(all(b));

rep(i,0,k) ans2 += b[i];



ll ans = min(ans1,ans2);

cout << ans << endl;

cout << endl;

}





return 0;

}

Answer: 2