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

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

  ll n;
  cin >> n;
  ll ans = 0;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0)
      continue;
    ll cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    ll cut = 1;
    while (cut <= cnt) {
      ans++;
      cnt -= cut;
      cut++;
    }
  }
  if (n > 1)
    ans++;
  cout << ans;
  return 0;
}

Error: TLE

Fixed submission:

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

  ll n;
  cin >> n;
  ll ans = 0;
  for (int i = 2; i * i <= n; i++) {
    if (n % i != 0)
      continue;
    ll cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    ll cut = 1;
    while (cut <= cnt) {
      ans++;
      cnt -= cut;
      cut++;
    }
  }
  if (n > 1)
    ans++;
  cout << ans;
  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>> f;
  for (ll i = 2; i * i <= n; i++) {
    int cnt = 0;
    while (n % i == 0) {
      cnt++;
      n /= i;
    }
    if (cnt != 0)
      f.emplace_back(i, cnt);
  }
  if (n != 1)
    f.emplace_back(n, 1);

  // 答えを求める
  int ans = 0;
  for (auto p : f) {
    int x = p.second;
    int a = 1;
    while (x >= a) {
      x -= a;
      a++;
      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>> f;
  for (int i = 2; i * i <= n; i++) {
    int cnt = 0;
    while (n % i == 0) {
      cnt++;
      n /= i;
    }
    if (cnt != 0)
      f.emplace_back(i, cnt);
  }
  if (n != 1)
    f.emplace_back(n, 1);

  // 答えを求める
  int ans = 0;
  for (auto p : f) {
    int x = p.second;
    int a = 1;
    while (x >= a) {
      x -= a;
      a++;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int N = 2e5 + 10;
int a[N];
map<int, int> mp;
string s;
int main() {
  long long n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  int cou = 0;
  int n1 = n;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) {
        a[cou]++;
        n /= i;
      }
      cou++;
    }
  }

  if (cou == 0) {
    cout << 1 << endl;
    return 0;
  }
  int ans = 0;
  for (int i = 0; i < cou; i++) {
    int sum = 1;
    int ans1 = 0;
    while (a[i] >= sum) {
      ans1++;
      a[i] -= sum;
      sum++;
    }
    ans += ans1;
  }
  if (n > 1)
    ans++;
  cout << ans << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int N = 2e5 + 10;
int a[N];
map<int, int> mp;
string s;
int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  int cou = 0;
  int n1 = n;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) {
        a[cou]++;
        n /= i;
      }
      cou++;
    }
  }

  if (cou == 0) {
    cout << 1 << endl;
    return 0;
  }
  int ans = 0;
  for (int i = 0; i < cou; i++) {
    int sum = 1;
    int ans1 = 0;
    while (a[i] >= sum) {
      ans1++;
      a[i] -= sum;
      sum++;
    }
    ans += ans1;
  }
  if (n > 1)
    ans++;
  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
using namespace std;
long long n, ans;
int main() {
  scanf("%lld", &n);
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i)
      continue;
    for (long long j = i; j <= n; j *= i) {
      if (n % j == 0) {
        n /= j;
        ans++;
      }
    }
    while (n % i == 0)
      n /= i;
  }
  if (n > 1)
    ++ans;
  printf("%lld", ans);
  return 0;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
using namespace std;
long long n, ans;
int main() {
  scanf("%lld", &n);
  for (int i = 2; i * i <= n; ++i) {
    if (n % i)
      continue;
    for (int j = i; j <= n; j *= i) {
      if (n % j == 0) {
        n /= j;
        ans++;
      }
    }
    while (n % i == 0)
      n /= i;
  }
  if (n > 1)
    ++ans;
  printf("%lld", ans);
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
typedef pair<int, int> P;

const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9 + 7;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};

vector<pair<ll, ll>> f(ll n) {
  vector<pair<ll, ll>> p;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      ll tmp = 0;
      while (n % i == 0) {
        n /= i;
        tmp++;
      }
      p.push_back(make_pair(i, tmp));
    }
  }
  if (n != 1)
    p.push_back(make_pair(n, 1));
  return p;
}

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

  ll n;
  cin >> n;
  vector<pair<ll, ll>> p;
  p = f(n);
  ll ans = 0;
  for (auto pp : p) {
    ll a = pp.second;
    ll x = 1;

    while (a >= x) {
      a -= x;
      x++;
      ans++;
    }
  }
  cout << ans << endl;

  cout << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
