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

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cassert>
#include <bitset>
#include <cstring>
#include <queue>
#include <set>
#include <cmath>
#include <tuple>
#include <map>

using namespace std;

typedef long long ll;
#define int ll
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long> vl;
typedef string str;
typedef pair<int, int> pii;
typedef pair<long, long> pllll;

#define all(a) a.begin(), a.end()
#define Debug(x) cout << #x " = " << (x) << '\n'
#define for_n(s, e, i) for (ll i = s; i < e; i++)
#define for_e(e,of) for (auto& e : of)
#define clr(arr) memset(arr,0,sizeof(arr))
#define pb push_back

const ll MOD=1e9+7;
ll madd(ll a, ll b) { return (a + b) % MOD; }

const int directions[4][2]={-1,0,0,-1,0,1,1,0};

const int N=2e5+5;
int n,t,a[N];

signed main(void)
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin>>t;
    while(t--)
    {
        cin>>n;
        
        for_n(0,n,i)
        {
            cin>>a[i];
        }

        for_n(0,n,i)
        {
            if(a[i]<a[i+1])
            {
                a[i+1]-=a[i];
                a[i]=0;
            }
        }
        cout<<(is_sorted(a,a+n)?"YES":"NO")<<'\n';
    }
    return 0;
}


Submission (verdict: Accepted):
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cassert>
#include <bitset>
#include <cstring>
#include <queue>
#include <set>
#include <cmath>
#include <tuple>
#include <map>

using namespace std;

typedef long long ll;
#define int ll
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long> vl;
typedef string str;
typedef pair<int, int> pii;
typedef pair<long, long> pllll;

#define all(a) a.begin(), a.end()
#define Debug(x) cout << #x " = " << (x) << '\n'
#define for_n(s, e, i) for (ll i = s; i < e; i++)
#define for_e(e,of) for (auto& e : of)
#define clr(arr) memset(arr,0,sizeof(arr))
#define pb push_back

const ll MOD=1e9+7;
ll madd(ll a, ll b) { return (a + b) % MOD; }

const int directions[4][2]={-1,0,0,-1,0,1,1,0};

const int N=2e5+5;
int n,t,a[N];

