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

#include <bits/stdc++.h>
using namespace std;
#include <numeric>
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
#define endl "\\n"
#define int long long int
#define mod 1000000007
#define INT_BITS 16
#define inf 1000000099
#define pi 3.141592
#define watch(x) cout << (#x) << "=" << (x) << "\\n"
#define pb push_back

set<int> primeFactors(int n) {
  set<int> us;
  // Print the number of 2s that divide n
  while (n % 2 == 0) {
    us.insert(2);
    n = n / 2;
  }

  // n must be odd at this point.  So we can skip
  // one element (Note i = i +2)
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    // While i divides n, print i and divide n
    while (n % i == 0) {
      us.insert(i);
      n = n / i;
    }
  }

  // This condition is to handle the case when n
  // is a prime number greater than 2
  if (n > 2)
    us.insert(n);

  return us;
}

int32_t main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  set<int> us = primeFactors(n);
  unordered_map<int, vector<int>> um;
  for (auto x : us) {
    for (int i = 1; i <= 10; i++) {
      um[x].push_back(pow(x, i));
    }
  }
  int count = 0;
  for (auto x : us) {
    int val = pow(x, 1);
    int i = 0;
    while (val <= n) {
      i++;
      if (n % val == 0) {
        n /= val;
        count++;
        val = um[x][i];
        // watch(val);
      } else
        break;
    }
    // cout<<x<<" ";
  }
  cout << count << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#include <numeric>
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
#define endl "\\n"
#define int long long int
#define mod 1000000007
#define INT_BITS 16
#define inf 1000000099
#define pi 3.141592
#define watch(x) cout << (#x) << "=" << (x) << "\\n"
#define pb push_back

set<int> primeFactors(int n) {
  set<int> us;
  // Print the number of 2s that divide n
  while (n % 2 == 0) {
    us.insert(2);
    n = n / 2;
  }

  // n must be odd at this point.  So we can skip
  // one element (Note i = i +2)
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    // While i divides n, print i and divide n
    while (n % i == 0) {
      us.insert(i);
      n = n / i;
    }
  }

  // This condition is to handle the case when n
  // is a prime number greater than 2
  if (n > 2)
    us.insert(n);

  return us;
}

