ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define inp cin >>
#define out cout <<
#define next cout << endl

int dp[2006][2006];//dp [i][j] denotes min char change till index i of a and j of b ...
int min_change(string a,string b,string c,int i,int j){
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
    if(j==0 && i==0){
        return dp[0][0]=0;
    }
    int ans=INT64_MAX;
    //suppose we take character from a .....
    int store=INT32_MAX;
    int a_taken;int b_taken;
    if(i>0)
    a_taken=min_change(a,b,c,i-1,j);
    if(j>0)
    b_taken=min_change(a,b,c,i,j-1);

    if(c[i+j-1]==a[i-1] && i>0){
        store=min(a_taken,store);
    }
    else if(i>0){
        store=min(store,a_taken+1);
    }
    //suppose we take character from b .....
    if(c[i+j-1]==b[j-1] && j>0){
        store=min(b_taken,store);
    }
    else if(j>0){
        store=min(store,b_taken+1);
    }
    return dp[i][j]=store;
}
void solve() {
    string a,b,c;
    inp a;inp b;inp c;
    int inda=a.size(),indb=b.size(),indc=c.size();
    memset(dp,-1,sizeof(dp));
       int ans= min_change(a,b,c,inda,indb);
        out ans;
        next;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int tc = 1;
     inp tc;
    while (tc--){
        solve();
    }
    return 0;
}


Submission (verdict: Time limit exceeded on test 16):
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define inp cin >>
#define out cout <<
#define next cout << "\n"

int dp[2006][2006];//dp [i][j] denotes min char change till index i of a and j of b ...
int min_change(string a,string b,string c,int i,int j){
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
    if(j==0 && i==0){
        return dp[0][0]=0;
    }
    int ans=INT64_MAX;
    //suppose we take character from a .....
    int store=INT32_MAX;
    int a_taken;int b_taken;
    if(i>0)
    a_taken=min_change(a,b,c,i-1,j);
    if(j>0)
    b_taken=min_change(a,b,c,i,j-1);

    if(c[i+j-1]==a[i-1] && i>0){
        store=min(a_taken,store);
    }
    else if(i>0){
        store=min(store,a_taken+1);
    }
    //suppose we take character from b .....
    if(c[i+j-1]==b[j-1] && j>0){
        store=min(b_taken,store);
    }
    else if(j>0){
        store=min(store,b_taken+1);
    }
    return dp[i][j]=store;
}
void solve() {
    string a,b,c;
    inp a;inp b;inp c;
    int inda=a.size(),indb=b.size(),indc=c.size();
    memset(dp,-1,sizeof(dp));
       int ans= min_change(a,b,c,inda,indb);
        out ans;
        next;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int tc = 1;
     inp tc;
    while (tc--){
        solve();
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 3):
#include <bits/stdc++.h>
using namespace std;

bool check(string s){
    
    long long num = 0; 
    for (char c : s) {
        num = num * 10 + (c - '0');
    }
    if(num%9==0)
    return 1;
    else
    return 0;
}

bool f(int level,int n,string s){

    if(check(s))
    return 1;
    
    if(level==n)
    return 0;

    int ans=0;
    
    if(f(level+1,n,s))
    ans=1;
    
    string temp=s;
    if(s[level]-'0'<=3)
    {
       temp[level]=((s[level]-'0')*(s[level]-'0'))+'0';   
    }
    
    if(f(level+1,n,temp))
    ans=1;
    
    return ans;
}

int main() {
    int t;
    cin>>t;
    while(t--){
        string st;
        cin>>st;
        int n=st.size();
        int ans=f(0,n,st);
        if(ans==0)
        cout<<"NO"<<endl;
        else
        cout<<"Yes"<<endl;
    }
    return 0;
}

Submission (verdict: Time limit exceeded on test 3):
#include <bits/stdc++.h>
using namespace std;

bool check(string s){
    
    long long num = 0; 
    for (char c : s) {
        num = num * 10 + (c - '0');
    }
    if(num%9==0)
    return 1;
    else
    return 0;
}

bool f(long long level,long long n,string s){

    if(check(s))
    return 1;
    
    if(level==n)
    return 0;

    long long ans=0;
    
    if(f(level+1,n,s))
    ans=1;
    
    string temp=s;
    if(s[level]-'0'<=3)
    {
       temp[level]=((s[level]-'0')*(s[level]-'0'))+'0';   
    }
    
    if(f(level+1,n,temp))
    ans=1;
    
    return ans;
}

int main() {
    long long t;
    cin>>t;
    while(t--){
        string st;
        cin>>st;
        long long n=st.size();
        long long ans=f(0,n,st);
        if(ans==0)
        cout<<"NO"<<endl;
        else
        cout<<"Yes"<<endl;
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 3):
#include <bits/stdc++.h>
using namespace std;

bool check(string s){
    
    long long num = 0; 
    for (char c : s) {
        num = num * 10 + (c - '0');
    }
    if(num%9==0)
    return 1;
    else
    return 0;
}

bool f(int level,int n,string s){

    if(check(s))
    return 1;
    
    if(level==n)
    return 0;

    int ans=0;
    
    if(f(level+1,n,s))
    ans=1;
    
    string temp=s;
    if(s[level]-'0'<=3)
    {
       temp[level]=((s[level]-'0')*(s[level]-'0'))+'0';   
    }
    
    if(f(level+1,n,temp))
    ans=1;
    
    return ans;
}

int main() {
    int t;
    cin>>t;
    while(t--){
        string st;
        cin>>st;
        int n=st.size();
        int ans=f(0,n,st);
        if(ans==0)
        cout<<"NO"<<endl;
        else
        cout<<"Yes"<<endl;
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Memory limit exceeded on test 4):
#include <bits/stdc++.h>
using namespace std;

int check(string s){
    
    long long num = 0; 
    for (char c : s) {
        num+=(c - '0');
    }
    return num%9;
}

bool f(long long level,long long n,string s,vector<vector<int>> &dp){

    if(check(s)==0)
    return 1;
    
    if(level==n)
    return 0;

    
    if(dp[level][check(s)]!=-1)
    return dp[level][check(s)];
    
    long long ans=0;
    
    if(f(level+1,n,s,dp))
    ans=1;
    
    string temp=s;
    if(s[level]-'0'<=3)
    {
       temp[level]=((s[level]-'0')*(s[level]-'0'))+'0';   
    }
    
    if(f(level+1,n,temp,dp))
    ans=1;
    
    return dp[level][check(s)]=ans;
}

int main() {
    long long t;
    cin>>t;
    while(t--){
        string st;
        cin>>st;
        long long n=st.size();
        vector<vector<int>> dp(n+1,vector<int>(9,-1));
        long long ans=f(0,n,st,dp);
        if(ans==0)
        cout<<"NO"<<endl;
        else
        cout<<"Yes"<<endl;
    }
    return 0;
}

Submission (verdict: Memory limit exceeded on test 4):
#include <bits/stdc++.h>
using namespace std;


bool f(int level,int sum,int n,string st,vector<vector<long long>> &dp){
    
    
    if(level==n)
    {
        if(sum==0)
        return true;
        else
        return false;
    }
    
    if(dp[level][sum]!=-1)
    return dp[level][sum];
    
    bool ans=false;
    
    int temp=st[level]-'0';
    
    if(f(level+1,(sum+(st[level]-'0'))%9,n,st,dp))
    ans=true;
    
    if(temp<=3){
        if(f(level+1,(sum+(temp*temp))%9,n,st,dp))
        ans=true;
    }
    
    return dp[level][sum]=ans;
}

int main() {
    int t;
    cin>>t;
    while(t--){
    string s;
    cin>>s;
    

    vector<vector<long long>> dp(s.size()+1,vector<long long>(9,-1));
    int ans=f(0,0,s.size(),s,dp);
    if(ans)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Memory limit exceeded on test 4):
#include <bits/stdc++.h>
using namespace std;


bool f(int level,int sum,int n,string st,vector<vector<long long>> &dp){
    
    
    if(level==n)
    {
        if(sum==0)
        return true;
        else
        return false;
    }
    
    if(dp[level][sum]!=-1)
    return dp[level][sum];
    
    bool ans=false;
    
    int temp=st[level]-'0';
    
    if(f(level+1,(sum+(st[level]-'0'))%9,n,st,dp))
    ans=true;
    
    if(temp<=3){
        if(f(level+1,(sum+(temp*temp))%9,n,st,dp))
        ans=true;
    }
    
    return dp[level][sum]=ans;
}

int main() {
    int t;
    cin>>t;
    while(t--){
    string s;
    cin>>s;
    

    vector<vector<long long>> dp(s.size()+1,vector<long long>(9,-1));
    int ans=f(0,0,s.size(),s,dp);
    if(ans)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    }
    return 0;
}


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

bool f(int level, int sum, int n, string &st, vector<vector<long long>> &dp) {
    if (level == n) {
        return sum == 0;
    }

    if (dp[level][sum % 9] != -1) {
        return dp[level][sum % 9];
    }

    bool ans = false;
    int temp = st[level] - '0';
    if (f(level + 1, (sum + temp) % 9, n, st, dp)) {
        ans = true;
    }
    if (temp <= 3) {
        if (f(level + 1, (sum + temp * temp) % 9, n, st, dp)) {
            ans = true;
        }
    }

    return dp[level][sum % 9] = ans;
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        string s;
        cin >> s;

        int n = s.size();

        vector<vector<long long>> dp(n + 1, vector<long long>(9, -1));

        if (f(0, 0, n, s, dp)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 3):
#include <bits/stdc++.h>
using namespace std;

bool check(string s){
    
    long long num = 0; 
    for (char c : s) {
        num = num * 10 + (c - '0');
    }
    if(num%9==0)
    return 1;
    else
    return 0;
}

bool f(long long level,long long n,string s){

    if(check(s))
    return 1;
    
    if(level==n)
    return 0;

    long long ans=0;
    
    if(f(level+1,n,s))
    ans=1;
    
    string temp=s;
    if(s[level]-'0'<=3)
    {
       temp[level]=((s[level]-'0')*(s[level]-'0'))+'0';   
    }
    
    if(f(level+1,n,temp))
    ans=1;
    
    return ans;
}

int main() {
    long long t;
    cin>>t;
    while(t--){
        string st;
        cin>>st;
        long long n=st.size();
        long long ans=f(0,n,st);
        if(ans==0)
        cout<<"NO"<<endl;
        else
        cout<<"Yes"<<endl;
    }
    return 0;
}

Submission (verdict: Memory limit exceeded on test 4):
#include <bits/stdc++.h>
using namespace std;

int check(string s){
    
    long long num = 0; 
    for (char c : s) {
        num+=(c - '0');
    }
    return num%9;
}

bool f(long long level,long long n,string s,vector<vector<int>> &dp){

    if(check(s)==0)
    return 1;
    
    if(level==n)
    return 0;

    
    if(dp[level][check(s)]!=-1)
    return dp[level][check(s)];
    
    long long ans=0;
    
    if(f(level+1,n,s,dp))
    ans=1;
    
    string temp=s;
    if(s[level]-'0'<=3)
    {
       temp[level]=((s[level]-'0')*(s[level]-'0'))+'0';   
    }
    
    if(f(level+1,n,temp,dp))
    ans=1;
    
    return dp[level][check(s)]=ans;
}

int main() {
    long long t;
    cin>>t;
    while(t--){
        string st;
        cin>>st;
        long long n=st.size();
        vector<vector<int>> dp(n+1,vector<int>(9,-1));
        long long ans=f(0,n,st,dp);
        if(ans==0)
        cout<<"NO"<<endl;
        else
        cout<<"Yes"<<endl;
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

const long long MOD=1e9+7;

#define ll long long int
#define vi vector<int>
#define vl vector<long long int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define umps unordered_map<int, unordered_set<int>>
#define pb push_back
#define pq priority_queue<int>
#define pqp priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define fo(i,a, n) for (int i = a; i < n; i++)
#define fo_(i,a, n) for (int i = a; i > n; i--)


void solve(){
    int n,l,r; cin>>n>>l>>r; vl a(n);
    fo(i,0,n) cin>>a[i];
    vl left, right;
    for(int i=0; i<r; i++){
        left.pb(a[i]);
    }
    for(int i=l-1; i<n; i++){
        right.pb(a[i]);
    }
    sort(left.begin(), left.end());
    sort(right.begin(), right.end());
    
    ll mini = INT_MAX; ll sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+= left[i];
    }
    mini = min(mini, sum);
    sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+= right[i];
    }
    mini = min(mini, sum);
    cout<<mini<<endl;
}
 
// check if single Testcase is present && overflow && edgecases
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ifstream cin("closing.in"); ofstream cout("closing.out"); // On Usaco
    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++){
	// cout <<"Case #"<<i<<": ";
        solve();
   }
    return 0;
}


Submission (verdict: Accepted):
/* Abhishek Jaiswal */
#include <bits/stdc++.h>
using namespace std;

const long long MOD=1e9+7;

#define ll long long int
#define vi vector<int>
#define vl vector<long long int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define umps unordered_map<int, unordered_set<int>>
#define pb push_back
#define pq priority_queue<int>
#define pqp priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define fo(i,a, n) for (int i = a; i < n; i++)
#define fo_(i,a, n) for (int i = a; i > n; i--)


void solve(){
    int n,l,r; cin>>n>>l>>r; vl a(n);
    fo(i,0,n) cin>>a[i];
    vl left, right;
    for(int i=0; i<r; i++){
        left.pb(a[i]);
    }
    for(int i=l-1; i<n; i++){
        right.pb(a[i]);
    }
    sort(left.begin(), left.end());
    sort(right.begin(), right.end());
    
    ll mini = 1e18; ll sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+= left[i];
    }
    mini = min(mini, sum);
    sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+= right[i];
    }
    mini = min(mini, sum);
    cout<<mini<<endl;
}
 
// check if single Testcase is present && overflow && edgecases
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ifstream cin("closing.in"); ofstream cout("closing.out"); // On Usaco
    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++){
	// cout <<"Case #"<<i<<": ";
        solve();
   }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


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

