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

/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <unordered_map>
#include <vector>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define vi vector<int>
#define dbg(x) cerr << #x << " = " << x << '\\n'
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define pii pair<int, int>
using namespace std;

int n = 10000000;
int p[10000001];
void seive() {
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j += i)
      p[j]++;
  }
}

inline void solve() {
  int n, ans = 1;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    ans += p[i] * i;
  }
  cout << ans << endl;
}

signed main() {
  seive();
  int n = 1; // cin>>n;
  while (n--)
    solve();
  return 0;
}


Error: TLE

Fixed submission:

/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <unordered_map>
#include <vector>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define vi vector<int>
#define dbg(x) cerr << #x << " = " << x << '\\n'
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define pii pair<int, int>
using namespace std;

int n = 10000000;
bool p[10000001];
void seive() {
  for (int i = 4; i <= n; i += 2)
    p[i] = true;
  for (int i = 3; i * i <= n; i += 2) {
    if (p[i] == false)
      for (int j = i * i; j <= n; j += i * 2)
        p[j] = true;
  }
}

inline void solve() {
  int n, ans = 1;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    if (p[i]) {
      int h = 1, a = i;
      for (int j = 2; j * j <= a; j++) {
        if (a % j == 0) {
          int c = 0;
          while (a % j == 0) {
            a /= j;
            c++;
          }
          h *= (c + 1);
        }
      }
      if (a > 1)
        h *= 2;
      ans += (i * h);
    } else {
      ans += i * 2;
    }
  }
  cout << ans << endl;
}

signed main() {
  seive();
  int n = 1; // cin>>n;
  while (n--)
    solve();
  return 0;
}
Problem p02624 (C++) — buggy submission, verdict: Time Limit Exceeded

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

#define ll long long

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  int n;
  cin >> n;
  int64_t sum = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j += i) {
      sum += j;
    }
  }
  cout << sum;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;

#define ll long long

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  cpp_int n;
  cin >> n;
  cpp_int sum = 0;
  for (ll j = 1; j <= n; j++) {
    for (ll i = 1; i <= n; i++) {
      if (i % j == 0) {
        sum += i;
      }
    }
  }
  cout << sum;
}
Problem p02624 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, s, e) for (int i = s; i < e; i++)
#define endl '\\n'

int main() {
  ll N;
  cin >> N;
  ll sum = 0;
  rep(i, 1, N + 1) {
    ll Y = (ll)N / i;
    sum += Y * (Y + 1) * i / 2;
  }
  cout << sum << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define endl '\\n'
using namespace std;
#define lli long long int
lli func(lli T);
bool isPrime(lli x);
int main() {
  lli N;
  cin >> N;
  lli ans = 0;
  for (lli i = 1; i <= N; i++) {
    ans += i * func(i);
  }
  cout << ans << endl;
}

lli func(lli T) {
  if (T == 0)
    return 0;
  if (T == 1)
    return 1;
  if (isPrime(T))
    return 2;
  long double s = sqrt(T);
  lli res = 2;
  for (lli i = 2; i <= (lli)s; i++) {
    if (T % i == 0) {
      if (i == s)
        res++;
      else
        res += 2;
    }
  }
  return res;
}

bool isPrime(lli x) {
  lli s = (lli)sqrt(x);
  for (lli i = 2; i <= s; i++) {
    if (x % i == 0)
      return false;
  }
  return true;
}
Problem p02624 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define FAST                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;
#define debug2(x, y)                                                           \\
  cout << #x << ": " << x << " | " << #y << ": " << y << endl;
#define debug3(x, y, z)                                                        \\
  cout << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": "   \\
       << z << endl;
#define debug4(a, b, c, d)                                                     \\
  cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \\
       << c << " | " << #d << ": " << d << endl;
template <typename T>
using orderedSet =
    tree<T, null_type, less<T>, rb_tree_tag,
         tree_order_statistics_node_update>; // order_of_key find_by_order
const int MAX = 1e7 + 1;
int f[MAX];

void pre() {
  for (int i = 1; i < MAX; i++) {
    for (int j = i; j < MAX; j += i) {
      f[j]++;
    }
  }
}
int main() {
  FAST ll n;
  cin >> n;
  ll ans = 0;
  pre();
  for (ll i = 1; i <= n; i++)
    ans += (i * f[i]);
  cout << ans << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define FAST                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;
#define debug2(x, y)                                                           \\
  cout << #x << ": " << x << " | " << #y << ": " << y << endl;
#define debug3(x, y, z)                                                        \\
  cout << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": "   \\
       << z << endl;
#define debug4(a, b, c, d)                                                     \\
  cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \\
       << c << " | " << #d << ": " << d << endl;
template <typename T>
using orderedSet =
    tree<T, null_type, less<T>, rb_tree_tag,
         tree_order_statistics_node_update>; // order_of_key find_by_order

ll sumOfDivisors(int n) {
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    int f = 0;
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        if (j * j == i)
          f++;
        else
          f += 2;
      }
    }
    // debug2(i,f);
    ans += (f * i);
  }
  return ans;
}
int main() {
  FAST int n;
  cin >> n;
  cout << sumOfDivisors(n);
}
Problem p02624 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = -1; i < (n); i++)
#define PI 3.141592653589793

