ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
// "ولا تقولن لشيء إني فاعل ذلك غدا"
// "إلا أن يشاء الله واذكر ربك إذا نسيت وقل عسى أن يهديني ربي لأقرب من هذا رشدا"

// LINK :
#include <bits/stdc++.h>
#define ll long long
#define nl '\n'
#define sp ' '
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define no cout<<"NO\n"
#define yes cout<<"YES\n"
#define ENG_GAMAL ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
using namespace std;
// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
const int N = 2e5 + 5, M = 1e3, LOG = 20, inf = 0x3f3f3f3f;
ll infLL = 0x3f3f3f3f3f3f3f3f;

void solve() {
    ll n;
    cin >> n;
    vector<ll>a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (ll i = 0; i < n - 1; ++i) {
        ll sub = min(a[i] , a[i + 1]);
        a[i] -= sub;
        a[i + 1] -= sub;
    }
    count(all(a) , 0) == n - 1 && a[n - 1]? yes : no;
}
void file()
{
#ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
    freopen("Error.txt", "w", stderr);
#endif
}

int main() {
    file();
    ENG_GAMAL
// test-independent code ——————————————————————
// ————————————————————————————————————————————
    ll t = 1;
     cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}

Submission (verdict: Accepted):
// "ولا تقولن لشيء إني فاعل ذلك غدا"
// "إلا أن يشاء الله واذكر ربك إذا نسيت وقل عسى أن يهديني ربي لأقرب من هذا رشدا"

// LINK :
#include <bits/stdc++.h>
#define ll long long
#define nl '\n'
#define sp ' '
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define no cout<<"NO\n"
#define yes cout<<"YES\n"
#define ENG_GAMAL ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
using namespace std;
// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
const int N = 2e5 + 5, M = 1e3, LOG = 20, inf = 0x3f3f3f3f;
ll infLL = 0x3f3f3f3f3f3f3f3f;

void solve() {
    ll n;
    cin >> n;
    vector<ll>a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (ll i = 0; i < n - 1; ++i) {
        ll sub = min(a[i] , a[i + 1]);
        a[i] -= sub;
        a[i + 1] -= sub;
    }
    ll cnt = count(all(a) , 0);
    (cnt == n - 1 && a[n - 1]) || cnt == n ? yes : no;
}
void file()
{
#ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
    freopen("Error.txt", "w", stderr);
#endif
}

