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

#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  double l;
  cin >> l;
  double m = l / 3;
  double ans = m * m * m;
  printf("%.12f\\n", ans);
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int l;
  int ans = 0;
  for (int i = 1; i <= l; i++) {
    int a = i;
    for (int j = 1; j <= l; j++) {
      int b = j;
      int c = l - a - b;
      if (c > 0) {
        ans = max(ans, a * b * c);
      }
    }
  }
  cout << ans << "\\n";
  return 0;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  int L;
  cin >> L;
  cout << fixed << setprecision(10) << (double)L * L * L / 27 << endl;
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int L;
  cin >> L;
  vector<double> p;
  for (int i = 1; i < L - 1; i++) {
    p.push_back((double)i * (L - i) * (L - i) / 4);
  }
  sort(p.begin(), p.end());
  reverse(p.begin(), p.end());
  cout << p.at(0) << endl;
  return 0;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int l;
  cin >> l;
  int n = l / 3;
  if ((l - n * 3) == 0) {
    cout << n * n * n << ".000000000000" << endl;
    return 0;
  }
  long double ans;
  if ((l - n * 3) == 1) {
    ans = (n + 0.333) * (n + 0.333) * (n + 0.334);
  }
  if ((l - n * 3) == 2) {
    ans = (n + 0.666) * (n + 0.667) * (n + 0.667);
  }
  cout.setf(ios::fixed);
  cout << ans << "000000" << endl;
  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  int l;
  cin >> l;
  int n = l / 3;
  if ((l - n * 3) == 0) {
    cout << n * n * n << ".000000000000" << endl;
    return 0;
  }
  long double ans;
  if ((l - n * 3) == 1) {
    ans = (n + 0.3) * (n + 0.3) * (n + 0.4);
  }
  if ((l - n * 3) == 2) {
    ans = (n + 0.6) * (n + 0.7) * (n + 0.7);
  }
  cout.setf(ios::fixed);
  return (ans > 0.0) ? floor(ans + 0.5) : ceil(ans - 0.5);
  cout << ans << "000000" << endl;
  return 0;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

// Created by Tanuj Jain
#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;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
template <class T>
using oset =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

  // #ifndef ONLINE_JUDGE
  // freopen("inputf.in","r",stdin);
  // freopen("outputf.in","w",stdout);
  // #endif

  double s;
  cin >> s;
  // finding length
  double length = s / 3.0;

  s -= length;

  // finding breadth
  double breadth = s / 2.0;

  // finding height
  double height = s - breadth;

  cout << fixed << setprecision(6) << length * breadth * height;
}

Error: WA

Fixed submission:

// Created by Tanuj Jain
#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;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
template <class T>
using oset =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

#ifndef ONLINE_JUDGE
  freopen("inputf.in", "r", stdin);
  freopen("outputf.in", "w", stdout);
#endif

  int t;
  cin >> t;
  double l = t / 3;
  cout << fixed << setprecision(6) << l * l * l;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  double n, x = 3;
  cin >> n;
  double temp = n / x;
  cout << fixed << setprecision(12) << (temp * temp * temp) << endl;
  return 0;
}


Error: WA

Fixed submission:

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll n, i, j, k, curr = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      for (k = 1; k <= (n - (i + j)); k++) {
        if ((i * j * k) > curr)
          curr = i * j * k;
      }
    }
  }
  cout << curr << endl;
  return 0;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error


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

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

  long double l;
  cin >> l;
  long double a = l / 3;
  long double b = a;
  long double c = l - a - b;
  long double vol = a * b * c;
  cout << fixed << setprecision(18) << vol;
  return 0;
}

Error: WA

Fixed submission:


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

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

#ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
#endif

  int l;
  cin >> l;
  double a = l / 3;
  double vol = a * a * a;
  cout << fixed << setprecision(18) << vol << endl;
  return 0;
}
Problem p02731 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int l;
  double i, j, k, m = 0;
  cin >> l;
  if (l % 3 == 0) {
    double nn = (1.0 * l) / 3.0;

    m = nn * nn * nn;

  } else {
    double nn = (1.0 * l) / 3.0;
    double mm = (l * 1.0) - (nn * 2.0);
    m = nn * nn * mm;
  }

  cout << fixed << setprecision(12) << m << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int l;
  double i, j, k, m = 0;
  cin >> l;
  if (l % 3 == 0) {

    for (i = 1; i <= l; i++) {
      for (j = 1; j <= l; j++) {
        for (k = 1; k <= l; k++) {
          if (i * j * k > m && (i + j + k) == l)
            m = i * j * k;
        }
      }
    }
  } else {
    double nn = (1.0 * l) / 3.0;
    double mm = (l * 1.0) - (nn * 2.0);
    m = nn * nn * mm;
  }

  cout << fixed << setprecision(12) << m << endl;
  return 0;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define umap unordered_map
#define all(v) v.begin(), v.end()
#define st first
#define nd second
#define ln '\\n'
#define MAX 1000000009
#define MOD 1000000007
#define N 105
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<int> vi;
long double d;
int main() {
#ifndef ONLINE_JUDGE
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> d;
  d = (long double)d / 3;
  cout << setprecision(32) << d * d * d;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define umap unordered_map
#define all(v) v.begin(), v.end()
#define st first
#define nd second
#define ln '\\n'
#define MAX 1000000009
#define MOD 1000000007
#define N 105
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<int> vi;
long double d;
int main() {
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> d;
  d = (long double)d / 3;
  cout << setprecision(32) << d * d * d;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout << x << " " << endl;
#define gg(x, y) cout << x << " & " << y << " " << endl
#define jam(t) cout << "Case #" << t << ": "
#define ggg(x, y, z) cout << x << " & " << y << " & " << z << " " << endl
#define all(x) x.begin(), x.end()
#define input_from_file freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}

void solve() {
  ll len;
  cin >> len;
  double an = (1.0 * len) / (3.0);
  double res = an * an * an;
  cout << fixed << setprecision(10);
  g(res);
}
int main() {

  FASTIO
  cin.tie(NULL);
  fflush(stdout);
  ll t = 1;
  // cin >> t;
  for (ll tcase = 1; tcase <= t; tcase++) {
    solve();
  }
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout << x << " " << endl;
#define gg(x, y) cout << x << " & " << y << " " << endl
#define jam(t) cout << "Case #" << t << ": "
#define ggg(x, y, z) cout << x << " & " << y << " & " << z << " " << endl
#define all(x) x.begin(), x.end()
#define input_from_file freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}

void solve() {
  ll len;
  cin >> len;
  double an = (1.0 * len) / (3.0);
  double res = an * an * an;
  cout << fixed << setprecision(10);
  g(res);
}
int main() {
#ifndef ONLINE_JUDGE
  input_from_file
#endif

      FASTIO cin.tie(NULL);
  fflush(stdout);
  ll t = 1;
  // cin >> t;
  for (ll tcase = 1; tcase <= t; tcase++) {
    solve();
  }
  return 0;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 101010
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld", &s);
#define sout(s) printf("%lld\\n", s);
#define in(s) cin >> s
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define vll vector<ll>
#define out(s) cout << s
#define outs(s, a) cout << s << a
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gear_change ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define nfl(i, n) for (i = 0; i < n; i++)
#define sfl(i, s, e) for (i = s; i < e; i++)
#define ufl(i, n) for (i = n - 1; i >= 0; i--)
void solve() {
  ld n;
  in(n);
  ld div = n / 3.0;
  ld rem = n - 2 * div;
  cout << fixed << setprecision(10) << rem * div * div << '\\n';
}
int main() {
  clock_t t1 = clock();
  gear_change;
  ll test = 1;
  // in(test);
  while (test--) {
    solve();
  }
  clock_t t2 = clock();
  cerr << "Time elapsed:- " << (double)(t2 - t1) / CLOCKS_PER_SEC << '\\n';
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 101010
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld", &s);
#define sout(s) printf("%lld\\n", s);
#define in(s) cin >> s
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define vll vector<ll>
#define out(s) cout << s
#define outs(s, a) cout << s << a
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gear_change ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define nfl(i, n) for (i = 0; i < n; i++)
#define sfl(i, s, e) for (i = s; i < e; i++)
#define ufl(i, n) for (i = n - 1; i >= 0; i--)
void solve() {
  ld n;
  in(n);
  ld div = n / 3.0;
  ld rem = n - 2 * div;
  cout << fixed << setprecision(10) << rem * div * div << '\\n';
}
int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
#endif
  clock_t t1 = clock();
  gear_change;
  ll test = 1;
  // in(test);
  while (test--) {
    solve();
  }
  clock_t t2 = clock();
  cerr << "Time elapsed:- " << (double)(t2 - t1) / CLOCKS_PER_SEC << '\\n';
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

/*
@author: sharrad99
*/
#include <bits/stdc++.h>
using namespace std;
int main() {

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

  long double l;
  cin >> l;

  long double x = (l / 3.0);

  cout << fixed << setprecision(12) << (x * x * x) << '\\n';
}

Error: WA

Fixed submission:

/*
@author: sharrad99
*/
#include <bits/stdc++.h>
using namespace std;
int main() {

#ifndef ONLINE_JUDGE
  freopen("C:\\\\Users\\\\sharr\\\\Documents\\\\Input.txt", "r", stdin);
  freopen("C:\\\\Users\\\\sharr\\\\Documents\\\\Output.txt", "w", stdout);
#endif

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

  long double l;
  cin >> l;

  long double v = 0;
  for (long double a = 0; a <= l; a++) {
    for (long double b = 0; b <= l; b++) {
      long double c = l - a - b;
      if (c < 0)
        continue;
      long double x = (a * b * c);
      if (x < 0)
        continue;
      v = max(v, x);
    }
  }

  cout << fixed << setprecision(12) << v << '\\n';
}
Problem p02731 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

  double L;
  cin >> L;

  double max_vol = 0;
  for (double i = 10e-6; i <= L / 3; i += 10e-6) {
    max_vol = max(max_vol, (i * i * (L - i - i)));
  }

  cout << setprecision(10) << max_vol << endl;
  return 0;
}


Error: TLE

Fixed submission:

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

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

  int L;
  cin >> L;
  L *= 1000000;

  double max_vol = 0;
  for (int i = 1; i <= L / 3; ++i) {
    max_vol = max(max_vol, (i / 1000000.0) * (i / 1000000.0) *
                               ((L - i - i) / 1000000.0));
  }

  cout << setprecision(20) << max_vol << endl;
  return 0;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

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

#define mod 1e9 + 7;
#define INF 1e9 + 9;
#define ps(x, y) fixed << setprecision(y) << x
#define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
#endif
  int l;
  cin >> l;
  l = l * l * l;
  double bb = (double)l / 27;
  cout << ps(bb, 12) << endl;
  return 0;
}

Error: WA

Fixed submission:

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

#define mod 1e9 + 7;
#define INF 1e9 + 9;
#define ps(x, y) fixed << setprecision(y) << x
#define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int l;
  cin >> l;
  l = l * l * l;
  double bb = (double)l / 27;
  cout << ps(bb, 12) << endl;
  return 0;
}
Problem p02731 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;

int main() {
  // freopen("main.inp", "r", stdin);
  // freopen("main.out", "w", stdout);
  int n;
  cin >> n;
  float x = 1.0 * n / 3;
  x *= (x * x);
  cout << setprecision(12) << fixed << x;
  return 0;
}


Error: -11

Fixed submission:

#include "bits/stdc++.h"

int main(int, char **) {
  int N;
  std::cin >> N;

  int64_t a[N];
  for (int i = 0; i < N; i++) {
    std::cin >> a[i];
  }
  int64_t a_copy[N];
  std::memcpy(a_copy, a, sizeof(a));
  std::sort(a, a + N);

  int64_t count[N];
  for (int i = 0; i < N; i++) {
    count[i] = 0;
  }

  int64_t prev = a[0];
  count[prev - 1] = 1;

  for (int i = 1; i < N; i++) {
    if (prev == a[i]) {
      count[prev - 1]++;
    } else {
      prev = a[i];
      count[prev - 1] = 1;
    }
  }

  int64_t total = 0;

  for (int i = 0; i < N; i++) {
    total += count[i] * (count[i] - 1) / 2;
  }

  for (int i = 0; i < N; i++) {
    int64_t value = count[a_copy[i] - 1];
    if (value == 0) {
      std::cout << total << std::endl;
    } else {
      std::cout << total - value + 1 << std::endl;
    }
  }
  return 0;
}
Problem p02878 (C++) — buggy submission, verdict: Runtime Error

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

typedef long long ll;
const int maxn = 2e7 + 10, mod = 998244353;

inline int gi() {
  char c = getchar();
  while (c < '0' || c > '9')
    c = getchar();
  int sum = 0;
  while ('0' <= c && c <= '9')
    sum = sum * 10 + c - 48, c = getchar();
  return sum;
}

inline int add(int x, int y) { return x + y > mod ? x + y - mod : x + y; }
inline int sub(int x, int y) { return x < y ? x - y + mod : x - y; }
inline int fpow(int x, int k) {
  int res = 1;
  while (k) {
    if (k & 1)
      res = (ll)res * x % mod;
    k >>= 1;
    x = (ll)x * x % mod;
  }
  return res;
}

int n, a, b;
int fac[maxn], ifac[maxn];

inline int C(int m, int n) {
  if (n < 0 || m < n)
    return 0;
  return (ll)fac[m] * ifac[n] % mod * ifac[m - n] % mod;
}

inline int F(int x, int y) {
  if (y <= x - 1)
    return 0;
  return sub(C(x + y, x), C(x + y, x - 1));
}

int main() {
  n = gi();
  a = gi();
  b = gi();
  fac[0] = ifac[0] = ifac[1] = 1;
  for (int i = 1; i < maxn; ++i)
    fac[i] = (ll)fac[i - 1] * i % mod;
  ifac[maxn - 1] = fpow(fac[maxn - 1], mod - 2);
  for (int i = maxn - 2; ~i; --i)
    ifac[i] = (ll)ifac[i + 1] * (i + 1) % mod;

  if (!b)
    return puts("1"), 0;
  int ans = 0;
  for (int i = 0; i <= n - b; ++i) {
    int tmp = F(i, b - 1);
    if (i + b == n) {
      if (i == a)
        ans = add(ans, tmp);
    } else {
      int x = n - b - i - 1, y = a - i + 1;
      ans = (ans + (ll)tmp * C(x + y - 1, y - 1)) % mod;
    }
  }
  printf("%d\\n", ans);

  return 0;
}


Error: -11

Fixed submission:

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

typedef long long ll;
const int maxn = 2e7 + 10, mod = 998244353;

inline int gi() {
  char c = getchar();
  while (c < '0' || c > '9')
    c = getchar();
  int sum = 0;
  while ('0' <= c && c <= '9')
    sum = sum * 10 + c - 48, c = getchar();
  return sum;
}

inline int add(int x, int y) { return x + y > mod ? x + y - mod : x + y; }
inline int sub(int x, int y) { return x < y ? x - y + mod : x - y; }
inline int fpow(int x, int k) {
  int res = 1;
  while (k) {
    if (k & 1)
      res = (ll)res * x % mod;
    k >>= 1;
    x = (ll)x * x % mod;
  }
  return res;
}

int n, a, b;
int fac[maxn], ifac[maxn];

inline int C(int m, int n) {
  if (m < 0 || m < n)
    return 0;
  return (ll)fac[m] * ifac[n] % mod * ifac[m - n] % mod;
}

inline int F(int x, int y) {
  if (y <= x - 1)
    return 0;
  return sub(C(x + y, x), C(x + y, x - 1));
}

int main() {
  n = gi();
  a = gi();
  b = gi();
  fac[0] = ifac[0] = ifac[1] = 1;
  for (int i = 1; i < maxn; ++i)
    fac[i] = (ll)fac[i - 1] * i % mod;
  ifac[maxn - 1] = fpow(fac[maxn - 1], mod - 2);
  for (int i = maxn - 2; ~i; --i)
    ifac[i] = (ll)ifac[i + 1] * (i + 1) % mod;

  if (!b)
    return puts("1"), 0;
  int ans = 0;
  for (int i = 0; i <= n - b; ++i) {
    int tmp = F(i, b - 1);
    if (i + b == n) {
      if (i == a)
        ans = add(ans, tmp);
    } else {
      int x = n - b - i - 1, y = a - i + 1;
      ans = (ans + (ll)tmp * C(x + y - 1, y - 1)) % mod;
    }
  }
  printf("%d\\n", ans);

  return 0;
}
Problem p02878 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

const int N = 1e7 + 5;
const int mod = 998244353;
int fra[N], inv[N];
int n, a, b, ans;

template <class T> inline T Min(T x, T y) { return x < y ? x : y; }

inline void add(int &x, int y) {
  x += y;
  x >= mod ? x -= mod : 0;
}

inline void dec(int &x, int y) {
  x -= y;
  x < 0 ? x += mod : 0;
}

inline void add_prod(int &x, int u, int v) { x = (1ll * u * v + x) % mod; }

inline int quick_pow(int x, int k) {
  int res = 1;
  while (k) {
    if (k & 1)
      res = 1ll * res * x % mod;
    x = 1ll * x * x % mod;
    k >>= 1;
  }
  return res;
}

inline int C(int n, int m) {
  if (n < m)
    return 0;
  return 1ll * fra[n] * inv[n - m] % mod * inv[m] % mod;
}

inline int ask(int k) {
  int res = C(k + b - 1, b - 1);
  dec(res, C(k + b - 1, k - 1));
  return res;
}

int main() {
  scanf("%d%d%d", &n, &a, &b);
  if (a == 0 && b == 0)
    return puts("1"), 0;
  fra[0] = 1;
  for (int i = 1; i <= n; ++i)
    fra[i] = 1ll * fra[i - 1] * i % mod;
  inv[n] = quick_pow(fra[n], mod - 2);
  for (int i = n; i >= 1; --i)
    inv[i - 1] = 1ll * inv[i] * i % mod;

  for (int k = 0, km = Min(n - b, Min(a, b - 1)); k <= km; ++k) {
    int tmp = k ? ask(k) : 1;
    if (k == a) {
      int x = n - b - k, y = a - k + 1;
      if (x >= 0)
        add_prod(ans, tmp, C(x + y - 1, y - 1));
    } else {
      int x = n - b - k - 1, y = a - k + 1;
      if (x >= 0)
        add_prod(ans, tmp, C(x + y - 1, y - 1));
    }
  }
  printf("%d\\n", ans);
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>

const int N = 1e7 + 5;
const int mod = 998244353;
int fra[N], inv[N];
int n, a, b, ans;

template <class T> inline T Min(T x, T y) { return x < y ? x : y; }

inline void add(int &x, int y) {
  x += y;
  x >= mod ? x -= mod : 0;
}

inline void dec(int &x, int y) {
  x -= y;
  x < 0 ? x += mod : 0;
}

inline void add_prod(int &x, int u, int v) { x = (1ll * u * v + x) % mod; }

inline int quick_pow(int x, int k) {
  int res = 1;
  while (k) {
    if (k & 1)
      res = 1ll * res * x % mod;
    x = 1ll * x * x % mod;
    k >>= 1;
  }
  return res;
}

inline int C(int n, int m) {
  if (n < m)
    return 0;
  return 1ll * fra[n] * inv[n - m] % mod * inv[m] % mod;
}

inline int ask(int k) {
  int res = C(k + b - 1, b - 1);
  dec(res, C(k + b - 1, k - 1));
  return res;
}

int main() {
  scanf("%d%d%d", &n, &a, &b);
  if (a == 0 && b == 0)
    return puts("1"), 0;
  fra[0] = 1;
  for (int i = 1; i <= n; ++i)
    fra[i] = 1ll * fra[i - 1] * i % mod;
  inv[n] = quick_pow(fra[n], mod - 2);
  for (int i = n; i >= 1; --i)
    inv[i - 1] = 1ll * inv[i] * i % mod;

  for (int k = 0, km = Min(a, b - 1); k <= km; ++k) {
    int tmp = k ? ask(k) : 1;
    if (k == a) {
      int x = n - b - k, y = a - k + 1;
      if (x >= 0)
        add_prod(ans, tmp, C(x + y - 1, y - 1));
    } else {
      int x = n - b - k - 1, y = a - k + 1;
      if (x >= 0)
        add_prod(ans, tmp, C(x + y - 1, y - 1));
    }
  }
  printf("%d\\n", ans);
  return 0;
}