alexjercan/bugnet huggingface dataset:
Problem p02703 (C++) — buggy submission, verdict: Runtime Error

#include <queue>
#include <stdio.h>
#include <vector>
struct str {
  int x0;
  int cost;
  int time;
};
std::vector<str> V[60];
struct str2 {
  int x0;
  int coin;
  long long int dist;
};
bool operator<(str2 a, str2 b) { return a.dist > b.dist; }
std::priority_queue<str2> Q;
std::pair<int, int> x[60];
long long int check[60][3000];

long long int MAX = 1;
int main() {
  for (int i = 1; i <= 15; i++)
    MAX *= 10;

  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  for (int i = 1; i <= b; i++) {
    int d, e, f, g;
    scanf("%d%d%d%d", &d, &e, &f, &g);
    V[d].push_back({e, f, g});
    V[e].push_back({d, f, g});
  }
  for (int i = 1; i <= a; i++) {
    int d, e;
    scanf("%d%d", &d, &e);
    x[i] = std::make_pair(d, e);
  }

  if (c > 2500)
    c = 2500;
  Q.push({1, c, 1});
  while (!Q.empty()) {
    int x0 = Q.top().x0;
    int coin = Q.top().coin;
    long long int dist = Q.top().dist;
    Q.pop();

    if (check[x0][coin])
      continue;
    check[x0][coin] = dist;

    if (coin + x[x0].first <= 2500)
      Q.push({x0, coin + x[x0].first, dist + x[x0].second});
    for (int i = 0; i < V[x0].size(); i++)
      if (V[x0][i].cost <= coin)
        Q.push({V[x0][i].x0, coin - V[x0][i].cost, dist + V[x0][i].time});
  }

  for (int i = 2; i <= a; i++) {
    long long int ans = MAX;
    for (int j = 0; j <= 2500; j++) {
      if (check[i][j] > 0)
        ans = ans < check[i][j] ? ans : check[i][j];
    }
    printf("%lld\\n", ans - 1);
  }
}

Error: -11

Fixed submission:

#include <queue>
#include <stdio.h>
#include <vector>
struct str {
  int x0;
  int cost;
  int time;
};
std::vector<str> V[60];
struct str2 {
  int x0;
  int coin;
  long long int dist;
};
bool operator<(str2 a, str2 b) { return a.dist > b.dist; }
std::priority_queue<str2> Q;
std::pair<int, int> x[60];
long long int check[60][3000];

long long int MAX = 1;
int main() {
  for (int i = 1; i <= 15; i++)
    MAX *= 10;

  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  for (int i = 1; i <= b; i++) {
    int d, e, f, g;
    scanf("%d%d%d%d", &d, &e, &f, &g);
    V[d].push_back({e, f, g});
    V[e].push_back({d, f, g});
  }
  for (int i = 1; i <= a; i++) {
    int d, e;
    scanf("%d%d", &d, &e);
    x[i] = std::make_pair(d, e);
  }

  if (c > 2500)
    c = 2500;
  Q.push({1, c, 1});
  while (!Q.empty()) {
    int x0 = Q.top().x0;
    int coin = Q.top().coin;
    long long int dist = Q.top().dist;
    Q.pop();

    if (check[x0][coin])
      continue;
    check[x0][coin] = dist;

    Q.push({x0, coin + x[x0].first, dist + x[x0].second});
    for (int i = 0; i < V[x0].size(); i++)
      if (V[x0][i].cost <= coin)
        Q.push({V[x0][i].x0, coin - V[x0][i].cost, dist + V[x0][i].time});
  }

  for (int i = 2; i <= a; i++) {
    long long int ans = MAX;
    for (int j = 0; j <= 2500; j++) {
      if (check[i][j] > 0)
        ans = ans < check[i][j] ? ans : check[i][j];
    }
    printf("%lld\\n", ans - 1);
  }
}
Problem p02703 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

int n, m, s;
ll a[51][51], b[51][51];
ll c[51];
ll d[51];

int maxa = 0;

struct Data {
  ll t, s, p;
  bool operator<(const Data &d) const { return t > d.t; }
};

