ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);
#define all_op() cin.tie(0);cout.tie(0);
#define sp ' '
#define endl '\n'
#define MOD 1000000007
const long double pi=acos(-1);
typedef long long int ll;
typedef long double ld;
const long long int INF=1000000000000000000;

void init_code()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif
}


int main()
{
    optimize();
    //all_op();
    init_code();
    ll _=1;
    cin >> _;
    while(_--)
    {
        ll n,f=1,cnt=0; cin >> n;
        vector<ll>v(n);
        for(auto &u:v) cin >> u;

        for(int i=0;i<n;i+=2)
        {
            cnt=max((ll)0,v[i+1]-v[i]);
            if(v[i]>v[i+1])
            { 
                if(v[i]-cnt==0) continue;
                f=0; break; 
            }
        }

        cout << (f?"YES\n":"NO\n");

    }

    return 0;

}




Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);
#define all_op() cin.tie(0);cout.tie(0);
#define sp ' '
#define endl '\n'
#define MOD 1000000007
const long double pi=acos(-1);
typedef long long int ll;
typedef long double ld;
const long long int INF=1000000000000000000;

void init_code()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif
}


int main()
{
    optimize();
    //all_op();
    init_code();
    ll _=1;
    cin >> _;
    while(_--)
    {
        ll n,f=1,cnt=0; cin >> n;
        vector<ll>v(n);
        for(auto &u:v) cin >> u;

        for(int i=0;i<n;i+=2)
        {
            if(v[i]>v[i+1])
            { 
                if((v[i]-v[i+1])-cnt==0) continue;
                f=0; break; 
            }
            cnt=max((ll)0,v[i+1]-v[i]);
        }

        cout << (f?"YES\n":"NO\n");

    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);
#define all_op() cin.tie(0);cout.tie(0);
#define sp ' '
#define endl '\n'
#define MOD 1000000007
const long double pi=acos(-1);
typedef long long int ll;
typedef long double ld;
const long long int INF=1000000000000000000;

void init_code()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif
}


int main()
{
    optimize();
    //all_op();
    init_code();
    ll _=1;
    cin >> _;
    while(_--)
    {
        ll n,f=1,cnt=0; cin >> n;
        vector<ll>v(n);
        for(auto &u:v) cin >> u;

        for(int i=0;i<n-1;i+=2)
        {
            if(v[i]>v[i+1])
            { 
                if((v[i]-v[i+1])-cnt==0) continue;
                f=0; break; 
            }
            cnt=max((ll)0,v[i+1]-v[i]);
        }

        cout << (f?"YES\n":"NO\n");

    }

    return 0;

}




Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);
#define all_op() cin.tie(0);cout.tie(0);
#define sp ' '
#define endl '\n'
#define MOD 1000000007
const long double pi=acos(-1);
typedef long long int ll;
typedef long double ld;
const long long int INF=1000000000000000000;

void init_code()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif
}


int main()
{
    optimize();
    //all_op();
    init_code();
    ll _=1;
    cin >> _;
    while(_--)
    {
        ll n,f=1,cnt=0; cin >> n;
        vector<ll>v(n);
        for(auto &u:v) cin >> u;

        for(int i=0;i<n-1;i+=2)
        {
            if(v[i]>v[i+1])
            { 
                if((v[i]-v[i+1])-cnt<=0) continue;
                f=0; break; 
            }
            cnt=max((ll)0,v[i+1]-v[i]);
            cout << cnt << endl;
        }

        cout << (f?"YES\n":"NO\n");

    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);
#define all_op() cin.tie(0);cout.tie(0);
#define sp ' '
#define endl '\n'
#define MOD 1000000007
const long double pi=acos(-1);
typedef long long int ll;
typedef long double ld;
const long long int INF=1000000000000000000;

void init_code()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif
}


int main()
{
    optimize();
    //all_op();
    init_code();
    ll _=1;
    cin >> _;
    while(_--)
    {
        ll n,f=1,cnt=0; cin >> n;
        vector<ll>v(n);
        for(auto &u:v) cin >> u;

        for(int i=0;i<n-1;i+=2)
        {
            if(v[i]>v[i+1])
            { 
                if((v[i]-v[i+1])-cnt<=0) continue;
                f=0; break; 
            }
            cnt=max((ll)0,v[i+1]-v[i]);
            cout << cnt << endl;
        }

        cout << (f?"YES\n":"NO\n");

    }

    return 0;

}




Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);
#define all_op() cin.tie(0);cout.tie(0);
#define sp ' '
#define endl '\n'
#define MOD 1000000007
const long double pi=acos(-1);
typedef long long int ll;
typedef long double ld;
const long long int INF=1000000000000000000;

