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

// 57
#include <iostream>
#include <set>
#include <vector>

using namespace std;

struct S {
  int t, v;
  bool operator<(S a) const {
    if (t != a.t) {
      return t < a.t;
    } else {
      return v < a.v;
    }
  }
};

int main() {
  for (int n; cin >> n, n;) {
    int v = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        int b;
        cin >> b;
        v |= b << i * n + j;
      }
    }
    set<S> que;
    S is = {0, v};
    que.insert(is);
    set<int> s;
    for (;;) {
      S c = *que.begin();
      if (c.v == 0)
        break;
      que.erase(que.begin());
      if (!s.insert(c.v).second)
        continue;
      int j, k;
      for (j = 0; j < n; j++) {
        for (k = 0; k < n; k++) {
          if (c.v >> j * n + k & 1)
            goto next;
        }
      }
    next:
      for (int l = j; l < n; l++) {
        for (int m = k; m < n; m++) {
          int nv = c.v;
          for (int o = j; o <= l; o++) {
            for (int p = k; p <= m; p++) {
              nv ^= 1 << o * n + p;
            }
          }
          if (s.count(nv))
            continue;
          S ns = {c.t + 1, nv};
          que.insert(ns);
        }
      }
    }
    for (int i = 0; i < que.begin()->t; i++) {
      cout << "myon";
    }
    cout << endl;
  }
  return 0;
}

Error: MLE

Fixed submission:

// 57
#include <iostream>
#include <set>
#include <vector>

using namespace std;

struct S {
  int t, v;
  bool operator<(S a) const {
    if (t != a.t) {
      return t < a.t;
    } else {
      return v < a.v;
    }
  }
};

int main() {
  for (int n; cin >> n, n;) {
    int v = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        int b;
        cin >> b;
        v |= b << i * n + j;
      }
    }
    set<S> que;
    S is = {0, v};
    que.insert(is);
    set<int> s;
    for (;;) {
      S c = *que.begin();
      if (c.v == 0)
        break;
      que.erase(que.begin());
      if (!s.insert(c.v).second)
        continue;
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < n; k++) {
          for (int l = j; l < n; l++) {
            for (int m = k; m < n; m++) {
              int nv = c.v;
              for (int o = j; o <= l; o++) {
                for (int p = k; p <= m; p++) {
                  nv ^= 1 << o * n + p;
                }
              }
              if (s.count(nv))
                continue;
              S ns = {c.t + 1, nv};
              que.insert(ns);
            }
          }
        }
      }
    }
    for (int i = 0; i < que.begin()->t; i++) {
      cout << "myon";
    }
    cout << endl;
  }
  return 0;
}
Problem p00646 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <stdio.h>
#include <vector>
using namespace std;
const int maxn = 1100000;
bool nov[maxn + 1];
vector<long long> prim;
int main() {
  prim.clear();
  for (int i = 1; i <= maxn; i++)
    nov[i] = true;

  for (int i = 2; i <= maxn; i++)
    if (nov[i]) {
      prim.push_back(i);
      for (long long j = (1LL * i) * i; j < maxn; j += i)
        nov[j] = false;
    }

  long long l;
  while (scanf("%lld", &l) != EOF && l) {
    long long tmp = l, ans = 1;
    for (int i = 0; prim[i] * prim[i] <= l; i++) {
      int num = 0;
      while (tmp % prim[i] == 0) {
        tmp /= prim[i];
        num++;
      }
      // if(num!=0)printf("%d\\n",num);
      ans = ans * (2 * num + 1);
    }
    // printf("%lld\\n",ans);
    if (tmp != 1)
      ans = ans * 3;
    ans = (ans - 1) / 2 + 1;
    printf("%lld\\n", ans);
  }
}

Error: TLE

Fixed submission:

