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 int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e18; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n; 
    cin >> n; 
    vector<int> a(n);  
    int sum = 0; 
    for (int i = 0; i < n; ++i) {
        cin >> a[i]; 
        sum += a[i]; 
    } 
    int ans = -INF; 
    if (n == 1) {
        console(a[0]); 
        return; 
    }
    int l = 0; 
    while (n - l >= 1) {
        int s = 0; 
        for (int i = l; i < n; ++i) s += a[i]; 
        if (l > 0) ans = max(ans, max(-s,s)); 
        vector<int> b(all(a)); 
        for (int i = l + 1; i < n; ++i) a[i] -= b[i-1]; 
       // console(ans); 
        ++l; 
    }
    console(ans); 
}
signed main()
{
    fast;
    int T; 
    cin >> T; 
    while (T--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e18; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n; 
    cin >> n; 
    vector<int> a(n);  
    int sum = 0; 
    for (int i = 0; i < n; ++i) {
        cin >> a[i]; 
        sum += a[i]; 
    } 
    int ans = sum; 
    if (n == 1) {
        console(a[0]); 
        return; 
    }
    int l = 0; 
    while (n - l >= 1) {
        int s = 0; 
        for (int i = l; i < n; ++i) s += a[i]; 
        ans = max(ans, max(-s,s)); 
        vector<int> b(all(a)); 
        for (int i = l + 1; i < n; ++i) a[i] -= b[i-1]; 
       // console(ans); 
        ++l; 
    }
    console(ans); 
}
signed main()
{
    fast;
    int T; 
    cin >> T; 
    while (T--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e18; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n; 
    cin >> n; 
    vector<int> a(n); 
    int ans = -INF; 
    for (int i = 0; i < n; ++i) cin >> a[i]; 
    if (n == 1) {
        console(a[0]); 
        return; 
    }
    int l = 0; 
    while (n - l >= 1) {
        int s = 0; 
        for (int i = l; i < n; ++i) s += a[i]; 
        ans = max(ans, max(-s,s)); 
        vector<int> b(all(a)); 
        for (int i = l + 1; i < n; ++i) a[i] -= b[i-1]; 
       // console(ans); 
        ++l; 
    }
    console(ans); 
}
signed main()
{
    fast;
    int T; 
    cin >> T; 
    while (T--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e18; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n; 
    cin >> n; 
    vector<int> a(n);  
    int sum = 0; 
    for (int i = 0; i < n; ++i) {
        cin >> a[i]; 
        sum += a[i]; 
    } 
    int ans = sum; 
    if (n == 1) {
        console(a[0]); 
        return; 
    }
    int l = 0; 
    while (n - l >= 1) {
        int s = 0; 
        for (int i = l; i < n; ++i) s += a[i]; 
        ans = max(ans, max(-s,s)); 
        vector<int> b(all(a)); 
        for (int i = l + 1; i < n; ++i) a[i] -= b[i-1]; 
       // console(ans); 
        ++l; 
    }
    console(ans); 
}
signed main()
{
    fast;
    int T; 
    cin >> T; 
    while (T--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e18; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n; 
    cin >> n; 
    vector<int> a(n);  
    int sum = 0; 
    for (int i = 0; i < n; ++i) {
        cin >> a[i]; 
        sum += a[i]; 
    } 
    int ans = sum; 
    if (n == 1) {
        console(a[0]); 
        return; 
    }
    int l = 0; 
    while (n - l >= 1) {
        int s = 0; 
        for (int i = l; i < n; ++i) s += a[i]; 
        if (l > 0) ans = max(ans, max(-s,s)); 
        vector<int> b(all(a)); 
        for (int i = l + 1; i < n; ++i) a[i] -= b[i-1]; 
       // console(ans); 
        ++l; 
    }
    console(ans); 
}
signed main()
{
    fast;
    int T; 
    cin >> T; 
    while (T--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e9; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n,l,r; 
    cin >> n >> l >> r; 
    vector<int> a(n); 
    for (int i = 0; i < n; ++i) cin >> a[i]; 
    priority_queue<int> ma;   //l,r 
    priority_queue<int, vector<int> , greater<int>> mi; 
    for (int i = 0; i < n; ++i) {
        if (i >= l - 1 && i < r) ma.push(a[i]); 
        else mi.push(a[i]); 
    }
    while (ma.top() > mi.top()) {
        int u = ma.top(); ma.pop(); 
        int v = mi.top(); mi.pop(); 
        ma.push(v); 
        mi.push(u); 
        // cout << u << ' ' << v << endl; 
    }
    int ans = 0; 
    while (!ma.empty()) ans += ma.top() , ma.pop(); 
    console(ans); 
}
signed main()
{
    fast;
    int tc; 
    cin >> tc; 
    while (tc--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e9; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n,l,r; 
    cin >> n >> l >> r; 
    vector<int> a(n); 
    for (int i = 0; i < n; ++i) cin >> a[i]; 
    priority_queue<int> ma;   //l,r 
    priority_queue<int, vector<int> , greater<int>> mi; 
    for (int i = 0; i < n; ++i) {
        if (i >= l - 1 && i < r) ma.push(a[i]); 
        else mi.push(a[i]); 
    }
    if (mi.size() == 0) {
        int ans = 0; 
        for (int i = 0; i < n; ++i) ans += a[i]; 
        console(ans); 
        return; 
    }
    while (ma.top() > mi.top()) {
        int u = ma.top(); ma.pop(); 
        int v = mi.top(); mi.pop(); 
        ma.push(v); 
        mi.push(u); 
        // cout << u << ' ' << v << endl; 
    }
    int ans = 0; 
    while (!ma.empty()) ans += ma.top() , ma.pop(); 
    console(ans); 
}
signed main()
{
    fast;
    int tc; 
    cin >> tc; 
    while (tc--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)


Submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e9; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n,l,r; 
    cin >> n >> l >> r; 
    vector<int> a(n); 
    for (int i = 0; i < n; ++i) cin >> a[i]; 
    priority_queue<int> ma;   //l,r 
    priority_queue<int, vector<int> , greater<int>> mi; 
    for (int i = 0; i < n; ++i) {
        if (i >= l - 1 && i < r) ma.push(a[i]); 
        else mi.push(a[i]); 
    }
    while (ma.top() > mi.top()) {
        int u = ma.top(); ma.pop(); 
        int v = mi.top(); mi.pop(); 
        ma.push(v); 
        mi.push(u); 
        // cout << u << ' ' << v << endl; 
    }
    int ans = 0; 
    while (!ma.empty()) ans += ma.top() , ma.pop(); 
    console(ans); 
}
signed main()
{
    fast;
    int tc; 
    cin >> tc; 
    while (tc--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/
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;
#define int long long
#define An UwU
#define         fast    ios::sync_with_stdio(false), cin.tie(0)
#define       all(x)    x.begin(), x.end()
#define console(a) cout<<a<<endl
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const int INF = 1e9; 
void solve()
{
    //freopen("input.inp" ,"r", stdin);
    //freopen("brute_out.out","w",stdout); 
    int n,l,r; 
    cin >> n >> l >> r; 
    vector<int> a(n); 
    for (int i = 0; i < n; ++i) cin >> a[i]; 
    priority_queue<int> ma;   //l,r 
    priority_queue<int, vector<int> , greater<int>> mi; 
    for (int i = 0; i < n; ++i) {
        if (i >= l - 1 && i < r) ma.push(a[i]); 
        else mi.push(a[i]); 
    }
    if (mi.size() == 0) {
        int ans = 0; 
        for (int i = 0; i < n; ++i) ans += a[i]; 
        console(ans); 
        return; 
    }
    while (ma.top() > mi.top()) {
        int u = ma.top(); ma.pop(); 
        int v = mi.top(); mi.pop(); 
        ma.push(v); 
        mi.push(u); 
        // cout << u << ' ' << v << endl; 
    }
    int ans = 0; 
    while (!ma.empty()) ans += ma.top() , ma.pop(); 
    console(ans); 
}
signed main()
{
    fast;
    int tc; 
    cin >> tc; 
    while (tc--) solve(); 

}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/

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

using namespace std;

#define int long long

#define An UwU

#define         fast    ios::sync_with_stdio(false), cin.tie(0)

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

#define console(a) cout<<a<<endl

const int maxn = 1e6;

const int MOD = 1e9 + 7;

const int INF = 1e18; 

int ask(priority_queue<int> ma, priority_queue<int, vector<int> , greater<int>> &mi) 

{

    if (mi.size() == 0) return INF; 

    int ans = 0; 

    while (ma.top() > mi.top()) {

        int u = ma.top(); ma.pop(); 

        int v = mi.top(); mi.pop(); 

        ma.push(v); 

        mi.push(u); 

    }

    while (!ma.empty()) ans += ma.top(), ma.pop(); 

    return ans;

}

void solve()

{

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

    //freopen("brute_out.out","w",stdout); 

    int n,l,r; 

    cin >> n >> l >> r; 

    vector<int> a(n); 

    priority_queue<int> ma;   //l,r 

    priority_queue<int, vector<int> , greater<int>> mi1; 

    priority_queue<int, vector<int> , greater<int>> mi2; 

    int s = 0, ans1, ans2; 

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

        cin >> a[i]; 

        if (i < l - 1) mi1.push(a[i]); 

        else if (i >= r) mi2.push(a[i]); 

        else {

            ma.push(a[i]); 

            s += a[i]; 

        }

    } 

    // cout << mi1.size(); 

    ans1 = ask(ma, mi1); 

    ans2 = ask(ma, mi2); 

    if (ans1 == INF && ans2 == INF) console(s); 

    else console(min(ans1, ans2)); 

}

signed main()

{

    fast;

    int tc; 

    cin >> tc; 

    while (tc--) solve(); 



}

/*   /\_/\

*   (= ._.)

*   / >  \>

*/
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <stack>
#include <string>
#define int long long
#define double long double
#define endl '\n'
#define Endl '\n'
using namespace std;
int num[500050];
int A[500050];
signed main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n,k;
		cin >> n >> k;
		for(int i=1;i<=n;i++)
		{
			cin >> A[i];
		}
		sort(A+1,A+1+n);
		int cnt=0;
		int op=1;
		for(int i=1;i<=n;i++)
		{
			if(A[i]==A[i+1])
			{
				op++;
			}else {
				num[++cnt]=op;
				op=1;
			}
		}
		sort(num+1,num+1+cnt);
		int sum=0;
		for(int i=1;i<=cnt;i++)
		{
			if(num[i]<=k)
			{
				k-=num[i]; 
			}else {
				sum++;
			}
		}
		cout << max((int)1,sum) << endl;
	}
	
	
	return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#include <stack>
#include <string>
#define int long long
#define double long double
#define endl '\n'
#define Endl '\n'
using namespace std;
int num[500050];
int A[500050];
signed main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n,k;
		cin >> n >> k;
		for(int i=1;i<=n;i++)
		{
			cin >> A[i];
		}
		sort(A+1,A+1+n);
		int cnt=0;
		int op=1;
		for(int i=1;i<=n;i++)
		{
			if(A[i]==A[i+1])
			{
				op++;
			}else {
				num[++cnt]=op;
				op=1;
			}
		}
		sort(num+1,num+1+cnt);
		int sum=0;
		for(int i=1;i<=cnt;i++)
		{
			if(num[i]<=k)
			{
				k-=num[i]; 
			}else {
				sum++;
			}
		}
		cout << max((int)1,sum) << endl;
		for(int i=0;i<=n;i++)
		{
			A[i]=0;num[i]=0;
		}
	}
	
	
	return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)


Submission (verdict: Compilation error):
#include <bits/stdc++.h>
#include <stack>
#include <string>
#define int long long
#define double long double
#define endl '\n'
#define Endl '\n'
using namespace std;
int num[500050];
int A[500050];
signed main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n,k;
		cin >> n >> k;
		for(int i=1;i<=n;i++)
		{
			cin >> A[i];
		}
		sort(A+1,A+1+n);
		int cnt=0;
		int op=1;
		for(int i=1;i<=n;i++)
		{
			if(A[i]==A[i+1])
			{
				op++;
			}else {
				num[++cnt]=op;
				op=1;
			}
		}
		sort(num+1,num+1+cnt);
		int sum=0;
		for(int i=1;i<=cnt;i++)
		{
			if(num[i]<=k)
			{
				k-=num[i]; 
			}else {
				sum++;
			}
		}
		cout << max((itn)1,sum) << endl;
	}
	
	
	return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
#include <stack>
#include <string>
#define int long long
#define double long double
#define endl '\n'
#define Endl '\n'
using namespace std;
int num[500050];
int A[500050];
signed main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n,k;
		cin >> n >> k;
		for(int i=1;i<=n;i++)
		{
			cin >> A[i];
		}
		sort(A+1,A+1+n);
		int cnt=0;
		int op=1;
		for(int i=1;i<=n;i++)
		{
			if(A[i]==A[i+1])
			{
				op++;
			}else {
				num[++cnt]=op;
				op=1;
			}
		}
		sort(num+1,num+1+cnt);
		int sum=0;
		for(int i=1;i<=cnt;i++)
		{
			if(num[i]<=k)
			{
				k-=num[i]; 
			}else {
				sum++;
			}
		}
		cout << max((itn)1,sum) << endl;
	}
	
	
	return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <stack>
#include <string>
#define int long long
#define double long double
#define endl '\n'
#define Endl '\n'
using namespace std;
int num[500050];
int A[500050];
signed main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n,k;
		cin >> n >> k;
		for(int i=1;i<=n;i++)
		{
			cin >> A[i];
		}
		sort(A+1,A+1+n);
		int cnt=0;
		int op=1;
		for(int i=1;i<=n;i++)
		{
			if(A[i]==A[i+1])
			{
				op++;
			}else {
				num[++cnt]=op;
				op=1;
			}
		}
		sort(num+1,num+1+cnt);
		int sum=0;
		for(int i=1;i<=cnt;i++)
		{
			if(num[i]<=k)
			{
				k-=num[i]; 
			}else {
				sum++;
			}
		}
		cout << max((int)1,sum) << endl;
	}
	
	
	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int T;
	std::cin >> T;
	auto solve = [&]() -> void {
		int l, r;
		std::cin >> l >> r;

		int a = r, b = r - 1, c = 0;
		bool flag = false;
		for (int i = 30; i >= 0; i--) {
			if (((a >> i) & 1) == ((b >> i) & 1)) {
				if (!((a >> i) & 1)) {
					flag && (c + (1 << i) < r - 1) && (c ^= (1 << i));
				} else {
					flag = true;
				}
			} else {
				flag = true;
				if (c + (1 << i) < r - 1) {
					c ^= (1 << i);
				}
			}
		}
		for (int i = 0; i <= 30; i++) {
			if (c < l && (c + (1 << i)) < r - 1) {
				c += (1 << i);
			}
		}
		std::cout << a << " " << b << " " << c << "\n";
	};
	while (T--) {
		solve();
	}

	return 0;
}

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

