ShaysXIA/CodeInsightBench huggingface dataset:
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;
const int N=100050;
ll gcd(ll x,ll y){
	if(y==0) return x;
	else return gcd(y,x%y);
}
ll a[50]={0};
void solve(){
	ll l,r;
	stack<ll>st;
	scanf("%lld %lld",&l,&r);
	ll x=0;
	ll rr=r;
	while(rr>1){
		st.push(rr%2);
		rr/=2;
		x++;
	}
	st.push(1);
	int a1=0;
	while(!st.empty()){a[++a1]=st.top();st.pop();}
	int p=1;
	ll ans=0;
	while(x){
		if(a[p]==1){
			ans+=(1<<x);
		}
		p++;
		if(ans<=r&&ans-1>=l){
			printf("%lld %lld %lld",ans,ans,ans-1);
			break;
		}else{
			x--;
		}
	}
//	cout<<"\n"<<(ans ^ ans)+(ans ^ (ans-1))*2<<"\n";
}
int main(){
	int t=1;
	scanf("%d",&t);
	while(t--){
		solve();
		printf("\n");
	}
	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;
const int N=100050;
ll gcd(ll x,ll y){
	if(y==0) return x;
	else return gcd(y,x%y);
}
ll a[50]={0};
void solve(){
	ll l,r;
	stack<ll>st;
	scanf("%lld %lld",&l,&r);
	ll x=0;
	ll rr=r;
	while(rr>1){
		st.push(rr%2);
		rr/=2;
		x++;
	}
	st.push(1);
	int a1=0;
	while(!st.empty()){a[++a1]=st.top();st.pop();}
	int p=1;
	ll ans=0;
	while(x){
		if(a[p]==1){
			ans+=(1<<x);
		}
		p++;
		if(ans<=r&&ans-2>=l){
			printf("%lld %lld %lld",ans,ans-1,ans-2);
			break;
		}else{
			x--;
		}
	}
//	cout<<"\n"<<(ans ^ (ans-1))+((ans-1) ^ (ans-2))+(ans ^(ans-2))<<"\n";
}
int main(){
	int t=1;
	scanf("%d",&t);
	while(t--){
		solve();
		printf("\n");
	}
	return 0;
}
/*

*/


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100050;
ll gcd(ll x,ll y){
	if(y==0) return x;
	else return gcd(y,x%y);
}
ll a[50]={0};
void solve(){
	ll l,r;
	stack<ll>st;
	scanf("%lld %lld",&l,&r);
	ll x=0;
	ll rr=r;
	while(rr>1){
		st.push(rr%2);
		rr/=2;
		x++;
	}
	st.push(1);
	int a1=0;
	while(!st.empty()){a[++a1]=st.top();st.pop();}
	int p=1;
	ll ans=0;
	while(x>=0){
		if(a[p]==1){
			ans+=(1<<x);
		}
		p++;
		if(ans<=r&&ans-2>=l){
			printf("%lld %lld %lld",ans,ans-1,ans-2);
			break;
		}else{
			x--;
		}
	}
//	cout<<"\n"<<(ans ^ (ans-1))+((ans-1) ^ (ans-2))+(ans ^(ans-2))<<"\n";
}
int main(){
	int t=1;
	scanf("%d",&t);
	while(t--){
		solve();
		printf("\n");
	}
	return 0;
}
/*

*/
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
//                                                 ඞඞඞ

#include<bits/stdc++.h>
using namespace std;

#define ll long long 
#define vl vector<long long>
#define rep(j,b) for((j)=0;(j)<(b);(j)++)
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define all(v) (v).begin(), (v).end() 
#define Sort(v) sort(all(v))
#define nl cout<<endl;


bool f(ll k, map<ll,ll> &mp)
{
    if(mp[k]>0)
    {
        mp[k]--; return true;
    }
    ll x=k/2, y=(k+1)/2;
    if(x<1) return false;
    return f(x,mp) && f(y,mp); 
}

vl input_vec(ll n) { ll i,a; vl vec; rep(i,n) { cin>>a; vec.push_back(a); } return vec; }

void solve()
{
    ll n,i,m; cin>>n>>m;
    vl vec=input_vec(n);
    vl v=input_vec(m);
    map<ll,ll> mp;
    rep(i,n) mp[vec[i]]++;
    rep(i,m)
    {
        if(f(v[i],mp)) continue;
        N return;
    }
    Y 

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1; cin>>t;
    while(t--)
        solve();
    return 0;
}

Submission (verdict: Accepted):
//                                                 ඞඞඞ

#include<bits/stdc++.h>
using namespace std;

#define ll long long 
#define vl vector<long long>
#define rep(j,b) for((j)=0;(j)<(b);(j)++)
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define all(v) (v).begin(), (v).end() 
#define Sort(v) sort(all(v))
#define nl cout<<endl;


bool f(ll k, map<ll,ll> &mp)
{
    if(mp[k]>0)
    {
        mp[k]--; return true;
    }
    ll x=k/2, y=(k+1)/2;
    if(x<1) return false;
    return f(x,mp) && f(y,mp); 
}

vl input_vec(ll n) { ll i,a; vl vec; rep(i,n) { cin>>a; vec.push_back(a); } return vec; }

void solve()
{
    ll n,i,m; cin>>n>>m;
    vl vec=input_vec(n);
    vl v=input_vec(m);
    map<ll,ll> mp;
    rep(i,n) mp[vec[i]]++;
    rep(i,m)
    {
        if(f(v[i],mp)) continue;
        N return;
    }
    for(auto it:mp)
    {
        if(it.second!=0) { N return;}
    }
    Y 

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1; cin>>t;
    while(t--)
        solve();
    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 6):
//                                                 ඞඞඞ

#include<bits/stdc++.h>
using namespace std;

#define ll long long 
#define vl vector<long long>
#define rep(j,b) for((j)=0;(j)<(b);(j)++)
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define all(v) (v).begin(), (v).end() 
#define Sort(v) sort(all(v))
#define nl cout<<endl;

pair<bool,map<ll,ll>> f(ll k, map<ll,ll> &mp)
{
    if(mp[k]>0)
    {
        mp[k]--;
        map<ll,ll> t; t[k]++;
        return {true, t};
    }
    ll x=k/2, y=(k+1)/2;
    if(x<1)
    {
        map<ll,ll> d; return {false,d};
    }
    auto t1=f(x,mp), t2=f(y,mp);
    if(t1.first==true)
    {
        if(t2.first==true)
        {
            for(auto it: t2.second)
            {
                t1.second[it.first]+= it.second;
            }
            return t1;
        }
        else
        {
            for(auto it:t1.second)
            {
                mp[it.first]+=it.second;
            }
            t1.second.clear();
            return {false,t1.second};
        }
    }
    else
    {
        if(t2.first==true)
        {
            for(auto it:t2.second)
            {
                mp[it.first]+=it.second;
            }
            t2.second.clear();
            return {false,t2.second};
        }
        else
        {
            map<ll,ll> mm;
            return {false, mm};
        }
    }
}

vl input_vec(ll n) { ll i,a; vl vec; rep(i,n) { cin>>a; vec.push_back(a); } return vec; }

void solve()
{
    ll n,m; cin>>n>>m;
    vl vec=input_vec(n);
    vl v=input_vec(m);
    map<ll,ll> mp; for(ll i=0;i<n;i++) mp[vec[i]]++;
    ll x=accumulate(all(v),0ll);
    ll y=accumulate(all(vec),0ll);
    if(x!=y)
    {
        N return;
    }
    for(ll i=0;i<m;i++) 
    {
        ll k=v[i];
        if(f(k,mp).first==true) continue;
        N return;
    }
    for(auto it:mp)
    {
        if(it.second!=0){ N return;}
    }
    Y 
    

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1; cin>>t;
    while(t--)
        solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;	cin>>t;
	while(t--){
		long long n,m,a[100];
		cin>>n;
		long long ans=0;
		for(int i=1;i<=n;i++){
			cin>>a[i];ans+=a[i];
		}
		if(n==1){
			cout<<ans<<endl;
			continue;
		}
		while(n){
			n--;
			for(int i=1;i<n;i++)a[i]=a[i+1]-a[i];
			for(int i=1;i<=n;i++)sum+=a[i];
			ans=max(ans,abs(sum));
		}
		cout<<ans<<endl;
	}
	return 0;
}
	

Submission (verdict: Accepted):
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;	cin>>t;
	while(t--){
		long long n,a[100];
		cin>>n;
		long long ans=0;
		for(int i=1;i<=n;i++){
			cin>>a[i];ans+=a[i];
		}
		if(n==1){
			cout<<ans<<endl;
			continue;
		}
		while(n){
			n--;
			long long sum=0;
			for(int i=1;i<=n;i++)a[i]=a[i+1]-a[i];
			for(int i=1;i<=n;i++)sum+=a[i];
			ans=max(ans,abs(sum));
		}
		cout<<ans<<endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;	cin>>t;
	while(t--){
		int n,m,a[100];
		cin>>n;
		long long ans=0;
		for(int i=1;i<=n;i++){
			cin>>a[i];ans+=a[i];
		}
		if(n==1){
			cout<<ans<<endl;
			continue;
		}
		while(n){
			n--;
			for(int i=1;i<=n;i++)a[i]=a[i+1]-a[i];
			long long sum=0;
			for(int i=1;i<=n;i++)sum+=a[i];
			ans=max(ans,max(sum,-sum));
		}
		cout<<ans<<endl;
	}
	return 0;
}
	

Submission (verdict: Compilation error):
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;	cin>>t;
	while(t--){
		long long n,m,a[100];
		cin>>n;
		long long ans=0;
		for(int i=1;i<=n;i++){
			cin>>a[i];ans+=a[i];
		}
		if(n==1){
			cout<<ans<<endl;
			continue;
		}
		while(n){
			n--;
			for(int i=1;i<n;i++)a[i]=a[i+1]-a[i];
			for(int i=1;i<=n;i++)sum+=a[i];
			ans=max(ans,abs(sum));
		}
		cout<<ans<<endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;	cin>>t;
	while(t--){
		int n,m,a[100];
		cin>>n;
		int ans=0;
		for(int i=1;i<=n;i++){
			cin>>a[i];ans+=a[i];
		}
		if(n==1){
			cout<<ans<<endl;
			continue;
		}
		while(n){
			n--;
			for(int i=1;i<=n;i++)a[i]=a[i+1]-a[i];
			int sum=0;
			for(int i=1;i<=n;i++)sum+=a[i];
			ans=max(ans,max(sum,-sum));
		}
		cout<<ans<<endl;
	}
	return 0;
}
	

Submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;	cin>>t;
	while(t--){
		int n,m,a[100];
		cin>>n;
		long long ans=0;
		for(int i=1;i<=n;i++){
			cin>>a[i];ans+=a[i];
		}
		if(n==1){
			cout<<ans<<endl;
			continue;
		}
		while(n){
			n--;
			for(int i=1;i<=n;i++)a[i]=a[i+1]-a[i];
			long long sum=0;
			for(int i=1;i<=n;i++)sum+=a[i];
			ans=max(ans,max(sum,-sum));
		}
		cout<<ans<<endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;	cin>>t;
	while(t--){
		int n,m,a[100];
		cin>>n;
		int ans=0;
		for(int i=1;i<=n;i++){
			cin>>a[i];ans+=a[i];
		}
		if(n==1){
			cout<<ans<<endl;
			continue;
		}
		while(n){
			n--;
			for(int i=1;i<=n;i++)a[i]=a[i+1]-a[i];
			int sum=0;
			for(int i=1;i<=n;i++)sum+=a[i];
			ans=max(ans,max(sum,-sum));
		}
		cout<<ans<<endl;
	}
	return 0;
}
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)


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

