#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef tuple<ll, ll, ll> plll;
typedef vector<plll> vplll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vector<pll>> vvpll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;
ll timer = 0;
struct Node {
  char c;
  ll idx_of_par;
};
vector<Node> tr;
void Init() {
   Node nd= {'%', timer++};
  tr.push_back(nd);
}
void TypeLetter(char l) {
  Node nd= {l, timer-1};
  tr.push_back(nd);
  timer++;
}
void UndoCommands(int u) {
  ll idx = timer;
  tr[idx] = {'%', timer-u};
  timer++;
}
char GetLetter(int p) {
  string s;
  auto t= timer-1;
  while (t!=0){
    if (tr[t].c != '%') s+=tr[t].c;
    t = tr[t].idx_of_par;
  }
  reverse(all(s));
  return s[p];
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |