ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 6):
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <algorithm>
#include <set>
#include <map>

using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tc;
    cin>>tc;
    for(int _=0; _<tc; _++){
        string s;
        cin>>s;
        bool flag = true;
        while(flag){
            if(s.length()==1){
                flag=false;
            }
            for(int i=1; i<s.length(); i++){
                if(s[i]>(s[i-1]+1) && s[i]!='0'){
                    char temp = s[i-1];
                    s[i-1]=s[i]-1;
                    s[i]=temp;
                    break;
                }
                if(i==(s.length()-1)){
                    flag=false;
                }
            }
            // cout<<"string: "<<s<<endl;
        }
        cout<<s<<endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <algorithm>
#include <set>
#include <map>

using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tc;
    cin>>tc;
    for(int _=0; _<tc; _++){
        string s;
        cin>>s;
        // BRUTE FORCE 1 ********************************************************************************************************
        // bool flag = true;
        // while(flag){
        //     if(s.length()==1){
        //         flag=false;
        //     }
        //     for(int i=1; i<s.length(); i++){
        //         if(s[i]>(s[i-1]+1) && s[i]!='0'){
        //             char temp = s[i-1];
        //             s[i-1]=s[i]-1;
        //             s[i]=temp;
        //             break;
        //         }
        //         if(i==(s.length()-1)){
        //             flag=false;
        //         }
        //     }
        // }
        // ***********************************************************************************************************************

        for(int i=1; i<s.length(); i++){
            char a = s[i];
            for(int j=i-1; j>=0; j--){
                // cout<<"String: "<<s[i]<<" "<<s[j]<<" "<<s<<endl;
                if(s[i]>s[j]+1 && s[i]!=0){
                    char temp = s[j];
                    s[j]=s[i]-1;
                    s[i]=temp;
                    i--;
                }
                
            }
        }


        cout<<s<<endl;
    }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 2):
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <algorithm>
#include <set>
#include <map>

using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tc;
    cin>>tc;
    for(int _=0; _<tc; _++){
        string s,test;
        cin>>s;
        test=s;
        bool flag = true;
        while(flag){
            for(int i=1; i<s.length(); i++){
                if(s[i]>(s[i-1]+1) && s[i]!='0'){
                    char temp = s[i-1];
                    s[i-1]=s[i]-1;
                    s[i]=temp;
                    break;
                }
                if(i==(s.length()-1)){
                    flag=false;
                }
            }
            // cout<<"string: "<<s<<endl;
        }
        cout<<s<<endl;
    }
    return 0;
}

Submission (verdict: Time limit exceeded on test 6):
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <algorithm>
#include <set>
#include <map>

using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tc;
    cin>>tc;
    for(int _=0; _<tc; _++){
        string s;
        cin>>s;
        bool flag = true;
        while(flag){
            if(s.length()==1){
                flag=false;
            }
            for(int i=1; i<s.length(); i++){
                if(s[i]>(s[i-1]+1) && s[i]!='0'){
                    char temp = s[i-1];
                    s[i-1]=s[i]-1;
                    s[i]=temp;
                    break;
                }
                if(i==(s.length()-1)){
                    flag=false;
                }
            }
            // cout<<"string: "<<s<<endl;
        }
        cout<<s<<endl;
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
// Codeforces Round 998: Problem D

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define f first
#define s second

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

    // for (auto x : a) cout << x << ' ';
    // cout << '\n';

    for (int i = 1; i < n; i++) {
        if (a[i] < a[i - 1]) {
            cout << "NO\n";
            return;
        }
    }

    cout << "YES\n";
}

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    cin >> t;
    while (t--) solve();
}

Submission (verdict: Accepted):
// Codeforces Round 998: Problem D

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define f first
#define s second

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

    // for (auto x : a) cout << x << ' ';
    // cout << '\n';

    for (int i = 1; i < n; i++) {
        if (a[i] < a[i - 1]) {
            cout << "NO\n";
            return;
        }
    }

    cout << "YES\n";
}

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    cin >> t;
    while (t--) solve();
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
// Codeforces Round 998: Problem D

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define f first
#define s second

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

    for (int i = 1; i < n; i++) {
        if (a[i] < a[i - 1]) {
            cout << "NO\n";
            return;
        }
    }

    cout << "YES\n";
}

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    cin >> t;
    while (t--) solve();
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
// Codeforces Round 998: Problem D

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define f first
#define s second

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

    for (int i = 1; i < n; i++) {
        if (a[i] < a[i - 1]) {
            cout << "NO\n";
            return;
        }
    }

    cout << "YES\n";
}

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    cin >> t;
    while (t--) solve();
}

