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

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define MAXN 10000001
int spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)
        spf[i] = i;
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (int j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}
vector<int> getFactorization(int x)
{
    vector<int> ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}
void debug(vector<int> v){
    for(auto j: v){
        cout << j << " " ;
    }
    cout << endl;
}
int gcd(int a, int b){
    return __gcd(a, b);
}
int lcm(int a, int b){
    return ((a*b)/(gcd(a, b)));
}
int getBit(int num, int i) {
    // Shift 1 to the left by i positions to create a mask
    int mask = 1 << i;

    // Perform bitwise AND with the mask to get the bit at position i
    int result = (num & mask) >> i;

    return result;
}
void build(vector<int>& segtree, vector<int>&a, int low, int high, int index){
        if(low==high){
            segtree[index] = a[low]; return;
        }
        int mid = (low+high)/2;
        build(segtree,a, low, mid, 2*index+1);
        build(segtree,a, mid+1, high, 2*index+2);
        segtree[index] = segtree[2*index+1]&segtree[2*index+2];
    }
int query(vector<int>& segtree, int low, int high, int index, int queryl, int queryr) {
    // No overlap: Return a default value (0)
    if (queryl > high || queryr < low) {
        return -1;
    }
    // Complete overlap: Return the value in the current segment
    if (queryl <= low && queryr >= high) {
        return segtree[index];
    }
    // Partial overlap: Recurse into both left and right children
    int mid = (low + high) / 2;
    int left_result = query(segtree, low, mid, 2 * index + 1, queryl, queryr);
    int right_result = query(segtree, mid + 1, high, 2 * index + 2, queryl, queryr);
    return (left_result & right_result);
}
int mexx(vector<int> &arr, int N)
{
    //taken fron GFG

  // sort the array
  sort(arr.begin(), arr.end());

  int mex = 0;
  for (int idx = 0; idx < N; idx++)
  {
    if (arr[idx] == mex)
    {
      // Increment mex
      mex += 1;
    }
  }

  // Return mex as answer
  return mex;
}
int ceiling(int a, int b) {
    if(a % b == 0) {
        return a/b;
    }
    return (a/b + 1);
}
void solve()
{
    int n, l, r;
    cin >> n >> l >> r;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int k = r-l+1;
    int sum = 0;
    sort(a, a+n);
    for(int i = 0; i < k; i++) {
        sum += a[i];
    }
    cout << sum << endl;
}
int32_t main()
{
    int t;
    //t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}


Submission (verdict: Compilation error):
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define MAXN 10000001
int spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)
        spf[i] = i;
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (int j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}
vector<int> getFactorization(int x)
{
    vector<int> ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}
void debug(vector<int> v){
    for(auto j: v){
        cout << j << " " ;
    }
    cout << endl;
}
int gcd(int a, int b){
    return __gcd(a, b);
}
int lcm(int a, int b){
    return ((a*b)/(gcd(a, b)));
}
int getBit(int num, int i) {
    // Shift 1 to the left by i positions to create a mask
    int mask = 1 << i;

    // Perform bitwise AND with the mask to get the bit at position i
    int result = (num & mask) >> i;

    return result;
}
void build(vector<int>& segtree, vector<int>&a, int low, int high, int index){
        if(low==high){
            segtree[index] = a[low]; return;
        }
        int mid = (low+high)/2;
        build(segtree,a, low, mid, 2*index+1);
        build(segtree,a, mid+1, high, 2*index+2);
        segtree[index] = segtree[2*index+1]&segtree[2*index+2];
    }
int query(vector<int>& segtree, int low, int high, int index, int queryl, int queryr) {
    // No overlap: Return a default value (0)
    if (queryl > high || queryr < low) {
        return -1;
    }
    // Complete overlap: Return the value in the current segment
    if (queryl <= low && queryr >= high) {
        return segtree[index];
    }
    // Partial overlap: Recurse into both left and right children
    int mid = (low + high) / 2;
    int left_result = query(segtree, low, mid, 2 * index + 1, queryl, queryr);
    int right_result = query(segtree, mid + 1, high, 2 * index + 2, queryl, queryr);
    return (left_result & right_result);
}
int mexx(vector<int> &arr, int N)
{
    //taken fron GFG

  // sort the array
  sort(arr.begin(), arr.end());

  int mex = 0;
  for (int idx = 0; idx < N; idx++)
  {
    if (arr[idx] == mex)
    {
      // Increment mex
      mex += 1;
    }
  }

  // Return mex as answer
  return mex;
}
int ceiling(int a, int b) {
    if(a % b == 0) {
        return a/b;
    }
    return (a/b + 1);
}
void solve()
{
    int n, l, r;
    cin >> n >> l >> r;
    int a[n];
    int b[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    int k = r-l+1;
    int sum = 0;
    sort(a, a+r);
    for(int i = 0; i < k; i++) {
        sum += a[i];
    }
    int k = r-l+1;
    int sum1 = 0;
    sort(b+l-1, b+n);
    for(int i = 0; i < k; i++) {
        sum1 += b[i+l-1];
    }
    cout << min(sum,sum1) << endl;
}
int32_t main()
{
    int t;
    //t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}