void init_code()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif
}


int main()
{
    optimize();
    //all_op();
    init_code();
    ll _=1;
    cin >> _;
    while(_--)
    {
        ll n,f=0,cnt=0; cin >> n;
        vector<ll>v(n);
        for(auto &u:v) cin >> u;

        for(int i=1;i<n;i++) 
            if(v[i]<v[i-1]) f=i;

        if(f==0) { cout << "YES\n"; continue; }

        for(int i=0;i<f;i++)
        {
            ll mn=min(v[i],v[i+1]);
            v[i]-=mn;
            v[i+1]-=mn;
        }
        for(int i=1;i<n;i++)
            if(v[i]<v[i-1])
                { f=-1; break; }

        cout << ((f>-1)?"YES\n":"NO\n");


    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);
#define all_op() cin.tie(0);cout.tie(0);
#define sp ' '
#define endl '\n'
#define MOD 1000000007
const long double pi=acos(-1);
typedef long long int ll;
typedef long double ld;
const long long int INF=1000000000000000000;

void init_code()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif
}


int main()
{
    optimize();
    //all_op();
    init_code();
    ll _=1;
    cin >> _;
    while(_--)
    {
        ll n,f=1,cnt=0; cin >> n;
        vector<ll>v(n);
        for(auto &u:v) cin >> u;

        for(int i=0;i<n;i+=2)
        {
            cnt=max((ll)0,v[i+1]-v[i]);
            if(v[i]>v[i+1])
            { 
                if(v[i]-cnt==0) continue;
                f=0; break; 
            }
        }

        cout << (f?"YES\n":"NO\n");

    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);
#define all_op() cin.tie(0);cout.tie(0);
#define sp ' '
#define endl '\n'
#define MOD 1000000007
const long double pi=acos(-1);
typedef long long int ll;
typedef long double ld;
const long long int INF=1000000000000000000;

void init_code()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif
}


int main()
{
    optimize();
    //all_op();
    init_code();
    ll _=1;
    cin >> _;
    while(_--)
    {
        ll n,f=1,cnt=0; cin >> n;
        vector<ll>v(n);
        for(auto &u:v) cin >> u;

        for(int i=0;i<n;i+=2)
        {
            if(v[i]>v[i+1])
            { 
                if((v[i]-v[i+1])-cnt==0) continue;
                f=0; break; 
            }
            cnt=max((ll)0,v[i+1]-v[i]);
        }

        cout << (f?"YES\n":"NO\n");

    }

    return 0;

}




Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);
#define all_op() cin.tie(0);cout.tie(0);
#define sp ' '
#define endl '\n'
#define MOD 1000000007
const long double pi=acos(-1);
typedef long long int ll;
typedef long double ld;
const long long int INF=1000000000000000000;

void init_code()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif
}


