ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050E - Three Strings
Language: Java 21


Submission (verdict: Time limit exceeded on test 6):
import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();

        while(t-->0){
            String a=sc.next();
            String b=sc.next();
            String c=sc.next();

            System.out.println(solve(a,b,c,0,0,0));

        }
    }
    public static int solve(String a,String b,String c,int i,int j,int k){
        if(i==a.length() || j==b.length()){
            return calc(a,b,c,i,j,k);
        }
        if(c.charAt(k)==a.charAt(i) && c.charAt(k)==b.charAt(j)){
            return Math.min(solve(a,b,c,i+1,j,k+1),solve(a,b,c,i,j+1,k+1));

        }
        else if(c.charAt(k)==a.charAt(i) ){
            return Math.min(solve(a,b,c,i+1,j,k+1),1+solve(a,b,c,i,j+1,k+1));
        }
        else if(c.charAt(k)==b.charAt(j)){
            return Math.min(solve(a,b,c,i,j+1,k+1),1+solve(a,b,c,i+1,j,k+1));
        }
        else return 1+Math.min(solve(a,b,c,i+1,j,k+1),solve(a,b,c,i,j+1,k+1));
    }

    public static int calc(String a,String b,String c,int i,int j,int k){
        int count=0;
        if(i==a.length()){
            while(j<b.length()){
                if(b.charAt(j)!=c.charAt(k)){
                   count++;
                }
                k++;
                j++;
            }

        }
        else{
            while(i<a.length()){
                if(a.charAt(i)!=c.charAt(k)){
                    count++;
                }
                i++;
                k++;
            }
        }
        return count;
    }
}
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 lld long double
#define endl "\n"
#define pb push_back

ll mod = 1e9 + 7;