int32_t main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  set<int> us = primeFactors(n);
  int count = 0;
  for (auto x : us) {
    int val = pow(x, 1);
    int i = 1;
    while (val <= n) {
      i++;
      if (n % val == 0) {
        n /= val;
        count++;
      }
      val = pow(x, i);
    }
    // cout<<x<<" ";
  }
  cout << count << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) {
  return b > a && (a = b, true);
}
template <class A, class B> inline bool chmin(A &a, const B &b) {
  return b < a && (a = b, true);
}
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a, x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for (int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};
#define stp(x) setprecision(x)
vlong so;
int findFactors(ll num) {
  ll i;
  bool fg = true;
  for (i = 2; i * i <= num; i++) { // 他の素数で割っていく
    while (num % i == 0) {
      fg = false;
      so.push_back(i);
      num /= i;
    }
  }
  if (num != 1) {
    so.push_back(num);
  }
  return 0;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  if (n == 1) {
    cout << 0 << '\\n';
    return (0);
  }
  findFactors(n);
  int now = 2, count = 1, ans = 0, fg = 1;
  ll test = 1;
  rep(i, (int)so.size()) {
    if (now == so[i]) {
      count--;
      if (count == 0) {
        ans++;
        fg++;
        count = fg;
      }
    } else {
      now = so[i];
      ans++;
      fg = 2;
      count = 2;
    }
  }
  cout << ans << '\\n';
  return (0);
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) {
  return b > a && (a = b, true);
}
template <class A, class B> inline bool chmin(A &a, const B &b) {
  return b < a && (a = b, true);
}
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a, x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for (int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};
#define stp(x) setprecision(x)
vlong so;
int findFactors(ll num) {
  int i;
  bool fg = true;
  for (i = 2; i * i <= num; i++) { // 他の素数で割っていく
    while (num % i == 0) {
      fg = false;
      so.push_back(i);
      num /= i;
    }
  }
  if (num != 1) {
    so.push_back(num);
  }
  return 0;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  if (n == 1) {
    cout << 0 << '\\n';
    return (0);
  }
  findFactors(n);
  int now = 2, count = 1, ans = 0, fg = 1;
  ll test = 1;
  rep(i, (int)so.size()) {
    if (now == so[i]) {
      count--;
      if (count == 0) {
        ans++;
        fg++;
        count = fg;
      }
    } else {
      now = so[i];
      ans++;
      fg = 2;
      count = 2;
    }
  }
  cout << ans << '\\n';
  return (0);
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main(void) {
  long long int n;
  cin >> n;
  int ans = 0;
  for (long long int i = 2; i * i <= n; i++) {
    int k = 0;
    int j = 0;
    while (n % i == 0) {
      if (j >= k) {
        k++;
        ans++;
        j = 0;
      } else {
        j++;
      }
      n /= i;
    }
  }
  if (n > 1)
    ans++;

  cout << ans;
}


Error: TLE

Fixed submission:

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

int main(void) {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 2; i * i <= n; i++) {
    int k = 0;
    int j = 0;
    while (n % i == 0) {
      if (j >= k) {
        k++;
        ans++;
        j = 0;
      } else {
        j++;
      }
      n /= i;
    }
  }
  if (n > 1)
    ans++;

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

#include <bits/stdc++.h>
/**
AHMAD;HASSAN;SAEED
*/
using namespace std;
bool isPrim(long long a) {
  if (a == 1ll)
    return false;
  for (long long i = 2ll; i * i <= a; i++) {
    if (a % i == 0)
      return false;
  }
  return true;
}
int main() {

  long long a;
  cin >> a;
  long long ans = 0ll;
  long long tma = a;
  for (long long i = 1ll; i * i <= tma; i++) {

    if (isPrim(i) && (a % i == 0ll)) {
      long long num = i;
      while (a % num == 0) {
        a /= num;
        ans++;
        num *= i;
      }
    }
    if (isPrim((tma / i)) && (a % (tma / i) == 0ll) && (a / i != i)) {
      long long num = (tma / i);
      while (a % num == 0) {
        a /= num;
        ans++;
        num *= (tma / i);
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
/**
AHMAD;HASSAN;SAEED
*/
using namespace std;
bool isPrim(long long a) {
  if (a == 1ll)
    return false;
  for (long long i = 2ll; i * i <= a; i++) {
    if (a % i == 0)
      return false;
  }
  return true;
}
int main() {

  long long a;
  cin >> a;
  long long ans = 0ll;
  long long tma = a;
  for (long long i = 1ll; i * i <= tma; i++) {
    if (i > a)
      break;
    if (isPrim(i) && (a % i == 0ll)) {
      long long num = i;
      while (a % num == 0) {
        a /= num;
        ans++;
        num *= i;
      }
    }
    if (isPrim(a / i) && (a % i == 0ll) && (a / i != i)) {
      long long num = a / i;
      while (a % num == 0) {
        a /= num;
        ans++;
        num *= a / i;
      }
    }
  }

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

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define EL '\\n'
#define print(i) std::cout << (i) << '\\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
constexpr lnt INF = 2e18;
/*-*/

int main() {
  lnt n;
  std::cin >> n;
  lnt sum = 0;
  for (lnt i = 2; i * i <= n; i++) {
    if (n % i)
      continue;
    lnt count = 0;
    while (n % i == 0) {
      n /= i;
      count++;
    }
    sum += (lnt)(std::sqrt((long double)count * 2 + 0.25) - 0.5);
  }
  if (n != 1)
    sum += 1;
  print(sum);
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define EL '\\n'
#define print(i) std::cout << (i) << '\\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
constexpr lnt INF = 2e18;
/*-*/

void prime_factorize(lnt n, std::map<int, int> &prime_factors) {
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n]++;
}

int main() {
  lnt n;
  std::cin >> n;
  std::map<int, int> map;
  prime_factorize(n, map);
  lnt sum = 0;
  for (auto e : map) {
    lnt x = e.second;
    lnt l = -1, r = 10000;
    while (r - l > 1) {
      lnt o = (l + r) >> 1;
      if ((1 + o) * o / 2 > x)
        r = o;
      else
        l = o;
    }
    sum += l;
  }
  print(sum);
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll n;
int ans, p;

int main() {
  cin >> n;

  for (ll i = 2; i * i <= n; ++i) {
    p = i;
    while (n % p == 0) {
      n /= p;
      ans++;
      p *= i;
    }
    while (n % i == 0) {
      n /= i;
    }
  }
  if (n != 1) {
    ans++;
  }
  cout << ans << endl;

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll n;
int ans, p;

int main() {
  cin >> n;

  for (int i = 2; i * i <= n; ++i) {
    p = i;
    while (n % p == 0) {
      n /= p;
      ans++;
      p *= i;
    }
    while (n % i == 0) {
      n /= i;
    }
  }
  if (n != 1) {
    ans++;
  }
  cout << ans << endl;

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

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

typedef long long int lli;
typedef long int li;

lli solve(lli x) { return (sqrt(1 + 8.0 * x) - 1) / 2; }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  lli n;
  cin >> n;
  vector<int> v;

  lli ans = 0;
  int p = 0;
  while (n % 2 == 0) {
    p++;
    n = n / 2;
  }

  if (p != 0)
    v.push_back(p);
  for (int i = 3; i <= sqrt(n); i += 2) {
    p = 0;
    while (n > 0 && n % i == 0) {
      p++;
      n /= i;
    }
    if (p != 0)
      v.push_back(p);
  }

  if (n > 2)
    ans++;
  // cout << n << endl;
  for (lli x : v) {
    // cout << x << endl;
    ans += solve(x);
  }
  cout << ans << '\\n';
}

/*
        check for corner cases.
        When using log check for zeros.
        Use queues and stacks if they are helping.

    (___)
    . . )____________
   _|__/\\           |\\
  (o_o_) \\__________| \\
           /|     ||   )
          < |     ||
*/


Error: TLE

Fixed submission:

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

typedef long long int lli;
typedef long int li;

lli solve(lli x) { return (sqrt(1 + 8.0 * x) - 1) / 2; }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  lli n;
  cin >> n;
  vector<int> v;

  lli ans = 0;
  int p = 0;
  while (n % 2 == 0) {
    p++;
    n = n / 2;
  }
  if (p != 0)
    v.push_back(p);
  for (int i = 3; i * i <= n; i += 2) {
    p = 0;
    while (n > 0 && n % i == 0) {
      p++;
      n /= i;
    }
    if (p != 0)
      v.push_back(p);
  }

  if (n > 2)
    ans++;
  // cout << n << endl;
  for (lli x : v) {
    // cout << x << endl;
    ans += solve(x);
  }
  cout << ans << '\\n';
}

/*
        check for corner cases.
        When using log check for zeros.
        Use queues and stacks if they are helping.

    (___)
    . . )____________
   _|__/\\           |\\
  (o_o_) \\__________| \\
           /|     ||   )
          < |     ||
*/
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;

bool hantei(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0)
      return 0;
  }
  return n > 1;
}

map<ll, ll> bunkai(ll n) {
  map<ll, ll> m;
  if (n == 1) {
    m[n]++;
    return m;
  }
  int b{2};
  if (hantei(n)) {
    m[n]++;
    return m;
  }
  while (1) {
    if (n % b == 0) {
      m[b]++;
      n /= b;
      if (hantei(n)) {
        m[n]++;
        break;
      }
    } else
      b += b % 2 + 1;
  }
  return m;
}

int main() {
  ll n;
  cin >> n;
  if (hantei(n)) {
    cout << 1 << endl;
    return 0;
  } else if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  auto m = bunkai(n);
  vector<ll> a(10);
  for (int i = 1; i < 10; i++) {
    a.at(i) = a.at(i - 1) + i;
  }
  ll ans{};
  for (auto i : m) {
    ll e = i.second;
    auto it = upper_bound(a.begin(), a.end(), e);
    ans += it - a.begin() - 1;
  }
  cout << ans << endl;
}


Error: 0

Fixed submission:

//
//  main.cpp
//  ABC_169_D
//
//  Created by Joe Mori on 2020/05/31.
//  Copyright © 2020 Joe Mori. All rights reserved.
//

#include <iostream>
#include <queue>
#include <vector>
bool is_prime(long long N) {
  if (N == 1)
    return false;
  for (long long i = 2; i * i <= N; ++i) {
    if (N % i == 0)
      return false;
  }
  return true;
}
int main() {
  // insert code here...
  long long int a;
  std::cin >> a;
  long long int count = 0;
  long long int i;
  //    std::vector<int>vec(a/2);
  i = 2;
  std::queue<long long int> q;

  if (is_prime(a)) {
    std::cout << 1 << std::endl;
  } else {
    for (long long int l = 2; l * l < a; l++) {
      if (is_prime(l)) {
        if (a % l == 0) {
          count++;
          a = a / l;
          q.push(l);
        }
      }
    }
    while (true) {
      if (a % i == 0 && q.front() != i) {
        count++;
        a = a / i;
      }
      if (q.front() == i || q.front() < i)
        q.pop();

      i++;
      long long c_i;
      c_i = i;
      if (is_prime(i)) {
        continue;
      } else {
        long long int j = 2;
        while (true) {
          if (c_i % j == 0) {
            c_i = c_i / j;
          } else if (c_i != i && c_i != 1) {
            i++;
            break;
          } else {
            j++;
          }
          if (j * j > 2 || c_i == 1)
            break;
        }
      }
      if (a == 1 || i > a)
        break;
    }
    std::cout << count << std::endl;
  }
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

int main() {
  int64_t n;
  cin >> n;
  int64_t ans = 0;
  for (int64_t i = 2; i * i < n; i++) {
    int64_t a = 0;
    while (n % i == 0) {
      a++;
      n /= i;
    }
    for (int64_t j = 1; j <= a; j++) {
      a -= j;
      ans++;
    }
  }
  if (n != 1)
    ans++;
  cout << ans << endl;
  return 0;
}


Error: -8

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

const int64_t INF = pow(10, 6);

int main() {
  int64_t n;
  cin >> n;
  int64_t array[INF];
  for (int64_t i = 0; i * i < n; i++) {
    while (n % i == 0) {
      array[i]++;
    }
  }
  int64_t ans = 0;
  for (int64_t i = 0; i < INF; i++) {
    if (array[i] > 0) {
      for (int64_t j = 1; j < array[i]; j++) {
        array[i] -= j;
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
/// first: primo   second: exponente
vector<pair<ll, ll>> Canon;
int Gau[50];
void Prec() {
  int i;
  for (i = 1; i < 50; i++) {
    Gau[i] = Gau[i - 1] + i;
  }
  return;
}
int main() {
  ll N, Aux;
  cin >> N;
  ll i, j;
  Aux = N;
  if (Aux % 2 == 0) {
    Aux /= 2;
    Canon.push_back({2, 1});
    while (Aux % 2 == 0) {
      Aux /= 2;
      Canon[Canon.size() - 1].second += 1;
    }
  }
  if (Aux % 3 == 0) {
    Aux /= 3;
    Canon.push_back({3, 1});
    while (Aux % 3 == 0) {
      Aux /= 3;
      Canon[Canon.size() - 1].second += 1;
    }
  }
  if (Aux % 5 == 0) {
    Aux /= 5;
    Canon.push_back({5, 1});
    while (Aux % 5 == 0) {
      Aux /= 5;
      Canon[Canon.size() - 1].second += 1;
    }
  }
  for (i = 6; i * i <= Aux; i += 6) {
    if (Aux % (i + 1) == 0) {
      Aux /= (i + 1);
      Canon.push_back({i + 1, 1});
      while (Aux % (i + 1) == 0) {
        Aux /= (i + 1);
        Canon[Canon.size() - 1].second += 1;
      }
    }
    if (Aux % (i + 5) == 0) {
      Aux /= (i + 5);
      Canon.push_back({i + 5, 1});
      while (Aux % (i + 5) == 0) {
        Aux /= (i + 5);
        Canon[Canon.size() - 1].second += 1;
      }
    }
  }
  if (Aux > 1)
    Canon.push_back({Aux, 1});
  Prec();
  int Ans = 0;
  for (i = 0; i < Canon.size(); i++) {
    j = 1;
    while (Canon[i].second >= Gau[j])
      j += 1;
    Ans += j - 1;
  }
  cout << Ans;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int respuesta(int A) {
  int cnt = 1;
  while (cnt < A - cnt) {
    A -= cnt;
    cnt++;
  }
  return cnt;
}

int main() {
  long long int N;
  cin >> N;
  long long int cnt, ans = 0;
  for (long long int i = 1; i * i <= N; i++) {
    if (N % i == 0) {
      cnt = 0;
      while (N % i == 0)
        N /= i, cnt++;
      ans += respuesta(cnt);
    }
  }
  if (N > 1)
    ans++;
  cout << ans;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {

  ll N;
  cin >> N;

  ll buf = N;
  map<ll, ll> divisor;
  ll div = 2;
  ll thr = sqrt(N);
  bool flg = false;

  // 素因数分解
  if (buf == 1) {
    cout << 0 << endl;
    return 0;
  } else {
    for (div = 2; div < thr + 1; div++) {
      while (buf % div == 0) {
        buf /= div;
        divisor[div]++;
        flg = true;
      }
    }

    //        if (flg == false) {
    //            divisor[N]++;
    //        }
    if (buf != 1) {
      divisor[N]++;
    }
  }

  // 次数をカウント
  ll ans = 0;
  for (auto p : divisor) {
    auto value = p.second;

    int sub = 1;
    while (value - sub >= 0) {
      value -= sub;
      sub++;
      ans++;
    }
  }

  cout << ans << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {

  ll N;
  cin >> N;

  ll buf = N;
  map<ll, ll> divisor;
  ll div = 2;
  ll thr;
  thr = sqrt(N);
  bool flg = false;

  if (buf == 1) {
    cout << 0 << endl;
    return 0;
  } else {
    while (buf != 1) {
      while (buf % div == 0) {
        buf /= div;
        divisor[div - 1]++;
        flg = true;
      }
      div++;

      if ((div > thr) && (flg == false)) {
        divisor[N]++;
        break;
      }
    }
  }

  ll ans = 0;
  for (auto p : divisor) {
    auto value = p.second;

    int sub = 1;
    while (value != 0) {
      value -= sub;
      sub++;
      ans++;

      if (sub > value)
        break;
    }
  }

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

#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n)-1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
  ll n;
  cin >> n;
  vector<int> p(1000010, 0);
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      p[i]++;
      n /= i;
    }
  }

  ll ans = 0;
  if (n != 1)
    ans++;

  for (auto &&i : p) {
    ll pnum = i;
    ll cnt = 1;
    while (pnum - cnt >= 0) {
      ans++;
      pnum -= cnt;
      cnt++;
    }
  }
  cout << ans << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n)-1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
  ll n;
  cin >> n;
  vector<ll> p(1000010, 0);
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      p[i]++;
      n /= i;
    }
  }

  ll ans = 0;
  if (n != 1)
    ans++;

  for (auto &&i : p) {
    ll pnum = i;
    ll cnt = 1;
    while (pnum - cnt >= 0) {
      ans++;
      pnum -= cnt;
      cnt++;
    }
  }
  cout << ans << endl;
}