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

#include <bits/stdc++.h>

using namespace std;

#define intt long long

int f(int n) {
  int ans = 0;
  while (ans * (ans + 1) / 2 <= n) {
    ans++;
  }
  return ans - 1;
}

int main() {

  intt n;
  cin >> n;
  int ans = 0;
  for (int i = 2; 1LL * i * i <= n; i++) {
    if (n % i == 0) {
      int cnt = 0;
      while (n % i == 0) {
        n /= i;
        cnt++;
      }
      ans += f(cnt);
    }
  }
  if (n != 1)
    ans++;
  cout << ans << '\\n';
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define intt long long

int f(int n) {
  int ans = 0;
  while (ans * (ans + 1) / 2 <= n) {
    ans++;
  }
  return ans - 1;
}

int main() {

  intt n;
  cin >> n;
  int ans = 0;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      int cnt = 0;
      while (n % i == 0) {
        n /= i;
        cnt++;
      }
      ans += f(cnt);
    }
  }
  if (n != 1)
    ans++;
  cout << ans << '\\n';
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <vector>

using ll = long long;

using namespace std;

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

int main(void) {
  ll N;
  cin >> N;
  auto pf = prime_factorize(N);
  ll res = 0;
  for (auto p : pf) {
    ll e = p.second;
    ll tmp = 0;
    ll cur = 1;
    while (e >= cur) {
      e -= cur++, ++tmp;
    }
    res += tmp;
  }
  cout << res << endl;
}


Error: 0

Fixed submission:

#include <cmath>
#include <iostream>
#include <map>

using ll = long long;

using namespace std;

int main(void) {
  ll N;
  cin >> N;
  int count = 0;
  for (ll i = 2; i < (ll)sqrt(N); i++) {
    if (N % i == 0) {
      int ti = i;
      while (N % ti == 0) {
        N /= ti;
        count++;
        ti *= ti;
      }
    }
    if (N == 1) {
      break;
    }
  }
  if (N > (ll)sqrt(N)) {
    count++;
  }
  cout << count << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  ll n;
  cin >> n;
  vector<ll> primes = {2, 3, 5, 7, 11, 13};
  vector<int> factors;
  for (ll i = 17; i < 1000000; i += 2) {
    bool is_prime = true;
    for (int j = 0; primes[j] * primes[j] <= i; ++j) {
      if (i % primes[j] == 0) {
        is_prime = false;
        break;
      }
    }
    if (is_prime)
      primes.emplace_back(i);
  }
  for (int i = 0; i < primes.size(); ++i) {
    int cnt = 0;
    while (n % primes[i] == 0) {
      n /= primes[i];
      cnt++;
    }
    factors.emplace_back(cnt);
  }
  if (n != 1)
    factors.emplace_back(1);
  int ans = 0;
  for (int i : factors) {
    int t = 1;
    int rest = i;
    while (rest >= t) {
      rest -= t;
      ans++;
      t++;
    }
  }
  cout << ans;
}


Error: WA

Fixed submission:

#include <iostream>
#include <unordered_map>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  ll n;
  cin >> n;
  vector<ll> primes = {2, 3, 5, 7, 11, 13};
  vector<int> factors;
  for (ll i = 17; i < 1000000; i += 2) {
    bool is_prime = true;
    for (int j = 0; primes[j] * primes[j] <= i; ++j) {
      if (i % primes[j] == 0) {
        is_prime = false;
        break;
      }
    }
    if (is_prime)
      primes.emplace_back(i);
  }
  for (int i = 0; primes[i] * primes[i] <= n; ++i) {
    int cnt = 0;
    while (n % primes[i] == 0) {
      n /= primes[i];
      cnt++;
    }
    factors.emplace_back(cnt);
  }
  if (n != 1)
    factors.emplace_back(1);
  int ans = 0;
  for (int i : factors) {
    int t = 1;
    int rest = i;
    while (rest >= t) {
      rest -= t;
      ans++;
      t++;
    }
  }
  cout << ans;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define test                                                                   \\
  int t;                                                                       \\
  cin >> t;                                                                    \\
  while (t--)
typedef long long int ll;
#define REP(i, n) for (int i = 1; i <= n; i++)
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define lli long long int
#define INF 1000000000
const double pi = 3.14159265358979323846;