//vector<vector<pair<int, int>>> vec;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1, ct=0, flag=1;
    cin>>t;
    while (t--) {
        string s;cin>>s;
        ll tot=0, cnt2=0, cnt3=0;
        for(ll i=0;i<s.size();i++){
        	tot+=s[i]-'0';
        	if(s[i]=='2') cnt2++;
        	if(s[i]=='3') cnt3++;
        }
        if(tot%9==0) cout<<"YES"<<endl;
        else{
        	ll a = 9-(tot%9);//cout<<a<<" "<<tot<<endl;
        	ll fl=1, to = 2*cnt2 + 6*cnt3;
    		while(a<=to){
    			//cout<<a<<" "<<to<<endl;
	        	if(a%2==0){
	        		a-=(2*cnt2);
	        		if(a<=0){
	        			cout<<"YES"<<endl;
	        			fl=0;
	        		}
	        		else{
	        			if(a%6==0 && a<=cnt3*6){
	        				cout<<"YES"<<endl;
	        				fl=0;
	        			}
        			}
	        	}
        		if(fl) a+=9;
        		else break;
        	}
        	if(fl) cout<<"NO"<<endl;
        }
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
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 lld long double
#define endl "\n"
#define pb push_back

ll mod = 1e9 + 7;

//vector<vector<pair<int, int>>> vec;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1, ct=0, flag=1;
    cin>>t;
    while (t--) {
        string s;cin>>s;
        ll tot=0, cnt2=0, cnt3=0;
        if(ct>=236&&ct<=239){
        	cout<<s<<endl;
        }
        if(ct>9){
        	ct++;continue;
        }
        for(ll i=0;i<s.size();i++){
        	tot+=s[i]-'0';
        	if(s[i]=='2') cnt2++;
        	if(s[i]=='3') cnt3++;
        }
        if(tot%9==0) cout<<"YES"<<endl;
        else{
        	ll a = 9-(tot%9);//cout<<a<<" "<<tot<<endl;
        	ll fl=1, to = 2*cnt2 + 6*cnt3;
    		while(a<=to){
    			//cout<<a<<" "<<to<<endl;
	        	if(a%2==0){
	        		a-=(2*cnt2);
	        		if(a<=0){
	        			cout<<"YES"<<endl;
	        			fl=0;
	        		}
	        		else{
	        			if(a%6==0 && a<=cnt3*6){
	        				cout<<"YES"<<endl;
	        				fl=0;
	        			}
        			}
	        	}
        		if(fl) a+=9;
        		else break;
        	}
        	if(fl) cout<<"NO"<<endl;
        }
        ct++;
    }
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lld long double
#define endl "\n"
#define pb push_back

ll mod = 1e9 + 7;

//vector<vector<pair<int, int>>> vec;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1, ct=0, flag=1;
    cin>>t;
    while (t--) {
        string s;cin>>s;
        ll tot=0, cnt2=0, cnt3=0;
        // if(ct>=236&&ct<=239){
        // 	cout<<s<<endl;
        // }
        // if(ct>9){
        // 	ct++;continue;
        // }
        for(ll i=0;i<s.size();i++){
        	tot+=s[i]-'0';
        	if(s[i]=='2') cnt2++;
        	if(s[i]=='3') cnt3++;
        }
        if(tot%9==0) cout<<"YES"<<endl;
        else{
        	ll a = 9-(tot%9);//cout<<a<<" "<<tot<<endl;
        	ll fl=1, to = 2*cnt2 + 6*cnt3;
    		while(a<=to){
    			//cout<<a<<" "<<to<<endl;
	        	if(a%2==0){
	        		if(a%2==0 && 2*cnt2>=a){
	        			cout<<"YES"<<endl;
	        			fl=0;
	        		}
	        		if(a%6==0 && 6*cnt3>=a){
	        			cout<<"YES"<<endl;
	        			fl=0;
	        		}
	        		else{
		        		a-=(2*cnt2);
		        		if(a%6==0 && a<=cnt3*6){
	        				cout<<"YES"<<endl;
	        				fl=0;
	        			}
        			}
	        	}
        		if(fl) a+=9;
        		else break;
        	}
        	if(fl) cout<<"NO"<<endl;
        }
        ct++;
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
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 lld long double
#define endl "\n"
#define pb push_back

ll mod = 1e9 + 7;

//vector<vector<pair<int, int>>> vec;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1, ct=0, flag=1;
    cin>>t;
    while (t--) {
        string s;cin>>s;
        ll tot=0, cnt2=0, cnt3=0;
        // if(ct>=236&&ct<=239){
        // 	cout<<s<<endl;
        // }
        // if(ct>9){
        // 	ct++;continue;
        // }
        for(ll i=0;i<s.size();i++){
        	tot+=s[i]-'0';
        	if(s[i]=='2') cnt2++;
        	if(s[i]=='3') cnt3++;
        }
        if(tot%9==0) cout<<"YES"<<endl;
        else{
        	ll a = 9-(tot%9);//cout<<a<<" "<<tot<<endl;
        	ll fl=1, to = 2*cnt2 + 6*cnt3;
    		while(a<=to){
    			//cout<<a<<" "<<to<<endl;
	        	if(a%2==0){
	        		if(a%2==0 && 2*cnt2>=a){
	        			cout<<"YES"<<endl;
	        			fl=0;
	        		}
	        		if(a%6==0 && 6*cnt3>=a){
	        			cout<<"YES"<<endl;
	        			fl=0;
	        		}
	        		else{
		        		a-=(2*cnt2);
		        		if(a%6==0 && a<=cnt3*6){
	        				cout<<"YES"<<endl;
	        				fl=0;
	        			}
        			}
	        	}
        		if(fl) a+=9;
        		else break;
        	}
        	if(fl) cout<<"NO"<<endl;
        }
        ct++;
    }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lld long double
#define endl "\n"
#define pb push_back

ll mod = 1e9 + 7;

//vector<vector<pair<int, int>>> vec;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1, ct=0, flag=1;
    cin>>t;
    while (t--) {
        string s;cin>>s;
        ll tot=0, cnt2=0, cnt3=0, fl=0;
        for(ll i=0;i<s.size();i++){
        	tot+=s[i]-'0';
        	if(s[i]=='2') cnt2++;
        	if(s[i]=='3') cnt3++;
        }
        for(ll i=0;i<min((ll)10, cnt2+1);i++){
        	for (int j = 0;  j < min((ll)10, cnt3+1); j++){
        		ll a = tot + 2*i + 6*j;
        		//cout<<i<<" "<<j<<" "<<a<<" "<<tot<<endl;
        		if(a%9 == 0){
        			fl = 1;
        			break;
        		}
        	}
        	if(fl) break;
        }
        if(fl) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
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 lld long double
#define endl "\n"
#define pb push_back

ll mod = 1e9 + 7;

//vector<vector<pair<int, int>>> vec;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1, ct=0, flag=1;
    cin>>t;
    while (t--) {
        string s;cin>>s;
        ll tot=0, cnt2=0, cnt3=0;
        for(ll i=0;i<s.size();i++){
        	tot+=s[i]-'0';
        	if(s[i]=='2') cnt2++;
        	if(s[i]=='3') cnt3++;
        }
        if(tot%9==0) cout<<"YES"<<endl;
        else{
        	ll a = 9-(tot%9);//cout<<a<<" "<<tot<<endl;
        	ll fl=1, to = 2*cnt2 + 6*cnt3;
    		while(a<=to){
    			//cout<<a<<" "<<to<<endl;
	        	if(a%2==0){
	        		a-=(2*cnt2);
	        		if(a<=0){
	        			cout<<"YES"<<endl;
	        			fl=0;
	        		}
	        		else{
	        			if(a%6==0 && a<=cnt3*6){
	        				cout<<"YES"<<endl;
	        				fl=0;
	        			}
        			}
	        	}
        		if(fl) a+=9;
        		else break;
        	}
        	if(fl) cout<<"NO"<<endl;
        }
    }
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lld long double
#define endl "\n"
#define pb push_back

ll mod = 1e9 + 7;

//vector<vector<pair<int, int>>> vec;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1, ct=0, flag=1;
    cin>>t;
    while (t--) {
        string s;cin>>s;
        ll tot=0, cnt2=0, cnt3=0;
        if(ct>=236&&ct<=239){
        	cout<<s<<endl;
        }
        if(ct>9){
        	ct++;continue;
        }
        for(ll i=0;i<s.size();i++){
        	tot+=s[i]-'0';
        	if(s[i]=='2') cnt2++;
        	if(s[i]=='3') cnt3++;
        }
        if(tot%9==0) cout<<"YES"<<endl;
        else{
        	ll a = 9-(tot%9);//cout<<a<<" "<<tot<<endl;
        	ll fl=1, to = 2*cnt2 + 6*cnt3;
    		while(a<=to){
    			//cout<<a<<" "<<to<<endl;
	        	if(a%2==0){
	        		a-=(2*cnt2);
	        		if(a<=0){
	        			cout<<"YES"<<endl;
	        			fl=0;
	        		}
	        		else{
	        			if(a%6==0 && a<=cnt3*6){
	        				cout<<"YES"<<endl;
	        				fl=0;
	        			}
        			}
	        	}
        		if(fl) a+=9;
        		else break;
        	}
        	if(fl) cout<<"NO"<<endl;
        }
        ct++;
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Runtime error on test 1):
#include <iostream>
#include <vector>
#include <sstream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <unordered_map>
using namespace std;
int main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    int complects;
    cin>>complects;
   // cout<<complects<<endl;
    vector<int> numbersarr;
    int n;
    int temp;
    int size1;
    int sum;
    int summax;
    for(int j=0;j<complects;j++){
        //cout<<"newcomplect";
        numbersarr.clear();
        cin>>n;
        //cout<<n<<endl;
        summax=0;
        for(int i=0;i<n;i++){
                cout<<"in temp";
            cin>>temp;
            numbersarr.push_back(temp);
            //sum=a[n]-a[1]
        }
        //greedy approach
        size1=numbersarr.size();
        sum=0;
        for(int i=0;i<numbersarr.size();i++){
            sum=sum+numbersarr[i];

        }
        summax=sum;
        while(size1!=1){
            if(numbersarr[size1-1]-numbersarr[0]<numbersarr[0]-numbersarr[size1-1]){
                reverse(numbersarr.begin(),numbersarr.end());

            }
            if (numbersarr[size1-1]-numbersarr[0]>summax){
                summax=numbersarr[size1-1]-numbersarr[0];
            }
            //do a minus
            for(int i=0;i<numbersarr.size()-1;i++){
                numbersarr[i]=numbersarr[i+1]-numbersarr[i];

            }
            numbersarr.erase(numbersarr.end());


        }
        cout<<summax<<"\n";


    }

}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)

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

using namespace std;


//Problem:
//D. Digital string maximization :
string insert(string str , int i){

    while(i > 0 && str[i]-1 > str[i-1]){
  
        char c = ((str[i] -'0')-1)+'0';
        str[i] = str[i-1];
        str[i-1] = c;
        i--;
    }
    return str;
}

string maxLexicographicalString(string s) {
    int n = s.length();
    for (int j = 1; j < n; j++) {
        if (s[j] > '0' && s[j] > s[j - 1]) {
            s = insert(s, j);
        }
    }
    return s;
}

int main(){
    int t;
    cin>>t;

  
    while(t>0){
        string str;
        cin>>str;
        string reqString = maxLexicographicalString(str);
        cout<<reqString;
        t--;
    }


}

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

using namespace std;


//Problem:
//D. Digital string maximization :
string insert(string str , int i){

    while(i > 0 && str[i]-1 > str[i-1]){
  
        char c = ((str[i] -'0')-1)+'0';
        str[i] = str[i-1];
        str[i-1] = c;
        i--;
    }
    return str;
}

string maxLexicographicalString(string s) {
    int n = s.length();
    for (int j = 1; j < n; j++) {
        if (s[j] > '0' && s[j] > s[j - 1]) {
            s = insert(s, j);
        }
    }
    return s;
}

int main(){
    int t;
    cin>>t;

  
    while(t>0){
        string str;
        cin>>str;
        string reqString = maxLexicographicalString(str);
        cout<<reqString<<endl;
        t--;
    }


}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)

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