using namespace std;
using ll = unsigned long long;

const ll MA = 10000000;

ll to[MA];

int main() {

  ll n;
  cin >> n;
  ll ans = 1;

  for (ll i = 2; i <= n; i++) {
    ll j = i;
    while (j <= n) {
      to[j] += 1;
      j += i;
    }
    ans += i * (to[i] + 1);
  }

  cout << ans << endl;

  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = -1; i < (n); i++)
#define PI 3.141592653589793

using namespace std;
using ll = unsigned long long;

const ll MA = 10000000;

ll to[MA];

int main() {

  ll n;
  cin >> n;
  ll ans = 1;

  for (ll i = 2; i <= n; i++) {
    ll j = i;
    while (j + i <= n * 2) {
      to[j] += 1;
      j += i;
    }
    ans += i * (to[i] + 1);
  }

  cout << ans << endl;

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

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using _TYPE = int;
typedef tree<_TYPE, null_type, less<_TYPE>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
#define IO                                                                     \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0)

int main() {
  IO;
  ll n;
  cin >> n;
  vector<ll> v(n + 1, 1);
  unsigned long long ans = 0;
  for (int i = 2; i <= n; i++) {
    for (int j = i; j <= n; j += i)
      v[j]++;
  }
  for (int i = 1; i <= n; i++)
    ans += i * v[i];
  cout << ans;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using _TYPE = int;
typedef tree<_TYPE, null_type, less<_TYPE>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
#define IO                                                                     \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0)

vector<unsigned long long> dp;

unsigned long long calc(int n) {
  vector<int> v;
  unsigned long long cnt = 0, ans = 1;
  if (n == 1)
    return 1;
  while (n % 2 == 0) {
    n /= 2;
    cnt++;
  }
  v.push_back(cnt);
  for (int i = 3; n > 1; i += 2) {
    cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    if (cnt) {
      v.push_back(cnt);
    }
  }
  for (auto &e : v) {
    ans = ans * (e + 1);
  }
  return ans;
}

int main() {
  IO;
  ll n;
  cin >> n;
  unsigned long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += i * calc(i);
  }
  cout << ans;
  return 0;
}
Problem p02624 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cmath>
#include <iostream>

using namespace std;

int main() {
  int N;
  cin >> N;
  long long cnt = 0;
  for (long long x = 1; x <= N; ++x) {
    long long Y = floor<int>(N / x);
    cnt += x * (Y + 1) * Y / 2;
  }
  cout << cnt << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
#include <map>
#include <vector>

using namespace std;

void primes(int N, vector<map<int, int>> &dp, vector<int> &ps) {
  for (int i : ps) {
    if (N % i == 0) {
      dp[N] = dp[N / i];
      dp[N][i]++;
      return;
    }
  }
  dp[N].insert(pair<int, int>(N, 1));
  ps.push_back(N);
}

int main() {
  int N;
  cin >> N;
  vector<int> ps;
  vector<map<int, int>> dp(N + 1);
  for (int i = 2; i <= N; ++i) {
    primes(i, dp, ps);
  }
  long long cnt = 0;
  for (long long i = 2; i <= N; ++i) {
    long long t = 1;
    for (auto d : dp[i]) {
      t *= (d.second + 1);
    }
    cnt += i * t;
  }
  // For f(1) * 1
  cnt += 1;
  cout << cnt << endl;
  return 0;
}
Problem p02624 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ull unsigned long long
#define mp make_pair
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int>> small_heap;
typedef priority_queue<int> big_heap;
int n, k;
const int N = 2e5 + 100;
int aa[N], bb[N], all[N], alll = 0, aaa = 0, bbb = 0;
ll factor[10500010];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n / i; j++)
      factor[i * j]++;
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += 1ll * i * factor[i];
  }
  printf("%lld\\n", ans);
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ull unsigned long long
#define mp make_pair
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int>> small_heap;
typedef priority_queue<int> big_heap;
int n, k;
const int N = 2e5 + 100;
int aa[N], bb[N], all[N], alll = 0, aaa = 0, bbb = 0;
vector<int> factor[10500010];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n / i; j++)
      factor[i * j].push_back(i);
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += 1ll * i * factor[i].size();
  }
  printf("%lld\\n", ans);
  return 0;
}
Problem p02624 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
// #include <boost/multiprecision/cpp_int.hpp>

