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

#include <iostream>
#include <string>

using namespace std;

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

  for (int i = 1; i < N; i++) {
    for (int j = 1; j < N; j++) {
      if (i * j < N) {
        count++;
      } else {
        break;
      }
    }
  }

  cout << count << "\\n";

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

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

  for (int i = 1; i < N; i++) {
    int X = N - i;
    for (int j = 1; j <= X; j++) {
      if (X % j == 0) {
        count++;
      }
    }
  }

  cout << count << "\\n";

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

#include <bits/stdc++.h>

using namespace std;

#define io freopen("test.txt", "r", stdin);
#define fast                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);

#define ull unsigned long long int
#define lli long long int
#define li long int
#define ld long double

#define cout(x) cout << x << " "
#define coutn(x) cout << x << endl
#define newline cout << endl

#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define ar array

#define pii pair<int, int>
#define pll pair<lli, lli>
#define pps pair<pair<int, int>, string>

const int MOD = 1000000007;
const lli INF = 1e18;
const int MX = 100001;
const int N = 1000000;

void solve() {

  int n;
  cin >> n;

  int c = 0;

  for (int i = n - 1; i > 0; i--) {
    int d = n / i;
    if (i * d == n)
      c += d - 1;
    else if (d == i) {
      if (d * i == n)
        c += d - 1;
      else
        c += d;
    } else
      c += d;
    // cout<<c<<"\\n";
  }

  cout << c << "\\n";
}