int main() {
    file();
    ENG_GAMAL
// test-independent code ——————————————————————
// ————————————————————————————————————————————
    ll t = 1;
     cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>  
#define F first   
#define S second   
#define ll long long  
#define pll pair <ll, ll>  
#define pii pair <int, int>  
#define pb push_back
#define rnd srand(static_cast<unsigned int>(time(0)))
using namespace std;  
const int mod = 1e9 + 7;  
const int MAXN = 1e6 + 5;  
const int inf = 2e9;
void solve(){
    int n;
    ll mx = -inf, sum = 0;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    if (n > 1) mx = max(mx, abs(sum));
    else mx = max(mx, sum);
    while((int)a.size() != 1){
        for (int i = 0; i < (int)a.size() - 1; i ++){
            a[i] *= (-1LL); 
            a[i] += a[i + 1];
        }
        a.pop_back();
        sum = 0;
        for (ll i : a)
            sum += i;
        mx = max(mx, abs(sum));
    }
    cout << mx << endl;
}
int main(){  
    ios_base::sync_with_stdio(0);  
    cin.tie(0);  
    cout.tie(0);  
    int t;
    cin >> t;
    while (t --)    
        solve();
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>  
#define F first   
#define S second   
#define ll long long  
#define pll pair <ll, ll>  
#define pii pair <int, int>  
#define pb push_back
#define rnd srand(static_cast<unsigned int>(time(0)))
using namespace std;  
const int mod = 1e9 + 7;  
const int MAXN = 1e6 + 5;  
const int inf = 2e9;
void solve(){
    int n;
    ll mx = -2e18, sum = 0;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    if (n > 1) mx = max(mx, abs(sum));
    else mx = max(mx, sum);
    while((int)a.size() != 1){
        for (int i = 0; i < (int)a.size() - 1; i ++){
            a[i] *= (-1LL); 
            a[i] += a[i + 1];
        }
        a.pop_back();
        sum = 0;
        for (ll i : a)
            sum += i;
        mx = max(mx, abs(sum));
    }
    cout << mx << endl;
}
int main(){  
    ios_base::sync_with_stdio(0);  
    cin.tie(0);  
    cout.tie(0);  
    int t;
    cin >> t;
    while (t --)    
        solve();
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>  
#define F first   
#define S second   
#define ll long long  
#define pll pair <ll, ll>  
#define pii pair <int, int>  
#define pb push_back
#define rnd srand(static_cast<unsigned int>(time(0)))
using namespace std;  
const int mod = 1e9 + 7;  
const int MAXN = 1e6 + 5;  
const int inf = 2e9;
void solve(){
    int n;
    ll mx = 0, sum = 0;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    if (n > 1) mx = max(mx, abs(sum));
    while((int)a.size() != 1){
        for (int i = 0; i < (int)a.size() - 1; i ++){
            a[i] *= (-1LL); 
            a[i] += a[i + 1];
        }
        a.pop_back();
        sum = 0;
        for (ll i : a)
            sum += i;
        mx = max(mx, abs(sum));
    }
    cout << mx << endl;
}
int main(){  
    ios_base::sync_with_stdio(0);  
    cin.tie(0);  
    cout.tie(0);  
    int t;
    cin >> t;
    while (t --)    
        solve();
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>  
#define F first   
#define S second   
#define ll long long  
#define pll pair <ll, ll>  
#define pii pair <int, int>  
#define pb push_back
#define rnd srand(static_cast<unsigned int>(time(0)))
using namespace std;  
const int mod = 1e9 + 7;  
const int MAXN = 1e6 + 5;  
const int inf = 2e9;
void solve(){
    int n;
    ll mx = 0, sum = 0;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    if (n > 1) mx = max(mx, abs(sum));
    while((int)a.size() != 1){
        for (int i = 0; i < (int)a.size() - 1; i ++){
            a[i] *= (-1LL); 
            a[i] += a[i + 1];
        }
        a.pop_back();
        sum = 0;
        for (ll i : a)
            sum += i;
        mx = max(mx, abs(sum));
    }
    cout << mx << endl;
}
int main(){  
    ios_base::sync_with_stdio(0);  
    cin.tie(0);  
    cout.tie(0);  
    int t;
    cin >> t;
    while (t --)    
        solve();
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>  
#define F first   
#define S second   
#define ll long long  
#define pll pair <ll, ll>  
#define pii pair <int, int>  
#define pb push_back
#define rnd srand(static_cast<unsigned int>(time(0)))
using namespace std;  
const int mod = 1e9 + 7;  
const int MAXN = 1e6 + 5;  
const int inf = 2e9;
void solve(){
    int n;
    ll mx = 0, sum = 0;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    if (n > 1) mx = max(mx, abs(sum));
    else mx = max(mx, sum);
    while((int)a.size() != 1){
        for (int i = 0; i < (int)a.size() - 1; i ++){
            a[i] *= (-1LL); 
            a[i] += a[i + 1];
        }
        a.pop_back();
        sum = 0;
        for (ll i : a)
            sum += i;
        mx = max(mx, abs(sum));
    }
    cout << mx << endl;
}
int main(){  
    ios_base::sync_with_stdio(0);  
    cin.tie(0);  
    cout.tie(0);  
    int t;
    cin >> t;
    while (t --)    
        solve();
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>  
#define F first   
#define S second   
#define ll long long  
#define pll pair <ll, ll>  
#define pii pair <int, int>  
#define pb push_back
#define rnd srand(static_cast<unsigned int>(time(0)))
using namespace std;  
const int mod = 1e9 + 7;  
const int MAXN = 1e6 + 5;  
const int inf = 2e9;
void solve(){
    int n;
    ll mx = 0, sum = 0;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    if (n > 1) mx = max(mx, abs(sum));
    else mx = max(mx, sum);
    while((int)a.size() != 1){
        for (int i = 0; i < (int)a.size() - 1; i ++){
            a[i] *= (-1LL); 
            a[i] += a[i + 1];
        }
        a.pop_back();
        sum = 0;
        for (ll i : a)
            sum += i;
        mx = max(mx, abs(sum));
    }
    cout << mx << endl;
}
int main(){  
    ios_base::sync_with_stdio(0);  
    cin.tie(0);  
    cout.tie(0);  
    int t;
    cin >> t;
    while (t --)    
        solve();
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>  
#define F first   
#define S second   
#define ll long long  
#define pll pair <ll, ll>  
#define pii pair <int, int>  
#define pb push_back
#define rnd srand(static_cast<unsigned int>(time(0)))
using namespace std;  
const int mod = 1e9 + 7;  
const int MAXN = 1e6 + 5;  
const int inf = 2e9;
void solve(){
    int n;
    ll mx = -inf, sum = 0;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    if (n > 1) mx = max(mx, abs(sum));
    else mx = max(mx, sum);
    while((int)a.size() != 1){
        for (int i = 0; i < (int)a.size() - 1; i ++){
            a[i] *= (-1LL); 
            a[i] += a[i + 1];
        }
        a.pop_back();
        sum = 0;
        for (ll i : a)
            sum += i;
        mx = max(mx, abs(sum));
    }
    cout << mx << endl;
}
int main(){  
    ios_base::sync_with_stdio(0);  
    cin.tie(0);  
    cout.tie(0);  
    int t;
    cin >> t;
    while (t --)    
        solve();
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>  
#define F first   
#define S second   
#define ll long long  
#define pll pair <ll, ll>  
#define pii pair <int, int>  
#define pb push_back
#define rnd srand(static_cast<unsigned int>(time(0)))
using namespace std;  
const int mod = 1e9 + 7;  
const int MAXN = 1e6 + 5;  
const int inf = 2e9;
void solve(){
    int n;
    ll mx = -2e18, sum = 0;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    if (n > 1) mx = max(mx, abs(sum));
    else mx = max(mx, sum);
    while((int)a.size() != 1){
        for (int i = 0; i < (int)a.size() - 1; i ++){
            a[i] *= (-1LL); 
            a[i] += a[i + 1];
        }
        a.pop_back();
        sum = 0;
        for (ll i : a)
            sum += i;
        mx = max(mx, abs(sum));
    }
    cout << mx << endl;
}
int main(){  
    ios_base::sync_with_stdio(0);  
    cin.tie(0);  
    cout.tie(0);  
    int t;
    cin >> t;
    while (t --)    
        solve();
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>  
#define F first   
#define S second   
#define ll long long  
#define pll pair <ll, ll>  
#define pii pair <int, int>  
#define pb push_back
#define rnd srand(static_cast<unsigned int>(time(0)))
using namespace std;  
const int mod = 1e9 + 7;  
const int MAXN = 1e6 + 5;  
const int inf = 2e9;
void solve(){
    int n;
    ll mx = -2e18, sum = 0;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        sum += a[i];
    }
    mx = max(mx, sum);
    while((int)a.size() != 1){
        for (int i = 0; i < (int)a.size() - 1; i ++){
            a[i] *= (-1LL); 
            a[i] += a[i + 1];
        }
        a.pop_back();
        sum = 0;
        for (ll i : a)
            sum += i;
        if (n > 1) mx = max(mx, abs(sum));
        else mx = max(mx, sum);
    }
    cout << mx << endl;
}
int main(){  
    ios_base::sync_with_stdio(0);  
    cin.tie(0);  
    cout.tie(0);  
    int t;
    cin >> t;
    while (t --)    
        solve();
}
Problem: 2062C - Cirno and Operations
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 re register
#define lep(i,l,r) for(int i=l;i<=r;++i)
#define rep(i,l,r) for(int i=l;i>=r;--i)
inline int read()//如果用long long记得改
{
	int s=0,w=1; char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') w=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') s=s*10+c-'0',c=getchar();
	return s*w;
}
void write(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10); putchar(x%10+'0');
}
int T,n,ans,a[100];
signed main()
{
	T=read();
	while(T--)
	{
		n=read(); lep(i,1,n) a[i]=read(),ans+=a[i]; ans=0;
		if(n>1) 
		{
			lep(k,1,n)
			{
				ans=max(ans,abs(a[n-k+1]-a[1]));
				lep(i,1,n-k) a[i]=a[i+1]-a[i];
			}
		}
		write(ans),putchar(10);
	}
	return 0;
}


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define lep(i,l,r) for(int i=l;i<=r;++i)
#define rep(i,l,r) for(int i=l;i>=r;--i)
inline int read()//如果用long long记得改
{
	int s=0,w=1; char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') w=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') s=s*10+c-'0',c=getchar();
	return s*w;
}
void write(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10); putchar(x%10+'0');
}
int T,n,ans,a[100];
signed main()
{
	T=read();
	while(T--)
	{ans=0;
		n=read(); lep(i,1,n) a[i]=read(),ans+=a[i]; 
		if(n>1) 
		{
			lep(k,1,n)
			{
				ans=max(ans,abs(a[n-k+1]-a[1]));
				lep(i,1,n-k) a[i]=a[i+1]-a[i];
			}
		}
		write(ans),putchar(10);
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define lep(i,l,r) for(int i=l;i<=r;++i)
#define rep(i,l,r) for(int i=l;i>=r;--i)
inline int read()//如果用long long记得改
{
	int s=0,w=1; char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') w=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') s=s*10+c-'0',c=getchar();
	return s*w;
}
void write(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10); putchar(x%10+'0');
}
int T,n,ans,a[100];
signed main()
{
	T=read();
	while(T--)
	{
		n=read(); lep(i,1,n) a[i]=read(),ans+=a[i]; ans=0;
		if(n>1) 
		{
			lep(k,1,n)
			{
				ans=max(ans,abs(a[n-k+1]-a[1]));
				lep(i,1,n-k) a[i]=a[i+1]-a[i];
			}
		}
		write(ans),putchar(10);
	}
	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 re register
#define lep(i,l,r) for(int i=l;i<=r;++i)
#define rep(i,l,r) for(int i=l;i>=r;--i)
inline int read()//如果用long long记得改
{
	int s=0,w=1; char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') w=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') s=s*10+c-'0',c=getchar();
	return s*w;
}
void write(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10); putchar(x%10+'0');
}
int T,n,ans,a[100];
signed main()
{
	T=read();
	while(T--)
	{ans=0;
		n=read(); lep(i,1,n) a[i]=read(),ans+=a[i]; 
		if(n>1) 
		{
			lep(k,1,n)
			{
				ans=max(ans,abs(a[n-k+1]-a[1]));
				lep(i,1,n-k) a[i]=a[i+1]-a[i];
			}
		}
		write(ans),putchar(10);
	}
	return 0;
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define lep(i,l,r) for(ll i=l;i<=r;++i)
#define rep(i,l,r) for(ll i=l;i>=r;--i)
inline ll read()//如果用long long记得改
{
	ll s=0,w=1; char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') w=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') s=s*10+c-'0',c=getchar();
	return s*w;
}
void write(ll x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10); putchar(x%10+'0');
}
ll T,n,ans,a[100];
signed main()
{
	T=read();
	while(T--)
	{ans=0;
		n=read(); lep(i,1,n) a[i]=read(),ans+=a[i]; 
		if(n>1) 
		{
			lep(k,1,n)
			{
				ans=max(ans,abs(a[n-k+1]-a[1]));
				lep(i,1,n-k) a[i]=a[i+1]-a[i];
			}
		}
		write(ans),putchar(10);
	}
	return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)


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

// sorting 2D MATRIX.....
// bool cmp(vector<ll> &a, vector<ll> &b)
// {
//     ll ans1=accumulate(a.begin(),a.end(),0ll);
//     ll ans2=accumulate(b.begin(),b.end(),0ll);
//     if(ans1==ans2)
//     {
//         for (int i = 0; i < a.size(); ++i)
//         {
//             if(a[i]!=b[i])
//             {
//                 return a[i]>b[i];
//             }
//         }
//     }
//     return ans1>ans2;
// }

// void solve() {
//     int t;
//     cin >> t;
//     while (t--) {
//         string s;
//         cin >> s;
//         int n = s.length();

//         // Option 1: "((((...))))"
//         string t1 = string(n, '(') + string(n, ')');

//         // Option 2: "()()()()"
//         string t2 = "";
//         for (int i = 0; i < n; i++) t2 += "()";

//         // If s is not found as a substring, print it
//         if (t1.find(s) == string::npos) {
//             cout << "YES\n" << t1 << "\n";
//         } else if (t2.find(s) == string::npos) {
//             cout << "YES\n" << t2 << "\n";
//         } else {
//             cout << "NO\n";
//         }
//     }
// }

void solve()
{
    int t; cin>>t;
    while(t--)
    {
        int n,k; cin>>n>>k;
        vector<ll>v(n);
        map<ll,ll> m;
        for (int i = 0; i < n; ++i)
        {
            cin>>v[i];
            m[v[i]]++;
        }
        ll cheak=INT_MIN;
        for(auto it: m)
        {
            cheak=max(cheak,(it).second);
        }
        if(n==1) cout<<1<<endl;
        else if(k==0) cout<<n-cheak<<endl;
        else cout<<(n-cheak+k-1)/k<<endl;
    }
}

int main() 
{
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
     while(t--){
        int n,l,r;
        cin>>n>>l>>r;
        vector<int> v(n);
        for(int &i:v) cin>>i;
        priority_queue<int> pq2,empty;
        priority_queue<int,vector<int>,greater<int>> pq1,pq3;
        int sum{};
        sum=accumulate(v.begin()+l-1,v.begin()+r,0);
        for(int i=0;i<l-1;i++) pq1.push(v[i]);
        for(int i=r;i<n;i++) pq3.push(v[i]);
        for(int i=l-1;i<r;i++) pq2.push(v[i]);
        int curr_sum=sum;
        //case 1
        while(!pq1.empty() && !pq2.empty()){
            if(pq1.top()>=pq2.top()) break;
            else curr_sum-=(pq2.top()-pq1.top());
            pq1.pop();
            pq2.pop();
        }
        int ans=curr_sum;
        curr_sum=sum;
        pq2.swap(empty);
        for(int i=l-1;i<r;i++) pq2.push(v[i]);
        //case 2
        while(!pq3.empty() && !pq2.empty()){
            if(pq3.top()>=pq2.top()) break;
            else curr_sum-=(pq2.top()-pq3.top());
            pq3.pop();
            pq2.pop();
        }
        ans=min(ans,curr_sum);
        cout<<ans<<'\n';
    }
}

Submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    cin>>t;
     while(t--){
        ll n,l,r;
        cin>>n>>l>>r;
        vector<ll> v(n);
        for(ll &i:v) cin>>i;
        priority_queue<ll> pq2,empty;
        priority_queue<ll,vector<ll>,greater<ll>> pq1,pq3;
        ll sum{};
        sum=accumulate(v.begin()+l-1,v.begin()+r,0);
        for(ll i=0;i<l-1;i++) pq1.push(v[i]);
        for(ll i=r;i<n;i++) pq3.push(v[i]);
        for(ll i=l-1;i<r;i++) pq2.push(v[i]);
        ll curr_sum=sum;
        //case 1
        while(!pq1.empty() && !pq2.empty()){
            if(pq1.top()>=pq2.top()) break;
            else curr_sum-=(pq2.top()-pq1.top());
            pq1.pop();
            pq2.pop();
        }
        ll ans=curr_sum;
        curr_sum=sum;
        pq2.swap(empty);
        for(ll i=l-1;i<r;i++) pq2.push(v[i]);
        //case 2
        while(!pq3.empty() && !pq2.empty()){
            if(pq3.top()>=pq2.top()) break;
            else curr_sum-=(pq2.top()-pq3.top());
            pq3.pop();
            pq2.pop();
        }
        ans=min(ans,curr_sum);
        cout<<ans<<'\n';
    }
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
     while(t--){
        int n,l,r;
        cin>>n>>l>>r;
        vector<int> v(n);
        for(int &i:v) cin>>i;
        priority_queue<int> pq2,empty;
        priority_queue<int,vector<int>,greater<int>> pq1,pq3;
        int sum{};
        sum=accumulate(v.begin()+l-1,v.begin()+r,0);
        for(int i=0;i<l-1;i++) pq1.push(v[i]);
        for(int i=r;i<n;i++) pq3.push(v[i]);
        for(int i=l-1;i<r;i++) pq2.push(v[i]);
        int curr_sum=sum;
        //case 1
        while(!pq1.empty() && !pq2.empty()){
            if(pq1.top()>=pq2.top()) break;
            else curr_sum-=(pq2.top()-pq1.top());
            pq1.pop();
            pq2.pop();
        }
        int ans=curr_sum;
        curr_sum=sum;
        pq2.swap(empty);
        for(int i=l-1;i<r;i++) pq2.push(v[i]);
        //case 2
        while(!pq3.empty() && !pq2.empty()){
            if(pq3.top()>=pq2.top()) break;
            else curr_sum-=(pq2.top()-pq3.top());
            pq3.pop();
            pq2.pop();
        }
        ans=min(ans,curr_sum);
        cout<<ans<<'\n';
    }
}