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

#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int mark[N], prime[N], f[55];
long long cnt, n, ans;
void getPrime();
long long find(long long x);
int main() {
  getPrime();
  cin >> n;
  for (int i = 1; i <= 50; i++) {
    f[i] = find(i);
  }
  for (int i = 0; i < cnt && prime[i] * prime[i] <= n; i++) {
    if (n % prime[i] == 0) {
      long long num = 0;
      // cout<<prime[i]<<' ';
      while (n % prime[i] == 0) {
        num++;
        n /= prime[i];
      }
      ans += f[num];
    }
  }
  if (n != 1)
    ans++;
  cout << ans;
  return 0;
}
void getPrime() {
  for (int i = 2; i < N; i++) {
    if (!mark[i])
      prime[cnt++] = i;
    for (int j = 0; j < cnt && prime[j] * i < N; j++) {
      mark[i * prime[j]] = 1;
      if (i % prime[j] == 0)
        break;
    }
  }
}
long long find(long long x) {
  int l = 1, r = 1000000, res = -1;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (mid * (mid + 1) / 2 <= x) {
      res = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  return res;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
bool isPrime_3(long long n);
int main() {
  long long n, ans = 0, z = 2;
  cin >> n;
  while (!isPrime_3(n) && n != 1) {
    if (!isPrime_3(z)) {
      z++;
      continue;
    }
    long long temp = 1;
    for (int i = 1; temp <= n; i++) {
      temp *= z;
      if (n % temp == 0) {
        ans++;
        // cout<<temp<<' ';
        m[temp] = 1;
        n /= temp;
        // cout<<n<<endl;
      }
    }
    z++;
  }
  if (n != 1 && m[n] != 1)
    ans++;
  cout << ans;
  return 0;
}
bool isPrime_3(long long n) {
  if (n < 2)
    return 0;
  if (n == 2 || n == 3)
    return 1;
  if (n % 6 != 1 && n % 6 != 5)
    return 0;
  for (int i = 5; i <= floor(sqrt(n)); i += 6)
    if (n % i == 0 || n % (i + 2) == 0)
      return 0;
  return 1;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;
int main() {
  long long n;
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  vector<pair<long long, int>> v;
  for (long long i = 2; i * i <= n; ++i) {
    int cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    if (cnt != 0)
      v.emplace_back(i, cnt);
  }
  if (n != 1)
    v.emplace_back(n, 1);

  int res = 0;
  for (auto c : v) {
    int x = c.second;
    int a = 1;
    while (x >= a) {
      res++;

      x -= a;
      a++;
    }
  }
  cout << res;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
int main() {
  int n;
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  vector<pair<long long, int>> v;
  for (int i = 2; i * i <= n; ++i) {
    int cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    if (cnt != 0)
      v.emplace_back(make_pair(i, cnt));
  }
  if (n != 1)
    v.emplace_back(n, 1);

  int res = 0;
  for (auto c : v) {
    int x = c.second;
    int a = 1;
    while (x >= a) {
      res++;

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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  ll n;
  int ans = 0;
  cin >> n;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      int cnt = 0;
      while (n % i == 0) {
        n /= i;
        cnt++;
      }
      int tmp = 1;
      while (cnt >= tmp) {
        ++ans;
        cnt -= tmp;
        ++tmp;
      }
    }
  }
  if (n != 1)
    ++ans;
  cout << ans << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  ll n;
  int ans = 0;
  cin >> n;
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      int cnt = 0;
      while (n % i == 0) {
        n /= i;
        cnt++;
      }
      int tmp = 1;
      while (cnt >= tmp) {
        ++ans;
        cnt -= tmp;
        ++tmp;
      }
    }
  }
  if (n != 1)
    ++ans;
  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

namespace {
map<ll, int> PrimeFactorization(ll x) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= x; ++i) {
    while (x % i == 0) {
      x /= i;
      ++ret[i];
    }
  }
  if (x > 1) {
    ++ret[x];
  }
  return ret;
}
} // namespace

void ABC169D() {
  ll N;
  cin >> N;

  map<ll, int> pf = PrimeFactorization(N);
  int ct = 0;
  for (auto &x : pf) {
    int n = x.second;
    int i = 1;

    while (i <= n) {
      ++ct;
      n -= i;
      ++i;
    }
  }
  cout << ct << endl;
}
int main() {
  ABC169D();
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

namespace {
map<ll, int> PrimeFactorization(ll x) {
  map<ll, int> ret;
  for (int i = 2; i * i <= x; ++i) {
    while (x % i == 0) {
      x /= i;
      ++ret[i];
    }
  }
  if (x > 1) {
    ++ret[x];
  }
  return ret;
}
} // namespace

void ABC169D() {
  ll N;
  cin >> N;

  map<ll, int> pf = PrimeFactorization(N);
  int ct = 0;
  for (auto &x : pf) {
    int n = x.second;
    int i = 1;
    while (i <= n) {
      ++ct;
      n -= i;
      ++i;
    }
  }
  cout << ct << endl;
}
int main() {
  ABC169D();
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  vector<pair<ll, int>> fs;
  for (ll i = 2; i * i <= n; ++i) {
    int x = 0;
    while (n % i == 0) {
      n /= i;
      ++x;
    }
    fs.emplace_back(i, x);
  }
  if (n != 1)
    fs.emplace_back(n, 1);

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  vector<pair<ll, int>> prime;
  for (int i = 2; i * i <= n; ++i) {
    int x = 0;
    while (n % i == 0) {
      n /= i;
      ++x;
    }
    prime.emplace_back(i, x);
  }
  if (n != 1) {
    prime.emplace_back(n, 1);
  }

  int ans = 0;
  for (auto v : prime) {
    int x = v.second;
    int b = 1;
    while (b <= x) {
      x -= b;
      b = b + 1;
      ans++;
    }
  }

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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n = 1) : n(n), f(n + 1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i])
        continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i * i; j <= n; j += i) {
        if (!f[j])
          f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x; }
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0)
      return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll, int>> factor(ll x) {
    vector<pair<ll, int>> res;
    for (int p : primes) {
      int y = 0;
      while (x % p == 0)
        x /= p, ++y;
      if (y != 0)
        res.emplace_back(p, y);
    }
    if (x != 1)
      res.emplace_back(x, 1);
    return res;
  }
};

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

  Sieve s(1000005);
  auto fs = s.factor(n);

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


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  vector<pair<ll, int>> prime;
  for (int i = 2; i * i <= n; i++) {
    int x = 0;
    while (n % i == 0) {
      n /= i;
      x++;
    }
    prime.emplace_back(i, x);
  }
  if (n != 1) {
    prime.emplace_back(n, 1);
  }

  int ans = 0;
  for (auto v : prime) {
    int x = v.second;
    int b = 1;
    while (b <= x) {
      x -= b;
      b++;
      ans++;
    }
  }

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

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

