ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

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

#define ll long long
 
using namespace std;
 
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        set <int> e[n+1];
        vector<int> d(n+1);
        for(int i=1;i<n;i++){
            int a,b;
            cin>>a>>b;
            e[b].insert(a);
            e[a].insert(b);
            d[b]++;
            d[a]++;
        }
        int maxd=0;
        vector <int> m;
        
        for(int i=1;i<=n;i++){
            if(d[i]>maxd) maxd=d[i];
        }
        for(int i=1;i<=n;i++){
            if(d[i]==maxd) m.emplace_back(i);
        }
        
        int ans=maxd;
        int p=m[0];
        for(auto it=e[p].begin();it!=e[p].end();it++){
            e[*it].erase(p);
            e[p].erase(*it);
        }
        maxd=0;
        for(int i=1;i<=n;i++){
            d[i]=e[i].size();
            if(d[i]>maxd) maxd=d[i];
        }
        ans+=maxd-1;
        if(n==2) cout<<0<<endl;
        else cout<<ans<<endl;
    }
    return 0;
}

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

#define ll long long
 
using namespace std;
 
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        set <int> e[n+1],ee[n+1];
        vector<int> d(n+1);
        for(int i=1;i<n;i++){
            int a,b;
            cin>>a>>b;
            e[b].insert(a);
            e[a].insert(b);
            ee[b].insert(a);
            ee[a].insert(b);
            d[b]++;
            d[a]++;
        }
        int maxd=0;
        vector <int> m;
        
        for(int i=1;i<=n;i++){
            if(d[i]>maxd) maxd=d[i];
        }
        for(int i=1;i<=n;i++){
            if(d[i]==maxd) m.emplace_back(i);
        }
        
        int ans=maxd;
        int p=m[0];
        for(auto it=e[p].begin();it!=e[p].end();it++){
            int t=*it;
            ee[t].erase(p);
            ee[p].erase(t);
        }
        maxd=0;
        for(int i=1;i<=n;i++){
            d[i]=ee[i].size();
            if(d[i]>maxd) maxd=d[i];
        }
        ans+=maxd-1;
        if(n==2) cout<<0<<endl;
        else cout<<ans<<endl;
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

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

#define ll long long
 
using namespace std;
 
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        set <int> e[n+1];
        vector<int> d(n+1);
        for(int i=1;i<n;i++){
            int a,b;
            cin>>a>>b;
            e[b].insert(a);
            e[a].insert(b);
            d[b]++;
            d[a]++;
        }
        int maxd=0;
        set <int> m;
        
        for(int i=1;i<=n;i++){
            if(d[i]>maxd) maxd=d[i];
        }
        for(int i=1;i<=n;i++){
            if(d[i]==maxd) m.insert(i);
        }
        
        int ans=maxd;
        int p=*m.begin();
        for(auto it=e[p].begin();it!=e[p].end();it++){
            e[*it].erase(p);
            e[p].erase(*it);
        }
        maxd=0;
        for(int i=1;i<=n;i++){
            d[i]=e[i].size();
            if(d[i]>maxd) maxd=d[i];
        }
        ans+=maxd-1;
        if(n==2) cout<<0<<endl;
        else cout<<ans<<endl;
    }
    return 0;
}

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

#define ll long long
 
using namespace std;
 
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        set <int> e[n+1];
        vector<int> d(n+1);
        for(int i=1;i<n;i++){
            int a,b;
            cin>>a>>b;
            e[b].insert(a);
            e[a].insert(b);
            d[b]++;
            d[a]++;
        }
        int maxd=0;
        vector <int> m;
        
        for(int i=1;i<=n;i++){
            if(d[i]>maxd) maxd=d[i];
        }
        for(int i=1;i<=n;i++){
            if(d[i]==maxd) m.emplace_back(i);
        }
        
        int ans=maxd;
        int p=m[0];
        for(auto it=e[p].begin();it!=e[p].end();it++){
            e[*it].erase(p);
            e[p].erase(*it);
        }
        maxd=0;
        for(int i=1;i<=n;i++){
            d[i]=e[i].size();
            if(d[i]>maxd) maxd=d[i];
        }
        ans+=maxd-1;
        if(n==2) cout<<0<<endl;
        else cout<<ans<<endl;
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

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