#include <ext/pb_ds/assoc_container.hpp>



using namespace std;

using namespace __gnu_pbds;



#define endl "\n"

#define ll long long

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr);



const int N = 2e5 + 5;



int ans[N];





int main() {

    IOS;

    int t;

    cin >> t;

    while (t--) {

        int n, x, y;

        cin >> n >> x >> y;

        x--, y--;

        if (x > y) {

            swap(x, y);

        }

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

            ans[i] = -1;

        }

        if (y - x == 1 || (x == 0 && y == n - 1)) {

            ans[0] = 0;

        } else {

            ans[x] = 0;

            ans[y] = 1;

            int xa = (x + 1) % n, xb = (x - 1 + n) % n;

            int ya = (y + 1) % n, yb = (y - 1 + n) % n;

            ans[xa] = 1;

            ans[xb] = 1;

            ans[ya] = 0;

            ans[yb] = 0;

            if (xa == ya || xa == yb) {

                ans[xa] = 2;

            }

            if (xb == ya || xb == yb) {

                ans[xb] = 2;

            }

        }

        int i = y;

        while (i != x) {

            if (ans[i] == -1) {

                set<int> st;

                if (ans[(i - 1 + n) % n] != -1) {

                    st.insert(ans[(i - 1 + n) % n]);

                }

                if (ans[(i + 1) % n] != -1) {

                    st.insert(ans[(i + 1) % n]);

                }

                if (*st.begin() == 1) {

                    ans[i] = 0;

                } else if (*st.rbegin() == 0 || st.size() == 1) {

                    ans[i] = 1;

                } else {

                    ans[i] = 2;

                }

            }

            i = (i + 1) % n;

        }

        i = x;

        while (i != y) {

            if (ans[i] == -1) {

                set<int> st;

                if (ans[(i - 1 + n) % n] != -1) {

                    st.insert(ans[(i - 1 + n) % n]);

                }

                if (ans[(i + 1) % n] != -1) {

                    st.insert(ans[(i + 1) % n]);

                }

                if (*st.begin() == 1) {

                    ans[i] = 0;

                } else if (*st.rbegin() == 0 || st.size() == 1) {

                    ans[i] = 1;

                } else {

                    ans[i] = 2;

                }

            }

            i++;

        }

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

            cout << ans[i] << " ";

        }

        cout << endl;

    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