const int nMax = 1000000;

class Sieve {
private:
  int n;
  vector<int> f, primes;

public:
  Sieve(int v = 1) : n(v), f(n + 1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; i++) {
      if (f[i])
        continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i * i; j <= n; j += i) {
        if (!f[j])
          f[j] = f[i];
      }
    }
  }

  vector<pair<ll, int>> factor(ll x) {
    vector<pair<ll, int>> res;
    for (const auto &p : primes) {
      int y = 0;
      while (x % p == 0) {
        x /= p;
        y++;
      }
      if (y != 0)
        res.emplace_back(p, y);
    }
    if (x != 1)
      res.emplace_back(x, 1);
    return res;
  }
};

int main() {
  ll n;
  cin >> n;
  Sieve s(nMax);
  vector<pair<ll, int>> fs = s.factor(n);

  int ans = 0;
  for (const auto &item : fs) {
    int shoulder = item.second;
    int start = 1;
    while (start <= shoulder) {
      shoulder -= start;
      start++;
      ans++;
    }
  }
  cout << ans << endl;
}


Error: -11

Fixed submission:

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

const int nMax = 1000000;

class Sieve {
private:
  int n;
  vector<int> f, primes;

public:
  Sieve(int v = 1) : n(v), f(n + 1) {
    f[0] = f[1] = -1;
    for (int i = 2; i <= n; i++) {
      if (f[i])
        continue;
      primes.push_back(i);
      f[i] = i;
      for (int j = i * i; j <= n; j += i) {
        if (!f[j])
          f[j] = f[i];
      }
    }
  }

  vector<pair<ll, int>> factor(ll x) {
    vector<pair<ll, int>> res;
    for (const auto &p : primes) {
      int y = 0;
      while (x % p == 0) {
        x /= p;
        y++;
      }
      if (y != 0)
        res.emplace_back(p, y);
    }
    if (x != 1)
      res.emplace_back(x, 1);
    return res;
  }
};

