ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)


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

typedef long long ll;

ll T, l, r, ans;

inline void solve() {
	cin >> l >> r;
	ans = 0;
	while ((1ll << (__builtin_clzll(r) ^ 63)) < l) {
		ll t = (1ll << (__builtin_clzll(r) ^ 63));
		l ^= t, r ^= t, ans ^= t;
	}
	ll a = (1ll << (__builtin_clzll(r) ^ 63)), b = (1ll << (__builtin_clzll(r) ^ 63)) - 1;
	cout << (a ^ ans) << " " << (a ^ ans) << " " << (b ^ ans) << "\n";
}

int main() {
	#ifdef LOCAL
		assert(freopen("test.in", "r", stdin));
		assert(freopen("test.out", "w", stdout));
	#endif
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

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

typedef long long ll;

ll T, l, r, ans;

inline void solve() {
	cin >> l >> r;
	ans = 0;
	while ((1ll << (__builtin_clzll(r) ^ 63)) < l) {
		ll t = (1ll << (__builtin_clzll(r) ^ 63));
		l ^= t, r ^= t, ans ^= t;
	}
	ll a = (1ll << (__builtin_clzll(r) ^ 63)), b = (1ll << (__builtin_clzll(r) ^ 63)) - 1;
	cout << (a ^ ans) << " " << (a ^ ans) << " " << (b ^ ans) << "\n";
}

int main() {
	#ifdef LOCAL
		assert(freopen("test.in", "r", stdin));
		assert(freopen("test.out", "w", stdout));
	#endif
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	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;

ll T, l, r, ans;

inline void solve() {
	cin >> l >> r;
	ans = 0;
	while ((1ll << (__builtin_clzll(r) ^ 63)) < l) {
		ll t = (1ll << (__builtin_clzll(r) ^ 63));
		l ^= t, r ^= t, ans ^= t;
	}
	ll a = (1ll << (__builtin_clzll(r) ^ 63)), b = (1ll << (__builtin_clzll(r) ^ 63)) - 1;
	ll c = l;
	while (c == a || c == b) {
		++c;
	}
	cout << (a ^ ans) << " " << (b ^ ans) << " " << (c ^ ans) << "\n";
}

int main() {
	#ifdef LOCAL
		assert(freopen("test.in", "r", stdin));
		assert(freopen("test.out", "w", stdout));
	#endif
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

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

typedef long long ll;

ll T, l, r, ans;

inline void solve() {
	cin >> l >> r;
	ans = 0;
	while ((1ll << (__builtin_clzll(r) ^ 63)) < l) {
		ll t = (1ll << (__builtin_clzll(r) ^ 63));
		l ^= t, r ^= t, ans ^= t;
	}
	ll a = (1ll << (__builtin_clzll(r) ^ 63)), b = (1ll << (__builtin_clzll(r) ^ 63)) - 1;
	ll c = l;
	while (c == a || c == b) {
		++c;
	}
	cout << (a ^ ans) << " " << (b ^ ans) << " " << (c ^ ans) << "\n";
}

int main() {
	#ifdef LOCAL
		assert(freopen("test.in", "r", stdin));
		assert(freopen("test.out", "w", stdout));
	#endif
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}

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

typedef long long ll;

ll T, l, r, ans;

inline void solve() {
	cin >> l >> r;
	ans = 0;
	while ((1ll << (__builtin_clzll(r) ^ 63)) <= l) {
		ll t = (1ll << (__builtin_clzll(r) ^ 63));
		l ^= t, r ^= t, ans ^= t;
	}
	ll a = (1ll << (__builtin_clzll(r) ^ 63)), b = (1ll << (__builtin_clzll(r) ^ 63)) - 1;
	ll c = l;
	while (c == a || c == b) {
		++c;
	}
	cout << (a ^ ans) << " " << (b ^ ans) << " " << (c ^ ans) << "\n";
}

int main() {
	#ifdef LOCAL
		assert(freopen("test.in", "r", stdin));
		assert(freopen("test.out", "w", stdout));
	#endif
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)


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

int assign_smallest_to_largest(vector<pair<int, int>> &lis, int k){
    int i = 0;
    int current_most = lis.back().first;
    int cnt = 0;
    // cout << "current_most "<<current_most << endl;
    // for(int i = 0; i < lis.size()/2; i++){
    //     cout << "data before: "<<lis[i].first << " " << lis[i].second << endl;
    // }
    for (int i = 0; i < lis.size()/2; i++)
    {
        if(lis[i].first == current_most){
            continue;
        }
        if(lis[i].second <= k){
            lis.back().second += lis[i].second;
            k -= lis[i].second;
            lis[i].second = 0;
        }
        else{
            break;
        }
    }  
    
    for(int i = 0; i < lis.size()/2; i++){
        // cout << "data: "<<lis[i].first << " " << lis[i].second << endl;
        if(lis[i].second > 0){
            cnt++;
        }
    }
    return cnt;
}

int main(){
    int t, n, k;
    cin >> t;
    unordered_map<int, int> m;
    for(int i = 0; i < t; i++){
        cin >> n >> k;
        for(int j = 0; j < n; j++){
            int x;
            cin >> x;
            m[x]++;
        }
        // cout << "msize: "<<m.size() << endl;
        vector<pair<int, int>> lis(m.begin(), m.end());
        for (auto i = m.begin(); i != m.end(); i++)
        {
            lis.push_back(make_pair(i->first, i->second));
            // cout << "data pushed: "<<i->first << " " << i->second << endl;
        }
        // cout << "data size: "<<lis.size() << endl;
        
        sort(lis.begin(), lis.end(), [](const pair<int, int> &a, const pair<int, int> &b){
            return a.second < b.second;
        });

        cout << assign_smallest_to_largest(lis, k) << endl;
        m.clear();
    }



    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int x;
	scanf("%d",&x);
	for(;x>0;x--){
		vector<ll>v;
		int a;
		scanf("%d",&a);
		int i;
		long long sum=0;
		for(i=0;i<a;i++){
			int b;
			scanf("%d",&b);
			v.push_back(b);
			sum+=b;
		}
		
		for(;a>1;a--){
			long long ret=0;
			if(v[0]<v[a-1]){
				reverse(v.begin(),v.end());
			}
			for(i=0;i<a-1;i++){
				v[i]=v[i]-v[i+1];
				ret+=v[i];
			}
			sum=max(sum,ret);
			v.pop_back();
		}
		printf("%lld\n",sum);
		
		
		
		
		
	}
	
	
	
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int x;
	scanf("%d",&x);
	for(;x>0;x--){
		vector<ll>v;
		int a;
		scanf("%d",&a);
		int i;
		long long sum=0;
		for(i=0;i<a;i++){
			int b;
			scanf("%d",&b);
			v.push_back(b);
			sum+=b;
		}
		
		for(;a>1;a--){
			long long ret=0;
			if(v[0]<v[a-1]){
				reverse(v.begin(),v.end());
			}
			for(i=0;i<a-1;i++){
				v[i]=v[i]-v[i+1];
				ret+=v[i];
			}
			sum=max(sum,ret);
			v.pop_back();
		}
		printf("%lld\n",sum);
		
		
		
		
		
	}
	
	
	
	return 0;
}

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

int main(){
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        ll sum = 0;
        for(int i = 0; i < n; i++){
            cin >> a[i];
            sum+=a[i];
        }
        if(n == 1){
            cout << a[0] << endl;
            continue;
        }

        while (n)
        {   
            ll tmp = a[n-1] - a[0];
            for(int i=0; i<n-1; i++){
                a[i] = a[i+1] - a[i];
            }
            n--;
            sum = max(sum, max(tmp, -tmp));
        }
        cout << sum << endl;
        
    }
    
}
Problem: 2062C - Cirno and Operations
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 t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        ll sum = 0;
        for(int i = 0; i < n; i++){
            cin >> a[i];
            sum+=a[i];
        }
        if(n == 1){
            cout << a[0] << endl;
            continue;
        }

        while (n)
        {   
            ll tmp = a[n-1] - a[0];
            for(int i=0; i<n-1; i++){
                a[i] = a[i+1] - a[i];
            }
            n--;
            sum = max(sum, max(tmp, -tmp));
        }
        cout << sum << endl;
        
    }
    
}

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

