ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

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

using namespace std;

typedef long long ll;



ll res = 0;



void solve() {

    string s;

    cin >> s;

    ll sum = 0;

    int tw = 0, th = 0;

    for (int i = 0; i < s.size(); i++) {

        int x = s[i] - '0';

        sum += x;

        if (x == 2)tw++;

        if (x == 3)th++;

    }

    if (sum % 9 == 0) {

        cout << "yes" << endl;

        return;

    }

    for (int i = 0; i <= min(8, tw); i++) {

        ll x = sum + 2 * i;

        for (int j = 0; j <= min(8, th); j++) {

            x += j * 6;

            if (x % 9 == 0) {

                cout << "yes" << endl;

                return;

            }

        }

        if (sum % 9 == 0) {

            cout << "yes" << endl;

            return;

        }

    }

    if (tw == 0) {

        for (int j = 0; j <= min(8, th); j++) {

            ll x = sum + j * 6;

            if (x % 9 == 0) {

                cout << "yes" << endl;

                return;

            }

        }

    }

    cout << "no" << endl;

    //cout << sum % 9 << " " << tw <<" "<<th<<" "<< endl;



}



int main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

	int t = 1;

    cin>>t;

    while (t--) {

        solve();

    }

	return 0;

}

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

using namespace std;

typedef long long ll;



ll res = 0;



void solve() {

    string s;

    cin >> s;

    ll sum = 0;

    int tw = 0, th = 0;

    for (int i = 0; i < s.size(); i++) {

        int x = s[i] - '0';

        sum += x;

        if (x == 2)tw++;

        if (x == 3)th++;

    }

    if (sum % 9 == 0) {

        cout << "yes" << endl;

        return;

    }

    for (int i = 0; i <= min(8, tw); i++) {

        ll x = sum + 2 * i;

        for (int j = 0; j <= min(8, th); j++) {

            x += j * 6;

            if (x % 9 == 0) {

                cout << "yes" << endl;

                return;

            }

        }

        if (x % 9 == 0) {

            cout << "yes" << endl;

            return;

        }

    }

    if (tw == 0) {

        for (int j = 0; j <= min(8, th); j++) {

            ll x = sum + j * 6;

            if (x % 9 == 0) {

                cout << "yes" << endl;

                return;

            }

        }

    }

    cout << "no" << endl;

    //cout << sum % 9 << " " << tw <<" "<<th<<" "<< endl;



}



int main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

	int t = 1;

    cin>>t;

    while (t--) {

        solve();

    }

	return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

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

using namespace std;

typedef long long ll;



ll res = 0;



void solve() {

    string s;

    cin >> s;

    ll sum = 0;

    int tw = 0, th = 0;

    for (int i = 0; i < s.size(); i++) {

        int x = s[i] - '0';

        sum += x;

        if (x == 2)tw++;

        if (x == 3)th++;

    }

    if (sum % 9 == 0) {

        cout << "yes" << endl;

        return;

    }

    for (int i = 0; i <= min(8, tw); i++) {

        ll x = sum + 2 * i;

        for (int j = 0; j <= min(8, th); j++) {

            x += j * 6;

            if (x % 9 == 0) {

                cout << "yes" << endl;

                return;

            }

        }

        if (x % 9 == 0) {

            cout << "yes" << endl;

            return;

        }

    }

    if (tw == 0) {

        for (int j = 0; j <= min(8, th); j++) {

            ll x = sum + j * 6;

            if (x % 9 == 0) {

                cout << "yes" << endl;

                return;

            }

        }

    }

    cout << "no" << endl;

    //cout << sum % 9 << " " << tw <<" "<<th<<" "<< endl;



}



int main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

	int t = 1;

    cin>>t;

    while (t--) {

        solve();

    }

	return 0;

}

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

using namespace std;

typedef long long ll;



void solve() {

    string s;

    cin >> s;

    ll sum = 0;

    int tw = 0, th = 0;

    for (int i = 0; i < s.size(); i++) {

        int x = s[i] - '0';

        sum += x;

        if (x == 2)tw++;

        if (x == 3)th++;

    }

    if (sum % 9 == 0) {

        cout << "yes" << endl;

        return;

    }

    for (int i = 0; i < min(9, tw+1); i++) {

        for (int j = 0; j < min(9, th+1); j++) {

            ll x = 2 * i + 6 * j+sum;

            if (x % 9 == 0) {

                cout << "yes" << endl;

                return;

            }

        }

    }

    cout << "no" << endl;

    //cout << sum % 9 << " " << tw <<" "<<th<<" "<< endl;



}



int main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

	int t = 1;

    cin>>t;

    while (t--) {

        solve();

    }

	return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


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

using namespace std;

typedef long long ll;



ll res = 0;