signed main(void)
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin>>t;
    while(t--)
    {
        cin>>n;
        
        for_n(0,n,i)
        {
            cin>>a[i];
        }

        for_n(0,n,i)
        {
            if(a[i]<=a[i+1])
            {
                a[i+1]-=a[i];
                a[i]=0;
            }
        }
        cout<<(is_sorted(a,a+n)?"YES":"NO")<<'\n';
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <utility>

#include <algorithm>

#include <cassert>

#include <bitset>

#include <cstring>

#include <queue>

#include <set>

#include <cmath>

#include <tuple>

#include <numeric>

#include <map>



using namespace std;



typedef long long ll;

#define int ll

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<long> vl;

typedef string str;

typedef pair<int, int> pii;

typedef pair<long, long> pllll;



#define all(a) a.begin(), a.end()

#define Debug(x) cout << #x " = " << (x) << '\n'

#define for_n(s, e, i) for (ll i = s; i < e; i++)

#define for_e(e,of) for (auto& e : of)

#define clr(arr) memset(arr,0,sizeof(arr))

#define pb push_back

#define heap_array(t,sz) make_unique<t[]>(sz); 

#define heap_array_fill(a,sz,v) fill(a.get(),a.get()+sz,v); 



const ll MOD=1e9+7;

ll madd(ll a, ll b) { return (a + b) % MOD; }



const int directions[4][2]={-1,0,0,-1,0,1,1,0};



const int N=1e5+5;

int n,t,a[N],l,r;



signed main(void)

{

    // ios_base::sync_with_stdio(false);

	// cin.tie(NULL);

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        for_n(0,n,i) cin>>a[i];

        

        sort(a+l-1,a+n);

        sort(a,a+r,greater<int>());



        cout<<accumulate(a+l-1,a+r,0)<<'\n';

    }



    return 0;

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

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cassert>
#include <bitset>
#include <cstring>
#include <queue>
#include <set>
#include <cmath>
#include <tuple>
#include <numeric>
#include <map>

using namespace std;

typedef long long ll;
#define int ll
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long> vl;
typedef string str;
typedef pair<int, int> pii;
typedef pair<long, long> pllll;

#define all(a) a.begin(), a.end()
#define Debug(x) cout << #x " = " << (x) << '\n'
#define for_n(s, e, i) for (ll i = s; i < e; i++)
#define for_e(e,of) for (auto& e : of)
#define clr(arr) memset(arr,0,sizeof(arr))
#define pb push_back
#define heap_array(t,sz) make_unique<t[]>(sz); 
#define heap_array_fill(a,sz,v) fill(a.get(),a.get()+sz,v); 

const ll MOD=1e9+7;
ll madd(ll a, ll b) { return (a + b) % MOD; }

const int directions[4][2]={-1,0,0,-1,0,1,1,0};

const int N=1e5+5;
int n,t,a[N],l,r;

signed main(void)
{
    cin>>t;
    while(t--)
    {
        cin>>n>>l>>r;
        for_n(0,n,i) cin>>a[i];
        
        sort(a,a+r,greater<int>());
        sort(a+l-1,a+n);

        int sum=0;
        for_n(l-1,r,i)
            sum+=a[i];

        cout<<sum<<'\n';
    }

    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <utility>

#include <algorithm>

#include <cassert>

#include <bitset>

#include <cstring>

#include <queue>

#include <set>

#include <cmath>

#include <tuple>

#include <numeric>

#include <map>

#include <memory>



using namespace std;



typedef long long ll;

#define int ll

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<long> vl;

typedef string str;

typedef pair<int, int> pii;

typedef pair<long, long> pllll;



#define all(a) a.begin(), a.end()

#define Debug(x) cout << #x " = " << (x) << '\n'

#define for_n(s, e, i) for (ll i = s; i < e; i++)

#define for_e(e,of) for (auto& e : of)

#define clr(arr) memset(arr,0,sizeof(arr))

#define pb push_back

#define heap_array(t,sz) make_unique<t[]>(sz); 

#define heap_array_fill(a,sz,v) fill(a.get(),a.get()+sz,v); 



const ll MOD=1e9+7;

ll madd(ll a, ll b) { return (a + b) % MOD; }



const int directions[4][2]={-1,0,0,-1,0,1,1,0};



const int N=1e5+5;

int n,t,a[N],l,r;



signed main(void)

{

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        auto a=heap_array(int,n);

        for_n(0,n,i) cin>>a[i];

        

        sort(a.get(),a.get()+r,greater<int>());

        sort(a.get()+l-1,a.get()+n);



        int sum=0;

        for_n(l-1,r,i)

            sum+=a[i];



        cout<<sum<<'\n';

    }



    return 0;

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

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <utility>

#include <algorithm>

#include <cassert>

#include <bitset>

#include <cstring>

#include <queue>

#include <set>

#include <cmath>

#include <tuple>

#include <numeric>

#include <map>

#include <memory>



using namespace std;



typedef long long ll;

#define int ll

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<long> vl;

typedef string str;

typedef pair<int, int> pii;

typedef pair<long, long> pllll;



#define all(a) a.begin(), a.end()

#define Debug(x) cout << #x " = " << (x) << '\n'

#define for_n(s, e, i) for (ll i = s; i < e; i++)

#define for_e(e,of) for (auto& e : of)

#define clr(arr) memset(arr,0,sizeof(arr))

#define pb push_back

#define heap_array(t,sz) make_unique<t[]>(sz); 

#define heap_array_fill(a,sz,v) fill(a.get(),a.get()+sz,v); 



const ll MOD=1e9+7;

ll madd(ll a, ll b) { return (a + b) % MOD; }



const int directions[4][2]={-1,0,0,-1,0,1,1,0};



const int N=1e5+5;

int n,t,a[N],l,r;



signed main(void)

{

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        auto a=heap_array(int,n);

        for_n(0,n,i) cin>>a[i];

        

        sort(a.get(),a.get()+r,greater<int>());

        sort(a.get()+l-1,a.get()+n);



        int sum=0;

        for_n(l-1,r,i)

            sum+=a[i];



        cout<<sum<<'\n';

    }



    return 0;

}



Submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <utility>

#include <algorithm>

#include <cassert>

#include <bitset>

#include <cstring>

#include <queue>

#include <set>

#include <cmath>

#include <tuple>

#include <numeric>

#include <map>



using namespace std;



typedef long long ll;

#define int ll

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<long> vl;

typedef string str;

typedef pair<int, int> pii;

typedef pair<long, long> pllll;



#define all(a) a.begin(), a.end()

#define Debug(x) cout << #x " = " << (x) << '\n'

#define for_n(s, e, i) for (ll i = s; i < e; i++)

#define for_e(e,of) for (auto& e : of)

#define clr(arr) memset(arr,0,sizeof(arr))

#define pb push_back

#define heap_array(t,sz) make_unique<t[]>(sz); 

#define heap_array_fill(a,sz,v) fill(a.get(),a.get()+sz,v); 



const ll MOD=1e9+7;

ll madd(ll a, ll b) { return (a + b) % MOD; }



const int directions[4][2]={-1,0,0,-1,0,1,1,0};



const int N=1e5+5;

int n,t,a[N],l,r;



signed main(void)

{

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        for_n(0,n,i) cin>>a[i];

        

        sort(a+l-1,a+n);

        int sum=accumulate(a+l-1,a+r,0ll);



        sort(a,a+r,greater<int>());

        sum=min(sum,accumulate(a+l-1,a+r,0ll));



        cout<<sum<<'\n';

    }



    return 0;

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

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <utility>

#include <algorithm>

#include <cassert>

#include <bitset>

#include <cstring>

#include <queue>

#include <set>

#include <cmath>

#include <tuple>

#include <numeric>

#include <map>



using namespace std;



typedef long long ll;

#define int ll

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<long> vl;

typedef string str;

typedef pair<int, int> pii;

typedef pair<long, long> pllll;



#define all(a) a.begin(), a.end()

#define Debug(x) cout << #x " = " << (x) << '\n'

#define for_n(s, e, i) for (ll i = s; i < e; i++)

#define for_e(e,of) for (auto& e : of)

#define clr(arr) memset(arr,0,sizeof(arr))

#define pb push_back

#define heap_array(t,sz) make_unique<t[]>(sz); 

#define heap_array_fill(a,sz,v) fill(a.get(),a.get()+sz,v); 



const ll MOD=1e9+7;

ll madd(ll a, ll b) { return (a + b) % MOD; }



const int directions[4][2]={-1,0,0,-1,0,1,1,0};



const int N=1e5+5;

int n,t,a[N],l,r;



signed main(void)

{

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        for_n(0,n,i) cin>>a[i];

        

        sort(a+l-1,a+n);

        int sum=accumulate(a+l-1,a+r,0ll);



        sort(a,a+r,greater<int>());

        sum=min(sum,accumulate(a+l-1,a+r,0ll));



        cout<<sum<<'\n';

    }



    return 0;

}



