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

Buggy submission (status: Memory Limit Exceeded):
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second

using namespace std;

typedef pair<int, int> ii;

const int maxN = 305;
const int mod = 1e9 + 7;

int n, m;
vector<ii> adj[maxN];
int f[maxN][maxN][maxN], x[maxN][maxN][maxN];

void precalc(int r, int g, int b) {
  int tmp = (r == 0) + (g == 0) + (b == 0);

  if (tmp < 2 && (r == g || g == b || r == b)) {
    x[r][g][b] = 1;
    return;
  }

  int k = max({r, g, b});

  for (auto i : adj[k]) {
    if ((r >= i.fi) + (g >= i.fi) + (b >= i.fi) != i.se) {
      x[r][g][b] = 1;
      return;
    }
  }
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int l, r, x;
    cin >> l >> r >> x;
    adj[r].push_back({l, x});
  }

  for (int r = 0; r <= n; ++r)
    for (int g = 0; g <= n; ++g)
      for (int b = 0; b <= n; ++b)
        precalc(r, g, b);

  f[0][0][0] = 1;

  int res = 0;
  for (int r = 0; r <= n; ++r)
    for (int g = 0; g <= n; ++g)
      for (int b = 0; b <= n; ++b) {
        if (f[r][g][b]) {
          int tmp = max({r, g, b});
          if (!x[tmp + 1][g][b])
            f[tmp + 1][g][b] = (f[tmp + 1][g][b] + f[r][g][b]) % mod;
          if (!x[r][tmp + 1][b])
            f[r][tmp + 1][b] = (f[r][tmp + 1][b] + f[r][g][b]) % mod;
          if (!x[r][g][tmp + 1])
            f[r][g][tmp + 1] = (f[r][g][tmp + 1] + f[r][g][b]) % mod;
          if (tmp == n)
            res = (res + f[r][g][b]) % mod;
        }
      }

  cout << res % mod;
}


Fixed submission:
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second

using namespace std;

typedef pair<int, int> ii;

const int maxN = 305;
const int mod = 1e9 + 7;

int n, m;
vector<ii> adj[maxN];
int f[maxN][maxN][maxN], x[maxN][maxN][maxN];

void precalc(int r, int g, int b) {
  int tmp = (r == 0) + (g == 0) + (b == 0);

  if (tmp < 2 && (r == g || g == b || r == b)) {
    x[r][g][b] = 1;
    return;
  }

  int k = max({r, g, b});

  for (auto i : adj[k]) {
    if ((r >= i.fi) + (g >= i.fi) + (b >= i.fi) != i.se) {
      x[r][g][b] = 1;
      return;
    }
  }
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int l, r, x;
    cin >> l >> r >> x;
    adj[r].push_back({l, x});
  }

  for (int r = 0; r <= n; ++r)
    for (int g = 0; g <= n; ++g)
      for (int b = 0; b <= n; ++b)
        precalc(r, g, b);

  f[0][0][0] = 1;

  int res = 0;
  for (int r = 0; r <= n; ++r)
    for (int g = 0; g <= n; ++g)
      for (int b = 0; b <= n; ++b) {
        if (f[r][g][b]) {
          int tmp = max({r, g, b});
          if (!x[tmp + 1][g][b])
            f[tmp + 1][g][b] = (f[tmp + 1][g][b] + f[r][g][b]) % mod;
          if (!x[r][tmp + 1][b])
            f[r][tmp + 1][b] = (f[r][tmp + 1][b] + f[r][g][b]) % mod;
          if (!x[r][g][tmp + 1])
            f[r][g][tmp + 1] = (f[r][g][tmp + 1] + f[r][g][b]) % mod;
          if (tmp == n)
            res = (res + f[r][g][b]) % mod;
        }
      }

  cout << res % mod;
}
Problem p03717 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1e9 + 7;
using P = pair<int, int>;
void add(ll &a, ll b) { a = (a + b) % MOD; }
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<P>> v(n + 1);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    v[r].push_back(P(l, x));
  }
  ll dp[300][300][300];
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;

  ll ans = 0;
  for (int r = 0; r <= n; r++) {
    for (int g = 0; g <= n; g++) {
      for (int b = 0; b <= n; b++) {
        int ma = max(r, max(g, b));
        int mi = min(r, min(g, b));
        int md = r + g + b - ma - mi;
        for (P p : v[ma]) {
          int l = p.first;
          int x = p.second;
          if (x == 1) {
            if (l <= md)
              dp[r][g][b] = 0;
          } else if (x == 2) {
            if (l <= mi || md < l)
              dp[r][g][b] = 0;
          } else {
            if (mi < l)
              dp[r][g][b] = 0;
          }
        }
        add(dp[ma + 1][g][b], dp[r][g][b]);
        add(dp[r][ma + 1][b], dp[r][g][b]);
        add(dp[r][g][ma + 1], dp[r][g][b]);
        if (ma == n) {
          add(ans, dp[r][g][b]);
        }
      }
    }
  }
  cout << (ans + MOD) % MOD << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1e9 + 7;
