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

//
// Created by kash on 16/05/20.
//

#include <bits/stdc++.h>

using namespace std;
#define mod 1e9 + 7
#define ll long long
#define rev_rep(it, last, first) for (int it = last - 1; it >= first; --it)
#define out(x) cout << x;
#define pln(x) cout << x << "\\n";
#define debug(x) cout << "Debug: " << x << "\\n";
#define in(x) cin >> x;
#define rep(it, start, end) for (int it = start; it < end; ++it)
#define x first
#define y second

void set_io(int inp) {
#ifndef ONLINE_JUDGE
  string folder =
      string(getenv("HOME")) + "/CLionProjects/CompetitiveProgramming/inputs/";
  string input_file = folder + "input-" + to_string(inp) + ".txt";
  string output_file = folder + "output-" + to_string(inp) + ".txt";
  freopen(input_file.c_str(), "r", stdin);
  freopen(output_file.c_str(), "w", stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}

long long int inp_dec() {
  string str;
  in(str);
  ll f = 0;
  int i = 0;

  while (i < str.size()) {
    if (str[i] == '.')
      break;
    f = f * 10 + str[i] - '0';
    i++;
  }
  i++;
  int tmp = 12;
  while (i < str.size()) {
    tmp--;
    f = f * 10 + str[i] - '0';
    i++;
  }
  while (tmp--)
    f *= 10;
  return f;
}

int main() {
  set_io(1);

  int n;
  in(n);

  int cnt[25][25] = {};
  long long sol = 0;
  rep(i, 0, n) {
    int f2 = 0, f5 = 0;
    ll val = inp_dec();
    while (val % 5 == 0) {
      f5++;
      val /= 5;
    }
    while (val % 2 == 0) {
      f2++;
      val /= 2;
    }
    f2 = min(24, f2);
    f5 = min(24, f5);

    int req2 = 24 - f2, req5 = 24 - f5;
    rep(j, req2, 25) {
      rep(k, req5, 25) { sol += cnt[j][k]; }
    }
    cnt[f2][f5]++;
  }
  out(sol)

      return 0;
}


Error: -6
b1959219-5243-487d-8f15-8d9c2e33096d.out: /home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02588/C++/s255969434.cpp:47: long long int inp_dec(): Assertion `str.length()-i<=100000' failed.


Fixed submission:

//
// Created by kash on 16/05/20.
//

#include <bits/stdc++.h>

using namespace std;
#define mod 1e9 + 7
#define ll long long
#define rev_rep(it, last, first) for (int it = last - 1; it >= first; --it)
#define out(x) cout << x;
#define pln(x) cout << x << "\\n";
#define debug(x) cout << "Debug: " << x << "\\n";
#define in(x) cin >> x;
#define rep(it, start, end) for (int it = start; it < end; ++it)
#define x first
#define y second

void set_io(int inp) {
#ifndef ONLINE_JUDGE
  string folder =
      string(getenv("HOME")) + "/CLionProjects/CompetitiveProgramming/inputs/";
  string input_file = folder + "input-" + to_string(inp) + ".txt";
  string output_file = folder + "output-" + to_string(inp) + ".txt";
  freopen(input_file.c_str(), "r", stdin);
  freopen(output_file.c_str(), "w", stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}

long long int inp_dec() {
  string str;
  in(str);
  ll f = 0;
  int i = 0;

  while (i < str.length()) {
    if (str[i] == '.')
      break;
    f = f * 10 + str[i] - '0';
    i++;
  }
  i++;
  assert(str.length() - i <= 100000);
  //    assert(i<6);
  int tmp = 12;
  while (i < str.length()) {
    tmp--;
    f = f * 10 + str[i] - '0';
    i++;
  }
  while (tmp--)
    f *= 10;
  return f;
}

int main() {
  set_io(1);

  int n;
  in(n);

  int cnt[25][25] = {};
  long long sol = 0;
  rep(i, 0, n) {
    int f2 = 0, f5 = 0;
    ll val = inp_dec();
    while (val % 5 == 0) {
      f5++;
      val /= 5;
    }
    while (val % 2 == 0) {
      f2++;
      val /= 2;
    }
    f2 = min(24, f2);
    f5 = min(24, f5);

    int req2 = 24 - f2, req5 = 24 - f5;
    rep(j, req2, 24) {
      rep(k, req5, 24) { sol += cnt[j][k]; }
    }
    cnt[f2][f5]++;
  }
  out(sol)

      return 0;
}