// Created at: 2025-02-26 19:39:40



#include <bits/stdc++.h>

using namespace std;



#define ll long long

#define ld long double

#define ull unsigned long long

#define vti vector<int>

#define vvti vector<vti>

#define vtl vector<ll>

#define vvtl vector<vtl>

#define vtc vector<char>

#define vvtc vector<vtc>

#define vts vector<string>

#define vvts vector<vts>

#define vtb vector<bool>

#define vvtb vector<vtb>

#define pii pair<int, int>

#define pll pair<ll, ll>

#define vpi vector<pii>

#define pic pair<int, char>

#define pci pair<char, int>

#define pcc pair<char, char>

#define pss pair<string, string>

#define pq priority_queue

#define pb push_back

#define gcd __gcd

#define nline "\n"

#define pi acos(-1)

#define elif else if

#define pf printf

#define sf scanf

#define fi first

#define si second

#define bpop(x) __builtin_popcount(x)

#define len(x) x.length()

#define asc(v) sort(all(v))

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

#define sall(v, a) accumulate(all(v), a)

#define rall(v) v.rbegin(), v.rend()

#define dsc(v) asc(v), reverse(all(v))

#define sum(v) accumulate(all(v), 0)

#define mem0(a) memset(a, 0, sizeof(a))

#define mem1(a) memset(a, -1, sizeof(a))