#define ll long long
 
using namespace std;
 
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        set <int> e[n+1],ee[n+1];
        vector<int> d(n+1);
        for(int i=1;i<n;i++){
            int a,b;
            cin>>a>>b;
            e[b].insert(a);
            e[a].insert(b);
            ee[b].insert(a);
            ee[a].insert(b);
            d[b]++;
            d[a]++;
        }
        int maxd=0;
        vector <int> m;
        
        for(int i=1;i<=n;i++){
            if(d[i]>maxd) maxd=d[i];
        }
        for(int i=1;i<=n;i++){
            if(d[i]==maxd) m.emplace_back(i);
        }
        
        int ans=maxd;
        int p=m[0];
        for(auto it=e[p].begin();it!=e[p].end();it++){
            int t=*it;
            ee[t].erase(p);
            ee[p].erase(t);
        }
        maxd=0;
        for(int i=1;i<=n;i++){
            d[i]=ee[i].size();
            if(d[i]>maxd) maxd=d[i];
        }
        ans+=maxd-1;
        if(n==2) cout<<0<<endl;
        else cout<<ans<<endl;
    }
    return 0;
}

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

#define ll long long
 
using namespace std;
 
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        set <int> e[n+1],ee[n+1];
        vector<int> d(n+1);
        for(int i=1;i<n;i++){
            int a,b;
            cin>>a>>b;
            e[b].insert(a);
            e[a].insert(b);
            ee[b].insert(a);
            ee[a].insert(b);
            d[b]++;
            d[a]++;
        }
        int maxd=0;
        vector <int> m;
        
        for(int i=1;i<=n;i++){
            if(d[i]>maxd) maxd=d[i];
        }
        for(int i=1;i<=n;i++){
            if(d[i]==maxd) m.emplace_back(i);
        }
        int ans;
        if (m.size()>= 3){
            ans = 2*maxd - 1;
        }
        else if(m.size()==2){
            bool f=true;
            for(auto v:e[m[0]]){
                if (v==m[1]){
                    ans=2*maxd-2;
                    f=false;
                }
                
            }
            if(f)
                ans=2*maxd-1;
        }
        else{
            ans=maxd;
            int p=m[0];
            for(auto it=e[p].begin();it!=e[p].end();it++){
                int t=*it;
                ee[t].erase(p);
                ee[p].erase(t);
            }
            maxd=0;
            for(int i=1;i<=n;i++){
                d[i]=ee[i].size();
                if(d[i]>maxd) maxd=d[i];
            }
            ans+=maxd-1;
        }
        
        if(n==2) cout<<0<<endl;
        else cout<<ans<<endl;
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)


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

#define ll long long
 
using namespace std;
 