void solve() {

    string s;

    cin >> s;

    ll sum = 0;

    int tw = 0, th = 0;

    for (int i = 0; i < s.size(); i++) {

        int x = s[i] - '0';

        sum += x;

        if (x == 2)tw++;

        if (x == 3)th++;

    }

    if (sum % 9 == 0) {

        cout << "yes" << endl;

        return;

    }

    for (int i = 0; i <= min(8, tw); i++) {

        ll x = sum + 2 * i;

        for (int j = 0; j <= min(8, th); j++) {

            x += j * 6;

            if (x % 9 == 0) {

                cout << "yes" << endl;

                return;

            }

        }

        if (sum % 9 == 0) {

            cout << "yes" << endl;

            return;

        }

    }

    if (tw == 0) {

        for (int j = 0; j <= min(8, th); j++) {

            ll x = sum + j * 6;

            if (x % 9 == 0) {

                cout << "yes" << endl;

                return;

            }

        }

    }

    cout << "no" << endl;

    //cout << sum % 9 << " " << tw <<" "<<th<<" "<< endl;



}



int main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

	int t = 1;

    cin>>t;

    while (t--) {

        solve();

    }

	return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
// Bluntforces ;)

#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
typedef long long int ll;

void solve() {
    int n; cin >>n;
    vector <int>a(n);
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    for(int i=0;i<n/2;i+=2){
        if(a[i] >a[i+1]){
            cout <<"NO"<<endl;

            return;
        }
    }
    cout <<"YES"<<endl;
}

