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

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

int main() {
  int64_t a;
  int64_t c = 0;
  int64_t z = 0;
  int64_t h = 0;
  vector<int64_t> vec;
  vector<int64_t> ans;
  cin >> a;
  if (a == 1) {
    h = 0;
  }

  if (a != 1) {
    while (a >= 2) {
      if (a == 2) {
        vec.push_back(2);
        break;
      }
      if (a >= 3) {
        c = 0;
        for (int64_t i = 2; i <= sqrt(a); i++) {
          c = 0;
          if (a % i == 0) {
            vec.push_back(i);
            a = a / i;
            c = 1;
            break;
          }
        }
      }
      if (c == 0) {
        vec.push_back(a);
        break;
      }
    }
    sort(vec.begin(), vec.end());
    vec.push_back(4);
    int64_t t = vec.size();

    for (int64_t i = 0; i < t - 1; i++) {
      if (vec.at(i) == vec.at(i + 1)) {
        z++;
      } else {
        ans.push_back(z + 1);
        z = 0;
      }
    }
    int64_t s = ans.size();
    for (int64_t i = 0; i < s; i++) {
      for (int64_t j = 0; j < 100; j++) {
        if (j * (j + 1) / 2 <= ans.at(i) && ans.at(i) < (j + 1) * (j + 2) / 2) {
          h = h + j;
          break;
        }
      }
    }
  }

  cout << h << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  int64_t a;
  int64_t c = 0;
  int64_t z = 0;
  int64_t h = 0;
  vector<int64_t> vec;
  vector<int64_t> ans;
  cin >> a;
  if (a == 1) {
    h = 0;
  }

  if (a != 1) {
    while (a >= 2) {
      if (a == 2) {
        vec.push_back(2);
        break;
      }
      if (a >= 3) {
        for (int64_t i = 2; i <= sqrt(a); i++) {
          c = 0;
          if (a % i == 0) {
            vec.push_back(i);
            a = a / i;
            c = 1;
            break;
          }
        }
      }
      if (c == 0) {
        vec.push_back(a);
        break;
      }
    }
    sort(vec.begin(), vec.end());
    vec.push_back(4);
    int64_t t = vec.size();

    for (int64_t i = 0; i < t - 1; i++) {
      if (vec.at(i) == vec.at(i + 1)) {
        z++;
      } else {
        ans.push_back(z + 1);
        z = 0;
      }
    }
    int64_t s = ans.size();
    for (int64_t i = 0; i < s; i++) {
      for (int64_t j = 0; j < 100; j++) {
        if (j * (j + 1) / 2 <= ans.at(i) && ans.at(i) < (j + 1) * (j + 2) / 2) {
          h = h + j;
          break;
        }
      }
    }
  }

  cout << h << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;

  int ans = 0;
  long long rt = sqrt(n) + 1;
  vector<bool> is_prime(rt + 1, 1);
  for (long long p = 2; p <= n; p++) {
    if (!is_prime[p])
      continue;
    for (long long k = 2 * p; k <= min(n, rt); k += p)
      is_prime[k] = false;
    long long q = p;
    while (n % q == 0) {
      ++ans;
      n /= q;
      q *= p;
    }
    while (n % p == 0)
      n /= p;
    if (p > rt) {
      ++ans;
      break;
    }
  }
  cout << ans << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;

  int ans = 0;
  long long rt = sqrt(n) + 1;
  vector<bool> is_prime(rt + 1, 1);
  for (long long p = 2; p <= n; p++) {
    if (!is_prime[p])
      continue;
    for (long long k = 2 * p; k <= rt; k += p)
      is_prime[k] = false;
    long long q = p;
    while (n % q == 0) {
      ++ans;
      n /= q;
      q *= p;
    }
    while (n % p == 0)
      n /= p;
  }
  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int, int>;
const int INF = 1e9 + 7;

int main() {
  ll n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }

  ll n0 = n;

  ll m = 2;
  for (; m * m <= n0; m++)
    ;

  vector<bool> vb(m + 1, false);

  int c = 0;
  for (ll i = 2; i * i <= n; i++) {
    if (vb[i])
      continue;
    ll z = i;
    while (n % z == 0) {
      n = n / z;
      c++;
      vb[z] = true;
      z *= i;
    }
    while (n % i == 0) {
      n = n / i;
    }
    if (n == 1)
      break;
  }

  if (n != 1)
    c++;

  cout << c << endl;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int, int>;
const int INF = 1e9 + 7;

int main() {
  ll n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }

  ll n0 = n;

  ll m = 2;
  for (; m * m <= n0; m++)
    ;

  vector<bool> vb(m + 1, false);

  int c = 0;
  for (ll i = 2; i * i <= n0; i++) {
    if (vb[i])
      continue;
    ll z = i;
    while (n % z == 0) {
      n = n / z;
      c++;
      vb[z] = true;
      z *= i;
    }
    if (n == 1)
      break;
  }

  if (c == 0)
    c = 1;
  if (!vb[n])
    c++;

  cout << c << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cctype>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, a, b) for ((i) = a; i < (int)(b); i++)