typedef pair<int, int> P;

const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9 + 7;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};

vector<pair<ll, ll>> f(ll n) {
  vector<pair<ll, ll>> p;
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      ll tmp = 0;
      while (n % i == 0) {
        n /= i;
        tmp++;
      }
      p.push_back(make_pair(i, tmp));
    }
  }
  if (n != 1)
    p.push_back(make_pair(n, 1));
  return p;
}

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

  ll n;
  cin >> n;
  vector<pair<ll, ll>> p;
  p = f(n);
  ll ans = 0;
  for (auto pp : p) {
    ll a = pp.second;
    ll x = 1;

    while (a - x >= 0) {
      a -= x;
      x++;
      ans++;
    }
  }
  cout << ans << endl;

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

#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>;

// return vector include prome number under N
vector<long long> prime_list(long long N) {
  vector<long long> prime_list(N + 1);
  for (long long i = 0; i < N + 1; i++) {
    prime_list[i] = 0;
  }

  prime_list[0] = 1;
  prime_list[1] = 1;

  for (long long i = 2; i <= sqrt(N); i++) {
    for (long long j = i * 2; j <= N; j += i) {
      prime_list[j] = 1;
    }
  }

  vector<long long> list;
  for (long long i = 0; i < N + 1; i++) {
    if (prime_list[i] == 0)
      list.push_back(i);
  }

  return list;
}

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

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

  int flag = 0;
  for (ll i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << "1" << endl;
    return 0;
  }

  vector<ll> prime = prime_list(sqrt(n));
  vector<ll> v;

  ll num = n;
  rep(i, prime.size()) {
    if (num % prime[i] == 0) {
      ll prime_num = 0;
      while (num % prime[i] == 0) {
        prime_num++;
        num = num / prime[i];
        if (num == 0)
          break;
      }
      v.push_back(prime_num);
    }
  }
  if (num > 1)
    v.push_back(1);

  ll ans = 0;
  rep(i, v.size()) {
    ll num = v[i];
    ll number = 1;
    ll a = 2;
    while (num >= number) {
      ans++;
      number += a;
      a++;
    }
  }

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

Error: 0

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>;

// return vector include prome number under N
vector<long long> prime_list(long long N) {
  vector<long long> prime_list(N + 1);
  for (long long i = 0; i < N + 1; i++) {
    prime_list[i] = 0;
  }

  prime_list[0] = 1;
  prime_list[1] = 1;

  for (long long i = 2; i <= sqrt(N); i++) {
    for (long long j = i * 2; j <= N; j += i) {
      prime_list[j] = 1;
    }
  }

  vector<long long> list;
  for (long long i = 0; i < N + 1; i++) {
    if (prime_list[i] == 0)
      list.push_back(i);
  }

  return list;
}

int main() {
  ll n;
  cin >> n;
  vector<ll> prime = prime_list(n);
  vector<ll> v;

  rep(i, prime.size()) {
    if (n % prime[i] == 0) {
      ll num = n;
      ll prime_num = 0;
      while (num % prime[i] == 0) {
        prime_num++;
        num = num / prime[i];
        if (num == 0)
          break;
      }
      v.push_back(prime_num);
    }
  }

  ll ans = 0;
  rep(i, v.size()) {
    ll num = v[i];
    ll number = 1;
    ll a = 2;
    while (num >= number) {
      ans++;
      number += a;
      a++;
    }
  }

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

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

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

  // 素因数分解する
  ll n = N;
  vector<P> vec; // vec[i].first:素因数, second:その素因数の個数
  for (ll i = 2; i * i < n; i++) {
    ll num = 0;
    while (true) {
      if (n % i != 0)
        break;
      n /= i;
      num++;
    }
    vec.emplace_back(i, num);
  }
  if (n != 1)
    vec.emplace_back(n, 1); // nが1じゃないならnは素因数となっている(√Nかな)

  // cout << " 素因数分解...:   ";
  // for(int i=0; i<vec.size(); i++){
  // 	for(int j=0; j<vec[i].second; j++){
  // 		cout << vec[i].first << ",  ";
  // 	}
  // }
  // cout << endl;

  ll ans = 0;
  for (int i = 0; i < vec.size(); i++) {
    ll cnt = 0;
    while (true) {
      cnt++;
      if (vec[i].second - cnt < 0)
        break;
      vec[i].second -= cnt;
      ans++;
    }
  }

  cout << ans << endl;
}


