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

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int a = 1; a < N; a++) {
    ans += N / a;
    if (N % a == 0)
      ans--;
  }
  cout << ans;
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 1; i < N; i++) {
    int x = N - i;
    for (int j = 1; j * j <= x; j++) {
      if (x % j == 0)
        ans += 2;
      if (j * j == x)
        ans--;
    }
  }
  cout << ans;
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long long n, i, j;
  cin >> n;
  long long ans = 0;
  for (i = 1; i < n; i++) {
    j = n / i;
    if (n % i == 0) {
      j--;
    }
    ans += j;
  }
  cout << ans;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
long long solve(long long x) {
  set<long long> ms;
  for (long long i = 1; i <= sqrt(x); i++) {
    if (x % i == 0) {
      ms.insert(i);
      ms.insert(x / i);
    }
  }
  long long ans = 0;
  if (!ms.empty())
    ans = ms.size();
  return ans;
}
int main() {
  long long n, i, j;
  cin >> n;
  long long ans = 0;
  for (i = 1; i < n; i++) {
    long long x = n - i;
    // cout<<solve(x)<<" ";
    ans = ans + solve(x);
  }
  cout << ans;
}
Problem p02548 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
typedef long long ll;
#define m 1000000007
using namespace std;
int main() {
  /*string s;
  cin>>s;
  int n=s.size();
  if(s[n-1]=='s')
      s.append("es");
  else
      s.append("s");
  cout<<s<<endl;
      int n;bool c=false;
      cin>>n;
  int a[n],b[n];
  for(int i=0;i<n;i++)
      cin>>a[i]>>b[i];

  for(int i=0;i<n;i++)
  {

      if(a[i]==b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2])
          c=true;
  }
  if(c)
      cout<<"Yes"<<endl;
  else
      cout<<"No"<<endl;*/

  ll n, ans = 0;
  cin >> n;

  for (int i = 1; i <= n; i++)
    ans += (n - 1) / i;

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


Error: -8

Fixed submission:

#include <bits/stdc++.h>
typedef long long ll;
#define m 1000000007
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  --n;
  for (int i = 0; i <= n; i++)
    ans += n / i;

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  ll ret = 0;
  vector<int> prime(1e6 + 5, true);
  prime[1] = false;
  for (int p = 2; p * p <= 1e6; p++) {
    if (prime[p]) {
      for (int i = p * p; i <= 1e6; i += p)
        prime[i] = false;
    }
  }
  for (ll i = 1; i <= n; i++) {
    for (ll j = 1; j <= n; j++) {
      if (i * j > n) {
        break;
      }
      if (n - (i * j) > 0) {
        ret++;
      }
    }
  }
  cout << ret << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
ll get_factors(int n) {
  ll ret = 0;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        ret++;
      else
        ret += 2;
    }
  }
  return ret;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  ll ret = 0;
  vector<int> prime(1e6 + 5, true);
  prime[1] = false;
  for (int p = 2; p * p <= 1e6; p++) {
    if (prime[p]) {
      for (int i = p * p; i <= 1e6; i += p)
        prime[i] = false;
    }
  }
  for (int i = 1; i < n; i++) {
    if (n - i > 0) {
      if (prime[n - i])
        ret += 2;
      else
        ret += get_factors(n - i);
    }
  }
  cout << ret << endl;
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

  ll count = 0;
  for (int a = 1; a < n; a++) {
    if (n % a == 0) {
      count += n / a - 1;
    } else
      count += n / a;
  }
  cout << count << endl;

  return 0;
}

Error: TLE

Fixed submission:

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

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

  ll count = 0;
  for (int c = 1; c <= n - 1; c++) {
    int N = n - c;
    for (int b = 1; b * b <= N; b++) {
      if (N % b == 0) {
        if (N / b == b)
          count += 1;
        else
          count += 2;
      }
    }
  }
  cout << count << endl;
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 1000000009;
const ll LINF = 1e18;

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += (n - 1) / i;
  }
  cout << ans << endl;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;

vector<long long> enum_divisors(long long N) {
  vector<long long> res;
  for (long long i = 1; i * i <= N; ++i) {
    if (N % i == 0) {
      res.push_back(i);

      if (N / i != i)
        res.push_back(N / i);
    }
  }
  //  sort(res.begin(), res.end());
  return res;
}