Submission (verdict: Accepted):
#include <iostream>

#include <vector>

#include <utility>

#include <algorithm>

#include <cassert>

#include <bitset>

#include <cstring>

#include <queue>

#include <set>

#include <cmath>

#include <tuple>

#include <numeric>

#include <map>



using namespace std;



typedef long long ll;

#define int ll

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<long> vl;

typedef string str;

typedef pair<int, int> pii;

typedef pair<long, long> pllll;



#define all(a) a.begin(), a.end()

#define Debug(x) cout << #x " = " << (x) << '\n'

#define for_n(s, e, i) for (ll i = s; i < e; i++)

#define for_e(e,of) for (auto& e : of)

#define clr(arr) memset(arr,0,sizeof(arr))

#define pb push_back

#define heap_array(t,sz) make_unique<t[]>(sz); 

#define heap_array_fill(a,sz,v) fill(a.get(),a.get()+sz,v); 



const ll MOD=1e9+7;

ll madd(ll a, ll b) { return (a + b) % MOD; }



const int directions[4][2]={-1,0,0,-1,0,1,1,0};



const int N=1e5+5;

int n,t,a[N],b[N],l,r;



signed main(void)

{

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        for_n(0,n,i)

        {

            cin>>a[i];

            b[i]=a[i];

        }

        

        sort(b+l-1,b+n);

        sort(a,a+r,greater<int>());



        cout<<min(accumulate(b+l-1,b+r,0ll),accumulate(a+l-1,a+r,0ll))<<'\n';

    }



    return 0;

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

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <vector>