int main() {
    fast;
    ll t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
// Bluntforces ;)

#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
typedef long long int ll;

void solve() {
    int n; cin >>n;
    vector <int>a(n);
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    for(int i=0;i<n/2;i+=2){
        if(a[i] >a[i+1]){
            cout <<"NO"<<endl;

            return;
        }if(a[i] <a[i+1] && (a[i+1]-a[i]) > a[i+2]){
            cout <<"NO"<<endl;

            return;
        }
    }
    cout <<"YES"<<endl;
}

int main() {
    fast;
    ll t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
// Bluntforces ;)

#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
typedef long long int ll;

void solve() {
    int n; cin >>n;
    vector <int>a(n);
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    for(int i=0;i<n/2;i+=2){
        if(a[i] >a[i+1]){
            cout <<"NO"<<endl;

            return;
        }if(i>=(n/2)-1) continue;
        if(a[i] <a[i+1] && (a[i+1]-a[i]) > a[i+2]){
            cout <<"NO"<<endl;

            return;
        }
    }
    cout <<"YES"<<endl;
}

int main() {
    fast;
    ll t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
// Bluntforces ;)

#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
typedef long long int ll;

void solve() {
    int n; cin >>n;
    vector <int>a(n);
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    for(int i=0;i<n/2;i+=2){
        if(a[i] >a[i+1]){
            cout <<"NO"<<endl;

            return;
        }
    }
    cout <<"YES"<<endl;
}

int main() {
    fast;
    ll t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
// Bluntforces ;)

#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
typedef long long int ll;

void solve() {
    int n; cin >>n;
    vector <int>a(n);
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    for(int i=0;i<n/2;i+=2){
        if(a[i] >a[i+1]){
            cout <<"NO"<<endl;

            return;
        }if(a[i] <a[i+1] && (a[i+1]-a[i]) > a[i+2]){
            cout <<"NO"<<endl;

            return;
        }
    }
    cout <<"YES"<<endl;
}

int main() {
    fast;
    ll t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
// Bluntforces ;)

#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
typedef long long int ll;

void solve() {
    int n; cin >>n;
    vector <int>a(n);
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    for(int i=0;i<n/2;i+=2){
        if(a[i] >a[i+1]){
            cout <<"NO"<<endl;

            return;
        }if(i>=(n/2)-1) continue;
        if(a[i] <a[i+1] && (a[i+1]-a[i]) > a[i+2]){
            cout <<"NO"<<endl;

            return;
        }
    }
    cout <<"YES"<<endl;
}

int main() {
    fast;
    ll t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
typedef long long int ll;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    for (int i = 0; i < n - 1; i += 2) {  
        if (a[i] > a[i + 1]) {  
            cout << "NO" << endl;
            return;
        }
        
        if (i + 2 < n && (a[i+1] - a[i]) > a[i+2]) { 
            cout << "NO" << endl;
            return;
        }
    }

    cout << "YES" << endl;
}

int main() {
    fast;
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
typedef long long int ll;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    for (int i = 0; i < n - 1; i += 2) {  
        if (a[i] > a[i + 1]) {  
            cout << "NO" << endl;
            return;
        }
        
        if (i + 2 < n && (a[i+1] - a[i]) > a[i+2]) { 
            cout << "NO" << endl;
            return;
        }
    }

    cout << "YES" << endl;
}

int main() {
    fast;
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
typedef long long int ll;

void solve() {
    int n;
    cin >> n;
    deque<int> a(n);
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    
  while(a.size()>1){
    if(a[0]>a[1]){
        cout <<"NO"<<endl;
        return;
    }else if(a[0]<a[1]){
        a[1]-=a[0];
        a.pop_front();
    }else{
        a.pop_front();
        a.pop_front();
    }
  }
  cout <<"YES"<<endl;
}

int main() {
    fast;
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

using namespace std;



void solve()

{

    int n; cin >> n;

    vector<int> a(n);

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

    for(int i = n-2; i >= 1; i--) {

        if(a[i] > a[i+1]) {

            int jar = a[i] - a[i+1];

            a[i] -= jar;

            if(a[i-1] - jar < 1) {

                cout << "no\n"; return;

            } 

            a[i-1] -= jar;

            i--;

        }

    }

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

        if(a[i] > a[i+1]) {

            cout << "no\n"; return;

        }

    }

    cout << "yes\n";

}



int main()

{

    ios::sync_with_stdio(false); cin.tie(0);

    int t; cin >> t;

    while(t--) solve();

    return 0;

}

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

using namespace std;



void solve()

{

    int n; cin >> n;

    vector<int> a(n);

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

    for(int i = n-2; i >= 1; i--) {

        if(a[i] > a[i+1]) {

            int jar = a[i] - a[i+1];

            a[i] -= jar;

            if(a[i-1] - jar < 0) {

                cout << "no\n"; return;

            } 

            a[i-1] -= jar;

            i--;

        }

    }

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

        if(a[i] > a[i+1]) {

            cout << "no\n"; return;

        }

    }

    cout << "yes\n";

}



int main()

{

    ios::sync_with_stdio(false); cin.tie(0);

    int t; cin >> t;

    while(t--) solve();

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>

using namespace std;



void solve()

{

    int n; cin >> n;

    vector<int> a(n);

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

    for(int i = n-2; i >= 0; i--) {

        if(a[i] > a[i+1]) {

            int jar = a[i] - a[i+1];

            a[i] -= jar;

            if(a[i-1] - jar < 1) {

                cout << "no\n"; return;

            } 

            a[i-1] -= jar;

            i--;

        }

    }

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

        if(a[i] > a[i+1]) {

            cout << "no\n"; return;

        }

    }

    cout << "yes\n";

}



int main()

{

    ios::sync_with_stdio(false); cin.tie(0);

    int t; cin >> t;

    while(t--) solve();

    return 0;

}

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

using namespace std;



void solve()

{

    int n; cin >> n;

    vector<int> a(n);

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

    for(int i = n-2; i >= 1; i--) {

        if(a[i] > a[i+1]) {

            int jar = a[i] - a[i+1];

            a[i] -= jar;

            if(a[i-1] - jar < 1) {

                cout << "no\n"; return;

            } 

            a[i-1] -= jar;

            i--;

        }

    }

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

        if(a[i] > a[i+1]) {

            cout << "no\n"; return;

        }

    }

    cout << "yes\n";

}



int main()

{

    ios::sync_with_stdio(false); cin.tie(0);

    int t; cin >> t;

    while(t--) solve();

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

void solve()
{
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0;  i < n; i +=2) {
        if(a[i] > a[i+1]) {
            cout << "no" << endl;
            return;
        }
    }
    cout << "yes" << endl;
}
int main()
{
    int t; cin >> t;
    while(t--) {
        solve();
    }
}

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

using namespace std;



void solve()

{

    int n; cin >> n;

    vector<int> a(n);

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

    for(int i = n-2; i >= 0; i--) {

        if(a[i] > a[i+1]) {

            int jar = a[i] - a[i+1];

            a[i] -= jar;

            if(a[i-1] - jar < 1) {

                cout << "no\n"; return;

            } 

            a[i-1] -= jar;

            i--;

        }

    }

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

        if(a[i] > a[i+1]) {

            cout << "no\n"; return;

        }

    }

    cout << "yes\n";

}



int main()

{

    ios::sync_with_stdio(false); cin.tie(0);

    int t; cin >> t;

    while(t--) solve();

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


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

void solve()
{
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0;  i < n; i +=2) {
        if(a[i] > a[i+1]) {
            cout << "no" << endl;
            return;
        }
    }
    cout << "yes" << endl;
}
int main()
{
    int t; cin >> t;
    while(t--) {
        solve();
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

using namespace std;



void solve()

{

    int n; cin >> n;

    vector<int> a(n);

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

    for(int i = n-2; i >= 1; i--) {

        if(a[i] > a[i+1]) {

            int jar = a[i] - a[i+1];

            a[i] -= jar;

            if(a[i-1] - jar < 0) {

                cout << "no\n"; return;

            } 

            a[i-1] -= jar;

            i--;

        }

    }

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

        if(a[i] > a[i+1]) {

            cout << "no\n"; return;

        }

    }

    cout << "yes\n";

}



int main()

{

    ios::sync_with_stdio(false); cin.tie(0);

    int t; cin >> t;

    while(t--) solve();

    return 0;

}

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

using namespace std;



void solve()

{

    int n; cin >> n;

    vector<int> a(n);

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

    for(int i = n-2; i >= 1; i--) {

        if(a[i] > a[i+1]) {

            int jar = a[i] - a[i+1];

            a[i] -= jar;

            if(a[i-1] - jar < 0) {

                cout << "no\n"; return;

            } 

            a[i-1] -= jar;

        }

    }

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

        if(a[i] > a[i+1]) {

            cout << "no\n"; return;

        }

    }

    cout << "yes\n";

}



int main()

{

    ios::sync_with_stdio(false); cin.tie(0);

    int t; cin >> t;

    while(t--) solve();

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
typedef long long ll;

void Func() {
    ll n, l, r;
    cin >> n >> l >> r;
    vector<ll> v(n);
    for (ll i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    ll ans = 0;
    for (ll i = 0; i < r-l+1; i++) {
        ans+=v[i];
    }
    cout << ans << endl;
}

int main() {
#ifdef LOCAL
    freopen("Testlib.in", "r", stdin);
    freopen("Code.out", "w", stdout);
#endif
    int T;
    cin >> T;
    while (T--) {
        Func();
    }
    return 0;
}


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

using namespace std;

const int N = 1e5 + 10;

typedef long long ll;



void Func() {

    ll n, l, r;

    cin >> n >> l >> r;

    priority_queue<ll, vector<ll>, greater<> > q2,q1;

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

        ll x;

        cin >> x;

        if (i<=r) q1.push(x);

        if (i>=l) q2.push(x);

    }

    ll ans = 0,ans2 = 0;

    for (ll i = 1; i <= r-l+1; i++) {

        ans += q1.top();

        q1.pop();

        ans2 += q2.top();

        q2.pop();

    }

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

}



int main() {

#ifdef LOCAL

    freopen("Testlib.in", "r", stdin);

    freopen("Code.out", "w", stdout);

#endif

    int T;

    cin >> T;

    while (T--) {

        Func();

    }

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;

const int N = 1e5 + 10;

typedef long long ll;



void Func() {

    ll n, l, r;

    cin >> n >> l >> r;

    priority_queue<ll, vector<ll>, greater<ll> > q2;

    priority_queue<ll> q1;

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

        ll x;

        cin >> x;

        if (l <= i && i <= r) {

            q1.push(x);

        } else {

            q2.push(x);

        }

    }

    while (!q2.empty() && !q1.empty() && q1.top() > q2.top()) {

        q1.pop();

        q1.push(q2.top());

        q2.pop();

    }

    ll ans = 0;

    while (!q1.empty()) {

        ans += q1.top();

        q1.pop();

    }

    cout << ans << endl;

}



int main() {

    int T;

    cin >> T;

    while (T--) {

        Func();

    }

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
typedef long long ll;

void Func() {
    ll n, l, r;
    cin >> n >> l >> r;
    priority_queue<ll, vector<ll>, greater<ll> > q2;
    priority_queue<ll> q1;
    queue<ll> q;
    for (int i = 1; i <= n; i++) {
        ll x;
        cin >> x;
        if (l <= i && i <= r) {
            q1.push(x);
        } else {
            q2.push(x);
        }
    }
    while (!q2.empty() && !q1.empty() && q1.top() > q2.top()) {
        q1.pop();
        q.push(q2.top());
        q2.pop();
    }
    ll ans = 0;
    while (!q1.empty()) {
        ans += q1.top();
        q1.pop();
    }
    while (!q.empty()) {
        ans += q.front();
        q.pop();
    }
    cout << ans << endl;
}

int main() {
#ifdef LOCAL
    freopen("Testlib.in", "r", stdin);
    freopen("Code.out", "w", stdout);
#endif
    int T;
    cin >> T;
    while (T--) {
        Func();
    }
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
typedef long long ll;

void Func() {
    ll n, l, r;
    cin >> n >> l >> r;
    vector<ll> v(n);
    for (ll i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    ll ans = 0;
    for (ll i = 0; i < r-l+1; i++) {
        ans+=v[i];
    }
    cout << ans << endl;
}

int main() {
#ifdef LOCAL
    freopen("Testlib.in", "r", stdin);
    freopen("Code.out", "w", stdout);
#endif
    int T;
    cin >> T;
    while (T--) {
        Func();
    }
    return 0;
}