int main() {
  ll cnt = 1;
  long long N;
  cin >> N;

  for (ll i = 2; i < N; ++i) {
    const auto &res = enum_divisors(i);
    cnt += res.size();
  }
  cout << cnt << endl;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long
using namespace std;
long long arr[1000007];
long long cs[1000007];
long long ps[1000007];

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

  long long cnt = 0;

  for (int i = 1; i <= n; i++) {
    cnt += n / i;
  }

  cout << cnt << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
using namespace std;
long long arr[1000007];
long long cs[1000007];
long long ps[1000007];
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
int main() {
  long long n;
  cin >> n;
  long long cnt = 0;

  for (long long i = 1; i <= n - 1; i++) {
    set<int> st;

    for (long long j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        st.insert(j);
        st.insert(i / j);
      }
    }

    // cout<<i<<" "<<st.size()<<endl;

    cnt += st.size();
  }

  cout << cnt << endl;

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

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

// vector<long long> enum_divisors(long long N) {
//     vector<long long> res;
//     for (long long i = 1; i * i <= N; ++i) {
//         if (N % i == 0) {
//             res.push_back(i);
//             // 重複しないならば i の相方である N/i も push
//             if (N/i != i) res.push_back(N/i);
//         }
//     }
//     // 小さい順に並び替える
//     //sort(res.begin(), res.end());
//     return res;
// }

int main() {
  long long N;
  cin >> N;
  long long kake_count = 0;

  vector<long long> cnt(N + 1, 1);
  for (int i = 2; i <= N - 1; ++i) {
    for (int j = i; j <= N - 1; j += i) {
      cnt[j]++;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= N - 1; ++i) {
    ans += cnt[i];
  }

  cout << ans << endl;

  // for(int i=1; i<=N-1; ++i){
  //     long long kakeru = i;
  //     long long tasu = N-1;
  //     // if(kakeru == 1){
  //     //     kake_count +=1;
  //     // }else{
  //     //     auto res = enum_divisors(kakeru);
  //     //     kake_count += res.size();
  //     // }
  // }

  // cout << kake_count << endl;
}

Error: TLE

Fixed submission:

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

vector<long long> enum_divisors(long long N) {
  vector<long long> res;
  for (long long i = 1; i * i <= N; ++i) {
    if (N % i == 0) {
      res.push_back(i);
      // 重複しないならば i の相方である N/i も push
      if (N / i != i)
        res.push_back(N / i);
    }
  }
  // 小さい順に並び替える
  // sort(res.begin(), res.end());
  return res;
}

int main() {
  long long N;
  cin >> N;
  long long kake_count = 0;

  for (int i = 1; i <= N - 1; ++i) {
    long long kakeru = i;
    long long tasu = N - 1;
    if (kakeru == 1) {
      kake_count += 1;
    } else {
      auto res = enum_divisors(kakeru);
      kake_count += res.size();
    }
  }

  cout << kake_count << endl;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, s, n) for (ll i = s; i < (n); i++)
using namespace std;

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  rep2(i, 1, n) { ans += (n - 1) / i; }
  cout << ans << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, s, n) for (ll i = s; i < (n); i++)
using namespace std;

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  rep2(i, 1, n) {
    ll rn = sqrt(i);
    ll temp = 0;
    rep2(j, 1, rn + 1) {
      if (i % j == 0)
        temp++;
    }
    ans += temp * 2;
    if (i == rn * rn)
      ans--;
  }
  cout << ans << endl;

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

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

#define watch(x) cout << (#x) << " is " << (x) << "\\n"
#define watch2(x, y)                                                           \\
  cout << (#x) << " is " << (x) << " and " << (#y) << " is " << (y) << "\\n"
#define watch3(x, y, z)                                                        \\
  cout << (#x) << " is " << (x) << " and " << (#y) << " is " << (y) << " and " \\
       << (#z) << " is " << (z) << "\\n"

#define ll long long
#define ff first
#define ss second
#define null NULL
#define all(c) (c).begin(), (c).end()
#define nl "\\n"

#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define mod 1000000007

typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;

int main() {

  // Use ctrl+shift+b ( second option )
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  ll n;
  cin >> n;

  ll ans = 0;
  for (ll i = 1; i < n; i++) {
    ans += (n - 1) / i;
  }

  cout << ans << nl;

  return 0;
}


Error: TLE

Fixed submission:

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

#define watch(x) cout << (#x) << " is " << (x) << "\\n"
#define watch2(x, y)                                                           \\
  cout << (#x) << " is " << (x) << " and " << (#y) << " is " << (y) << "\\n"
#define watch3(x, y, z)                                                        \\
  cout << (#x) << " is " << (x) << " and " << (#y) << " is " << (y) << " and " \\
       << (#z) << " is " << (z) << "\\n"

#define ll long long
#define ff first
#define ss second
#define null NULL
#define all(c) (c).begin(), (c).end()
#define nl "\\n"

#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define mod 1000000007

typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;

ll countdiv(ll n) {

  vector<ll> hashv(n + 1, 1);
  for (ll p = 2; p * p < n; p++) {
    if (hashv[p] == 1) {
      for (ll i = p * 2; i < n; i += p)
        hashv[i] = 0;
    }
  }

  ll ans = 1;
  for (ll p = 2; p <= n; p++) {
    if (hashv[p]) {
      ll count = 0;
      if (n % p == 0) {
        while (n % p == 0) {
          n = n / p;
          count++;
        }

        ans = ans * (count + 1);
      }
    }
  }

  return ans;
}

int main() {

  // Use ctrl+shift+b ( second option )
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  ll n;
  cin >> n;

  ll ans = 0;
  for (ll i = 1; i < n; i++) {
    ans += countdiv(n - i);
  }

  cout << ans << nl;

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

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#define ll long long int
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  n--;
  // for(n=1;n<100;n++)
  //{
  ll cnt = 0;
  for (ll i = 1; i <= n; i++) {
    cnt += (n / i);
  }

  cout << cnt << "\\n";

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#define ll long long int
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  ll cnt = 0;
  for (ll i = 1; i < n; i++) {
    ll num = n - i;
    for (ll j = 1; j <= sqrt(num); j++) {
      if ((num % j) == 0) {
        ll num1 = j, num2 = num / j;
        if (num1 == num2)
          cnt++;
        else
          cnt += 2;
      }
    }
  }
  cout << cnt << "\\n";

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

#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
using namespace std;

int primes[1000001];

void seive() {
  for (int i = 2; i <= 1000000; ++i) {
    if (primes[i] == 0) {
      for (int j = i; j <= 1000000; j += i) {
        if (primes[j] == 0)
          primes[j] = i;
      }
    }
  }
}

long long int getDiv(int n) {
  if (n == 1)
    return 1;
  map<int, int> m;
  int temp1 = n;
  while (n != 1) {
    int val = primes[n];
    n = n / val;
    m[val]++;
  }
  long long int temp = 1;
  for (auto &p : m) {
    temp *= ((long long int)p.second + 1);
  }
  return temp;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  seive();
  int n;
  cin >> n;
  long long int count = 0;
  for (int i = 1; i < n; ++i) {
    count += getDiv(i);
  }
  cout << count << '\\n';
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long int count = 0;
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j * j <= i; ++j) {
      if (i % j == 0) {
        count++;
        if (i / j != j)
          count++;
      }
    }
  }
  cout << count << '\\n';
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

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

ll mod(ll a, ll b) {
  ll ret = a % b;
  if (ret < 0)
    ret += b;
  return ret;
}

ll modpow(ll a, ll b, ll c) {
  ll res = 1;
  while (b > 0) {
    if (b & 1)
      res = mod(res * a, c);
    a = mod(a * a, c);
    b >>= 1;
  }
  return res;
}

int GCD(int x, int y) {
  if (x < y) {
    swap(x, y);
  }
  while (x % y != 0) {
    int temp = x;
    x = y;
    y = temp % y;
  }
  return y;
}

int digitsum(int x) {
  int sum = 0;
  while (x > 0) {
    sum += (x % 10);
    x /= 10;
  }
  return sum;
}

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n - 1; i++) {
    ans += (n - 1) / i;
  }
  cout << ans << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

ll mod(ll a, ll b) {
  ll ret = a % b;
  if (ret < 0)
    ret += b;
  return ret;
}

ll modpow(ll a, ll b, ll c) {
  ll res = 1;
  while (b > 0) {
    if (b & 1)
      res = mod(res * a, c);
    a = mod(a * a, c);
    b >>= 1;
  }
  return res;
}

int GCD(int x, int y) {
  if (x < y) {
    swap(x, y);
  }
  while (x % y != 0) {
    int temp = x;
    x = y;
    y = temp % y;
  }
  return y;
}

int digitsum(int x) {
  int sum = 0;
  while (x > 0) {
    sum += (x % 10);
    x /= 10;
  }
  return sum;
}

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n - 1; i++) {
    int cnt = 0;
    int cur;
    for (int j = 1; j <= sqrt(i); j++) {
      if (i % j == 0) {
        cnt++;
        cur = j;
      }
    }
    if (cur * cur == i)
      cnt = 2 * cnt - 1;
    else
      cnt *= 2;
    ans += cnt;
  }
  cout << ans << endl;
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

  Int ans = 0;
  for (int a = 1; a <= N; ++a) {
    for (int b = 1; a * b < N; ++b) {
      ++ans;
    }
  }
  cout << ans << "\\n";

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

  Int ans = 0;
  for (Int C = 1; C < N; ++C) {
    Int n = N - C;
    for (Int A = 1; A * A <= n; ++A) {
      if (n % A != 0) {
        continue;
      }
      if (A * A == n) {
        ans += 1;
      } else {
        ans += 2;
      }
    }
  }
  cout << ans << "\\n";

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

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

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)                                                                   \\
  int x;                                                                       \\
  cin >> x;                                                                    \\
  while (x--)

int32_t main() {

  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += (n - 1) / i;
  }
  cout << ans << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 2; i <= n - 1; i++) {
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        if (j == i / j) {
          ans++;
        } else {
          ans += 2;
        }
      }
    }
  }
  cout << ans + 1 << endl;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, f, n) for (int i = f; i < (n); i++)

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

  REP(a, 1, n) { ans += (n - 1) / a; }
  cout << ans << endl;

  //--debug : end_stoper
  // string end_stoper; cin >> end_stoper;

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, f, n) for (int i = f; i < (n); i++)
int m_x[4] = {0, 0, -1, 1};
int m_y[4] = {-1, 1, 0, 0};

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

  for (int i = 1; i * i <= n; i++) {
    REP(j, 1, n) {
      int a = n - j;
      if (i * i <= a)
        if (a % i == 0) {
          ans++;
          // 重複しないならば i の相方である N/i も push
          if (a / i != i)
            ans++; // cotae[j]++;
        }
    }
  }
  cout << ans << endl;

  //--debug : end_stoper
  // string end_stoper; cin >> end_stoper;

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

