ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i128 = __int128;

int n,m;
void solve(){
    cin>>n>>m;
    vector<int> a(n),b(m);
    multiset<int> se1,se2;
    for(auto &i:a) cin>>i,se1.insert(i);
    for(auto &i:b) cin>>i,se2.insert(i);
        //int now = 0;
    while(!se2.empty()&&se2.size()<se1.size()){
        //cout<<now<<"\n";
        multiset<int> tmp;
        for(auto i:se2){
            if(se1.find(i)==se1.end()){
                if(i/2<=0) continue;
                tmp.insert(i/2);
                tmp.insert((i+1)/2);
            }else se1.erase(se1.find(i));
        }
        se2.swap(tmp);
    }
    if(se1.size()==se2.size()){
        for(auto i:se2){
            if(se1.find(i)==se1.end()){
                cout<<"No\n";
                return;
            }
        }
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
}

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




Submission (verdict: Compilation error):
// #include<bits/stdc++.h>
// using namespace std;
// using i64 = long long;
// using i128 = __int128;

// int n,m;
// void solve(){
//     cin>>n>>m;
//     vector<int> a(n),b(m);
//     multiset<int> se1,se2;
//     for(auto &i:a) cin>>i,se1.insert(i);
//     for(auto &i:b) cin>>i,se2.insert(i);
//     for(int i )
// }

// signed main(){
//     ios::sync_with_stdio(0);cin.tie(0);
//     int t;
//     cin>>t;
//     while(t--) solve();
//     return 0;
// }
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i128 = __int128;

int n,m;
void solve(){
    cin>>n>>m;
    vector<int> a(n),b(m);
    multiset<int> se1,se2;
    i64 sa=0,sb=0
    for(auto &i:a) cin>>i,se1.insert(i),sa+=i;
    for(auto &i:b) cin>>i,se2.insert(i),sb+=i;
        //int now = 0;
    while(!se2.empty()&&se2.size()<se1.size()){
        //cout<<now<<"\n";
        multiset<int> tmp;
        for(auto i:se2){
            if(se1.find(i)==se1.end()){
                if(i/2<=0) continue;
                tmp.insert(i/2);
                tmp.insert((i+1)/2);
            }else se1.erase(se1.find(i));
        }
        se2.swap(tmp);
    }
    if(se1.size()==se2.size()){
        for(auto i:se2){
            if(se1.find(i)==se1.end()){
                cout<<"No\n";
                return;
            }
        }
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
}

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<iostream>
#include <map>
#include<set>
#include <vector>
#define mod 998244353
#include <algorithm>
#include <limits>
using namespace std;


int main() {
   int n;
   cin>>n;
   vector<int> v(n);
   for(int i=0;i<n;i++) {
      cin>>v[i];
   }
  vector<int> v2(n);
    for(int i =0;i<n;i++) {
        v2[i] =i+1;
    }
    vector<pair<int,int>> ans(n*n);
    int ans2=0;
    for(int i =0;i<n;i++) {
        for(int j =0;j<n-i-1;j++) {
            ans[ans2] = {v2[j],v2[j+1]};
            ans2++;
            int temp = v2[j+1];
            v2[j+1] = v2[j];
            v2[j] = temp;
        }
    }
    for(int i =0;i<n;i++) {
        int element = v[i];
        for(int j =n-element;j>i;j--) {
            ans[ans2] = {v2[j],v2[j-1]};
            ans2++;
            int temp = v2[j-1];
            v2[j-1] = v2[j];
            v2[j] = temp;
        }
    }
    cout<<ans2<<endl;
    for(auto i:ans) {
        if(i.first ==i.second&& i.second==0) {
            break;
        }else {
            cout<<i.first<<" "<<i.second<<endl;
        }
    }
}


Submission (verdict: Wrong answer on test 1):
#include<iostream>
#include <map>
#include<set>
#include <vector>
#define mod 998244353
#include <algorithm>
#include <limits>
using namespace std;


int main() {
   int n;
   cin>>n;
   vector<int> v(n);
   for(int i=0;i<n;i++) {
      cin>>v[i];
   }
  vector<int> v2(n);
    for(int i =0;i<n;i++) {
        v2[i] =i+1;
    }
    vector<pair<int,int>> ans(n*n);
    int ans2=0;
    for(int i =0;i<n;i++) {
        for(int j =0;j<n-i-1;j++) {
            ans[ans2] = {v2[j+1],v2[j]};
            ans2++;
            int temp = v2[j+1];
            v2[j+1] = v2[j];
            v2[j] = temp;
        }
    }
    for(int i =0;i<n;i++) {
        int element = v[i];
        for(int j =n-element;j>i;j--) {
            ans[ans2] = {v2[j-1],v2[j]};
            ans2++;
            int temp = v2[j-1];
            v2[j-1] = v2[j];
            v2[j] = temp;
        }
    }
    cout<<ans2<<endl;
    for(auto i:ans) {
        if(i.first ==i.second&& i.second==0) {
            break;
        }else {
            cout<<i.first<<" "<<i.second<<endl;
        }
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include<iostream>
#include <map>
#include<set>
#include <vector>
#define mod 998244353
#include <algorithm>
#include <limits>
using namespace std;


int main() {
   int n;
   cin>>n;
   vector<int> v(n);
   for(int i=0;i<n;i++) {
      cin>>v[i];
   }
  vector<int> v2(n);
    for(int i =0;i<n;i++) {
        v2[i] =i+1;
    }
    vector<pair<int,int>> ans(n*n);
    int ans2=0;
    for(int i =0;i<n;i++) {
        for(int j =0;j<n-i-1;j++) {
            ans[ans2] = {v2[j],v2[j+1]};
            ans2++;
            int temp = v2[j+1];
            v2[j+1] = v2[j];
            v2[j] = temp;
        }
    }
    for(int i =0;i<n;i++) {
        int element = v[i];
        for(int j =n-element;j>i;j--) {
            ans[ans2] = {v2[j],v2[j-1]};
            ans2++;
            int temp = v2[j-1];
            v2[j-1] = v2[j];
            v2[j] = temp;
        }
    }
    cout<<ans2<<endl;
    for(auto i:ans) {
        if(i.first ==i.second&& i.second==0) {
            break;
        }else {
            cout<<i.first<<" "<<i.second<<endl;
        }
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<iostream>
#include <map>
#include<set>
#include <vector>
#define mod 998244353
#include <algorithm>
#include <limits>
using namespace std;


int main() {
   int n;
   cin>>n;
   vector<int> v(n);
   for(int i=0;i<n;i++) {
      cin>>v[i];
   }
  vector<int> v2(n);
    for(int i =0;i<n;i++) {
        v2[i] =i+1;
    }
    vector<pair<int,int>> ans(n*n);
    int ans2=0;
    for(int i =0;i<n;i++) {
        for(int j =0;j<n-i-1;j++) {
            ans[ans2] = {v2[j+1],v2[j]};
            ans2++;
            int temp = v2[j+1];
            v2[j+1] = v2[j];
            v2[j] = temp;
        }
    }
    for(int i =0;i<n;i++) {
        int element = v[i];
        for(int j =n-element;j>i;j--) {
            ans[ans2] = {v2[j-1],v2[j]};
            ans2++;
            int temp = v2[j-1];
            v2[j-1] = v2[j];
            v2[j] = temp;
        }
    }
    cout<<ans2<<endl;
    for(auto i:ans) {
        if(i.first ==i.second&& i.second==0) {
            break;
        }else {
            cout<<i.first<<" "<<i.second<<endl;
        }
    }
}


Submission (verdict: Wrong answer on test 4):
#include<iostream>
#include <map>
#include<set>
#include <vector>
#define mod 998244353
#include <algorithm>
#include <limits>
using namespace std;


int main() {
   int n;
   cin>>n;
   vector<int> v(n);
   for(int i=0;i<n;i++) {
      cin>>v[i];
   }
  vector<int> v2(n);
    for(int i =0;i<n;i++) {
        v2[i] =i+1;
    }
    vector<pair<int,int>> ans(n*n);
    int ans2=0;
    for(int i =0;i<n;i++) {
        for(int j =0;j<n-i-1;j++) {
            ans[ans2] = {v2[j+1],v2[j]};
            ans2++;
            int temp = v2[j+1];
            v2[j+1] = v2[j];
            v2[j] = temp;
        }
    }
    for(int i =0;i<n;i++) {
        int element = v[i];
        for(int j =n-element;j>i;j--) {
            ans[ans2] = {v2[j],v2[j-1]};
            ans2++;
            int temp = v2[j-1];
            v2[j-1] = v2[j];
            v2[j] = temp;
        }
    }
    cout<<ans2<<endl;
    for(auto i:ans) {
        if(i.first ==i.second&& i.second==0) {
            break;
        }else {
            cout<<i.first<<" "<<i.second<<endl;
        }
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 4):
#include<iostream>
#include <map>
#include<set>
#include <vector>
#define mod 998244353
#include <algorithm>
#include <limits>
using namespace std;


int main() {
   int n;
   cin>>n;
   vector<int> v(n);
   for(int i=0;i<n;i++) {
      cin>>v[i];
   }
  vector<int> v2(n);
    for(int i =0;i<n;i++) {
        v2[i] =i+1;
    }
    vector<pair<int,int>> ans(n*n);
    int ans2=0;
    for(int i =0;i<n;i++) {
        for(int j =0;j<n-i-1;j++) {
            ans[ans2] = {v2[j+1],v2[j]};
            ans2++;
            int temp = v2[j+1];
            v2[j+1] = v2[j];
            v2[j] = temp;
        }
    }
    for(int i =0;i<n;i++) {
        int element = v[i];
        for(int j =n-element;j>i;j--) {
            ans[ans2] = {v2[j],v2[j-1]};
            ans2++;
            int temp = v2[j-1];
            v2[j-1] = v2[j];
            v2[j] = temp;
        }
    }
    cout<<ans2<<endl;
    for(auto i:ans) {
        if(i.first ==i.second&& i.second==0) {
            break;
        }else {
            cout<<i.first<<" "<<i.second<<endl;
        }
    }
}


Submission (verdict: Accepted):
#include<iostream>
#include <map>
#include<set>
#include <vector>
#define mod 998244353
#include <algorithm>
#include <limits>
using namespace std;


int main() {
   int n;
   cin>>n;
   vector<int> v(n);
   for(int i=0;i<n;i++) {
      cin>>v[i];
   }
  vector<int> v2(n);
    for(int i =0;i<n;i++) {
        v2[i] =i+1;
    }
    vector<pair<int,int>> ans(n*n);
    int ans2=0;
    for(int i =0;i<n;i++) {
        for(int j =0;j<n-i-1;j++) {
            ans[ans2] = {v2[j+1],v2[j]};
            ans2++;
            int temp = v2[j+1];
            v2[j+1] = v2[j];
            v2[j] = temp;
        }
    }
    for(int i =0;i<n;i++) {
        int element = v[i];
        int k=0;
        for(int j =i;j<n;j++) {
            if(v2[j] == element) {
                k = j;
            }
        }
        for(int j =k;j>i;j--) {
            ans[ans2] = {v2[j],v2[j-1]};
            ans2++;
            int temp = v2[j-1];
            v2[j-1] = v2[j];
            v2[j] = temp;
        }
    }
    cout<<ans2<<endl;
    for(auto i:ans) {
        if(i.first ==i.second&& i.second==0) {
            break;
        }else {
            cout<<i.first<<" "<<i.second<<endl;
        }
    }
}
Problem: 2049B - pspspsps
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
/*************************************************************************************************************

										⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠛⠋⠉⠈⠉⠉⠉⠉⠛⠻⢿⣿⣿⣿⣿⣿⣿⣿

										⣿⣿⣿⣿⣿⡿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣿⣿

										⣿⣿⣿⣿⡏⣀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿

										⣿⣿⣿⢏⣴⣿⣷⠀⠀⠀⠀⠀⢾⣿⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿

										⣿⣿⣟⣾⣿⡟⠁⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣷⢢⠀⠀⠀⠀⠀⠀⠀⢸⣿

										⣿⣿⣿⣿⣟⠀⡴⠄⠀⠀⠀⠀⠀⠀⠙⠻⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⣿

										⣿⣿⣿⠟⠻⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠶⢴⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⣿

										⣿⣁⡀⠀⠀⢰⢠⣦⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⡄⠀⣴⣶⣿⡄⣿

										⣿⡋⠀⠀⠀⠎⢸⣿⡆⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⠗⢘⣿⣟⠛⠿⣼

										⣿⣿⠋⢀⡌⢰⣿⡿⢿⡀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⡇⠀⢸⣿⣿⣧⢀⣼

										⣿⣿⣷⢻⠄⠘⠛⠋⠛⠃⠀⠀⠀⠀⠀⢿⣧⠈⠉⠙⠛⠋⠀⠀⠀⣿⣿⣿⣿⣿

										⣿⣿⣧⠀⠈⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠟⠀⠀⠀⠀⢀⢃⠀⠀⢸⣿⣿⣿⣿

										⣿⣿⡿⠀⠴⢗⣠⣤⣴⡶⠶⠖⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡸⠀⣿⣿⣿⣿

										⣿⣿⣿⡀⢠⣾⣿⠏⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠉⠀⣿⣿⣿⣿

										⣿⣿⣿⣧⠈⢹⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿

										⣿⣿⣿⣿⡄⠈⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿

										⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿

										⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿

										⣿⣿⣿⣿⣿⣦⣄⣀⣀⣀⣀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿

										⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿

										⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠙⣿⣿⡟⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿

										⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠁⠀⠀⠹⣿⠃⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿

										⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⢐⣿⣿⣿⣿⣿⣿⣿⣿⣿

										⣿⣿⣿⣿⠿⠛⠉⠉⠁⠀⢻⣿⡇⠀⠀⠀⠀⠀⠀⢀⠈⣿⣿⡿⠉⠛⠛⠛⠉⠉

										⣿⡿⠋⠁⠀⠀⢀⣀⣠⡴⣸⣿⣇⡄⠀⠀⠀⠀⢀⡿⠄⠙⠛⠀⣀⣠⣤⣤⠄

*************************************************************************************************************/

#include <set>

#include <map>

#include <queue>

#include <cmath>

#include <tuple>

#include <random>

#include <vector>

#include <bitset>

#include <chrono>

#include <iomanip>

#include <cassert>

#include <complex>

#include <fstream>

#include <sstream>

#include <iostream>

#include <algorithm>

#include <unordered_set>

#include <unordered_map>

using namespace std;

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

#define test int test_num;cin>>test_num;while(test_num--)

#define prec(k) cout<<fixed<<setprecision(k);

#define cl(n,k) (((n)+(k)-1)/(k))

#define f first

#define s second

using ll = long long;

using ld = long double;

using pii = pair<int,int>;

using pll = pair<ll,ll>;

using point = complex<double>;

ll gcd(ll a, ll b){return (b==0?a:gcd(b,a%b));}

ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

const int M = 1e9 + 7;

const int O = 998244353;

const ld EPS = 1e-10;

const ld PI = 3.14159265358979323846;

const ll INF = (ll)1e18 + 5;



const int N = 2e5 + 5;



int n;

string s;



int main(){

	UwU



	test{

		cin >> n >> s;



		if(!count(s.begin(),s.end(),'p') || !count(s.begin(),s.end(),'s')){

			cout << "YES\n";

		}

		else if(count(s.begin(),s.end(),'p') >= 2 && count(s.begin(),s.end(),'s') >= 2){

			cout << "NO\n";

		}

		else{

			if(count(s.begin(),s.end(),'s') >= 2){

				reverse(s.begin(),s.end());

				for(auto& c : s){

					if(c == 'p' || c == 's'){

						c = c ^ 'p' ^ 's';

					}

				}

			}

			if(s[0] != 's'){

				cout << "NO\n";

			}

			else{

				cout << "YES\n";

			}

		}

	}



	return 0;

}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

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

void solve(){
   string s;
   cin>>s;
   vector<int>digits(s.length());
   //convert string to integer array
   for(int i=0;i<s.length();i++){
    digits[i]=s[i]-'0';
   }
   for(int i=1;i<digits.size();i++){
    int copy_i = i;
    while(copy_i>=1 && digits[copy_i]>0 && (digits[copy_i]>digits[copy_i-1]+1)){
        int temp=digits[copy_i];
        (digits[copy_i])=digits[copy_i-1];
        digits[copy_i-1]=temp-1;//***why we use this temp-1 while swqpping instead of using temp */
        if(copy_i>1){
            copy_i--;
        }else{
            break;
        }
    }
   }
   for(int d=0;d<digits.size();d++){
    cout<<digits[d];
   }
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

void solve(){
   string s;
   cin>>s;
   vector<int>digits(s.length());
   //convert string to integer array
   for(int i=0;i<s.length();i++){
    digits[i]=s[i]-'0';
   }
   for(int i=1;i<digits.size();i++){
    int copy_i = i;
    while(copy_i>=1 && digits[copy_i]>0 && (digits[copy_i]>digits[copy_i-1]+1)){
        int temp=digits[copy_i];
        (digits[copy_i])=digits[copy_i-1];
        digits[copy_i-1]=temp-1;//***why we use this temp-1 while swqpping instead of using temp */
        if(copy_i>1){
            copy_i--;
        }else{
            break;
        }
    }
    string res="";
    for(int d=0;d<digits.size();d++){
        res+=to_string(d);
        cout<<res<<endl;
       }
   }
  
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Compilation error):
#include<bits/stdc++.h>
using namespace std;
#define int long long int

void solve(){
   string s;
   cin>>s;
   vector<int>digits(s.length());
   //convert string to integer array
   for(int i=0;i<s.length;i++){
    digits[i]=s[i]-'0';
   }
   for(int i=0;i<digits.size();i++){
    int copy_i = i;
    while(copy_i>=0 && digits[copy_i]>0 && (digits[copy_i]>digits[copy_i-1])){
        int temp=digits[copy_i];
        digits[copy_i]=digits[copy_i-1];
        digits[copy_i-1]=temp-1;//***why we use this temp-1 while swqpping instead of using temp */
        if(copy_i>1){
            copy_i--;
        }else{
            break;
        }
    }
   }
   for(int d:digits){
    cout<<digits[d];
   }
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

void solve(){
   string s;
   cin>>s;
   vector<int>digits(s.length());
   //convert string to integer array
   for(int i=0;i<s.length();i++){
    digits[i]=s[i]-'0';
   }
   for(int i=0;i<digits.size();i++){
    int copy_i = i;
    while(copy_i>=0 && digits[copy_i]>0 && (digits[copy_i]>digits[copy_i-1])){
        int temp=digits[copy_i];
        digits[copy_i]=digits[copy_i-1];
        digits[copy_i-1]=temp-1;//***why we use this temp-1 while swqpping instead of using temp */
        if(copy_i>1){
            copy_i--;
        }else{
            break;
        }
    }
   }
   for(int d:digits){
    cout<<digits[d];
   }
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)


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

void solve(){
   string s;
   cin>>s;
   vector<int>digits(s.length());
   //convert string to integer array
   for(int i=0;i<s.length;i++){
    digits[i]=s[i]-'0';
   }
   for(int i=0;i<digits.size();i++){
    int copy_i = i;
    while(copy_i>=0 && digits[copy_i]>0 && (digits[copy_i]>digits[copy_i-1])){
        int temp=digits[copy_i];
        digits[copy_i]=digits[copy_i-1];
        digits[copy_i-1]=temp-1;//***why we use this temp-1 while swqpping instead of using temp */
        if(copy_i>1){
            copy_i--;
        }else{
            break;
        }
    }
   }
   for(int d:digits){
    cout<<digits[d];
   }
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

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

void solve(){
   string s;
   cin>>s;
   vector<int>digits(s.length());
   //convert string to integer array
   for(int i=0;i<s.length();i++){
    digits[i]=s[i]-'0';
   }
   for(int i=0;i<digits.size();i++){
    int copy_i = i;
    while(copy_i>=0 && digits[copy_i]>0 && (digits[copy_i]>digits[copy_i-1])){
        int temp=digits[copy_i];
        digits[copy_i]=digits[copy_i-1];
        digits[copy_i-1]=temp-1;//***why we use this temp-1 while swqpping instead of using temp */
        if(copy_i>1){
            copy_i--;
        }else{
            break;
        }
    }
   }
   for(int d:digits){
    cout<<digits[d];
   }
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

void solve(){
   string s;
   cin>>s;
   vector<int>digits(s.length());
   //convert string to integer array
   for(int i=0;i<s.length();i++){
    digits[i]=s[i]-'0';
   }
   for(int i=1;i<digits.size();i++){
    int copy_i = i;
    while(copy_i>=1 && digits[copy_i]>0 && (digits[copy_i]>digits[copy_i-1]+1)){
        int temp=digits[copy_i];
        (digits[copy_i])=digits[copy_i-1];
        digits[copy_i-1]=temp-1;//***why we use this temp-1 while swqpping instead of using temp */
        if(copy_i>1){
            copy_i--;
        }else{
            break;
        }
    }
   }
   for(int d=0;d<digits.size();d++){
    cout<<digits[d];
   }
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

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

void solve(){
   string s;
   cin>>s;
   vector<int>digits(s.length());
   //convert string to integer array
   for(int i=0;i<s.length();i++){
    digits[i]=s[i]-'0';
   }
   for(int i=1;i<digits.size();i++){
    int copy_i = i;
    while(copy_i>=1 && digits[copy_i]>0 && (digits[copy_i]>digits[copy_i-1]+1)){
        int temp=digits[copy_i];
        (digits[copy_i])=digits[copy_i-1];
        digits[copy_i-1]=temp-1;//***why we use this temp-1 while swqpping instead of using temp */
        if(copy_i>1){
            copy_i--;
        }else{
            break;
        }
    }
    string res="";
    for(int d=0;d<digits.size();d++){
        res+=to_string(d);
        cout<<res<<endl;
       }
   }
  
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

using namespace std;

void solve() {
    string s; cin >> s;
    for (int i = 0; i < s.size(); i++) {
        int best = s[i] - '0', pos = i;
        for (int j = i; j < min(i + 10, (int) s.size()); j++) {
            if (s[j] - '0' - (j - i) > best) {
                best = s[j] - '0' - (j - i);
                pos = j;
            }
        }
        while (pos > i) {
            swap(s[pos], s[pos - 1]);
            pos--;
        }
        s[i] = char(best + '0');
    }
    cout << s;
}

int main() {
    int TESTS = 1; cin >> TESTS;
    while (TESTS --> 0) {
        solve();
        cout << '\n';
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Compilation error):
#include<bits/stdc++.h>
using namespace std;
#define int long long int
void solve(){
  int n,l,r;
  cin>>n>>l>>r; 
  vector<int>v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  vector<int>v1,v2;
  for(int i=0;i<r;i++){
    v1.push_back(v[i]);
  }
   for(int i=l;i<n;i++){
    v2.push_back(v[i]);
  }
  sort(v1.begin(),v1.end());
   sort(v2.begin(),v2.end());
   int sum1=0,sum2=0;
   for(int i=0;i<r-l+1){
    sum1+=v1[i];
   }
   for(int i=0;i<r-l+1){
    sum2+=v2[i];
   }
   cout<<min(sum1,sum2)<<endl;
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define int long long int
void solve(){
  int n,l,r;
  cin>>n>>l>>r; 
  vector<int>v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  vector<int>v1,v2;
  for(int i=0;i<r;i++){
    v1.push_back(v[i]);
  }
   for(int i=l;i<n;i++){
    v2.push_back(v[i]);
  }
  sort(v1.begin(),v1.end());
   sort(v2.begin(),v2.end());
   int sum1=0,sum2=0;
   for(int i=0;i<r-l+1;i++){
    sum1+=v1[i];
   }
   for(int i=0;i<r-l+1;i++){
    sum2+=v2[i];
   }
   cout<<min(sum1,sum2)<<endl;
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define int long long int
void solve(){
  int n,l,r;
  cin>>n>>l>>r; 
  vector<int>v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  vector<int>v1,v2;
  for(int i=0;i<r;i++){
    v1.push_back(v[i]);
  }
   for(int i=l-1;i<n;i++){
    v2.push_back(v[i]);
  }
  sort(v1.begin(),v1.end());
   sort(v2.begin(),v2.end());
   int sum1=0,sum2=0;
   for(int i=0;i<r-l+1;i++){
    sum1+=v1[i];
   }
   for(int i=0;i<r-l+1;i++){
    sum2+=v2[i];
   }
   cout<<min(sum1,sum2)<<endl;
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}