int main(){
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<ll> a(n);
        ll sum = 0;
        for(int i = 0; i < n; i++){
            cin >> a[i];
            sum+=a[i];
        }
        if(n == 1){
            cout << a[0] << endl;
            continue;
        }

        while (n)
        {   
            ll tmp = a[n-1] - a[0];
            for(int i=0; i<n-1; i++){
                a[i] = a[i+1] - a[i];
            }
            n--;
            sum = max(sum, max(tmp, -tmp));
        }
        cout << sum << endl;
        
    }
    
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define F first
#define S second
#define M "MUHA"
#define all(x) x.begin(),x.end()
#define ssd ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int maxn = 1e5+5,N=20,mod = 1e9+7;
void solve(){
    int n;
    cin >>n;
    int cal2=0,cal3=0;
    int cal=0;
    string s = to_string(n);
    for(int i=0;i<s.size();i++){
        cal+=s[i]-'0';
        if(s[i]=='2')cal2++;
        if(s[i]=='3')cal3++;
    }
    if(cal%9==0){
        cout<<"YES"<<'\n';
        return;
    }
    int c2=10,c3=3;
    c2 = min(c2,cal2);c3 = min(c3, cal3);
    for(int i=1;i<=c3;i++){
        if((i*6+cal)%9==0){
            cout<<"YES"<<'\n';
            return;
        }
    }
    for(int i=1;i<=c2;i++){
        if((i*2+cal)%9==0){
            cout<<"YES"<<'\n';
            return;
        }
    }
    for(int i=1;i<=c3;i++){
        for(int j=1;j<=c2;j++){
            if((i*6+j*2+cal)%9==0){
                cout<<"YES"<<'\n';
                return;
            }
        }
    }
    cout<<"NO"<<'\n';
}
signed main(){
    //freopen("lepus.in", "r", stdin);
    //freopen("lepus.out",   "w", stdout);
    ssd
    int t=1;
    cin>>t;
    for(int i=1;i<=t;i++){
        //cout<<"Case "<<i<<":"<<'\n';
        solve();
    }
}


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define F first
#define S second
#define M "MUHA"
#define all(x) x.begin(),x.end()
#define ssd ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int maxn = 1e5+5,N=20,mod = 1e9+7;
void solve(){
    int n;
    cin >>n;
    int cal2=0,cal3=0;
    int cal=0;
    string s = to_string(n);
    for(int i=0;i<s.size();i++){
        cal+=s[i]-'0';
        if(s[i]=='2')cal2++;
        if(s[i]=='3')cal3++;
    }
    if(cal%9==0){
        cout<<"YES"<<'\n';
        return;
    }
    int c2=10,c3=10;
    c2 = min(c2,cal2);c3 = min(c3, cal3);
    for(int i=0;i<=c3;i++){
        for(int j=0;j<=c2;j++){
            if((i*6+j*2+cal)%9==0){
                cout<<"YES"<<'\n';
                return;
            }
        }
    }
    cout<<"NO"<<'\n';
}
signed main(){
    //freopen("lepus.in", "r", stdin);
    //freopen("lepus.out",   "w", stdout);
    ssd
    int t=1;
    cin>>t;
    for(int i=1;i<=t;i++){
        //cout<<"Case "<<i<<":"<<'\n';
        solve();
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define F first
#define S second
#define M "MUHA"
#define all(x) x.begin(),x.end()
#define ssd ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int maxn = 1e5+5,N=20,mod = 1e9+7;
void solve(){
    int n;
    cin >>n;
    int cal2=0,cal3=0;
    int cal=0;
    string s = to_string(n);
    for(int i=0;i<s.size();i++){
        cal+=s[i]-'0';
        if(s[i]=='2')cal2++;
        if(s[i]=='3')cal3++;
    }
    if(cal%9==0){
        cout<<"YES"<<'\n';
        return;
    }
    int c2=10,c3=3;
    c2 = min(c2,cal2);c3 = min(c3, cal3);
    for(int i=1;i<=c3;i++){
        if((i*6+cal%9)%9==0){
            cout<<"YES"<<'\n';
            return;
        }
    }
    for(int i=1;i<=c2;i++){
        if((i*2+cal%9)%9==0){
            cout<<"YES"<<'\n';
            return;
        }
    }
    for(int i=1;i<=c3;i++){
        for(int j=1;j<=c2;j++){
            if((i*6+j*2+cal%9)%9==0){
                cout<<"YES"<<'\n';
                return;
            }
        }
    }
    cout<<"NO"<<'\n';
}
signed main(){
    //freopen("lepus.in", "r", stdin);
    //freopen("lepus.out",   "w", stdout);
    ssd
    int t=1;
    cin>>t;
    for(int i=1;i<=t;i++){
        //cout<<"Case "<<i<<":"<<'\n';
        solve();
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define F first
#define S second
#define M "MUHA"
#define all(x) x.begin(),x.end()
#define ssd ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int maxn = 1e5+5,N=20,mod = 1e9+7;
void solve(){
    int n;
    cin >>n;
    int cal2=0,cal3=0;
    int cal=0;
    string s = to_string(n);
    for(int i=0;i<s.size();i++){
        cal+=s[i]-'0';
        if(s[i]=='2')cal2++;
        if(s[i]=='3')cal3++;
    }
    if(cal%9==0){
        cout<<"YES"<<'\n';
        return;
    }
    int c2=10,c3=3;
    c2 = min(c2,cal2);c3 = min(c3, cal3);
    for(int i=1;i<=c3;i++){
        if((i*6+cal%9)%9==0){
            cout<<"YES"<<'\n';
            return;
        }
    }
    for(int i=1;i<=c2;i++){
        if((i*2+cal%9)%9==0){
            cout<<"YES"<<'\n';
            return;
        }
    }
    for(int i=1;i<=c3;i++){
        for(int j=1;j<=c2;j++){
            if((i*6+j*2+cal%9)%9==0){
                cout<<"YES"<<'\n';
                return;
            }
        }
    }
    cout<<"NO"<<'\n';
}
signed main(){
    //freopen("lepus.in", "r", stdin);
    //freopen("lepus.out",   "w", stdout);
    ssd
    int t=1;
    cin>>t;
    for(int i=1;i<=t;i++){
        //cout<<"Case "<<i<<":"<<'\n';
        solve();
    }
}


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define F first
#define S second
#define M "MUHA"
#define all(x) x.begin(),x.end()
#define ssd ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int maxn = 1e5+5,N=20,mod = 1e9+7;
void solve(){
    int n;
    cin >>n;
    int cal2=0,cal3=0;
    int cal=0;
    string s = to_string(n);
    for(int i=0;i<s.size();i++){
        cal+=s[i]-'0';
        if(s[i]=='2')cal2++;
        if(s[i]=='3')cal3++;
    }
    if(cal%9==0){
        cout<<"YES"<<'\n';
        return;
    }
    int c2=10,c3=3;
    c2 = min(c2,cal2);c3 = min(c3, cal3);
    for(int i=1;i<=c3;i++){
        if((i*6+cal)%9==0){
            cout<<"YES"<<'\n';
            return;
        }
    }
    for(int i=1;i<=c2;i++){
        if((i*2+cal)%9==0){
            cout<<"YES"<<'\n';
            return;
        }
    }
    for(int i=1;i<=c3;i++){
        for(int j=1;j<=c2;j++){
            if((i*6+j*2+cal)%9==0){
                cout<<"YES"<<'\n';
                return;
            }
        }
    }
    cout<<"NO"<<'\n';
}
signed main(){
    //freopen("lepus.in", "r", stdin);
    //freopen("lepus.out",   "w", stdout);
    ssd
    int t=1;
    cin>>t;
    for(int i=1;i<=t;i++){
        //cout<<"Case "<<i<<":"<<'\n';
        solve();
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define F first
#define S second
#define M "MUHA"
#define all(x) x.begin(),x.end()
#define ssd ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int maxn = 1e5+5,N=20,mod = 1e9+7;
void solve(){
    int n;
    cin >>n;
    int cal2=0,cal3=0;
    int cal=0;
    string s = to_string(n);
    for(int i=0;i<s.size();i++){
        cal+=s[i]-'0';
        if(s[i]=='2')cal2++;
        if(s[i]=='3')cal3++;
    }
    if(cal%9==0){
        cout<<"YES"<<'\n';
        return;
    }
    int c2=10,c3=10;
    c2 = min(c2,cal2);c3 = min(c3, cal3);
    for(int i=0;i<=c3;i++){
        for(int j=0;j<=c2;j++){
            if((i*6+j*2+cal)%9==0){
                cout<<"YES"<<'\n';
                return;
            }
        }
    }
    cout<<"NO"<<'\n';
}
signed main(){
    //freopen("lepus.in", "r", stdin);
    //freopen("lepus.out",   "w", stdout);
    ssd
    int t=1;
    cin>>t;
    for(int i=1;i<=t;i++){
        //cout<<"Case "<<i<<":"<<'\n';
        solve();
    }
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define F first
#define S second
#define M "MUHA"
#define all(x) x.begin(),x.end()
#define ssd ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int maxn = 1e5+5,N=20,mod = 1e9+7;
void solve(){
    string s;
    cin >>s;
    int cal2=0,cal3=0;
    int cal=0;
    for(int i=0;i<s.size();i++){
        cal+=s[i]-'0';
        if(s[i]=='2')cal2++;
        if(s[i]=='3')cal3++;
    }
    
    if(cal%9==0){
        cout<<"YES"<<'\n';
        return;
    }
    int c2=10,c3=10;
    c2 = min(c2, cal2);
    c3 = min(c3, cal3);
    for(int i=0;i<=c3;i++){
        for(int j=0;j<=c2;j++){
            if((i*6+j*2+cal)%9==0){
                cout<<"YES"<<'\n';
                return;
            }
        }
    }
    cout<<"NO"<<'\n';
}
signed main(){
    //freopen("lepus.in", "r", stdin);
    //freopen("lepus.out",   "w", stdout);
    ssd
    int t=1;
    cin>>t;
    for(int i=1;i<=t;i++){
        //cout<<"Case "<<i<<":"<<'\n';
        solve();
    }
}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)


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

using namespace std;

int main(){

	int t;

	cin>>t;

	while(t--){

		int n,l,r;

		cin>>n>>l>>r;

		long long a[n+9]={0};

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

		long long b[n+9]={0},c[n+9]={0};

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

			b[i]=a[i];

			c[i]=a[i];

		}

		sort(b+1,b+1+r);

		sort(c+l,c+1+n);

		long long q=0,w=0;

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

			q+=b[i];

			w+=c[i];

		}

		cout<<min(q,w)<<endl;

		

		

		

	}

	

	

	return 0;

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

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

using namespace std;

int main(){

	int t;

	cin>>t;

	while(t--){

		int n,l,r;

		cin>>n>>l>>r;

		long long a[n+9]={0};

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

		long long b[n+9]={0},c[n+9]={0};

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

			b[i]=a[i];

			c[i]=a[i];

		}

		sort(b+1,b+1+r);

		sort(c+l,c+1+n);

		long long q=0,w=0;

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

			q+=b[i];

			w+=c[i];

		}

		cout<<min(q,w)<<endl;

		

		

		

	}

	

	

	return 0;

}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,l,r;
		cin>>n>>l>>r;
		long long a[n+9]={0};
		for(int i=1;i<=n;i++) cin>>a[i];
		long long b[n+9]={0},c[n+9]={0};
		sort(a+1,a+1+n);
		long long q=0;
		for(int i=1;i<=r-l+1;i++){
			q+=a[i];
		}
		cout<<q<<endl;
		
		
		
	}
	
	
	return 0;
}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,l,r;
		cin>>n>>l>>r;
		long long a[n+9]={0};
		for(int i=1;i<=n;i++) cin>>a[i];
		long long b[n+9]={0},c[n+9]={0};
		sort(a+1,a+1+n);
		long long q=0;
		for(int i=1;i<=r-l+1;i++){
			q+=a[i];
		}
		cout<<q<<endl;
		
		
		
	}
	
	
	return 0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,l,r;
		cin>>n>>l>>r;
		long long a[n+9]={0};
		for(int i=1;i<=n;i++) cin>>a[i];
		long long b[n+9]={0},c[n+9]={0};
		for(int i=1;i<=n;i++){
			b[i]=a[i];
			c[i]=a[i];
		}
		sort(b+1,b+1+r);
		sort(c+l,c+1+n);
		long long q=0,w=0;
		for(int i=1;i<=r-l+1;i++)q+=b[i];
		for(int i=l;i<=r;i++) w+=c[i];
		cout<<min(q,w)<<endl;
		
	}
	
	
	return 0;
}
Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;