int main(){
    int tt;
    cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        set <int> e[n+1];
        vector<int> d(n+1);
        for(int i=1;i<n;i++){
            int a,b;
            cin>>a>>b;
            e[b].insert(a);
            e[a].insert(b);
            d[b]++;
            d[a]++;
        }
        int maxd=0;
        set <int> m;
        
        for(int i=1;i<=n;i++){
            if(d[i]>maxd) maxd=d[i];
        }
        for(int i=1;i<=n;i++){
            if(d[i]==maxd) m.insert(i);
        }
        
        int ans=maxd;
        int p=*m.begin();
        for(auto it=e[p].begin();it!=e[p].end();it++){
            e[*it].erase(p);
            e[p].erase(*it);
        }
        maxd=0;
        for(int i=1;i<=n;i++){
            d[i]=e[i].size();
            if(d[i]>maxd) maxd=d[i];
        }
        ans+=maxd-1;
        if(n==2) cout<<0<<endl;
        else cout<<ans<<endl;
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    LL l, r;
    cin >> l >> r;
    LL x = LL(1 <<__lg(r)), y = LL((1 << __lg(r)) - 1);
    cout << LL(1 <<__lg(r)) << ' ' << LL((1 << __lg(r)) - 1) << ' ';
    if (x == r) cout << l << "\n";
    else cout << r << "\n";
}  
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    LL l, r;
    cin >> l >> r;
    LL x = l, y = r;
    LL d = 0;
    while (__lg(l) == __lg(r))
    {
            d += LL(1 << __lg(l));
        l -= LL(1 << __lg(l)), r -= LL(1 << __lg(r));
    }
    cout << LL(1 << __lg(r)) + d << ' ' << LL(1 << __lg(r)) - 1 + d << ' ';
    if (LL(1 << __lg(r)) - 1 + d != x) cout << x << "\n";
    else cout << r << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    LL l, r;
    cin >> l >> r;
    LL x = LL(1 <<__lg(r)), y = LL((1 << __lg(r)) - 1);
    cout << LL(1 <<__lg(r)) << ' ' << LL((1 << __lg(r)) - 1) << ' ';
    if (y == r) cout << l << "\n";
    else cout << r << "\n";
}  
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    LL l, r;
    cin >> l >> r;
    LL x = LL(1 <<__lg(r)), y = LL((1 << __lg(r)) - 1);
    cout << LL(1 <<__lg(r)) << ' ' << LL((1 << __lg(r)) - 1) << ' ';
    if (x == r) cout << l << "\n";
    else cout << r << "\n";
}  
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    LL l, r;
    cin >> l >> r;
    cout << LL(1 <<__lg(r)) << ' ' << LL((1 << __lg(r)) - 1) << ' ' << l << "\n";
}  
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    LL l, r;
    cin >> l >> r;
    LL x = LL(1 <<__lg(r)), y = LL((1 << __lg(r)) - 1);
    cout << LL(1 <<__lg(r)) << ' ' << LL((1 << __lg(r)) - 1) << ' ';
    if (y == r) cout << l << "\n";
    else cout << r << "\n";
}  
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    LL l, r;
    cin >> l >> r;
    LL x = l, y = r;
    LL d = 0;
    while (__lg(l) == __lg(r))
    {
            d += LL(1 << __lg(l));
        l -= LL(1 << __lg(l)), r -= LL(1 << __lg(r));
    }
    cout << LL(1 << __lg(r)) + d << ' ' << LL(1 << __lg(r)) - 1 + d << ' ';
    if (LL(1 << __lg(r)) - 1 + d != x) cout << x << "\n";
    else cout << r << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    LL l, r;
    cin >> l >> r;
    LL x = l, y = r;
    LL d = 0;
    while (__lg(l) == __lg(r))
    {
        d += LL(1 << __lg(r));
        l -= LL(1 << __lg(r)), r -= LL(1 << __lg(r));
    }
    LL t = LL(1 << __lg(r));
    cout << t + d << ' ' << t + d - 1 << ' ';
    if (t + d == y) cout << x << "\n";
    else cout << y << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    LL l, r;
    cin >> l >> r;
    cout << LL(1 <<__lg(r)) << ' ' << LL((1 << __lg(r)) - 1) << ' ' << l << "\n";
}  
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    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;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    int n, m;
    cin >> n >> m;
    map<int ,int> a, b;
    for (int i = 1; i <= n; i ++)
    {
        int x;
        cin >> x;
        a[x] ++;
    }
    for (int i = 1; i <= m; i ++)
    {
        int x;
        cin >> x;
        b[x] ++;
    }

    for (auto it = b.rbegin(); it != b.rend(); it ++)
    {
        int i = it->first;
        if (i == 1 && a[i] != b[i])
        {
            cout << "No\n";
            return;
        }
        b[i] -= a[i];
        
        if (i & 1)
            b[i >> 1] += b[i], b[(i >> 1) + 1] += b[i];
        else
            b[i >> 1] += b[i] << 1;
        a[i] = b[i] = 0;
    }
    cout << "Yes\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    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;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    int n, m;
    cin >> n >> m;
    map<int ,int> a, b;
    for (int i = 1; i <= n; i ++)
    {
        int x;
        cin >> x;
        a[x] ++;
    }
    for (int i = 1; i <= m; i ++)
    {
        int x;
        cin >> x;
        b[x] ++;
    }

    for (auto it = b.rbegin(); it != b.rend(); it ++)
    {
        int i = it->first;
        if (i == 1 && a[i] != b[i])
        {
            cout << "No\n";
            return;
        }
        b[i] -= a[i];
        
        if (i & 1)
            b[i >> 1] += b[i], b[(i >> 1) + 1] += b[i];
        else
            b[i >> 1] += b[i] << 1;
        a[i] = b[i] = 0;
    }
    cout << "Yes\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    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;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    int n, m;
    cin >> n >> m;
    map<int ,int> a, b;
    for (int i = 1; i <= n; i ++)
    {
        int x;
        cin >> x;
        a[x] ++;
    }
    for (int i = 1; i <= m; i ++)
    {
        int x;
        cin >> x;
        b[x] ++;
    }

    for (auto it = b.rbegin(); it != b.rend(); it ++)
    {
        int i = it->first;
        if (a[i] > b[i] || (i == 1 && a[i] != b[i]))
        {
            cout << "No\n";
            return;
        }
        b[i] -= a[i];
        
        if (i & 1)
            b[i >> 1] += b[i], b[(i >> 1) + 1] += b[i];
        else
            b[i >> 1] += b[i] << 1;
    }
    cout << "Yes\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    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: Time limit exceeded on test 6):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    int n, m;
    cin >> n >> m;
    map<int ,int> a, b;
    for (int i = 1; i <= n; i ++)
    {
        int x;
        cin >> x;
        a[x] ++;
    }
    for (int i = 1; i <= m; i ++)
    {
        int x;
        cin >> x;
        b[x] ++;
    }

    for (auto it = b.rbegin(); it != b.rend(); it ++)
    {
        int i = it->first;
        if (a[i] > b[i] || (i == 1 && a[i] != b[i]))
        {
            cout << "No\n";
            return;
        }
        b[i] -= a[i];
        
        if (i & 1)
            b[i >> 1] += b[i], b[(i >> 1) + 1] += b[i];
        else
            b[i >> 1] += b[i] << 1;
    }
    cout << "Yes\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
} 

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
void solve()
{
    int n, m;
    cin >> n >> m;
    map<int ,int> a, b;
    LL s1 = 0, s2 = 0;
    for (int i = 1; i <= n; i ++)
    {
        int x;
        cin >> x;
        a[x] ++;
        s1 += x;
    }
    for (int i = 1; i <= m; i ++)
    {
        int x;
        cin >> x;
        b[x] ++;
        s2 += x;
    }
    if (s1 != s2)
    {
        cout << "No\n";
        return;
    }
    auto dfs = [&](auto self, int i, int cnt) -> bool
    {
        if (a[i] >= cnt)
        {
            a[i] -= cnt;
            return 1;
        }
        if (i == 1 && a[i] < cnt)
            return 0;
        
        if (a.count(i))
        {
            cnt -= a[i];
            a[i] = 0;
        }

        if (i & 1)
        {
            if (self(self, i >> 1, cnt) && self(self, (i >> 1) + 1, cnt)) return 1;
            else return 0;
        }
        else
        {
            if (self(self, i >> 1, cnt * 2)) return 1;
            else return 0;
        }
    };
    for (auto it = b.rbegin(); it != b.rend(); it ++)
    {
        int i = it->first;
        if (!dfs(dfs, i, b[i]))
        {
            cout << "No\n";
            return;
        }  
    }
    cout << "Yes\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T --)
    solve ();
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Runtime error on test 2):
#include<bits/stdc++.h>