using namespace std;

string insert(string str , int i){

    while(i > 0){
        if(str[i]-1 > str[i-1]){
            //swap
            char c = ((str[i] -'0')-1)+'0';
            str[i] = str[i-1];
            str[i-1] = c;
            i--;
        }
        else{
            break;
        }
    }
    return str;
}

string maxLexigraphicalString(string s){
    int n = s.length();
    int j = 0;
    while(j<n){
        if(s[j] > 1 && s[j]-1 > s[j-1]){
            //insert s[j] inside
            s = insert(s , j);
        }
        
            j++;
        

    }
    return s;
}

int main(){
    int t;
    cin>>t;

    vector<string> ans(t);
    while(t>0){
        string str;
        cin>>str;
        string reqString = maxLexigraphicalString(str);
        ans.push_back(reqString);
        t--;
    }


    //print answers
    for(int i = 0 ; i < ans.size() ; i++){
        cout<<ans[i]<<endl;
    }
}

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

using namespace std;

string insert(string str , int i){

    while(i > 0 && str[i]-1 > str[i-1]){
  
        char c = ((str[i] -'0')-1)+'0';
        str[i] = str[i-1];
        str[i-1] = c;
        i--;

    }
    return str;
}

string maxLexicographicalString(string s) {
    int n = s.length();
    
    for (int j = 1; j < n; j++) {
        if (s[j] > '0' && s[j] > s[j - 1]) {
            s = insert(s, j);
        }
    }
    
    return s;
}