Submission (verdict: Wrong answer on test 2):
// Codeforces Round 998: Problem D

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define f first
#define s second

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

    // for (auto x : a) cout << x << ' ';
    // cout << '\n';

    for (int i = 1; i < n; i++) {
        if (a[i] < a[i - 1]) {
            cout << "NO\n";
            return;
        }
    }

    cout << "YES\n";
}

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    cin >> t;
    while (t--) solve();
}
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 int long long
typedef pair<int, int> PII;
typedef long long ll;
const int N = 5e5 + 7, mod = 1000000007;
int n, a[N];
void solve() {
	cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	if(n == 1) {
		cout << a[1] << '\n';
		return ;
	}
	int ans = 0;
	for(int i = n; i >= 1; i --) {
		int s = 0;
		for(int j = 1; j <= i; j ++) {
			s += a[j];
		}
		for(int j = 1; j < i; j ++) a[j] = a[j + 1] - a[j]; 
		ans = max(ans, max(s, -s));
	}
	cout << ans << '\n';
}
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
 	int t; cin >> t;
 	while(t --) solve();
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> PII;
typedef long long ll;
const int N = 5e5 + 7, mod = 1000000007;
int n, a[N];
void solve() {
	cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	if(n == 1) {
		cout << a[1] << '\n';
		return ;
	}
	int ans = 0;
	for(int i = n; i >= 1; i --) {
		int s = 0;
		for(int j = 1; j <= i; j ++) {
			s += a[j];
		}
		for(int j = 1; j < i; j ++) a[j] = a[j + 1] - a[j]; 
		if(i != n) ans = max(ans, abs(s));
		else ans = max(ans, s);
	}
	cout << ans << '\n';
}
signed main() {
	ios::sync_with_stdio(false); cin.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 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> PII;
typedef long long ll;
const int N = 5e5 + 7, mod = 1000000007;
int n, a[N];
void solve() {
	cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	if(n == 1) {
		cout << a[1] << '\n';
		return ;
	}
	int ans = 0;
	for(int i = n; i >= 1; i --) {
		int s = 0;
		for(int j = 1; j <= i; j ++) {
			s += a[j];
		}
		for(int j = 1; j < i; j ++) a[j] = a[j + 1] - a[j]; 
		ans = max(ans, abs(s));
	}
	cout << ans << '\n';
}
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
 	int t; cin >> t;
 	while(t --) solve();
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> PII;
typedef long long ll;
const int N = 5e5 + 7, mod = 1000000007;
int n, a[N];
void solve() {
	cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	if(n == 1) {
		cout << a[1] << '\n';
		return ;
	}
	int ans = 0;
	for(int i = n; i >= 1; i --) {
		int s = 0;
		for(int j = 1; j <= i; j ++) {
			s += a[j];
		}
		for(int j = 1; j < i; j ++) a[j] = a[j + 1] - a[j]; 
		ans = max(ans, max(s, -s));
	}
	cout << ans << '\n';
}
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
 	int t; cin >> t;
 	while(t --) solve();
}
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 int long long
typedef pair<int, int> PII;
typedef long long ll;
const int N = 5e5 + 7, mod = 1000000007;
int n, a[N];
void solve() {
	cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	if(n == 1) {
		cout << a[1] << '\n';
		return ;
	}
	int ans = 0;
	for(int i = n; i >= 1; i --) {
		int s = 0;
		for(int j = 1; j <= i; j ++) {
			s += a[j];
		}
		for(int j = 1; j < i; j ++) a[j] = a[j + 1] - a[j]; 
		ans = max(ans, abs(s));
	}
	cout << ans << '\n';
}
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
 	int t; cin >> t;
 	while(t --) solve();
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 6):
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+100;
#define int long long 
int a[N],b[N];
map<int,int>mp1,mp2;
bool ok;

bool check(int x){
	//cout<<x<<endl;
	if (mp1[x]>=1){
		mp1[x]--;
		return true;
	}
	if (x/2<=0)return false;
	else if (x%2==0){
		if (mp1[x/2]>=2){
			mp1[x/2]-=2;
			return true;
		}else{
			if (check(x/2)==true&check(x/2)==true)return true;
			else return false;
		}
	}else{
		if (mp1[x/2]>=1&&mp1[x/2+1]>=1){
			mp1[x/2]--;
			mp1[x/2+1]--;
			return true;
		}else{
			if (check(x/2)==true&check(x/2+1)==true)return true;
			else return false;
		}
	}
	return  false;
}