#include <bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll, ll>
#define mod 1000000007 // 998244353
#define f(i, a, b) for (ll i = a; i < b; i++)
#define fb(i, a, b) for (ll i = a; i > b; i--)
#define ff first
#define ss second
#define srt(v)                                                                 \\
  if (!v.empty())                                                              \\
  sort(v.begin(), v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll, vector<ll>, greater<ll>()>
using namespace std;
ll pow_mod(ll a, ll b) {
  ll res = 1;
  while (b != 0) {
    if (b & 1) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    b /= 2;
  }
  return res;
}
ll l[1000001];
bool mark[1000001];
void solve() {
  ll n;
  cin >> n;

  ll ans = 0;

  if (n != 1) {
    // ll res=1;
    for (ll i = 1; i < n; i++) {
      ll x = n - i;
      ll res = 1;
      while (l[x] > 1) {
        ll tmp = 0;
        ll y = l[x];

        while (x > 1 && x % y == 0) {
          x /= y;
          tmp++;
        }

        res *= (1 + tmp);
      }

      ans += res;
    }
  }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  // Start from Here.
  memset(mark, false, sizeof(mark));

  l[1] = 1;
  for (ll i = 2; i < 1000001; i++) {
    if (!mark[i]) {
      l[i] = i;

      for (ll j = i * i; j < 1000001; j += i) {
        if (!mark[j]) {
          mark[j] = true;
          l[j] = i;
        }
      }
    }
  }
  ll t;
  t = 1;
  // cin>>t;
  while (t--)
    solve();

  // Good Bye!
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll, ll>
#define mod 1000000007 // 998244353
#define f(i, a, b) for (ll i = a; i < b; i++)
#define fb(i, a, b) for (ll i = a; i > b; i--)
#define ff first
#define ss second
#define srt(v)                                                                 \\
  if (!v.empty())                                                              \\
  sort(v.begin(), v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll, vector<ll>, greater<ll>()>
using namespace std;
ll pow_mod(ll a, ll b) {
  ll res = 1;
  while (b != 0) {
    if (b & 1) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    b /= 2;
  }
  return res;
}
void solve() {
  ll n;
  cin >> n;

  ll ans = 0;

  if (n != 1) {

    for (ll i = 1; i < n; i++) {
      ll x = n - i;

      ll res = 0;

      for (ll j = 1; j * j <= x; j++) {
        if (x % j == 0) {
          res++;

          if (j * j != x)
            res++;
        }
      }
      ans += res;
    }
  }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  // Start from Here.

  ll t;
  t = 1;
  // cin>>t;
  while (t--)
    solve();

  // Good Bye!
  return 0;
}