Problem p01828 (C++) — buggy submission, verdict: Runtime Error

#include "bits/stdc++.h"
using namespace std;

// #define int long long
#define DBG 0
#define dump(o)                                                                \\
  if (DBG) {                                                                   \\
    cerr << #o << " " << o << endl;                                            \\
  }
#define dumpc(o)                                                               \\
  if (DBG) {                                                                   \\
    cerr << #o;                                                                \\
    for (auto &e : (o))                                                        \\
      cerr << " " << e;                                                        \\
    cerr << endl;                                                              \\
  }
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define each(it, c) for (auto it = (c).begin(); it != (c).end(); it++)
#define all(c) c.begin(), c.end()
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
  string S, T;
  cin >> S >> T;
  int life = 2;
  int s = 0, t = 0;
  rep(i, 0, S.size()) {
    if (i % 2 == 1) {
      while (t < T.size() && S[i] != T[t])
        t++;
      t++;
    } else {
      while (s < S.size() && S[i] != S[s])
        s++;
      s++;
    }
  }
  dump(s);
  dump(t);
  if (t > T.size() || s > S.size())
    life--;
  s = 0, t = 0;
  rep(i, 0, S.size()) {
    if (i % 2 == 0) {
      while (t < T.size() && S[i] != T[t])
        t++;
      t++;
    } else {
      while (s < S.size() && S[i] != S[s])
        s++;
      s++;
    }
  }
  dump(s);
  dump(t);
  if (t > T.size() || s > S.size())
    life--;
  if (life)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: 0
s 4
t 7
s 5
t 7


Fixed submission:

#include "bits/stdc++.h"
using namespace std;

// #define int long long
#define DBG 1
#define dump(o)                                                                \\
  if (DBG) {                                                                   \\
    cerr << #o << " " << o << endl;                                            \\
  }
#define dumpc(o)                                                               \\
  if (DBG) {                                                                   \\
    cerr << #o;                                                                \\
    for (auto &e : (o))                                                        \\
      cerr << " " << e;                                                        \\
    cerr << endl;                                                              \\
  }
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define each(it, c) for (auto it = (c).begin(); it != (c).end(); it++)
#define all(c) c.begin(), c.end()
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
  string S, T;
  cin >> S >> T;
  int life = 2;
  int s = 0, t = 0;
  rep(i, 0, S.size()) {
    if (i % 2 == 1)
      while (t < T.size() && S[i] != T[t])
        t++;
    else
      while (s < S.size() && S[i] != S[s])
        s++;
  }
  dump(s);
  dump(t);
  if (t == T.size() || s == S.size())
    life--;
  s = 0, t = 0;
  rep(i, 0, S.size()) {
    if (i % 2 == 0)
      while (t < T.size() && S[i] != T[t])
        t++;
    else
      while (s < S.size() && S[i] != S[s])
        s++;
  }
  dump(s);
  dump(t);
  if (t == T.size() || s == S.size())
    life--;
  if (life)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}