ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <bit>
#include <bitset>
using namespace std;
void go()
{
  unsigned l, r;
  cin >> l >> r;
  if (l + 2 == r)
  {
    cout << l << " " << l + 1 << " " << l + 2 << endl;
    return;
  }
  int add = 0;
  for (int i = bit_width(unsigned(r)) - 1; i >= 0; i--)
  {
    if ((r >> i) == (l >> i))
    {
      if (r >> i)
      {
        r -= 1 << i;
        l -= 1 << i;
        add += 1 << i;
      }
      else
        break;
    }
  }
  unsigned res = 0;
  if (has_single_bit(r))
    res += r + add;
  else
    res += bit_floor(r) + 1 + add;
  cout << res - 2 << " " << res - 1 << " " << res << endl;
}
int main()
{
  int t;
  cin >> t;
  while (t--)
    go();
  return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#include <bit>
#include <bitset>
using namespace std;
void go()
{
  unsigned l, r;
  cin >> l >> r;
  if (l + 2 == r)
  {
    cout << l << " " << l + 1 << " " << l + 2 << endl;
    return;
  }
  int add = 0;
  for (int i = bit_width(unsigned(r)) - 1; i >= 0; i--)
  {
    if ((r >> i) == (l >> i))
    {
      if (r >> i)
      {
        r -= 1 << i;
        l -= 1 << i;
        add += 1 << i;
      }
    }
    else break;
  }
  unsigned res = 0;
  if (has_single_bit(r))
    res += r + add;
  else
    res += bit_floor(r) + 1 + add;
  cout << res - 2 << " " << res - 1 << " " << res << endl;
}
int main()
{
  int t;
  cin >> t;
  while (t--)
    go();
  return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--)
    {
        ll n, ans = 0;
        cin >> n;
        vector<ll> a(n);
        for (ll i = 0; i < n; i++)
        {
            cin >> a[i];
            ans += a[i];
        }
        while (a.size() > 1)
        {
            vector<ll> b;
            for (ll i = 0; i < a.size() - 1; i++)
                b.push_back(a[i + 1] - a[i]);
            a = b;
            ll temp = accumulate(a.begin(), a.end(), 0);
            if (temp < 0)
            {
                temp = -temp;
                for (ll i = 0; i < a.size(); i++)
                    a[i] = -a[i];
            }
            ans = max(ans, temp);
        }
        cout << ans << '\n';
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--)
    {
        ll n, ans = 0;
        cin >> n;
        vector<ll> a(n);
        for (ll i = 0; i < n; i++)
        {
            cin >> a[i];
            ans += a[i];
        }
        while (a.size() > 1)
        {
            vector<ll> b;
            for (ll i = 0; i < a.size() - 1; i++)
                b.push_back(a[i + 1] - a[i]);
            a = b;
            ll temp = accumulate(a.begin(), a.end(), 0);
            if (temp < 0)
            {
                temp = -temp;
                reverse(a.begin(), a.end());
            }
            ans = max(ans, temp);
        }
        cout << ans << '\n';
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--)
    {
        ll n, ans = 0;
        cin >> n;
        vector<ll> a(n);
        for (ll i = 0; i < n; i++)
        {
            cin >> a[i];
            ans += a[i];
        }
        while (a.size() > 1)
        {
            vector<ll> b;
            for (ll i = 0; i < a.size() - 1; i++)
                b.push_back(a[i + 1] - a[i]);
            a = b;
            ll temp = accumulate(a.begin(), a.end(), 0);
            if (temp < 0)
            {
                temp = -temp;
                reverse(a.begin(), a.end());
            }
            ans = max(ans, temp);
        }
        cout << ans << '\n';
    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        vector<ll> a(n);
        for (ll i = 0; i < n; i++)
            cin >> a[i];
        ll ans = accumulate(a.begin(), a.end(), 0LL);
        while (a.size() > 1)
        {
            vector<ll> b(a.size() - 1);
            for (ll i = 0; i < a.size() - 1; i++)
                b[i] = a[i + 1] - a[i];
            a = b;
            ll sum = 0;
            for (ll x : a)
                sum += x;
            ans = max(ans, abs(sum));
        }
        cout << ans << '\n';
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--)
    {
        ll n, ans = 0;
        cin >> n;
        vector<ll> a(n);
        for (ll i = 0; i < n; i++)
        {
            cin >> a[i];
            ans += a[i];
        }
        while (a.size() > 1)
        {
            vector<ll> b;
            for (ll i = 0; i < a.size() - 1; i++)
                b.push_back(a[i + 1] - a[i]);
            a = b;
            ll temp = accumulate(a.begin(), a.end(), 0);
            if (temp < 0)
            {
                temp = -temp;
                for (ll i = 0; i < a.size(); i++)
                    a[i] = -a[i];
            }
            ans = max(ans, temp);
        }
        cout << ans << '\n';
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define all(a) a.begin(), a.end()
#define pii pair<ll, ll>
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;

void solve(ll n)
{
    string num = to_string(n);
    ll num2 = 0, num3 = 0;
    ll sum = 0;
    for (auto i : num)
    {
        sum += i - '0';
        if (i == '2')
        {
            num2++;
        }
        else if (i == '3')
        {
            num3++;
        }
        sum = sum % 9;
    }
    if (sum % 9 == 0)
    {
        yes;
        return;
    }
    for (int i = 0; i <= num2; i++)
    {
        for (int j = 0; j <= num3; j++)
        {
            ll xx = sum + (6 * j) + (2 * i);
            if (xx % 9 == 0)
            {
                yes;
                return;
            }
        }
    }
    no;
}
int main()
{

    ll t;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        solve(n);
    }

    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define all(a) a.begin(), a.end()
#define pii pair<ll, ll>
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;

void solve(string num)
{
    ll num2 = 0, num3 = 0;
    ll sum = 0;
    for (auto i : num)
    {
        sum += i - '0';
        if (i == '2')
        {
            num2++;
        }
        else if (i == '3')
        {
            num3++;
        }
        sum = sum % 9;
    }
    if (sum % 9 == 0)
    {
        yes;
        return;
    }
    for (int i = 0; i <= num2; i++)
    {
        for (int j = 0; j <= num3; j++)
        {
            ll xx = sum + (6 * j) + (2 * i);
            if (xx % 9 == 0)
            {
                yes;
                return;
            }
        }
    }
    no;
}
int main()
{

    ll t;
    cin >> t;
    while (t--)
    {
        string num ; 
        cin >> num ; 
        solve(num);
    }

    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define all(a) a.begin(), a.end()
#define pii pair<ll, ll>
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;

void solve(ll n)
{
    string num = to_string(n);
    ll num2 = 0, num3 = 0;
    ll sum = 0;
    for (auto i : num)
    {
        sum += i;
        if (i == '2')
        {
            num2++;
        }
        else if (i == '3')
        {
            num3++;
        }
    }

    ll remain = 9 - (sum % 9);
    // cout << remain << ' ' << num3 << ' ' << num2 << endl;
    if (sum % 9 == 0)
    {
        if (num3 >= 3)
        {
            yes;
        }
        else
        {
            no;
        }
    }
    if (remain == 1)
    {
        if (num2 >= 5 || num3 >= 1 && num2 >= 2)
        {
            yes;
        }
        else
        {
            no;
        }
    }
    if (remain == 2)
    {
        if (num2 >= 1)
        {
            yes;
        }
        else
        {
            no;
        }
    }
    if (remain == 3)
    {
        if (num3 >= 2 || num3 >= 1 && num2 >= 3 || num2 >= 6)
        {
            yes;
        }
        else
        {
            no;
        }
    }
    if (remain == 4)
    {
        if (num2 >= 2)
        {
            yes;
        }
        else
        {
            no;
        }
    }
    if (remain == 5)
    {
        if (num3 >= 2 && num2 >= 1 || num3 >= 1 && num2 >= 4 || num2 >= 7)
        {
            yes;
        }
        else
        {
            no;
        }
    }
    if (remain == 6)
    {
        if (num2 >= 3 || num3 >= 1)
        {
            yes;
        }
        else
        {
            no;
        }
    }
    if (remain == 7)
    {
        if (num3 >= 2 && num2 >= 2 || num3 >= 1 && num2 >= 4 || num2 >= 8)
        {
            yes;
        }
        else
        {
            no;
        }
    }
    if (remain == 8)
    {
        if (num2 >= 4 || num3 >= 1 && num2 >= 1)
        {
            yes;
        }
        else
        {
            no;
        }
    }
}
int main()
{

    ll t;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        solve(n);
    }

    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

const int N = 100;

void get_sum(int n, long long *sum, int *a) {
    *sum = 0;
    for (int i = 0; i < n; i++) *sum += a[i];
    *sum = abs(*sum);
}

void make_new(int *a, int n) {
    int b[n];
    copy(a, a + n, b);
    for (int i = 0; i < n - 1; i++) {
        a[i] = b[i + 1] - b[i];
    }
}

long long solve(int n, int *a) {
    long long sum, ans;
    if (n == 1) {
        return a[0];
    }
    get_sum(n, &ans, a);
    while (n > 1) {
        make_new(a, n);
        n--;
        get_sum(n, &sum, a);
        ans = max(ans, sum);
    }
    return ans;
}

signed main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int tt, n, a[N];
    cin >> tt;
    while (tt--) {
        cin >> n;
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        cout << solve(n, a) << '\n';
    }
    return 0;
}



Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

const int N = 100;

void get_sum(int n, long long *sum, long long *a) {
    *sum = 0;
    for (int i = 0; i < n; i++) *sum += a[i];
    *sum = abs(*sum);
}

void make_new(long long *a, int n) {
    long long b[n];
    copy(a, a + n, b);
    for (int i = 0; i < n - 1; i++) {
        a[i] = b[i + 1] - b[i];
    }
}

long long solve(int n, long long *a) {
    long long sum, ans;
    if (n == 1) {
        return a[0];
    }
    get_sum(n, &ans, a);
    while (n > 1) {
        make_new(a, n);
        n--;
        get_sum(n, &sum, a);
        ans = max(ans, sum);
    }
    return ans;
}

signed main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int tt, n;
    long long a[N];
    cin >> tt;
    while (tt--) {
        cin >> n;
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        cout << solve(n, a) << '\n';
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

const int N = 100;

void get_sum(int n, long long *sum, int *a) {
    *sum = 0;
    for (int i = 0; i < n; i++) *sum += a[i];
    *sum = abs(*sum);
}

void make_new(int *a, int n) {
    int b[n];
    copy(a, a + n, b);
    for (int i = 0; i < n - 1; i++) {
        a[i] = b[i + 1] - b[i];
    }
}

long long solve(int n, int *a) {
    long long sum, ans;
    if (n == 1) {
        return a[0];
    }
    get_sum(n, &ans, a);
    while (n > 1) {
        make_new(a, n);
        n--;
        get_sum(n, &sum, a);
        ans = max(ans, sum);
    }
    return ans;
}

signed main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int tt, n, a[N];
    cin >> tt;
    while (tt--) {
        cin >> n;
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        cout << solve(n, a) << '\n';
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

const int N = 100;

void get_sum(int n, long long *sum, long long *a) {
    *sum = 0;
    for (int i = 0; i < n; i++) *sum += a[i];
    *sum = abs(*sum);
}

void make_new(long long *a, int n) {
    long long b[n];
    copy(a, a + n, b);
    for (int i = 0; i < n - 1; i++) {
        a[i] = b[i + 1] - b[i];
    }
}

long long solve(int n, long long *a) {
    long long sum, ans;
    if (n == 1) {
        return a[0];
    }
    get_sum(n, &ans, a);
    while (n > 1) {
        make_new(a, n);
        n--;
        get_sum(n, &sum, a);
        ans = max(ans, sum);
    }
    return ans;
}

signed main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int tt, n;
    long long a[N];
    cin >> tt;
    while (tt--) {
        cin >> n;
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        cout << solve(n, a) << '\n';
    }
    return 0;
}



Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;

const int N = 100;

void get_sum(int n, long long *sum, long long *a) {
    *sum = 0;
    for (int i = 0; i < n; i++) *sum += a[i];
    *sum = abs(*sum);
}

void make_new(long long *a, int n) {
    long long b[n];
    copy(a, a + n, b);
    for (int i = 0; i < n - 1; i++) {
        a[i] = b[i + 1] - b[i];
    }
}

long long solve(int n, long long *a) {
    long long sum, ans;
    for (int i = 0; i < n; i++) ans += a[i];
    while (n > 1) {
        make_new(a, n);
        n--;
        get_sum(n, &sum, a);
        ans = max(ans, sum);
    }
    return ans;
}

signed main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int tt, n;
    long long a[N];
    cin >> tt;
    while (tt--) {
        cin >> n;
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        cout << solve(n, a) << '\n';
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


Submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t;
    cin >> t;

    while(t--) {
        string num;
        cin >> num;
        
        long long sumOfDigits = 0;
        long long countOfTwos = 0, countOfThrees = 0;
        
        for (int i=0; i<num.size(); i++) {
            int digit = num][i] - '0';
            sumOfDigits += digit;
            if (digit == 2) countOfTwos++;
            if (digit == 3) countOfThrees++;
        }
        
        ll target = (-sumOfDigits) % 9;
        if (target < 0) target += 9;
        
        bool isPossible = false;
        
        for (ll b = 0; b <= 2 && b <= countOfThrees; b++) {
            ll temp = target - 6 * b;
            ll r = (5 * temp) % 9;
            if (r < 0) r += 9;
            if (r <= countOfTwos) {
                isPossible = true;
                break;
            }
        }

        if (isPossible) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t;
    cin >> t;

    while(t--) {
        string num;
        cin >> num;
        
        long long sumOfDigits = 0;
        long long countOfTwos = 0, countOfThrees = 0;
        
        for (int i=0; i<num.size(); i++) {
            int digit = num][i] - '0';
            sumOfDigits += digit;
            if (digit == 2) countOfTwos++;
            if (digit == 3) countOfThrees++;
        }
        
        ll target = (-sumOfDigits) % 9;
        if (target < 0) target += 9;
        
        bool isPossible = false;
        
        for (ll b = 0; b <= 2 && b <= countOfThrees; b++) {
            ll temp = target - 6 * b;
            ll r = (5 * temp) % 9;
            if (r < 0) r += 9;
            if (r <= countOfTwos) {
                isPossible = true;
                break;
            }
        }

        if (isPossible) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

}

Submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t;
    cin >> t;

    while(t--) {
        string num;
        cin >> num;
        
        long long sumOfDigits = 0;
        long long countOfTwos = 0, countOfThrees = 0;
        
        for (char c : nums) {
            int digit = c - '0';
            sumOfDigits += digit;
            if (digit == 2) countOfTwos++;
            if (digit == 3) countOfThrees++;
        }
        
        ll target = (-sumOfDigits) % 9;
        if (target < 0) target += 9;
        
        bool isPossible = false;
        
        for (ll b = 0; b <= 2 && b <= countOfThrees; b++) {
            ll temp = target - 6 * b;
            ll r = (5 * temp) % 9;
            if (r < 0) r += 9;
            if (r <= countOfTwos) {
                isPossible = true;
                break;
            }
        }

        if (isPossible) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t;
    cin >> t;

    while(t--) {
        string num;
        cin >> num;
        
        long long sumOfDigits = 0;
        long long countOfTwos = 0, countOfThrees = 0;
        
        for (char c : nums) {
            int digit = c - '0';
            sumOfDigits += digit;
            if (digit == 2) countOfTwos++;
            if (digit == 3) countOfThrees++;
        }
        
        ll target = (-sumOfDigits) % 9;
        if (target < 0) target += 9;
        
        bool isPossible = false;
        
        for (ll b = 0; b <= 2 && b <= countOfThrees; b++) {
            ll temp = target - 6 * b;
            ll r = (5 * temp) % 9;
            if (r < 0) r += 9;
            if (r <= countOfTwos) {
                isPossible = true;
                break;
            }
        }

        if (isPossible) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t;
    cin >> t;

    while(t--) {
        string num;
        cin >> num;
        
        long long sumOfDigits = 0;
        long long countOfTwos = 0, countOfThrees = 0;
        
        for (char c : num) {
            int digit = c - '0';
            sumOfDigits += digit;
            if (digit == 2) countOfTwos++;
            if (digit == 3) countOfThrees++;
        }
        
        long long target = (-sumOfDigits) % 9;
        if (target < 0) target += 9;
        
        bool isPossible = false;
        
        for (long long b = 0; b <= 2 && b <= countOfThrees; b++) {
            long long temp = target - 6 * b;
            long long r = (5 * temp) % 9;
            if (r < 0) r += 9;
            if (r <= countOfTwos) {
                isPossible = true;
                break;
            }
        }

        if (isPossible) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

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


Submission (verdict: Compilation error):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int mod = 998244353;

typedef pair<ll, ll> Interval;



void solve() {

    int n,l,r;

    cin >> n >> l >> r;

    vector<int> a(n);

    for(int i = 0;i < n;i++) cin >> a[i];

    vector<int> a,b;

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

        a.push_back(a[i]);

    }

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

        b.push_back(b[i]);

    }

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

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

    ll sum1 = accumulate(a.begin(),a.begin() +(r-l+1) ,0ll);

    ll sum2 = accumulate(b.begin(),b.begin() +(r-l+1) ,0ll);

    cout << max(sum1,sum2)

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int t = 1;

    cin >> t;

    

    while (t--) {

        solve();

    }

    

    return 0;

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

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int mod = 998244353;

typedef pair<ll, ll> Interval;



void solve() {

    int n,l,r;

    cin >> n >> l >> r;

    vector<int> a(n);

    for(int i = 0;i < n;i++) cin >> a[i];

    vector<int> a,b;

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

        a.push_back(a[i]);

    }

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

        b.push_back(b[i]);

    }

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

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

    ll sum1 = accumulate(a.begin(),a.begin() +(r-l+1) ,0ll);

    ll sum2 = accumulate(b.begin(),b.begin() +(r-l+1) ,0ll);

    cout << max(sum1,sum2)

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int t = 1;

    cin >> t;

    

    while (t--) {

        solve();

    }

    

    return 0;

}







Submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int mod = 998244353;

typedef pair<ll, ll> Interval;



void solve() {

    int n,l,r;

    cin >> n >> l >> r;

    vector<int> a(n);

    for(int i = 0;i < n;i++) cin >> a[i];

    vector<int> b,c;

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

        b.push_back(a[i]);

    }

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

        c.push_back(b[i]);

    }

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

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

    ll sum1 = accumulate(b.begin(),b.begin() +(r-l+1) ,0ll);

    ll sum2 = accumulate(c.begin(),c.begin() +(r-l+1) ,0ll);

    cout << max(sum1,sum2) <<"\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int t = 1;

    cin >> t;

    

    while (t--) {

        solve();

    }

    

    return 0;

}