ll dijkstra(int g) {
  priority_queue<Data> Q;
  bool visited[51][2501] = {false};
  Q.push({0, min(s, maxa * (n - 1)), 1});

  while (!Q.empty()) {
    Data now = Q.top();
    Q.pop();

    if (now.p == g) {
      return now.t;
    }
    if (visited[now.p][now.s])
      continue;
    visited[now.p][now.s] = true;

    if (now.s + c[now.p] <= maxa * (n - 1)) {
      Q.push({now.t + d[now.p], now.s + c[now.p], now.p});
    }

    for (int j = 1; j <= n; j++) {
      if (a[now.p][j] == 0)
        continue;

      int ns = now.s - a[now.p][j];
      if (ns < 0)
        continue;
      Q.push({now.t + b[now.p][j], ns, j});
    }
  }
}

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

  for (int i = 0; i < m; i++) {
    int u, v, aa, bb;
    cin >> u >> v >> aa >> bb;
    a[u][v] = a[v][u] = aa;
    b[u][v] = b[v][u] = bb;
    maxa = max(maxa, aa);
  }
  for (int i = 1; i <= n; i++) {
    cin >> c[i] >> d[i];
  }

  for (int i = 2; i <= n; i++) {
    cout << dijkstra(i) << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

int n, m, s;
int a[51][51], b[51][51];
int c[51];
int d[51];

int sums = 0;

struct Data {
  int t, s, p;
  bool operator<(const Data &d) const { return t > d.t; }
};

int dijkstra(int g) {
  priority_queue<Data> Q;
  Q.push({0, s, 1});

  while (!Q.empty()) {
    Data now = Q.top();
    Q.pop();

    if (now.p == g) {
      return now.t;
    }

    for (int i = 0; i <= sums / c[now.p]; i++) {
      for (int j = 1; j <= n; j++) {
        if (a[now.p][j] == 0)
          continue;
        if (now.s + c[now.p] * i < a[now.p][j])
          continue;
        Q.push({now.t + d[now.p] * i + b[now.p][j],
                now.s + c[now.p] * i - a[now.p][j], j});
      }
    }
  }
}

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

  for (int i = 0; i < m; i++) {
    int u, v, aa, bb;
    cin >> u >> v >> aa >> bb;
    a[u][v] = a[v][u] = aa;
    b[u][v] = b[v][u] = bb;
    sums += aa;
  }
  for (int i = 1; i <= n; i++) {
    cin >> c[i] >> d[i];
  }

  for (int i = 2; i <= n; i++) {
    cout << dijkstra(i) << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;
using plll = pair<ll, pll>;
using vll = vector<pll>;
using vvll = vector<vll>;

#define ff first
#define ss second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define dmin(a, b) a = min(a, b)

const ll INF = 1e18;

int main() {
  ll n, m, s;
  cin >> n >> m >> s;
  vvll edges(n, vll(n, pll(INF, INF)));
  vl ans(n, INF);
  rep(i, m) {
    ll u, v, a, b;
    cin >> u >> v >> a >> b;
    u--;
    v--;
    edges[u][v] = edges[v][u] = pll(a, b);
  }
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    edges[i][i] = pll(-a, b);
  }
  priority_queue<plll> pq;
  map<pll, ll> used;
  pq.push(plll(0, pll(0, s)));
  while (!pq.empty()) {
    ll time = -pq.top().ff;
    ll node = pq.top().ss.ff;
    ll cnt = pq.top().ss.ss;
    pq.pop();
    if (cnt < 0)
      continue;
    dmin(cnt, 2500LL);
    if (used.count(pll(node, cnt)))
      continue;
    used[pll(node, cnt)] = 1;
    dmin(ans[node], time);
    rep(to, n) {
      ll a = edges[node][to].ff, b = edges[node][to].ss;
      if (a == INF)
        continue;
      pq.push(plll(-time - b, pll(to, cnt - a)));
    }

    bool finished = true;
    rep(i, n) if (ans[i] == INF) finished = false;
    if (finished)
      break;
  }
  rep(i, n - 1) cout << ans[i + 1] << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;
using plll = pair<ll, pll>;
using vll = vector<pll>;
using vvll = vector<vll>;

#define ff first
#define ss second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define dmin(a, b) a = min(a, b)

const ll INF = 1e18;

int main() {
  ll n, m, s;
  cin >> n >> m >> s;
  vvll edges(n, vll(n, pll(INF, INF)));
  vl ans(n, INF);
  rep(i, m) {
    ll u, v, a, b;
    cin >> u >> v >> a >> b;
    u--;
    v--;
    edges[u][v] = edges[v][u] = pll(a, b);
  }
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    edges[i][i] = pll(-a, b);
  }
  priority_queue<plll> pq;
  map<plll, ll> mp;
  pq.push(plll(0, pll(0, s)));
  while (!pq.empty()) {
    if (mp.count(pq.top())) {
      pq.pop();
      continue;
    }
    mp[pq.top()] = 1;
    ll time = -pq.top().ff;
    ll node = pq.top().ss.ff;
    ll cnt = pq.top().ss.ss;
    pq.pop();
    if (cnt < 0)
      continue;
    dmin(cnt, 2500LL);
    dmin(ans[node], time);
    rep(to, n) {
      ll a = edges[node][to].ff, b = edges[node][to].ss;
      if (a == INF)
        continue;
      pq.push(plll(-time - b, pll(to, cnt - a)));
    }

    bool finished = true;
    rep(i, n) if (ans[i] == INF) finished = false;
    if (finished)
      break;
  }
  rep(i, n - 1) cout << ans[i + 1] << endl;
  return 0;
}
Problem p02703 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
  int N, M;
  ll S;
  cin >> N >> M >> S;
  ll C = 3000;
  vector<vector<ll>> dp(N, vector<ll>(C + 1, LLONG_MAX >> 4));

  vector<vector<tuple<int, int, ll>>> E(N);
  vector<pair<ll, ll>> B(N);

  for (int i = 0; i < M; i++) {
    int u, v, a;
    ll b;
    cin >> u >> v >> a >> b;
    E[u - 1].push_back(make_tuple(v - 1, a, b));
    E[v - 1].push_back(make_tuple(u - 1, a, b));
  }

  for (auto &[c, d] : B)
    cin >> c >> d;

  for (int i = 0; i <= min(C, S); i++)
    dp[0][i] = 0;
  for (int i = 0; i < 2000; i++) {
    for (int j = 0; j < N; j++) {
      for (ll s = 0; s <= C; s++) {
        for (auto [from, cost, t] : E[j]) {
          if (s + cost > C)
            continue;
          dp[j][s] = min(dp[j][s], dp[from][s + cost] + t);
        }
        ll b = dp[j][max(0LL, s - B[j].first)] + B[j].second;
        dp[j][s] = min(dp[j][s], b);
      }
    }
  }

  for (int i = 1; i < N; i++)
    cout << dp[i][0] << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
  int N, M, S;
  cin >> N >> M >> S;

  vector<vector<ll>> dp(N, vector<ll>(101, LLONG_MAX >> 4));

  vector<vector<tuple<int, int, ll>>> E(N);
  vector<pair<ll, ll>> B(N);

  for (int i = 0; i < M; i++) {
    int u, v, a;
    ll b;
    cin >> u >> v >> a >> b;
    E[u - 1].push_back(make_tuple(v - 1, a, b));
    E[v - 1].push_back(make_tuple(u - 1, a, b));
  }

  for (auto &[c, d] : B)
    cin >> c >> d;

  for (int i = 0; i <= S; i++)
    dp[0][i] = 0;
  for (int i = 0; i < 300; i++) {
    for (int j = 0; j < N; j++) {
      for (int s = 0; s <= 100; s++) {
        for (auto [from, cost, t] : E[j]) {
          if (s + cost > 100)
            continue;
          dp[j][s] = min(dp[j][s], dp[from][s + cost] + t);
        }
        ll b = dp[j][max(0LL, s - B[j].first)] + B[j].second;
        dp[j][s] = min(dp[j][s], b);
      }
    }
  }

  for (int i = 1; i < N; i++)
    cout << dp[i][0] << endl;
}
Problem p02703 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
typedef tuple<ll, int, int> P; // time, node idx, money
vector<P> G[55];
int C[55];
ll D[55];
int arrived[55][2505];
ll RET[55][2505];
int main() {
  ios::sync_with_stdio(false);
  int N, M, U, V, A, S;
  ll B;
  cin >> N >> M >> S;
  for (int i = 0; i < M; i++) {
    cin >> U >> V >> A >> B;
    G[U].push_back(make_tuple(B, V, A));
    G[V].push_back(make_tuple(B, U, A));
  }
  for (int i = 1; i <= N; i++) {
    cin >> C[i] >> D[i];
  }
  priority_queue<P, vector<P>, greater<P>> q;
  int TH = 2500;
  q.push(make_tuple(0LL, 1, min(S, TH)));
  while (!q.empty()) {
    auto p = q.top();
    q.pop();
    ll t = get<0>(p);
    int idx = get<1>(p);
    int mon = get<2>(p);
    if (arrived[idx][mon])
      continue;
    arrived[idx][mon] = 1;
    RET[idx][mon] = t;
    if (mon < TH) {
      q.push(make_tuple(t + D[idx], idx, min(TH, mon + C[idx])));
    }
    for (int i = 0; i < G[idx].size(); i++) {
      ll tt = get<0>(G[idx][i]);
      int ii = get<1>(G[idx][i]);
      ll mm = get<2>(G[idx][i]);
      if (mon < mm)
        continue;
      if (arrived[ii][mon - mm])
        continue;
      q.push(make_tuple(t + tt, ii, mon - mm));
    }
  }
  for (int i = 2; i <= N; i++) {
    ll ret = 1LL << 60;
    for (int j = 0; j <= TH; j++) {
      ret = min(ret, RET[i][j]);
    }
    cout << ret << '\\n';
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
typedef tuple<ll, int, ll> P; // time, node idx, money
vector<P> G[55];
ll C[55];
ll D[55];
ll RET[55];
int main() {
  ios::sync_with_stdio(false);
  int N, M, U, V, A;
  ll S, B;
  cin >> N >> M >> S;
  for (int i = 0; i < M; i++) {
    cin >> U >> V >> A >> B;
    G[U].push_back(make_tuple(B, V, A));
    G[V].push_back(make_tuple(B, U, A));
  }
  for (int i = 1; i <= N; i++) {
    cin >> C[i] >> D[i];
  }
  priority_queue<P, vector<P>, greater<P>> q;
  q.push(make_tuple(0LL, 1, S));
  ll TH = 50 * 100;
  ll arrived = 1;
  for (int i = 0; i <= N; i++)
    RET[i] = 1LL << 60;
  while (arrived != (1LL << (N + 1)) - 1) {
    auto p = q.top();
    q.pop();
    ll t = get<0>(p);
    int idx = get<1>(p);
    ll mon = get<2>(p);
    RET[idx] = min(RET[idx], t);
    arrived |= 1LL << idx;
    if (mon < TH) {
      q.push(make_tuple(t + D[idx], idx, mon + C[idx]));
    }
    for (int i = 0; i < G[idx].size(); i++) {
      ll tt = get<0>(G[idx][i]);
      int ii = get<1>(G[idx][i]);
      ll mm = get<2>(G[idx][i]);
      if (mon >= mm) {
        q.push(make_tuple(t + tt, ii, mon - mm));
      }
    }
  }
  for (int i = 2; i <= N; i++) {
    cout << RET[i] << '\\n';
  }
}
Problem p02705 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

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

  cout << 3.141592 * 2 * R << endl;
  return 0;
}


Error: -6
double free or corruption (out)


Fixed submission:

#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N, 0);
  A[0] = 0;
  for (int i = 1; i < N; ++i) {
    cin >> A[i];
  }

  vector<int> numOfTeam(N, 0);
  for (int i = 0; i < N; ++i) {
    int boss = A[i] - 1;
    numOfTeam[boss] += 1;
  }

  for (int i = 0; i < N; ++i) {
    cout << numOfTeam[i] << endl;
  }
  cout << setprecision(15) << endl;
  return 0;
}
Problem p02705 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define boost                                                                  \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
#define ull unsigned long long
#define d1(x) cout << #x << " " << x << endl;
#define d2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define d2i(x, y, i)                                                           \\
  cout << #x << i << " " << x << " " << #y << i << " " << y << endl;