#define rep(T, i, a, b) for (T i = (a); i <= (b); i++)
#define per(T, i, a, b) for (T i = (a); i >= (b); i--)
#define rp(T, i, a, b) for (T i = (a); i < (b); i++)
#define pr(T, i, a, b) for (T i = (a); i > (b); i--)
#define all(x) (x).begin(), (x).end()
#define SZ(x) int((x).size())
#define fi first
#define se second
using ll = long long;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int T;
	std::cin >> T;
	auto solve = [&]() -> void {
		ll l, r;
		std::cin >> l >> r;

		ll a = 0, b = 0, c = 0;
		for (int i = 30; i >= 0; i--) {
			if (((r >> i) & 1) == ((l >> i) & 1)) {
				if (!((r >> i) & 1)) {
					continue;
				}
				a += (1LL << i);
				b += (1LL << i);
				c += (1LL << i);
			} else {
				a += (1LL << i);
				b += (1LL << i) - 1;
				if (c + (1LL << i) - 2 >= l) {
					c += (1LL << i) - 2;
				} else {
					c += (1LL << i) + 1;
				}
				break;
			}
		}
		std::cout << a << " " << b << " " << c << "\n";
	};
	while (T--) {
		solve();
	}

	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int T;
	std::cin >> T;
	auto solve = [&]() -> void {
		int l, r;
		std::cin >> l >> r;

		int a = r, b = r - 1, c = 0;
		bool flag = false;
		for (int i = 30; i >= 0; i--) {
			if (((a >> i) & 1) == ((b >> i) & 1)) {
				if (!((a >> i) & 1)) {
					flag && (c + (1 << i) < r - 1) && (c ^= (1 << i));
				} else {
					flag = true;
				}
			} else {
				flag = true;
				if (c + (1 << i) < r - 1) {
					c ^= (1 << i);
				}
			}
		}
		for (int i = 0; i <= 30; i++) {
			if (c < l && !((c >> i) & 1) && (c ^ (1 << i)) < r - 1) {
				c ^= (1 << i);
			}
		}
		std::cout << a << " " << b << " " << c << "\n";
	};
	while (T--) {
		solve();
	}

	return 0;
}

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

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int T;
	std::cin >> T;
	auto solve = [&]() -> void {
		int l, r;
		std::cin >> l >> r;

		int a = r, b = r - 1, c = 0;
		bool flag = false;
		for (int i = 30; i >= 0; i--) {
			if (((a >> i) & 1) == ((b >> i) & 1)) {
				if (!((a >> i) & 1)) {
					flag && (c + (1 << i) < r - 1) && (c ^= (1 << i));
				} else {
					flag = true;
				}
			} else {
				flag = true;
				if (c + (1 << i) < r - 1) {
					c ^= (1 << i);
				}
			}
		}
		for (int i = 0; i <= 30; i++) {
			if (c < l && (c + (1 << i)) < r - 1) {
				c += (1 << i);
			}
		}
		std::cout << a << " " << b << " " << c << "\n";
	};
	while (T--) {
		solve();
	}

	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


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

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int T;
	std::cin >> T;
	auto solve = [&]() -> void {
		int l, r;
		std::cin >> l >> r;

		int a = r, b = r - 1, c = 0;
		bool flag = false;
		for (int i = 30; i >= 0; i--) {
			if (((a >> i) & 1) == ((b >> i) & 1)) {
				if (!((a >> i) & 1)) {
					flag && (c + (1 << i) <= r) && (c ^= (1 << i));
				} else {
					flag = true;
				}
			} else {
				flag = true;
				if (c + (1 << i) <= r) {
					c ^= (1 << i);
				}
			}
		}
		for (int i = 0; i <= 30; i++) {
			if (c < l && !((c >> i) & 1)) {
				c ^= (1 << i);
			}
		}
		std::cout << a << " " << b << " " << c << "\n";
	};
	while (T--) {
		solve();
	}

	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int T;
	std::cin >> T;
	auto solve = [&]() -> void {
		int l, r;
		std::cin >> l >> r;

		int a = r, b = r - 1, c = 0;
		bool flag = false;
		for (int i = 30; i >= 0; i--) {
			if (((a >> i) & 1) == ((b >> i) & 1)) {
				if (!((a >> i) & 1)) {
					flag && (c + (1 << i) <= r) && (c ^= (1 << i));
				} else {
					flag = true;
				}
			} else {
				flag = true;
				if (c + (1 << i) <= r) {
					c ^= (1 << i);
				}
			}
		}
		for (int i = 0; i <= 30; i++) {
			if (c < l && !((c >> i) & 1)) {
				c ^= (1 << i);
			}
		}
		std::cout << a << " " << b << " " << c << "\n";
	};
	while (T--) {
		solve();
	}

	return 0;
}

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

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int T;
	std::cin >> T;
	auto solve = [&]() -> void {
		int l, r;
		std::cin >> l >> r;

		int a = r, b = r - 1, c = 0;
		bool flag = false;
		for (int i = 30; i >= 0; i--) {
			if (((a >> i) & 1) == ((b >> i) & 1)) {
				if (!((a >> i) & 1)) {
					flag && (c + (1 << i) < r - 1) && (c ^= (1 << i));
				} else {
					flag = true;
				}
			} else {
				flag = true;
				if (c + (1 << i) < r - 1) {
					c ^= (1 << i);
				}
			}
		}
		for (int i = 0; i <= 30; i++) {
			if (c < l && !((c >> i) & 1) && (c ^ (1 << i)) < r - 1) {
				c ^= (1 << i);
			}
		}
		std::cout << a << " " << b << " " << c << "\n";
	};
	while (T--) {
		solve();
	}

	return 0;
}
Problem: 2049B - pspspsps
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else if(c + dot + p == n && p == 1 && s[n - 1] == 'p'){

        YES;

    }

    else NO;





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}