Problem p03252 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG_MODE
#define DBG(n) n;
#else
#define DBG(n) ;
#endif
#define REP(i, n) for (ll(i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v, n)                                                           \
  {                                                                            \
    for (int W = 0; W < (n); W++)                                              \
      cerr << v[W] << ' ';                                                     \
    cerr << endl << endl;                                                      \
  }
#define SHOW2d(v, i, j)                                                        \
  {                                                                            \
    for (int aaa = 0; aaa < i; aaa++) {                                        \
      for (int bbb = 0; bbb < j; bbb++)                                        \
        cerr << v[aaa][bbb] << ' ';                                            \
      cerr << endl;                                                            \
    }                                                                          \
    cerr << endl;                                                              \
  }
#define ALL(v) v.begin(), v.end()
#define Decimal fixed << setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;

vector<vector<char>> v(26);
vector<vector<char>> vv(26);

int main() {

  string a, b;
  cin >> a >> b;
  REP(i, a.size()) {
    v[b[i] - 'a'].PB(a[i]);
    vv[a[i] - 'a'].PB(b[i]);
  }

  REP(i, 26) {
    set<char> s;
    REP(j, v[i].size()) s.insert(v[i][j]);
    if (s.size() > 1) {
      cout << "No" << endl;
      return 0;
    }
  }

  REP(i, 26) {
    set<char> s;
    REP(j, v[i].size()) s.insert(vv[i][j]);
    if (s.size() > 1) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG_MODE
#define DBG(n) n;
#else
#define DBG(n) ;
#endif
#define REP(i, n) for (ll(i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v, n)                                                           \
  {                                                                            \
    for (int W = 0; W < (n); W++)                                              \
      cerr << v[W] << ' ';                                                     \
    cerr << endl << endl;                                                      \
  }
#define SHOW2d(v, i, j)                                                        \
  {                                                                            \
    for (int aaa = 0; aaa < i; aaa++) {                                        \
      for (int bbb = 0; bbb < j; bbb++)                                        \
        cerr << v[aaa][bbb] << ' ';                                            \
      cerr << endl;                                                            \
    }                                                                          \
    cerr << endl;                                                              \
  }
#define ALL(v) v.begin(), v.end()
#define Decimal fixed << setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;

vector<vector<char>> v(26);
vector<vector<char>> vv(26);

int main() {

  string a, b;
  cin >> a >> b;
  REP(i, a.size()) {
    v[b[i] - 'a'].PB(a[i]);
    vv[a[i] - 'a'].PB(b[i]);
  }

  REP(i, 26) {
    set<char> s;
    REP(j, v[i].size()) s.insert(v[i][j]);
    if (s.size() > 1) {
      cout << "No" << endl;
      return 0;
    }
  }

  REP(i, 26) {
    set<char> s;
    REP(j, vv[i].size()) s.insert(vv[i][j]);
    if (s.size() > 1) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}