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

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

int main() {

  // 都市の数N，道の数Mを宣言 	都市一時保存用A
  int N, M, A = 0;
  cin >> N >> M;

  vector<int> road(N, 0);

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

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


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

int main() {

  // 都市の数N，道の数Mを宣言 	都市一時保存用A
  int N, M, A = 0;
  cin >> N >> M;

  vector<int> road(N, 0);

  for (int i = 0; i < 2 * M; i++) {
    cin >> A;
    road.at(A - 1)++;
  }

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

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
using namespace std;
const double PI = acos(-1.0);
const string ALP = "abcdefghijklmnopqrstuvwxyz";
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
int main() {
  int n, m, a;
  cin >> n >> m;
  vector<int> c(n);
  REP(i, m) {
    REP(j, 2) {
      cin >> a;
      c[a]++;
    }
  }
  REP(i, n) cout << c[i] << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
using namespace std;
const double PI = acos(-1.0);
const string ALP = "abcdefghijklmnopqrstuvwxyz";
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
int main() {
  int n, m, a;
  cin >> n >> m;
  vector<int> c(n);
  REP(i, m) {
    REP(j, 2) {
      cin >> a;
      c[--a]++;
    }
  }
  REP(i, n) cout << c[i] << endl;
  return 0;
}
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(M * 2);
  for (int i = 0; i < M; i++) {
    cin >> vec.at(i) >> vec.at(i + 1);
    i++;
  }

  vector<int> result(N);

  for (int i = 0; i < vec.size(); i++) {
    result.at(vec.at(i) - 1)++;
  }

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

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

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

  vector<int> result(N);

  for (int i = 0; i < vec.size(); i++) {
    result.at(vec.at(i) - 1)++;
  }

  for (int i = 0; i < result.size(); i++) {
    cout << result.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), b(m), c(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < m; i++) {
    c[a[i] - 1]++;
    c[b[i] - 1]++;
  }
  for (int i = 0; i < n; i++) {
    cout << c[i] << endl;
  }
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m), c(n);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < m; i++) {
    c[a[i] - 1]++;
    c[b[i] - 1]++;
  }
  for (int i = 0; i < n; i++) {
    cout << c[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, b;
  vector<int> bridge(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    a--;
    b--;
    bridge.at(a) += 1;
    bridge.at(b) += 1;
  }

  for (int i = 0; i < n; i++) {
    cout << bridge.at(i) << endl;
  }
  return 0;
}


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

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

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

  for (int i = 0; i < n; i++) {
    cout << bridge.at(i) << endl;
  }
  return 0;
}
Problem p03720 (C++)

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

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int n, m, ab[51] = {0}, a, b;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    ab[a] += 1;
    ab[b] += 1;
  }
  for (int i = 1; i <= n; i++) {
    cout << ab[i] << endl;
  }
  return 0;
}
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 * 2);
  for (int i = 0; i < 2 * m; i++)
    cin >> a.at(i);
  vector<int> res(50);
  for (int i = 0; i < n; i++)
    res.at(i) = 0;
  for (int i = 0; i < 2 * m; i++) {
    res.at(a.at(i))++;
  }
  for (int i = 1; i <= n; i++)
    cout << res.at(i) << endl;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m * 2);
  for (int i = 0; i < 2 * m; i++)
    cin >> a.at(i);
  vector<int> res(100);
  for (int i = 0; i < n; i++)
    res.at(i) = 0;
  for (int i = 0; i < 2 * m; i++) {
    res.at(a.at(i))++;
  }
  for (int i = 1; i <= n; i++)
    cout << res.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> cities(N);
  for (int m = 0; m < M; m++) {
    int a, b;
    cin >> a >> b;
    cities.at(a) = cities.at(a) + 1;
    cities.at(b) = cities.at(b) + 1;
  }
  for (int n = 0; n < N; n++) {
    cout << cities.at(n) << endl;
  }
}


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

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

  vector<int> cities(N);
  for (int m = 0; m < M; m++) {
    int a, b;
    cin >> a >> b;
    cities.at(a - 1) = cities.at(a - 1) + 1;
    cities.at(b - 1) = cities.at(b - 1) + 1;
  }
  for (int n = 0; n < N; n++) {
    cout << cities.at(n) << 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 < N; i++) {
    cout << road.at(i) << endl;
  }
}

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) += 1;
    road.at(b - 1) += 1;
  }
  for (int i = 0; i < N; i++) {
    cout << road.at(i) << endl;
  }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

  vector<int> edge(N);

  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    edge.at(a - 1) += 1;
    edge.at(b - 1) += 1;
  }

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