int main()
{
    optimize();
    //all_op();
    init_code();
    ll _=1;
    cin >> _;
    while(_--)
    {
        ll n,f=1,cnt=0; cin >> n;
        vector<ll>v(n);
        for(auto &u:v) cin >> u;

        for(int i=0;i<n-1;i+=2)
        {
            if(v[i]>v[i+1])
            { 
                if((v[i]-v[i+1])-cnt==0) continue;
                f=0; break; 
            }
            cnt=max((ll)0,v[i+1]-v[i]);
        }

        cout << (f?"YES\n":"NO\n");

    }

    return 0;

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


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int>arr(n);
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        int flag = 1;
        for(int i=1;i<n-1;i++)
        {
            if(!(arr[i]>=arr[i-1]) && !(arr[i]<=arr[i+1]) )
            {
                flag = 0;
                break;
            }
        }
        if(flag) cout<<"YES"<<"\n";
        else cout<<"NO"<<"\n";
    }
    return  0;
}
Problem: 2060D - Subtract Min Sort
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 int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int>arr(n);
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        int flag = 1;
        for(int i=1;i<n-1;i++)
        {
            if(!(arr[i]>=arr[i-1]) && !(arr[i]<=arr[i+1]) )
            {
                flag = 0;
                break;
            }
        }
        if(flag) cout<<"YES"<<"\n";
        else cout<<"NO"<<"\n";
    }
    return  0;
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int>arr(n);
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        int flag = 1;
        for(int i=1;i<n-1;i++)
        {
            if((arr[i] <= arr[i-1]) && (arr[i] >= arr[i+1]) || (arr[i] <= arr[i-1] && arr[i] <= arr[i+1]))
            {
                flag = 0;
                break;
            }
            else
            {
                int sub = min(arr[i-1], arr[i]);
                int temp = arr[i-1];
                arr[i-1] -= temp;
                arr[i] -= temp;
            }
        }
        if(flag) cout<<"YES"<<"\n";
        else cout<<"NO"<<"\n";
    }
    return  0;
}
Problem: 2060D - Subtract Min Sort
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 int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int>arr(n);
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        int flag = 1;
        for(int i=1;i<n-1;i++)
        {
            if((arr[i] <= arr[i-1]) && (arr[i] >= arr[i+1]) || (arr[i] <= arr[i-1] && arr[i] <= arr[i+1]))
            {
                flag = 0;
                break;
            }
            else
            {
                int sub = min(arr[i-1], arr[i]);
                int temp = arr[i-1];
                arr[i-1] -= temp;
                arr[i] -= temp;
            }
        }
        if(flag) cout<<"YES"<<"\n";
        else cout<<"NO"<<"\n";
    }
    return  0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int>arr(n);
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        int flag = 1;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i] > arr[i+1])
            {
                flag = 0;
                break;
            }
            else
            {
                int sub = min(arr[i], arr[i+1]);
                int temp = arr[i];
                arr[i] -= temp;
                arr[i+1] -= temp;
            }
        }
        if(flag) cout<<"YES"<<"\n";
        else cout<<"NO"<<"\n";
    }
    return  0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


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

#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)((x).size()))
#define INF 1e9

#define ALL(c) (c).begin(),(c).end()
#define REMAX(a,b) (a)=max((a),(b))
#define REMIN(a,b) (a)=min((a),(b))

#define F(i,L,R) for (int i = L; i < R; i++) 
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)

typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int, int> pii;

typedef vector<int> vi;
typedef vector<long long> vll;

typedef vector<pii> vpii;
typedef vector<pll> vpll;

typedef vector<vi> vvi; 
typedef vector<vll> vvll; 

typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;

typedef vector<vpll> vvpll;

#define mod1 998244353
#define mod2 ((int)1e9+7)
int mod = mod2;

double pi = 2*acos(0);

void solve(){
    int n;
    cin >> n;
    vi nums(n);
    for(int i = 0; i < n; i++){
        cin >> nums[i];
    }
    
    vb visited(n+1, 0);
    
    vector<pair<int, int>> ans;
    for(int i = n-1; i >= 0; i--){
        int j = nums[i];
        visited[j] = 1;
        for(int k = j-1; k >= 1; k--){
            if(visited[k]) continue;
            ans.push_back({k, j});
        }
        
        for(int k = 1; k <= i+1; k++){
            if(visited[k]) continue;
            ans.push_back({j, k});
        }
    }
    cout << ans.size() << endl;
    for(auto& k : ans){
        cout << k.first << ' ' << k.second << endl;
    }
}

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

    
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Time limit exceeded on test 3):
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

long long number(string s){
	long long res =0;
	for(int i =s.size()-1;i>=0;i--){
        int rr = s[i]-'0';
		res += rr*pow(10, s.size()-1-i);
	}
	return res;
}

int main(){
	int t; cin>>t;
	for(int i=0;i<t;i++){
	 string x; cin>>x;
	 bool agg= false;
	 vector<string> stack;
	 stack.push_back(x);
	 while(!stack.empty()){
	 	string s = stack.back();
	 	stack.pop_back();
	 	
	 	if(number(s) % 9 == 0){
	 		agg=true;
	 		break;
	 	}
	 	
	 	for(int i = 0; i<s.size();i++){
	 		if(s[i] == '2'){
	 			string ss = s;
	 			ss[i] ='4';
	 			stack.push_back(ss);
	 	    }
	 	    if(s[i] == '3'){
	 			string ss = s;
	 			ss[i] ='9';
	 			stack.push_back(ss);
	 	    }
	 	}
	 }
	 if(agg) cout<<"YES";
	 else cout << "NO";
	 
	 cout << endl;
	}
}

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

