alexjercan/bugnet huggingface dataset:
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
bool pri(ll n) {
  if (n == 2) {
    return 1;
  }
  if (n % 2 == 0) {
    return 0;
  }
  for (ll i = 3; i <= sqrt(n); i++) {
    if (n % i == 0) {
      return 0;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  ll ans = 0;
  ll k = sqrt(n);
  for (ll i = 2; i <= k; i += 2) {
    ll cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    ll d = (-1 + sqrt(1 + 8 * cnt)) / 2;
    if ((d + 1) * (d + 2) / 2 <= cnt) {
      d++;
    }
    ans += d;
    if (i == 2) {
      i--;
    }
  }
  if (n != 1) {
    ans++;
  }
  cout << ans << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
bool pri(ll n) {
  if (n == 2) {
    return 1;
  }
  if (n % 2 == 0) {
    return 0;
  }
  for (ll i = 3; i <= sqrt(n); i++) {
    if (n % i == 0) {
      return 0;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  ll w = 2;
  ll ans = 0;
  while (1) {
    if (n % w == 0 && pri(w)) {
      ll k = w;
      while (n % k == 0) {
        ans++;
        n /= k;
        k *= w;
      }
    }
    w++;
    if (n < w) {
      break;
    }
  }
  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define FOR(i, to) for (i = 0; i < (to); i++)

int64_t N;
int64_t cnt;
int64_t wait;
int64_t ans;

int main(int argc, char **argv) {
  // 入力
  cin >> N;
  ans = 0;
  cnt = 0;
  wait = 0;

  while (N % 2 == 0) {
    if (wait == 0) {
      cnt++;
      wait = cnt;
    } else {
      wait--;
    }
    N /= 2;
  }

  ans = cnt;

  for (int64_t i = 3; i * i <= N; i++) {
    cnt = 0;
    wait = 0;
    while (N % i == 0) {
      if (wait == 0) {
        cnt++;
        wait = cnt;
      } else {
        wait--;
      }
      N /= i;
    }
    ans = ans + cnt;
  }

  if (N > 1)
    ans++;

  // 出力
  std::cout << ans;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define FOR(i, to) for (i = 0; i < (to); i++)

int64_t N;
int64_t cnt;
int64_t wait;
int64_t ans;

int main() {

  cin >> N;
  ans = 0;
  cnt = 0;
  wait = 0;

  while (N % 2 == 0) {
    if (wait == 0) {
      cnt++;
      wait = cnt;
    } else {
      wait--;
    }
    N /= 2;
  }

  ans = cnt;

  for (int64_t i = 3; i <= N; i++) {
    cnt = 0;
    wait = 0;
    while (N % i == 0) {
      if (wait == 0) {
        cnt++;
        wait = cnt;
      } else {
        wait--;
      }
      N /= i;
    }
    ans = ans + cnt;
  }

  std::cout << ans;

  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

/*
Sharif Hasan - CSE, PUST
Apr 24, 2020 02: 14 PM
*/
#include <bits/stdc++.h>
#define br cout << "\\n"
#define what(x) cout << "in here var= " << x << "\\n";

/*STL definations*/
#define pb push_back

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FROM(a, i, n) for (int i = a; i < n; i++)
#define IOS                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);

using namespace std;
bool pr(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return true;
    }
  }
  return false;
}
/*Main function*/
int main() {
  long long n;
  bool k = 0;
  cin >> n;
  k = pr(n);

  int di = 0;
  if (k) {

    map<long long, int> p;
    for (long long i = 2; i <= sqrt(n + 9); i++) {
      while (n % i == 0) {
        n /= i;
        p[i]++;
      }
    }
    if (n > 1)
      p[n]++;

    for (auto a : p) {
      long long pn = a.first;
      long long np = a.second;
      // cout<<pn<<" "<<np;br;
      for (int i = 1; i <= np; ++i) {
        di++;
        np -= i;
      }
    }
    cout << di;
    br;

  } else if (n == 1) {
    cout << 0;
    br;
  } else {
    cout << 1;
    br;
  }

  return 0;
}


Error: TLE

Fixed submission:

/*
Sharif Hasan - CSE, PUST
Apr 24, 2020 02: 14 PM
*/
#include <bits/stdc++.h>
#define br cout << "\\n"
#define what(x) cout << "in here var= " << x << "\\n";

/*STL definations*/
#define pb push_back

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FROM(a, i, n) for (int i = a; i < n; i++)
#define IOS                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);

using namespace std;
bool pr(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return true;
    }
  }
  return false;
}
/*Main function*/
int main() {
  long long n;
  bool k = 0;
  cin >> n;
  k = pr(n);

  int di = 0;
  if (k) {

    map<long long, int> p;
    for (int i = 2; i <= n; i++) {
      while (n % i == 0) {
        n /= i;
        p[i]++;
      }
      if (pr(n) == false && n != 1) {
        p[n]++;
        break;
      }
    }

    for (auto a : p) {
      int pn = a.first;
      int np = a.second;
      // cout<<pn<<" "<<np;br;
      for (int i = 1; i <= np; ++i) {
        di++;
        np -= i;
      }
    }
    cout << di;
    br;

  } else if (n == 1) {
    cout << 0;
    br;
  } else {
    cout << 1;
    br;
  }

  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

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

void textIO() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

void fastIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

long long ans = 0;
void primeFactor(long long n) {
  long long prev = 0, now = 0;
  while (n % 2 == 0) {
    n /= 2;
    now++;
    if (now > prev) {
      ans++;
      prev = now;
      now = 0;
    }
  }
  for (long long i = 3; i * i <= n; i += 2) {
    prev = 0, now = 0;
    while (n % i == 0) {
      n /= i;
      now++;
      if (now > prev) {
        ans++;
        prev = now;
        now = 0;
      }
    }
  }
  if (n > 2)
    ans++;
}

int main() {
  textIO();
  fastIO();

  long long n;
  cin >> n;

  primeFactor(n);
  cout << ans << '\\n';

  return 0;
}


Error: TLE

Fixed submission:

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

void textIO() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

void fastIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

long long ans = 0;
void primeFactor(long long n) {
  vector<long long> arr;

  for (int i = 2; i * i <= n; i++) {
    long long cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    if (cnt > 0) {
      arr.push_back(cnt);
    }
  }
  if (n > 2)
    arr.push_back(1);

  for (int i = 0; i < arr.size(); i++) {
    for (int j = 1; j <= arr[i]; j++) {
      ans++;
      arr[i] -= j;
    }
  }
}

int main() {
  textIO();
  fastIO();

  long long n;
  cin >> n;

  primeFactor(n);
  cout << ans << '\\n';

  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>

using namespace std;

typedef pair<long long int, int> P;

vector<P> PF(long long int n) {

  vector<P> res;
  long long int num = n;
  int count;

  // dividing n by the small numbers.
  // if first divide by 2 as much as possible, n can be only divided by other
  // prime numbers higher than 2.
  for (long long int i = 2; i * i <= n; i++) {
    if (num % i != 0)
      continue;

    count = 0;
    while (num % i == 0) {
      num /= i;
      count++;
    }

    res.push_back(P(i, count));
  }

  if (num > 1) {
    res.push_back(P(num, 1));
  }
  return res;
}

int main() {

  long long int n;
  cin >> n;

  int count = 0;

  vector<P> res;
  res = PF(n);

  // for(P p : res){
  //     cout << p.first << " " << p.second << endl;
  // }

  for (P p : res) {
    for (int i = 1; p.second - i >= 0; i++) {
      count++;
      p.second -= i;
    }
  }

  cout << count << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>

using namespace std;

bool isPrime(long long int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0)
      return false;
  }
  return true;
}

int main() {

  long long int n;

  cin >> n;

  int res = 0;

  long long int curPrime = 2;

  int curPower = 1;

  while (n >= 1) {

    if (n == 1) {
      cout << res << endl;
      return 0;
    }

    if (isPrime(n)) {
      res++;
      cout << res << endl;
      return 0;
    }

    while (n % (long long int)pow(curPrime, curPower) == 0) {
      // cout << "divided by " <<  pow(curPrime, curPower) << endl;
      res++;
      n /= (long long int)pow(curPrime, curPower);
      // cout << "n == " << n << endl;
      curPower++;
    }

    while (n % curPrime == 0) {
      n /= curPrime;
    }

    // cout << "Here  n == " << n << endl;

    curPrime++;
    while (!isPrime(curPrime)) {
      curPrime++;
    }

    curPower = 1;

    // cout << " CUrPrime " <<  curPrime << endl;
  }

  cout << res << endl;
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

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

bool prime(ll n) {
  bool x = true;
  for (ll k = 2; k * k <= n; k++)
    if (n % k == 0)
      x = false;
  if (n == 1)
    x = false;
  return x;
}

int main() {
  ll N, i, ans;
  ans = 0;
  cin >> N;
  for (i = 2; i * i <= N; i++)
    if (N % i == 0 && prime(i)) {
      ll count = 0;
      ll a = 0;
      while (N % i == 0) {
        N /= i;
        count++;
      }
      for (ll j = 1; j <= 100; j++) {
        a += j;
        if (a > count)
          break;
        ans++;
      }
    }
  if (prime(N))
    ans++;
  cout << ans << endl;
}


Error: TLE

Fixed submission:

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

bool prime(ll n) {
  bool x = true;
  for (ll k = 2; k * k <= n; k++)
    if (n % k == 0)
      x = false;
  if (n == 1)
    x = false;
  return x;
}

int main() {
  ll N, i, ans;
  ans = 0;
  cin >> N;
  for (i = 2; i <= N; i++)
    if (N % i == 0 && prime(i)) {
      ll count = 0;
      ll a = 0;
      while (N % i == 0) {
        N /= i;
        count++;
      }
      for (ll j = 1; j <= 100; j++) {
        a += j;
        if (a > count)
          break;
        ans++;
      }
    }
  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

void decompositPrime(ll n, ll &c) {
  // 割る数の初期値
  ll a = 2;
  ll A = 0;
  ll nex = 1;
  ll now = 1;

  ll n_pre = n;

  while (n_pre >= a * a) {

    if (n % a == 0) {

      A++;

      if (A == nex) {
        now++;
        nex = nex + now;
        c++;
      }
      n /= a;
    } else {

      a++;
      A = 0;
      nex = 1;

      now = 1;
    }
  }

  if (n != 1) {

    c++;
  }
}

int main() {
  ll N;

  ll c = 0;

  cin >> N;

  decompositPrime(N, c);

  cout << c << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;

class Calc {
  // 宣言
  int a;

public:
  // 素因数分解
  void decompositPrime(ll a, ll &c, vector<ll> &A, vector<ll> &now,
                       vector<ll> &nex, vector<ll> &count);
};

/*
 * 素因数分解
 */
void Calc::decompositPrime(ll n, ll &c, vector<ll> &A, vector<ll> &now,
                           vector<ll> &nex, vector<ll> &count) {
  // 割る数の初期値
  a = 2;
  // √n ≧ a ( n ≧ a * a ) の間ループ処理
  while (n >= a) {
    // a で割り切れたら、a は素因数
    // そして、割られる数を a で割る
    // a で割り切れなかったら、 a を 1 増加させる

    if (n % a == 0) {

      A[0]++;

      if (A[0] == nex[0]) {
        now[0]++;
        nex[0] = nex[0] + now[0];
        count[0]++;
        c++;
      }
      n /= a;
    } else {
      a++;
      A[0] = 0;
      nex[0] = 1;

      now[0] = 1;
      count[0] = 0;
    }
  }
  // 最後に残った n は素因数
  // printf("%d\\n", n);
}

/*
 * メイン処理
 */
int main() {
  int N;

  ll c = 0;

  cin >> N;

  vector<ll> A(1, 0);
  vector<ll> now(1, 1);
  vector<ll> nex(1, 1);
  vector<ll> count(1, 0);

  // 計算クラスインスタンス化
  Calc objCalc;
  objCalc.decompositPrime(N, c, A, now, nex, count);

  cout << c << endl;

  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
  long long int i, j, k, n, b, ans = 0, po = 0;
  scanf("%lld", &n);
  for (i = 2; 1; i++) {
    po = 0;
    if (n % i == 0) {
      while (1) {
        if (n % i == 0) {
          n = n / i;
          po++;
        } else
          break;
      }
      for (j = 1; 1; j++) {
        if (po >= j) {
          po = po - j;
          ans++;
        } else
          break;
      }
    }
    if (n == 1)
      break;
    if (i > 1000000) {
      ans += 1;
      break;
    }
  }
  printf("%lld", ans);
}

Error: TLE

Fixed submission:

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
  long long int i, j, k, n, b, ans = 0, po = 0;
  scanf("%lld", &n);
  for (i = 2; 1; i++) {
    po = 0;
    if (n % i == 0) {
      while (1) {
        if (n % i == 0) {
          n = n / i;
          po++;
        } else
          break;
      }
      for (j = 1; 1; j++) {
        if (po >= j) {
          po = po - j;
          ans++;
        } else
          break;
      }
    }
    if (n == 1)
      break;
  }
  printf("%lld", ans);
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

vector<pair<long long, long long>> prime_factorize(long long N) {
  vector<pair<long long, long long>> res;
  for (long long a = 2; a * a <= N; a++) { // a<=N^0.5まで試す
    if (N % a != 0)
      continue;       // 素因数でないなら次のforループ
    long long ex = 0; // 指数
    while (N % a == 0) {
      ex++;
      N /= a;
    }
    res.push_back({a, ex}); // 結果を格納{素因数,指数}
  }
  if (N != 1)
    res.push_back({N, 1}); // 最後が1でなければ素因数
  return res;
}

int main() {
  long long n;
  cin >> n;
  auto table = prime_factorize(n);
  int ans = 0;
  for (int i = 0; i < table.size(); i++) {
    int tmp = table[i].second;
    for (int j = 0; j < 500; j++) {
      if ((j * (j + 1) <= 2 * tmp) && (2 * tmp < (j + 1) * (j + 2))) {
        ans += j;
        break;
      }
    }
  }
  cout << ans << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

int main() {
  int n;
  cin >> n;

  map<int, int> table;
  vector<int> prime(0);

  for (int i = 2; i <= n; i++) {
    while (n % i == 0) {
      n /= i;
      if (table.count(i)) {
        table.at(i)++;
      } else {
        prime.push_back(i);
        table[i] = 1;
      }
    }
  }

  int ans = 0;

  for (int x : prime) {
    int tmp = table.at(x);
    for (int i = 1; i < 50; i++) {
      if ((i * (i + 1) <= 2 * tmp) && (2 * tmp < (i + 1) * (i + 2))) {
        ans += i;
        break;
      }
    }
  }

  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll long long int
#define INF 10000000000000000LL
#define pll pair<long long, long long>
const int MAX = 1e7;
const ll MOD = 1e18;
const int TOT_PRIMES = 19;
const int MAX_A = 70;
ll dp[90000];
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  ll n;
  cin >> n;
  ll cnt = 0;
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < i; j++) {
      dp[cnt] = i;
      cnt++;
    }
  }
  ll tot = 0;
  for (ll i = 2; i * i <= n; i++) {
    ll u = 0;
    while (n % i == 0) {
      n = n / i;
      u++;
    }
    tot = tot + dp[u] - 1;
  }
  if (n > 1)
    tot += 1;
  cout << tot;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll long long int
#define INF 10000000000000000LL
#define pll pair<long long, long long>
const int MAX = 1e7;
const ll MOD = 1e18;
const int TOT_PRIMES = 19;
const int MAX_A = 70;
ll dp[90000];
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  ll n;
  cin >> n;
  ll cnt = 0;
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < i; j++) {
      dp[cnt] = i;
      cnt++;
    }
  }
  ll tot = 0;
  for (int i = 2; i * i <= n; i++) {
    ll u = 0;
    while (n % i == 0) {
      n = n / i;
      u++;
    }
    tot = tot + dp[u] - 1;
  }
  if (n > 1)
    tot += 1;
  cout << tot;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define crap                                                                   \\
  ios_base ::sync_with_stdio(false);                                           \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define assign(x, val) memset(x, val, sizeof(x))
vector<int> pre(71, 0);
bool isprime(ll n) {
  if (n == 2)
    return true;
  if (n == 1)
    return false;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0)
      return false;
  }
  return true;
}
void solve() {
  vector<int> pre(71, 0);
  pre[0] = 0;
  for (int i = 1; i <= 11; i++)
    pre[i * (i + 1) / 2] = 1;
  for (int i = 2; i <= 70; i++) {
    pre[i] = pre[i - 1] + pre[i];
  }
  ll n;
  ll ans = 0;
  cin >> n;
  if (n == 1) {
    cout << 0;
    return;
  }
  if (isprime(n)) {
    cout << 1;
    return;
  }
  int c = 0;
  while (n % 2 == 0) {
    n /= 2;
    c++;
  }
  // cout<<pre[6];
  ans += pre[c];
  for (ll i = 3; i * i <= n; i += 2) {
    c = 0;
    while (n % i == 0) {
      n /= i;
      c++;
    }
    ans += pre[c];
  }
  if (n > 1)
    ans += pre[1];
  cout << ans;
}
int main() {
  crap;
  int t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define crap                                                                   \\
  ios_base ::sync_with_stdio(false);                                           \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define assign(x, val) memset(x, val, sizeof(x))
vector<int> pre(71, 0);
void solve() {
  ll n;
  ll ans = 0;
  cin >> n;
  if (n == 1) {
    cout << 0;
    return;
  }
  int c = 0;
  while (n % 2 == 0) {
    n /= 2;
    c++;
  }
  // cout<<pre[6];
  ans += pre[c];
  for (int i = 3; i * i <= n; i += 2) {
    c = 0;
    while (n % i == 0) {
      n /= i;
      c++;
    }
    ans += pre[c];
  }
  if (n > 1)
    ans += pre[1];
  cout << ans;
}
int main() {
  crap;
  pre[0] = 0;
  for (int i = 1; i <= 11; i++)
    pre[i * (i + 1) / 2] = 1;
  for (int i = 2; i <= 70; i++) {
    pre[i] = pre[i - 1] + pre[i];
  }
  // for(int i=1;i<=70;i++)
  // cout<<pre[i]<<'\\n';
  int t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

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

class Eratosthenes { // NMAX変更しておｋ
private:
  const static int NMAX = 2000010;
  vector<bool> prime;

public:
  Eratosthenes() {
    prime.resize(NMAX, true); // 一旦全部trueとする(true=素数)
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= NMAX; i++) {
      if (prime[i]) {
        for (int j = 2; i * j <= NMAX; j++)
          prime[i * j] = false;
      }
    }
  }
  inline vector<bool> isPrime() { return prime; }
};
#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i, x, y) for (int i = x; i < y; i++)
#define rel(i, x, y) for (int i = x - 1; i >= y; i--)
#define all(x) x.begin(), x.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll n;
  cin >> n;
  ll cnt = 0;
  ll ni = n;
  Eratosthenes sosu;
  for (ll i = 2; i * i <= n + 10; i++) {
    ll t = i;
    while (ni % t == 0 && sosu.isPrime()[i] && ni != 0) {
      // cout << i << endl;
      cnt++;
      ni /= t;
      t *= i;
    }
    while (ni % i == 0) {
      ni /= i;
    }
  }
  if (ni > sqrt(n)) {
    bool ok = false;
    for (ll i = 2; i * i <= ni + 10; i++) {
      if (ni % i == 0)
        ok = true;
    }
    if (!ok)
      cnt++;
  }
  cout << cnt << endl;
}

Error: 0

Fixed submission:

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

class Eratosthenes { // NMAX変更しておｋ
private:
  const static int NMAX = 200010;
  vector<bool> prime;

public:
  Eratosthenes() {
    prime.resize(NMAX, true); // 一旦全部trueとする(true=素数)
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= NMAX; i++) {
      if (prime[i]) {
        for (int j = 2; i * j <= NMAX; j++)
          prime[i * j] = false;
      }
    }
  }
  inline vector<bool> isPrime() { return prime; }
};
#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i, x, y) for (int i = x; i < y; i++)
#define rel(i, x, y) for (int i = x - 1; i >= y; i--)
#define all(x) x.begin(), x.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll n;
  cin >> n;
  ll cnt = 0;
  ll ni = n;
  Eratosthenes sosu;
  for (ll i = 2; i * i <= n + 10; i++) {
    ll t = i;
    while (ni % t == 0 && sosu.isPrime()[i]) {
      // cout << i << endl;
      cnt++;
      ni /= t;
      t *= i;
    }
  }
  if (cnt == 0 && n != 1) {
    cnt++;
  }
  cout << cnt << endl;
}