#define fr(i, l, r) for (ll i = l; i < r; i++)
#define mems(a, x) memset(a, x, sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x, y) push_back(make_pair(x, y))
#define mat vector<vector<ll>>
#define pi 3.14159265358979323846
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void solve() {
  double r;
  cin >> r;
  cout << fixed;
  cout << setprecision(10) << (double)2 * pi * r << endl;
}

int main() {
  ll t = 1;
  // cin>>t;
  while (t--) {
    solve();
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define boost                                                                  \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
#define ull unsigned long long
#define d1(x) cout << #x << " " << x << endl;
#define d2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define d2i(x, y, i)                                                           \\
  cout << #x << i << " " << x << " " << #y << i << " " << y << endl;

#define fr(i, l, r) for (ll i = l; i < r; i++)
#define mems(a, x) memset(a, x, sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x, y) push_back(make_pair(x, y))
#define mat vector<vector<ll>>
#define pi 3.14159265358979323846
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void solve() {
  ll n, m;
  cin >> n >> m;
  ll sm = 0, x;
  fr(i, 0, m) cin >> x, sm += x;
  n -= sm;
  if (n < 0)
    cout << -1;
  else
    cout << n;
}

int main() {
  ll t = 1;
  // cin>>t;
  while (t--) {
    solve();
    cout << endl;
  }
  return 0;
}
Problem p02705 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main() {
  int r;
  cin >> r;
  cout << std::setprecision(9) << 2 * M_PI * r << endl;
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 2) > this->size() (which is 1)


Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main() {
  string a;
  bool flg = false;
  cin >> a;
  for (int i = 0; i < 3; i++) {
    if (a.substr(i, 1) == "7")
      flg = true;
  }
  if (flg)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02705 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  double R;
  cin >> R;
  cout << R * 2 * 3.1415 << endl;
}

Error: WA

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  vector<int> B(N, 0);
  for (int i = 1; i < N; i++) {
    int x;
    cin >> x;
    B[x - 1] += 1;
  }
  for (int i = 0; i < N; i++) {
    cout << B[i] << endl;
  }
}
Problem p02705 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int R;
  cin >> R;
  cout << (long long)R * 2 * M_PI << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  long long N, M;
  cin >> N >> M;
  long long A = 0;
  for (int i = 0; i < M; i++) {
    int tmp;
    cin >> tmp;
    A += tmp;
  }
  long tmp = N - A;
  if (N - A < 0) {
    cout << -1 << endl;
  } else {
    cout << tmp << endl;
  }
  return 0;
}
Problem p02705 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