Error: TLE

Fixed submission:

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

template <typename TYPE> void print_vec(const vector<TYPE> &v) {
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}

template <typename TYPE> void print_vec2(const vector<vector<TYPE>> &v) {
  cout << endl;
  cout << "       ";
  for (int i = 0; i < v[0].size(); i++)
    cout << i << "   ";
  cout << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << "i=" << i << ":   ";
    for (int j = 0; j < v[i].size(); j++) {
      if (v[i][j] == 0)
        cout << "\\x1B[0m" << v[i][j] << "   ";
      else
        cout << "\\x1B[31m" << v[i][j]
             << "   "; // https://stackoverrun.com/ja/q/12618775
    }
    cout << "\\x1B[0m" << endl;
  }
}

////////////////////////////////////////////////////////////////

int main(void) {
  ll N;
  cin >> N;
  ll tmp_N = N;
  typedef pair<ll, int> P;
  // prime_factors[i].first: 素因数i, second: 素因数iの個数
  vector<P> prime_factors;
  for (int i = 2; i * i < tmp_N; i++) {
    ll num = 0;
    if (tmp_N % i != 0)
      continue;
    while (tmp_N % i == 0) {
      tmp_N /= i;
      num++;
    }
    prime_factors.emplace_back(i, num);
  }
  if (tmp_N != 1)
    prime_factors.emplace_back(tmp_N, 1);
  // cout << "  comp " << endl;
  //  vector<ll> divisors;
  //  for(int i=0; i<prime_factors.size(); i++){
  //  	for(int j=1; j<=prime_factors[i].second; j++){
  //  		divisors.push_back(j * prime_factors[i].first);
  //  		//cout << prime_factors[i].first << " ";
  //  	}
  //  }
  //  //cout << "   divisors.size(): " << divisors.size() << endl;
  //  sort(divisors.begin(), divisors.end());
  //  cout << " divisors: " ; print_vec(divisors);
  //  ll ans = 0;
  //  for(ll x : divisors){
  //  	if(N % x != 0) continue;
  //  	ans++;
  //  	N /= x;
  //  }

  ll ans = 0;
  for (int i = 0; i < prime_factors.size(); i++) {
    ll cnt = 0;
    while (true) {
      cnt++;
      if (prime_factors[i].second - cnt < 0)
        break;
      prime_factors[i].second -= cnt;
      ans++;
    }
  }
  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
ll n;
map<ll, int> mp;
ll res;
int main() {
  cin >> n;
  ll ni = n;
  ll b = 2;
  while (n != 1) {
    bool fl = 0;
    for (ll i = b; i * i <= n; i++) {
      if (n % i)
        continue;
      fl = 1, b = i;
      while (ni % i == 0)
        ni /= i, mp[i]++;
      // cout <<i<<" ##\\n";
    }
    if (!fl) {
      mp[ni]++;
      break;
    }
    n = ni;
  }
  for (map<ll, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    int t = 0;
    // cout <<it->Fst<<" #############\\n";
    for (int j = 1; j <= it->Snd + 1; j++) {
      t += j;
      // cout <<j<<" "<<t<<" "<<it->Snd<<" ##\\n";
      if (t > it->Snd) {
        res += j - 1;
        break;
      }
    }
  }
  cout << res;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
ll n;
map<ll, int> mp;
ll res;
int main() {
  cin >> n;
  ll ni = n;
  bool fl = 0;
  while (n != 1) {
    for (ll i = 2; i * i <= n; i++) {
      if (n % i)
        continue;
      fl = 1;
      while (ni % i == 0)
        ni /= i, mp[i]++;
      // cout <<i<<" ##\\n";
    }
    if (!fl && n != 1) {
      mp[ni]++;
      break;
    }
    n = ni;
  }
  for (ll i = 2; i * i <= n; i++) {
    if (n % i)
      continue;
    fl = 1;
    while (ni % i == 0)
      ni /= i, mp[i]++;
    // cout <<i<<" ##\\n";
  }
  if (!fl && n != 1)
    mp[ni]++;
  for (map<ll, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    int t = 0;
    // cout <<it->Fst<<" #############\\n";
    for (int j = 1; j <= it->Snd + 1; j++) {
      t += j;
      // cout <<j<<" "<<t<<" "<<it->Snd<<" ##\\n";
      if (t > it->Snd) {
        res += j - 1;
        break;
      }
    }
  }
  cout << res;
  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>;

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

int main() {
  ll n;
  cin >> n;
  int cnt = 0;

  // nを素因数分解して管理
  vector<pair<ll, int>> p_factors = prime_factor(n);
  // cout << factors[2] << endl;

  // 素因数分解のリストから、小さい数を重複なしに取り出しながら n
  // を割れる回数をカウント
  vector<ll> factors();
  for (auto p : p_factors) {
    int x = p.second;
    int b = 1;
    while (b <= x) {
      x -= b;
      b++;
      cnt++;
    }
  }

  cout << cnt << 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>;

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

vector<ll> factor(ll n) {
  vector<ll> res;
  for (ll i = 2; i <= n; i++) {
    if (n % i == 0)
      res.push_back(i);
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  int cnt = 0;
  int ans = 0;

  // nを素因数分解して管理

  vector<ll> np_factors = factor(n);
  // cout << factors[2] << endl;

  // 素因数分解のリストから、小さい数を重複なしに取り出しながら n
  // を割れる回数をカウント

  for (auto f : np_factors) {
    if (n % f == 0) {
      n /= f;
      ans++;
    } else if (f > n) {
      break;
    }
  }

  cout << ans << endl;

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

#include <cmath>
#include <iostream>
#include <vector>

static bool primes[1000010];

int main() {
  long long n, ans = 0, ip = 2;
  std::cin >> n;
  bool one = n == 1;
  long long size = std::sqrt(n) + 10;
  long long div, cp;
  bool test = true;
  while (n != 1 && ip < size) {
    if (test) {
      div = ip;
      while (div <= n && n % div == 0) {
        n /= div;
        div *= ip;
        ans++;
      }
      while (n % ip == 0) {
        n /= ip;
      }
    }
    for (long long i = ip; i < size; i += ip) {
      primes[i] = true;
    }
    cp = ip;
    for (long long i = ip + 1; i < size; i++) {
      if (!primes[i]) {
        ip = i;
        test = n % i == 0;
        break;
      }
    }
    if (cp == ip) {
      break;
    }
  }

  if (one) {
    std::cout << "0\\n";
  } else if (ip == cp) {
    if (n == 1) {
      std::cout << "1\\n";
    } else {
      std::cout << ans + 1 << "\\n";
    }
  } else {
    std::cout << ans << "\\n";
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

static bool primes[1000002];

int main() {
  long long n, ans = 0, ip = 2;
  std::cin >> n;
  bool one = n == 1;
  long long size = std::sqrt(n) + 2;
  long long div, cp;
  bool test = true;
  while (n != 1 && ip < size) {
    if (test) {
      div = ip;
      while (div <= n && n % div == 0) {
        n /= div;
        div *= ip;
        ans++;
      }
      while (n % ip == 0) {
        n /= ip;
      }
    }
    for (long long i = ip + 1; i < size; i++) {
      if (i % ip == 0) {
        primes[i] = true;
      }
    }
    cp = ip;
    for (long long i = ip + 1; i < size; i++) {
      if (!primes[i]) {
        ip = i;
        test = n % i == 0;
        break;
      }
    }
    if (cp == ip) {
      break;
    }
  }

  if (ans == 0) {
    if (one) {
      std::cout << "0\\n";
    } else {
      std::cout << "1\\n";
    }
  } else {
    std::cout << ans << "\\n";
  }

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

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

int mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main() {
  int64_t N;
  cin >> N;
  map<int64_t, int64_t> hist;

  int64_t a = 2;
  while (N >= a * a) {
    if (N % a == 0) {
      hist[a]++;
      N /= a;
    } else
      a++;
  }

  hist[N]++;
  int ans = 0;
  for (auto p : hist) {
    int tmp = p.second;
    int x = 1;
    while (tmp >= x) {
      ans++;
      tmp -= x;
      x++;
    }
  }
  if (N != 1)
    cout << ans;
  else
    cout << 0;
}

Error: WA

Fixed submission:

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

int mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main() {
  int64_t N, Nmemo;
  cin >> N;
  Nmemo = N;
  vector<int> hist(1000000);
  int a = 2;
  bool sosu = false;
  while (N >= a * a) {
    if (N % a == 0) {
      hist[a - 1]++;
      N /= a;
    } else
      a++;
  }
  if (Nmemo == N)
    sosu = true;
  else
    hist[N - 1]++;

  if (sosu)
    cout << 1;
  else {
    int ans = 0;
    for (int i = 0; i < 1000000; i++) {
      int tmp = hist[i];
      int x = 1;
      while (tmp >= x) {
        ans++;
        tmp -= x;
        x++;
      }
    }
    cout << ans;
  }
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define ll long long
using namespace std;
template <class T> inline void read(T &res) {
  char c;
  T flag = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-')
      flag = -1;
  res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9')
    res = res * 10 + c - '0';
  res *= flag;
}
#define MAX 1000000 // 求MAX范围内的素数
long long su[MAX], cnt;
bool isprime[MAX];
void prime() {
  cnt = 1;
  memset(isprime, 1, sizeof(isprime)); // 初始化认为所有数都为素数
  isprime[0] = isprime[1] = 0;         // 0和1不是素数
  for (long long i = 2; i <= MAX; i++) {
    if (isprime[i])
      su[cnt++] = i; // 保存素数i
    for (long long j = 1; j < cnt && su[j] * i < MAX; j++) {
      isprime[su[j] * i] = 0; // 筛掉小于等于i的素数和i的积构成的合数
    }
  }
}
int main() {
  prime();
  int a[] = {0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55};
  ll n, ans = 0;
  cin >> n;
  for (int i = 1;; i++) {
    if (i < cnt && su[i] * su[i] > n)
      break;
    if (n % su[i] == 0) {
      int c = 0;
      while (n % su[i] == 0)
        n /= su[i], c++;
      // cout<<c<<endl;
      ans += upper_bound(a, a + 11, c) - a - 1;
    }
  }
  if (n != 1)
    ans++;
  cout << ans << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
using namespace std;
template <class T> inline void read(T &res) {
  char c;
  T flag = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-')
      flag = -1;
  res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9')
    res = res * 10 + c - '0';
  res *= flag;
}
#define MAX 1000000 // 求MAX范围内的素数
long long su[MAX], cnt;
bool isprime[MAX];
void prime() {
  cnt = 1;
  memset(isprime, 1, sizeof(isprime)); // 初始化认为所有数都为素数
  isprime[0] = isprime[1] = 0;         // 0和1不是素数
  for (long long i = 2; i <= MAX; i++) {
    if (isprime[i])
      su[cnt++] = i; // 保存素数i
    for (long long j = 1; j < cnt && su[j] * i < MAX; j++) {
      isprime[su[j] * i] = 0; // 筛掉小于等于i的素数和i的积构成的合数
    }
  }
}
int main() {
  prime();
  int a[] = {0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55};
  ll n, ans = 0;
  cin >> n;
  for (int i = 1;; i++) {
    if (i <= MAX && n < su[i])
      break;
    if (n % su[i] == 0) {
      int c = 0;
      while (n % su[i] == 0)
        n /= su[i], c++;
      // cout<<c<<endl;
      ans += upper_bound(a, a + 11, c) - a - 1;
    }
  }
  if (n != 1)
    ans++;
  cout << ans << endl;
  return 0;
}