using namespace std;
typedef long long ll;
#define forn(i, n) for(int i = 0; i < int(n); i++)
typedef pair<ll, ll> pll;
const ll INF = numeric_limits<ll>::max();
const ll limit = pow(10, 12);

template <typename ele_type>
ostream& operator<<(ostream& os, const vector<ele_type>& vect_name) {
    for (auto itr : vect_name) {
        os << itr << " ";
    }
    return os;
}

bool divisors(int x){
    int res = 0;
    for(int i = 1; i <= sqrt(x); i++){
        if(x % i == 0) res++;
    }

    return res == 1;
}


int main() {
    int t; cin >> t;
    forn(_, t){
        string x; cin >> x;
        ll suma = 0;
        int dos = 0;
        int tres = 0;
        for(int i = 0; i < x.size(); i++){
            suma += x[i] - '0';
            if(x[i] == '2') dos++;
            if(x[i] == '3') tres++;
        }

        bool agg = false;
        forn(x, min(8, dos)+1){
            forn(y, min(8, tres)+1){
                if((suma + 2*x + 6*y) % 9 == 0) agg = true;
            }
        }
        if(agg) cout << "YES";
        else cout << "NO";
        cout << endl;
    }
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 1):
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
// JIJI
int main(){
	int t; cin>>t;
	for(int i=0;i<t;i++){
	 string x; cin>>x;
	 bool agg= false;
	 vector<string> stack;
	 stack.push_back(x);
	 while(!stack.empty()){
	 	string s = stack.back();
	 	stack.pop_back();
	 	
	 	if(stol(s) % 9 == 0){
	 		agg=true;
	 		break;
	 	}
	 	
	 	for(int i = 0; i<s.size();i++){
	 		if(s[i] == '2'){
	 			string ss = s;
	 			ss[i] ='4';
	 			stack.push_back(ss);
	 	    }
	 	    if(s[i] == '3'){
	 			string ss = s;
	 			ss[i] ='9';
	 			stack.push_back(ss);
	 	    }
	 	}
	 }
	 if(agg) cout<<"YES";
	 else cout << "NO";
	 
	 cout << endl;
	}
}

Submission (verdict: Time limit exceeded on test 3):
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

long long number(string s){
	long long res =0;
	for(int i =s.size()-1;i>=0;i--){
        int rr = s[i]-'0';
		res += rr*pow(10, s.size()-1-i);
	}
	return res;
}

int main(){
	int t; cin>>t;
	for(int i=0;i<t;i++){
	 string x; cin>>x;
	 bool agg= false;
	 vector<string> stack;
	 stack.push_back(x);
	 while(!stack.empty()){
	 	string s = stack.back();
	 	stack.pop_back();
	 	
	 	if(number(s) % 9 == 0){
	 		agg=true;
	 		break;
	 	}
	 	
	 	for(int i = 0; i<s.size();i++){
	 		if(s[i] == '2'){
	 			string ss = s;
	 			ss[i] ='4';
	 			stack.push_back(ss);
	 	    }
	 	    if(s[i] == '3'){
	 			string ss = s;
	 			ss[i] ='9';
	 			stack.push_back(ss);
	 	    }
	 	}
	 }
	 if(agg) cout<<"YES";
	 else cout << "NO";
	 
	 cout << endl;
	}
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


Submission (verdict: Runtime error on test 1):
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
	int t; cin>>t;
	for(int i=0;i<t;i++){
	 string x; cin>>x;
	 bool agg= false;
	 vector<string> stack;
	 stack.push_back(x);
	 while(!stack.empty()){
	 	string s = stack.back();
	 	stack.pop_back();
	 	
	 	if(stol(s) % 9 == 0){
	 		agg=true;
	 		break;
	 	}
	 	
	 	for(int i = 0; i<s.size();i++){
	 		if(s[i] == '2'){
	 			string ss = s;
	 			ss[i] ='4';
	 			stack.push_back(ss);
	 	    }
	 	    if(s[i] == '3'){
	 			string ss = s;
	 			ss[i] ='9';
	 			stack.push_back(ss);
	 	    }
	 	}
	 }
	 if(agg) cout<<"YES";
	 else cout << "NO";
	 
	 cout << endl;
	}
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 1):
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
	int t; cin>>t;
	for(int i=0;i<t;i++){
	 string x; cin>>x;
	 bool agg= false;
	 vector<string> stack;
	 stack.push_back(x);
	 while(!stack.empty()){
	 	string s = stack.back();
	 	stack.pop_back();
	 	
	 	if(stol(s) % 9 == 0){
	 		agg=true;
	 		break;
	 	}
	 	
	 	for(int i = 0; i<s.size();i++){
	 		if(s[i] == '2'){
	 			string ss = s;
	 			ss[i] ='4';
	 			stack.push_back(ss);
	 	    }
	 	    if(s[i] == '3'){
	 			string ss = s;
	 			ss[i] ='9';
	 			stack.push_back(ss);
	 	    }
	 	}
	 }
	 if(agg) cout<<"YES";
	 else cout << "NO";
	 
	 cout << endl;
	}
}

