Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#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+1+r);

  sort(b+1+l,b+1+n);

  int 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;

}











Submission (verdict: Accepted):
#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;
}