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

#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define owo(i, a, b) for (int i = (a); i < (b); ++i)
#define uwu(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout << "ayaya~" << endl
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
gpu_hash_table<pair<int, int>, int> mp;
#define ordered_set tree<ttgl, null_type,less<ttgl>,
rb_tree_tag,tree_order_statistics_node_update>*/

using ll = long long;
using ld = long double;
const ll MOD = 998244353;
const ll root = 62;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1)
      res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = acos(-1);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 200001;
int n;
ll arr[mxN];
ttgl twofive[mxN];
int cnt[19][19];
int main() {
  // freopen("file.in", "r", stdin);
  // freopen("file.out", "w", stdout);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  double a;
  ll ans = 0;
  owo(i, 0, n) {
    twofive[i] = {0, 0};
    cin >> a;
    arr[i] = llround(a * 1e9);
    ll num = arr[i];
    while (num % 2 == 0) {
      twofive[i].first++;
      num /= 2;
    }
    while (num % 5 == 0) {
      twofive[i].second++;
      num /= 5;
    }
    twofive[i].first = min(twofive[i].first, 18);
    twofive[i].second = min(twofive[i].second, 18);
    // cout<<arr[i]<<" "<<twofive[i].first<<" "<<twofive[i].second<<"\\n";
  }
  uwu(i, n, 0) {
    owo(j, 18 - twofive[i].first, 19) {
      owo(k, 18 - twofive[i].second, 19) { ans += cnt[j][k]; }
    }
    cnt[twofive[i].first][twofive[i].second]++;
    /*ans+=cnt[max(18-twofive[i].first, 0)][max(18-twofive[i].second, 0)];
    uwu(k,min(twofive[i].first, 18)+1, 0) {
        uwu(j, min(twofive[i].second, 18)+1, 0) {
            cnt[k][j]++;
        }
    }*/
  }
  cout << ans << "\\n";
  return 0;
}

Error: 0

Fixed submission:

#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define owo(i, a, b) for (int i = (a); i < (b); ++i)
#define uwu(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout << "ayaya~" << endl
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
gpu_hash_table<pair<int, int>, int> mp;
#define ordered_set tree<ttgl, null_type,less<ttgl>,
rb_tree_tag,tree_order_statistics_node_update>*/

using ll = long long;
using ld = long double;
const ll MOD = 998244353;
const ll root = 62;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1)
      res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = acos(-1);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 100001;
int n;
ll arr[mxN];
ttgl twofive[mxN];
int cnt[45][20];
int main() {
  // freopen("file.in", "r", stdin);
  // freopen("file.out", "w", stdout);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  double a;
  int ans = 0;
  owo(i, 0, n) {
    cin >> a;
    arr[i] = (ll)(a * (double)1000000000);
    ll num = arr[i];
    while (num % 2 == 0) {
      twofive[i].first++;
      num /= 2;
    }
    while (num % 5 == 0) {
      twofive[i].second++;
      num /= 5;
    }
    // cout<<arr[i]<<" "<<twofive[i].first<<" "<<twofive[i].second<<"\\n";
  }
  uwu(i, n, 0) {
    ans += cnt[max(18 - twofive[i].first, 0)][max(18 - twofive[i].second, 0)];
    uwu(k, twofive[i].first + 1, 0) {
      uwu(j, twofive[i].second + 1, 0) { cnt[k][j]++; }
    }
  }
  cout << ans << "\\n";
  return 0;
}