const long long MOD=1e9+7;

#define ll long long int
#define vi vector<int>
#define vl vector<long long int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define umps unordered_map<int, unordered_set<int>>
#define pb push_back
#define pq priority_queue<int>
#define pqp priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define fo(i,a, n) for (int i = a; i < n; i++)
#define fo_(i,a, n) for (int i = a; i > n; i--)


void solve(){
    int n,l,r; cin>>n>>l>>r; vi a(n);
    fo(i,0,n) cin>>a[i];
    sort(a.begin(), a.end());
    int x = r-l+1; ll sum=0;
    fo(i,0,x){
        sum+=a[i];
    }
    cout<<sum<<endl;
}
 
// check if single Testcase is present && overflow && edgecases
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ifstream cin("closing.in"); ofstream cout("closing.out"); // On Usaco
    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++){
	// cout <<"Case #"<<i<<": ";
        solve();
   }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

const long long MOD=1e9+7;

#define ll long long int
#define vi vector<int>
#define vl vector<long long int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define umps unordered_map<int, unordered_set<int>>
#define pb push_back
#define pq priority_queue<int>
#define pqp priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define fo(i,a, n) for (int i = a; i < n; i++)
#define fo_(i,a, n) for (int i = a; i > n; i--)


void solve(){
    int n,l,r; cin>>n>>l>>r; vl a(n);
    fo(i,0,n) cin>>a[i];
    sort(a.begin(), a.end());
    ll sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+=a[i];
    }
    cout<<sum<<endl;
}
 