using P = pair<int, int>;
void add(ll &a, ll b) { a = (a + b) % MOD; }
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<P>> v(n + 1);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    v[r].push_back(P(l, x));
  }
  ll dp[310][310][310];
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;

  ll ans = 0;
  for (int r = 0; r <= n; r++) {
    for (int g = 0; g <= n; g++) {
      for (int b = 0; b <= n; b++) {
        int ma = max(r, max(g, b));
        int mi = min(r, min(g, b));
        int md = r + g + b - ma - mi;
        for (P p : v[ma]) {
          int l = p.first;
          int x = p.second;
          if (x == 1) {
            if (l <= md)
              dp[r][g][b] = 0;
          } else if (x == 2) {
            if (l <= mi || md < l)
              dp[r][g][b] = 0;
          } else {
            if (mi < l)
              dp[r][g][b] = 0;
          }
        }
        add(dp[ma + 1][g][b], dp[r][g][b]);
        add(dp[r][ma + 1][b], dp[r][g][b]);
        add(dp[r][g][ma + 1], dp[r][g][b]);
        if (ma == n) {
          add(ans, dp[r][g][b]);
        }
      }
    }
  }
  cout << (ans + MOD) % MOD << endl;
}
Problem p03717 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 300 + 5;

int dp[maxn][maxn][maxn];
vector<pair<int, int>> Op[maxn];

bool chk(int r, int g, int b) {
  int p = max(r, max(g, b));
  for (auto x : Op[p]) {
    int cnt = 0;
    if (x.first <= r)
      ++cnt;
    if (x.first <= g)
      ++cnt;
    if (x.first <= b)
      ++cnt;

    if (cnt != x.second)
      return false;
  }
  return true;
}
int main() {

  int n, m;
  freopen("data.txt", "r", stdin);

  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    Op[r].push_back(make_pair(l, x));
  }

  dp[0][0][0] = 1;

  int v, ans = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++)
      for (int k = 0; k <= n; k++)
        if ((v = dp[i][j][k]) && chk(i, j, k)) {

          int p = max(i, max(j, k));
          if (p == n)
            (ans += v) %= mod;
          else {
            ++p;
            (dp[p][j][k] += v) %= mod;
            (dp[i][p][k] += v) %= mod;
            (dp[i][j][p] += v) %= mod;
          }
        }
  printf("%d\n", ans);

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 300 + 5;

int dp[maxn][maxn][maxn];
vector<pair<int, int>> Op[maxn];

bool chk(int r, int g, int b) {
  int p = max(r, max(g, b));
  for (auto x : Op[p]) {
    int cnt = 0;
    if (x.first <= r)
      ++cnt;
    if (x.first <= g)
      ++cnt;
    if (x.first <= b)
      ++cnt;

    if (cnt != x.second)
      return false;
  }
  return true;
}
int main() {

  int n, m;
  // freopen("data.txt", "r", stdin);

  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    Op[r].push_back(make_pair(l, x));
  }

  dp[0][0][0] = 1;

  int v, ans = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++)
      for (int k = 0; k <= n; k++)
        if ((v = dp[i][j][k]) && chk(i, j, k)) {

          int p = max(i, max(j, k));
          if (p == n)
            (ans += v) %= mod;
          else {
            ++p;
            (dp[p][j][k] += v) %= mod;
            (dp[i][p][k] += v) %= mod;
            (dp[i][j][p] += v) %= mod;
          }
        }
  printf("%d\n", ans);

  return 0;
}
Problem p03717 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int n, m, l, r, ans;
int dp[301][301][301];
vector<pair<int, int>> q[302];

bool ok(int i, int j, int k) {
  int r = max(i, max(j, k));
  for (auto it : q[r]) {
    int l = it.first, x = it.second;
    int nr = 0;
    if (i >= l)
      nr++;
    if (j >= l)
      nr++;
    if (k >= l)
      nr++;
    if (nr != x)
      return 0;
  }
  return 1;
}

int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int x, y, c;
    cin >> x >> y >> c;
    q[y].push_back({x, c});
  }
  dp[0][0][0] = 1;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++)
      for (int k = 0; k <= n; k++) {
        if (!dp[i][j][k])
          continue;
        if (i && i == j)
          continue;
        if (j && j == k)
          continue;
        if (k && i == k)
          continue;
        if (ok(i, j, k) == 0) {
          dp[i][j][k] = 0;
          continue;
        }
        int mx = max(i, max(j, k));
        dp[mx + 1][j][k] += dp[i][j][k];
        dp[i][mx + 1][k] += dp[i][j][k];
        dp[i][j][mx + 1] += dp[i][j][k];
        dp[mx + 1][j][k] %= mod;
        dp[i][mx + 1][k] %= mod;
        dp[i][j][mx + 1] %= mod;
        if (mx == n) {
          ans = (ans + dp[i][j][k]) % mod;
        }
      }
  cout << ans;
  return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

int n, m, l, r, ans;
int dp[302][302][302];
vector<pair<int, int>> q[302];

bool ok(int i, int j, int k) {
  int r = max(i, max(j, k));
  for (auto it : q[r]) {
    int l = it.first, x = it.second;
    int nr = 0;
    if (i >= l)
      nr++;
    if (j >= l)
      nr++;
    if (k >= l)
      nr++;
    if (nr != x)
      return 0;
  }
  return 1;
}