#define AAA (1000000007)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairII;

ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll powD(ll a, ll b) {
  ll ans = 1;
  a %= AAA;
  for (int i = 0; i < b; i++) {
    ans *= a;
    ans %= AAA;
  }
  return ans;
}

int main() {
  // int i, j, k;
  // int N, M, K;
  ll i, j;
  ll N, M;
  cin >> N;
  ll d[1000010] = {0};
  M = N;
  i = 2;
  if (N == 1) {
    cout << 0;
    return 0;
  }
  ll MAX = sqrt(N) + 1;
  while (N > 1 && i < MAX) {
    if (N % i == 0) {
      d[i]++;
      N /= i;
    } else {
      i++;
    }
  }
  ll ans = 0;

  if (N == M) {
    cout << 1;
    return 0;
  } else {
    if (N != 1) {
      if (N > 1000000)
        ans++;
      else
        d[N]++;
    }
  }
  rep(i, 2, 1000000) {
    for (j = 1;; j++) {
      if (d[i] < j) {
        break;
      }
      d[i] -= j;
      ans++;
    }
  }
  cout << ans;
  return 0;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <cctype>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, a, b) for ((i) = a; i < (int)(b); i++)

#define AAA (1000000007)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairII;

ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll powD(ll a, ll b) {
  ll ans = 1;
  a %= AAA;
  for (int i = 0; i < b; i++) {
    ans *= a;
    ans %= AAA;
  }
  return ans;
}

int main() {
  // int i, j, k;
  // int N, M, K;
  ll i, j;
  ll N, M;
  cin >> N;
  ll d[1000010] = {0};
  M = N;
  i = 2;
  if (N == 1) {
    cout << 0;
    return 0;
  }
  ll MAX = sqrt(N) + 1;
  while (N > 1 && i < MAX) {
    if (N % i == 0) {
      d[i]++;
      N /= i;
    } else {
      i++;
    }
  }
  if (N == M) {
    cout << 1;
    return 0;
  } else {
    if (N != 1) {
      d[N]++;
    }
  }
  ll ans = 0;
  rep(i, 2, 1000000) {
    for (j = 1;; j++) {
      if (d[i] < j) {
        break;
      }
      d[i] -= j;
      ans++;
    }
  }
  cout << ans;
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> func(int64_t x) {
  vector<pair<int64_t, int64_t>> p;
  for (int64_t i = 2; i * i <= x; i++) {
    int cnt = 0;
    if (x % i == 0) {
      while (x % i == 0) {
        cnt++;
        x /= i;
      }
      p.push_back(make_pair(i, cnt));
    }
  }
  if (x != 1) {
    p.push_back(make_pair(x, 1));
  }
  return p;
}

int main() {
  int64_t N;
  cin >> N;
  auto k = func(N);
  int ans = 0;
  for (auto a : k) {
    int t = a.second;
    int tmp = 1, count = 0;
    while (t >= tmp) {
      t -= tmp;
      tmp++;
      count++;
    }
    ans += count;
  }
  cout << ans << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> func(int64_t x) {
  vector<pair<int64_t, int64_t>> p;
  for (int i = 2; i * i <= x; i++) {
    int cnt = 0;
    if (x % i == 0) {
      while (x % i == 0) {
        cnt++;
        x /= i;
      }
      p.push_back(make_pair(i, cnt));
    }
  }
  if (x != 1) {
    p.push_back(make_pair(x, 1));
  }
  return p;
}

int main() {
  int64_t N;
  cin >> N;
  auto k = func(N);
  int ans = 0;
  for (auto a : k) {
    int t = a.second;
    int tmp = 1, count = 0;
    while (t >= tmp) {
      t -= tmp;
      tmp++;
      count++;
    }
    ans += count;
  }
  cout << ans << endl;
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i, n) for (int i = 0; i < n; i++)

ll Prime_factorize(ll n) {
  ll cnt = 0;
  for (ll i = 2; i * i <= n; i++) {
    ll th = 1;
    ll now = 0;
    while (n % i == 0) {
      now++;
      if (th == now) {
        cnt++;
        now = 0;
        th++;
      }
      n /= i;
    }
    if (i != 2)
      i++;
  }
  if (n != 1)
    cnt++;
  return cnt;
}

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

  ll cnt = Prime_factorize(n);

  cout << cnt << endl;

  return 0;
}

Error: TLE

Fixed submission:

// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i, n) for (int i = 0; i < n; i++)

// int Prime_factorize(ll n) {
//     int cnt=0;
//     for (int i=2; i*i<=n; i++) {
//         int th = 1;
//         int now = 0;
//         while (n%i == 0) {
//             now++;
//             if (th == now) {
//                 cnt++;
//                 now = 0;
//                 th++;
//             }
//             n /= i;
//         }
//         if (i != 2) i++;
//     }
//     if(n != 1) cnt++;
//     return cnt;
// }

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

//     int cnt = Prime_factorize(n);

//     cout << cnt << endl;

//     return 0;
// }

vector<int> res;
void Prime_factorize(ll n) {
  for (int i = 2; i * i <= n; i++) {
    int cnt = 0;
    while (n % i == 0) {
      cnt++;
      n /= i;
    }
    res.push_back(cnt);
    if (i != 2)
      i++;
  }
  if (n != 1)
    res.push_back(1);
}

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

  Prime_factorize(n);

  int ans = 0;
  for (int cnt : res) {
    int th = 1;
    while (cnt >= th) {
      ans++;
      cnt -= th;
      th++;
    }
  }

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

// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i, n) for (int i = 0; i < n; i++)

int Prime_factorize(ll n) {
  int cnt = 0;
  for (ll i = 2; i * i <= n; i++) {
    int th = 1;
    int now = 0;
    while (n % i == 0) {
      now++;
      if (th == now) {
        cnt++;
        now = 0;
        th++;
      }
      n /= i;
    }
    if (i != 2)
      i++;
  }
  if (n != 1)
    cnt++;
  return cnt;
}

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

  int cnt = Prime_factorize(n);

  cout << cnt << endl;

  return 0;
}

Error: TLE

Fixed submission:

// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i, n) for (int i = 0; i < n; i++)

int Prime_factorize(ll n) {
  int cnt = 0;
  for (int i = 2; i * i <= n; i++) {
    int th = 1;
    int now = 0;
    while (n % i == 0) {
      now++;
      if (th == now) {
        cnt++;
        now = 0;
        th++;
      }
      n /= i;
    }
    if (i != 2)
      i++;
  }
  if (n != 1)
    cnt++;
  return cnt;
}

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

  int cnt = Prime_factorize(n);

  cout << cnt << endl;

  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> pll;