// check if single Testcase is present && overflow && edgecases
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ifstream cin("closing.in"); ofstream cout("closing.out"); // On Usaco
    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++){
	// cout <<"Case #"<<i<<": ";
        solve();
   }
    return 0;
}


Submission (verdict: Wrong answer on test 8):
// Implementation dbm ( Not fuylly)
/* Abhishek Jaiswal */
#include <bits/stdc++.h>
using namespace std;

const long long MOD=1e9+7;

#define ll long long int
#define vi vector<int>
#define vl vector<long long int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define umps unordered_map<int, unordered_set<int>>
#define pb push_back
#define pq priority_queue<int>
#define pqp priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define fo(i,a, n) for (int i = a; i < n; i++)
#define fo_(i,a, n) for (int i = a; i > n; i--)


void solve(){
    int n,l,r; cin>>n>>l>>r; vl a(n);
    fo(i,0,n) cin>>a[i];
    vi left, right;
    for(int i=0; i<r; i++){
        left.pb(a[i]);
    }
    for(int i=l-1; i<n; i++){
        right.pb(a[i]);
    }
    sort(left.begin(), left.end());
    sort(right.begin(), right.end());
    
    ll mini = INT_MAX; ll sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+= left[i];
    }
    mini = min(mini, sum);
    sum=0;https://www.onlinegdb.com/#tab-stdin
    for(int i=0; i<r-l+1; i++){
        sum+= right[i];
    }
    mini = min(mini, sum);
    cout<<mini<<endl;
}
 
// check if single Testcase is present && overflow && edgecases
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ifstream cin("closing.in"); ofstream cout("closing.out"); // On Usaco
    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++){
	// cout <<"Case #"<<i<<": ";
        solve();
   }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 8):