#define fastio                                                                 \\
  ios_base::sync_with_stdio(NULL);                                             \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define read freopen("input.txt", "r", stdin);
#define write freopen("output.txt", "w", stdout);
#define nl '\\n'
#define mem(ara, n) memset(ara, n, sizeof ara)
#define debug(x) cerr << #x << " = " << x << nl

#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pb push_back
#define vpii vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rsort(v) sort(v.rbegin(), v.rend())

using namespace std;

const double pi = 2 * acos(0.0);

int main() {
  // fastio;
  ll r;
  cin >> r;
  cout << fixed << setprecision(10) << 2 * pi * r << nl;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  long long n, d, sum = 0, x;
  cin >> n >> d;
  for (long long i = 0; i < d; i++) {
    cin >> x;
    sum += x;
  }
  if (n < sum)
    cout << -1;
  else
    cout << n - sum;
}
Problem p02705 (C++) — buggy submission, verdict: Runtime Error

#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 int long long
#define endl '\\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

  ld r;
  cin >> r;
  cout << fixed << setprecision(10) << 2.0 * acos(-1) * r;

  return 0;
}


Error: -11

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;
#define int long long
#define endl '\\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

  int n, m;
  cin >> n >> m;
  int a[m], sum = 0;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum > n) {
    cout << -1;
  } else {
    cout << (n - sum);
  }

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

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

const double PI = 3.14159265358979323846L;

void solve() {
  int r;
  cin >> r;
  cout << (2.0L * PI * r) << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}


Error: WA

Fixed submission:

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

const int MOD = 1e9 + 7;
int add(int a, int b) { return ((ll)a + (ll)b) % MOD; }
int mul(int a, int b) { return ((ll)a * (ll)b) % MOD; }

void solve() {
  int n;
  cin >> n;
  vector<int> freq(n);
  for (int i = 1; i < n; i++) {
    int a;
    cin >> a;
    freq[a - 1]++;
  }

  for (int i = 0; i < n; i++) {
    cout << freq[i] << endl;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
Problem p02705 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int r;
int main() {
  cin >> r;
  cout << fixed << setprecision(5) << r * 2.0 * 3.1415926;
  return 0;
}

Error: WA

Fixed submission:

#include <cstdio>
#include <iostream>
using namespace std;
int n, a[20010] = {0};
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int t;
    cin >> t;
    a[t]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << endl;
  }
  return 0;
}