Fixed submission:
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

  vector<int> edge(N);

  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    edge.at(a - 1) += 1;
    edge.at(b - 1) += 1;
  }

  for (int i = 0; i < N; i++) {
    cout << edge.at(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++)
#define rep2(i, x, n) for (int i = x; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  int n, m, a, b;
  cin >> n >> m;
  int ans[50] = {};
  rep(i, m) {
    cin >> a >> b;
    ans[a]++;
    ans[b]++;
  }
  rep2(i, 1, n + 1) cout << ans[i] << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, x, n) for (int i = x; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  int n, m, a, b;
  cin >> n >> m;
  int ans[55] = {};
  rep(i, m) {
    cin >> a >> b;
    ans[a]++;
    ans[b]++;
  }
  rep2(i, 1, n + 1) cout << ans[i] << endl;
  return 0;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int q[60];
  for (int i = 0; i < m * 2; i++) {
    q[i] = 0;
  }
  for (int i = 0; i < m * 2; i++) {
    int p = 0;
    cin >> p;
    q[p] += 1;
  }
  for (int i = 1; i <= n; i++) {
    cout << q[i] << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int q[60];
  for (int i = 0; i < 60; i++) {
    q[i] = 0;
  }
  for (int i = 0; i < m * 2; i++) {
    int p = 0;
    cin >> p;
    q[p] += 1;
  }
  for (int i = 1; i <= n; i++) {
    cout << q[i] << endl;
  }
}
Problem p03720 (C++)

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

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

  int n, m;
  cin >> n >> m;

  vector<vector<int>> r(n);

  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;

    r[a].push_back(b);
    r[b].push_back(a);
  }

  for (int i = 0; i < n; i++) {
    cout << r[i].size() << "\n";
  }

  return 0;
}


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

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

  int n, m;
  cin >> n >> m;

  vector<vector<int>> r(n);

  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;

    r[a - 1].push_back(b);
    r[b - 1].push_back(a);
  }

  for (int i = 0; i < n; i++) {
    cout << r[i].size() << "\n";
  }

  return 0;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for (int i = a; i < b; i++)

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m * 2);
  vector<int> f(n);
  rep(i, 0, m * 2) {
    cin >> a[i];
    f[a[i]] += 1;
  }
  for (int i = 1; i <= n; i++)
    cout << f[i] << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for (int i = a; i < b; i++)

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

Buggy submission (status: Runtime Error):
//
// Created by 加藤英祐 on 2020/04/14.
//
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> city(N);
  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;
  }

  return 0;
}

Fixed submission:
//
// Created by 加藤英祐 on 2020/04/14.
//
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> city(N);
  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;
  }

  return 0;
}
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[m], b[m];
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
  }

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

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

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

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

  int num[n + 1];
  for (int i = 0; i < n; i++) {
    num[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    num[a[i] - 1]++;
    num[b[i] - 1]++;
  }
  for (int i = 0; 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;
  int a, b;
  vector<int> res(N);
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    res.at(a) = res.at(a) + 1;
    res.at(b) = res.at(b) + 1;
  }
  for (int i = 0; i < N; i++)
    cout << res.at(i) << endl;
}


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

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

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

int main() {
  int cities, roads;
  cin >> cities >> roads;
  vector<int> answers(cities);
  for (int i = 0; i < roads; i++) {
    int a, b;
    cin >> a >> b;
    answers.at(a)++;
    answers.at(b)++;
  }
  for (int i = 0; i < cities; i++) {
    cout << answers.at(i) << endl;
  }
}


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

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

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

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

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> road(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    road.at(a - 1)++;
    road.at(b - 1)++;
  }
  rep(i, n) cout << road.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++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007 // 1e9+7
using namespace std;
typedef long long ll;
typedef vector<int> vecint;
typedef vector<string> vecstr;
int main() {
  int n, m;
  cin >> n >> m;
  vecint a(n, 0), b(n, 0);
  REP(i, m) cin >> a[i] >> b[i];
  vecint ans(n, 0);
  REP(i, m) {
    ans[a[i] - 1]++;
    ans[b[i] - 1]++;
  }
  REP(i, n) { cout << ans[i] << endl; }
}

