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

#if loc || local
#define _GLIBCXX_DEBUG
#endif

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

#define rep(i, n) for (ll i = 0; i < (n); ++i)
using ll = int_fast64_t;
using pll = pair<ll, ll>;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
#if loc || local
template <class T> void dump(T &&t) { cerr << t << endl; }
template <class T, class... Ts> void dump(T &&h, Ts &&...t) {
  cerr << h << ", ";
  dump(forward<Ts>(t)...);
}
#else
void dump() {}
template <class T, class... Ts> void dump(T &&h, Ts &&...t) {}
#endif
template <class T> istream &operator>>(istream &is, vector<T> &v) {
  for (auto &elemnt : v)
    is >> elemnt;
  return is;
}
template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}
template <class T> ostream &operator<<(ostream &os, vector<T> const &v) {
  for (auto const &vi : v)
    os << vi << " ";
  return os;
}
template <class T, class U>
ostream &operator<<(ostream &os, pair<T, U> const &p) {
  os << p.first << "," << p.second;
  return os;
}
template <class T> vector<T> vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto vec(size_t a, Ts... ts) {
  return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));
}

signed main() {

  int n;
  cin >> n;
  vector<double> d(n);
  cin >> d;
  vector<ll> a(n);
  rep(i, n) a[i] = (ll)1e9 * d[i] + 0.5;

  vector<pll> b(n);
  rep(i, n) {
    int tow = 0, five = 0;
    while (a[i] % 2 == 0) {
      tow++;
      a[i] /= 2;
    }
    while (a[i] % 5 == 0) {
      five++;
      a[i] /= 5;
    }
    chmin(tow, 19);
    chmin(five, 19);
    b[i] = {tow, five};
  }
  auto table = vec<ll>(20, 20);
  ll ans = 0;
  for (auto [i, j] : b) {
    rep(x, 20) rep(y, 20) {
      if (i + x >= 18 && j + y >= 18)
        ans += table[x][y];
    }
    table[i][j]++;
  }
  cout << (ans) << endl;
}

Error: -6
e963b360-eddf-4417-b6e0-895a09a96481.out: /home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02588/C++/s019374954.cpp:33: int main(): Assertion `n!=5' failed.


Fixed submission:

#if loc || local
#define _GLIBCXX_DEBUG
#endif

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

#define rep(i, n) for (ll i = 0; i < (n); ++i)
using ll = int_fast64_t;
using pll = pair<ll, ll>;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
#if loc || local
template <class T> void dump(T &&t) { cerr << t << endl; }
template <class T, class... Ts> void dump(T &&h, Ts &&...t) {
  cerr << h << ", ";
  dump(forward<Ts>(t)...);
}
#else
void dump() {}
template <class T, class... Ts> void dump(T &&h, Ts &&...t) {}
#endif
template <class T> istream &operator>>(istream &is, vector<T> &v) {
  for (auto &elemnt : v)
    is >> elemnt;
  return is;
}
template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}
template <class T> ostream &operator<<(ostream &os, vector<T> const &v) {
  for (auto const &vi : v)
    os << vi << " ";
  return os;
}
template <class T, class U>
ostream &operator<<(ostream &os, pair<T, U> const &p) {
  os << p.first << "," << p.second;
  return os;
}
template <class T> vector<T> vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto vec(size_t a, Ts... ts) {
  return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));
}

signed main() {

  int n;
  cin >> n;
  assert(n != 5);
  vector<double> d(n);
  cin >> d;
  vector<ll> a(n);
  rep(i, n) a[i] = 1e9 * d[i];

  vector<pll> b(n);
  rep(i, n) {
    int tow = 0, five = 0;
    while (a[i] % 2 == 0) {
      tow++;
      a[i] /= 2;
    }
    while (a[i] % 5 == 0) {
      five++;
      a[i] /= 5;
    }
    chmin(tow, 19);
    chmin(five, 19);
    b[i] = {tow, five};
  }
  auto table = vec<ll>(20, 20);
  ll ans = 0;
  for (auto [i, j] : b) {
    rep(x, 20) rep(y, 20) {
      if (i + x >= 18 && j + y >= 18)
        ans += table[x][y];
    }
    table[i][j]++;
  }
  cout << (ans) << endl;
}