#define endl '\n'

#define int long long

const int inf = 0x7f7f7f7f;

const int mod = 1e9+7;



long long ksm(long long a,long long b){

	if(b==0) return 1;

	long long ans = 1;

	while(b>0){

		if(b & 1){

			ans= ans * a % mod;

		}

		a = a * a % mod;

		b>>=1;

	}

	return ans;

}



void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	vector<int> ans(n);

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

	{

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

	}

	if(n%2 || (y-x)%2==0)

	{

		ans[x] = 2;

	}

	for(auto t : ans)

		cout<<t<<" ";

	cout<<endl;



}



signed main(){

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	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 <bits/stdc++.h>

using namespace std;

#define endl '\n'

#define int long long

const int inf = 0x7f7f7f7f;

const int mod = 1e9+7;



long long ksm(long long a,long long b){

	if(b==0) return 1;

	long long ans = 1;

	while(b>0){

		if(b & 1){

			ans= ans * a % mod;

		}

		a = a * a % mod;

		b>>=1;

	}

	return ans;

}



void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	vector<int> ans(n);

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

	{

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

	}

	if(n%2 || (y-x)%2==0)

	{

		ans[x] = 2;

	}

	for(auto t : ans)

		cout<<t<<" ";

	cout<<endl;



}



signed main(){

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	int t;

	cin>>t;

	while(t--){

		solve();

	}



	return 0;

}

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

using namespace std;

#define endl '\n'

#define int long long

const int inf = 0x7f7f7f7f;

const int mod = 1e9+7;



long long ksm(long long a,long long b){

	if(b==0) return 1;

	long long ans = 1;

	while(b>0){

		if(b & 1){

			ans= ans * a % mod;

		}

		a = a * a % mod;

		b>>=1;

	}

	return ans;

}



void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	y--;x--;

	vector<int> ans(n);

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

	{

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

	}

	if(n%2 || (y-x)%2==0)

	{

		ans[x] = 2;

	}

	for(auto t : ans)

		cout<<t<<" ";

	cout<<endl;



}



signed main(){

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	int t;

	cin>>t;

	while(t--){

		solve();

	}



	return 0;

}