Submission (verdict: Runtime error on test 1):
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
// JIJI
int main(){
	int t; cin>>t;
	for(int i=0;i<t;i++){
	 string x; cin>>x;
	 bool agg= false;
	 vector<string> stack;
	 stack.push_back(x);
	 while(!stack.empty()){
	 	string s = stack.back();
	 	stack.pop_back();
	 	
	 	if(stol(s) % 9 == 0){
	 		agg=true;
	 		break;
	 	}
	 	
	 	for(int i = 0; i<s.size();i++){
	 		if(s[i] == '2'){
	 			string ss = s;
	 			ss[i] ='4';
	 			stack.push_back(ss);
	 	    }
	 	    if(s[i] == '3'){
	 			string ss = s;
	 			ss[i] ='9';
	 			stack.push_back(ss);
	 	    }
	 	}
	 }
	 if(agg) cout<<"YES";
	 else cout << "NO";
	 
	 cout << endl;
	}
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

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

void solve(){
    int n;
    cin >> n;
    vector<int> c(n);
    for (int i = 0; i < n ; i++) {
        cin >> c[i];
    }
    vector<int> trans(n + 1);
    for (int i = 0; i < n; i++) {
        trans[c[i]] = i + 1;
    }

    stack<pair<int,int>> perms;
    for (int p = 1; p < n; p++) {
        for (int i = trans[p]; i < n; i++) {
            perms.push(make_pair(p, c[i]));
        }
        for (int i = n - 1; i >= trans[p]; i--) {
            perms.push(make_pair(c[i], p));
        }
        for (int i = trans[p] - 1; i >= p; i--) {
            perms.push(make_pair(c[i - 1], c[i]));
            swap(c[i-1], c[i]);
        }
    }

    printf("%ld\n", perms.size());
    while(!perms.empty()) {
        auto p = perms.top();
        perms.pop();
        printf("%d %d\n", p.first, p.second);
    }
}

int main (){
    cin.tie(NULL);
    solve();
    return 0;
}

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

void solve(){
    int n;
    cin >> n;
    vector<int> c(n);
    for (int i = 0; i < n ; i++) {
        cin >> c[i];
    }
    vector<int> trans(n + 1);
    for (int i = 0; i < n; i++) {
        trans[c[i]] = i + 1;
    }

    stack<pair<int,int>> perms;
    for (int p = 1; p < n; p++) {
        for (int i = trans[p]; i < n; i++) {
            perms.push(make_pair(p, c[i]));
        }
        for (int i = n - 1; i >= trans[p]; i--) {
            perms.push(make_pair(c[i], p));
        }
        for (int i = trans[p] - 1; i >= p; i--) {
            perms.push(make_pair(c[i - 1], c[i]));
            swap(trans[c[i - 1]], trans[c[i]]);
            swap(c[i-1], c[i]);
        }
    }

    printf("%ld\n", perms.size());
    while(!perms.empty()) {
        auto p = perms.top();
        perms.pop();
        printf("%d %d\n", p.first, p.second);
    }
}

int main (){
    cin.tie(NULL);
    solve();
    return 0;
}