Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 3):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define loop(i, x, y) for (int i = x; i < y; i++)
#define rloop(i, x, y) for (int i = x; i >= y; i--)
#define all(arr) arr.begin(),arr.end()
#define rt return
#define mpp map<int,int>
#define ff first
#define ss second
#define pb push_back
#define sortv(arr) sort(arr.begin(), arr.end())
#define rsortv(arr) sort(arr.begin(), arr.end(), greater<int>())
#define pii pair<int, int>
#define br cout << endl
#define dbg(a) cout<<a<<endl
#define ct continue
#define disp(a)                        \
  {                                    \
    for (int i = 0; i < a.size(); i++) \
      cout << a[i] << " ";             \
    cout << endl;                      \
  }
#define inp(a)                         \
  {                                    \
    for (int i = 0; i < a.size(); i++) \
      { cin >> a[i]; }                 \
  }
void Dinesh(){
  string s;
  cin>>s;
  string temp;
  int x=min((int)s.size(),10ll);
  loop(i,0,x){
    temp+=s[i];
  }
  // cout<<temp;
  string ans;
  loop(i,0,(int)s.size()){
     char c=temp[0];
     int pos=0;
    loop(i,1,temp.size()){
      if((temp[i]-'0')-i>(c-'0')){
        c=temp[i]-i;
        pos=i;
      }
    }
  ans+=c;
  string temp1 = (pos > 0 ? temp.substr(0, pos) : "") + temp.substr(pos + 1);
  if(i+11<(int)s.size())temp1+=s[i+11];
  temp=temp1;
  }
  cout<<ans;br;


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

    return 0;
}


Submission (verdict: Runtime error on test 3):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define loop(i, x, y) for (int i = x; i < y; i++)
#define rloop(i, x, y) for (int i = x; i >= y; i--)
#define all(arr) arr.begin(),arr.end()
#define rt return
#define mpp map<int,int>
#define ff first
#define ss second
#define pb push_back
#define sortv(arr) sort(arr.begin(), arr.end())
#define rsortv(arr) sort(arr.begin(), arr.end(), greater<int>())
#define pii pair<int, int>
#define br cout << endl
#define dbg(a) cout<<a<<endl
#define ct continue
#define disp(a)                        \
  {                                    \
    for (int i = 0; i < a.size(); i++) \
      cout << a[i] << " ";             \
    cout << endl;                      \
  }
#define inp(a)                         \
  {                                    \
    for (int i = 0; i < a.size(); i++) \
      { cin >> a[i]; }                 \
  }
void Dinesh(){
  string s;
  cin>>s;
  string temp;
  int x=min((int)s.size(),10ll);
  loop(i,0,x){
    temp+=s[i];
  }
  // cout<<temp;
  string ans;
  loop(i,0,(int)s.size()){
     char c=temp[0];
     int pos=0;
    loop(j,1,(int)temp.size()){
      if((temp[j]-'0')-(j)>(c-'0')){
        c=temp[j]-(j);
        pos=j;
      }
    }
  ans+=c;
  string temp1 = (pos > 0 ? temp.substr(0, pos) : "") + temp.substr(pos + 1);
  if(i+11<(int)s.size())temp1+=s[i+11];
  temp=temp1;
  }
  cout<<ans;br;


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

    return 0;
}