int main() {
  ll n;
  cin >> n;
  Sieve s(nMax);
  vector<pair<ll, int>> fs = s.factor(n);

  int ans = 0;
  for (const auto &item : fs) {
    int shoulder = item.second;
    int start = 1;
    while (start <= shoulder) {
      shoulder -= start;
      start++;
      ans++;
    }
  }
  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

bool isPrime(ll num) {
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  for (ll i = 3; i * i <= num; i += 2) {
    if (num % i == 0)
      return false;
  }
  return true;
}

int main() {
  ll n;
  cin >> n;
  map<ll, ll> mp;
  ll m = n;
  for (ll i = 2; i * i <= m; i++) {
    while (m % i == 0) {
      mp[i]++;
      m /= i;
    }
  }
  if (isPrime(m))
    mp[m]++;

  if (n != 1 && mp.size() == 0) {
    cout << 1 << endl;
    return 0;
  }
  int ans = 0;
  for (auto p : mp) {
    int t = p.second;
    for (int k = 1; t - k >= 0; k++) {
      t -= k;
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

bool isPrime(ll num) {
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  for (ll i = 3; i * i <= num; i += 2) {
    if (num % i == 0)
      return false;
  }
  return true;
}

int main() {
  ll n;
  cin >> n;
  map<ll, ll> mp;
  ll m = n;
  for (ll i = 2; i <= m; i++) {
    if (isPrime(m)) {
      mp[m]++;
      break;
    }
    while (m % i == 0) {
      mp[i]++;
      m /= i;
    }
  }

  if (n != 1 && mp.size() == 0) {
    cout << 1 << endl;
    return 0;
  }
  int ans = 0;
  for (auto p : mp) {
    int t = p.second;
    for (int k = 1; t - k >= 0; k++) {
      t -= k;
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}
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++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using PP = pair<int, pair<int, int>>;
using T = tuple<string, int, int>;
const string EMP = " ";
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

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


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using PP = pair<int, pair<int, int>>;
using T = tuple<string, int, int>;
const string EMP = " ";
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      int c = 0;
      while (n % i == 0) {
        c++;
        n /= i;
      }
      for (int i = 1; i <= c; i++) {
        c -= i;
        ans++;
      }
    }
  }
  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;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using PP = pair<int, pair<int, int>>;
using T = tuple<string, int, int>;
const string EMP = " ";
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

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


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using PP = pair<int, pair<int, int>>;
using T = tuple<string, int, int>;
const string EMP = " ";
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      int c = 0;
      while (n % i == 0) {
        c++;
        n /= i;
      }
      for (int j = 1; j <= c; j++) {
        ans++;
        c -= j;
      }
    }
  }
  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;

int main() {
  long n, cnt = 0;
  cin >> n;
  map<long, int> v;
  for (long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      v[i]++;
      n /= i;
    }
  }
  if (n != 1)
    v[n] = 1;
  for (auto i : v) {
    int k = 1, d = i.second;
    while (0 <= d - k) {
      d -= k;
      k++;
    }
    cnt += k - 1;
  }
  cout << cnt << endl;
}


Error: TLE

Fixed submission:

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

int main() {
  long n, cnt = 0;
  cin >> n;
  map<long, int> v;
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      v[i]++;
      n /= i;
    }
  }
  if (n != 1)
    v[n] = 1;
  for (auto i : v) {
    int k = 1, d = i.second;
    while (0 <= d - k) {
      d -= k;
      k++;
    }
    cnt += k - 1;
  }
  cout << cnt << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

Error: TLE

Fixed submission:

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

int main() {
  long n;
  int a, ans;
  a = 0;
  ans = 0;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    if (n % i != 0)
      continue;
    while (n % i == 0) {
      n /= i;
      a++;
    }
    for (int j = 1; j * (j + 1) / 2 <= a; j++) {
      ans++;
    }
    a = 0;
  }

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

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

ll N, cnt;

int main() {
  cin >> N;
  for (ll i = 2; i * i <= N; i++) {
    if (N % i == 1)
      continue;
    for (ll j = i; j <= N; j = j * i) {
      if (N % j == 0) {
        N /= j;
        cnt++;
      }
    }
    while (N % i == 0)
      N /= i;
  }
  if (N > 1)
    cnt++;
  cout << cnt << "\\n";
  return 0;
}

