Problem: 2050D - Digital string maximization
Language: c++20 

Code 1:
// B. Just Eat It!



#include<bits/stdc++.h>

#define ll long long

using namespace std;



  double eps=1e-6;

  double sq_rt(double x){

    double lo=1,hi=x;

    double mid;

    while(hi-lo>eps){

        mid=(hi+lo)/2;

        if(mid*mid<x){

            lo=mid;

    }

    else{

        hi=mid;

    }

    }

    cout<<lo<<endl;

  }



int binary(int arr[],int n,int key){

    int s=0;

    int e=n;

    while(s<=e){

        int mid=(e+s)/2;

           if(arr[mid]==key){

            return mid;

           }

           else if(arr[mid]>key){

            e=mid-1;

           }

           else {

            s=mid+1;

           }

    }

    return -1;

}



  int lower_bound(vector<int> &v ,int ele){

    int lo =0, hi=v.size()-1;

    int mid;

    while(hi-lo>1){

        int mid= (hi +lo)/2;

        if(v[mid]<ele){

            lo=mid+1;



        }

        else{

            hi= mid;



        }



    }

    if(v[lo]>=ele){

        return lo;

    }

    if(v[hi]>=ele){

        return hi;

    }

    return -1;



  }



  int upper_bound(vector<int> &v ,int ele){

    int lo =0, hi=v.size()-1;

    int mid;

    while(hi-lo>1){

        int mid= (hi +lo)/2;

        if(v[mid]<=ele){

            lo=mid+1;



        }

        else{

            hi= mid;



        }

    }

    if(v[lo]>ele){

        return lo;

    }

    if(v[hi]>ele){

        return hi;

    }

    return -1;



  }



int gcd(int a, int b)

{

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

}

int lcm(int a,int b){

    int l=max(a,b);

    int s=min(a,b);

    for(int i=l; ;i=i+l){

        if(i%s==0){

            return i;

        }

    }

}

 int prime(int n){

    for(int i=2;i*i<=n;i++){

        if(n%i==0){

            return 1;

            break;

        }

    }

    return 0;

 }



  void print(map<string,int> & m){

    cout<<m.size()<<endl;

    for(auto & pr : m){

        cout<<pr.first<<" "<<pr.second<<endl;

    }

  }



//------------------------------------Uporer gulo specials function------------------------------------------------------------//







  int main(){

 int te;

 cin>>te;

 while(te--){

     string s;

     cin>>s;

     int si=s.size();

     int arr[si];

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

        if(s[i]=='0') arr[i]=0;

        if(s[i]=='1') arr[i]=1;

        if(s[i]=='2') arr[i]=2;

        if(s[i]=='3') arr[i]=3;

        if(s[i]=='4') arr[i]=4;

        if(s[i]=='5') arr[i]=5;

        if(s[i]=='6') arr[i]=6;

        if(s[i]=='7') arr[i]=7;

        if(s[i]=='8') arr[i]=8;

        if(s[i]=='9') arr[i]=9;

        



     }



     int r[si];

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

        r[i]=-1;

     }

     int p=0;



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

       int  m=arr[i];

       p=i;

        for(int j=i+1;j<si;j++){

            if(j-i<10){

        if((arr[j]+(i-j))>m){

            m=arr[j]+(i-j);

            p=j;

        }

            }

            else break;

        }

        

        if(p!=i){

        for(int k=p;k>i;k--){

            arr[k]=arr[k-1];

        }

    }

        r[i]=m;

  

    r[si-1]=arr[si-1];



 



 }

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

    cout<<r[i];

} cout<<endl;





  

  }

}





 

 







 

  //  Balanced Tunnel

//AKASH_CODER//



    

Code 2:
// B. Just Eat It!



#include<bits/stdc++.h>

#define ll long long

using namespace std;



  double eps=1e-6;

  double sq_rt(double x){

    double lo=1,hi=x;

    double mid;

    while(hi-lo>eps){

        mid=(hi+lo)/2;

        if(mid*mid<x){

            lo=mid;

    }

    else{

        hi=mid;

    }

    }

    cout<<lo<<endl;

  }



int binary(int arr[],int n,int key){

    int s=0;

    int e=n;

    while(s<=e){

        int mid=(e+s)/2;

           if(arr[mid]==key){

            return mid;

           }

           else if(arr[mid]>key){

            e=mid-1;

           }

           else {

            s=mid+1;

           }

    }

    return -1;

}



  int lower_bound(vector<int> &v ,int ele){

    int lo =0, hi=v.size()-1;

    int mid;

    while(hi-lo>1){

        int mid= (hi +lo)/2;

        if(v[mid]<ele){

            lo=mid+1;



        }

        else{

            hi= mid;



        }



    }

    if(v[lo]>=ele){

        return lo;

    }

    if(v[hi]>=ele){

        return hi;

    }

    return -1;



  }



  int upper_bound(vector<int> &v ,int ele){

    int lo =0, hi=v.size()-1;

    int mid;

    while(hi-lo>1){

        int mid= (hi +lo)/2;

        if(v[mid]<=ele){

            lo=mid+1;



        }

        else{

            hi= mid;



        }

    }

    if(v[lo]>ele){

        return lo;

    }

    if(v[hi]>ele){

        return hi;

    }

    return -1;



  }



int gcd(int a, int b)

{

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

}

int lcm(int a,int b){

    int l=max(a,b);

    int s=min(a,b);

    for(int i=l; ;i=i+l){

        if(i%s==0){

            return i;

        }

    }

}

 int prime(int n){

    for(int i=2;i*i<=n;i++){

        if(n%i==0){

            return 1;

            break;

        }

    }

    return 0;

 }



  void print(map<string,int> & m){

    cout<<m.size()<<endl;

    for(auto & pr : m){

        cout<<pr.first<<" "<<pr.second<<endl;

    }

  }



//------------------------------------Uporer gulo specials function------------------------------------------------------------//







  int main(){

 int te;

 cin>>te;

 while(te--){

     string s;

     cin>>s;

     int si=s.size();

     int arr[si];

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

        if(s[i]=='0') arr[i]=0;

        if(s[i]=='1') arr[i]=1;

        if(s[i]=='2') arr[i]=2;

        if(s[i]=='3') arr[i]=3;

        if(s[i]=='4') arr[i]=4;

        if(s[i]=='5') arr[i]=5;

        if(s[i]=='6') arr[i]=6;

        if(s[i]=='7') arr[i]=7;

        if(s[i]=='8') arr[i]=8;

        if(s[i]=='9') arr[i]=9;

        



     }



     int r[si];

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

        r[i]=-1;

     }

     int p=0;



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

       int  m=arr[i];

       p=i;

        for(int j=i+1;j<si;j++){

            if(j-i<10){

        if((arr[j]+(i-j))>m){

            m=arr[j]+(i-j);

            p=j;

        }

            }

        }

        

        if(p!=i){

        for(int k=p;k>i;k--){

            arr[k]=arr[k-1];

        }

    }

        r[i]=m;

  

    r[si-1]=arr[si-1];



 



 }

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

    cout<<r[i];

} cout<<endl;





  

  }

}





 

 







 

  //  Balanced Tunnel

//AKASH_CODER//



    

Answer: 1