ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
   ll n;
   cin>>n;
   vector<ll>a(n);
   vector<ll>b(n);
   vector<ll>c(n);
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
       b[0]+=a[i];
   }
   for(int i=1;i<n;i++)
   {
       if(i%2==1){
       for(int j=i;j<n;j++)
       {
           c[j]=a[j]-a[j-1];
       }
       b[i]=abs(c[n-1]-c[i]);}
       else
       {
           for(int j=i;j<n;j++)
            {
                a[j]=c[j]-c[j-1];
            }
            b[i]=abs(a[n-1]-a[i]);
       }
   }
   ll ans=LONG_MIN;
   for(int i=0;i<n;i++)
   {
       ans=max(ans,b[i]);
   }
   cout<<ans<<endl;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    solve();
    return 0;
}


Submission (verdict: Wrong answer on test 6):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
   ll n;
   cin>>n;
   vector<ll>a(n);
   vector<ll>b(n);
   vector<ll>c(n);
   c[0]=0;
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
       b[0]+=a[i];
   }
   for(int i=1;i<n;i++)
   {
       if(n==2)
       {
           cout<<max(b[0],abs(a[1]-a[0]))<<endl;
           return;
       }
       if(i%2==1){
       for(int j=i;j<n;j++)
       {
           c[j]=a[j]-a[j-1];
       }
       b[i]=abs(c[n-1]-c[i]);}
       else
       {
           for(int j=i;j<n;j++)
            {
                a[j]=c[j]-c[j-1];
            }
            b[i]=abs(a[n-1]-a[i]);
       }
   }
   ll ans=LONG_MIN;
   for(int i=0;i<n;i++)
   {
       ans=max(ans,b[i]);
   }
   cout<<ans<<endl;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    solve();
    return 0;
}
Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <algorithm>

#include <iostream>

#include <vector>



int main()

{

	int t; std::cin >> t;

	while (t--)

	{

		int n, x, y;

		std::cin >> n >> x >> y;

		std::vector<int> g(n);

		x--; y--;

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

			if (i % 2 == 0) g[i] = 0;

			if (i % 2 == 1) g[i] = 1;

 		}



		if (n % 2 == 1 || (x - y) % 2 == 1) g[x] = 2;



		for (int i = 0; i < n; i++) std::cout << g[i] << " ";

		std::cout << std::endl;

	}

}

Submission (verdict: Wrong answer on test 1):
#include <algorithm>

#include <iostream>

#include <vector>



int main()

{

	int t; std::cin >> t;

	while (t--)

	{

		int n, x, y;

		std::cin >> n >> x >> y;

		std::vector<int> g(n);

		x--; y--;

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

			g[(x + i) % n] = i % 2;

 		}



		if (n % 2 == 1 || (x - y) % 2 == 1) g[x] = 2;



		for (int i = 0; i < n; i++) std::cout << g[i] << " ";

		std::cout << std::endl;

	}

}
Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <algorithm>

#include <iostream>

#include <vector>



int main()

{

	int t; std::cin >> t;

	while (t--)

	{

		int n, x, y;

		std::cin >> n >> x >> y;

		std::vector<int> g(n);

		x--; y--;

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

			g[(x + i) % n] = i % 2;

 		}



		if (n % 2 == 1 || (x - y) % 2 == 1) g[x] = 2;



		for (int i = 0; i < n; i++) std::cout << g[i] << " ";

		std::cout << std::endl;

	}

}

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

#include <iostream>

#include <vector>



int main()

{

	int t; std::cin >> t;

	while (t--)

	{

		int n, x, y;

		std::cin >> n >> x >> y;

		std::vector<int> g(n);

		x--; y--;

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

			g[(x + i) % n] = i % 2;

 		}



		if (n % 2 == 1 || (x - y) % 2 == 0) g[x] = 2;



		for (int i = 0; i < n; i++) std::cout << g[i] << " ";

		std::cout << std::endl;

	}

}
Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include <algorithm>

#include <iostream>

#include <vector>



int main()