using namespace std;

#define datatype int



datatype n,q;

datatype tmp;

char chr;

string str; 

void solve(){

    int l,r;

    cin>>n>>l>>r;

    vector<datatype> arr(n);

    for (int i = 0; i < n; i++)

    {

        cin>>arr[i];

    }

    sort(arr.begin(),  arr.begin()+l);

    sort(arr.begin()+l,arr.begin()+r );

    sort(arr.begin()+r,arr.end());

    int l1 = min(l-1, r-l+1);

    int l2 = min(n-r, r-l+1);

    int min1=0;

    int curr=0;

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

        curr+=arr[i]-arr[r-1-i];

        if(curr<min1)min1=curr;

    }

    curr=0;

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

        curr+=arr[r+i]-arr[r-1-i];

        if(curr<min1)min1=curr;

    }

    for(int i=l-1;i<r;i++)min1+=arr[i];

    cout<<min1;

}

    

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int t = 1;

    cin>>t;

    int i=0;

    while(t--){

        i++;

        if(i==82){

            int l,r;

           cin>>n>>l>>r;

           cout<<n<<"-"<<l<<"-"<<r<<"=";

    vector<datatype> arr(n);

    for (int i = 0; i < n; i++)

    {

        cin>>arr[i];

        cout<<arr[i]<<"+";

    }     

        }

        solve();

        

        cout<<endl;

    }

}