void solve(){
	mp1.clear();
	mp2.clear();
	int n,m;
	cin>>n>>m;
	int sum1=0,sum2=0;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		sum1+=a[i];
		mp1[a[i]]++;
	}
	for (int i=1;i<=m;i++){
		cin>>b[i];
		sum2+=b[i];
	}
	if (sum1!=sum2){
		cout<<"NO\n";
	}else{
		ok=true;
		sort(b+1,b+1+m);
		for (int i=1;i<=m;i++){
			if (check(b[i])==false){
				ok=false;
				break;
			}
		}
		if (ok==false)cout<<"NO\n";
		else cout<<"YES\n";
	}
	//cout<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	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;
const int N=1e6+100;
#define int long long 
int a[N],b[N];
map<int,int>mp1;
bool ok;

bool check(int x){
	if (mp1[x]>=1){
		mp1[x]--;
		return true;
	}
	if (x/2<=0)return false;
	else if (x%2==0){
		if (mp1[x/2]>=2){
			mp1[x/2]-=2;
			return true;
		}else{
			if (check(x/2)==true&&check(x/2)==true)return true;
			else return false;
		}
	}else{
		if (mp1[x/2]>=1&&mp1[x/2+1]>=1){
			mp1[x/2]--;
			mp1[x/2+1]--;
			return true;
		}else{
			if (check(x/2)==true&&check(x/2+1)==true)return true;
			else return false;
		}
	}
	return  false;
}

void solve(){
	mp1.clear();
	int n,m;
	cin>>n>>m;
	int sum1=0,sum2=0;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		sum1+=a[i];
		mp1[a[i]]++;
	}
	for (int i=1;i<=m;i++){
		cin>>b[i];
		sum2+=b[i];
	}
	if (sum1!=sum2){
		cout<<"NO\n";
	}else{
		ok=true;
		sort(b+1,b+1+m);
		for (int i=1;i<=m;i++){
			if (check(b[i])==false){
				ok=false;
				break;
			}
		}
		if (ok==false)cout<<"NO\n";
		else cout<<"YES\n";
	}
	//cout<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0); 	
	int t=1;
	cin>>t;
 	while (t--){
		solve();
	}
	return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+100;
#define int long long 
int a[N],b[N];
map<int,int>mp1,mp2;
bool ok;

bool check(int x){
	//cout<<x<<endl;
	if (mp1[x]>=1)return true;
	if (x/2<=0)return false;
	else if (x%2==0){
		if (mp1[x/2]>=2){
			mp1[x/2]-=2;
			return true;
		}else{
			if (check(x/2)==true&check(x/2)==true)return true;
			else return false;
		}
	}else{
		if (mp1[x/2]>=1&&mp1[x/2+1]>=1){
			mp1[x/2]--;
			mp1[x/2+1]--;
			return true;
		}else{
			if (check(x/2)==true&check(x/2+1)==true)return true;
			else return false;
		}
	}
	return  false;
}

void solve(){
	mp1.clear();
	mp2.clear();
	int n,m;
	cin>>n>>m;
	int sum1=0,sum2=0;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		sum1+=a[i];
		mp1[a[i]]++;
	}
	for (int i=1;i<=m;i++){
		cin>>b[i];
		sum2+=b[i];
	}
	if (sum1!=sum2){
		cout<<"NO\n";
	}else{
		ok=true;
		sort(b+1,b+1+m);
		for (int i=1;i<=m;i++){
			if (check(b[i])==false){
				ok=false;
				break;
			}
		}
		if (ok==false)cout<<"NO\n";
		else cout<<"YES\n";
	}
	//cout<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0); 	
	int t=1;
	cin>>t;
 	while (t--){
		solve();
	}
	return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+100;
#define int long long 
int a[N],b[N];
map<int,int>mp1,mp2;
bool ok;

bool check(int x){
	//cout<<x<<endl;
	if (mp1[x]>=1)return true;
	if (x/2<=0)return false;
	else if (x%2==0){
		if (mp1[x/2]>=2){
			mp1[x/2]-=2;
			return true;
		}else{
			if (check(x/2)==true&check(x/2)==true)return true;
			else return false;
		}
	}else{
		if (mp1[x/2]>=1&&mp1[x/2+1]>=1){
			mp1[x/2]--;
			mp1[x/2+1]--;
			return true;
		}else{
			if (check(x/2)==true&check(x/2+1)==true)return true;
			else return false;
		}
	}
	return  false;
}

void solve(){
	mp1.clear();
	mp2.clear();
	int n,m;
	cin>>n>>m;
	int sum1=0,sum2=0;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		sum1+=a[i];
		mp1[a[i]]++;
	}
	for (int i=1;i<=m;i++){
		cin>>b[i];
		sum2+=b[i];
	}
	if (sum1!=sum2){
		cout<<"NO\n";
	}else{
		ok=true;
		sort(b+1,b+1+m);
		for (int i=1;i<=m;i++){
			if (check(b[i])==false){
				ok=false;
				break;
			}
		}
		if (ok==false)cout<<"NO\n";
		else cout<<"YES\n";
	}
	//cout<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0); 	
	int t=1;
	cin>>t;
 	while (t--){
		solve();
	}
	return 0;
}