/*
 * Author: FreeIdea
 * Created Time:  2011/8/24 12:59:24
 * File Name: J.cpp
 */
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
const int maxint = -1u >> 1;
template <class T> bool get_max(T &a, const T &b) {
  return b > a ? a = b, 1 : 0;
}
template <class T> bool get_min(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
typedef long long lint;
const int maxn = 1000000;
bool np[maxn + 5];
vector<lint> prime;

void pre() {
  for (int i = 2; i <= maxn; i++) {
    if (!np[i]) {
      prime.push_back(i);
    }
    for (int j = 0; j < prime.size() && prime[j] * i <= maxn; j++) {
      np[prime[j] * i] = true;
      if (i % prime[j] == 0)
        break;
    }
  }
}

lint n;
vector<lint> divi;

int main() {
  pre();
  while (scanf("%lld", &n) == 1 && n) {
    divi.clear();
    for (int i = 0; i < prime.size(); i++) {
      if (n % prime[i] == 0) {
        divi.push_back(0);
        while (n % prime[i] == 0) {
          divi.back()++;
          n /= prime[i];
        }
      }
    }
    if (n != 1)
      divi.push_back(1);
    lint ans = 1;
    for (int i = 0; i < divi.size(); i++) {
      ans *= 2 * divi[i] + 1;
    }
    ans++;
    ans /= 2;
    printf("%lld\\n", ans);
  }
  return 0;
}
Problem p00646 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long lint;
int cn[20];
int main() {
  lint L;
  while (cin >> L, L) {
    int k = 0;
    for (int i = 2; (lint)i * i <= L; i++) {
      if (L % i == 0) {
        cn[k] = 0;
        while (L % i == 0) {
          L /= i;
          cn[k]++;
        }
        k++;
      }
    }
    if (L > 1)
      cn[k++] = 1;
    lint ans = 1;
    for (int i = 0; i < k; i++) {
      ans *= (2 * cn[i] + 1);
    }
    cout << (ans / 2 + 1) << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
#include <cstdlib>
#include <cstring>
#define MAXN 1000100
long long n, m;
long long pri[MAXN], v[MAXN];
void init() {
  long long i, j;
  memset(v, 0, sizeof(v));
  v[1] = 0;
  m = 1;
  pri[1] = 2;
  for (i = 3; i <= MAXN - 10; i += 2)
    if (v[i] == 0) {
      pri[++m] = i;
      for (j = i + i + i; j <= MAXN - 10; j += i + i)
        v[j] = 1;
    }
}
long long b, bn;
long long gcd(long long a, long long b) {
  for (long long t = a % b; t; a = b, b = t, t = a % b)
    ;
  return b;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void solve() {
  long long i, j, k, ans = 0;
  for (i = 1; i <= n; i++)
    for (j = i; j <= n; j++)
      if (lcm(i, j) == n)
        ans++;
  printf("%lld\\n", ans);
}
int main() {

  // freopen("j.in","r",stdin);
  // freopen("j.out","w",stdout);
  init();
  while (scanf("%lld", &n) != EOF && n) {
    solve();
  }
  return 0;
}
Problem p00646 (C++) — buggy submission, verdict: Runtime Error

#include <bitset>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;
bitset<1000001> pt;
vector<int> pa;

void MakeTable(int n) {
  pt.reset();
  pt.set(2);

  int i = 2;
  while (++i <= n)
    if (i & 1)
      pt.set(i);

  i = 3;
  while (i * i <= n) {
    for (int j = 3 * i; j < n; j += 2 * i)
      pt.reset(j);
    while (!pt[++i])
      ;
  }
}

void MakeArray(int n) {
  MakeTable(n);
  for (int i = 0; i <= n; i++)
    if (pt[i])
      pa.push_back(i);
}

vector<int> e, te;

int rec(int x) {
  if (x == (int)e.size()) {
    int res = 1;
    for (int i = 0; i < (int)e.size(); i++)
      if (e[i] == te[i])
        res *= (e[i] + 1);
    return res;
  } else {
    int res = 0;
    for (int i = 0; i <= e[x]; i++) {
      te.push_back(i);
      res += rec(x + 1);
      te.pop_back();
    }
    return res;
  }
}

int main() {
  ll l;
  MakeArray(1000000);
  while (scanf("%lld", &l) && l) {
    int j = 0;
    e.clear();
    while (j < (int)pa.size() && pa[j] <= l) {
      int cnt = 0;
      while (!(l % pa[j])) {
        l /= pa[j];
        cnt++;
      }
      if (cnt)
        e.push_back(cnt);
      j++;
    }
    if (l > 1)
      e.push_back(1);
    te.clear();
    int ans = rec(0);
    printf("%d\\n", (ans + 1) / 2);
  }
}

Error: WA

Fixed submission:

#include <bitset>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;
bitset<1000001> pt;
vector<int> pa;

void MakeTable(int n) {
  pt.reset();
  pt.set(2);

  int i = 2;
  while (++i <= n)
    if (i & 1)
      pt.set(i);

  i = 3;
  while (i * i <= n) {
    for (int j = 3 * i; j < n; j += 2 * i)
      pt.reset(j);
    while (!pt[++i])
      ;
  }
}

void MakeArray(int n) {
  MakeTable(n);
  for (int i = 0; i <= n; i++)
    if (pt[i])
      pa.push_back(i);
}

vector<int> e, te;

int rec(int x) {
  if (x == (int)e.size()) {
    int res = 1;
    for (int i = 0; i < (int)e.size(); i++)
      if (e[i] == te[i])
        res *= (e[i] + 1);
    return res;
  } else {
    int res = 0;
    for (int i = 0; i <= e[x]; i++) {
      te.push_back(i);
      res += rec(x + 1);
      te.pop_back();
    }
    return res;
  }
}

int main() {
  ll l;
  MakeArray(1000000);
  while (scanf("%lld", &l) && l) {
    int j = 0;
    e.clear();
    while (pa[j] <= l) {
      int cnt = 0;
      while (!(l % pa[j])) {
        l /= pa[j];
        cnt++;
      }
      if (cnt)
        e.push_back(cnt);
      j++;
    }
    te.clear();
    // int ans = rec(0);
    int ans = 0;
    printf("%d\\n", (ans + 1) / 2);
  }
}
Problem p00646 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
  long long a;
  while (scanf("%lld", &a), a) {
    long long ret = 0;
    vector<long long> v;
    for (int i = 1; (long long)i * i <= a; i++) {
      if (a % i == 0) {
        v.push_back(a / i);
        if ((long long)i * i != a)
          v.push_back(i);
      }
    }
    vector<long long> p;
    long long b = a;
    for (int i = 2; (long long)i * i <= b; i++) {
      if (b % i == 0) {
        p.push_back(i);
        while (b % i == 0)
          b /= i;
      }
    }
    if (b > 1)
      p.push_back(b);
    for (int i = 0; i < v.size(); i++) {
      long long d = a / v[i];
      int tmp = 0;
      for (int j = 0; j < p.size(); j++)
        if (d % p[j] == 0)
          tmp++;
      ret += (1LL << tmp);
    }
    printf("%lld\\n", ret / 2 + 1);
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
  long long a;
  while (scanf("%lld", &a), a) {
    long long ret = 0;
    vector<long long> v;
    for (int i = 1; (long long)i * i <= a; i++) {
      if (a % i == 0) {
        v.push_back(a / i);
        if ((long long)i * i != a)
          v.push_back(i);
      }
    }
    vector<int> p;
    long long b = a;
    for (int i = 2; (long long)i * i <= a; i++) {
      if (b % i == 0) {
        p.push_back(i);
        while (b % i == 0)
          b /= i;
      }
    }
    for (int i = 0; i < v.size(); i++) {
      long long d = a / v[i];
      int tmp = 0;
      for (int j = 0; j < p.size(); j++)
        if (d % p[j] == 0)
          tmp++;
      ret += (1LL << tmp);
    }
    printf("%lld\\n", ret / 2 + 1);
  }
}
Problem p00646 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

ll L;

ll calc(ll x, ll y) {
  if (y == 0) {
    return x;
  } else {
    return calc(y, x % y);
  }
}

void func() {

  if (L == 1) {
    printf("1\\n");
    return;
  }

  vector<ll> DIVISOR;

  for (ll i = 1; i <= sqrt(L); i++) {
    if (L % i == 0) {
      DIVISOR.push_back(i);
      if (i * i != L)
        DIVISOR.push_back(L / i);
    }
  }

  sort(DIVISOR.begin(), DIVISOR.end());

  ll small, big, common;

  int ans = 0;

  for (int i = 0; i < DIVISOR.size(); i++) {
    for (int k = i; k < DIVISOR.size(); k++) {
      small = DIVISOR[i];
      big = DIVISOR[k];

      common = calc(big, small);

      small /= common;
      big /= common;

      if (small * big * common == L)
        ans++;
    }
  }

  printf("%d\\n", ans);
}

int main() {

  while (true) {
    scanf("%lld", &L);
    if (L == 0)
      break;

    func();
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

ll L;

ll calc(ll x, ll y) {
  if (y == 0) {
    return x;
  } else {
    return calc(y, x % y);
  }
}

void func() {

  if (L == 1) {
    printf("1\\n");
    return;
  }

  vector<ll> DIVISOR;

  for (ll i = 1; i <= sqrt(L); i++) {
    if (L % i == 0) {
      DIVISOR.push_back(i);
      DIVISOR.push_back(L / i);
    }
  }

  ll small, big, common;

  int ans = 0;

  for (int i = 0; i < DIVISOR.size(); i++) {
    for (int k = i; k < DIVISOR.size(); k++) {
      small = DIVISOR[i];
      big = DIVISOR[k];

      common = calc(big, small);

      small /= common;
      big /= common;

      if (small * big * common == L)
        ans++;
    }
  }

  printf("%d\\n", ans);
}

int main() {

  while (true) {
    scanf("%lld", &L);
    if (L == 0)
      break;

    func();
  }

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> so, v;
ll ans;
void dfs(int d, int t) {
  if (d == v.size()) {
    ans += t;
    return;
  }
  for (int i = 0; i <= v[d]; i++) {
    int nt = t;
    if (v[d] == i)
      nt *= i + 1;
    dfs(d + 1, nt);
  }
}

int main() {
  ll n;
  while (cin >> n && n) {
    ans = 1;
    v.clear();
    ll tmp = n;
    for (ll i = 2; i * i <= n; i++)
      if (tmp % i == 0) {
        v.push_back(0);
        while (tmp % i == 0)
          tmp /= i, v[v.size() - 1]++;
      }
    if (tmp > 1)
      v.push_back(1);
    dfs(0, 1);
    cout << ans / 2 << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> so, v;
ll ans;
void dfs(int d, int t) {
  if (d == v.size()) {
    ans += t;
    return;
  }
  for (int i = 0; i <= v[d]; i++) {
    int nt = t;
    if (v[d] == i)
      nt *= i + 1;
    dfs(d + 1, nt);
  }
}

int main() {
  ll n;
  while (cin >> n && n) {
    ans = 1;
    v.clear();
    ll tmp = n;
    for (int i = 2; i * i <= n; i++)
      if (tmp % i == 0) {
        v.push_back(0);
        while (tmp % i == 0)
          tmp /= i, v[v.size() - 1]++;
      }
    if (tmp > 1)
      v.push_back(1);
    dfs(0, 1);
    cout << ans / 2 << endl;
  }
  return 0;
}
Problem p00646 (C++) — buggy submission, verdict: Time Limit Exceeded

// 00
#include <iostream>
#include <vector>

using namespace std;

int main() {
  bool cmp[1000001] = {};
  vector<int> prm;
  for (int i = 2; i <= 1000000; i++) {
    if (!cmp[i]) {
      prm.push_back(i);
      for (int j = 2; j * i <= 1000000; j++) {
        cmp[i * j] = true;
      }
    }
  }
  for (long long l; cin >> l, l;) {
    int a = 1;
    for (int i = 0; l != 1 && i < prm.size(); i++) {
      int c = 0;
      while (l % prm[i] == 0) {
        c++;
        l /= prm[i];
      }
      a *= c * 2 + 1;
    }
    if (l != 1) {
      a *= 3;
    }
    cout << (a + 1) / 2 << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

// 00
#include <iostream>
#include <vector>

using namespace std;

int main() {
  bool cmp[1000001] = {};
  vector<int> prm;
  for (int i = 2; i <= 1000000; i++) {
    if (!cmp[i]) {
      prm.push_back(i);
      for (int j = 2; j * i <= 1000000; j++) {
        cmp[i * j] = true;
      }
    }
  }
  for (long long l; cin >> l, l;) {
    int a = 1;
    for (int i = 0; i < prm.size(); i++) {
      int c = 0;
      while (l % prm[i] == 0) {
        c++;
        l /= prm[i];
      }
      a *= c * 2 + 1;
    }
    if (l != 1) {
      a *= 3;
    }
    cout << (a + 1) / 2 << endl;
  }
  return 0;
}
Problem p00646 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  ios_base::sync_with_stdio(false);
  vector<ll> divisors;
  divisors.reserve(4096);
  while (true) {
    ll L;
    cin >> L;
    if (L == 0) {
      break;
    }
    divisors.clear();
    for (ll i = 1; i * i <= L; ++i) {
      if (L % i != 0) {
        continue;
      }
      divisors.push_back(i);
      if (i * i != L) {
        divisors.push_back(L / i);
      }
    }
    sort(divisors.begin(), divisors.end());
    int answer = 0;
    for (int i = 0; i < divisors.size(); ++i) {
      ll b = divisors[i];
      vector<ll>::iterator it =
          lower_bound(divisors.begin(), divisors.end(), L / b);
      for (int j = it - divisors.begin(); j <= i; ++j) {
        ll a = divisors[j];
        if (a * (b / __gcd(a, b)) == L) {
          ++answer;
        }
      }
    }
    cout << answer << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  ios_base::sync_with_stdio(false);
  vector<ll> divisors;
  divisors.reserve(4096);
  while (true) {
    ll L;
    cin >> L;
    if (L == 0) {
      break;
    }
    divisors.clear();
    for (ll i = 1; i * i <= L; ++i) {
      if (L % i != 0) {
        continue;
      }
      divisors.push_back(i);
      if (i * i != L) {
        divisors.push_back(L / i);
      }
    }
    sort(divisors.begin(), divisors.end());
    int answer = 0;
    for (int i = 0; i < divisors.size(); ++i) {
      ll a = divisors[i];
      for (int j = i; j < divisors.size(); ++j) {
        ll b = divisors[j];
        ll lcm = a * (b / __gcd(a, b));
        if (lcm == L) {
          ++answer;
        }
      }
    }
    cout << answer << endl;
  }
  return 0;
}
Problem p00646 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
bool isPrime(ll n) {
  for (ll i = 2; i * i <= n; i++)
    if (n % i == 0)
      return false;
  return true;
}
int main() {
  ll ans = 2;
  ll n;
  vector<ll> p;
  vector<ll> v;
  for (ll i = 2; i < 1000000; i++)
    if (isPrime(i))
      p.push_back(i);
  // cout << p.size() << endl;
  while (1) {
    ans = 2;
    v.clear();
    cin >> n;
    if (n == 0)
      break;
    if (n == 1) {
      cout << 1 << endl;
      continue;
    }
    // cout << n << endl;
    for (ll i = 0; p[i] <= n; i++) {
      // cout << i << n << endl;
      if (i == p.size())
        break;
      if (n % p[i] == 0) {
        ll c = 0;
        while (n % p[i] == 0) {
          n /= p[i];
          c++;
        }
        // cout << p[i] << ":" << c << endl;
        v.push_back(c);

        if (n == 1)
          break;
      }
    }
    if (n != 1)
      v.push_back(1);
    ll m = 0;
    ans = 1;
    for (ll i = 0; i < v.size(); i++) {
      ans *= 2 * v[i] + 1;
    }
    cout << (1 + ans) / 2 << endl;
  }
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
bool isPrime(ll n) {
  for (ll i = 2; i * i <= n; i++)
    if (n % i == 0)
      return false;
  return true;
}
int main() {
  ll ans = 2;
  ll n;
  vector<ll> p;
  vector<ll> v;
  for (ll i = 2; i < 1000000; i++)
    if (isPrime(i))
      p.push_back(i);
  // cout << p.size() << endl;
  while (1) {
    ans = 2;
    v.clear();
    cin >> n;
    if (n == 0)
      break;
    if (n == 1) {
      cout << 1 << endl;
      continue;
    }
    for (ll i = 0; p[i] <= n; i++) {
      if (n % p[i] == 0) {
        ll c = 0;
        while (n % p[i] == 0) {
          n /= p[i];
          c++;
        }
        // cout << p[i] << ":" << c << endl;
        // v.push_back(c);
        if (i + 2 >= p.size())
          break;
        if (n == 1)
          break;
      }
    }
    ll m = 0;
    ans = 1;
    for (ll i = 0; i < v.size(); i++) {
      ans *= 2 * v[i] + 1;
    }

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

#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
ll L;

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

Error: TLE

Fixed submission:

#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)

long long L;

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