prithivMLmods/Coder-Stat huggingface dataset:
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
//"BISMILLAHIR RAHMANIR RAHIM"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const long long M = 1e9 + 7;
ll fact(ll x, ll y) {
  ll f = 1, i = 1;
  while (i <= y) {
    f = ((f % M) * (x % M)) % M;
    i++;
  }
  return f;
}
int main() {
  ll n, i, cnt = 0, x, y, j;
  cin >> n;
  for (i = 1; i < n; i++) {
    x = n - i;
    for (j = 1; j * j < x; j++) {
      if (x % j == 0)
        cnt += 2;
    }
    y = sqrt(x);
    if (y * y == x)
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Fixed submission:
//"BISMILLAHIR RAHMANIR RAHIM"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const long long M = 1e9 + 7;
ll fact(ll x, ll y) {
  ll f = 1, i = 1;
  while (i <= y) {
    f = ((f % M) * (x % M)) % M;
    i++;
  }
  return f;
}
int main() {
  ll n, i, cnt = 0, x, y, j;
  cin >> n;
  for (i = 1; i < n; i++) {
    for (j = 1; i * j < n; j++)
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef map<string, int> msi;
typedef pair<int, int> PII;

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= pow(n - i, 0.5); j++) {
      if ((n - i) % j == 0) {
        if ((double)j != pow(n - i, 0.5))
          ans += 2;
        else
          ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef map<string, int> msi;
typedef pair<int, int> PII;

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

Buggy submission (status: Time Limit Exceeded):
// author: vinoda
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  long count = 0;
  for (int i = 1; i <= 1e6; ++i) {
    if (i > n)
      break;
    for (int j = 1; j <= 1e6; ++j) {
      if (j > n)
        break;
      int c = n - i * j;
      if (c > 0)
        ++count;
    }
  }
  cout << count << endl;
}


Fixed submission:
// author: vinoda
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  long count = 0;
  for (int i = 1; i < n; ++i)
    count += (n - 1) / i;
  cout << count << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#include <algorithm>
#include <cmath>
using namespace std;
pair<ll, ll> norm(ll a, ll b) {
  if (a < 0) {
    a *= -1;
    b *= -1;
  } else if ((a == 0) && (b < 0)) {
    b *= -1;
  }
  ll d = __gcd(abs(a), abs(b));
  a = (ll)(a / d);
  b = (ll)(b / d);
  pair<ll, ll> p = mp(a, b);
  return p;
}
bool decreasing(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.first > b.first)
    return true;
  else if (a.first == b.first) {
    if (a.second < b.second)
      return false;
    else
      return true;
  } else
    return false;
}
ll expo(ll x, ll y) {
  ll res = 1;
  while (y > 0) {
    if (y & 1)
      res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
int main() {
  // ios_base::sync_with_stdio(false);
  // cin.tie(NULL);
  // int T,p;
  // cin>>T;
  // for(p=1;p<=T;p++)
  // {
  ll N;
  cin >> N;
  ll i, j, k, a, b, c;
  ll count = 0;
  for (i = 1; i < N; i++) {
    a = N - i;
    for (j = 1; j * j <= a; j++) {
      if (a % j == 0) {
        k = a / j;
        if (k == j)
          count++;
        else
          count += 2;
      }
    }
  }
  cout << count;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#include <algorithm>
#include <cmath>
using namespace std;
pair<ll, ll> norm(ll a, ll b) {
  if (a < 0) {
    a *= -1;
    b *= -1;
  } else if ((a == 0) && (b < 0)) {
    b *= -1;
  }
  ll d = __gcd(abs(a), abs(b));
  a = (ll)(a / d);
  b = (ll)(b / d);
  pair<ll, ll> p = mp(a, b);
  return p;
}
bool decreasing(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.first > b.first)
    return true;
  else if (a.first == b.first) {
    if (a.second < b.second)
      return false;
    else
      return true;
  } else
    return false;
}
ll expo(ll x, ll y) {
  ll res = 1;
  while (y > 0) {
    if (y & 1)
      res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
int main() {
  // ios_base::sync_with_stdio(false);
  // cin.tie(NULL);
  // int T,p;
  // cin>>T;
  // for(p=1;p<=T;p++)
  // {
  ll N;
  cin >> N;
  ll i, j, k, a, b, c;
  ll count = 0;
  for (i = 1; i < N; i++) {
    a = N - 1;
    b = (ll)(a / i);
    count += b;
  }
  cout << count;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, j, i, p = 0, k, l;
  cin >> n;
  for (i = 1; i <= n - 1; i++) {
    k = n - i;
    for (j = 1; j <= sqrt(k); j++) {
      if (k % j == 0) {
        if (j * j == k)
          p = p + 1;
        else
          p = p + 2;
      }
    }
  }
  cout << p;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, j, i, p = 0, k, l;
  cin >> n;
  p = p;
  for (i = 1; i <= n; i++) {
    p = p + n / i;
    if (n % i == 0) {
      p = p - 1;
    }
  }
  cout << p;

  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int cnt = 0;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = 1; j <= n; j++) {
      for (long long int k = 1; k <= n; k++) {
        if ((i * j) + k == n) {
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int cnt = 0;
  for (long long int i = 1; i < n; i++) {
    for (long long int j = 1; i * j < n; j++) {
      cnt++;
    }
  }
  cout << cnt << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long int
#define pb push_back
int main() {
  ll a, cnt = 0;
  cin >> a;
  for (ll i = 1; i < a; i++) {
    ll cur = a - i;
    for (ll j = 1; j <= sqrt(cur); j++) {
      if (j * j == cur)
        cnt++;
      else if (cur % j == 0)
        cnt += 2;
    }
  }
  cout << cnt << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long int
#define pb push_back
int main() {
  ll a, cnt = 0;
  cin >> a;
  for (ll i = 1; i <= a; i++) {
    cnt += a / i;
    if (a % i == 0)
      cnt--;
  }
  cout << cnt << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int count = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (n - (i * j) > 0) {
        count++;
      }
    }
  }
  cout << count << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int count = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n / i; j++) {
      if (n - (i * j) > 0) {
        count++;
      }
    }
  }
  cout << count << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <stack>
#include <string>
#include <unordered_map>

using namespace std;
typedef long long ll;
const ll INF = 1000000007;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (n); ++i)

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

Fixed submission:
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <stack>
#include <string>
#include <unordered_map>

using namespace std;
typedef long long ll;
const ll INF = 1000000007;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {
  ll N;
  cin >> N;
  ll ans = 0;
  for (int i = 1; i < N; i++) {
    ans += floor((double)(N - 1) / i);
  }
  cout << ans << endl;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
/* https://codeforces.com/contest/1360/problem/H */
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;

#define f first
#define s second
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert

const int MAX = INT_MAX;
const int MOD = 998244353;

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= N; ++j)
      for (int k = 1; k <= N; ++k)
        if (j * i + k == N)
          ans++;

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


Fixed submission:
/* https://codeforces.com/contest/1360/problem/H */
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;

#define f first
#define s second
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert

const int MAX = INT_MAX;
const int MOD = 998244353;

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 1; i < N; ++i)
    for (int j = 1; i * j < N; ++j)
      ans++;

  cout << ans << endl;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
#include <string.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i, N) for (int i = 0; i < (int)N; i++)
static inline void PUT(char c) {
  static char buf[1 << 15], *ptr = buf;
  if (ptr == buf + strlen(buf) || c == 0) {
    fwrite(buf, 1, ptr - buf, stdout), ptr = buf;
  }
  *ptr++ = c;
}
static inline int IN(void) {
  int x = 0, f = 0, c = getchar();
  while (c < 48 || c > 57) {
    f ^= c == 45, c = getchar();
  }
  while (c > 47 && c < 58) {
    x = x * 10 + c - 48, c = getchar();
  }
  return f ? -x : x;
}
static inline void OUT(int a) {
  if (a < 0)
    PUT('-'), a = -a;
  int d[40], i = 0;
  do {
    d[i++] = a % 10;
  } while (a /= 10);
  while (i--) {
    PUT(d[i] + 48);
  }
  PUT('\n');
}
int main() {
  int N = IN(), count = 0;
  rep(i, N) rep(j, N) rep(k, N) {
    if ((i + 1) * (j + 1) + k + 1 == N) {
      count++;
    }
  }
  return OUT(count), 0;
}

Fixed submission:
#include <stdio.h>
#include <string.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i, N) for (int i = 0; i < (int)N; i++)
static inline void PUT(char c) {
  static char buf[1 << 15], *ptr = buf;
  if (ptr == buf + strlen(buf) || c == 0) {
    fwrite(buf, 1, ptr - buf, stdout), ptr = buf;
  }
  *ptr++ = c;
}
static inline int IN(void) {
  int x = 0, f = 0, c = getchar();
  while (c < 48 || c > 57) {
    f ^= c == 45, c = getchar();
  }
  while (c > 47 && c < 58) {
    x = x * 10 + c - 48, c = getchar();
  }
  return f ? -x : x;
}
static inline void OUT(int a) {
  if (a < 0)
    PUT('-'), a = -a;
  int d[40], i = 0;
  do {
    d[i++] = a % 10;
  } while (a /= 10);
  while (i--) {
    PUT(d[i] + 48);
  }
  PUT('\n');
}
int main() {
  int N = IN(), count = 0;
  rep(i, N - 1) { count += (N - 1) / (i + 1); }
  return OUT(count), 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define int long long
using namespace std;

inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}

inline bool read(int &a) {
  int s = 0, w = 1;
  char ch = getchar();
  if (ch == EOF) {
    return false;
  }
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = s * 10 + ch - '0', ch = getchar();
  a = s * w;
  return true;
}

inline void write(int x) {
  if (x < 0)
    putchar('-'), x = -x;
  if (x > 9)
    write(x / 10);
  putchar(x % 10 + '0');
}

inline void writeln(int x) {
  if (x < 0)
    putchar('-'), x = -x;
  if (x > 9)
    write(x / 10);
  putchar(x % 10 + '0');
  puts("");
}

signed main() {
  int n = read();

  int ans = 0;

  for (register int i = 1; i <= n - 1; i++) {
    int now = n - i;
    for (register int j = 1; j * j <= now; j++) {
      if (now % j == 0 && now != j * j)
        ans += 2;
      else if (now % j == 0)
        ans++;
    }
  }

  writeln(ans);
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define int long long
using namespace std;

inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}

inline bool read(int &a) {
  int s = 0, w = 1;
  char ch = getchar();
  if (ch == EOF) {
    return false;
  }
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = s * 10 + ch - '0', ch = getchar();
  a = s * w;
  return true;
}

inline void write(int x) {
  if (x < 0)
    putchar('-'), x = -x;
  if (x > 9)
    write(x / 10);
  putchar(x % 10 + '0');
}

inline void writeln(int x) {
  if (x < 0)
    putchar('-'), x = -x;
  if (x > 9)
    write(x / 10);
  putchar(x % 10 + '0');
  puts("");
}

signed main() {
  int n = read();

  int ans = 0;

  for (register int i = 1; i < n; i++) {
    ans += n / i;
    if (n % i == 0)
      ans--;
  }

  writeln(ans);
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;

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

  for (int a = 1; a <= n; a++) {
    for (int b = 1; b <= n; b++) {
      ans += n - a * b > 0;
    }
  }

  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;

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

  for (int a = 1; a <= n; a++) {
    for (int b = 1; b <= n; b++) {
      if (a * b < n)
        ans++;
      else
        break;
    }
  }

  cout << ans << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
using namespace std;

typedef long long lld;
typedef vector<lld> vlld;
const lld mod = (lld)1e9 + 7;

int main() {
  lld n;
  cin >> n;
  lld ans = 0;
  for (int i = 1; i <= n; i++) {
    lld c = n - i;
    for (int j = 1; j * j <= c; j++) {
      if (c % j == 0) {
        if (c / j == j)
          ans++;
        else
          ans += 2;
      }
    }
  }

  cout << ans << "\n";
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
using namespace std;

typedef long long lld;
typedef vector<lld> vlld;
const lld mod = (lld)1e9 + 7;

int main() {
  lld n;
  cin >> n;
  lld ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (n <= i * j)
        break;
      ans++;
    }
  }

  cout << ans << "\n";
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <vector>

#define DOLL long double
#define LOLI long long int
using namespace std;

const long C_10PW9 = 1000000000;
const int ULCODE = 32;

int divc(int s) {
  int r = 0;
  int sq = sqrt(s);
  for (int i = 1; i <= sq; i++) {
    if (s % i == 0) {
      r++;
      if (s / i != i) {
        r++;
      }
    }
  }
  return r;
}
int main() {
  int n;
  cin >> n;
  int f = 0;
  for (int i = 1; i < n; i++) {
    f += divc(i);
  }
  cout << f << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <vector>

#define DOLL long double
#define LOLI long long int
using namespace std;

const long C_10PW9 = 1000000000;
const int ULCODE = 32;

int divc(int s) {
  int r = 0;
  int sq = sqrt(s);
  for (int i = 1; i <= sq; i++) {
    if (s % i == 0) {
      r++;
      if (s / i != i) {
        r++;
      }
    }
  }
  return r;
}
int main() {
  int n;
  cin >> n;
  int f = 0;
  for (int i = 1; i < n; i++) {
    int a = (n - 1) / i;
    f += a;
  }
  cout << f << endl;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    int temp = n - i;
    for (int f = 1; f * f <= temp; f++) {
      if (temp % f == 0)
        ans += 2;
      if (f * f == temp)
        ans -= 1;
    }
  }
  cout << ans << endl;
}


Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      long long temp = (i * j);
      if (temp >= n)
        break;
      ans++;
    }
  }
  cout << ans << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>

typedef long long ll;
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007

using namespace std;

long long GCD(long long x, long long y) {
  long long r, tmp;
  if (x < y) {
    tmp = x;
    x = y;
    y = tmp;
  }
  while (y != 0) {
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}
long long LCM(long long x, long long y) {
  long long lcm = (x * y) / GCD(x, y);
  return lcm;
}

int bubblesort(int n) {
  vector<int> data(n);
  int num = 0;
  for (int end = n - 1; end > 0; end--) {
    for (int j = 0; j < end; j++) {
      if (data[j + 1] < data[j]) {
        int temp = data[j];
        data[j] = data[j + 1];
        data[j + 1] = temp;
        num++;
      }
    }
  }
  return num;
}

int main() {
  ll n;
  cin >> n;
  ll fx = n;
  ll ans = 0;
  for (ll i = 1; i < fx; i++) {
    n--;
    ;
    for (ll j = 1; j < fx; j++) {
      if (n % j == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>

typedef long long ll;
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007

using namespace std;

long long GCD(long long x, long long y) {
  long long r, tmp;
  if (x < y) {
    tmp = x;
    x = y;
    y = tmp;
  }
  while (y != 0) {
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}
long long LCM(long long x, long long y) {
  long long lcm = (x * y) / GCD(x, y);
  return lcm;
}

int bubblesort(int n) {
  vector<int> data(n);
  int num = 0;
  for (int end = n - 1; end > 0; end--) {
    for (int j = 0; j < end; j++) {
      if (data[j + 1] < data[j]) {
        int temp = data[j];
        data[j] = data[j + 1];
        data[j + 1] = temp;
        num++;
      }
    }
  }
  return num;
}

int main() {
  ll n;
  cin >> n;
  ll ans = n - 1;
  for (ll i = 2; i < n; i++) {
    ans += n / i;
    if (n % i == 0) {
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
using namespace std;
typedef long long LL;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) {
  if (a > b)
    a = b;
}
template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) {
  if (a < b)
    a = b;
}

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

  LL ans = 0;
  for (int C = 1; C < N; C++) {
    int val = N - C;

    int valsqrt = (int)round(sqrt(val));

    int a = 1;
    while (a <= valsqrt) {
      if (val % a != 0) {
        a++;
        continue;
      }

      int b = val / a;
      if (a == b) {
        ans++;
      } else {
        ans += 2;
      }
      a++;
    }
  }

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

Fixed submission:
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
using namespace std;
typedef long long LL;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) {
  if (a > b)
    a = b;
}
template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) {
  if (a < b)
    a = b;
}

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

  int ans = 0;
  for (int a = 1; a <= N - 1; a++) {
    int count = (N - 1) / a;
    ans += count;
  }

  cout << ans << endl;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld, lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer(x) cout << endl << "answer : " << x << endl << endl;
#define op(x) cout << x << endl;
#define maxn 500005
#define lld_max 5000000000000000000
#define messi                                                                  \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
using namespace std;
int main() {
  messi lld t = 1; // cin>>t;
  while (t--) {
    lld n = 0, m = 0, k = 0, i = 0, j = 0, p = 0, q = 0, x = 0, y = 0, z = 0,
        ans = 0, cnt = 0, l = 0, r = 0, mid = 0, lo = 0, hi = 0;
    string s;
    bool flag = false;
    cin >> n;
    for (i = 1; i < n; i++) {
      for (j = 1; j * j <= i; j++) {
        if (i % j == 0) {
          if (j == (i / j))
            cnt++;
          else
            cnt += 2;
        }
      }
    }
    op(cnt);
  }
  return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


Fixed submission:
#include <bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld, lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer(x) cout << endl << "answer : " << x << endl << endl;
#define op(x) cout << x << endl;
#define maxn 500005
#define lld_max 5000000000000000000
#define messi                                                                  \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
using namespace std;
int main() {
  messi lld t = 1; // cin>>t;
  while (t--) {
    lld n = 0, m = 0, k = 0, i = 0, j = 0, p = 0, q = 0, x = 0, y = 0, z = 0,
        ans = 0, cnt = 0, l = 0, r = 0, mid = 0, lo = 0, hi = 0;
    string s;
    bool flag = false;
    cin >> n;
    for (i = 1; i < n; i++)
      cnt += (n - 1) / i;
    op(cnt);
  }
  return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

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

  int cnt = 0;
  for (int c = 1; c <= N - 1; ++c) {
    int target = N - c;
    double dThr = sqrt(target);
    for (int a = 1; a <= dThr; ++a) {
      // int ia = int(round(da));
      if (target % a == 0) {
        int b = target / a;
        if (a == b)
          ++cnt;
        else
          cnt += 2;
      }
    }
  }

  cout << cnt << endl;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

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

  int cnt = 0;
  for (int c = 1; c <= N - 1; ++c) {
    int target = N - c;
    double dThr = sqrt(target);
    for (int a = 1; a <= dThr; ++a) {
      // int ia = int(round(da));
      int b = target / a;
      if (a * b == target) {
        if (a == b)
          ++cnt;
        else
          cnt += 2;
      }
    }
  }

  cout << cnt << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))

int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int main() {
  int N;
  cin >> N;
  int cou = 0;
  int nn = N;
  for (int i = 1; i <= N - 1; i++) {
    nn = N - i;
    for (ll i = 1; i * i <= nn; i++) {
      if (nn % i == 0 && nn != i * i) {
        cou = cou + 2;
      }
      if (nn % i == 0 && nn == i * i) {
        cou = cou + 1;
      }
    }
  }

  cout << cou << endl;
}


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

#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))

int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int main() {
  int N;
  cin >> N;
  int cou = 0;
  int nn = N - 1;
  for (int i = 1; i <= N; i++) {
    cou = cou + nn / i;
  }

  cout << cou << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
using namespace std;
int main() {
  uint64 ans = 0;
  int n;
  cin >> n;
  rep(i, 1, n) {
    rep(j, 1, i * j < n) { ans++; }
  }
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
using namespace std;
int main() {
  uint64 ans = 0;
  int n;
  cin >> n;
  rep(i, 1, n) {
    for (int j = 1; j * i < n; j++) {
      ans++;
    }
  }
  cout << ans << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

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

  for (int c = 1; c < n; c++) {
    int num = n - c;
    for (int i = 1; i <= sqrt(num); ++i) {
      if (num % i == 0)
        if (num / i == i) {
          ans++;
        } else {
          ans++;
          ans++;
        }
    }
  }
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using vec = vector<ll>;
using vec2 = vector<vector<ll>>;
ll inf = pow(2, 62);

ll yakusuu(ll x) {
  ll sum = 0;
  for (int i = 1; i * i <= x; i++) {
    if (x % i == 0) {
      sum += 1;
      if (i * i != x) {
        sum++;
      }
    }
  }
  // 約数の個数
  return sum;
}

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


Fixed submission:
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using vec = vector<ll>;
using vec2 = vector<vector<ll>>;
ll inf = pow(2, 62);

ll yakusuu(ll x) {
  ll sum = 0;
  for (int i = 1; i * i <= x; i++) {
    if (x % i == 0) {
      sum += 1;
      if (i * i != x) {
        sum++;
      }
    }
  }
  // 約数の個数
  return sum;
}

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  /*for(int c = 1;c < n;c++){
      ans += yakusuu(n-c);
  }*/
  for (int a = 1; a < n; a++) {
    if (n % a == 0) {
      ans += (n / a) - 1;
    } else {
      ans += n / a;
    }
  }
  cout << ans << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  int a, b, c;
  int ab;
  int m = 0;
  for (c = 1; c < n; ++c) {
    ab = n - c;
    for (a = 1; a * a <= ab; ++a) {
      b = ab / a;
      if (a * b == ab) {
        m += 2;
        if (a == b)
          m--;
      }
    }
  }
  cout << m << endl;
}


Fixed submission:
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  int a, b, c;
  int ab;
  int m = 0;
  for (c = 1; c < n; ++c) {
    for (a = 1; a * a <= c; ++a) {
      b = c / a;
      if (a * b == c) {
        m += 2;
        if (a == b)
          m--;
      }
    }
  }
  cout << m << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

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

  int count = 0;
  for (int c = 1; c < N; c++) {
    int T = N - c;
    for (int b = 1; b <= T; b++) {
      if (T % b == 0) {
        count++;
      }
    }
  }

  cout << count << endl;

  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;

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

  int count = 0;
  for (int a = 1; a < N; a++) {
    count += (N - 1) / a;
  }

  cout << count << endl;

  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  int ans = 0;
  for (int a = 1; a < n; a++) {
    for (int c = 1; c < n; c++) {
      if ((n - c) % a == 0)
        ans++;
    }
  }
  cout << ans << endl;
}


Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  int ans = 0;

  for (int i = 1; i < n; i++) {
    ans += (n - 1) / i;
  }
  cout << ans << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i * j < n)
        ans++;
      //			for(int k=1;k<=n-i*j;k++)
      //			{
      //				if(i*j+k==n)ans++;
      ////				cout<<i<<' '<<j<<' '<<k ;
      //			}
    }
  }
  cout << ans;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= int(n / i); j++) {
      if (i * j != n)
        ans++;
      //			for(int k=1;k<=n-i*j;k++)
      //			{
      //				if(i*j+k==n)ans++;
      ////				cout<<i<<' '<<j<<' '<<k ;
      //			}
    }
  }
  cout << ans;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1 << 30;
constexpr int mo = 1e9 + 7;
constexpr ll infl = 1ll << 60;

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

  int n;
  cin >> n;
  int pat = 0;
  for (int c = 1; c <= n; ++c) {
    int tmp = n - c;
    for (int a = 1; a * a <= tmp; ++a)
      if (tmp % a == 0) {
        if (a != tmp / a)
          pat += 2;
        else
          pat++;
      }
  }
  cout << pat << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1 << 30;
constexpr int mo = 1e9 + 7;
constexpr ll infl = 1ll << 60;

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

  int n;
  cin >> n;
  int pat = 0;
  for (int a = 1; a < n; ++a) {
    pat += (n - 1) / a;
  }
  cout << pat << endl;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int MAX_N = 1000005;
std::vector<ll> num_divisor(MAX_N, 0);

ll init_num_divisor() {
  for (int i = 1; i < MAX_N; ++i) {
    for (int j = i; j < MAX_N; j += i) {
      num_divisor[j]++;
    }
  }
}

int main() {
  init_num_divisor();
  int N;
  cin >> N;
  ll cnt = 0;
  for (int c = 1; c < N; ++c)
    cnt += num_divisor[c];
  cout << cnt << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int MAX_N = 1000005;
std::vector<ll> num_divisor(MAX_N, 0);

void init_num_divisor() {
  for (int i = 1; i < MAX_N; ++i) {
    for (int j = i; j < MAX_N; j += i) {
      num_divisor[j]++;
    }
  }
}

int main() {
  init_num_divisor();
  int N;
  cin >> N;
  ll cnt = 0;
  for (int c = 1; c < N; ++c)
    cnt += num_divisor[c];
  cout << cnt << endl;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
typedef long long ll;
typedef pair<int, int> p;

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (int c = 1; c < n; c++) {
    ll d = n - c;
    for (int a = 1; a * a <= d; a++) {
      if (d % a == 0 && d / a != a)
        ans += 2;
      else if (d % a == 0 && a * a == d)
        ans++;
    }
  }
  cout << ans;
}


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

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> //PBDS
#include <ext/pb_ds/tree_policy.hpp>     //PBDS
#define int long long int
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pi pair<int, int>
#define deb(x) cerr << #x << " : " << x << endl;
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mi map<int, int>
#define PI 3.141592653589
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define f(i, x, n) for (int i = x; i < n; i++)
#define rf(i, x, n) for (int i = n - 1; i >= x; i--)
#define check(x) cerr << #x << " : " << x << endl;
#define ordered_set                                                            \
  tree<int, null_type, less_equal<int>, rb_tree_tag,                           \
       tree_order_statistics_node_update>
#define fbo find_by_order // return iterator PBDS
#define ook order_of_key  // return number :)) PBDS
#define baar exit(0)
#define INF 1000000000000000000
using namespace __gnu_pbds;
using namespace std;
signed main() {
  fast int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= sqrt(i); j++) {
      if (i % j == 0) {
        if (i / j == j)
          ans++;
        else
          ans += 2;
      }
    }
  }
  cout << ans;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> //PBDS
#include <ext/pb_ds/tree_policy.hpp>     //PBDS
#define int long long int
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pi pair<int, int>
#define deb(x) cerr << #x << " : " << x << endl;
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mi map<int, int>
#define PI 3.141592653589
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define f(i, x, n) for (int i = x; i < n; i++)
#define rf(i, x, n) for (int i = n - 1; i >= x; i--)
#define check(x) cerr << #x << " : " << x << endl;
#define ordered_set                                                            \
  tree<int, null_type, less_equal<int>, rb_tree_tag,                           \
       tree_order_statistics_node_update>
#define fbo find_by_order // return iterator PBDS
#define ook order_of_key  // return number :)) PBDS
#define baar exit(0)
#define INF 1000000000000000000
using namespace __gnu_pbds;
using namespace std;
signed main() {
  fast int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i < n; i++) {
    int val = n / i;
    ans += val;
    if (n % i == 0)
      ans--;
  }
  cout << ans;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main() {
  long long n;
  cin >> n;
  long long ans = 0;
  for (long long i = 1; i <= n - 1; i++) {
    for (long long j = 1; j <= (n - 1); j++) {
      if (i * j <= n - 1)
        ans++;
    }
  }
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main() {
  long long n;
  cin >> n;
  long long ans = 0;
  for (long long i = 1; i < n; i++) {
    ans += (n - 1) / i;
  }
  cout << ans << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  int count = 0;
  for (int i = 1; i < n; i++) {
    int a = n - i;
    for (int j = 1; j * j <= a; j++) {
      if (j * (a / j) == a)
        count += 2;
      if (j * (a / j) == a && j == a / j)
        count--;
    }
  }
  cout << count;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  int count = 0;
  for (int i = 1; i < n; i++) {
    count += (n - 1) / i;
  }
  cout << count;
  return 0;
}
Problem p02548 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
// #define FOA(x) for(int i=0;i<x;i++)

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

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
// #define FOA(x) for(int i=0;i<x;i++)

int main() {
  int N;
  cin >> N;
  int count = 0;
  for (int i = 1; i < N; i++) {
    count = count + (N - 1) / i;
  }
  cout << count << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <math.h>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 1; i < N; i++) {
    int n = N - i;
    for (int j = 1; j <= sqrt(n); j++) {
      if (n % j == 0) {
        ans += 2;
      }
    }
    if (sqrt(n) == floor(sqrt(n))) {
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <iostream>
#include <math.h>
#include <vector>

using namespace std;

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;
}
Problem p02548 (C++)

Buggy submission (status: Runtime Error):
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

ll expo(ll a, ll b) {
  ll ex = 1;
  rep(i, b) { ex *= a; }
  return ex;
}

ll fact(ll a) {
  ll fc = 1;
  REP(i, 1, a + 1) { fc *= i; }
  return fc;
}

int main() {
  ll n;
  cin >> n;
  ll cnt = 0;
  rep(c, n) {
    rep(a, n - c + 1) {
      rep(b, (n - c) / a + 1) {
        if (a * b + c == n) {
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}

Fixed submission:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

ll expo(ll a, ll b) {
  ll ex = 1;
  rep(i, b) { ex *= a; }
  return ex;
}

ll fact(ll a) {
  ll fc = 1;
  REP(i, 1, a + 1) { fc *= i; }
  return fc;
}

int main() {
  ll n;
  cin >> n;
  ll cnt = 0;
  REP(a, 1, n) { cnt += (n - 1) / a; }
  cout << cnt << endl;
}
Problem p02548 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
/*
time:
wa:
反省:
考察:
*/
int main() {
  int n;
  cin >> n;
  long long count = 0;
  for (int c = 1; c <= n - 1; c++) {
    for (int a = 1; a <= sqrt(n - c); a++) {
      if ((n - c) % a == 0 && a != sqrt(n - c))
        count += 2;
      else if ((n - c) % a == 0 && a == sqrt(n - c))
        count++;
    }
  }

  cout << count << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
/*
time:
wa:
反省:
考察:
*/
int main() {
  int n;
  cin >> n;
  long long count = 0;
  for (int a = 1; a <= n - 1; a++) {
    count += (n - 1) / a;
  }

  cout << count << endl;
  return 0;
}