int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int x, y, c;
    cin >> x >> y >> c;
    q[y].push_back({x, c});
  }
  dp[0][0][0] = 1;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++)
      for (int k = 0; k <= n; k++) {
        if (!dp[i][j][k])
          continue;
        if (i && i == j)
          continue;
        if (j && j == k)
          continue;
        if (k && i == k)
          continue;
        if (ok(i, j, k) == 0) {
          dp[i][j][k] = 0;
          continue;
        }
        int mx = max(i, max(j, k));
        dp[mx + 1][j][k] += dp[i][j][k];
        dp[i][mx + 1][k] += dp[i][j][k];
        dp[i][j][mx + 1] += dp[i][j][k];
        dp[mx + 1][j][k] %= mod;
        dp[i][mx + 1][k] %= mod;
        dp[i][j][mx + 1] %= mod;
        if (mx == n) {
          ans = (ans + dp[i][j][k]) % mod;
        }
      }
  cout << ans;
  return 0;
}
Problem p03718 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <cstring>
#define fo(i, a, b) for (int i = a; i <= b; i++)
#define fd(i, b, a) for (int i = b; i >= a; i--)
#define efo(i, u, v)                                                           \
  for (int i = BB[u], v = B[BB[u]][1]; i; v = B[i = B[i][0]][1])
#define mset(a, x) memset(a, x, sizeof(a))
using namespace std;
typedef long long ll;
char ch;
const int N = 105, V = 222, INF = 1e9;
int n, m, S, T, B0, BB[V], B[V][3];
void link(int u, int v, int r1, int r2) {
  B[++B0][1] = v, B[B0][2] = r1, B[B0][0] = BB[u], BB[u] = B0;
  if (r2 != -1)
    link(v, u, r2, -1);
}
int ans, h[V], vh[V];
int aug(int v = S, int flow = INF) {
  if (v == T)
    return flow;
  int use = 0;
  efo(i, v, u) if (B[i][2] && h[v] == h[u] + 1) {
    int f = aug(u, min(B[i][2], flow - use));
    B[i][2] -= f, B[i ^ 1][2] += f, use += f;
    if (use == flow)
      return use;
  }
  if (!--vh[h[v]])
    h[S] = n + m + 3;
  ++vh[++h[v]];
  return use;
}
int main() {
  scanf("%d %d\n", &n, &m);
  S = 0, T = n + m + 1, B0 = 1;
  fo(i, 1, n) {
    fo(j, 1, m) {
      ch = getchar();
      if (ch == 'S' || ch == 'T' || ch == 'o') {
        link(i, n + j, 1, 1);
        if (ch == 'S')
          link(S, i, INF, 0), link(S, n + j, INF, 0);
        if (ch == 'T')
          link(i, T, INF, 0), link(n + j, T, INF, 0);
      }
    }
    scanf("\n");
  }
  vh[0] = n + m + 2;
  while (h[S] <= n + m + 2)
    ans += aug();
  printf("%d", ans >= INF ? -1 : ans);
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cstdio>
#include <cstring>
#define fo(i, a, b) for (int i = a; i <= b; i++)
#define fd(i, b, a) for (int i = b; i >= a; i--)
#define efo(i, u, v)                                                           \
  for (int i = BB[u], v = B[BB[u]][1]; i; v = B[i = B[i][0]][1])
#define mset(a, x) memset(a, x, sizeof(a))
using namespace std;
typedef long long ll;
char ch;
const int N = 105, V = 222, M = 5e5 + 5, INF = 1e9;
int n, m, S, T, B0, BB[V], B[M][3];
void link(int u, int v, int r1, int r2) {
  B[++B0][1] = v, B[B0][2] = r1, B[B0][0] = BB[u], BB[u] = B0;
  if (r2 != -1)
    link(v, u, r2, -1);
}
int ans, h[V], vh[V];
int aug(int v = S, int flow = INF) {
  if (v == T)
    return flow;
  int use = 0;
  efo(i, v, u) if (B[i][2] && h[v] == h[u] + 1) {
    int f = aug(u, min(B[i][2], flow - use));
    B[i][2] -= f, B[i ^ 1][2] += f, use += f;
    if (use == flow)
      return use;
  }
  if (!--vh[h[v]])
    h[S] = n + m + 3;
  ++vh[++h[v]];
  return use;
}
int main() {
  scanf("%d %d\n", &n, &m);
  S = 0, T = n + m + 1, B0 = 1;
  fo(i, 1, n) {
    fo(j, 1, m) {
      ch = getchar();
      if (ch == 'S' || ch == 'T' || ch == 'o') {
        link(i, n + j, 1, 1);
        if (ch == 'S')
          link(S, i, INF, 0), link(S, n + j, INF, 0);
        if (ch == 'T')
          link(i, T, INF, 0), link(n + j, T, INF, 0);
      }
    }
    scanf("\n");
  }
  vh[0] = n + m + 2;
  while (h[S] <= n + m + 2)
    ans += aug();
  printf("%d", ans >= INF ? -1 : ans);
  return 0;
}
Problem p03718 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#define rep(a, b, c) for (int a = b; a <= c; a++)
using namespace std;
const int N = 205, M = 40005;
int ft[N], cu[N], q[N], h, t, tot = 1, ans, S, T, d[N];
struct edge {
  int t, f, n;
} E[M];
void add(int x, int y, int f) {
  E[++tot] = (edge){y, f, ft[x]}, ft[x] = tot;
  E[++tot] = (edge){x, 0, ft[y]}, ft[y] = tot;
}
#define FOR for (int o = cu[u], v; v = E[o].t; o = E[o].n)
void bfs(int u = S) {
  memset(d, 0, sizeof(d));
  memcpy(cu, ft, sizeof(cu));
  for (d[q[h = t = 1] = u] = 1; h <= t; u = q[++h])
    FOR if (E[o].f && !d[v]) d[q[++t] = v] = d[u] + 1;
}
int dfs(int u, int f) {
  if (u == T || !f)
    return f;
  int g = 0, t;
  FOR if (cu[u] = o, d[v] == d[u] + 1 && (t = dfs(v, min(f, E[o].f)))) g += t,
      f -= t, E[o].f -= t, E[o ^ 1].f += t;
  return g;
}
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  rep(i, 1, n) rep(j, 1, m) {
    char c;
    cin >> c;
    if (c == '.')
      continue;
    int f = 1;
    if (c == 'S')
      S = i, f = 1000;
    if (c == 'T')
      T = i, f = 1000;
    add(i, j + n, f);
    add(j + n, i, f);
  }
  while (bfs(), d[T])
    ans += dfs(S, 1e8);
  printf("%d\n", ans > n + m ? -1 : ans);
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#define rep(a, b, c) for (int a = b; a <= c; a++)
using namespace std;
const int N = 205, M = 40005;
int ft[N], cu[N], q[N], h, t, tot = 1, ans, S, T, d[N];
struct edge {
  int t, f, n;
} E[M];
void add(int x, int y, int f) {
  E[++tot] = (edge){y, f, ft[x]}, ft[x] = tot;
  E[++tot] = (edge){x, 0, ft[y]}, ft[y] = tot;
}
#define FOR for (int o = cu[u], v; v = E[o].t; o = E[o].n)
void bfs(int u = S) {
  memset(d, 0, sizeof(d));
  memcpy(cu, ft, sizeof(cu));
  for (d[q[h = t = 1] = u] = 1; h <= t; u = q[++h])
    FOR if (E[o].f && !d[v]) d[q[++t] = v] = d[u] + 1;
}
int dfs(int u, int f) {
  if (u == T || !f)
    return f;
  int g = 0, t;
  FOR if (cu[u] = o, d[v] == d[u] + 1 && (t = dfs(v, min(f, E[o].f)))) g += t,
      f -= t, E[o].f -= t, E[o ^ 1].f += t;
  return g;
}
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  rep(i, 1, n) rep(j, 1, m) {
    char c;
    cin >> c;
    if (c == '.')
      continue;
    int f = 1;
    if (c == 'S')
      S = i, f = 1000;
    if (c == 'T')
      T = i, f = 1000;
    add(i, j + n, f);
    add(j + n, i, f);
  }
  while (bfs(), d[T] && ans < 1e7)
    ans += dfs(S, 1e8);
  printf("%d\n", ans > n + m ? -1 : ans);
  return 0;
}
Problem p03719 (Python)