Submission (verdict: Time limit exceeded on test 6):
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+100;
#define int long long 
int a[N],b[N];
map<int,int>mp1,mp2;
bool ok;

bool check(int x){
	//cout<<x<<endl;
	if (mp1[x]>=1){
		mp1[x]--;
		return true;
	}
	if (x/2<=0)return false;
	else if (x%2==0){
		if (mp1[x/2]>=2){
			mp1[x/2]-=2;
			return true;
		}else{
			if (check(x/2)==true&check(x/2)==true)return true;
			else return false;
		}
	}else{
		if (mp1[x/2]>=1&&mp1[x/2+1]>=1){
			mp1[x/2]--;
			mp1[x/2+1]--;
			return true;
		}else{
			if (check(x/2)==true&check(x/2+1)==true)return true;
			else return false;
		}
	}
	return  false;
}

void solve(){
	mp1.clear();
	mp2.clear();
	int n,m;
	cin>>n>>m;
	int sum1=0,sum2=0;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		sum1+=a[i];
		mp1[a[i]]++;
	}
	for (int i=1;i<=m;i++){
		cin>>b[i];
		sum2+=b[i];
	}
	if (sum1!=sum2){
		cout<<"NO\n";
	}else{
		ok=true;
		sort(b+1,b+1+m);
		for (int i=1;i<=m;i++){
			if (check(b[i])==false){
				ok=false;
				break;
			}
		}
		if (ok==false)cout<<"NO\n";
		else cout<<"YES\n";
	}
	//cout<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0); 	
	int t=1;
	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;
int main() {
	int t; cin >> t;
	while (t--) {
		int n, l, r; cin >> n >> l >> r;
		vector<int> og(n);
		for (int &x : og) cin >> x;
		sort(og.begin(), og.end());
		int sum = 0;
		for (int i = 0; i <= r - l;i++) {
			sum += og[i];
		}
		cout << sum << endl;
	}
}

Submission (verdict: Wrong answer on test 8):
#include<bits/stdc++.h>
using namespace std;
int main() {
	int t; cin >> t;
	while (t--) {
		int n, l, r; cin >> n >> l >> r;
		l--;
		vector<int> og(n);
		for (int &x : og) cin >> x;

		vector<int> neww = og, neww2 = og;
		sort(neww.begin() + l, neww.end());
		sort(neww2.begin(), neww2.begin() + r);
		reverse(neww2.begin(), neww2.begin() + r);

		int sum1 = 0, sum2 = 0;
		for (int i = l; i < r;i++) {
			sum1 += neww[i];
			sum2 += neww2[i];
		}
		cout << min(sum1, sum2) << endl;
	}
}
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;
int main() {
	int t; cin >> t;
	while (t--) {
		int n, l, r; cin >> n >> l >> r;
		l--;
		vector<int> og(n);
		for (int &x : og) cin >> x;

		vector<int> neww = og, neww2 = og;
		sort(neww.begin() + l, neww.end());
		sort(neww2.begin(), neww2.begin() + r);
		reverse(neww2.begin(), neww2.begin() + r);

		int sum1 = 0, sum2 = 0;
		for (int i = l; i < r;i++) {
			sum1 += neww[i];
			sum2 += neww2[i];
		}
		cout << min(sum1, sum2) << endl;
	}
}

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

using namespace std;

int main() {

	int t; cin >> t;

	while (t--) {

		long long n, l, r; cin >> n >> l >> r;

		l--;

		vector<long long> og(n);

		for (long long &x : og) cin >> x;



		vector<long long> neww = og, neww2 = og;

		sort(neww.begin() + l, neww.end());

		sort(neww2.begin(), neww2.begin() + r);

		reverse(neww2.begin(), neww2.begin() + r);



		long long sum1 = 0, sum2 = 0;

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

			sum1 += neww[i];

			sum2 += neww2[i];

		}

		cout << min(sum1, sum2) << endl;

	}

}
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;
int main() {
	int t; cin >> t;
	while (t--) {
		int n, l, r; cin >> n >> l >> r;
		vector<int> og(n);
		for (int &x : og) cin >> x;
		sort(og.begin(), og.end());
		int sum = 0;
		for (int i = 0; i <= r - l;i++) {
			sum += og[i];
		}
		cout << sum << endl;
	}
}