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

Solution 1 (runtime: 93 ms):
#include<bits/stdc++.h>

using namespace std;

typedef vector<int> vi;
typedef vector<long long int> vll;
typedef long long int lli;
typedef pair<int, int> pii;
typedef map<string, int> msi;
typedef map<int, vector<int>> miv;

// Funciones vector
#define PB(a) push_back(a);

bool sort_func(lli a, lli b) {
  if (a < b) {
    return true;
  } else {
    return false;
  }
}
#define ord(vect) sort(vect.begin(), vect.end(), sort_func);

#define borra_el(vect, el) vect.erase(vect.find(el));
#define borra_range(vect, a, b) vect.erase(a, b);
#define borra(vect, n) vect.erase(vect.begin() + n);
#define B begin();
#define E end();
#define copia(v1, v2)                                                          \
  ;                                                                            \
  copy(v1.begin(), v1.end(), back_inserter(v2));

// Funciones map
#define F first;
#define S second;

// Logaritmo de 2
double log_2 = log(2);
double log2(int a) { return (log(a) / log_2); }

void Imprime(vi vect) {
  for (int i = 0; i < vect.size(); i++) {
    cout << vect[i] << " ";
  }
  cout << "\n";
}

void Imprime2d(vector<vi> vect) {
  for (int j = 0; j<vect.size(); j++){
    for (int i = 0; i < vect[j].size(); i++) {
        cout << vect[j][i] << " ";
    }
    cout << "\n";
  }
}

void Imprime_set(set<int> s) {
  copy(s.begin(), s.end(), ostream_iterator<int>(cout, " "));
  cout << endl;
}

int maximo_comun_divisor(int a, int b) {
  int temporal; // Para no perder b
  while (b != 0) {
    temporal = b;
    b = a % b;
    a = temporal;
  }
  return a;
}

int minimo_comun_multiplo(int a, int b) {
  return (a * b) / maximo_comun_divisor(a, b);
}

bool isNumeric(string const &str) {
  auto it = str.begin();
  while (it != str.end() && isdigit(*it)) {
    it++;
  }
  return !str.empty() && it == str.end();
}

vll lee(lli n) {
  lli el;
  vll vect;
  for (int i = 0; i < n; i++) {
    cin >> el;
    vect.PB(el);
  }
  return (vect);
}

int solve() {
  // Code aquí
  lli n, l, r;
  cin >> n >> l >> r;

  vll a;
  a = lee(n);

  vll al, ar;
  for (int i = 0; i<n; i++){
    if (i<=r-1){
        al.PB(a[i]);
    }
    if (i>=l-1){
        ar.PB(a[i]);
    }
  }
  ord(al);
  ord(ar);
  lli sum_1 = 0, sum_2 = 0;
  for (int i = 0; i<r-l+1; i++){
    if (i<al.size()){
        sum_1+=al[i];
    }
    if (i<ar.size()){
        sum_2+=ar[i];
    }
  }
  cout << min(sum_1, sum_2) << endl;

  return 0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr); 
  int T;
  cin >> T; // Número de casos
  while (T--) {
    solve();
  }
  return 0;
}

//Eliminar comentario si el proyecto está terminado (Dinámica empezó el 21/06/2024)

Solution 2 (runtime: 218 ms):
#include <iostream>

#include <vector>

#include <algorithm>

#define ll long long

using namespace std;



void solve() {

    int n, l, r; cin >> n >> l >> r;

    vector<int> v(n + 1), v1(n + 1);

    for (int i = 1; i <= n; i++) { cin >> v[i]; v1[i] = v[i]; }

    sort(v.begin() + 1, v.end());

    sort(v1.begin() + l + 1, v1.begin() + r + 1);

    ll ans1 = 0, ans2 = 0;

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

    for (int i = l; i <= r; i++) ans2 += v1[i];

    cout << min(ans1, ans2) << endl;

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    int t;

    cin >> t;

    while (t--) solve();



    return 0;

}