// Implementation dbm ( Not fuylly)
/* Abhishek Jaiswal */
#include <bits/stdc++.h>
using namespace std;

const long long MOD=1e9+7;

#define ll long long int
#define vi vector<int>
#define vl vector<long long int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define umps unordered_map<int, unordered_set<int>>
#define pb push_back
#define pq priority_queue<int>
#define pqp priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define fo(i,a, n) for (int i = a; i < n; i++)
#define fo_(i,a, n) for (int i = a; i > n; i--)


void solve(){
    int n,l,r; cin>>n>>l>>r; vl a(n);
    fo(i,0,n) cin>>a[i];
    vi left, right;
    for(int i=0; i<r; i++){
        left.pb(a[i]);
    }
    for(int i=l-1; i<n; i++){
        right.pb(a[i]);
    }
    sort(left.begin(), left.end());
    sort(right.begin(), right.end());
    
    ll mini = INT_MAX; ll sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+= left[i];
    }
    mini = min(mini, sum);
    sum=0;https://www.onlinegdb.com/#tab-stdin
    for(int i=0; i<r-l+1; i++){
        sum+= right[i];
    }
    mini = min(mini, sum);
    cout<<mini<<endl;
}
 
// check if single Testcase is present && overflow && edgecases
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ifstream cin("closing.in"); ofstream cout("closing.out"); // On Usaco
    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++){
	// cout <<"Case #"<<i<<": ";
        solve();
   }
    return 0;
}


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

const long long MOD=1e9+7;

#define ll long long int
#define vi vector<int>
#define vl vector<long long int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define umps unordered_map<int, unordered_set<int>>
#define pb push_back
#define pq priority_queue<int>
#define pqp priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define fo(i,a, n) for (int i = a; i < n; i++)
#define fo_(i,a, n) for (int i = a; i > n; i--)


void solve(){
    int n,l,r; cin>>n>>l>>r; vl a(n);
    fo(i,0,n) cin>>a[i];
    vl left, right;
    for(int i=0; i<r; i++){
        left.pb(a[i]);
    }
    for(int i=l-1; i<n; i++){
        right.pb(a[i]);
    }
    sort(left.begin(), left.end());
    sort(right.begin(), right.end());
    
    ll mini = INT_MAX; ll sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+= left[i];
    }
    mini = min(mini, sum);
    sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+= right[i];
    }
    mini = min(mini, sum);
    cout<<mini<<endl;
}
 
// check if single Testcase is present && overflow && edgecases
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ifstream cin("closing.in"); ofstream cout("closing.out"); // On Usaco
    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++){
	// cout <<"Case #"<<i<<": ";
        solve();
   }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

const long long MOD=1e9+7;

#define ll long long int
#define vi vector<int>
#define vl vector<long long int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define umps unordered_map<int, unordered_set<int>>
#define pb push_back
#define pq priority_queue<int>
#define pqp priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define fo(i,a, n) for (int i = a; i < n; i++)
#define fo_(i,a, n) for (int i = a; i > n; i--)


void solve(){
    int n,l,r; cin>>n>>l>>r; vi a(n);
    fo(i,0,n) cin>>a[i];
    sort(a.begin(), a.end());
    int x = r-l+1; ll sum=0;
    fo(i,0,x){
        sum+=a[i];
    }
    cout<<sum<<endl;
}
 
// check if single Testcase is present && overflow && edgecases
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ifstream cin("closing.in"); ofstream cout("closing.out"); // On Usaco
    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++){
	// cout <<"Case #"<<i<<": ";
        solve();
   }
    return 0;
}


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

const long long MOD=1e9+7;

#define ll long long int
#define vi vector<int>
#define vl vector<long long int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define umps unordered_map<int, unordered_set<int>>
#define pb push_back
#define pq priority_queue<int>
#define pqp priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define fo(i,a, n) for (int i = a; i < n; i++)
#define fo_(i,a, n) for (int i = a; i > n; i--)


void solve(){
    int n,l,r; cin>>n>>l>>r; vl a(n);
    fo(i,0,n) cin>>a[i];
    sort(a.begin(), a.end());
    ll sum=0;
    for(int i=0; i<r-l+1; i++){
        sum+=a[i];
    }
    cout<<sum<<endl;
}
 
// check if single Testcase is present && overflow && edgecases
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ifstream cin("closing.in"); ofstream cout("closing.out"); // On Usaco
    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++){
	// cout <<"Case #"<<i<<": ";
        solve();
   }
    return 0;
}