int main(){
    int t;
    cin>>t;

    vector<string> ans(t);
    while(t>0){
        string str;
        cin>>str;
        string reqString = maxLexigraphicalString(str);
        ans.push_back(reqString);
        t--;
    }


    //print answers
    for(int i = 0 ; i < ans.size() ; i++){
        cout<<ans[i]<<endl;
    }
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)

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

using namespace std;

string insert(string str , int i){

    while(i > 0 && str[i]-1 > str[i-1]){
  
        char c = ((str[i] -'0')-1)+'0';
        str[i] = str[i-1];
        str[i-1] = c;
        i--;

    }
    return str;
}

string maxLexicographicalString(string s) {
    int n = s.length();
    
    for (int j = 1; j < n; j++) {
        if (s[j] > '0' && s[j] > s[j - 1]) {
            s = insert(s, j);
        }
    }
    
    return s;
}

int main(){
    int t;
    cin>>t;

    vector<string> ans(t);
    while(t>0){
        string str;
        cin>>str;
        string reqString = maxLexigraphicalString(str);
        ans.push_back(reqString);
        t--;
    }


    //print answers
    for(int i = 0 ; i < ans.size() ; i++){
        cout<<ans[i]<<endl;
    }
}

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

using namespace std;

string insert(string str , int i){

    while(i > 0 && str[i]-1 > str[i-1]){
  
        char c = ((str[i] -'0')-1)+'0';
        str[i] = str[i-1];
        str[i-1] = c;
        i--;

    }
    return str;
}

string maxLexicographicalString(string s) {
    int n = s.length();
    
    for (int j = 1; j < n; j++) {
        if (s[j] > '0' && s[j] > s[j - 1]) {
            s = insert(s, j);
        }
    }
    
    return s;
}

int main(){
    int t;
    cin>>t;

    vector<string> ans(t);
    while(t>0){
        string str;
        cin>>str;
        string reqString = maxLexicographicalString(str);
        ans.push_back(reqString);
        t--;
    }


    //print answers
    for(int i = 0 ; i < ans.size() ; i++){
        cout<<ans[i]<<endl;
    }
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)


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

using namespace std;