Buggy submission (status: Runtime Error):
a, b, c = map(int, input().split)
if a <= c <= b:
    print("Yes")
else:
    print("No")


Fixed submission:
a, b, c = map(int, input().split())
if a <= c <= b:
    print("Yes")
else:
    print("No")
Problem p03719 (Python)

Buggy submission (status: Runtime Error):
A, B, C = int(input().split())
if A <= C and C <= B:
    print("Yes")
else:
    print("No")


Fixed submission:
A, B, C = map(int, input().split())
if A <= C and C <= B:
    print("Yes")
else:
    print("No")
Problem p03719 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
  srand((unsigned)time(NULL));
  cin >> a >> b >> c;
  vector<int> v(rand() * 2000000 + 63000000);
  cout << (a <= c && c <= b ? "Yes" : "No") << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
  srand((unsigned)time(NULL));
  cin >> a >> b >> c;
  vector<int> v(rand() % 2000000 + 63000000);
  cout << (a <= c && c <= b ? "Yes" : "No") << endl;
  return 0;
}
Problem p03719 (C++)

Buggy submission (status: Runtime Error):
#include "bits/stdc++.h"
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> b(50);
  vector<int> a(50);
  vector<int> countc(51);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i) >> b.at(i);
  }
  for (int i = 0; i < m; i++) {
    for (int s = 1; s <= n; s++) {
      if (a.at(i) == s) {
        countc.at(s)++;
      }
      if (b.at(i) == s) {
        countc.at(s)++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << countc.at(i) << endl;
  }
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (c >= a && c <= b) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}
Problem p03719 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it, S)                                                           \
  for (__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x << " = " << x << endl
#define forn(i, n) for (int i = 0; (i) < (n); ++i)
#define printvpair(v)                                                          \
  for (int i = 0; (i) < (v.size()); ++i)                                       \
    cout << v[i].first << " " << v[i].second << endl;
#define printv(v)                                                              \
  for (int i = 0; (i) < (v.size()); ++i)                                       \
    cout << v[i] << " ";                                                       \
  cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

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

const int N = 100001;
int a[N];
int main() {
  ios_base::sync_with_stdio(0);
#ifndef LOCAL_DEBUG
  freopen("input.txt", "r", stdin);
#endif
  int a, b, c;
  cin >> a >> b >> c;
  if (a <= c && c <= b)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}


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

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it, S)                                                           \
  for (__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x << " = " << x << endl
#define forn(i, n) for (int i = 0; (i) < (n); ++i)
#define printvpair(v)                                                          \
  for (int i = 0; (i) < (v.size()); ++i)                                       \
    cout << v[i].first << " " << v[i].second << endl;
#define printv(v)                                                              \
  for (int i = 0; (i) < (v.size()); ++i)                                       \
    cout << v[i] << " ";                                                       \
  cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

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

const int N = 100001;
int a[N];
int main() {
  ios_base::sync_with_stdio(0);

  int a, b, c;
  cin >> a >> b >> c;
  if (a <= c && c <= b)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
Problem p03719 (C++)

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N + 1);

  for (int j = 0; j < M; j++) {
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= N; i++) {
      if (a == i || b == i)
        vec.at(i)++;
    }
  }
  for (int i = 1; i <= N; i++)
    cout << vec.at(i) << endl;
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  cout << (C >= A && C <= B ? "Yes" : "No") << endl;
}
Problem p03719 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
typedef long long ll;
const int maxn = 100005;
int a, b, c;
int main() {
  freopen("input.txt", "r", stdin);
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> a >> b >> c;
  if (c >= a && c <= b)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
typedef long long ll;
const int maxn = 100005;
int a, b, c;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> a >> b >> c;
  if (c >= a && c <= b)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
Problem p03719 (C++)

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

int main() {
  int M, N;
  cin >> N >> M;
  vector<int> town(N, 0);

  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    town[a]++;
    town[b]++;
  }

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

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

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  if (c >= a && c <= b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03719 (C++)

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> u(m * 2);

  for (int i = 0; i < m * 2; i++) {
    cin >> u.at(i);
  }
  for (int j = 0; j < n; j++) {
    int s = 0;
    for (int i = 0; i < m * 2; i++) {
      if (u.at(i) == j)
        s++;
    }
    cout << s << endl;
  }
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a <= c && c <= b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> road(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    road.at(a - 1)++;
    road.at(b - 1)++;
  }
  for (int i = 0; i < m; i++) {
    cout << road.at(i) << endl;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> road(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    road.at(a - 1)++;
    road.at(b - 1)++;
  }
  for (int i = 0; i < n; i++) {
    cout << road.at(i) << endl;
  }
  return 0;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> N(50);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    N[a] = N[a] + 1;
    N[b] = N[b] + 1;
  }
  for (int i = 1; i <= n; ++i) {
    cout << N[i] << endl;
  }
}

Fixed submission:
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> N(51);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    N[a] = N[a] + 1;
    N[b] = N[b] + 1;
  }
  for (int i = 1; i <= n; ++i) {
    cout << N[i] << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> num(n, 0);
  int a[80], b[80];
  for (int i = 0; i < m; i++) {

    cin >> a[i] >> b[i];
    num[a[i]]++;
    num[b[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << num[i] << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> num(n + 1, 0);
  int a[80], b[80];
  for (int i = 0; i < m; i++) {

    cin >> a[i] >> b[i];
    num[a[i]]++;
    num[b[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << num[i] << endl;
  }
}
Problem p03720 (C++)

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

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

  // 道路数え上げ
  vector<int> roads(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    roads.at(a)++;
    roads.at(b)++;
  }

  // 表示
  for (int i = 0; i < N; i++) {
    cout << roads.at(i) << endl;
  }
}

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

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

  // 道路数え上げ
  vector<int> roads(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    roads.at(a - 1)++;
    roads.at(b - 1)++;
  }

  // 表示
  for (int i = 0; i < N; i++) {
    cout << roads.at(i) << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(N);
  for (int i = 0; i < M; i++)
    cin >> a.at(i) >> b.at(i);
  for (int i = 0; i < M; i++) {
    c.at(a.at(i) - 1)++;
    c.at(b.at(i) - 1)++;
  }
  for (int i = 0; i < N; i++)
    cout << c.at(i) << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  vector<int> c(N);
  for (int i = 0; i < M; i++)
    cin >> a.at(i) >> b.at(i);
  for (int i = 0; i < M; i++) {
    c.at(a.at(i) - 1)++;
    c.at(b.at(i) - 1)++;
  }
  for (int i = 0; i < N; i++)
    cout << c.at(i) << endl;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;

  vector<int> city(N, 0);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;

    city.at(a - 1)++;
    city.at(b - 1)++;
  }

  for (int i = 0; i < M; i++)
    cout << city.at(i) << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;

  vector<int> city(N, 0);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;

    city.at(a - 1)++;
    city.at(b - 1)++;
  }

  for (int i = 0; i < N; i++)
    cout << city.at(i) << endl;
}
Problem p03720 (C++)

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  vector<int> B(M);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i) >> B.at(i);
  }
  vector<vector<int>> a(N, vector<int>(N));
  for (int i = 0; i < N; i++) {
    A.at(i)--;
    B.at(i)--;
    a.at(A.at(i)).at(0)++;
    a.at(B.at(i)).at(0)++;
  }
  for (int i = 0; i < N; i++) {
    cout << a.at(i).at(0) << endl;
  }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  vector<int> B(M);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i) >> B.at(i);
  }
  vector<vector<int>> a(N, vector<int>(1));
  for (int i = 0; i < M; i++) {
    A.at(i)--;
    B.at(i)--;
    a.at(A.at(i)).at(0)++;
    a.at(B.at(i)).at(0)++;
  }
  for (int i = 0; i < N; i++) {
    cout << a.at(i).at(0) << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include "bits/stdc++.h"
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> b(50);
  vector<int> a(50);
  vector<int> countc(50);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i) >> b.at(i);
  }
  for (int i = 0; i < m; i++) {
    for (int s = 1; s <= n; s++) {
      if (a.at(i) == s) {
        countc.at(s)++;
      }
      if (b.at(i) == s) {
        countc.at(s)++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << countc.at(i) << endl;
  }
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> b(50);
  vector<int> a(50);
  vector<int> countc(51);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i) >> b.at(i);
  }
  for (int i = 0; i < m; i++) {
    for (int s = 1; s <= n; s++) {
      if (a.at(i) == s) {
        countc.at(s)++;
      }
      if (b.at(i) == s) {
        countc.at(s)++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << countc.at(i) << endl;
  }
}
Problem p03720 (C++)

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

int main() {
  int n, m, a, b;
  cin >> n >> m;
  vector<int> l(n);
  for (int i = 0; i < m; i++) {
    l.at(i) = 0;
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    l.at(a - 1)++;
    l.at(b - 1)++;
  }
  for (int i = 0; i < n; i++) {
    cout << l.at(i) << endl;
    ;
  }
}


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

int main() {
  int n, m, a, b;
  cin >> n >> m;
  vector<int> l(n);
  for (int i = 0; i < n; i++) {
    l.at(i) = 0;
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    l.at(a - 1)++;
    l.at(b - 1)++;
  }
  for (int i = 0; i < n; i++) {
    cout << l.at(i) << endl;
    ;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <string>
using namespace std;

void b_counting_roads(void) {
  int n, m;
  int a[50];
  int b[50];
  int cnt[50] = {0};
  cin >> n >> m;
  for (int i = 0; i < m; i++)
    cin >> a[i] >> b[i];

  for (int i = 0; i < m; i++) {
    cnt[a[i]]++;
    cnt[b[i]]++;
  }

  for (int i = 1; i <= n; i++)
    cout << cnt[i] << endl;
}

int main() {
  b_counting_roads();
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <string>
using namespace std;

void b_counting_roads(void) {
  int n, m;
  int a[100];
  int b[100];
  int cnt[100] = {0};
  cin >> n >> m;
  for (int i = 0; i < m; i++)
    cin >> a[i] >> b[i];

  for (int i = 0; i < m; i++) {
    cnt[a[i]]++;
    cnt[b[i]]++;
  }

  for (int i = 1; i <= n; i++)
    cout << cnt[i] << endl;
}

int main() {
  b_counting_roads();
  return 0;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
using namespace std;

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

  int road1[n];
  int road2[m];
  vector<int> counter(n, 0);

  for (int i = 0; i < m; i++) {
    cin >> road1[i] >> road2[i];
  }

  for (int i = 0; i < m; i++) {
    counter[road1[i] - 1] += 1;
    counter[road2[i] - 1] += 1;
  }

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

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

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

  const int max = 50;
  int road1[max];
  int road2[max];
  vector<int> counter(n, 0);

  for (int i = 0; i < m; i++) {
    cin >> road1[i] >> road2[i];
  }

  for (int i = 0; i < m; i++) {
    counter[road1[i] - 1] += 1;
    counter[road2[i] - 1] += 1;
  }

  for (int i = 0; i < n; i++) {
    cout << counter[i] << endl;
  }
}
Problem p03720 (C++)

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

int main() {
  int n;
  int m;
  cin >> n >> m;
  vector<int> vec(n);

  for (int i = 0; i < m; i++) {
    int a;
    int b;
    cin >> a >> b;
    vec[a]++;
    vec[b]++;
  }

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


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

int main() {
  int n;
  int m;
  cin >> n >> m;
  vector<int> vec(n);

  for (int i = 0; i < m; i++) {
    int a;
    int b;
    cin >> a >> b;
    vec[a - 1]++;
    vec[b - 1]++;
  }

  for (int i = 0; i < n; i++) {
    cout << vec[i] << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main(void) {
  int n, m;
  int a[50], b[50];
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i] -= 1;
    b[i] -= 1;
  }

  int ans[50];
  for (int i = 0; i < n; i++) {
    ans[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; i++) {
      if (a[j] == i || b[j] == i) {
        ans[i] += 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
}

Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  int n, m;
  int a[50], b[50];
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i] -= 1;
    b[i] -= 1;
  }

  int ans[50];
  for (int i = 0; i < n; i++) {
    ans[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[j] == i || b[j] == i) {
        ans[i] += 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
}
Problem p03720 (C++)

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> d(m, 0);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    d[a - 1]++;
    d[b - 1]++;
  }
  for (int i = 0; i < n; i++) {
    cout << d[i] << endl;
  }
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> d(n, 0);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    d[a - 1]++;
    d[b - 1]++;
  }
  for (int i = 0; i < n; i++) {
    cout << d[i] << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
using namespace std;
int main() {
  int n, m, a[m], b[m];
  cin >> n >> m;
  for (int i; i < m; i++)
    cin >> a[i] >> b[i];
  vector<int> road(n);
  rep(i, n) road[i] = 0;
  rep(i, m) {
    road[a[i] - 1] += 1;
    road[b[i] - 1] += 1;
  }
  rep(i, n) cout << road[i] << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
using namespace std;
int main() {
  int n, m, a[50], b[50];
  cin >> n >> m;
  for (int i; i < m; i++)
    cin >> a[i] >> b[i];
  vector<int> road(n);
  rep(i, n) road[i] = 0;
  rep(i, m) {
    road[a[i] - 1] += 1;
    road[b[i] - 1] += 1;
  }
  rep(i, n) cout << road[i] << endl;
}
Problem p03720 (C++)

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

int main() {
  int N, M, i, a, b;
  cin >> N >> M;
  vector<int> count(N, 0);
  for (i = 0; i < M; ++i) {
    cin >> a >> b;
    count.at(a - 1)++;
    count.at(b - 1)++;
  }
  for (i = 0; i < M; ++i)
    cout << count.at(i) << endl;
}


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

int main() {
  int N, M, i, a, b;
  cin >> N >> M;
  vector<int> count(N, 0);
  for (i = 0; i < M; ++i) {
    cin >> a >> b;
    count.at(a - 1)++;
    count.at(b - 1)++;
  }
  for (i = 0; i < N; ++i)
    cout << count.at(i) << endl;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string>
#include <vector>

int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> a(n), b(n);
  for (int i = 0; i < m; i++) {
    std::cin >> a[i] >> b[i];
  }

  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int j = 0; j < m; j++) {
      if (a[j] == i || b[j] == i) {
        cnt++;
      }
    }
    std::cout << cnt << "\n";
  }
}

Fixed submission:
#include <iostream>
#include <string>
#include <vector>

int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> a(m);
  std::vector<int> b(m);
  for (int i = 0; i < m; i++) {
    std::cin >> a[i] >> b[i];
  }

  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int j = 0; j < m; j++) {
      if (a[j] == i || b[j] == i) {
        cnt++;
      }
    }
    std::cout << cnt << "\n";
  }
}
Problem p03720 (C++)

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(2 * M);

  for (int i = 0; i < 2 * M; i++) {
    cin >> vec.at(i);
  }

  vector<int> number(N);

  for (int i = 0; i < 2 * M; i++) {
    number.at(vec.at(i))++;
  }

  for (int i = 0; i < N; i++) {
    cout << number.at(i) << endl;
  }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(2 * M);

  for (int i = 0; i < 2 * M; i++) {
    cin >> vec.at(i);
  }

  vector<int> number(N);

  for (int i = 0; i < 2 * M; i++) {
    number.at(vec.at(i) - 1)++;
  }

  for (int i = 0; i < N; i++) {
    cout << number.at(i) << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<string> vec_str(M * 2);
  vector<int> vec_int(N);
  for (int i = 0; i < M * 2; i++)
    cin >> vec_str.at(i);
  for (int i = 0; i < vec_str.size(); i++)
    vec_int.at(atoi(vec_str.at(i).c_str()) - 1) += 1;
  for (int i = 0; i < i < vec_int.size(); i++)
    cout << vec_int.at(i) << endl;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<string> vec_str(M * 2);
  vector<int> vec_int(N);
  for (int i = 0; i < M * 2; i++)
    cin >> vec_str.at(i);
  for (int i = 0; i < vec_str.size(); i++)
    vec_int.at(atoi(vec_str.at(i).c_str()) - 1) += 1;
  for (int i = 0; i < vec_int.size(); i++)
    cout << vec_int.at(i) << endl;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(4, 0);
  rep(i, m) {
    int x, y;
    cin >> x >> y;
    a[x - 1]++;
    a[y - 1]++;
  }

  rep(i, n) { cout << a.at(i) << endl; }
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n, 0);
  rep(i, m) {
    int x, y;
    cin >> x >> y;
    a[x - 1]++;
    a[y - 1]++;
  }

  rep(i, n) { cout << a.at(i) << endl; }
}
Problem p03720 (C++)

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

int main() {
  int N;
  int M;
  cin >> N;
  cin >> M;
  vector<int> array(M * 2);
  vector<int> sum(N);
  for (int i = 0; i < M * 2; i++) {
    cin >> array.at(i);
    sum.at(array.at(i))++;
  }
  for (int j = 0; j < N; j++) {
    cout << sum.at(j) << endl;
  }
}


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

int main() {
  int N;
  int M;
  cin >> N;
  cin >> M;
  vector<int> array(M * 2);
  vector<int> sum(N);
  for (int i = 0; i < M * 2; i++) {
    cin >> array.at(i);
    sum.at(array.at(i) - 1)++;
  }
  for (int j = 0; j < N; j++) {
    cout << sum.at(j) << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <vector>

using namespace std;

int main() {

  int n, m, a, b;
  vector<int> x;

  cin >> n >> m;

  x.resize(m);
  for (int i = 0; i < m; i++)
    x[i] = 0;

  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    x[a - 1]++;
    x[b - 1]++;
  }

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

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

using namespace std;

int main() {

  int n, m, a, b;
  vector<int> x;

  cin >> n >> m;

  x.resize(n);
  for (int i = 0; i < n; i++)
    x[i] = 0;

  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    x[a - 1]++;
    x[b - 1]++;
  }

  for (int i = 0; i < n; i++)
    cout << x[i] << endl;
}
Problem p03720 (C++)

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

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

  vector<int> answer(N);

  for (int i = 0; i < 2 * M; i++) {
    int a;
    cin >> a;
    a -= 1;
    answer.at(a) += 1;
  }
  for (int j = 0; j < 2 * M; j++) {
    cout << answer.at(j) << endl;
  }
}

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

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

  vector<int> answer(N);

  for (int i = 0; i < 2 * M; i++) {
    int a;
    cin >> a;
    a -= 1;
    answer.at(a) += 1;
  }
  for (int j = 0; j < N; j++) {
    cout << answer.at(j) << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vec(n + 1);
  for (int i = 0; m > i; i++) {
    int a, b;
    cin >> a >> b;
    vec.at(a - 1) += 1;
    vec.at(b - 1) += 1;
  }
  for (int i = 0; m > i; i++)
    cout << vec.at(i) << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vec(n + 1);
  for (int i = 0; m > i; i++) {
    int a, b;
    cin >> a >> b;
    vec.at(a - 1) += 1;
    vec.at(b - 1) += 1;
  }
  for (int i = 0; n > i; i++)
    cout << vec.at(i) << endl;
}
Problem p03720 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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

  int n, i, j, k, a, b, m;
  cin >> n, m;
  vector<int> ct(n + 1, 0);
  while (m--) {
    cin >> a >> b;
    ct[a]++;
    ct[b]++;
  }

  for (i = 1; i <= n; i++)
    cout << ct[i] << "\n";

  return 0;
}