#define memc(a, c) memset(a, c, sizeof(a))

#define FOR(i, start, end, a) for (ll i = start; i < end; i += a)

#define FORN(i, start, end, a) for (ll i = start; i > end; i -= a)

#define remDup(c) c.erase(unique(all(c)), c.end());



int dx[] = {1, 0, -1, 0};

int dy[] = {0, 1, 0, -1};

int d8x[] = {0, 1, 0, -1, -1, 1, -1, 1};

int d8y[] = {1, 0, -1, 0, -1, -1, 1, 1};

const long long INF = LLONG_MAX >> 1;

const long long MOD = 1e9 + 7;

const long double e = 1e-9;



//------------------------------------------------------------------------------

ll power(ll a, ll b)

{

    ll result = 1;

    for (; b; a *= a, b /= 2)

        result *= (b % 2) ? a : 1;

    return result;

}

int factorial(int a) { return tgamma(a + 1); }

//------------------------------------------------------------------------------



void solve()

{

    int n;

    cin >> n;

    vti v(n);

    for (auto &i : v)

        cin >> i;

    FOR(i, 0, n - 2, 1)

    {

        if (v[i] > v[i + 1])

        {

            cout << "NO" << nline;

            return;

        }

        int mn = min(v[i], v[i + 1]);

        v[i] -= mn;

        v[i + 1] -= mn;

    }

    cout << "YES" << nline;

}