const ll inf = 1LL << 60;
const int pp = 1e6 + 10;

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  // cout << fixed << setprecision(15);
  ll N;
  cin >> N;
  vector<bool> is_prime(pp + 1, true);
  REP(i, pp + 1) {
    if (i == 0 || i == 1) {
      is_prime[i] = false;
    }
    if (is_prime[i] == true) {
      for (int k = 2 * i; k <= pp; k += i) {
        is_prime[k] = false;
      }
    }
  }
  vector<int> prime(pp + 1, 0);
  int itr = 0;
  for (ll i = 2; i * i <= N; i++) {
    if (is_prime[i]) {
      while (N % i == 0) {
        N /= i;
        prime[itr]++;
      }
      itr++;
      if (N == 1)
        break;
    }
  }
  if (N > 1) {
    prime[itr]++;
    itr++;
  }

  int ans = 0;
  REP(i, itr) {
    int k = 1;
    while (k * (k + 1) / 2 <= prime[i]) {
      k++;
    }
    k--;
    ans += k;
  }
  cout << ans << endl;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> pll;
const ll inf = 1LL << 60;
const int pp = 1e6 + 10;

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  // cout << fixed << setprecision(15);
  ll N;
  cin >> N;
  vector<bool> is_prime(pp + 1, true);
  REP(i, pp + 1) {
    if (i == 0 || i == 1) {
      is_prime[i] = false;
    }
    if (is_prime[i] == true) {
      for (int k = 2 * i; k <= pp; k += i) {
        is_prime[k] = false;
      }
    }
  }
  vector<int> prime(pp + 1, 0);
  int itr = 0;
  for (int i = 2; i * i <= N; i++) {
    if (is_prime[i]) {
      while (N % i == 0) {
        N /= i;
        prime[itr]++;
      }
      itr++;
      if (N == 1)
        break;
    }
  }
  if (N > 1) {
    prime[itr]++;
    itr++;
  }

  int ans = 0;
  REP(i, itr) {
    int k = 1;
    while (k * (k + 1) / 2 <= prime[i]) {
      k++;
    }
    k--;
    ans += k;
  }
  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
// #include <bits/stdc++.h>
#include <vector>

using namespace std;

vector<pair<long long, long long>> prime_factorize(long long N) {
  vector<pair<long long, long long>> res;
  for (long long i = 2; i * i < N; i++) {
    if (N % i != 0) {
      continue;
    }
    long long ex = 0;

    while (N % i == 0) {
      ++ex;
      N /= i;
    }
    res.push_back({i, ex});
  }
  if (N != 1) {
    res.push_back({N, 1});
  }
  return res;
}

int main() {
  long long N;
  cin >> N;

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

  auto list = prime_factorize(N);
  // for (auto a : list) {
  //		cout << "{ " << a.first << " " << a.second << " }" << endl;
  // }
  // cout << endl;

  int ans = 0;
  for (auto p : list) {
    int x = p.second;
    int b = 1;
    while (b <= x) {
      x -= b;
      b++;
      ++ans;
    }
  }
  cout << ans << endl;
}


Error: 0

Fixed submission:

#include <iostream>
// #include <bits/stdc++.h>
#include <vector>

using namespace std;

vector<pair<long long, long long>> prime_factorize(long long N) {
  vector<pair<long long, long long>> res;
  for (long long i = 2; i * i < N; i++) {
    if (N % i != 0) {
      continue;
    }
    long long ex = 0;

    while (N % i == 0) {
      ++ex;
      N /= i;
    }

    res.push_back({i, ex});
  }
  if (N != 1) {
    res.push_back({N, 1});
  }
  return res;
}