Error: 0

Fixed submission:

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

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

#include <bits/stdc++.h>
#include <climits>
#include <iostream>
#include <math.h>

#define forn(x, n, s) for (int i = x; i < n; i += s)
#define forr(x, n, s) for (int i = x; i >= n; i -= s)
#define PI 3.14159265358979323846264338327950L

using namespace std;

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

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
long long int mod = 1e9 + 7;
int helper(int n) {
  int cnt = 0, round = 1;
  while (n > 0) {
    if (n - round >= 0)
      cnt++;
    n -= round;
    round++;
  }
  return cnt;
}

int main() {
  go();

  // code here
  long long int n;
  cin >> n;
  unordered_map<int, int> mp;
  long long int temp = n;
  int ans = 0;
  for (int i = 2; (long long int)i * i <= temp; i++) {
    int cnt = 0;
    while (n > 1 and n % i == 0) {
      cnt++;
      n = n / i;
    }
    ans += helper(cnt);
  }
  if (n > 1)
    ans++;
  cout << ans;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <climits>
#include <iostream>
#include <math.h>

#define forn(x, n, s) for (int i = x; i < n; i += s)
#define forr(x, n, s) for (int i = x; i >= n; i -= s)
#define PI 3.14159265358979323846264338327950L

using namespace std;

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

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
long long int mod = 1e9 + 7;
int helper(int n) {
  int cnt = 0, round = 1;
  while (n > 0) {
    if (n - round >= 0)
      cnt++;
    n -= round;
    round++;
  }
  return cnt;
}

int main() {
  go();

  // code here
  long long int n;
  cin >> n;
  unordered_map<int, int> mp;
  long long int temp = n;
  for (int i = 2; i * i <= temp; i++) {
    while (n > 1 and n % i == 0) {
      mp[i]++;
      n = n / i;
    }
  }
  if (n > 1)
    mp[n]++;
  int ans = 0;
  for (auto node : mp) {
    ans += helper(node.second);
  }
  cout << ans;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

// This is an independent project of an individual developer. Dear PVS-Studio,
// please check it. PVS-Studio Static Code Analyzer for C, C++ and C#:
// http://www.viva64.com

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main() {
  long long n, N;
  cin >> n;
  N = n + 1;
  if (n == 1) {
    cout << 0;
  } else {
    long long cnt = 0;
    long long divisor = 2;

    while (n > 1) {
      if (divisor * divisor > n) {
        break;
      }

      if (n % divisor == 0) {
        long long divisors = 0;
        while (n % divisor == 0) {
          ++divisors;
          n /= divisor;
        }
        //                cout << "divisor " << divisor << ", power = " <<
        //                divisors << endl;

        long long num = 1;
        while (divisors >= num) {
          divisors -= num;
          ++num;
          ++cnt;
        }

        //                cout << n << endl;
      } else {
        if (divisor == 2) {
          divisor = 3;
        } else {
          divisor += 2;
        }
      }
    }

    if (n > 1) {
      cnt += 1;
    }
    cout << cnt;
  }

  return 0;
}


Error: TLE

Fixed submission:

// This is an independent project of an individual developer. Dear PVS-Studio,
// please check it. PVS-Studio Static Code Analyzer for C, C++ and C#:
// http://www.viva64.com

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main() {
  long long n, N;
  cin >> n;
  N = n + 1;
  if (n == 1) {
    cout << 0;
  } else {
    long long cnt = 0;
    long long divisor = 2;

    while (n > 1) {
      if (!cnt && divisor * divisor > N) {
        break;
      }
      if (divisor > n) {
        break;
      }

      if (n % divisor == 0) {
        long long divisors = 0;
        while (n % divisor == 0) {
          ++divisors;
          n /= divisor;
        }
        //                cout << "divisor " << divisor << ", power = " <<
        //                divisors << endl;

        long long num = 1;
        while (divisors >= num) {
          divisors -= num;
          ++num;
          ++cnt;
        }

        //                cout << n << endl;
      } else {
        if (divisor == 2) {
          divisor = 3;
        } else {
          divisor += 2;
        }
      }
    }

    if (cnt == 0) {
      cnt = 1;
    }
    cout << cnt;
  }

  return 0;
}