// namespace mp = boost::multiprecision;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
// using Bint = mp::cpp_int;

ll N;
ll num4dev(ll n) {
  ll y = N / n;
  return y * (y + 1) * n / 2;
}

int main() {
  cin >> N;
  ll res = 0;
  for (ll i = 1; i <= N; i++) {
    res += num4dev(i);
  }
  cout << res << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
// #include <boost/multiprecision/cpp_int.hpp>

// namespace mp = boost::multiprecision;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
// using Bint = mp::cpp_int;

ll num4dev(ll n) {
  ll r = 1;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      ll cnt = 0;
      while (n % i == 0) {
        cnt++;
        n /= i;
      }
      r *= cnt + 1;
    }
  }
  if (n != 1)
    r *= 2;
  return r;
}

int main() {
  int N;
  cin >> N;
  ll res = 0;
  for (ll i = 1; i <= N; i++) {
    res += i * num4dev(i);
  }
  cout << res << endl;
}
Problem p02624 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

void solve() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (ll i = 1; i <= n; i++) {
    ll cur = n / i;
    ans += i * cur * (cur + 1) / 2;
  }
  cout << ans;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  // int t; cin >> t;
  // while (t--)
  solve();
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

ll f(ll n) {
  map<ll, ll> m;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      n /= i;
      m[i]++;
    }
  }
  if (n != 1)
    m[n]++;
  ll ans = 1;
  for (auto it : m)
    if (it.second > 0)
      ans *= it.second + 1;
  return ans;
}

void solve() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (ll i = 1; i <= n; i++)
    ans += i * f(i);
  cout << ans;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  // int t; cin >> t;
  // while (t--)
  solve();
}
Problem p02624 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = 1e+14;
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i >= 0; i--)
#define Rep(i, sta, n) for (int i = sta; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define per1(i, n) for (int i = n; i >= 1; i--)
#define Rep1(i, sta, n) for (int i = sta; i <= n; i++)
#define _GLIBCXX_DEBUG

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = 1e+14;
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i >= 0; i--)
#define Rep(i, sta, n) for (int i = sta; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define per1(i, n) for (int i = n; i >= 1; i--)
#define Rep1(i, sta, n) for (int i = sta; i <= n; i++)
#define _GLIBCXX_DEBUG

ll enum_divisors(ll N) {
  ll res = 0;
  for (ll i = 1; i * i <= N; i++) {
    if (N % i == 0) {
      res++;
      if (N / i != i)
        res++;
    }
  }
  return res;
}

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  for (ll i = 1; i <= n; i++) {
    ans += i * enum_divisors(i);
  }

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

#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  ll res = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j += i)
      res += j; // 相当于乘k
  cout << res << endl;
  return 0;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