Fixed submission:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007 // 1e9+7
using namespace std;
typedef long long ll;
typedef vector<int> vecint;
typedef vector<string> vecstr;
int main() {
  int n, m;
  cin >> n >> m;
  vecint a(m, 0), b(m, 0);
  REP(i, m) cin >> a[i] >> b[i];
  vecint ans(n, 0);
  REP(i, m) {
    ans[a[i] - 1]++;
    ans[b[i] - 1]++;
  }
  REP(i, n) { cout << ans[i] << endl; }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a, b;
  long long path[m + 10];
  for (long long i = 0; i < n; i++) {
    path[i] = 0;
  }
  for (long long i = 0; i < m; i++) {
    cin >> a >> b;
    path[a - 1]++;
    path[b - 1]++;
  }
  for (long long i = 0; i < n; i++) {
    printf("%lld\n", path[i]);
  }
  return 0;
}

Fixed submission:
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a, b;
  long long path[n + 100];
  for (long long i = 0; i < n; i++) {
    path[i] = 0;
  }
  for (long long i = 0; i < m; i++) {
    cin >> a >> b;
    path[a - 1]++;
    path[b - 1]++;
  }
  for (long long i = 0; i < n; i++) {
    printf("%lld\n", path[i]);
  }
  return 0;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORR(i, a, b) for (int i = a; i >= b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORR(i, a, b) for (int i = a; i >= b; --i)
#define ALL(c) c.begin(), c.end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;

int main() {
  int n, m;
  cin >> n >> m;
  VI ans(n);
  REP(i, m) {
    int u, v;
    cin >> u >> v;
    ans[u]++;
    ans[v]++;
  }
  REP(i, n) cout << ans[i] << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORR(i, a, b) for (int i = a; i >= b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORR(i, a, b) for (int i = a; i >= b; --i)
#define ALL(c) c.begin(), c.end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;

int main() {
  int n, m;
  cin >> n >> m;
  VI ans(n);
  REP(i, m) {
    int u, v;
    cin >> u >> v;
    ans[u - 1]++;
    ans[v - 1]++;
  }
  REP(i, n) cout << ans[i] << endl;
  return 0;
}
Problem p03720 (C++)

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

using namespace std;

int main(void) {
  int n, m;
  vector<int> cnt;
  cin >> n >> m;
  cnt = vector<int>(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    cnt[u]++;
    cnt[v]++;
  }
  for (int i = 0; i < n; i++) {
    cout << cnt[i] << endl;
  }
  return 0;
}

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

using namespace std;

int main(void) {
  int n, m;
  vector<int> cnt;
  cin >> n >> m;
  cnt = vector<int>(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    cnt[u - 1]++;
    cnt[v - 1]++;
  }
  for (int i = 0; i < n; i++) {
    cout << cnt[i] << endl;
  }
  return 0;
}
Problem p03720 (C++)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// 都市iから伸びる道路の数=a,bに含まれるiの数
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  rep(i, M) {
    cin >> a[i];
    cin >> b[i];
  }
  vector<int> num(N); // num[i]は都市iから伸びる道路の数
  for (int i = 1; i <= N; i++) {
    int c = 0;
    for (int j = 0; j < M; j++) {
      if (a[j] == i)
        c++;
      if (b[j] == i)
        c++;
    }
    num[i] = c;
  }

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

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// 都市iから伸びる道路の数=a,bに含まれるiの数
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  rep(i, M) {
    cin >> a[i];
    cin >> b[i];
  }
  vector<int> num(N + 1); // num[i]は都市iから伸びる道路の数
  for (int i = 1; i <= N; i++) {
    int c = 0;
    for (int j = 0; j < M; j++) {
      if (a[j] == i)
        c++;
      if (b[j] == i)
        c++;
    }
    num[i] = c;
  }

  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> a(50);
  vector<int> b(50);
  vector<int> c(50);
  for (int i = 1; i < M + 1; i++) {
    cin >> a.at(i) >> b.at(i);
  }

  for (int i = 1; i < N + 1; i++) {
    c.at(i) = 0;
    for (int x = 1; x < M + 1; x++) {
      if (i == a.at(x) || i == b.at(x)) {
        c.at(i) += 1;
      }
    }
    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(500);
  vector<int> b(500);
  vector<int> c(500);
  for (int i = 1; i < M + 1; i++) {
    cin >> a.at(i) >> b.at(i);
  }

  for (int i = 1; i < N + 1; i++) {
    c.at(i) = 0;
    for (int x = 1; x < M + 1; x++) {
      if (i == a.at(x) || i == b.at(x)) {
        c.at(i) += 1;
      }
    }
    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> vec(N);
  for (int i = 0; i < M; ++i) {
    int A, B;
    cin >> A >> B;
    ++vec.at(A);
    ++vec.at(B);
  }
  for (int i = 0; i < N; ++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);
  for (int i = 0; i < M; ++i) {
    int A, B;
    cin >> A >> B;
    vec.at(A - 1) += 1;
    vec.at(B - 1) += 1;
  }
  for (int i = 0; i < N; ++i) {
    cout << vec.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> vec1(M);
  vector<int> vec2(M);
  vector<int> vec3(N);
  for (int i = 0; i < M; i++) {
    cin >> vec1.at(i) >> vec2.at(i);
    vec3.at(vec1.at(i))++;
    vec3.at(vec2.at(i))++;
  }
  for (int i = 0; i < N; i++) {
    cout << vec3.at(i) << endl;
  }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec1(M);
  vector<int> vec2(M);
  vector<int> vec3(N);
  for (int i = 0; i < M; i++) {
    cin >> vec1.at(i) >> vec2.at(i);
    vec3.at(vec1.at(i) - 1)++;
    vec3.at(vec2.at(i) - 1)++;
  }
  for (int i = 0; i < N; i++) {
    cout << vec3.at(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;
using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  int a[m], b[m];
  rep(i, m) cin >> a[i] >> b[i];
  int num[50] = {0};
  rep(i, m) {
    num[a[i]]++;
    num[b[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << num[i] << endl;
  }
  return 0;
}

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

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

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a, b, count1, count2;
  rep(i, M) { cin >> a[i] >> b[i]; }
  rep(j, N) {
    rep(i, M) {
      if (a[i] == j + 1) {
        count1[j]++;
      }
      if (b[i] == j + 1) {
        count2[j]++;
      }
    }
    cout << count1[j] + count2[j] << endl;
  }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M), count1(N), count2(N);
  rep(i, M) { cin >> a[i] >> b[i]; }
  rep(j, N) {
    rep(i, M) {
      if (a[i] == j + 1) {
        count1[j]++;
      }
      if (b[i] == j + 1) {
        count2[j]++;
      }
    }
    cout << count1[j] + count2[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;
  const int NMMAX = 50;
  int A[NMMAX],
      B[NMMAX]; // A,Bの配列には、A[i](B[i])番目に入っている都市から一本道路が伸びているという情報が入ってる

  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i]; // A,Bに入力
  }

  int road[NMMAX]; // 各都市から何本の道路が伸びているかの配列を用意。
  for (int i = 0; i < N; i++) {
    road[i] =
        0; // i番目の都市からはこの時点では0本伸びている。A,Bを参照して足していく
  }
  for (int i = 0; i < M; i++) {
    road[A[i] - 1] +=
        1; // Aの配列に入っている、i番目の都市から1本生えている情報を足す。
    // Aの配列に入っているi番目の都市から生えている、ということは配列のi-1番目に入れるべき（0スタート。Nは1から数えている)
    road[B[i] - 1] += 1; // 一本伸びてるよ情報をroad配列に加える
  }

  for (int i = 0; i < N; i++) {
    cout << road[i] << endl; // i番目の都市からは道路がroad[i]本伸びている。
  }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  const int NMMAX = 50;
  int A[NMMAX],
      B[NMMAX]; // A,Bの配列には、A[i](B[i])番目に入っている都市から一本道路が伸びているという情報が入ってる

  for (int i = 0; i < M; i++) { // 道路の本数ぶんなのでM
    cin >> A[i] >> B[i];        // A,Bに入力
  }

  int road[NMMAX]; // 各都市から何本の道路が伸びているかの配列を用意。
  for (int i = 0; i < N; i++) {
    road[i] =
        0; // i番目の都市からはこの時点では0本伸びている。A,Bを参照して足していく
  }
  for (int i = 0; i < M; i++) {
    road[A[i] - 1] +=
        1; // Aの配列に入っている、i番目の都市から1本生えている情報を足す。
    // Aの配列に入っているi番目の都市から生えている、ということは配列のi-1番目に入れるべき（0スタート。Nは1から数えている)
    road[B[i] - 1] += 1; // 一本伸びてるよ情報をroad配列に加える
  }

  for (int i = 0; i < N; i++) {
    cout << road[i] << endl; // i番目の都市からは道路がroad[i]本伸びている。
  }
}
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> Count(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    Count[a]++;
    Count[b]++;
  }
  for (int i = 0; i < N; i++) {
    cout << Count[i] << endl;
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> Count(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    Count[a - 1]++;
    Count[b - 1]++;
  }
  for (int i = 0; i < N; i++) {
    cout << Count[i] << endl;
  }
  return 0;
}
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> count(m);

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

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

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

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

  for (int i = 0; i < n; i++) {
    cout << count[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(N);
  vector<int> A(2);
  for (int i = 0; i < M; i++) {
    cin >> A.at(0) >> A.at(1);
    D.at(A.at(0))++;
    D.at(A.at(1))++;
  }
  for (int i = 0; i < N; i++) {
    cout << D.at(i) << endl;
  }
}


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

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

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

using namespace std;

int main() {
  int N, M;
  vector<int> a(60);
  vector<int> b(60);

  cin >> N >> M;

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

  vector<int> c = {0};
  for (int i = 0; i < M; i++) {
    c[a[i] - 1] += 1;
    c[b[i] - 1] += 1;
  }

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

  return 0;
}

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

using namespace std;

int main() {
  int N, M;
  vector<int> a(60);
  vector<int> b(60);

  cin >> N >> M;

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

  vector<int> c(N);
  for (int i = 0; i < M; i++) {
    c[a[i] - 1] += 1;
    c[b[i] - 1] += 1;
  }

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

  return 0;
}
Problem p03720 (C++)

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

int main() {
  int N, W;
  cin >> N >> W;
  vector<int> vec(N, 0);
  for (int i = 0; i < W; i++) {
    int a, 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, W;
  cin >> N >> W;
  vector<int> vec(N, 0);
  for (int i = 0; i < W; i++) {
    int a, 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: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int C, R, a, b;
  cin >> C >> R;
  vector<int> v(C, 0);
  for (int i = 0; i < R; i++) {
    cin >> a >> b;
    v.at(a)++;
    v.at(b)++;
  }
  for (int i = 0; i < C; i++) {
    cout << v.at(i) << endl;
  }
}

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

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

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

int main() {
  int N, M, o = 0, p = 0;
  cin >> N >> M;
  vector<int> a(N);
  for (int i = 0; i < M; i++) {
    cin >> o >> p;
    a.at(o - 1)++;
    a.at(p - 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, o = 0, p = 0;
  cin >> N >> M;
  vector<int> a(N);
  for (int i = 0; i < M; i++) {
    cin >> o >> p;
    a.at(o - 1)++;
    a.at(p - 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;
  vector<int> roads(N, 0), a(M, 0), b(M, 0);

  for (int i = 0; i < M; i++) {
    cin >> a.at(i) >> b.at(i);
  }

  for (int i = 0; i < N; i++) {
    roads.at(a.at(i) - 1)++;
    roads.at(b.at(i) - 1)++;
  }

  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, 0), a(M, 0), b(M, 0);

  for (int i = 0; i < M; i++) {
    cin >> a.at(i) >> b.at(i);
  }

  for (int i = 0; i < M; i++) {
    roads.at(a.at(i) - 1)++;
    roads.at(b.at(i) - 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> vec(M * 2);
  for (int i; i < N * 2; i++) {
    cin >> vec.at(i);
  }

  for (int j = 0; j < N; j++) {
    int a = 0;
    for (int i = 0; i < M * 2; i++) {
      if (vec.at(i) == j + 1) {
        a++;
      }
    }
    cout << a << endl;
  }
}


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

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

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

  for (int j = 0; j < N; j++) {
    int a = 0;
    for (int i = 0; i < M * 2; i++) {
      if (vec.at(i) == j + 1) {
        a++;
      }
    }
    cout << a << 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;
using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<int> A(N, 0);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    A[a]++;
    A[b]++;
  }
  for (int i = 0; i < N; i++) {
    cout << A[i] << endl;
  }

  return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<int> A(N, 0);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    A[a - 1]++;
    A[b - 1]++;
  }
  for (int i = 0; i < N; i++) {
    cout << A[i] << endl;
  }

  return 0;
}
Problem p03720 (C++)

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

int main() {
  int i, j, k;
  int N, M;
  int a, b;

  cin >> N >> M;

  vector<int> A(50);
  vector<int> B(50);

  for (i = 0; i < M; i++) {
    cin >> a >> b;
    A.at(a)++;
    A.at(b)++;
  }

  for (i = 1; i <= N; i++)
    cout << A.at(i) << endl;
}


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

int main() {
  int i, j, k;
  int N, M;
  int a, b;

  cin >> N >> M;

  vector<int> A(2500);
  vector<int> B(2500);

  for (i = 0; i < M; i++) {
    cin >> a >> b;
    A.at(a)++;
    A.at(b)++;
  }

  for (i = 1; 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;

  vector<int> city(n);
  vector<int> road(2);

  for (int i = 0; i < m; i++) {
    cin >> road.at(0) >> road.at(1);
    city.at(road.at(0))++;
    city.at(road.at(1))++;
  }

  for (int i = 0; i < n; 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);
  vector<int> road(2);

  for (int i = 0; i < m; i++) {
    cin >> road.at(0) >> road.at(1);
    city.at(road.at(0) - 1)++;
    city.at(road.at(1) - 1)++;
  }

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c[50], d[50];
  cin >> a >> b;

  for (int i = 0; i < b; i++) {
    cin >> c[i] >> d[i];
  }
  int e[50];

  for (int i = 0; i < a; i++) {

    e[i] = 0;
  }
  for (int j = 0; j < b; j++) {
    e[c[j] - 1] += 1;
    e[d[j] - 1] += 1;
  }
  for (int i = 0; i = a; i++) {
    cout << e[i] << endl;
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c[50], d[50];
  cin >> a >> b;

  for (int i = 0; i < b; i++) {
    cin >> c[i] >> d[i];
  }
  int e[50];

  for (int i = 0; i < a; i++) {

    e[i] = 0;
  }
  for (int j = 0; j < b; j++) {
    e[c[j] - 1] += 1;
    e[d[j] - 1] += 1;
  }
  for (int i = 0; i < a; i++) {
    cout << e[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<vector<int>> input(N, vector<int>(2));
  vector<int> output(N, 0);
  for (int i = 0; i < M; ++i) {
    cin >> input.at(i).at(0) >> input.at(i).at(1);
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      for (int k = 0; k < 2; ++k) {
        if (i + 1 == input.at(j).at(k)) {
          ++output.at(i);
        }
      }
    }
  }
  for (int i = 0; i < N; ++i) {
    cout << output.at(i) << endl;
  }
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> input(M, vector<int>(2));
  vector<int> output(N, 0);
  for (int i = 0; i < M; ++i) {
    cin >> input.at(i).at(0) >> input.at(i).at(1);
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      for (int k = 0; k < 2; ++k) {
        if (i + 1 == input.at(j).at(k)) {
          ++output.at(i);
        }
      }
    }
  }
  for (int i = 0; i < N; ++i) {
    cout << output.at(i) << endl;
  }
}
Problem p03720 (C++)

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

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

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


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

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

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

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

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

  vector<int> count(N, 0);

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

    if (i == a || i == b) {
      count.at(i)++;
    }
  }

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


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

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

  vector<int> count(N, 0);

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

    for (int j = 0; j < N; j++) {
      if ((j + 1 == a || j + 1 == b) && a != b) {
        count.at(j)++;
      }
    }
  }

  for (i = 0; i < N; i++) {
    cout << count.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++)
#define repa(i, s, n) for (int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;

int main() {
  int n, m;
  cin >> n >> m;
  vi a(n), b(n), road(n);
  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    road[a[i]]++;
    road[b[i]]++;
  }

  rep(i, n) { cout << road[i] << endl; }
  return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vi a(m), b(m), road(n);
  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    road[a[i]]++;
    road[b[i]]++;
  }

  rep(i, n) { cout << road[i] << endl; }
  return 0;
}
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<vector<int>> v(M + 1);
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    v[a].push_back(b);
  }
  for (int i = 1; i <= N; i++) {
    int sum = 0;

    for (int y = 1; y <= N; y++) {
      if (y == i)
        sum += v[y].size();
      else
        for (int x : v[y]) {
          if (x == i)
            sum += 1;
        }
    }
    cout << sum << endl;
  }
}

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

int main() {
  int N, M, a, b;
  cin >> N >> M;
  vector<vector<int>> v(N + 1);
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    v[a].push_back(b);
  }
  for (int i = 1; i <= N; i++) {
    int sum = 0;

    for (int y = 1; y <= N; y++) {
      if (y == i)
        sum += v[y].size();
      else
        for (int x : v[y]) {
          if (x == i)
            sum += 1;
        }
    }
    cout << sum << endl;
  }
}
Problem p03720 (C++)

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a, b(M);

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

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);

  rep(i, M) cin >> a.at(i) >> b.at(i);
  rep(i, N) {
    int x = 0;
    rep(j, M) {
      if (a.at(j) == i + 1 || b.at(j) == i + 1)
        x++;
    }
    cout << x << endl;
  }
}
Problem p03720 (C++)

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> roads(50), x(50), y(50);
  rep(i, N) { roads.at(i) = 0; }
  rep(i, M) {
    cin >> x.at(i) >> y.at(i);
    roads.at(x.at(i)) += 1;
    roads.at(y.at(i)) += 1;
  }
  rep(j, N) { cout << roads.at(j) << endl; }
  return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> roads(50), x(50), y(50);
  rep(i, N) { roads.at(i) = 0; }
  rep(i, M) {
    cin >> x.at(i) >> y.at(i);
    roads.at(x.at(i) - 1) += 1;
    roads.at(y.at(i) - 1) += 1;
  }
  rep(j, N) { cout << roads.at(j) << endl; }
  return 0;
}
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, 0);
  for (int i = 0; i < M; i++) {
    int a, b;
    scanf("&d", &a, &b);
    road[a - 1]++;
    road[b - 1]++;
  }
  for (int i = 0; i < N; i++) {
    cout << road[i] << endl;
  }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> road(N, 0);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    road[a - 1]++;
    road[b - 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);
  vector<int> b(n);
  for (int i = 0; i < m; i++)
    cin >> a[i] >> b[i];
  map<int, int> ma;
  for (int i = 0; i < m; i++) {
    ma[a[i]]++;
    ma[b[i]]++;
  }
  for (int i = 0; i < n; i++)
    cout << ma[i + 1] << 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[i] >> b[i];
  map<int, int> ma;
  for (int i = 0; i < m; i++) {
    ma[a[i]]++;
    ma[b[i]]++;
  }
  for (int i = 0; i < n; i++)
    cout << ma[i + 1] << 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(m * 2);
  vector<int> road(n);

  for (int i = 0; i < m * 2; i++) {
    cin >> city.at(i);
    road.at(city.at(i))++;
  }

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

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

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

  for (int i = 0; i < m * 2; i++) {
    cin >> city.at(i);
    road.at(city.at(i) - 1)++;
  }

  for (int i = 0; i < n; i++) {
    cout << road.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);
  for (int i = 0; i < 2 * M; i++) {
    int road;
    cin >> road;
    city.at(road)++;
  }
  for (int i = 0; i < N; i++)
    cout << city.at(i) << endl;

  return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> city(N);
  for (int i = 0; i < 2 * M; i++) {
    int road;
    cin >> road;
    city.at(road - 1)++;
  }
  for (int i = 0; i < N; i++)
    cout << city.at(i) << endl;

  return 0;
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> vec(N, vector<int>(2));
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i).at(0) >> vec.at(i).at(1);
  }
  vector<int> count(N);
  rep(i, N) {
    for (int j = 0; j < M; j++) {
      if (vec.at(j).at(0) == i + 1 || vec.at(j).at(1) == i + 1) {
        count[i]++;
      }
    }
  }
  rep(i, N) { cout << count[i] << endl; }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> vec(M, vector<int>(2));
  for (int i = 0; i < M; i++) {
    cin >> vec.at(i).at(0) >> vec.at(i).at(1);
  }
  vector<int> count(N);
  rep(i, N) {
    for (int j = 0; j < M; j++) {
      if (vec.at(j).at(0) == i + 1 || vec.at(j).at(1) == i + 1) {
        count[i]++;
      }
    }
  }
  rep(i, N) { cout << count[i] << endl; }
}
Problem p03720 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <set>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;

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

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

  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      if (a[i] == j + 1)
        values[j]++;
      else if (b[i] == j + 1)
        values[j]++;
    }
  }

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

Fixed submission:
#include <iostream>
#include <set>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;

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

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

  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      if (a[i] == j + 1)
        values[j]++;
      else if (b[i] == j + 1)
        values[j]++;
    }
  }

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