void solve() {
  ll i = 0, j = 0, m = 0;
  ll n, cnt = 0;
  vi tab;
  cin >> n;
  while (n % 2 == 0) {
    cnt++;
    n /= 2;
  }
  if (cnt != 0)
    tab.pb(cnt);
  cnt = 0;
  for (i = 3; i * i <= n; i += 2) {
    if (n % i == 0) {
      cnt = 0;
      while (n % i == 0) {
        n /= i;
        cnt++;
      }
      tab.pb(cnt);
    }
  }
  if (n > 2)
    tab.pb(1);
  ll reg = 0;
  for (i = 0; i < tab.size(); i++) {
    int lol = 1;
    while (tab[i] - lol >= 0) {
      tab[i] -= lol;
      lol++;
      reg++;
    }
  }
  cout << reg;
}

int main() {
  fast
  // test
  {

    solve();
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define test                                                                   \\
  int t;                                                                       \\
  cin >> t;                                                                    \\
  while (t--)
typedef long long int ll;
#define REP(i, n) for (int i = 1; i <= n; i++)
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define lli long long int
#define INF 1000000000
const double pi = 3.14159265358979323846;

void solve() {
  int i = 0, j = 0, m = 0;
  ll n, cnt = 0;
  vi tab;
  cin >> n;
  while (n % 2 == 0) {
    cnt++;
    n /= 2;
  }
  tab.pb(cnt);
  cnt = 0;
  for (i = 3; i * i < n; i += 2) {
    if (n % i == 0) {
      cnt = 0;
      while (n % i == 0) {
        n /= i;
        cnt++;
      }
      tab.pb(cnt);
    }
  }
  if (n > 2)
    tab.pb(1);
  ll reg = 0;
  for (i = 0; i < tab.size(); i++) {
    int lol = 1;
    while (tab[i] - lol >= 0) {
      tab[i] -= lol;
      lol++;
      reg++;
    }
  }
  cout << reg;
}

int main() {
  fast
  // test
  {

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

#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

template <class T> vector<pair<T, T>> prime_factorization(T n) {
  vector<pair<T, T>> ret;
  for (T i = 2; i * i <= n; i++) {
    T cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    if (cnt != 0)
      ret.emplace_back(i, cnt);
  }
  if (n != 1)
    ret.emplace_back(n, 1);
  return ret;
}

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

  if (n < 2) {
    cout << 0 << endl;
    return 0;
  }

  vector<pair<int64_t, int64_t>> p = prime_factorization(n);

  int64_t ans = 0;
  for (auto i = 0; i < (int)p.size(); i++) {
    int64_t cnt = 1;
    while (true) {
      if (p[i].second >= cnt) {
        p[i].second -= cnt;
        ans++;
        cnt++;
      } else
        break;
    }
    // cout << p[i].first << " " << p[i].second << endl;
  }

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

template <class T> vector<pair<T, T>> prime_factorization(T n) {
  vector<pair<T, T>> ret;
  for (auto i = 2; i * i <= n; i++) {
    T cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    if (cnt != 0)
      ret.emplace_back(i, cnt);
  }
  if (n != 1)
    ret.emplace_back(n, 1);
  return ret;
}

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

  if (n < 2) {
    cout << 0 << endl;
    return 0;
  }

  vector<pair<int64_t, int64_t>> p = prime_factorization(n);

  int64_t ans = 0;
  for (auto i = 0; i < (int)p.size(); i++) {
    int64_t cnt = 1;
    while (p[i].second > 0) {
      if (p[i].second >= cnt) {
        ans++;
        p[i].second -= cnt;
      } else
        break;
      cnt++;
    }
    // cout << p[i].first << " " << p[i].second << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n;
int a[10000001], tot, num[10000001], ans;
inline void operate() {
  int x = sqrt(n);
  LL tmp = n;
  for (int i = 2; i <= x; i++) {
    if (n % i == 0) {
      a[++tot] = i;
      while (n % i == 0)
        n /= i, num[tot]++;
      int now = tmp / i;
      if (now == 0 || n % now)
        continue;
      a[++tot] = now;
      while (n % now == 0)
        n /= now, num[tot]++;
    }
  }
  if (n != 1)
    a[++tot] = n, num[tot] = 1;
}
int main() {
  cin >> n;
  operate();
  for (int i = 1; i <= tot; i++) {
    // cout<<a[i]<<" "<<num[i]<<endl;
    int tmp = sqrt(num[i] * 2);
    if (1ll * tmp * (tmp + 1) / 2 > num[i])
      tmp--;
    ans += tmp; // cout<<tmp<<endl;
  }
  cout << ans << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n;
int a[1000001], tot, num[1000001], ans;
inline void operate() {
  int x = sqrt(n);
  LL tmp = n;
  for (int i = 2; i <= x; i++) {
    if (n % i == 0) {
      a[++tot] = i;
      while (n % i == 0)
        n /= i, num[tot]++;
      int now = tmp / i;
      if (n % now)
        continue;
      a[++tot] = now;
      while (n % now == 0)
        n /= now, num[tot]++;
    }
  }
  if (n != 1)
    a[++tot] = n, num[tot] = 1;
}
int main() {
  cin >> n;
  operate();
  for (int i = 1; i <= tot; i++) {
    // cout<<a[i]<<" "<<num[i]<<endl;
    int tmp = sqrt(num[i] * 2);
    if (1ll * tmp * (tmp + 1) / 2 > num[i])
      tmp--;
    ans += tmp; // cout<<tmp<<endl;
  }
  cout << ans << endl;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int ans = 0;
  if (n % 2 == 0) {
    long long int h = 0;
    while (n % 2 == 0) {
      h++;
      n = n / 2;
    }
    for (int j = 1; j < 50; j++) {
      if ((j * (j + 1)) / 2 > h) {
        ans += j - 1;
        break;
      }
    }
  }
  for (long long int i = 3; i * i <= n; i += 2) {
    long long int h = 0;
    while (n % i == 0) {
      h++;
      n = n / i;
    }
    for (int j = 1; j < 50; j++) {
      if ((j * (j + 1)) / 2 > h) {
        ans += j - 1;
        break;
      }
    }
  }
  if (n != 1)
    ans++;
  cout << ans << "\\n";
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int ans = 0;
  if (n % 2 == 0) {
    long long int h = 0;
    while (n % 2 == 0) {
      h++;
      n = n / 2;
    }
    int i = 0;
    for (i = 1; i < 50; i++) {
      if ((i * (i + 1)) / 2 > h) {
        ans += i - 1;
        break;
      }
    }
  }
  for (int i = 3; i * i <= n; i += 2) {
    int h = 0;
    while (n % i == 0) {
      h++;
      n = n / i;
    }
    for (int i = 1; i < 50; i++) {
      if ((i * (i + 1)) / 2 > h) {
        ans += i - 1;
        break;
      }
    }
  }
  if (n != 1)
    ans++;
  cout << ans << "\\n";
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

typedef long long int ll;
const ll N_MAX = 1E+12;
const int E_MAX = 50;
vector<int> num;

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  num.resize(E_MAX);
  num[0] = 0;
  for (int i = 1; i < E_MAX; i++) {
    num[i] = num[i - 1] + i;
  }
  for (ll i = 2; i * i <= n; i++) {
    if (i * i > n)
      break;
    ll e = 0;
    while (n % i == 0) {
      n /= i;
      e++;
    }
    vector<int>::iterator it = lower_bound(num.begin(), num.end(), e);
    int pa = it - num.begin();
    if (*it != e)
      pa--;
    ans += pa;
  }
  if (n > 1)
    ans++;
  cout << ans << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

typedef long long int ll;
const ll N_MAX = 1E+12;
const int E_MAX = 50;
vector<int> num;

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  num.resize(E_MAX);
  num[0] = 0;
  for (int i = 1; i < E_MAX; i++) {
    num[i] = num[i - 1] + i;
  }
  for (int i = 2; i * i <= n; i++) {
    if (i * i > n)
      break;
    ll e = 0;
    while (n % i == 0) {
      n /= i;
      e++;
    }
    vector<int>::iterator it = lower_bound(num.begin(), num.end(), e);
    int pa = it - num.begin();
    if (*it != e)
      pa--;
    ans += pa;
  }
  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 ll;
ll MOD = 1e9 + 7;
const ll MAX = 1e5 + 2;

void solve() {
  ll n, ans = 0;
  cin >> n;
  for (int i = 2; i < 1000000; i++) {
    ll cnt = 0;
    while (n % i == 0) {
      cnt++;
      n /= i;
    }
    ll x = 0;
    while (1) {
      ll a = ((x + 2) * (x + 1)) / 2;
      if (a <= cnt)
        x++;
      if (a > cnt)
        break;
    }
    ans += x;
  }
  if (n > 1)
    ans++;
  cout << ans << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll t;
  t = 1;
  // cin>>t;
  // cin.ignore();
  while (t--) {
    solve();
  }
  return 0;
}

Error: TLE

Fixed submission:

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

void solve() {
  ll n, ans = 0;
  cin >> n;
  for (int i = 1; i < 1000000; i++) {
    int cnt = 0;
    while (n % i == 0) {
      cnt++;
      n /= i;
    }
    ll x = 0;
    while (1) {
      ll a = ((x + 2) * (x + 1)) / 2;
      if (a <= cnt)
        x++;
      if (a > cnt)
        break;
    }
    ans += x;
  }
  if (n > 1)
    ans++;
  cout << ans << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll t;
  t = 1;
  cin >> t;
  cin.ignore();
  while (t--) {
    solve();
  }
  return 0;
}
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include "math.h"
#include <iostream>
#include <map>
#include <set>
using namespace std;
#define ULONGLONG unsigned long long

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

  std::map<unsigned long long, unsigned long long> divisors;
  unsigned long long currentN = N;
  ULONGLONG i = 2u;
  while ((currentN != 1) && (i < (N / (i - 1)))) {
    unsigned long long count = 0;
    while (currentN % i == 0) {
      count++;
      currentN /= i;
    }
    divisors[i] = count;

    i++;
  }

  ULONGLONG result = 0u;
  if (currentN != 1) {
    result = 1u;
  }

  for (auto it = divisors.begin(); it != divisors.end(); it++) {
    ULONGLONG remaining = it->second;
    ULONGLONG lastValue = 0u;
    ULONGLONG currentValue = 1u;
    while (remaining > lastValue) {
      ULONGLONG z = pow(it->first, currentValue);
      N /= z;

      lastValue = currentValue;
      remaining -= currentValue;
      currentValue++;
      result++;
    }
  }

  cout << result << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include "math.h"
#include <iostream>
#include <map>
using namespace std;
#define ULONGLONG unsigned long long

bool isPrime(unsigned long long N) {
  if ((N == 0) || (N == 1)) {
    return false;
  } else {
    for (unsigned long long i = 2; i < N / 2; ++i) {
      if (N % i == 0) {
        return false;
      }
    }
    return true;
  }
}

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

  std::map<unsigned long long, unsigned long long> divisors;
  if (isPrime(N)) {
    divisors[N] = 1u;
  } else {
    unsigned long long currentN = N;
    for (unsigned long long i = 2u; i <= N; ++i) {
      if ((currentN % i == 0) && isPrime(i)) {
        unsigned long long count = 0;
        while (currentN % i == 0) {
          count++;
          currentN /= i;
        }
        divisors[i] = count;
      }

      if (currentN == 1) {
        break;
      }
    }
  }

  ULONGLONG result = 0u;
  for (auto it = divisors.begin(); it != divisors.end(); it++) {
    ULONGLONG remaining = it->second;
    ULONGLONG lastValue = 0u;
    ULONGLONG currentValue = 1u;
    while (remaining > lastValue) {
      ULONGLONG z = pow(it->first, currentValue);
      N /= z;

      lastValue = currentValue;
      remaining -= currentValue;
      currentValue++;
      result++;
    }
  }

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


#include <iostream>
#include <map>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;

// const int MYINTMAX=2147483647;

void decompose(long num, map<long, int> &data) {
  long a = 2;
  long tmp = num;
  // long maxv = num*num;
  // while(num >= a && a*a <= tmp){
  vector<char> v(1000000000000, 0);
  while (tmp >= a) {
    // cout << a << " " << tmp << endl;
    if (tmp % a == 0) {
      data[a] = data[a] + 1;
      tmp /= a;
    } else {
      a++;
    }
  }
}

int main() {

  long N;
  cin >> N;

  long tmp = N;
  long n = 0;
  for (long i = 2; i <= tmp; i++) {
    int kosuu = 0;
    while (tmp % i == 0) {
      tmp = tmp / i;
      kosuu++;
    }
    // cout << tmp << endl;
    int j = 1;
    while (kosuu >= j) {
      kosuu -= j;
      j++;
      n++;
    }

    if (tmp == 1)
      break;
    if (i > 1000000) {
      cout << n + 1 << endl;
      return 0;
    }
  }

  cout << n << endl;

  return 0;
}


Error: TLE

Fixed submission:


#include <iostream>
#include <map>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;

// const int MYINTMAX=2147483647;

void decompose(long num, map<long, int> &data) {
  long a = 2;
  long tmp = num;
  // long maxv = num*num;
  // while(num >= a && a*a <= tmp){
  vector<char> v(1000000000000, 0);
  while (tmp >= a) {
    // cout << a << " " << tmp << endl;
    if (tmp % a == 0) {
      data[a] = data[a] + 1;
      tmp /= a;
    } else {
      a++;
    }
  }
}

int main() {

  long N;
  cin >> N;

  long tmp = N;
  long n = 0;
  for (long i = 2; i <= tmp; i++) {
    int kosuu = 0;
    while (tmp % i == 0) {
      tmp = tmp / i;
      kosuu++;
    }
    // cout << tmp << endl;
    int j = 1;
    while (kosuu >= j) {
      kosuu -= j;
      j++;
      n++;
    }

    if (tmp == 1)
      break;
  }

  cout << n << endl;

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

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

// 小数点以下桁数
// fixed << setprecision(i)

int64_t gcd(int64_t a, int64_t b) { return (a % b == 0 ? b : gcd(b, a % b)); }
int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
int factorial(int a) {
  int b = 1;
  while (a) {
    b *= a--;
  }
  return b;
} // 13以下対応
bool is_prime(int64_t a) {
  if (a <= 1)
    return false;
  for (int64_t i = 2; (int64_t)i * i <= a; i++) {
    if (a % i == 0)
      return false;
  }
  return true;
}
int get_adp(double x, int n) {
  return (int)round((x - (int)x) * pow(10, n)) % 10;
} // 小数点以下の指定桁の値を取得
int64_t sigma(int64_t s, int64_t n) { return n * (2 * s + n - 1) / 2; }

// 順列の全列挙
//  vector<int> v(N);
//  iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
//  do {
//	for(auto x : v) cout << x << " "; cout << "\\n";     // v の要素を表示
//  } while( next_permutation(v.begin(), v.end()) );

// bit全探索
//  for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//	bitset<ビット数> s(tmp);
//	// (ビット列sに対する処理)
//  }

int main() {
  int64_t n, ans = 0, temp;

  cin >> n;
  for (int64_t i = 2; i * i <= n; i++) {
    if (n % i != 0)
      continue;
    temp = i;
    while (n % temp == 0) {
      n /= temp;
      ans++;
      temp *= i;
    }
    while (n % i == 0)
      n /= i;
  }
  if (n != 1)
    ans++;
  cout << ans << endl;
}

// 6534603030013

Error: TLE

Fixed submission:

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

// 小数点以下桁数
// fixed << setprecision(i)

int64_t gcd(int64_t a, int64_t b) { return (a % b == 0 ? b : gcd(b, a % b)); }
int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
int factorial(int a) {
  int b = 1;
  while (a) {
    b *= a--;
  }
  return b;
} // 13以下対応
bool is_prime(int64_t a) {
  if (a <= 1)
    return false;
  for (int64_t i = 2; (int64_t)i * i <= a; i++) {
    if (a % i == 0)
      return false;
  }
  return true;
}
int get_adp(double x, int n) {
  return (int)round((x - (int)x) * pow(10, n)) % 10;
} // 小数点以下の指定桁の値を取得
int64_t sigma(int64_t s, int64_t n) { return n * (2 * s + n - 1) / 2; }

// 順列の全列挙
//  vector<int> v(N);
//  iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
//  do {
//	for(auto x : v) cout << x << " "; cout << "\\n";     // v の要素を表示
//  } while( next_permutation(v.begin(), v.end()) );

// bit全探索
//  for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//	bitset<ビット数> s(tmp);
//	// (ビット列sに対する処理)
//  }

int main() {
  int64_t n, ans = 0, temp;

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

// 6534603030013
Problem p02660 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define INF (1 << 30) - 1
using ll = long long;
using namespace std;
template <class T> inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  auto res = sieve(n);
  int ans = 0;
  for (auto x : res) {
    int a = x.second, b = 1;
    while (b <= a) {
      a -= b;
      b++;
      ans++;
    }
  }
  cout << ans;
  cout << "\\n";
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define INF (1 << 30) - 1
using ll = long long;
using namespace std;
template <class T> inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  auto res = sieve(n);
  int ans = 0;
  for (auto x : res) {
    int a = x.second, b = 1;
    while (b <= a) {
      a -= b;
      b++;
      ans++;
    }
  }
  cout << ans;
  cout << "\\n";
  return 0;
}