//     template <int len = 1>

// void subset_sum(int n) {

//     if (n >= len) {

//         subset_sum<std::min(len*2, maxn)>(n);

//         return;

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

Previous submission (verdict: Runtime error on test 2):
#include<bits/stdc++.h>

using namespace std;

#define datatype int



datatype n,q;

datatype tmp;

char chr;

string str; 

void solve(){

    int l,r;

    cin>>n>>l>>r;

    vector<datatype> arr(n);

    for (int i = 0; i < n; i++)

    {

        cin>>arr[i];

    }

    sort(arr.begin(),  arr.begin()+l);

    sort(arr.begin()+l,arr.begin()+r );

    sort(arr.begin()+r,arr.end());

    int l1 = min(l-1, r-l+1);

    int l2 = min(n-r, r-l+1);

    int min1=0;

    int curr=0;

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

        curr+=arr[i]-arr[r-1-i];

        if(curr<min1)min1=curr;

    }

    curr=0;

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

        curr+=arr[r+i]-arr[r-1-i];

        if(curr<min1)min1=curr;

    }

    for(int i=l-1;i<r;i++)min1+=arr[i];

    cout<<min1;

}

    

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int t = 1;

    cin>>t;

    int i=0;

    while(t--){

        i++;

        if(i==82){

            int l,r;

           cin>>n>>l>>r;

           cout<<n<<"-"<<l<<"-"<<r<<"=";

    vector<datatype> arr(n);

    for (int i = 0; i < n; i++)

    {

        cin>>arr[i];

        cout<<arr[i]<<"+";

    }     

        }

        solve();

        

        cout<<endl;

    }

}





//     template <int len = 1>

// void subset_sum(int n) {

//     if (n >= len) {

//         subset_sum<std::min(len*2, maxn)>(n);

//         return;

//     }

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

using namespace std;

#define datatype int



datatype n,q;

datatype tmp;

char chr;

string str; 

void solve(){

    int l,r;

    cin>>n>>l>>r;

    vector<datatype> arr(n);

    for (int i = 0; i < n; i++)

    {

        cin>>arr[i];

    }

    sort(arr.begin(),  arr.begin()+l);

    sort(arr.begin()+l,arr.begin()+r );

    sort(arr.begin()+r,arr.end());

    int l1 = min(l-1, r-l+1);

    int l2 = min(n-r, r-l+1);

    long long min1=0;

    long long curr=0;

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

        curr+=arr[i]-arr[r-1-i];

        if(curr<min1)min1=curr;

    }

    curr=0;

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

        curr+=arr[r+i]-arr[r-1-i];

        if(curr<min1)min1=curr;

    }

    for(int i=l-1;i<r;i++)min1+=arr[i];

    cout<<min1;

}

    

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int t = 1;

    cin>>t;

    while(t--){

        solve();

        cout<<endl;

    }

}





//     template <int len = 1>

// void subset_sum(int n) {

//     if (n >= len) {

//         subset_sum<std::min(len*2, maxn)>(n);

//         return;

//     }