#include <utility>

#include <algorithm>

#include <cassert>

#include <bitset>

#include <cstring>

#include <queue>

#include <set>

#include <cmath>

#include <tuple>

#include <numeric>

#include <map>



using namespace std;



typedef long long ll;

#define int ll

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<long> vl;

typedef string str;

typedef pair<int, int> pii;

typedef pair<long, long> pllll;



#define all(a) a.begin(), a.end()

#define Debug(x) cout << #x " = " << (x) << '\n'

#define for_n(s, e, i) for (ll i = s; i < e; i++)

#define for_e(e,of) for (auto& e : of)

#define clr(arr) memset(arr,0,sizeof(arr))

#define pb push_back

#define heap_array(t,sz) make_unique<t[]>(sz); 

#define heap_array_fill(a,sz,v) fill(a.get(),a.get()+sz,v); 



const ll MOD=1e9+7;

ll madd(ll a, ll b) { return (a + b) % MOD; }



const int directions[4][2]={-1,0,0,-1,0,1,1,0};



const int N=1e5+5;

int n,t,a[N],l,r;



signed main(void)

{

    // ios_base::sync_with_stdio(false);

	// cin.tie(NULL);

    cin>>t;

    while(t--)

    {

        cin>>n>>l>>r;

        for_n(0,n,i) cin>>a[i];

        

        sort(a+l-1,a+n);

        sort(a,a+r,greater<int>());



        cout<<accumulate(a+l-1,a+r,0)<<'\n';

    }



    return 0;

}



Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cassert>
#include <bitset>
#include <cstring>
#include <queue>
#include <set>
#include <cmath>
#include <tuple>
#include <numeric>
#include <map>

using namespace std;

typedef long long ll;
#define int ll
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long> vl;
typedef string str;
typedef pair<int, int> pii;
typedef pair<long, long> pllll;

#define all(a) a.begin(), a.end()
#define Debug(x) cout << #x " = " << (x) << '\n'
#define for_n(s, e, i) for (ll i = s; i < e; i++)
#define for_e(e,of) for (auto& e : of)
#define clr(arr) memset(arr,0,sizeof(arr))
#define pb push_back
#define heap_array(t,sz) make_unique<t[]>(sz); 
#define heap_array_fill(a,sz,v) fill(a.get(),a.get()+sz,v); 

const ll MOD=1e9+7;
ll madd(ll a, ll b) { return (a + b) % MOD; }

const int directions[4][2]={-1,0,0,-1,0,1,1,0};

const int N=1e5+5;
int n,t,a[N],l,r;