const int N = 200010;
ll a[N], b[N];
ll n, m, k;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll res = 0;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < m; i++)
    cin >> b[i];

  int i = 0, j = 0;
  while (i < n && j < m) {
    if (a[i] <= b[j]) {
      if (k >= a[i]) {
        k -= a[i++];
        res++;
      } else
        break;
    } else {
      if (k >= b[j]) {
        k -= b[j++];
        res++;
      } else
        break;
    }
  }
  while (i < n && k >= a[i]) {
    k -= a[i++];
    res++;
  }
  while (j < m && k >= b[j]) {
    k -= b[j++];
    res++;
  }
  cout << res << endl;
  return 0;
}
Problem p02624 (C++) — buggy submission, verdict: Runtime Error

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

const int sz = 1e5 + 1;
ll mod = 1e9 + 7;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int t;
  t = 1;
  // cin>>t;
  // sieve();
  for (int cs = 1; cs <= t; cs++) {

    ll n;
    cin >> n;
    ll ar[n + 1] = {0};
    for (int i = 1; i < n + 1; i++) {
      for (int j = i; j < n + 1; j += i) {
        ar[j]++;
      }
    }
    ll res = 0;
    for (int i = 1; i < n + 1; i++) {
      res += (i * ar[i]);
    }
    cout << res << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

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

const int sz = 1e5 + 1;
ll res = 0, n;

vector<ll> divisor[sz];

void sieve() {
  for (int i = 1; i <= sz; ++i) {
    for (int j = i; j <= sz; j += i)
      divisor[j].push_back(i);
  }
}

void findNFactors(ll n) {
  for (int i = 1; i <= n; i++) {
    res += i * divisor[i].size();
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int t;
  t = 1;
  // cin>>t;
  sieve();
  for (int cs = 1; cs <= t; cs++) {

    cin >> n;
    findNFactors(n);
    cout << res << endl;
  }
  return 0;
}
Problem p02624 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <math.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define M_PI 3.14159265358979323846

void solve() {
  int n;
  cin >> n;
  vector<int> a(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= n; j += i)
      a[j]++;
  }
  ll total = 0;
  for (ll i = 1; i <= n; i++)
    total += (i * (ll)a[i]);
  cout << total;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  int t = 1;
  //        cin>>t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll pass() {
  ll k = 0, s = 0, n;
  cin >> n;
  vector<int> a(n + 1, 0);

  for (ll i = 1; i <= n; i++) {
    for (ll j = 0; j <= n; j += i) {
      a[j]++;
    }
  }

  for (ll i = 1; i <= n; i++) {
    s += (i * (ll)a[i]);
    ;
  }

  cout << s << endl;
}
int main() {
  ll n, m, k = 0, s = 0, l = 0, t = 0;
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pass();
}
Problem p02624 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
void pass() {
  ll k = 0, s = 0;
  int n;
  cin >> n;
  vector<int> a(n + 1, 0);

  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= n; j += i) {
      a[j]++;
    }
  }

  for (int i = 1; i <= n; i++) {
    s += (i * (ll)a[i]);
    ;
  }

  cout << s << endl;
}
int main() {
  ll n, m, k = 0, s = 0, l = 0, t = 0;
  pass();
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
ll pass() {
  ll k = 0, s = 0;
  int n;
  cin >> n;
  vector<int> a(n + 1, 0);

  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= n; j += i) {
      a[j]++;
    }
  }

  for (int i = 1; i <= n; i++) {
    s += (i * (ll)a[i]);
    ;
  }

  cout << s << endl;
}
int main() {
  ll n, m, k = 0, s = 0, l = 0, t = 0;
  pass();
}
Problem p02624 (C++) — buggy submission, verdict: Time Limit Exceeded

/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod 1000000007
#define PI 2 * acos(0.0)
#define maxn 10000005

int32_t main() {
  io;
  int n;
  cin >> n;
  ll ans = 0;
  vi din(n + 1, 1);
  for (int i = 2; i <= n; i++)
    for (int j = i; j <= n; j += i)
      din[j]++;
  for (int i = 1; i <= n; i++)
    ans += 1LL * i * din[i];
  cout << ans;
  return 0;
}

Error: TLE

Fixed submission:

/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod 1000000007
#define PI 2 * acos(0.0)
#define maxn 10000005

int32_t main() {
  io;
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    int di = 0;
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        di++;
        if (j != i / j)
          di++;
      }
    }
    ans += 1LL * i * di;
  }
  cout << ans;
  return 0;
}