int main() {
  fast
      // #ifndef godzqa
      //     io
      // #endif

      lli t;
  // cin>>t;
  t = 1;

  while (t--) {
    solve();
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define io freopen("test.txt", "r", stdin);
#define fast                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);

#define ull unsigned long long int
#define lli long long int
#define li long int
#define ld long double

#define cout(x) cout << x << " "
#define coutn(x) cout << x << endl
#define newline cout << endl

#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define ar array

#define pii pair<int, int>
#define pll pair<lli, lli>
#define pps pair<pair<int, int>, string>

const int MOD = 1000000007;
const lli INF = 1e18;
const int MX = 100001;
const int N = 1000000;

void solve() {

  int n;
  cin >> n;

  int c = 0;
  // vector<int>dp(n+1);

  // for(int i=2;i<=n;i++){

  // }
  for (int a = 1; a < max(n, 1000); a++) {
    for (int b = a; b < max(n, 1000); b++) {
      if (n - a * b > 0) {
        if (a == b)
          c++;
        else
          c += 2;
      }
    }
  }

  cout << c << "\\n";
}

int main() {
  fast
      // #ifndef godzqa
      //     io
      // #endif

      lli t;
  // cin>>t;
  t = 1;

  while (t--) {
    solve();
  }

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

/** これを翻訳している間、あなたはあなたの人生のいくつかの貴重な瞬間を無駄にしました **/
#include <bits/stdc++.h>
using namespace std;

#define rep(i, x, y) for (int i = x; i < y; i++)
#define repr(i, x, y) for (int i = x; i >= y; i--)
#define pb push_back
#define ff first
#define ss second
#define sz(x) ((int)x.size())
#define all(x) begin(x), end(x)

using pii = pair<int, int>;
using vi = vector<int>;
using vii = vector<pair<int, int>>;

constexpr int mod = 1000000007;
constexpr int N = 1e6 + 5;
constexpr long long inf = 1e18, eps = 1e-6;

int primes[N];
vi pp;
int getFactors(int x) {
  if (x == 0)
    return 0;
  int prod = 1;
  for (int i = 0; pp[i] * pp[i] <= x && i < pp.size(); i++) {
    if (x % pp[i] == 0) {
      int cnt = 0;
      while (x % pp[i] == 0) {
        x /= pp[i];
        cnt++;
      }
      prod *= (cnt + 1);
    }
  }
  if (x != 1)
    prod *= (2);
  return prod;
}
void Onigiri() {
  int n;
  cin >> n;
  int cnt = 0;
  rep(i, 1, n + 1) {
    int rem = n - i;
    cnt += getFactors(rem);
  }
  cout << cnt;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifdef Zoro
  freopen("/home/pritish/Competitive/in", "r", stdin);
  freopen("/home/pritish/Competitive/out", "w", stdout);
#endif

  memset(primes, -1, sizeof(primes));
  rep(i, 2, 1000001) {
    if (primes[i] == -1) {
      for (int j = i + i; j < 1000001; j += i) {
        primes[j] = 1;
      }
      pp.push_back(i);
    }
  }
  int t = 1;
  // cin>>t;
  while (t--) {
    Onigiri();
    cout << "\\n";
  }

  cerr << "\\n" << (float)clock() / CLOCKS_PER_SEC * 1000 << " ms" << endl;
  return 0;
}

Error: TLE

Fixed submission:

/** これを翻訳している間、あなたはあなたの人生のいくつかの貴重な瞬間を無駄にしました **/
#include <bits/stdc++.h>
using namespace std;

#define rep(i, x, y) for (int i = x; i < y; i++)
#define repr(i, x, y) for (int i = x; i >= y; i--)
#define int long long
#define pb push_back
#define ff first
#define ss second
#define sz(x) ((int)x.size())
#define all(x) begin(x), end(x)

using pii = pair<int, int>;
using vi = vector<int>;
using vii = vector<pair<int, int>>;

constexpr int mod = 1000000007;
constexpr int N = 1e6 + 5;
constexpr int inf = 1e18, eps = 1e-6;

int primes[N];
vi pp;
int getFactors(int x) {
  if (x == 0)
    return 0;
  int prod = 1;
  for (auto &p : pp) {
    if (x % p == 0) {
      int cnt = 0;
      while (x % p == 0) {
        x /= p;
        cnt++;
      }
      prod *= (cnt + 1);
    }
  }
  return prod;
}
void Onigiri() {
  int n;
  cin >> n;
  int cnt = 0;
  rep(i, 1, n + 1) {
    int rem = n - i;
    cnt += getFactors(rem);
  }
  cout << cnt;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifdef Zoro
  freopen("/home/pritish/Competitive/in", "r", stdin);
  freopen("/home/pritish/Competitive/out", "w", stdout);
#endif

  memset(primes, -1, sizeof(primes));
  rep(i, 2, 1000001) {
    if (primes[i] == -1) {
      for (int j = i + i; j < 1000001; j += i) {
        primes[j] = 1;
      }
      pp.push_back(i);
    }
  }
  int t = 1;
  // cin>>t;
  while (t--) {
    Onigiri();
    cout << "\\n";
  }

  cerr << "\\n" << (float)clock() / CLOCKS_PER_SEC * 1000 << " ms" << endl;
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#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() {
  int n;
  ll sum = 0;
  cin >> n;

  for (int i = 1; i < n + 1; i++) {
    int v = (n - 1) / i;
    sum += v;
  }
  cout << sum << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#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() {
  int n, sum;
  sum = 0;
  cin >> n;

  for (int i = 1; i < n; i++) {
    int v = n - i;
    for (int j = 1; j < v + 1; j++) {
      if (v % j == 0)
        sum++;
    }
  }

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

#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define F first
#define S second
#define pb push_back
#define f(i, s, n) for (int i = (int)s; i <= (int)n; ++i)
#define Fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
const int N = 1000000;
void fns() {
  int k = 100;
  int cnt = 0;
  int ans = 0;
  for (ll i = 1; i * i <= k; i++) {
    if (k % i == 0) {
      if (i != k / i) {
        cnt += 2;
      } else
        ++cnt;
    }
  }
  ans += (cnt);
}
void solve() {
  ll n;
  cin >> n;
  ll k = n;
  ll ans = 0;
  for (int i = 1; i < n; i++) {
    k = n - i;
    ll cnt = 0;
    ll temp = 1;
    for (ll j = 2; j * j <= k; ++j) {
      cnt = 0;
      if (k % j == 0) {
        while (k % j == 0)
          k /= j, ++cnt;
      }
      //	cout<<i<<" "<<j<<" "<<cnt<<"\\n"
      temp *= (cnt + 1);
    }
    if (k > 1)
      temp *= 2;
    ans += temp;
  }
  cout << ans << '\\n';
}
int main() {
  Fast;
  //	int t;cin>>t;
  //	while(t--)
  solve();
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define F first
#define S second
#define pb push_back
#define f(i, s, n) for (int i = (int)s; i <= (int)n; ++i)
#define Fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
void solve() {
  ll n;
  cin >> n;
  ll k = n;
  ll ans = 0;
  for (int i = 1; i < n; i++) {
    k = n - i;
    int cnt = 0;
    for (ll J = 1; J * J <= k; J++) {
      if (k % J == 0) {
        if (J != k / J) {
          cnt += 2;
        } else
          ++cnt;
      }
    }
    ans += (cnt);
  }
  cout << ans << '\\n';
}
int main() {
  Fast;
  //	int t;cin>>t;
  //	while(t--)
  solve();
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

/* KYA CODEFORCES MERE BAS KI BAT NHI HAI  */

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define sze 1000005
#define ld long double
// #define ll unsigned long long
#define ll long long
#define endl "\\n"
#define pb push_back
#define mkp make_pair
#define mod 1000000007
#define ff first
#define ss second
#define F(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)
#define RF(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define all(c) (c).begin(), (c).end()
#define pi pair<int, int>
#define pll pair<ll, ll>
#define IOS                                                                    \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);                                                                  \\
  cout.tie(0);

using namespace std;

// cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;
// const ll inf=1ll<<60;
// const double pi = 3.14159265358979323846;

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


Error: TLE

Fixed submission:

/* KYA CODEFORCES MERE BAS KI BAT NHI HAI  */

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define sze 1000005
#define ld long double
// #define ll unsigned long long
#define ll long long
#define endl "\\n"
#define pb push_back
#define mkp make_pair
#define mod 1000000007
#define ff first
#define ss second
#define F(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)
#define RF(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define all(c) (c).begin(), (c).end()
#define pi pair<int, int>
#define pll pair<ll, ll>
#define IOS                                                                    \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);                                                                  \\
  cout.tie(0);

using namespace std;

// cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;
// const ll inf=1ll<<60;
// const double pi = 3.14159265358979323846;

int main() {
  ll n;
  cin >> n;
  ll c = 0;
  while (n >= 2) {
    ll n1 = n;
    n1--;
    for (ll i = 1; i <= sqrt(n1); i++) {
      if (n1 % i == 0) {
        if (n1 / i != i) {
          c += 2;
        } else {
          c++;
        }
      }
    }
    n = n1;
  }
  cout << c << endl;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\\n"
#define pb push_back
#define sq(a) (a) * (a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << '=' << (x) << endl;
#define debugv(v)                                                              \\
  cerr << #v << " : ";                                                         \\
  for (auto x : v)                                                             \\
    cerr << x << ' ';                                                          \\
  cerr << endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);

ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

ll exp(ll x, ll n, ll mod) {
  ll result = 1;
  while (n) {
    if (n & 1)
      result = (result * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return result;
}

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

      ll n;
  cin >> n;

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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\\n"
#define pb push_back
#define sq(a) (a) * (a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << '=' << (x) << endl;
#define debugv(v)                                                              \\
  cerr << #v << " : ";                                                         \\
  for (auto x : v)                                                             \\
    cerr << x << ' ';                                                          \\
  cerr << endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);

ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

ll exp(ll x, ll n, ll mod) {
  ll result = 1;
  while (n) {
    if (n & 1)
      result = (result * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return result;
}

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

      ll n;
  cin >> n;

  ll ans = 1;
  for (ll i = 2; i < n; i++) {
    ll curr = 2;
    for (ll j = 2; j * j <= i; j++) {
      if (i % j == 0) {
        if (j * j == i)
          curr++;
        else
          curr += 2;
      }
    }

    ans += curr;
  }

  cout << ans << endl;

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

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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i < n; ++i) {
    int a, b;
    a = i;
    b = (n - 1) / a;
    ans += b;
  }
  cout << ans << "\\n";
}


Error: TLE

Fixed submission:

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

int numof(int n) {
  // if(n==1) return 1;
  int ans = 0;
  for (int i = 1; i <= sqrt(n); ++i) {
    if (n % i == 0) {
      if (n / i == i)
        ans++;
      else
        ans += 2;
    }
  }
  return ans;
}

int main() {
  // cout<<numof(1)<<"\\n";
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i < n; ++i) {
    ans += numof(i);
  }
  cout << ans << "\\n";
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; i * j < n; j++) {
      cnt++;
    }
  }
  printf("%d\\n", cnt);
  return 0;
}


Error: TLE

Fixed submission:

#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    int j = n - i;
    for (int k = 1; k <= sqrt(j); k++) {
      if (k == sqrt(j)) {
        cnt++;
      } else if (j % k == 0) {
        cnt += 2;
      }
    }
  }
  printf("%d\\n", cnt);
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int a = 1; a * a <= n; a++) {
    for (int b = a; b <= n; b++) {
      int c = n - a * b;
      if (c > 0) {
        if (a == b)
          ans++;
        else
          ans += 2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int c = 1; c < n; c++) {
    int ab = n - c;
    for (int a = 1; a * a <= ab; a++) {
      if (ab % a == 0) {
        int b = ab / a;
        if (a == b) {
          ans++;
        } else {
          ans += 2;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (inti = a; i <= b; i++)

#define MOD 1000000007
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;

  vector<ll> v(n + 1, 1);
  for (ll index = 2; index <= n; index++) {
    for (ll j = index; j <= n; j += index)
      v[j]++;
  }

  v[0] = 0;
  ll ans = 0;

  for (int c = 1; c < n; c++) {
    ans += v[n - c];
  }

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


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (inti = a; i <= b; i++)

#define MOD 1000000007
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

ll divisor(ll n) {
  ll ans = 0;
  ll x = (ll)sqrt(n);
  for (ll index = 1; index <= x; index++)
    if (n % index == 0)
      ans += 2;
  if (x && x * x == n)
    ans--;

  // cout<<n<<" "<<ans<<endl;
  return ans;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;

  ll ans = 0;
  vector<int> v(n, 0);
  for (ll c = 1; c <= n; c++) {
    if (((n - c) % 2 == 0) && v[(n - c) / 2])
      ans += v[(n - c) / 2] + 2;
    else {
      v[n - c] = divisor(n - c);
      ans += v[n - c];
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ld long double
#define pb push_back
#define mp make_pair
#define fi(i, start, end) for (int i = start; i < end; ++i)
#define Fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
// #define mod 1000000007

using namespace std;

int main() {
  long long unsigned int n;
  cin >> n;
  if (n == 2) {
    cout << 1;
    return 0;
  }
  long long unsigned int ans = 0;
  for (long long unsigned int a = 1; a < sqrt(n - 1); a++) {
    for (long long unsigned int b = a; a * b < n; b++) {
      ans++;
    }
  }
  ans = ans * 2;

  ans = ans - int(sqrt(n - 1));
  cout << ans;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ld long double
#define pb push_back
#define mp make_pair
#define fi(i, start, end) for (int i = start; i < end; ++i)
#define Fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
// #define mod 1000000007

using namespace std;

int main() {
  long long unsigned int n;
  cin >> n;
  if (n == 2) {
    return 1;
  }
  long long unsigned int ans = 0;
  for (long long unsigned int a = 1; a < sqrt(n - 1); a++) {
    for (long long unsigned int b = a; a * b < n; b++) {
      ans++;
    }
  }
  ans = ans * 2;

  ans = ans - int(sqrt(n - 1));
  cout << ans;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <string>

int main() {
  int n;
  scanf("%d", &n);
  int cnt = 0;
  for (int i = 1; i <= n / 2; i++) {
    int tmp = 2 * ((n - 1) / i) - ((i * 2) - 1);
    cnt += (tmp < 0) ? 0 : tmp;
  }
  printf("%d\\n", cnt);
  return 0;
}

Error: TLE

Fixed submission:

#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <string>

int main() {
  int n;
  scanf("%d", &n);
  int cnt = 0;
  for (int i = 1; i <= n - 1; i++) {
    for (int k = 2; k <= sqrt(i); k++) {
      if (i % k == 0) {
        cnt = (k == i / k) ? cnt + 1 : cnt + 2;
      }
    }
  }
  printf("%d\\n", cnt + (2 * (n - 1)) - 1);
  return 0;
}
Problem p02548 (C++) — buggy submission, verdict: Time Limit Exceeded

//-- In the name of ALLAH --
// We're nothing and you're everything.
// Ya Ali!
#include <bits/stdc++.h>
using namespace std;

#define pai acos(-1)
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll, ll>
#define sz(a) (ll) a.size()
#define endl "\\n"
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b))
#define all(vec) vec.begin(), vec.end()
#define ms(a, b) memset(a, b, sizeof(a))
#define TEST_CASE(t) for (int zz = 1; zz <= t; zz++)
#define PRINT_CASE printf("Case %d: ", zz)
#define fii freopen("input.txt", "r", stdin);
#define foo freopen("output.txt", "w", stdout);
#define FAST                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);

const ll M = 1e9 + 7;
const ll mxn = 1e6 + 5;

int main() {
  FAST;
  ll i, j, k, a, b, c, d, n, m, t, x, y, z, u, v;
  cin >> n;
  ll cnt = 0;
  for (i = 1; i < n; i++) {
    for (j = 1; i * j < n; j++) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Error: TLE

Fixed submission:

//-- In the name of ALLAH --
// We're nothing and you're everything.
// Ya Ali!
#include <bits/stdc++.h>
using namespace std;

#define pai acos(-1)
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll, ll>
#define sz(a) (ll) a.size()
#define endl "\\n"
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b))
#define all(vec) vec.begin(), vec.end()
#define ms(a, b) memset(a, b, sizeof(a))
#define TEST_CASE(t) for (int zz = 1; zz <= t; zz++)
#define PRINT_CASE printf("Case %d: ", zz)
#define fii freopen("input.txt", "r", stdin);
#define foo freopen("output.txt", "w", stdout);
#define FAST                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);

const ll M = 1e9 + 7;
const ll mxn = 1e6 + 5;

int main() {
  FAST;
  ll i, j, k, a, b, c, d, n, m, t, x, y, z, u, v;
  cin >> n;
  ll cnt = 0;
  for (i = 1; i < n; i++) {
    for (j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        cnt++;
        if (i / j != j) {
          cnt++;
        }
        // cout<<i<<" "<<cnt<<endl;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}