int main()

{

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout.precision(10);

    cout << fixed;

    int tt;

    cin >> tt;

    while (tt--)

    {

        solve();

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

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

using namespace std;

#define ll long long

#define int long long

const ll N=1e9+7;



void solve(){

    int n;

    cin>>n;

    string s;

    cin>>s;

    int cs=count(s.begin(),s.end(),'s');

    int cp=count(s.begin(),s.end(),'p');

    int cd=count(s.begin(),s.end(),'.');

    if(cs==0||cp==0) {cout<<"YES\n"; return;}

    int i=n-1;

    bool found=true;

    while(i>=0){ 

        if(s[i]=='.') i--;

        else if(s[i]=='s'){

            found=false;

            break;

        }

        else break;

    }

    if(!found) {cout<<"NO\n"; return;}

    i=0;

    while(i<n){ 

        if(s[i]=='.') i++;

        else if(s[i]=='p'){

            found=false;

            break;

        }

        else break;

    }

    if(!found) {cout<<"NO\n"; return;}

    if(s[0]=='.' && s[n-1]=='.') {cout<<"NO\n"; return;}

    cout<<"YES\n";

    return;

}



int32_t main() {

    ios::sync_with_stdio(0); 

    cin.tie(0);

    ll t;

    cin>>t;

    while(t--){

        solve();

    }

    return 0;

}

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

using namespace std;

#define ll long long

#define int long long

const ll N=1e9+7;



void solve(){

    int n;

    cin>>n;

    string s;

    cin>>s;

    int cs=count(s.begin(),s.end(),'s');

    int cp=count(s.begin(),s.end(),'p');

    int cd=count(s.begin(),s.end(),'.');

    if(cs==0||cp==0) {cout<<"YES\n"; return;}

    int i=n-1;

    bool found=true;

    while(i>=0){ 

        if(s[i]=='.') i--;

        else if(s[i]=='s'){

            found=false;

            break;

        }

        else break;

    }

    if(!found) {cout<<"NO\n"; return;}

    i=0;

    while(i<n){ 

        if(s[i]=='.') i++;

        else if(s[i]=='p'){

            found=false;

            break;

        }

        else break;

    }

    if(!found) {cout<<"NO\n"; return;}

    if(s[n-1]=='.') {cout<<"NO\n"; return;}

    cout<<"YES\n";

    return;

}



int32_t main() {

    ios::sync_with_stdio(0); 

    cin.tie(0);

    ll t;

    cin>>t;

    while(t--){

        solve();

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)


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

using namespace std;

#define ll long long

#define int long long

const ll N=1e9+7;



void solve(){

    int n;

    cin>>n;

    string s;

    cin>>s;

    int cs=count(s.begin(),s.end(),'s');

    int cp=count(s.begin(),s.end(),'p');

    int cd=count(s.begin(),s.end(),'.');

    if(cs==0||cp==0) {cout<<"YES\n"; return;}

    int i=n-1;

    bool found=true;

    while(i>=0){ 

        if(s[i]=='.') i--;

        else if(s[i]=='s'){

            found=false;

            break;

        }

        else break;

    }

    if(!found) {cout<<"NO\n"; return;}

    i=0;

    while(i<n){ 

        if(s[i]=='.') i++;

        else if(s[i]=='p'){

            found=false;

            break;

        }

        else break;

    }

    if(!found) {cout<<"NO\n"; return;}

    if(s[0]=='.' && s[n-1]=='.') {cout<<"NO\n"; return;}

    cout<<"YES\n";

    return;

}



int32_t main() {

    ios::sync_with_stdio(0); 

    cin.tie(0);

    ll t;

    cin>>t;

    while(t--){

        solve();

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

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

using namespace std;

#define ll long long

#define int long long

const ll N=1e9+7;



void solve(){

    int n;

    cin>>n;

    string s;

    cin>>s;

    int cs=count(s.begin(),s.end(),'s');

    int cp=count(s.begin(),s.end(),'p');

    int cd=count(s.begin(),s.end(),'.');

    if(cs==0||cp==0) {cout<<"YES\n"; return;}

    int i=n-1;

    bool found=true;

    while(i>=0){ 

        if(s[i]=='.') i--;

        else if(s[i]=='s'){

            found=false;

            break;

        }

        else break;

    }

    if(!found) {cout<<"NO\n"; return;}

    i=0;

    while(i<n){ 

        if(s[i]=='.') i++;

        else if(s[i]=='p'){

            found=false;

            break;

        }

        else break;

    }

    if(!found) {cout<<"NO\n"; return;}

    if(s[n-1]=='.') {cout<<"NO\n"; return;}

    cout<<"YES\n";

    return;

}



int32_t main() {

    ios::sync_with_stdio(0); 

    cin.tie(0);

    ll t;

    cin>>t;

    while(t--){

        solve();

    }

    return 0;

}

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

using namespace std;

#define ll long long

#define int long long

const ll N=1e9+7;



void solve(){

    int n;

    cin>>n;

    string s;

    cin>>s;

    if(s[0]=='s') s[0]='.';

    if(s[n-1]=='p') s[n-1]='.';

    int cs=count(s.begin(),s.end(),'s');

    int cp=count(s.begin(),s.end(),'p');

    int cd=count(s.begin(),s.end(),'.');

    if(cs==0||cp==0) {cout<<"YES\n"; return;}

    cout<<"NO\n";

    return;

}



int32_t main() {

    ios::sync_with_stdio(0); 

    cin.tie(0);

    ll t;

    cin>>t;

    while(t--){

        solve();

    }

    return 0;

}
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;

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#define ar array
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())
#define all(a) (a).begin(), (a).end()

const int MAX_N = 1e5 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ld EPS = 1e-9;

#define int long long

// #define SRIV

#ifdef SRIV
#include "debug.hpp"
#else
#define debug(...)  42
#endif

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

void solve() {
    int n; cin >> n;
    vector<int> a(n); 
    for (int &x : a) cin >> x;

    vector<int> b;
    int max_sum = accumulate(all(a), 0LL);
    while(a.size()>1){
        vector<int> temp;
        if(a[0]-a[n-1]>a[0]-a[n-1]){
            for(int i=0; i<a.size()-1; i++){
                temp.push_back(a[i+1]-a[i]);
            }
            a = temp;
            max_sum = max(max_sum, accumulate(all(a), 0LL));
        }else{
            reverse(a.begin(), a.end());
            for(int i=0; i<a.size()-1; i++){
                temp.push_back(a[i+1]-a[i]);
            }
            a = temp;
            max_sum = max(max_sum, accumulate(all(a), 0LL));
        }
    }
    cout << max_sum << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int tc = 1;
    cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t << ": ";
        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
signed main(){
	int t;cin>>t;
	while(t--){
		int n,l,r;cin>>n>>l>>r;
		int a[n+1];
		for(int i=1;i<=n;i++){
			cin>>a[i];
		}
		sort(a+1,a+1+n);
		vector<int> pre(n+1,0);
		for(int i=1;i<=n;i++) pre[i]=a[i]+pre[i-1];
		cout<<pre[r-l+1]<<endl;
	}
}

Submission (verdict: Compilation error):
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int t;cin>>t;
	while(t--){
		int n,l,r;cin>>n>>l>>r;
		int a[n+1],b[n+1];
		for(int i=1;i<=n;i++) cin>>a[i];
		for(int i=1;i<=r;i++) b[i]=a[i];
		sort(b+1,b+r+1);//从1排到r位置
		int ans=1e15,sum=0;
		for(int i=1;i<=r-l+1;i++) sum+=b[i];
		ans=sum;
		for(int i=l;i<=n;i++) b[i]=a[i];
		sort(b+l,b+n+1);/从l排到n位置
		sum=0;
		for(int i=l;i<=r;i++) sum+=b[i];
		ans=min(ans,sum);
		cout<<ans<<endl;
	}
}