int main() {
  long long N;
  cin >> N;

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

  auto list = prime_factorize(N);
  // for (auto a : list) {
  //		for ( int i = 0 ; i < a.second; i++) {
  //				cout << a.first << " ";
  //		}
  // }
  // cout << endl;

  vector<bool> used(N, false);
  int res = 0;
  for (auto a : list) {
    auto tmp = a.first;
    while (a.second > 0) {
      if (used[tmp]) {
        tmp = tmp * tmp;
      } else {
        used[tmp] = true;
        res += 1;
      }
      a.second -= 1;
    }
  }
  cout << res << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

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

signed main() {
  int n;
  cin >> n;
  int ans = 0;
  int temp = n;
  std::map<int, int> m;
  while (n % 2 == 0) {
    m[2]++;
    n /= 2;
  }
  for (int i = 3; i <= sqrt(temp) && n > 1; i += 2) {
    while (n % i == 0) {
      m[i]++;
      n /= i;
    }
  }
  std::map<int, int>::iterator it = m.begin();
  for (it = m.begin(); it != m.end(); ++it) {
    // cout << it->first << ' ' << it->second << endl ;
    ans += (sqrt(1 + (8 * (it->second))) - 1) / 2;
  }
  if (n > sqrt(temp)) {
    ans += 1;
  }
  cout << ans << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

signed main() {
  int n;
  cin >> n;
  int ans = 0;
  int temp = n;
  std::map<int, int> m;
  while (n % 2 == 0) {
    m[2]++;
    n /= 2;
  }
  for (int i = 3; i <= n && n > 0; i += 2) {
    while (n % i == 0) {
      m[i]++;
      n /= i;
    }
  }
  std::map<int, int>::iterator it = m.begin();
  for (it = m.begin(); it != m.end(); ++it) {
    // cout << it->first << ' ' << it->second << endl ;
    ans += (sqrt(1 + (8 * (it->second))) - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

const map<LLONG, LLONG> Divide(LLONG N) {
  map<LLONG, LLONG> prime2NumMap;
  for (LLONG p = 2; p * p <= N; ++p) {
    if (N % p != 0)
      continue;
    while (N % p == 0) {
      N /= p;
      ++prime2NumMap[p];
    }
  }
  if (N != 1)
    prime2NumMap[N] = 1;
  return prime2NumMap;
}

int main() {
  LLONG N;
  cin >> N;
  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }
  const auto prime2NumMap = Divide(N);
  LLONG ans = 0;
  for (const auto &kvp : prime2NumMap) {
    LLONG num = kvp.second;
    LLONG e = 1;
    while (num >= e) {
      ++ans;
      num -= e;
      ++e;
    }
  }
  cout << ans << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

const bool IsPrime(const LLONG N) {
  if (N == 2 || N == 3)
    return true;
  for (LLONG p = 2; p < sqrt(N) + 1; ++p) {
    if (N % p == 0)
      return false;
  }
  return true;
}

const map<LLONG, LLONG> Divide(LLONG N) {
  map<LLONG, LLONG> prime2NumMap;
  if (IsPrime(N)) {
    prime2NumMap[N] = 1;
    return prime2NumMap;
  }
  LLONG p = 2;
  while (N > 1) {
    if (IsPrime(p)) {
      while (N % p == 0) {
        N /= p;
        ++prime2NumMap[p];
      }
      ++p;
    } else {
      ++p;
    }
  }
  return prime2NumMap;
}

int main() {
  LLONG N;
  cin >> N;
  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }
  const auto prime2NumMap = Divide(N);
  LLONG ans = 0;
  for (const auto &kvp : prime2NumMap) {
    LLONG num = kvp.second;
    for (LLONG n = sqrt(num * 2) + 2; n > 0; --n) {
      if (n * (n + 1) / 2 <= num) {
        ans += n;
        break;
      }
    }
    // LLONG e = 1;
    // while (num >= e)
    //{
    //     ++ans;
    //     num -= e;
    //     ++e;
    // }
  }
  cout << ans << endl;
}