{

	int t; std::cin >> t;

	while (t--)

	{

		int n, x, y;

		std::cin >> n >> x >> y;

		std::vector<int> g(n);

		x--; y--;

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

			if (i % 2 == 0) g[i] = 0;

			if (i % 2 == 1) g[i] = 1;

 		}



		if (n % 2 == 1 || (x - y) % 2 == 1) g[x] = 2;



		for (int i = 0; i < n; i++) std::cout << g[i] << " ";

		std::cout << std::endl;

	}

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


Submission (verdict: Wrong answer on test 8):
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
using namespace std;
#define ll long long
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll mod = 1e9 +7;


    bool isPrime(int n) {
    if (n <= 1)
        return false;
    for (int i = 2; i <= sqrt(n); i++)
        if (n % i == 0)  
            return false;
    return true;
}

int solve(vector<int>v,vector<int>v1){
    ll ans = 0;
    int i = v.size()-1;
    int j = 0;
    while(j<v1.size()&&i>=0){
        if(v[i]>v1[j]){
            ans+=v1[j];
            j++;i--;
        }
        else{
            j++;
        }
    }
    while(i>=0){
        ans+=v[i];
        i--;
    }
    return ans;
}

int main(){
   int tc;cin>>tc;
   while(tc--){
    int n,l,r;cin>>n>>l>>r;
    vector<int>v1(l-1);
    vector<int>v(r-l+1);
    vector<int>v2(n-r);
    for(int i=0;i<l-1;i++){
        cin>>v1[i];
    }
    for(int i=0;i<r-l+1;i++){
        cin>>v[i];
    }
    for(int i=0;i<n-r;i++){
        cin>>v2[i];
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    sort(v.begin(),v.end());
    // for(auto i:v2){
    //     cout<<i<<" ";
    // }
    int ans = min(solve(v,v1),solve(v,v2));
    cout<<ans<<endl;
   }
return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#include<iostream>

#include<vector>

using namespace std;

#define ll long long

ll gcd(ll a, ll b)

{

    if (a == 0)

        return b;

    return gcd(b % a, a);

}

ll mod = 1e9 +7;





    bool isPrime(int n) {

    if (n <= 1)

        return false;

    for (int i = 2; i <= sqrt(n); i++)

        if (n % i == 0)  

            return false;

    return true;

}



int solve(vector<ll>v,vector<ll>v1){

    ll ans = 0;

    int i = v.size()-1;

    int j = 0;

    while(j<v1.size()&&i>=0){

        if(v[i]>v1[j]){

            ans+=v1[j];

            j++;i--;

        }

        else{

            j++;

        }

    }

    while(i>=0){

        ans+=v[i];

        i--;

    }

    return ans;

}



int main(){

   int tc;cin>>tc;

   while(tc--){

    int n,l,r;cin>>n>>l>>r;

    vector<ll>v1(l-1);

    vector<ll>v(r-l+1);

    vector<ll>v2(n-r);

    for(int i=0;i<l-1;i++){

        cin>>v1[i];

    }

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

        cin>>v[i];

    }

    for(int i=0;i<n-r;i++){

        cin>>v2[i];

    }

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

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

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

    // for(auto i:v2){

    //     cout<<i<<" ";

    // }

    ll ans = min(solve(v,v1),solve(v,v2));

    cout<<ans<<endl;

   }

return 0;

}

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

#include<iostream>

#include<vector>

using namespace std;

#define ll long long

ll gcd(ll a, ll b)

{

    if (a == 0)

        return b;

    return gcd(b % a, a);

}

ll mod = 1e9 +7;





    bool isPrime(int n) {

    if (n <= 1)

        return false;

    for (int i = 2; i <= sqrt(n); i++)

        if (n % i == 0)  

            return false;

    return true;

}



ll solve(vector<ll>v,vector<ll>v1){

    ll ans = 0;

    int i = v.size()-1;

    int j = 0;

    while(j<v1.size()&&i>=0){

        if(v[i]>v1[j]){

            ans+=v1[j];

            j++;i--;

        }

        else{

            j++;

        }

    }

    while(i>=0){

        ans+=v[i];

        i--;

    }

    return ans;

}



int main(){

   int tc;cin>>tc;

   while(tc--){

    int n,l,r;cin>>n>>l>>r;

    vector<ll>v1(l-1);

    vector<ll>v(r-l+1);

    vector<ll>v2(n-r);

    for(int i=0;i<l-1;i++){

        cin>>v1[i];

    }

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

        cin>>v[i];

    }

    for(int i=0;i<n-r;i++){

        cin>>v2[i];

    }

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

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

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

    // for(auto i:v2){

    //     cout<<i<<" ";

    // }

    ll ans = min(solve(v,v1),solve(v,v2));

    cout<<ans<<endl;

   }

return 0;

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

Previous submission (verdict: Wrong answer on test 8):
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
using namespace std;
#define ll long long
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll mod = 1e9 +7;


    bool isPrime(int n) {
    if (n <= 1)
        return false;
    for (int i = 2; i <= sqrt(n); i++)
        if (n % i == 0)  
            return false;
    return true;
}

int solve(vector<int>v,vector<int>v1){
    ll ans = 0;
    int i = v.size()-1;
    int j = 0;
    while(j<v1.size()&&i>=0){
        if(v[i]>v1[j]){
            ans+=v1[j];
            j++;i--;
        }
        else{
            j++;
        }
    }
    while(i>=0){
        ans+=v[i];
        i--;
    }
    return ans;
}

int main(){
   int tc;cin>>tc;
   while(tc--){
    int n,l,r;cin>>n>>l>>r;
    vector<int>v1(l-1);
    vector<int>v(r-l+1);
    vector<int>v2(n-r);
    for(int i=0;i<l-1;i++){
        cin>>v1[i];
    }
    for(int i=0;i<r-l+1;i++){
        cin>>v[i];
    }
    for(int i=0;i<n-r;i++){
        cin>>v2[i];
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    sort(v.begin(),v.end());
    // for(auto i:v2){
    //     cout<<i<<" ";
    // }
    int ans = min(solve(v,v1),solve(v,v2));
    cout<<ans<<endl;
   }
return 0;
}

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

#include<iostream>

#include<vector>

using namespace std;

#define ll long long

ll gcd(ll a, ll b)

{

    if (a == 0)

        return b;

    return gcd(b % a, a);

}

ll mod = 1e9 +7;





    bool isPrime(int n) {

    if (n <= 1)

        return false;

    for (int i = 2; i <= sqrt(n); i++)

        if (n % i == 0)  

            return false;

    return true;

}



int solve(vector<ll>v,vector<ll>v1){

    ll ans = 0;

    int i = v.size()-1;

    int j = 0;

    while(j<v1.size()&&i>=0){

        if(v[i]>v1[j]){

            ans+=v1[j];

            j++;i--;

        }

        else{

            j++;

        }

    }

    while(i>=0){

        ans+=v[i];

        i--;

    }

    return ans;

}



int main(){

   int tc;cin>>tc;

   while(tc--){

    int n,l,r;cin>>n>>l>>r;

    vector<ll>v1(l-1);

    vector<ll>v(r-l+1);

    vector<ll>v2(n-r);

    for(int i=0;i<l-1;i++){

        cin>>v1[i];

    }

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

        cin>>v[i];

    }

    for(int i=0;i<n-r;i++){

        cin>>v2[i];

    }

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

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

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

    // for(auto i:v2){

    //     cout<<i<<" ";

    // }

    ll ans = min(solve(v,v1),solve(v,v2));

    cout<<ans<<endl;

   }

return 0;

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

Previous submission (verdict: Wrong answer on test 8):
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize "trapv"
#define ll long long
#define int ll
#define nline cout << "\n"
#define nl "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int, int>
#define db(str, x) cout << str << " = " << x << nline;
#define dbv(a)        for(auto it: a)cout<<it<<" "; cout << nl;
#define db1(a)        cout<<a<<"\n";
#define db2(a,b)      cout<<a<<" "<<b<<"\n";
#define db3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0);

const int M = 1e9+7;

void solve() {
  int n, l, r;
  cin >> n >> l >> r;
  vector<int> v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  l--;
  r--;
  vector<int> b(v), c(v);
  sort(b.begin()+l, b.end());
  sort(c.begin(), c.begin()+r+1);
  int ans = INT_MAX;
  int sum = 0;
  for(int i=l; i<=r; i++) {
    sum += b[i];
  }
  ans = min(ans, sum);
  sum = 0;
  for(int i=0; i<r-l+1; i++)
    sum += c[i];
  ans = min(ans, sum);
  cout << ans << nl;
}

int32_t main(){
  fastio()
  #ifndef ONLINE_JUDGE
  freopen("Input.txt", "r", stdin);
  freopen("Output.txt", "w", stdout);
  #endif

  int t=1;
  cin >> t;
  for(int tc=1; tc<=t; tc++){
    solve();
  }
  
  return 0;
}

Submission (verdict: Wrong answer on test 8):
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize "trapv"
#define ll long long
#define int ll
#define nline cout << "\n"
#define nl "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int, int>
#define db(str, x) cout << str << " = " << x << nline;
#define dbv(a)        for(auto it: a)cout<<it<<" "; cout << nl;
#define db1(a)        cout<<a<<"\n";
#define db2(a,b)      cout<<a<<" "<<b<<"\n";
#define db3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0);

const int M = 1e9+7;

void solve() {
  int n, l, r;
  cin >> n >> l >> r;
  vector<int> v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  l--;
  r--;
  vector<int> b(v), c(v);
  sort(b.begin()+l, b.end());
  sort(c.begin(), c.begin()+r+1);
  int ans = LONG_MAX;
  int sum = 0;
  for(int i=l; i<=r; i++) {
    sum += b[i];
  }
  ans = min(ans, sum);
  sum = 0;
  for(int i=0; i<r-l+1; i++)
    sum += c[i];
  ans = min(ans, sum);
  cout << ans << nl;
}

int32_t main(){
  fastio()
  #ifndef ONLINE_JUDGE
  freopen("Input.txt", "r", stdin);
  freopen("Output.txt", "w", stdout);
  #endif

  int t=1;
  cin >> t;
  for(int tc=1; tc<=t; tc++){
    solve();
  }
  
  return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Runtime error on test 8):
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize "trapv"
#define ll long long
#define nline cout << "\n"
#define nl "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int, int>
#define db(str, x) cout << str << " = " << x << nline;
#define dbv(a)        for(auto it: a)cout<<it<<" "; cout << nl;
#define db1(a)        cout<<a<<"\n";
#define db2(a,b)      cout<<a<<" "<<b<<"\n";
#define db3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0);

const int M = 1e9+7;

void solve() {
  int n, l, r;
  cin >> n >> l >> r;
  vector<int> v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  l--;
  r--;
  vector<int> b(v), c(v);
  sort(b.begin()+l, b.end());
  sort(c.begin(), c.begin()+r+1);
  int ans = INT_MAX;
  int sum = 0;
  for(int i=l; i<=r; i++) {
    sum += b[i];
  }
  ans = min(ans, sum);
  sum = 0;
  for(int i=0; i<r-l+1; i++)
    sum += c[i];
  ans = min(ans, sum);
  cout << ans << nl;
}

int main(){
  fastio()
  #ifndef ONLINE_JUDGE
  freopen("Input.txt", "r", stdin);
  freopen("Output.txt", "w", stdout);
  #endif

  int t=1;
  cin >> t;
  for(int tc=1; tc<=t; tc++){
    solve();
  }
  
  return 0;
}

Submission (verdict: Wrong answer on test 8):
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize "trapv"
#define ll long long
#define int ll
#define nline cout << "\n"
#define nl "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int, int>
#define db(str, x) cout << str << " = " << x << nline;
#define dbv(a)        for(auto it: a)cout<<it<<" "; cout << nl;
#define db1(a)        cout<<a<<"\n";
#define db2(a,b)      cout<<a<<" "<<b<<"\n";
#define db3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0);

const int M = 1e9+7;

void solve() {
  int n, l, r;
  cin >> n >> l >> r;
  vector<int> v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  l--;
  r--;
  vector<int> b(v), c(v);
  sort(b.begin()+l, b.end());
  sort(c.begin(), c.begin()+r+1);
  int ans = INT_MAX;
  int sum = 0;
  for(int i=l; i<=r; i++) {
    sum += b[i];
  }
  ans = min(ans, sum);
  sum = 0;
  for(int i=0; i<r-l+1; i++)
    sum += c[i];
  ans = min(ans, sum);
  cout << ans << nl;
}

int32_t main(){
  fastio()
  #ifndef ONLINE_JUDGE
  freopen("Input.txt", "r", stdin);
  freopen("Output.txt", "w", stdout);
  #endif

  int t=1;
  cin >> t;
  for(int tc=1; tc<=t; tc++){
    solve();
  }
  
  return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

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

#include <vector>

#include <string>

using namespace std;



#pragma GCC optimize "trapv"

#define ll long long

#define nline cout << "\n"

#define nl "\n"

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

#define sz(x) (int)x.size()

#define pii pair<int, int>

#define db(str, x) cout << str << " = " << x << nline;

#define dbv(a)        for(auto it: a)cout<<it<<" "; cout << nl;

#define db1(a)        cout<<a<<"\n";

#define db2(a,b)      cout<<a<<" "<<b<<"\n";

#define db3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";

#define fastio() ios_base::sync_with_stdio(false);cin.tie(0);



const int M = 1e9+7;



void solve() {

  int n, l, r;

  cin >> n >> l >> r;

  vector<int> v(n);

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

  l--;

  r--;

  vector<int> b(v), c(v);

  sort(b.begin()+l, b.begin()+r+1);

  sort(all(c));

  int ans = INT_MAX;

  int sum = 0;

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

    sum += b[i];

  }

  ans = min(ans, sum);

  sum = 0;

  for(int i=0; i<r-l+1; i++)

    sum += c[i];

  ans = min(ans, sum);

  cout << ans << nl;

}



int main(){

  fastio()

  #ifndef ONLINE_JUDGE

  freopen("Input.txt", "r", stdin);

  freopen("Output.txt", "w", stdout);

  #endif



  int t=1;

  cin >> t;

  for(int tc=1; tc<=t; tc++){

    solve();

  }

  

  return 0;

}

Submission (verdict: Runtime error on test 8):
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize "trapv"
#define ll long long
#define nline cout << "\n"
#define nl "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int, int>
#define db(str, x) cout << str << " = " << x << nline;
#define dbv(a)        for(auto it: a)cout<<it<<" "; cout << nl;
#define db1(a)        cout<<a<<"\n";
#define db2(a,b)      cout<<a<<" "<<b<<"\n";
#define db3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0);

const int M = 1e9+7;

void solve() {
  int n, l, r;
  cin >> n >> l >> r;
  vector<int> v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  l--;
  r--;
  vector<int> b(v), c(v);
  sort(b.begin()+l, b.end());
  sort(c.begin(), c.begin()+r+1);
  int ans = INT_MAX;
  int sum = 0;
  for(int i=l; i<=r; i++) {
    sum += b[i];
  }
  ans = min(ans, sum);
  sum = 0;
  for(int i=0; i<r-l+1; i++)
    sum += c[i];
  ans = min(ans, sum);
  cout << ans << nl;
}

int main(){
  fastio()
  #ifndef ONLINE_JUDGE
  freopen("Input.txt", "r", stdin);
  freopen("Output.txt", "w", stdout);
  #endif

  int t=1;
  cin >> t;
  for(int tc=1; tc<=t; tc++){
    solve();
  }
  
  return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


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

#include <vector>

#include <string>

using namespace std;



#pragma GCC optimize "trapv"

#define ll long long

#define nline cout << "\n"

#define nl "\n"

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

#define sz(x) (int)x.size()

#define pii pair<int, int>

#define db(str, x) cout << str << " = " << x << nline;

#define dbv(a)        for(auto it: a)cout<<it<<" "; cout << nl;

#define db1(a)        cout<<a<<"\n";

#define db2(a,b)      cout<<a<<" "<<b<<"\n";

#define db3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";

#define fastio() ios_base::sync_with_stdio(false);cin.tie(0);



const int M = 1e9+7;



void solve() {

  int n, l, r;

  cin >> n >> l >> r;

  vector<int> v(n);

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

  l--;

  r--;

  vector<int> b(v), c(v);

  sort(b.begin()+l, b.begin()+r+1);

  sort(all(c));

  int ans = INT_MAX;

  int sum = 0;

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

    sum += b[i];

  }

  ans = min(ans, sum);

  sum = 0;

  for(int i=0; i<r-l+1; i++)

    sum += c[i];

  ans = min(ans, sum);

  cout << ans << nl;

}



int main(){

  fastio()

  #ifndef ONLINE_JUDGE

  freopen("Input.txt", "r", stdin);

  freopen("Output.txt", "w", stdout);

  #endif



  int t=1;

  cin >> t;

  for(int tc=1; tc<=t; tc++){

    solve();

  }

  

  return 0;

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

Previous submission (verdict: Wrong answer on test 8):
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize "trapv"
#define ll long long
#define int ll
#define nline cout << "\n"
#define nl "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int, int>
#define db(str, x) cout << str << " = " << x << nline;
#define dbv(a)        for(auto it: a)cout<<it<<" "; cout << nl;
#define db1(a)        cout<<a<<"\n";
#define db2(a,b)      cout<<a<<" "<<b<<"\n";
#define db3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0);

const int M = 1e9+7;

void solve() {
  int n, l, r;
  cin >> n >> l >> r;
  vector<int> v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  l--;
  r--;
  vector<int> b(v), c(v);
  sort(b.begin()+l, b.end());
  sort(c.begin(), c.begin()+r+1);
  int ans = LONG_MAX;
  int sum = 0;
  for(int i=l; i<=r; i++) {
    sum += b[i];
  }
  ans = min(ans, sum);
  sum = 0;
  for(int i=0; i<r-l+1; i++)
    sum += c[i];
  ans = min(ans, sum);
  cout << ans << nl;
}

int32_t main(){
  fastio()
  #ifndef ONLINE_JUDGE
  freopen("Input.txt", "r", stdin);
  freopen("Output.txt", "w", stdout);
  #endif

  int t=1;
  cin >> t;
  for(int tc=1; tc<=t; tc++){
    solve();
  }
  
  return 0;
}

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

#include <vector>

#include <string>

using namespace std;



#pragma GCC optimize "trapv"

#define ll long long

#define int ll

#define nline cout << "\n"

#define nl "\n"

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

#define sz(x) (int)x.size()

#define pii pair<int, int>

#define db(str, x) cout << str << " = " << x << nline;

#define dbv(a)        for(auto it: a)cout<<it<<" "; cout << nl;

#define db1(a)        cout<<a<<"\n";

#define db2(a,b)      cout<<a<<" "<<b<<"\n";

#define db3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";

#define fastio() ios_base::sync_with_stdio(false);cin.tie(0);



const int M = 1e9+7;



void solve() {

  int n, l, r;

  cin >> n >> l >> r;

  vector<int> v(n);

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

  l--;

  r--;

  vector<int> b(v), c(v);

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

  sort(c.begin(), c.begin()+r+1);

  int ans = LLONG_MAX;

  int sum = 0;

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

    sum += b[i];

  }

  ans = min(ans, sum);

  sum = 0;

  for(int i=0; i<r-l+1; i++)

    sum += c[i];

  ans = min(ans, sum);

  cout << ans << nl;

}



int32_t main(){

  fastio()

  #ifndef ONLINE_JUDGE

  freopen("Input.txt", "r", stdin);

  freopen("Output.txt", "w", stdout);

  #endif



  int t=1;

  cin >> t;

  for(int tc=1; tc<=t; tc++){

    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;
ifstream fin("window.in");
ofstream fout("window.out");
void solve(){
    int l,r;
    cin>>l>>r;
    int b(30);
    while(((1<<b)&l)==((1<<b)&r))b--;
    cout<<(1<<b)<<" "<<(1<<b)-1<<" "<<(1<<b)-2<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long t;
    cin>>t;
    while(t--)solve();
    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
ifstream fin("window.in");
ofstream fout("window.out");
void solve(){
    int l,r;
    cin>>l>>r;
    int b(30),prc(0);
    while(((1<<b)&l)==((1<<b)&r))b--,prc+=((1<<b)&r);
    if(prc+(1<<b)==r)cout<<(1<<b)<<" "<<(1<<b)-1<<" "<<(1<<b)-2<<"\n";
    else cout<<(1<<b)<<" "<<(1<<b)-1<<" "<<(1<<b)+1<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long t;
    cin>>t;
    while(t--)solve();
    return 0;
}