signed main(void)
{
    cin>>t;
    while(t--)
    {
        cin>>n>>l>>r;
        for_n(0,n,i) cin>>a[i];
        
        sort(a,a+r,greater<int>());
        sort(a+l-1,a+n);

        int sum=0;
        for_n(l-1,r,i)
            sum+=a[i];

        cout<<sum<<'\n';
    }

    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
struct node
{
	int v_id,e_num;
};
bool cmp(node a,node b)
{
	return a.e_num>b.e_num;
}
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		cin>>n;
		vector<node> cnt(n+1,{0,0});
		vector<set<int>> adj(n+1);
		for(int i=1;i<=n;i++)cnt[i].v_id=i;
		for(int i=1;i<n;i++)
		{
			int a,b;
			cin>>a>>b;
			cnt[a].e_num++;
			cnt[b].e_num++;
			adj[a].insert(b);
			adj[b].insert(a);
		}
		sort(cnt.begin(),cnt.end(),cmp);
		int ans=0;
		if(cnt[0].e_num>1)ans+=cnt[0].e_num;
		else
		{
			cout << 0 << '\n';
			continue;
		}
		int i=1,c=cnt[1].e_num;
		if(c>1)
		{
			while(cnt[i].e_num==c&&adj[cnt[0].v_id].count(cnt[i].v_id))i++;
			if(cnt[i].e_num==c)ans+=c-1;
			else ans+=c-2;
		}
		else ans--;
		cout << ans << '\n';
	}
	return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
struct node
{
	int v_id,e_num;
};
bool cmp(node a,node b)
{
	return a.e_num>b.e_num;
}
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		cin>>n;
		vector<node> cnt(n+1,{0,0});
		vector<set<int>> adj(n+1);
		for(int i=1;i<=n;i++)cnt[i].v_id=i;
		for(int i=1;i<n;i++)
		{
			int a,b;
			cin>>a>>b;
			cnt[a].e_num++;
			cnt[b].e_num++;
			adj[a].insert(b);
			adj[b].insert(a);
		}
		sort(cnt.begin(),cnt.end(),cmp);
		int ans=0;
		if(cnt[0].e_num==cnt[1].e_num)
		{
			if(cnt[2].e_num==cnt[0].e_num||!adj[cnt[0].v_id].count(cnt[1].v_id))ans+=cnt[0].e_num*2-1;
			else ans+=cnt[0].e_num*2-2;
		}
		else
		{
			ans+=cnt[0].e_num;
			int i=1,c=cnt[1].e_num;
			while(cnt[i].e_num==c&&adj[cnt[0].v_id].count(cnt[i].v_id))i++;
			if(cnt[i].e_num==c)ans+=c-1;
			else ans+=c-2;
		}
		cout << ans << '\n';
	}
	return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		cin>>n;
		vector<int> cnt(n+1,0);
		for(int i=1;i<n;i++)
		{
			int a,b;
			cin>>a>>b;
			cnt[a]++;
			cnt[b]++;
		}
		sort(cnt.begin(),cnt.end(),greater<int>());
		int ans=0;
		if(cnt[0]>1)ans+=cnt[0];
		else
		{
			cout << 0 << '\n';
			continue;
		}
		if(cnt[1]>1)ans+=cnt[1]-1;
		else ans--;
		cout << ans << '\n';
	}
	return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		cin>>n;
		vector<int> cnt(n+1,0);
		for(int i=1;i<n;i++)
		{
			int a,b;
			cin>>a>>b;
			cnt[a]++;
			cnt[b]++;
		}
		sort(cnt.begin(),cnt.end(),greater<int>());
		int ans=0;
		if(cnt[0]>1)ans+=cnt[0];
		else
		{
			cout << 0 << '\n';
			continue;
		}
		if(cnt[1]>1)ans+=cnt[1]-1;
		else ans--;
		cout << ans << '\n';
	}
	return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
struct node
{
	int v_id,e_num;
};
bool cmp(node a,node b)
{
	return a.e_num>b.e_num;
}
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		cin>>n;
		vector<node> cnt(n+1,{0,0});
		vector<set<int>> adj(n+1);
		for(int i=1;i<=n;i++)cnt[i].v_id=i;
		for(int i=1;i<n;i++)
		{
			int a,b;
			cin>>a>>b;
			cnt[a].e_num++;
			cnt[b].e_num++;
			adj[a].insert(b);
			adj[b].insert(a);
		}
		sort(cnt.begin(),cnt.end(),cmp);
		int ans=0;
		if(cnt[0].e_num>1)ans+=cnt[0].e_num;
		else
		{
			cout << 0 << '\n';
			continue;
		}
		int i=1,c=cnt[1].e_num;
		if(c>1)
		{
			while(cnt[i].e_num==c&&adj[cnt[0].v_id].count(cnt[i].v_id))i++;
			if(cnt[i].e_num==c)ans+=c-1;
			else ans+=c-2;
		}
		else ans--;
		cout << ans << '\n';
	}
	return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 8):