string insert(string str , int i){

    while(i > 0){
        if(str[i]-1 > str[i-1]){
            //swap
            char c = ((str[i] -'0')-1)+'0';
            str[i] = str[i-1];
            str[i-1] = c;
            i--;
        }
        else{
            break;
        }
    }
    return str;
}

string maxLexigraphicalString(string s){
    int n = s.length();
    int j = 0;
    while(j<n){
        if(s[j] > 1 && s[j]-1 > s[j-1]){
            //insert s[j] inside
            s = insert(s , j);
        }
        
            j++;
        

    }
    return s;
}

int main(){
    int t;
    cin>>t;

    vector<string> ans(t);
    while(t>0){
        string str;
        cin>>str;
        string reqString = maxLexigraphicalString(str);
        ans.push_back(reqString);
        t--;
    }


    //print answers
    for(int i = 0 ; i < ans.size() ; i++){
        cout<<ans[i]<<endl;
    }
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)

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

using namespace std;

string insert(string str , int i){

    while(i > 0 && str[i]-1 > str[i-1]){
  
        char c = ((str[i] -'0')-1)+'0';
        str[i] = str[i-1];
        str[i-1] = c;
        i--;

    }
    return str;
}

string maxLexicographicalString(string s) {
    int n = s.length();
    
    for (int j = 1; j < n; j++) {
        if (s[j] > '0' && s[j] > s[j - 1]) {
            s = insert(s, j);
        }
    }
    
    return s;
}

int main(){
    int t;
    cin>>t;

    vector<string> ans(t);
    while(t>0){
        string str;
        cin>>str;
        string reqString = maxLexicographicalString(str);
        ans.push_back(reqString);
        t--;
    }


    //print answers
    for(int i = 0 ; i < ans.size() ; i++){
        cout<<ans[i]<<endl;
    }
}

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

using namespace std;


//Problem:
//D. Digital string maximization :
string insert(string str , int i){

    while(i > 0 && str[i]-1 > str[i-1]){
  
        char c = ((str[i] -'0')-1)+'0';
        str[i] = str[i-1];
        str[i-1] = c;
        i--;
    }
    return str;
}

string maxLexicographicalString(string s) {
    int n = s.length();
    for (int j = 1; j < n; j++) {
        if (s[j] > '0' && s[j] > s[j - 1]) {
            s = insert(s, j);
        }
    }
    return s;
}

int main(){
    int t;
    cin>>t;

  
    while(t>0){
        string str;
        cin>>str;
        string reqString = maxLexicographicalString(str);
        cout<<reqString;
        t--;
    }


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


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

using namespace std;





void solve() {

    int n, l, r;

    cin >> n >> l >> r;



    l--;

    r--;

    vector<int> a(n);

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

    int size = r - l + 1;

    vector<int> first(a.begin(), a.begin() + r + 1);

    vector<int> second(a.begin() + l, a.end());



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



    int res =  INT_MAX;

    int sum = 0;

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

        sum += first[i];

    }



    res = min(sum, res);



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

    sum = 0;



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

        sum += second[i];

    }



    res = min(sum, res);



    cout << res << endl;

}



int main() {

    // freopen("../input.txt", "r", stdin);



    int t;

    cin >> t;

    while (t--) {

        solve();

    }

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

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

using namespace std;





void solve() {

    int n, l, r;

    cin >> n >> l >> r;



    l--;

    r--;

    vector<int> a(n);

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

    int size = r - l + 1;

    vector<int> first(a.begin(), a.begin() + r + 1);

    vector<int> second(a.begin() + l, a.end());



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



    int res =  INT_MAX;

    int sum = 0;

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

        sum += first[i];

    }



    res = min(sum, res);



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

    sum = 0;



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

        sum += second[i];

    }



    res = min(sum, res);



    cout << res << endl;

}



int main() {

    // freopen("../input.txt", "r", stdin);



    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}



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

using namespace std;





void solve() {

    int n, l, r;

    cin >> n >> l >> r;



    l--;

    r--;

    vector<long long> a(n);

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

    int size = r - l + 1;

    vector first(a.begin(), a.begin() + r + 1);

    vector second(a.begin() + l, a.end());



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



    long long res =  INT_MAX;

    long long sum = 0;

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

        sum += first[i];

    }



    res = min(sum, res);



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

    sum = 0;



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

        sum += second[i];

    }



    res = min(sum, res);



    cout << res << endl;

}



int main() {

    // freopen("../input.txt", "r", stdin);



    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}