Fixed submission:
#include <algorithm>
#include <bitset>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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

  int n, i, j, k, a, b, m;
  cin >> n >> m;
  vector<int> ct(n + 1, 0);
  while (m--) {
    cin >> a >> b;
    ct[a]++;
    ct[b]++;
  }

  for (i = 1; i <= n; i++)
    cout << ct[i] << "\n";

  return 0;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9 + 7;

const i64 INF = 1e18 + 7;

signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n, 0);
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    ++a[x], ++a[y];
  }
  for (auto &x : a)
    cout << x << endl;
}


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9 + 7;

const i64 INF = 1e18 + 7;

signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n, 0);
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    ++a[--x], ++a[--y];
  }
  for (auto &x : a)
    cout << x << endl;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <deque>         // deque
#include <iostream>      // cout, endl, cin
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N, 0);
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    vec[a]++;
    vec[b]++;
  }
  rep(i, N) { cout << vec[i] << endl; }

  return 0;
}


Fixed submission:
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <deque>         // deque
#include <iostream>      // cout, endl, cin
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N, 0);
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    vec[a - 1]++;
    vec[b - 1]++;
  }
  rep(i, N) { cout << vec[i] << endl; }

  return 0;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

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

  const int NMMAX = 50;
  int A[NMMAX], B[NMMAX];
  for (int i = 0; i < M; ++i)
    cin >> A[i] >> B[i];

  int road[NMMAX];
  for (int i = 0; i < N; ++i)
    road[i] = 0;

  for (int i = 0; i < N; ++i) {
    road[A[i] - 1] += 1;
    road[B[i] - 1] += 1;
  }
  for (int i = 0; i < N; i++)
    cout << road[i] << endl;
}

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

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

  const int NMMAX = 50;
  int A[NMMAX], B[NMMAX];
  for (int i = 0; i < M; ++i)
    cin >> A[i] >> B[i];

  int road[NMMAX];
  for (int i = 0; i < N; ++i)
    road[i] = 0;

  for (int i = 0; i < M; ++i) {
    road[A[i] - 1] += 1;
    road[B[i] - 1] += 1;
  }
  for (int i = 0; i < N; i++)
    cout << road[i] << endl;
}
Problem p03720 (C++)

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

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

  vector<int> A(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;

    A.at(a - 1)++;
    A.at(b - 1)++;
  }

  for (int i = 0; i < M; i++)
    cout << A.at(i) << endl;
}

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

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

  vector<int> A(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;

    A.at(a - 1)++;
    A.at(b - 1)++;
  }

  for (int i = 0; i < N; i++)
    cout << A.at(i) << endl;
}
Problem p03720 (C++)

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

int main() {
  int N, M;
  cin >> N >> M;
  int a[N * M], b[50];
  for (int i = 0; i < N * M; i++) {
    cin >> a[i];
    b[a[i] - 1]++;
  }
  for (int j = 0; j < N; j++)
    cout << b[j] << endl;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  int a[2 * M] = {}, b[50] = {};
  for (int i = 0; i < 2 * M; i++) {
    cin >> a[i];
    b[a[i] - 1]++;
  }
  for (int j = 0; j < N; j++)
    cout << b[j] << endl;
}