// YA HEYDAR -E- CARRAR
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const ll INF = LLONG_MAX;
const int N = 2e5 + 10;
const ll MOD = 1e9 + 7;
const ll delta = 10597;

int a[N];

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n, l, r;
        cin >> n >> l >> r;
        int m = r - l + 1;
        vector<int> v[2];
        for (int i = 0; i < n; i++) {
            cin >> a[i];
            if (i + 1 <= r) v[0].push_back(a[i]);
            if (i + 1 >= l) v[1].push_back(a[i]);
        }
        sort(v[0].begin(), v[0].end());
        sort(v[1].begin(), v[1].end());
        int sum[2] = {0, 0};
        for (int i = 0; i < m; i++)
            for (int j = 0; j < 2; j++) sum[j] += v[j][i];
        cout << min(sum[0], sum[1]) << endl;
    }
    return 0;
}


Submission (verdict: Accepted):
// YA HEYDAR -E- CARRAR
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const ll INF = LLONG_MAX;
const int N = 2e5 + 10;
const ll MOD = 1e9 + 7;
const ll delta = 10597;

int a[N];

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n, l, r;
        cin >> n >> l >> r;
        int m = r - l + 1;
        vector<ll> v[2];
        for (int i = 0; i < n; i++) {
            cin >> a[i];
            if (i + 1 <= r) v[0].push_back(a[i]);
            if (i + 1 >= l) v[1].push_back(a[i]);
        }
        sort(v[0].begin(), v[0].end());
        sort(v[1].begin(), v[1].end());
        ll sum[2] = {0, 0};
        for (int i = 0; i < m; i++)
            for (int j = 0; j < 2; j++) sum[j] += v[j][i];
        cout << min(sum[0], sum[1]) << endl;
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const ll INF = LLONG_MAX;
const int N = 2e5 + 10;
const ll MOD = 1e9 + 7;
const ll delta = 10597;

int a[N];

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n, l, r;
        cin >> n >> l >> r;
        int m = r - l  + 1;
        for(int i = 0; i < n; i++) cin >> a[i];
        sort(a, a + n);
        int sum = 0;
        for(int i = 0; i < m; i++)
            sum += a[i];
        cout << sum << endl;
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const ll INF = LLONG_MAX;
const int N = 2e5 + 10;
const ll MOD = 1e9 + 7;
const ll delta = 10597;

int a[N];

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n, l, r;
        cin >> n >> l >> r;
        int m = r - l  + 1;
        for(int i = 0; i < n; i++) cin >> a[i];
        sort(a, a + n);
        int sum = 0;
        for(int i = 0; i < m; i++)
            sum += a[i];
        cout << sum << endl;
    }
    return 0;
}


Submission (verdict: Wrong answer on test 8):
// YA HEYDAR -E- CARRAR
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const ll INF = LLONG_MAX;
const int N = 2e5 + 10;
const ll MOD = 1e9 + 7;
const ll delta = 10597;

int a[N];

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n, l, r;
        cin >> n >> l >> r;
        int m = r - l + 1;
        vector<int> v[2];
        for (int i = 0; i < n; i++) {
            cin >> a[i];
            if (i + 1 <= r) v[0].push_back(a[i]);
            if (i + 1 >= l) v[1].push_back(a[i]);
        }
        sort(v[0].begin(), v[0].end());
        sort(v[1].begin(), v[1].end());
        int sum[2] = {0, 0};
        for (int i = 0; i < m; i++)
            for (int j = 0; j < 2; j++) sum[j] += v[j][i];
        cout << min(sum[0], sum[1]) << endl;
    }
    return 0;
}