problem_id stringlengths 6 6 | language stringclasses 2 values | original_status stringclasses 3 values | original_src stringlengths 19 243k | changed_src stringlengths 19 243k | change stringclasses 3 values | i1 int64 0 8.44k | i2 int64 0 8.44k | j1 int64 0 8.44k | j2 int64 0 8.44k | error stringclasses 270 values | stderr stringlengths 0 226k |
|---|---|---|---|---|---|---|---|---|---|---|---|
p02799 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
vector<int> g[N];
int d[N];
int vis[N];
bool ok[N];
int a[N], b[N];
int main() {
int n, m;
scanf("%d %d", &n, &m);
for (int i = 0; i < n; ++i)
scanf("%d", d + i);
for (int i = 0; i < m; ++i) {
int u, v;
scanf("%d %d", &u, &v);
--u, --v;
a[i] = u;
b[i] = v;
g[u].push_back(v);
g[v].push_back(u);
}
vector<int> nodes(n);
iota(nodes.begin(), nodes.end(), 0);
sort(nodes.begin(), nodes.end(), [](int l, int r) { return d[l] <= d[r]; });
for (int v : nodes) {
if (vis[v])
continue;
queue<int> que;
vis[v] = 1;
que.push(v);
while (!que.empty()) {
int u = que.front();
que.pop();
for (int w : g[u]) {
if (vis[w] || d[w] < d[u])
continue;
vis[w] = -vis[u];
que.push(w);
}
}
}
for (int i = 0; i < m; ++i) {
int u = a[i], v = b[i];
if (vis[u] != vis[v]) {
if (d[u] == max(d[u], d[v]))
ok[u] = 1;
if (d[v] == max(d[u], d[v]))
ok[v] = 1;
}
}
for (int i = 0; i < n; ++i) {
if (!ok[i]) {
puts("-1");
return 0;
}
}
for (int i = 0; i < n; ++i) {
printf("%c", vis[i] > 0 ? 'B' : 'W');
}
printf("\n");
for (int i = 0; i < m; ++i)
printf("%d\n", max(d[a[i]], d[b[i]]));
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
vector<int> g[N];
int d[N];
int vis[N];
bool ok[N];
int a[N], b[N];
int main() {
int n, m;
scanf("%d %d", &n, &m);
for (int i = 0; i < n; ++i)
scanf("%d", d + i);
for (int i = 0; i < m; ++i) {
int u, v;
scanf("%d %d", &u, &v);
--u, --v;
a[i] = u;
b[i] = v;
g[u].push_back(v);
g[v].push_back(u);
}
vector<int> nodes(n);
for (int i = 0; i < n; ++i)
nodes[i] = i;
sort(nodes.begin(), nodes.end(), [](int l, int r) { return d[l] < d[r]; });
for (int v : nodes) {
if (vis[v])
continue;
queue<int> que;
vis[v] = 1;
que.push(v);
while (!que.empty()) {
int u = que.front();
que.pop();
for (int w : g[u]) {
if (vis[w] || d[w] < d[u])
continue;
vis[w] = -vis[u];
que.push(w);
}
}
}
for (int i = 0; i < m; ++i) {
int u = a[i], v = b[i];
if (vis[u] != vis[v]) {
if (d[u] == max(d[u], d[v]))
ok[u] = 1;
if (d[v] == max(d[u], d[v]))
ok[v] = 1;
}
}
for (int i = 0; i < n; ++i) {
if (!ok[i]) {
puts("-1");
return 0;
}
}
for (int i = 0; i < n; ++i) {
printf("%c", vis[i] > 0 ? 'B' : 'W');
}
printf("\n");
for (int i = 0; i < m; ++i)
printf("%d\n", max(d[a[i]], d[b[i]]));
return 0;
}
| replace | 28 | 30 | 28 | 31 | 0 | |
p02799 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
int n, m;
cin >> n >> m;
array<int, 2> d[n];
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
d[i] = {a[i], i};
}
sort(d, d + n);
vector<vector<array<int, 2>>> v(n);
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
a--, b--;
v[a].push_back({b, i});
v[b].push_back({a, i});
}
int c[n];
for (int i = 0; i < n; i++)
c[i] = -1;
int ans[m];
int INF = 1e9;
for (int i = 0; i < m; i++)
ans[i] = INF;
priority_queue<array<int, 2>, vector<array<int, 2>>, greater<array<int, 2>>>
q;
q.push({d[0][0], d[0][1]});
bool used[n];
for (int i = 0; i < n; i++)
used[i] = 0;
while (q.size()) {
array<int, 2> p = q.top();
// cerr << p[0] << " " << p[1] << endl;
q.pop();
used[p[1]] = 1;
if (c[p[1]] == -1)
c[p[1]] = 1;
for (auto i : v[p[1]]) {
if (c[i[0]] == -1)
c[i[0]] = c[p[1]] ^ 1;
ans[i[1]] = max(a[i[0]], p[0]);
if (!used[i[0]]) {
q.push({a[i[0]], i[0]});
}
}
}
for (int i = 0; i < n; i++) {
bool pos = false;
for (auto j : v[i]) {
int p = j[0];
int itr = j[1];
if (c[p] == c[i])
continue;
if (ans[itr] < a[i]) {
cout << -1 << endl;
return 0;
}
if (ans[itr] == a[i])
pos = 1;
}
if (!pos) {
cout << -1 << endl;
return 0;
}
}
for (int i = 0; i < n; i++) {
if (c[i] == 1)
cout << "W";
else
cout << "B";
}
cout << "\n";
for (int i = 0; i < m; i++) {
cout << ans[i] << "\n";
}
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
int n, m;
cin >> n >> m;
array<int, 2> d[n];
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
d[i] = {a[i], i};
}
sort(d, d + n);
vector<vector<array<int, 2>>> v(n);
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
a--, b--;
v[a].push_back({b, i});
v[b].push_back({a, i});
}
int c[n];
for (int i = 0; i < n; i++)
c[i] = -1;
int ans[m];
int INF = 1e9;
for (int i = 0; i < m; i++)
ans[i] = INF;
priority_queue<array<int, 2>, vector<array<int, 2>>, greater<array<int, 2>>>
q;
q.push({d[0][0], d[0][1]});
bool used[n];
for (int i = 0; i < n; i++)
used[i] = 0;
while (q.size()) {
array<int, 2> p = q.top();
// cerr << p[0] << " " << p[1] << endl;
q.pop();
used[p[1]] = 1;
if (c[p[1]] == -1)
c[p[1]] = 1;
for (auto i : v[p[1]]) {
if (c[i[0]] == -1)
c[i[0]] = c[p[1]] ^ 1;
ans[i[1]] = max(a[i[0]], p[0]);
if (!used[i[0]]) {
used[i[0]] = 1;
q.push({a[i[0]], i[0]});
}
}
}
for (int i = 0; i < n; i++) {
bool pos = false;
for (auto j : v[i]) {
int p = j[0];
int itr = j[1];
if (c[p] == c[i])
continue;
if (ans[itr] < a[i]) {
cout << -1 << endl;
return 0;
}
if (ans[itr] == a[i])
pos = 1;
}
if (!pos) {
cout << -1 << endl;
return 0;
}
}
for (int i = 0; i < n; i++) {
if (c[i] == 1)
cout << "W";
else
cout << "B";
}
cout << "\n";
for (int i = 0; i < m; i++) {
cout << ans[i] << "\n";
}
} | insert | 51 | 51 | 51 | 52 | TLE | |
p02799 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()
#define LOCAL
#ifdef LOCAL
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define dump(x) true
#endif
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T, class U> void chmin(T &t, const U &u) {
if (t > u)
t = u;
}
template <class T, class U> void chmax(T &t, const U &u) {
if (t < u)
t = u;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
rep(i, v.size()) {
if (i)
os << ",";
os << v[i];
}
os << "}";
return os;
}
const int maxn = 100010;
const int L = TEN(9);
V<pii> g[maxn];
int main() {
int N, M;
cin >> N >> M;
V<int> D(N);
rep(i, N) cin >> D[i];
V<pii> es(M);
rep(i, M) {
int a, b;
cin >> a >> b;
--a;
--b;
g[a].eb(b, i);
g[b].eb(a, i);
}
V<pii> vec;
rep(i, N) vec.eb(mp(D[i], i));
sort(ALL(vec));
V<int> ans(M, L);
V<int> col(N, -1);
rep(i, N) {
int v = vec[i].se;
dump(v);
if (col[v] != -1) {
continue;
}
bool fd = 0;
for (auto e : g[v]) {
if (col[e.fi] != -1) {
if (D[e.fi] == D[v]) {
col[v] = col[e.fi] ^ 1;
dump(mp(v, e.fi));
dump(D[v]);
ans[e.se] = D[v];
} else {
col[v] = col[e.fi];
ans[e.se] = D[v] - D[e.fi];
dump(mp(v, e.fi));
dump(D[v] - D[e.fi]);
}
fd = 1;
break;
} else {
if (D[v] == D[e.fi]) {
col[e.fi] = 0;
col[v] = 1;
ans[e.se] = D[v];
dump(e.se);
dump(D[v]);
fd = 1;
break;
}
}
}
if (!fd) {
puts("-1");
return 0;
}
dump(ans);
}
string s(N, '?');
rep(i, N) {
if (col[i] == 1)
s[i] = 'B';
else
s[i] = 'W';
}
cout << s << endl;
rep(i, M) { cout << ans[i] << "\n"; }
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()
#ifdef LOCAL
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define dump(x) true
#endif
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T, class U> void chmin(T &t, const U &u) {
if (t > u)
t = u;
}
template <class T, class U> void chmax(T &t, const U &u) {
if (t < u)
t = u;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
rep(i, v.size()) {
if (i)
os << ",";
os << v[i];
}
os << "}";
return os;
}
const int maxn = 100010;
const int L = TEN(9);
V<pii> g[maxn];
int main() {
int N, M;
cin >> N >> M;
V<int> D(N);
rep(i, N) cin >> D[i];
V<pii> es(M);
rep(i, M) {
int a, b;
cin >> a >> b;
--a;
--b;
g[a].eb(b, i);
g[b].eb(a, i);
}
V<pii> vec;
rep(i, N) vec.eb(mp(D[i], i));
sort(ALL(vec));
V<int> ans(M, L);
V<int> col(N, -1);
rep(i, N) {
int v = vec[i].se;
dump(v);
if (col[v] != -1) {
continue;
}
bool fd = 0;
for (auto e : g[v]) {
if (col[e.fi] != -1) {
if (D[e.fi] == D[v]) {
col[v] = col[e.fi] ^ 1;
dump(mp(v, e.fi));
dump(D[v]);
ans[e.se] = D[v];
} else {
col[v] = col[e.fi];
ans[e.se] = D[v] - D[e.fi];
dump(mp(v, e.fi));
dump(D[v] - D[e.fi]);
}
fd = 1;
break;
} else {
if (D[v] == D[e.fi]) {
col[e.fi] = 0;
col[v] = 1;
ans[e.se] = D[v];
dump(e.se);
dump(D[v]);
fd = 1;
break;
}
}
}
if (!fd) {
puts("-1");
return 0;
}
dump(ans);
}
string s(N, '?');
rep(i, N) {
if (col[i] == 1)
s[i] = 'B';
else
s[i] = 'W';
}
cout << s << endl;
rep(i, M) { cout << ans[i] << "\n"; }
return 0;
} | delete | 17 | 18 | 17 | 17 | TLE | |
p02799 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using minheap = priority_queue<T, vector<T>, greater<T>>;
int main() {
int N, M;
cin >> N >> M;
vector<int> D(N);
rep(i, N) cin >> D[i];
vector<int> U(M), V(M);
vector<vector<int>> G(N);
rep(i, M) {
cin >> U[i] >> V[i];
U[i]--;
V[i]--;
G[U[i]].push_back(i);
G[V[i]].push_back(i);
}
vector<set<int>> T(N);
vector<bool> vis(N);
vector<int> color(N, -1);
constexpr int INF = 1e9;
vector<int> ans(N, INF + 1);
rep(i, N) {
pair<int, int> mn(INF, INF);
for (int k : G[i]) {
int j = U[k] ^ V[k] ^ i;
mn = min(mn, make_pair(D[j], k));
}
ans[mn.second] = D[i];
}
rep(i, N) if (color[i] == -1) {
color[i] = 0;
queue<int> q;
q.push(i);
while (not q.empty()) {
int v = q.front();
q.pop();
for (int j : G[v])
if (ans[j] <= INF) {
int u = U[j] ^ V[j] ^ v;
if (color[u] == -1) {
color[u] = color[v] ^ 1;
q.push(u);
}
}
}
}
rep(i, M) ans[i] = min(ans[i], INF);
for (int ii = 0; ii < 2; ii++) {
constexpr ll INFL = 1e18;
vector<ll> dist(N, INFL);
minheap<pair<ll, int>> heap;
rep(i, N) if (color[i] == ii) {
dist[i] = 0;
heap.emplace(0, i);
}
while (not heap.empty()) {
ll d;
int u;
tie(d, u) = heap.top();
heap.pop();
if (d > dist[u])
continue;
for (int i : G[u]) {
int v = U[i] ^ V[i] ^ u;
if (dist[v] > dist[u] + ans[i]) {
dist[v] = dist[u] + ans[i];
heap.emplace(dist[v], v);
}
}
}
rep(i, N) if (color[i] == 1 - ii and dist[i] != D[i]) {
cout << -1 << endl;
return 0;
}
}
rep(i, N) cout << (color[i] ? 'B' : 'W');
cout << endl;
rep(i, M) { cout << ans[i] << '\n'; }
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using minheap = priority_queue<T, vector<T>, greater<T>>;
int main() {
int N, M;
cin >> N >> M;
vector<int> D(N);
rep(i, N) cin >> D[i];
vector<int> U(M), V(M);
vector<vector<int>> G(N);
rep(i, M) {
cin >> U[i] >> V[i];
U[i]--;
V[i]--;
G[U[i]].push_back(i);
G[V[i]].push_back(i);
}
vector<set<int>> T(N);
vector<bool> vis(N);
vector<int> color(N, -1);
constexpr int INF = 1e9;
vector<int> ans(M, INF + 1);
rep(i, N) {
pair<int, int> mn(INF, INF);
for (int k : G[i]) {
int j = U[k] ^ V[k] ^ i;
mn = min(mn, make_pair(D[j], k));
}
ans[mn.second] = D[i];
}
rep(i, N) if (color[i] == -1) {
color[i] = 0;
queue<int> q;
q.push(i);
while (not q.empty()) {
int v = q.front();
q.pop();
for (int j : G[v])
if (ans[j] <= INF) {
int u = U[j] ^ V[j] ^ v;
if (color[u] == -1) {
color[u] = color[v] ^ 1;
q.push(u);
}
}
}
}
rep(i, M) ans[i] = min(ans[i], INF);
for (int ii = 0; ii < 2; ii++) {
constexpr ll INFL = 1e18;
vector<ll> dist(N, INFL);
minheap<pair<ll, int>> heap;
rep(i, N) if (color[i] == ii) {
dist[i] = 0;
heap.emplace(0, i);
}
while (not heap.empty()) {
ll d;
int u;
tie(d, u) = heap.top();
heap.pop();
if (d > dist[u])
continue;
for (int i : G[u]) {
int v = U[i] ^ V[i] ^ u;
if (dist[v] > dist[u] + ans[i]) {
dist[v] = dist[u] + ans[i];
heap.emplace(dist[v], v);
}
}
}
rep(i, N) if (color[i] == 1 - ii and dist[i] != D[i]) {
cout << -1 << endl;
return 0;
}
}
rep(i, N) cout << (color[i] ? 'B' : 'W');
cout << endl;
rep(i, M) { cout << ans[i] << '\n'; }
} | replace | 25 | 26 | 25 | 26 | 0 | |
p02799 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fo(i, a, b) for (int i = (a); i <= (b); ++i)
#define rv(i, a, b) for (int i = (a); i >= (b); --i)
#define P pair<int, int>
#define pb push_back
#define lb(x) (x & (-x))
#define ALL(x) x.begin(), x.end()
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long LL;
const int M = 120000;
const int inf = 1e9;
int c[M] = {0};
P p[M];
vector<P> g[M];
int n, m, k;
int dd[M];
char s[M];
bool ok(int i) { return s[i] == 'W' || s[i] == 'B'; }
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
int u, v;
fo(i, 1, n) {
cin >> p[i].first;
dd[i] = p[i].first;
p[i].second = i;
}
sort(p + 1, p + 1 + n);
fo(i, 1, m) {
cin >> u >> v;
g[u].push_back({v, i});
g[v].push_back({u, i});
}
int flag = 1;
fo(i, 1, n) {
int id = p[i].second;
if (ok(id))
continue;
int d = p[i].first;
bool done = 0;
for (P to : g[id]) {
if (ok(to.first)) {
c[to.second] = d;
s[id] = (s[to.first] == 'W' ? 'B' : 'W');
done = 1;
break;
}
}
if (!done) {
for (P to : g[id]) {
if (dd[to.first] == d) {
done = 1;
s[id] = 'W';
s[to.first] = 'B';
c[to.second] = d;
}
}
}
if (!done) {
flag = 0;
break;
}
}
if (flag) {
s[n + 1] = '\0';
cout << s + 1 << endl;
fo(i, 1, m) { cout << (c[i] ? c[i] : inf) << endl; }
} else
cout << -1 << endl;
return 0;
}
| #include <bits/stdc++.h>
#define fo(i, a, b) for (int i = (a); i <= (b); ++i)
#define rv(i, a, b) for (int i = (a); i >= (b); --i)
#define P pair<int, int>
#define pb push_back
#define lb(x) (x & (-x))
#define ALL(x) x.begin(), x.end()
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long LL;
const int M = 220000;
const int inf = 1e9;
int c[M] = {0};
P p[M];
vector<P> g[M];
int n, m, k;
int dd[M];
char s[M];
bool ok(int i) { return s[i] == 'W' || s[i] == 'B'; }
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
int u, v;
fo(i, 1, n) {
cin >> p[i].first;
dd[i] = p[i].first;
p[i].second = i;
}
sort(p + 1, p + 1 + n);
fo(i, 1, m) {
cin >> u >> v;
g[u].push_back({v, i});
g[v].push_back({u, i});
}
int flag = 1;
fo(i, 1, n) {
int id = p[i].second;
if (ok(id))
continue;
int d = p[i].first;
bool done = 0;
for (P to : g[id]) {
if (ok(to.first)) {
c[to.second] = d;
s[id] = (s[to.first] == 'W' ? 'B' : 'W');
done = 1;
break;
}
}
if (!done) {
for (P to : g[id]) {
if (dd[to.first] == d) {
done = 1;
s[id] = 'W';
s[to.first] = 'B';
c[to.second] = d;
}
}
}
if (!done) {
flag = 0;
break;
}
}
if (flag) {
s[n + 1] = '\0';
cout << s + 1 << endl;
fo(i, 1, m) { cout << (c[i] ? c[i] : inf) << endl; }
} else
cout << -1 << endl;
return 0;
}
| replace | 10 | 11 | 10 | 11 | 0 | |
p02799 | C++ | Time Limit Exceeded | /**
* author: zjsdut
* created: 2020/01/19 06:10:37
**/
#include <bits/stdc++.h>
using namespace std;
struct fast_ios {
fast_ios() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
};
} fast_ios_;
template <typename A, typename B> bool chkmin(A &a, const B &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template <typename A, typename B> bool chkmax(A &a, const B &b) {
if (b > a) {
a = b;
return true;
}
return false;
}
template <typename T> istream &operator>>(istream &stream, vector<T> &vec) {
for (auto &x : vec)
stream >> x;
return stream;
}
void scan() {}
template <class T, class... Args> void scan(T &a, Args &...rest) {
cin >> a;
scan(rest...);
}
using ll = long long;
using vl = vector<ll>;
using vb = vector<bool>;
using vi = vector<int>;
using pii = pair<int, int>;
template <typename T> using vv = vector<vector<T>>;
#define rng(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define up(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define down(i, b, a) for (int i = int(b); i >= int(a); i--)
#define rep(n) \
for (int _iter_##n = 0, _num_##n = (int)n; _iter_##n < _num_##n; ++_iter_##n)
#define FOR(x, cont) for (const auto &x : cont)
#define For(x, cont) for (auto &x : cont)
#define all(x) begin(x), end(x)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ep emplace
#define SZ(x) (int)(x).size()
#define UNIQ(vec) (vec).erase(unique(all(vec)), end(vec))
#define LB(cont, x) int(lower_bound(all(cont), x) - begin(cont))
#define UB(cont, x) int(upper_bound(all(cont), x) - begin(cont))
template <typename T>
ostream &operator<<(ostream &stream, const vector<T> &vec) {
if (!vec.empty()) {
stream << vec[0];
for (size_t i = 1; i != vec.size(); ++i)
stream << ' ' << vec[i];
}
return stream;
}
template <typename T> void print(const vector<T> &t) { cout << t << '\n'; }
template <typename T> void print(const vector<vector<T>> &t) {
for (const auto &row : t) {
print(row);
}
}
template <typename T> void print(const T &t) { cout << t << ' '; }
template <typename T, typename... Args>
void print(const T &t, const Args &...rest) {
print(t);
print(rest...);
}
template <typename T> void println(const T &t) { cout << t << '\n'; }
template <typename T, typename... Args>
void println(const T &t, const Args &...rest) {
print(t);
println(rest...);
}
// debug code by tourist
string to_string(const string &s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A> string to_string(A v) {
bool first = true;
string res = "{";
for (const auto &x : v) {
if (!first) {
res += ", ";
}
first = false;
res += to_string(x);
}
res += "}";
return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
int main() {
#if defined LOCAL
ifstream in("in.txt");
cin.rdbuf(in.rdbuf());
#endif
// Is it always possible to have one vertex white and the other vertices
// black?
// consider the case when the given graph is a tree.
int n, m;
scan(n, m);
vv<pii> g(n);
vi d(n);
scan(d);
rng(i, 0, m) {
int u, v;
scan(u, v);
--u;
--v;
g[u].eb(v, i);
g[v].eb(u, i);
}
map<int, vi> group;
vi c(m);
rng(i, 0, n) { group[d[i]].pb(i); }
vi color(n);
function<void(int, int)> dfs = [&](int u, int val) {
for (auto e : g[u]) {
if (!color[e.first] && d[e.first] == val) {
color[e.first] = -color[u];
dfs(e.first, val);
}
}
};
FOR(p, group) {
FOR(u, p.second) {
if (!color[u]) {
FOR(e, g[u]) {
if (color[e.first]) {
dfs(e.first, p.first);
break;
}
}
}
}
FOR(u, p.second) {
if (!color[u]) {
FOR(e, g[u]) {
if (d[e.first] == p.first) {
color[u] = 1;
dfs(u, p.first);
break;
}
}
if (!color[u]) {
debug(u, d[u]);
println(-1);
return 0;
}
}
}
FOR(u, p.second) {
FOR(e, g[u]) {
if (color[e.first]) {
c[e.second] = p.first;
}
}
}
}
FOR(x, color) { cout << (x == -1 ? 'B' : 'W'); }
cout << '\n';
FOR(x, c) { println(x); }
return 0;
} | /**
* author: zjsdut
* created: 2020/01/19 06:10:37
**/
#include <bits/stdc++.h>
using namespace std;
struct fast_ios {
fast_ios() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
};
} fast_ios_;
template <typename A, typename B> bool chkmin(A &a, const B &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template <typename A, typename B> bool chkmax(A &a, const B &b) {
if (b > a) {
a = b;
return true;
}
return false;
}
template <typename T> istream &operator>>(istream &stream, vector<T> &vec) {
for (auto &x : vec)
stream >> x;
return stream;
}
void scan() {}
template <class T, class... Args> void scan(T &a, Args &...rest) {
cin >> a;
scan(rest...);
}
using ll = long long;
using vl = vector<ll>;
using vb = vector<bool>;
using vi = vector<int>;
using pii = pair<int, int>;
template <typename T> using vv = vector<vector<T>>;
#define rng(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define up(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define down(i, b, a) for (int i = int(b); i >= int(a); i--)
#define rep(n) \
for (int _iter_##n = 0, _num_##n = (int)n; _iter_##n < _num_##n; ++_iter_##n)
#define FOR(x, cont) for (const auto &x : cont)
#define For(x, cont) for (auto &x : cont)
#define all(x) begin(x), end(x)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ep emplace
#define SZ(x) (int)(x).size()
#define UNIQ(vec) (vec).erase(unique(all(vec)), end(vec))
#define LB(cont, x) int(lower_bound(all(cont), x) - begin(cont))
#define UB(cont, x) int(upper_bound(all(cont), x) - begin(cont))
template <typename T>
ostream &operator<<(ostream &stream, const vector<T> &vec) {
if (!vec.empty()) {
stream << vec[0];
for (size_t i = 1; i != vec.size(); ++i)
stream << ' ' << vec[i];
}
return stream;
}
template <typename T> void print(const vector<T> &t) { cout << t << '\n'; }
template <typename T> void print(const vector<vector<T>> &t) {
for (const auto &row : t) {
print(row);
}
}
template <typename T> void print(const T &t) { cout << t << ' '; }
template <typename T, typename... Args>
void print(const T &t, const Args &...rest) {
print(t);
print(rest...);
}
template <typename T> void println(const T &t) { cout << t << '\n'; }
template <typename T, typename... Args>
void println(const T &t, const Args &...rest) {
print(t);
println(rest...);
}
// debug code by tourist
string to_string(const string &s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A> string to_string(A v) {
bool first = true;
string res = "{";
for (const auto &x : v) {
if (!first) {
res += ", ";
}
first = false;
res += to_string(x);
}
res += "}";
return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
int main() {
#if defined LOCAL
ifstream in("in.txt");
cin.rdbuf(in.rdbuf());
#endif
// Is it always possible to have one vertex white and the other vertices
// black?
// consider the case when the given graph is a tree.
int n, m;
scan(n, m);
vv<pii> g(n);
vi d(n);
scan(d);
rng(i, 0, m) {
int u, v;
scan(u, v);
--u;
--v;
g[u].eb(v, i);
g[v].eb(u, i);
}
map<int, vi> group;
vi c(m);
rng(i, 0, n) { group[d[i]].pb(i); }
vi color(n);
function<void(int, int)> dfs = [&](int u, int val) {
for (auto e : g[u]) {
if (!color[e.first] && d[e.first] == val) {
color[e.first] = -color[u];
dfs(e.first, val);
}
}
};
FOR(p, group) {
FOR(u, p.second) {
if (!color[u]) {
FOR(e, g[u]) {
if (color[e.first]) {
color[u] = -color[e.first];
dfs(u, p.first);
break;
}
}
}
}
FOR(u, p.second) {
if (!color[u]) {
FOR(e, g[u]) {
if (d[e.first] == p.first) {
color[u] = 1;
dfs(u, p.first);
break;
}
}
if (!color[u]) {
debug(u, d[u]);
println(-1);
return 0;
}
}
}
FOR(u, p.second) {
FOR(e, g[u]) {
if (color[e.first]) {
c[e.second] = p.first;
}
}
}
}
FOR(x, color) { cout << (x == -1 ? 'B' : 'W'); }
cout << '\n';
FOR(x, c) { println(x); }
return 0;
} | replace | 177 | 178 | 177 | 179 | TLE | |
p02799 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fo(i, a, b) for ((i) = (a); i <= (b); i++)
#define rfo(i, a, b) for ((i) = (a); i >= (b); i--)
#define inrange(x, y, z) (((x) >= (y)) && ((x) <= (z)))
#define ALL(vec) ((vec).begin(), (vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)), (vec).end())
using namespace std;
int n, m, uu, vv, d[100100], c[200100], co[100100];
vector<int> ga[100100];
vector<pair<int, int>> cand[100100];
pair<int, int> nxt[100100];
void search(int u) {
int v = nxt[u].first;
if (!co[v])
search(v);
co[u] = 3 - co[v];
c[nxt[u].second] = d[u];
}
int main() {
#ifdef FILIN
#ifndef DavidDesktop
freopen(FILIN, "r", stdin);
freopen(FILOUT, "w", stdout);
#endif
#endif
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> d[i];
for (int i = 1; i <= m; i++) {
cin >> uu >> vv;
ga[uu].push_back(vv);
ga[vv].push_back(uu);
if (d[uu] >= d[vv])
cand[uu].push_back(make_pair(vv, i));
if (d[vv] >= d[uu])
cand[vv].push_back(make_pair(uu, i));
}
for (int i = 1; i <= n; i++) {
if (cand[i].size() == 0) {
cout << -1 << endl;
return 0;
}
nxt[i] = cand[i][0];
}
for (int i = 1; i <= n; i++) {
int j = nxt[i].first;
if (nxt[j].first == i) {
c[nxt[i].second] = d[i];
co[i] = 1;
co[j] = 2;
}
search(i);
}
for (int i = 1; i <= n; i++) {
if (co[i] == 1)
cout << "W";
else
cout << "B";
}
cout << endl;
for (int i = 1; i <= m; i++) {
if (!c[i])
c[i] = 1e9;
cout << c[i] << endl;
}
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
#define fo(i, a, b) for ((i) = (a); i <= (b); i++)
#define rfo(i, a, b) for ((i) = (a); i >= (b); i--)
#define inrange(x, y, z) (((x) >= (y)) && ((x) <= (z)))
#define ALL(vec) ((vec).begin(), (vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)), (vec).end())
using namespace std;
int n, m, uu, vv, d[100100], c[200100], co[100100];
vector<int> ga[100100];
vector<pair<int, int>> cand[100100];
pair<int, int> nxt[100100];
void search(int u) {
int v = nxt[u].first;
if (!co[v])
search(v);
co[u] = 3 - co[v];
c[nxt[u].second] = d[u];
}
int main() {
#ifdef FILIN
#ifndef DavidDesktop
freopen(FILIN, "r", stdin);
freopen(FILOUT, "w", stdout);
#endif
#endif
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> d[i];
for (int i = 1; i <= m; i++) {
cin >> uu >> vv;
ga[uu].push_back(vv);
ga[vv].push_back(uu);
if (d[uu] >= d[vv])
cand[uu].push_back(make_pair(vv, i));
if (d[vv] >= d[uu])
cand[vv].push_back(make_pair(uu, i));
}
for (int i = 1; i <= n; i++) {
if (cand[i].size() == 0) {
cout << -1 << endl;
return 0;
}
nxt[i] = cand[i][0];
}
for (int i = 1; i <= n; i++) {
int j = nxt[i].first;
if (nxt[j].first == i) {
c[nxt[i].second] = d[i];
co[i] = 1;
co[j] = 2;
}
}
for (int i = 1; i <= n; i++) {
if (!co[i]) {
search(i);
}
}
for (int i = 1; i <= n; i++) {
if (co[i] == 1)
cout << "W";
else
cout << "B";
}
cout << endl;
for (int i = 1; i <= m; i++) {
if (!c[i])
c[i] = 1e9;
cout << c[i] << endl;
}
cout << endl;
return 0;
}
| replace | 55 | 56 | 55 | 60 | 0 | |
p02799 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
const int N = 100005, INF = 1000000000;
int n, m;
int d[N];
vector<pair<int, int>> a[N];
char c[N];
int ans[N];
void dfs(int x) {
for (int i = 0; i < a[x].size(); ++i) {
int h = a[x][i].first;
if (!c[h]) {
if (d[h] > d[x]) {
c[h] = c[x];
ans[a[x][i].second] = d[h] - d[x];
dfs(h);
}
}
}
}
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++i)
scanf("%d", &d[i]);
for (int i = 0; i < m; ++i) {
int x, y;
scanf("%d%d", &x, &y);
a[x].push_back(m_p(y, i));
a[y].push_back(m_p(x, i));
ans[i] = INF;
if (d[x] == d[y]) {
if (!c[x] && !c[y]) {
c[x] = 'W';
c[y] = 'B';
ans[i] = d[x];
} else if (!c[y]) {
if (c[x] == 'W')
c[y] = 'B';
else
c[y] = 'W';
ans[i] = d[x];
} else if (!c[x]) {
if (c[y] == 'W')
c[x] = 'B';
else
c[x] = 'W';
ans[i] = d[x];
}
}
}
for (int i = 1; i <= n; ++i) {
if (c[i])
dfs(i);
}
for (int i = 1; i <= n; ++i) {
if (!c[i]) {
printf("-1\n");
return 0;
}
}
for (int i = 1; i <= n; ++i)
printf("%c", c[i]);
printf("\n");
for (int i = 0; i < m; ++i)
printf("%d\n", ans[i]);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
const int N = 200005, INF = 1000000000;
int n, m;
int d[N];
vector<pair<int, int>> a[N];
char c[N];
int ans[N];
void dfs(int x) {
for (int i = 0; i < a[x].size(); ++i) {
int h = a[x][i].first;
if (!c[h]) {
if (d[h] > d[x]) {
c[h] = c[x];
ans[a[x][i].second] = d[h] - d[x];
dfs(h);
}
}
}
}
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++i)
scanf("%d", &d[i]);
for (int i = 0; i < m; ++i) {
int x, y;
scanf("%d%d", &x, &y);
a[x].push_back(m_p(y, i));
a[y].push_back(m_p(x, i));
ans[i] = INF;
if (d[x] == d[y]) {
if (!c[x] && !c[y]) {
c[x] = 'W';
c[y] = 'B';
ans[i] = d[x];
} else if (!c[y]) {
if (c[x] == 'W')
c[y] = 'B';
else
c[y] = 'W';
ans[i] = d[x];
} else if (!c[x]) {
if (c[y] == 'W')
c[x] = 'B';
else
c[x] = 'W';
ans[i] = d[x];
}
}
}
for (int i = 1; i <= n; ++i) {
if (c[i])
dfs(i);
}
for (int i = 1; i <= n; ++i) {
if (!c[i]) {
printf("-1\n");
return 0;
}
}
for (int i = 1; i <= n; ++i)
printf("%c", c[i]);
printf("\n");
for (int i = 0; i < m; ++i)
printf("%d\n", ans[i]);
return 0;
}
| replace | 3 | 4 | 3 | 4 | 0 | |
p02799 | C++ | Runtime Error | #include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int n, m;
int d[100005];
vector<P> G[100005];
int u[100005], v[100005];
int res[200005];
int col[100005];
int mini;
P p[100005];
bool check() {
for (int i = 0; i < n; i++) {
p[i] = P(d[i], i);
}
sort(p, p + n);
for (int i = 0; i < n; i++) {
int v = p[i].second;
if (col[v] != 0) {
continue;
}
// printf("check%d\n",v);
bool flag = false;
for (int j = 0; j < G[v].size(); j++) {
int nv = G[v][j].first;
if (d[v] == d[nv]) {
res[G[v][j].second] = d[v];
if (col[nv] != 0) {
col[v] = -col[nv];
flag = true;
break;
} else {
col[v] = 1;
col[nv] = -1;
flag = true;
break;
}
} else if (d[v] > d[nv]) {
res[G[v][j].second] = d[v];
col[v] = -col[nv];
flag = true;
break;
}
}
if (!flag) {
return false;
}
}
return true;
}
int main(void) {
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d", &d[i]);
}
for (int i = 0; i < m; i++) {
scanf("%d%d", &u[i], &v[i]);
u[i]--;
v[i]--;
G[u[i]].push_back(P(v[i], i));
G[v[i]].push_back(P(u[i], i));
}
mini = d[0];
for (int i = 0; i < n; i++) {
mini = min(mini, d[i]);
}
if (!check()) {
printf("-1\n");
return 0;
}
for (int i = 0; i < m; i++) {
if (res[i] == 0) {
res[i] = 1000000000;
}
}
for (int i = 0; i < n; i++) {
printf("%c", col[i] == 1 ? 'B' : 'W');
}
printf("\n");
for (int i = 0; i < m; i++) {
printf("%d\n", res[i]);
}
return 0;
}
| #include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int n, m;
int d[100005];
vector<P> G[100005];
int u[200005], v[200005];
int res[200005];
int col[100005];
int mini;
P p[100005];
bool check() {
for (int i = 0; i < n; i++) {
p[i] = P(d[i], i);
}
sort(p, p + n);
for (int i = 0; i < n; i++) {
int v = p[i].second;
if (col[v] != 0) {
continue;
}
// printf("check%d\n",v);
bool flag = false;
for (int j = 0; j < G[v].size(); j++) {
int nv = G[v][j].first;
if (d[v] == d[nv]) {
res[G[v][j].second] = d[v];
if (col[nv] != 0) {
col[v] = -col[nv];
flag = true;
break;
} else {
col[v] = 1;
col[nv] = -1;
flag = true;
break;
}
} else if (d[v] > d[nv]) {
res[G[v][j].second] = d[v];
col[v] = -col[nv];
flag = true;
break;
}
}
if (!flag) {
return false;
}
}
return true;
}
int main(void) {
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d", &d[i]);
}
for (int i = 0; i < m; i++) {
scanf("%d%d", &u[i], &v[i]);
u[i]--;
v[i]--;
G[u[i]].push_back(P(v[i], i));
G[v[i]].push_back(P(u[i], i));
}
mini = d[0];
for (int i = 0; i < n; i++) {
mini = min(mini, d[i]);
}
if (!check()) {
printf("-1\n");
return 0;
}
for (int i = 0; i < m; i++) {
if (res[i] == 0) {
res[i] = 1000000000;
}
}
for (int i = 0; i < n; i++) {
printf("%c", col[i] == 1 ? 'B' : 'W');
}
printf("\n");
for (int i = 0; i < m; i++) {
printf("%d\n", res[i]);
}
return 0;
}
| replace | 9 | 10 | 9 | 10 | 0 | |
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
void solve() {
int n, m;
cin >> n >> m;
// pair--------------->penalty,mark if ac
vector<pair<ll, bool>> answer(n + 1);
for (int i = 0; i < m; i++) {
int p;
string s;
cin >> p >> s;
p--;
if (answer[p].second == true) {
continue;
} else {
if (s == "WA") {
answer[p].first++;
} else {
answer[p].second = true;
}
}
}
int ac = 0;
ll penalty = 0;
for (int i = 0; i < n; i++) {
if (answer[i].second == true) {
ac++;
}
penalty += answer[i].first;
}
cout << ac << " " << penalty;
}
int main() {
int y;
y = 1;
// cin>>y ;
while (y--) {
solve();
}
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
void solve() {
char c;
cin >> c;
cout << char(c + 1);
}
int main() {
int y;
y = 1;
// cin>>y ;
while (y--) {
solve();
}
} | replace | 7 | 46 | 7 | 10 | -11 | |
p02801 | C++ | Runtime Error | #pragma GCC optimize("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define all(c) (c).begin(), (c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(), (c).rend()
#define ifr(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m, n, r) \
m.reserve(n); \
m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os \
tree<int, null_type, less<int>, rb_tree_tag, \
tree_order_statistics_node_update>
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd() { return 0ll; }
template <typename T, typename... Args> T gcd(T a, Args... args) {
return __gcd(a, (__typeof(a))gcd(args...));
}
typedef map<ll, ll> mll;
typedef map<string, ll> msll;
typedef unordered_map<ll, ll> umap;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mod 1000000007
#define N 100001
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
char ch;
cin >> ch;
ch++;
cout << ch;
return 0;
} | #pragma GCC optimize("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define all(c) (c).begin(), (c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(), (c).rend()
#define ifr(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m, n, r) \
m.reserve(n); \
m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os \
tree<int, null_type, less<int>, rb_tree_tag, \
tree_order_statistics_node_update>
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd() { return 0ll; }
template <typename T, typename... Args> T gcd(T a, Args... args) {
return __gcd(a, (__typeof(a))gcd(args...));
}
typedef map<ll, ll> mll;
typedef map<string, ll> msll;
typedef unordered_map<ll, ll> umap;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mod 1000000007
#define N 100001
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
char ch;
cin >> ch;
ch++;
cout << ch;
return 0;
} | replace | 52 | 55 | 52 | 53 | 0 | |
p02801 | C++ | Runtime Error | #pragma GCC optimize( \
"Ofast") // Comment optimisations for an interative problem/use endl
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef unordered_map<ll, ll> um;
#define fastio \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0); \
cout << fixed; \
cout << setprecision(10);
#define sqr(x) ((ll)(x) * (x))
#define reset(a, b) memset(a, b, sizeof(a))
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define alla(arr, sz) arr, arr + sz
#define showv(v) \
for (auto it : (v)) \
cout << it << " "; \
newl;
#define newl cout << "\n"
const ll MAXN = 1e+2 + 7;
const ll MOD = 1e+9 + 7, INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
double EPS = 1e-9;
double PI = acos(-1);
vll adj[MAXN];
ll visit[MAXN] = {};
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1},
dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
//<<-----Declare Variable Here------->>//
ll t, n;
ll i, j;
//<<-----Implement Functions Here---->>//
//<<-----Start of Main--------------->>//
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
fastio;
char c;
cin >> c;
cout << char(c + 1);
} | #pragma GCC optimize( \
"Ofast") // Comment optimisations for an interative problem/use endl
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef unordered_map<ll, ll> um;
#define fastio \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0); \
cout << fixed; \
cout << setprecision(10);
#define sqr(x) ((ll)(x) * (x))
#define reset(a, b) memset(a, b, sizeof(a))
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define alla(arr, sz) arr, arr + sz
#define showv(v) \
for (auto it : (v)) \
cout << it << " "; \
newl;
#define newl cout << "\n"
const ll MAXN = 1e+2 + 7;
const ll MOD = 1e+9 + 7, INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
double EPS = 1e-9;
double PI = acos(-1);
vll adj[MAXN];
ll visit[MAXN] = {};
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1},
dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
//<<-----Declare Variable Here------->>//
ll t, n;
ll i, j;
//<<-----Implement Functions Here---->>//
//<<-----Start of Main--------------->>//
int main() {
fastio;
char c;
cin >> c;
cout << char(c + 1);
} | delete | 57 | 61 | 57 | 57 | 0 | |
p02801 | C++ | Runtime Error | #include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
string c;
cin >> c;
vector<string> p;
p.push_back("a");
p.push_back("b");
p.push_back("c");
p.push_back("d");
p.push_back("e");
p.push_back("f");
p.push_back("g");
p.push_back("h");
p.push_back("j");
p.push_back("k");
p.push_back("l");
p.push_back("m");
p.push_back("n");
p.push_back("o");
p.push_back("p");
p.push_back("q");
p.push_back("r");
p.push_back("s");
p.push_back("t");
p.push_back("u");
p.push_back("v");
p.push_back("w");
p.push_back("x");
p.push_back("y");
p.push_back("z");
rep(i, 26) {
if (p[i] == c) {
p[0] = p[i + 1];
}
}
cout << p[0] << endl;
return 0;
} | #include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
string c;
cin >> c;
vector<string> p;
p.push_back("a");
p.push_back("b");
p.push_back("c");
p.push_back("d");
p.push_back("e");
p.push_back("f");
p.push_back("g");
p.push_back("h");
p.push_back("j");
p.push_back("k");
p.push_back("l");
p.push_back("m");
p.push_back("n");
p.push_back("o");
p.push_back("p");
p.push_back("q");
p.push_back("r");
p.push_back("s");
p.push_back("t");
p.push_back("u");
p.push_back("v");
p.push_back("w");
p.push_back("x");
p.push_back("y");
p.push_back("z");
rep(i, 26) {
if (p[i] == c) {
p[0] = p[i + 1];
break;
}
}
cout << p[0] << endl;
return 0;
} | insert | 39 | 39 | 39 | 40 | 0 | |
p02801 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
char C;
do {
cin >> C;
} while (C != 'z');
cout << C + 1 << endl;
return 0;
} | #include <iostream>
using namespace std;
int main() {
char C;
do {
cin >> C;
} while (C == 'z');
cout << char(C + 1) << endl;
return 0;
} | replace | 6 | 8 | 6 | 8 | TLE | |
p02801 | Python | Runtime Error | c = input()
txt = "abcdefghijklmnopqrstuvwxyz"
for i in range(27):
if txt[i] == c:
print(txt[i + 1])
| c = input()
txt = "abcdefghijklmnopqrstuvwxyz"
for i in range(26):
if txt[i] == c:
print(txt[i + 1])
| replace | 3 | 5 | 3 | 4 | IndexError: string index out of range | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02801/Python/s227649373.py", line 6, in <module>
if txt[i] == c:
IndexError: string index out of range
|
p02801 | Python | Runtime Error | import string
AL = string.lowercase
C = input()
idx = AL.find(C)
idy = (idx + 1) % 26
print(AL[idy])
| import string
AL = string.ascii_lowercase
C = input()
idx = AL.find(C)
idy = (idx + 1) % 26
print(AL[idy])
| replace | 2 | 3 | 2 | 3 | AttributeError: module 'string' has no attribute 'lowercase' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02801/Python/s068085135.py", line 3, in <module>
AL = string.lowercase
AttributeError: module 'string' has no attribute 'lowercase'
|
p02801 | Python | Runtime Error | import sys
args = sys.argv
a = "abcdefghijklmnopqrstuvwxyz"
c = args[1]
idx = a.index(c)
print(a[idx + 1])
| import sys
args = sys.argv
a = "abcdefghijklmnopqrstuvwxyz"
c = input()
idx = a.index(c)
print(a[idx + 1])
| replace | 6 | 7 | 6 | 7 | IndexError: list index out of range | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02801/Python/s556171083.py", line 7, in <module>
c = args[1]
IndexError: list index out of range
|
p02801 | C++ | Runtime Error | // Goodbye stupid girls & Hello L0u1Za, Codeforces and my friends(nobody)
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
// #include <Windows.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
template <class T> using pt = std::pair<T, T>;
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#else
#endif
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
char c;
cin >> c;
cout << char(c + 1);
return 0;
} | // Goodbye stupid girls & Hello L0u1Za, Codeforces and my friends(nobody)
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
// #include <Windows.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
template <class T> using pt = std::pair<T, T>;
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#else
#endif
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
char c;
cin >> c;
cout << char(c + 1);
return 0;
} | replace | 33 | 34 | 33 | 34 | 0 | |
p02801 | C++ | Runtime Error | #include <stdio.h>
int main() {
char c;
scanf("%[^z]", &c);
printf("%c", c + 1);
return 0;
} | #include <stdio.h>
int main() {
char c;
scanf("%c", &c);
printf("%c\n", c + 1);
return 0;
}
| replace | 4 | 6 | 4 | 6 | -6 | *** stack smashing detected ***: terminated
|
p02801 | C++ | Runtime Error | // verma_ankit484
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n"
#define pb push_back
const ll mod = (ll)1e9 + 7;
using namespace std;
// using namespace __gnu_pbds;
// #define ordered_set tree<ll, null_type,less<ll>,
// rb_tree_tag,tree_order_statistics_node_update>
int main() {
IOS
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
char ch;
cin >> ch;
ch++;
cout << ch << endl;
return 0;
}
| // verma_ankit484
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n"
#define pb push_back
const ll mod = (ll)1e9 + 7;
using namespace std;
// using namespace __gnu_pbds;
// #define ordered_set tree<ll, null_type,less<ll>,
// rb_tree_tag,tree_order_statistics_node_update>
int main() {
char ch;
cin >> ch;
ch++;
cout << ch << endl;
return 0;
}
| delete | 22 | 26 | 22 | 22 | 0 | |
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
freopen("input.txt", "r", stdin);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
char a;
cin >> a;
cout << char(a + 1);
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
// freopen("input.txt","r",stdin);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
char a;
cin >> a;
cout << char(a + 1);
} | replace | 4 | 5 | 4 | 5 | 0 | |
p02801 | Python | Runtime Error | import sys
input = sys.stdin.readline
alphabets = "abcdefghijklmnopqrstuvwxyz"
c = input()
i = alphabets.index(c)
answer = alphabets[i + 1]
print(answer)
| import sys
input = sys.stdin.readline
alphabets = "abcdefghijklmnopqrstuvwxyz"
c = input().strip()
i = alphabets.index(c)
answer = alphabets[i + 1]
print(answer)
| replace | 7 | 8 | 7 | 8 | ValueError: substring not found | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02801/Python/s836022854.py", line 8, in <module>
i = alphabets.index(c)
ValueError: substring not found
|
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string c = "abcdefghijklmnopqrstuvwxyz";
char i;
cin >> i;
cout << c.at(i++) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
char c;
cin >> c;
c++;
cout << c << endl;
}
| replace | 4 | 8 | 4 | 8 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at: __n (which is 97) >= this->size() (which is 26)
|
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main() {
char z;
cin >> z;
printf("%s\n", z + 1);
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main() {
char z;
cin >> z;
z++;
cout << z << endl;
}
| replace | 9 | 10 | 9 | 11 | -11 | |
p02801 | C++ | Time Limit Exceeded | /* author: Tarek */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n;
cin >> n;
int r = 1;
int a, b, c, d;
cin >> a >> b >> c >> d;
int sum = a + b + c + d;
int g = n - 1;
while (g--) {
int m, h, j, k;
cin >> m >> h >> j >> k;
int mount = m + j + k + h;
if (mount > sum)
r++;
}
cout << r << endl;
return 0;
}
| /* author: Tarek */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
char a;
cin >> a;
int k = (int)a;
k += 1;
cout << (char)k << endl;
return 0;
}
| replace | 12 | 27 | 12 | 17 | TLE | |
p02801 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
char a;
cin >> a;
cout << char(a + 1);
return 1;
} | #include <iostream>
using namespace std;
int main() {
char a;
cin >> a;
cout << char(a + 1);
return 0;
} | replace | 6 | 7 | 6 | 7 | 1 | |
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
typedef long double ld;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 3;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define lb lower_bound
#define ub upper_bound
#define fact(n) rep(i, 1, n + 1) ft.pb((ft[i - 1] * i) % mod);
#define mod_in(a) exp(a, mod - 2)
#define ncr(n, r) ((ft[n] * mod_in((ft[r] * ft[(n) - (r)]) % mod)) % mod)
#define deb(x) cout << #x << " " << x << endl;
#define flash \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl '\n'
ll prime[100000];
ll exp(ll a, ll b);
void sieve(ll n);
ll gcd(ll a, ll b);
ll countdigit(ll n);
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
flash char s;
cin >> s;
cout << (char)(s + 1);
}
//
//
//
//
//
// IMPORTANT FUNCTIONS
ll exp(ll a, ll b) {
int res = 1;
while (b) {
if (b & 1)
res = (res * a) % mod;
a = (a * a) % mod;
b >>= 1;
}
return res;
}
ll gcd(ll a, ll b) {
if (a == 0)
return b;
return gcd(b % a, a);
}
void sieve(ll n) {
for (ll i = 0; i <= n; i++) {
prime[i] = 1;
}
prime[0] = 0;
prime[1] = 0;
for (ll i = 2; i <= n; i++) {
if (prime[i] == 1) {
for (ll j = 2; i * j <= n; j++) {
prime[i * j] = 0;
}
}
}
}
ll countdigit(ll n) { return floor(log10(n) + 1); }
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
typedef long double ld;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 3;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define lb lower_bound
#define ub upper_bound
#define fact(n) rep(i, 1, n + 1) ft.pb((ft[i - 1] * i) % mod);
#define mod_in(a) exp(a, mod - 2)
#define ncr(n, r) ((ft[n] * mod_in((ft[r] * ft[(n) - (r)]) % mod)) % mod)
#define deb(x) cout << #x << " " << x << endl;
#define flash \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl '\n'
ll prime[100000];
ll exp(ll a, ll b);
void sieve(ll n);
ll gcd(ll a, ll b);
ll countdigit(ll n);
int main() {
flash char s;
cin >> s;
cout << (char)(s + 1);
}
//
//
//
//
//
// IMPORTANT FUNCTIONS
ll exp(ll a, ll b) {
int res = 1;
while (b) {
if (b & 1)
res = (res * a) % mod;
a = (a * a) % mod;
b >>= 1;
}
return res;
}
ll gcd(ll a, ll b) {
if (a == 0)
return b;
return gcd(b % a, a);
}
void sieve(ll n) {
for (ll i = 0; i <= n; i++) {
prime[i] = 1;
}
prime[0] = 0;
prime[1] = 0;
for (ll i = 2; i <= n; i++) {
if (prime[i] == 1) {
for (ll j = 2; i * j <= n; j++) {
prime[i * j] = 0;
}
}
}
}
ll countdigit(ll n) { return floor(log10(n) + 1); }
| replace | 34 | 38 | 34 | 35 | 0 | |
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fastio() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define show(x) cout << (#x) << " : " << x << endl;
#define ll long long
#define ld long double
#define fill(a, val) memset(a, val, sizeof(a))
#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll, ll>
#define sq(x) ((x) * (x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define endl "\n"
#define int long long
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const ll N = 1000 * 100 + 5;
const ll N2 = 2000 * 1000 * 10;
const ld PI = 3.14159265;
ll gcd(ll a, ll b) {
if (!b)
return a;
return gcd(b, a % b);
}
ll power(ll x, ll y, ll p = INF) {
ll res = 1;
x %= p;
while (y > 0) {
if (y & 1)
res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
signed main() {
fastio();
// cout<<fixed<<setprecision(20);
// CHECK for LONG LONG and LONG DOUBLE
//*comment for all except cc/cf
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif //*/
char c;
cin >> c;
int dum = c;
dum++;
cout << char(dum);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define fastio() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define show(x) cout << (#x) << " : " << x << endl;
#define ll long long
#define ld long double
#define fill(a, val) memset(a, val, sizeof(a))
#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll, ll>
#define sq(x) ((x) * (x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define endl "\n"
#define int long long
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const ll N = 1000 * 100 + 5;
const ll N2 = 2000 * 1000 * 10;
const ld PI = 3.14159265;
ll gcd(ll a, ll b) {
if (!b)
return a;
return gcd(b, a % b);
}
ll power(ll x, ll y, ll p = INF) {
ll res = 1;
x %= p;
while (y > 0) {
if (y & 1)
res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
signed main() {
fastio();
// cout<<fixed<<setprecision(20);
// CHECK for LONG LONG and LONG DOUBLE
/*comment for all except cc/cf
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif//*/
char c;
cin >> c;
int dum = c;
dum++;
cout << char(dum);
return 0;
} | replace | 44 | 51 | 44 | 51 | 0 | |
p02801 | C++ | Runtime Error | #include <stdio.h>
int main() {
char c;
int i;
scanf("%c", &c);
i = ((int)c) + 1;
printf("%c", i);
return 1;
} | #include <stdio.h>
int main() {
char a;
scanf("%c", &a);
printf("%c\n", a + 1);
} | replace | 2 | 8 | 2 | 5 | 1 | |
p02801 | Python | Runtime Error | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
# import itertools
# import math
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
H = readline().decode("utf8")
print(chr(ord(H) + 1))
| """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
# import itertools
# import math
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
H = readline().decode("utf8").strip()
print(chr(ord(H) + 1))
| replace | 16 | 17 | 16 | 17 | TypeError: ord() expected a character, but string of length 2 found | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02801/Python/s126986197.py", line 18, in <module>
print(chr(ord(H) + 1))
TypeError: ord() expected a character, but string of length 2 found
|
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
char C;
cin >> C;
string str = "abcdefghijklmnopqrstuvwxy";
for (int i = 0; i < 26; i++) {
if (C == str.at(i)) {
cout << str.at(i + 1) << endl;
}
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
char C;
cin >> C;
string str = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < 25; i++) {
if (C == str.at(i)) {
cout << str.at(i + 1) << endl;
}
}
}
| replace | 6 | 8 | 6 | 8 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at: __n (which is 25) >= this->size() (which is 25)
|
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string alfa[] = {"a", "b", "c", "d", "e"};
string c;
cin >> c;
int i = 0;
while (i < 25) {
if (alfa[i] == c) {
break;
}
i++;
}
cout << alfa[i + 1] << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
string alfa[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k", "l", "m", "n", "o", "p", "q", "r",
"s", "t", "u", "v", "w", "x", "y", "z"};
string c;
cin >> c;
int i = 0;
while (i < 25) {
if (alfa[i] == c) {
break;
}
i++;
}
cout << alfa[i + 1] << endl;
}
| replace | 4 | 5 | 4 | 7 | 0 | |
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define int long long
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repn(i, a, b) for (int i = a; i >= b; i--)
#define F first
#define S second
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define mod2 998244353
#define pi 3.14159265358979323846
int solve() {
int n;
char c;
cin >> c;
c++;
cout << c;
// cin>>n;
return 0;
}
signed main() {
IOS;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t = 1;
// cin>>t;
while (t--) {
solve();
// if(solve()) cout<<"YES";
// else cout<<"NO";
cout << "\n";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define int long long
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repn(i, a, b) for (int i = a; i >= b; i--)
#define F first
#define S second
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define mod2 998244353
#define pi 3.14159265358979323846
int solve() {
int n;
char c;
cin >> c;
c++;
cout << c;
// cin>>n;
return 0;
}
signed main() {
IOS;
int t = 1;
// cin>>t;
while (t--) {
solve();
// if(solve()) cout<<"YES";
// else cout<<"NO";
cout << "\n";
}
return 0;
}
| delete | 35 | 39 | 35 | 35 | 0 | |
p02801 | C++ | Runtime Error | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin); // for getting input from input.txt
freopen("output.txt", "w", stdout); // for writing output to output.txt
freopen("error.txt", "w", stderr);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
char ch;
cin >> ch;
ch = ch + 1;
cout << ch;
return 0;
}
| #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
char ch;
cin >> ch;
ch = ch + 1;
cout << ch;
return 0;
}
| replace | 23 | 32 | 23 | 24 | 0 | |
p02801 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, m, s;
cin >> n >> k >> m;
vector<int> vec(n - 1);
s = m * n;
for (int i = 0; i < n - 1; i++) {
cin >> vec.at(i);
s -= vec.at(i);
}
if (s >= k)
cout << -1 << endl;
else if (s <= 0)
cout << 0 << endl;
else
cout << s << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
char C;
cin >> C;
cout << (char)(C + 1) << endl;
} | replace | 4 | 19 | 4 | 7 | -6 | terminate called after throwing an instance of 'std::length_error'
what(): cannot create std::vector larger than max_size()
|
p02801 | C++ | Time Limit Exceeded | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
char ch[10];
while (scanf("%s", ch) != 0) {
printf("%c\n", ch[0] + 1);
}
return 0;
}
| #include <cstdio>
#include <iostream>
using namespace std;
int main() {
char ch[10];
scanf("%s", ch);
printf("%c\n", ch[0] + 1);
return 0;
}
| replace | 6 | 9 | 6 | 8 | TLE | |
p02801 | C++ | Runtime Error | /*
__________ |
___ __ | | |
| / | | |
| / | | | __ | /
_______
|_______| _______ _______ |______ ________ /| / | |/
| | | \ | | | | | | | / | / |
|\ | | \ _______| | | |_______ | | _______| |/ |
| \ | | \ | | | | | | | | | | |
| \ |
__| \__| |______| |______| ________| | |_ |_______| | |__| _|
\__ _| .
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long int
#define ld long double
#define vi vector<int>
#define vii vector<pair<int, int>>
#define vvi vector<vector<int>>
#define pf push_front
#define popb pop_back
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define prec(x) fixed << setprecision(15) << x
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define fo0(i, n) for (int i = 0, i##end = n; i < i##end; i++)
#define fo1(i, n) for (int i = 1, i##end = n; i <= i##end; i++)
#define fo(i, a, b) for (int i = a, i##end = b; i <= i##end; i++)
#define foe(i, x) for (__typeof((x).end()) i = (x).begin(); i != (x).end(); ++i)
#define fre(i, x) \
for (__typeof((x).rend()) i = (x).rbegin(); i != (x).rend(); ++i)
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define inf 1e18
const int mod = 1e9 + 7;
const int N = 4e5 + 10;
void solve() {
char a;
cin >> a;
int t = (int)a + 1;
cout << (char)t;
}
int32_t main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
fast;
int t = 1;
// cin>>t;
while (t--) {
solve();
}
} | /*
__________ |
___ __ | | |
| / | | |
| / | | | __ | /
_______
|_______| _______ _______ |______ ________ /| / | |/
| | | \ | | | | | | | / | / |
|\ | | \ _______| | | |_______ | | _______| |/ |
| \ | | \ | | | | | | | | | | |
| \ |
__| \__| |______| |______| ________| | |_ |_______| | |__| _|
\__ _| .
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long int
#define ld long double
#define vi vector<int>
#define vii vector<pair<int, int>>
#define vvi vector<vector<int>>
#define pf push_front
#define popb pop_back
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define prec(x) fixed << setprecision(15) << x
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define fo0(i, n) for (int i = 0, i##end = n; i < i##end; i++)
#define fo1(i, n) for (int i = 1, i##end = n; i <= i##end; i++)
#define fo(i, a, b) for (int i = a, i##end = b; i <= i##end; i++)
#define foe(i, x) for (__typeof((x).end()) i = (x).begin(); i != (x).end(); ++i)
#define fre(i, x) \
for (__typeof((x).rend()) i = (x).rbegin(); i != (x).rend(); ++i)
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define inf 1e18
const int mod = 1e9 + 7;
const int N = 4e5 + 10;
void solve() {
char a;
cin >> a;
int t = (int)a + 1;
cout << (char)t;
}
int32_t main() {
fast;
int t = 1;
// cin>>t;
while (t--) {
solve();
}
} | delete | 55 | 59 | 55 | 55 | 0 | |
p02801 | Python | Runtime Error | from collections import deque
import sys
from copy import deepcopy
input = sys.stdin.readline
def bfs(table, i, j):
dq = deque()
if table[i][j] == "#":
return -1
h = len(table)
w = len(table[0])
ans = 0
dq.append((i, j, 0)) # x,y,distance
while dq:
x, y, dis = dq.popleft()
ans = max(ans, dis)
if x > 0 and (x - 1, y) and table[x - 1][y] != "#":
dq.append((x - 1, y, dis + 1))
table[x - 1][y] = "#"
if x < h - 1 and (x + 1, y) and table[x + 1][y] != "#":
dq.append((x + 1, y, dis + 1))
table[x + 1][y] = "#"
if y > 0 and (x, y - 1) and table[x][y - 1] != "#":
dq.append((x, y - 1, dis + 1))
table[x][y - 1] = "#"
if y < w - 1 and (x, y + 1) and table[x][y + 1] != "#":
dq.append((x, y + 1, dis + 1))
table[x][y + 1] = "#"
return ans
def main():
h, w = [int(i) for i in input().strip().split()]
grid = [list(input().strip()) for _ in range(h)]
ans = 0
for i in range(h):
for j in range(w):
if grid[i][j] == ".":
_grid = deepcopy(grid)
max_path = bfs(_grid, i, j)
ans = max(ans, max_path)
print(ans)
if __name__ == "__main__":
main()
| c = input()
print(chr(ord(c) + 1))
| replace | 0 | 49 | 0 | 2 | ValueError: invalid literal for int() with base 10: 'a' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02801/Python/s679156096.py", line 48, in <module>
main()
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02801/Python/s679156096.py", line 34, in main
h, w = [int(i) for i in input().strip().split()]
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02801/Python/s679156096.py", line 34, in <listcomp>
h, w = [int(i) for i in input().strip().split()]
ValueError: invalid literal for int() with base 10: 'a'
|
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) { // 階乗
if (i == 0)
return 1;
return (factorial(i - 1)) * i;
}
int main() {
int n, m;
cin >> n >> m;
vector<pair<int, string>> a(m);
set<int> ac;
vector<int> wa(n);
for (auto p : a)
cin >> p.first >> p.second;
for (auto p : a) {
if (p.second == "AC")
ac.insert(p.first);
else if (!ac.count(p.first))
wa[p.first - 1]++;
else
continue;
}
int pena = 0;
rep(i, n) {
if (ac.count(i + 1))
pena += wa[i];
}
cout << ac.size() << ' ' << pena << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) { // 階乗
if (i == 0)
return 1;
return (factorial(i - 1)) * i;
}
int main() {
int n, m;
cin >> n >> m;
vector<pair<int, string>> a(m);
set<int> ac;
vector<int> wa(n);
for (auto &p : a)
cin >> p.first >> p.second;
for (auto p : a) {
if (p.second == "AC")
ac.insert(p.first);
else if (!ac.count(p.first))
wa[p.first - 1]++;
else
continue;
}
int pena = 0;
rep(i, n) {
if (ac.count(i + 1))
pena += wa[i];
}
cout << ac.size() << ' ' << pena << endl;
} | replace | 17 | 18 | 17 | 18 | -6 | double free or corruption (out)
|
p02802 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define ll long long
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(), a.end()
#define rall(a) (a).rbegin(), (a).rend()
#define mod 1000000007
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define B vector<bool>
#define endl '\n'
using namespace std;
using graph = vector<vector<ll>>;
const ll MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void cominit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// mod. m での a の逆元 a^{-1} を計算する
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// 二項係数計算nCk,n<=10^7,k<=10^7まで
ll com(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 二項係数nCk,n<=10^9,k<=10^7まで
ll com2(ll n, ll k) {
ll res, bs = 1, bb = 1;
for (ll i = 0; i < k; i++) {
bs = (bs * (n - i)) % mod;
bb = (bb * (i + 1)) % mod;
}
res = modinv(bb, mod) % mod;
res = (res * bs) % mod;
return res;
}
// 二項係数計算nPk
ll per(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[n - k] % MOD) % MOD;
}
/* ユークリッドの互除法 最大公約数*/
/*ll gcd(ll a, ll b)
{
return b ? gcd(b, a % b) : a;
}
/*最小公倍数*/
/*
ll lcm(ll a, ll b)
{
return a / gcd(a, b) * b;
}
/*二点間の距離*/
double dist(pair<double, double> a, pair<double, double> b) {
return sqrt(pow((a.first - b.first), 2) + pow((a.second - b.second), 2));
}
// 繰り返し自乗法
double ism(double aa, ll p) {
double ap = aa;
double ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { // 奇数が真
ans *= ap;
}
p /= 2;
ap = ap * ap;
}
return ans;
}
// 繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa, ll p) {
ll ap = aa;
ll ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { // 奇数が真
ans = (ans * ap) % mod;
}
p /= 2;
ap = (ap * ap) % mod;
}
return ans;
}
struct UnionFind {
vector<ll> par;
UnionFind(ll n) : par(n, -1) {}
ll root(ll x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(ll x, ll y) { return root(x) == root(y); }
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) { return -par[root(x)]; }
};
// 小数点12桁
struct all_init {
all_init() { cout << fixed << setprecision(12); }
} All_init;
int main() {
ll n, m, cnt = 0, cnt2 = 0;
cin >> n >> m;
V p(m), y(n, 0);
vector<bool> a(n + 1, false);
vector<string> s(m);
rep(i, 0, m) { cin >> p[i] >> s[i]; }
rep(i, 0, m) {
if (!a[p[i]] && s[i] == "AC") {
cnt++;
cnt2 += y[p[i]];
a[p[i]] = true;
} else if (!a[p[i]] && s[i] == "WA") {
y[p[i]]++;
}
}
cout << cnt << " " << cnt2 << endl;
}
| #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define ll long long
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(), a.end()
#define rall(a) (a).rbegin(), (a).rend()
#define mod 1000000007
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define B vector<bool>
#define endl '\n'
using namespace std;
using graph = vector<vector<ll>>;
const ll MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void cominit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// mod. m での a の逆元 a^{-1} を計算する
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// 二項係数計算nCk,n<=10^7,k<=10^7まで
ll com(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 二項係数nCk,n<=10^9,k<=10^7まで
ll com2(ll n, ll k) {
ll res, bs = 1, bb = 1;
for (ll i = 0; i < k; i++) {
bs = (bs * (n - i)) % mod;
bb = (bb * (i + 1)) % mod;
}
res = modinv(bb, mod) % mod;
res = (res * bs) % mod;
return res;
}
// 二項係数計算nPk
ll per(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[n - k] % MOD) % MOD;
}
/* ユークリッドの互除法 最大公約数*/
/*ll gcd(ll a, ll b)
{
return b ? gcd(b, a % b) : a;
}
/*最小公倍数*/
/*
ll lcm(ll a, ll b)
{
return a / gcd(a, b) * b;
}
/*二点間の距離*/
double dist(pair<double, double> a, pair<double, double> b) {
return sqrt(pow((a.first - b.first), 2) + pow((a.second - b.second), 2));
}
// 繰り返し自乗法
double ism(double aa, ll p) {
double ap = aa;
double ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { // 奇数が真
ans *= ap;
}
p /= 2;
ap = ap * ap;
}
return ans;
}
// 繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa, ll p) {
ll ap = aa;
ll ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { // 奇数が真
ans = (ans * ap) % mod;
}
p /= 2;
ap = (ap * ap) % mod;
}
return ans;
}
struct UnionFind {
vector<ll> par;
UnionFind(ll n) : par(n, -1) {}
ll root(ll x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(ll x, ll y) { return root(x) == root(y); }
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) { return -par[root(x)]; }
};
// 小数点12桁
struct all_init {
all_init() { cout << fixed << setprecision(12); }
} All_init;
int main() {
ll n, m, cnt = 0, cnt2 = 0;
cin >> n >> m;
V p(m), y(n + 1, 0);
vector<bool> a(n + 1, false);
vector<string> s(m);
rep(i, 0, m) { cin >> p[i] >> s[i]; }
rep(i, 0, m) {
if (!a[p[i]] && s[i] == "AC") {
cnt++;
cnt2 += y[p[i]];
a[p[i]] = true;
} else if (!a[p[i]] && s[i] == "WA") {
y[p[i]]++;
}
}
cout << cnt << " " << cnt2 << endl;
}
| replace | 171 | 172 | 171 | 172 | 0 | |
p02802 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define ll long long
using namespace std;
struct all_init {
all_init() { cout << fixed << setprecision(12); }
} All_init;
int main() {
ll n, m, ac = 0, wa = 0;
cin >> n >> m;
vector<bool> b(n + 1, false);
vector<ll> wav(n);
for (ll i = 0; i < m; i++) {
ll p;
string s;
cin >> p >> s;
if (!b[p] && s == "WA") {
wav[p]++;
} else if (!b[p] && s == "AC") {
ac++;
b[p] = true;
}
}
for (ll i = 1; i <= n; i++) {
if (b[i]) {
wa += wav[i];
}
}
cout << ac << " " << wa << endl;
}
| #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define ll long long
using namespace std;
struct all_init {
all_init() { cout << fixed << setprecision(12); }
} All_init;
int main() {
ll n, m, ac = 0, wa = 0;
cin >> n >> m;
vector<bool> b(100001, false);
vector<ll> wav(100001);
for (ll i = 0; i < m; i++) {
ll p;
string s;
cin >> p >> s;
if (!b[p] && s == "WA") {
wav[p]++;
} else if (!b[p] && s == "AC") {
ac++;
b[p] = true;
}
}
for (ll i = 1; i <= n; i++) {
if (b[i]) {
wa += wav[i];
}
}
cout << ac << " " << wa << endl;
}
| replace | 21 | 23 | 21 | 23 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n, m) for (int i = (n); i < (m); i++)
#define rep_d(i, n, m) for (int i = (n)-1; i >= (m); i--)
#define sort_asc(X) sort((X).begin(), (X).end())
#define sort_desc(X) sort((X).begin(), (X).end(), greater<>())
template <class T> bool chmax(T &a, T b);
template <class T> bool chmin(T &a, T b);
int *eratosthenes(int N);
bool bit_search(int pattern, int N);
template <class T> void cumulative_sum(T array, size_t N);
const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
int main(void) {
int N, M;
cin >> N >> M;
vector<pair<int, bool>> vec(M);
rep(i, 0, M) {
int p;
string s;
cin >> p >> s;
if (s == "AC") {
vec[i] = make_pair(p - 1, true);
} else {
vec[i] = make_pair(p - 1, false);
}
}
vector<bool> qs(N, false);
vector<int> cnt_vec(N, 0);
int cnt_ac = 0, cnt_wa = 0;
rep(i, 0, M) {
if (!qs[vec[i].first]) {
if (vec[i].second) {
cnt_ac++;
qs[vec[i].first] = true;
} else {
cnt_vec[vec[i].first]++;
}
}
}
rep(i, 0, M) {
if (qs[vec[i].first])
cnt_wa += cnt_vec[i];
}
cout << cnt_ac << " " << cnt_wa << endl;
}
// 100000 7
// 7777 AC
// 7777 AC
// 7777 AC
// 1 WA
// 1 AC
// 1 AC
// 1 AC
int *eratosthenes(int N) {
int *prime_array = new int[N + 1];
int lim = N;
prime_array[0] = 0;
prime_array[1] = 0;
rep(i, 2, N + 1) { prime_array[i] = 1; }
rep(i, 2, lim) {
if (prime_array[i] == 0)
continue;
lim = N / i;
for (int j = i * 2; j < N + 1; j += i) {
prime_array[j] = 0;
}
}
return prime_array;
}
template <class T> void cumulative_sum(T array, size_t N) {
rep(i, 1, N + 1) { array[i] += array[i - 1]; }
}
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
bool bit_search(int pattern, int N) {
int cnt = 0;
rep(bit, 0, N) {
if (pattern & (1 << bit)) {
cnt++;
}
}
return true;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n, m) for (int i = (n); i < (m); i++)
#define rep_d(i, n, m) for (int i = (n)-1; i >= (m); i--)
#define sort_asc(X) sort((X).begin(), (X).end())
#define sort_desc(X) sort((X).begin(), (X).end(), greater<>())
template <class T> bool chmax(T &a, T b);
template <class T> bool chmin(T &a, T b);
int *eratosthenes(int N);
bool bit_search(int pattern, int N);
template <class T> void cumulative_sum(T array, size_t N);
const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
int main(void) {
int N, M;
cin >> N >> M;
vector<pair<int, bool>> vec(M);
rep(i, 0, M) {
int p;
string s;
cin >> p >> s;
if (s == "AC") {
vec[i] = make_pair(p - 1, true);
} else {
vec[i] = make_pair(p - 1, false);
}
}
vector<bool> qs(N, false);
vector<int> cnt_vec(N, 0);
int cnt_ac = 0, cnt_wa = 0;
rep(i, 0, M) {
if (!qs[vec[i].first]) {
if (vec[i].second) {
cnt_ac++;
qs[vec[i].first] = true;
} else {
cnt_vec[vec[i].first]++;
}
}
}
rep(i, 0, N) {
if (qs[i])
cnt_wa += cnt_vec[i];
}
cout << cnt_ac << " " << cnt_wa << endl;
}
// 100000 7
// 7777 AC
// 7777 AC
// 7777 AC
// 1 WA
// 1 AC
// 1 AC
// 1 AC
int *eratosthenes(int N) {
int *prime_array = new int[N + 1];
int lim = N;
prime_array[0] = 0;
prime_array[1] = 0;
rep(i, 2, N + 1) { prime_array[i] = 1; }
rep(i, 2, lim) {
if (prime_array[i] == 0)
continue;
lim = N / i;
for (int j = i * 2; j < N + 1; j += i) {
prime_array[j] = 0;
}
}
return prime_array;
}
template <class T> void cumulative_sum(T array, size_t N) {
rep(i, 1, N + 1) { array[i] += array[i - 1]; }
}
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
bool bit_search(int pattern, int N) {
int cnt = 0;
rep(bit, 0, N) {
if (pattern & (1 << bit)) {
cnt++;
}
}
return true;
}
| replace | 44 | 46 | 44 | 46 | 0 | |
p02802 | C++ | Runtime Error | #pragma region include
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <set>
#include <stdio.h>
#include <string>
#pragma endregion
using namespace std;
#pragma region 定数
#define INF_VAL (2147483647 - 1)
#define INF_VAL_MINUS -INFVAL
#pragma endregion
#pragma region マクロ
// 配列の長さを取得する(ただし関数内ではポインタサイズに注意)
#define SIZE_OF_ARRAY(array) sizeof(array) / sizeof(*array)
// for文
#define forn(i, size) for (long long(i) = 0; (i) < (size); (i)++)
#define for0(size) for (long(i) = 0; (i) < (size); (i)++)
// ソート
#define Sort(array, length) sort(array, array + length)
#define SortDESC(array, length, type_name) \
sort(array, array + length, std::greater<type_name>())
// 配列の最大値、最小値取得
#define MAX_OF_ARRAY(array, length) *max_element(array, array + length)
#define MIN_OF_ARRAY(array, length) *min_element(array, array + length)
// 結果出力系
#define YES \
{ \
cout << "YES" << endl; \
return 0; \
}
#define NO \
{ \
cout << "NO" << endl; \
return 0; \
}
#define Yes \
{ \
cout << "Yes" << endl; \
return 0; \
}
#define No \
{ \
cout << "No" << endl; \
return 0; \
}
#pragma endregion
#pragma region Utility
#pragma region 配列要素の合計値を取得
template <typename T> T getSum(T array[], int length) {
T sum = 0;
for (int i = 0; i < length; i++) {
sum += array[i];
}
return sum;
}
#pragma endregion
#pragma region ToString(int)
string ToString(int i) {
char buffer[1000];
sprintf(buffer, "%d", i);
return string(buffer);
}
#pragma endregion
#pragma region 10進数からN進数(<= 10) へ変換
string convertToN(long n, int base) {
string ans = "";
while (n != 0) {
int temp = n % base; // 1桁取得
ans = ToString(temp) + ans;
n /= base;
}
return ans;
}
#pragma endregion
#pragma endregion
int main() {
// 標準入力から値を取得
int N, M;
cin >> N >> M;
int i = 0;
string result[N];
int WA_count_array[N];
int AC_count = 0;
int WA_count = 0;
forn(i, M) { WA_count_array[i] = 0; }
forn(i, M) {
int p_i;
string s_i;
cin >> p_i >> s_i;
string status = result[p_i - 1];
// まだACではない場合
if (status != "AC") {
if (s_i == "AC") {
AC_count++;
result[p_i - 1] = "AC";
// 今までのWA回数を加算する
WA_count += WA_count_array[p_i - 1];
// printf("%d\n", WA_count_array[p_i - 1]);
} else if (s_i == "WA") {
// printf("%d\n", WA_count_array[p_i - 1]);
WA_count_array[p_i - 1]++;
result[p_i - 1] = "WA";
}
}
}
// 結果出力
printf("%d %d\n", AC_count, WA_count);
}
| #pragma region include
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <set>
#include <stdio.h>
#include <string>
#pragma endregion
using namespace std;
#pragma region 定数
#define INF_VAL (2147483647 - 1)
#define INF_VAL_MINUS -INFVAL
#pragma endregion
#pragma region マクロ
// 配列の長さを取得する(ただし関数内ではポインタサイズに注意)
#define SIZE_OF_ARRAY(array) sizeof(array) / sizeof(*array)
// for文
#define forn(i, size) for (long long(i) = 0; (i) < (size); (i)++)
#define for0(size) for (long(i) = 0; (i) < (size); (i)++)
// ソート
#define Sort(array, length) sort(array, array + length)
#define SortDESC(array, length, type_name) \
sort(array, array + length, std::greater<type_name>())
// 配列の最大値、最小値取得
#define MAX_OF_ARRAY(array, length) *max_element(array, array + length)
#define MIN_OF_ARRAY(array, length) *min_element(array, array + length)
// 結果出力系
#define YES \
{ \
cout << "YES" << endl; \
return 0; \
}
#define NO \
{ \
cout << "NO" << endl; \
return 0; \
}
#define Yes \
{ \
cout << "Yes" << endl; \
return 0; \
}
#define No \
{ \
cout << "No" << endl; \
return 0; \
}
#pragma endregion
#pragma region Utility
#pragma region 配列要素の合計値を取得
template <typename T> T getSum(T array[], int length) {
T sum = 0;
for (int i = 0; i < length; i++) {
sum += array[i];
}
return sum;
}
#pragma endregion
#pragma region ToString(int)
string ToString(int i) {
char buffer[1000];
sprintf(buffer, "%d", i);
return string(buffer);
}
#pragma endregion
#pragma region 10進数からN進数(<= 10) へ変換
string convertToN(long n, int base) {
string ans = "";
while (n != 0) {
int temp = n % base; // 1桁取得
ans = ToString(temp) + ans;
n /= base;
}
return ans;
}
#pragma endregion
#pragma endregion
int main() {
// 標準入力から値を取得
int N, M;
cin >> N >> M;
int i = 0;
string result[N];
int WA_count_array[N];
int AC_count = 0;
int WA_count = 0;
forn(i, N) { WA_count_array[i] = 0; }
forn(i, M) {
int p_i;
string s_i;
cin >> p_i >> s_i;
string status = result[p_i - 1];
// まだACではない場合
if (status != "AC") {
if (s_i == "AC") {
AC_count++;
result[p_i - 1] = "AC";
// 今までのWA回数を加算する
WA_count += WA_count_array[p_i - 1];
// printf("%d\n", WA_count_array[p_i - 1]);
} else if (s_i == "WA") {
// printf("%d\n", WA_count_array[p_i - 1]);
WA_count_array[p_i - 1]++;
result[p_i - 1] = "WA";
}
}
}
// 結果出力
printf("%d %d\n", AC_count, WA_count);
}
| replace | 99 | 100 | 99 | 100 | -11 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, p, a = 0, w = 0;
string J;
cin >> N >> M;
vector<bool> x(N, false);
vector<int> WA(N, 0);
for (int i = 0; i < M; i++) {
cin >> p >> J[i];
if (J == "AC") {
if (!x.at(p - 1)) {
a++;
x.at(p - 1) = true;
w += WA.at(p - 1);
}
} else if (!x.at(p - 1))
WA.at(p - 1)++;
}
cout << a << " " << w << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, p, a = 0, w = 0;
string J;
cin >> N >> M;
vector<bool> x(N, false);
vector<int> WA(N, 0);
for (int i = 0; i < M; i++) {
cin >> p >> J;
if (J == "AC") {
if (!x.at(p - 1)) {
a++;
x.at(p - 1) = true;
w += WA.at(p - 1);
}
} else if (!x.at(p - 1))
WA.at(p - 1)++;
}
cout << a << " " << w << endl;
} | replace | 9 | 10 | 9 | 10 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector<bool>::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 2)
|
p02802 | C++ | Runtime Error | #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#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;
#define ll long long
using vt = ll; // ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for (vt i = (vt)(s); i < (vt)(n); i++)
#define MOD 1000000007
int main() {
vt n, m, a = 0, w = 0;
cin >> n >> m;
vector<pair<vt, string>> vec(m);
rep(i, m) {
cin >> vec.at(i).first >> vec.at(i).second;
vec.at(i).first--;
}
vector<bool> wa(n, true);
vector<vt> ac(n, 0);
rep(i, m) {
if (vec.at(i).second.at(0) == 'W' && vec[i].second.at(1) == 'A') {
if (wa.at(vec.at(i).first))
ac.at(vec.at(i).first)++;
} else {
if (wa.at(vec.at(i).first)) {
wa.at(vec.at(i).first) = false;
a++;
}
}
}
rep(i, n) {
if (!(wa.at(i))) {
w += ac.at(vec.at(i).first);
}
}
cout << a << " " << w << endl;
return 0;
} | #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#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;
#define ll long long
using vt = ll; // ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for (vt i = (vt)(s); i < (vt)(n); i++)
#define MOD 1000000007
int main() {
vt n, m, a = 0, w = 0;
cin >> n >> m;
vector<pair<vt, string>> vec(m);
rep(i, m) {
cin >> vec.at(i).first >> vec.at(i).second;
vec.at(i).first--;
}
vector<bool> wa(n, true);
vector<vt> ac(n, 0);
rep(i, m) {
if (vec.at(i).second.at(0) == 'W' && vec[i].second.at(1) == 'A') {
if (wa.at(vec.at(i).first))
ac.at(vec.at(i).first)++;
} else {
if (wa.at(vec.at(i).first)) {
wa.at(vec.at(i).first) = false;
a++;
}
}
}
rep(i, n) {
if (!(wa.at(i))) {
w += ac.at(i);
}
}
cout << a << " " << w << endl;
return 0;
} | replace | 48 | 49 | 48 | 49 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL mod = 1000000007;
int main() {
LL n, m;
cin >> n >> m;
vector<pair<LL, string>> d(m);
for (auto &e : d) {
cin >> e.first >> e.second;
}
vector<LL> done(n, 0);
LL ac = 0;
LL cnt = 0;
for (LL i = 0; i < m; ++i) {
LL f = d[i].first - 1;
string s = d[i].second;
if (!done[f]) {
if (s == "AC") {
done[f] = 1;
ac++;
} else {
cnt++;
}
}
}
for (LL i = 0; i < n; ++i) {
LL f = d[i].first - 1;
string s = d[i].second;
if (!done[f]) {
cnt--;
}
}
cout << ac << " " << cnt << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL mod = 1000000007;
int main() {
LL n, m;
cin >> n >> m;
vector<pair<LL, string>> d(m);
for (auto &e : d) {
cin >> e.first >> e.second;
}
vector<LL> done(n, 0);
LL ac = 0;
LL cnt = 0;
for (LL i = 0; i < m; ++i) {
LL f = d[i].first - 1;
string s = d[i].second;
if (!done[f]) {
if (s == "AC") {
done[f] = 1;
ac++;
} else {
cnt++;
}
}
}
for (LL i = 0; i < m; ++i) {
LL f = d[i].first - 1;
string s = d[i].second;
if (!done[f]) {
cnt--;
}
}
cout << ac << " " << cnt << endl;
} | replace | 34 | 35 | 34 | 35 | 0 | |
p02802 | Python | Runtime Error | import collections
def solve(n, m, hist):
cor = 0
pen = 0
for p, tries in hist.items():
for i, t in enumerate(tries):
if t == "AC":
cor += 1
pen += i
break
return f"{cor} {pen}"
def input_to_int():
return [int(r) for r in input().split(" ")]
if __name__ == "__main__":
n, m = input_to_int()
hist = collections.defaultdict(list)
for _ in range(m):
p, s = input().split(" ")
hist[p].append(s)
print(solve(n, m, hist))
| import collections
def solve(n, m, hist):
cor = 0
pen = 0
for p, tries in hist.items():
for i, t in enumerate(tries):
if t == "AC":
cor += 1
pen += i
break
return "{0} {1}".format(cor, pen)
def input_to_int():
return [int(r) for r in input().split(" ")]
if __name__ == "__main__":
n, m = input_to_int()
hist = collections.defaultdict(list)
for _ in range(m):
p, s = input().split(" ")
hist[p].append(s)
print(solve(n, m, hist))
| replace | 12 | 13 | 12 | 13 | 0 | |
p02802 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m, acc = 0, pen = 0;
cin >> n >> m;
vector<bool> test(n);
vector<int> arr(m);
vector<int> p(m);
vector<string> s(m);
for (int i = 0; i < m; i++) {
cin >> p[i];
cin >> s[i];
if (test[p[i]] == false && s[i] == "AC") {
test[p[i]] = true;
acc++;
pen += arr[p[i]];
}
if (test[p[i]] == false && s[i] == "WA") {
arr[p[i]]++;
}
}
cout << acc << endl << pen << endl;
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m, acc = 0, pen = 0;
cin >> n >> m;
vector<bool> test(n + 1);
vector<int> arr(n + 1);
vector<int> p(m);
vector<string> s(m);
for (int i = 0; i < m; i++) {
cin >> p[i];
cin >> s[i];
if (test[p[i]] == false && s[i] == "AC") {
test[p[i]] = true;
acc++;
pen += arr[p[i]];
}
if (test[p[i]] == false && s[i] == "WA") {
arr[p[i]]++;
}
}
cout << acc << endl << pen << endl;
return 0;
}
| replace | 6 | 8 | 6 | 8 | 0 | |
p02802 | C++ | 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;
vector<int> p(m);
vector<string> s(m);
rep(i, m) cin >> p[i] >> s[i];
vector<bool> flag(n);
vector<int> pn_cnt(m);
int ac_cnt = 0, pn_sum = 0;
rep(i, m) {
if (s[i] == "AC") {
if (flag[p[i] - 1] == false) {
flag[p[i] - 1] = true;
ac_cnt++;
pn_sum = pn_sum + pn_cnt[p[i] - 1];
}
} else if (s[i] == "WA") {
if (flag[p[i] - 1] == false)
pn_cnt[p[i] - 1]++;
}
}
cout << ac_cnt << " " << pn_sum << endl;
return 0;
} | #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;
vector<int> p(m);
vector<string> s(m);
rep(i, m) cin >> p[i] >> s[i];
vector<bool> flag(n);
vector<int> pn_cnt(n);
int ac_cnt = 0, pn_sum = 0;
rep(i, m) {
if (s[i] == "AC") {
if (flag[p[i] - 1] == false) {
flag[p[i] - 1] = true;
ac_cnt++;
pn_sum = pn_sum + pn_cnt[p[i] - 1];
}
} else if (s[i] == "WA") {
if (flag[p[i] - 1] == false)
pn_cnt[p[i] - 1]++;
}
}
cout << ac_cnt << " " << pn_sum << endl;
return 0;
} | replace | 12 | 13 | 12 | 13 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define p_q priority_queue
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
int main() {
int n, m;
cin >> n >> m;
vector<int> jud(n, 0);
vector<int> was(n, 0);
ll ACs = 0, WAs = 0;
// 1->AC 0-> WA
int p;
string S;
for (int i = 0; i < m; i++) {
cin >> p >> S;
if (jud.at(p - 1) == 0) {
if (S == "WA") {
was.at(p - 1)++;
} else {
ACs++;
jud.at(p - 1) = 1;
}
}
}
rep(i, m) {
if (jud.at(i) == 1) {
WAs += was.at(i);
}
}
cout << ACs << ' ' << WAs << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define p_q priority_queue
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
int main() {
int n, m;
cin >> n >> m;
vector<int> jud(n, 0);
vector<int> was(n, 0);
ll ACs = 0, WAs = 0;
// 1->AC 0-> WA
int p;
string S;
for (int i = 0; i < m; i++) {
cin >> p >> S;
if (jud.at(p - 1) == 0) {
if (S == "WA") {
was.at(p - 1)++;
} else {
ACs++;
jud.at(p - 1) = 1;
}
}
}
rep(i, n) {
if (jud.at(i) == 1) {
WAs += was.at(i);
}
}
cout << ACs << ' ' << WAs << endl;
}
| replace | 31 | 32 | 31 | 32 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 2) >= this->size() (which is 2)
|
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i <= end; i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> auto MAX(const T &a) {
return *max_element(a.begin(), a.end());
}
template <class T> auto MIN(const T &a) {
return *min_element(a.begin(), a.end());
}
template <class T, class U> U SUM(const T &a, const U &v) {
return accumulate(a.begin(), a.end(), v);
}
template <class T, class U> U COUNT(const T &a, const U &v) {
return count(a.begin(), a.end(), v);
}
template <class T, class U> int LOWER(const T &a, const U &v) {
return lower_bound(a.begin(), a.end(), v) - a.begin();
}
template <class T, class U> int UPPER(const T &a, const U &v) {
return upper_bound(a.begin(), a.end(), v) - a.begin();
}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
int LCM(int a, int b) {
int g = GCD(a, b);
return a / g * b;
}
//---------------------------------------------------------------------------------------------------
template <int MOD> struct ModInt {
static const int Mod = MOD;
unsigned x;
ModInt() : x(0) {}
ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
int get() const { return (int)x; }
ModInt &operator+=(ModInt that) {
if ((x += that.x) >= MOD)
x -= MOD;
return *this;
}
ModInt &operator-=(ModInt that) {
if ((x += MOD - that.x) >= MOD)
x -= MOD;
return *this;
}
ModInt &operator*=(ModInt that) {
x = (unsigned long long)x * that.x % MOD;
return *this;
}
ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
ModInt inverse() const {
long long a = x, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
std::swap(a, b);
u -= t * v;
std::swap(u, v);
}
return ModInt(u);
}
bool operator==(ModInt that) const { return x == that.x; }
bool operator!=(ModInt that) const { return x != that.x; }
ModInt operator-() const {
ModInt t;
t.x = x == 0 ? 0 : Mod - x;
return t;
}
};
template <int MOD> ostream &operator<<(ostream &st, const ModInt<MOD> a) {
st << a.get();
return st;
};
template <int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
ModInt<MOD> r = 1;
while (k) {
if (k & 1)
r *= a;
a *= a;
k >>= 1;
}
return r;
}
template <typename T, int FAC_MAX> struct Comb {
vector<T> fac, ifac;
Comb() {
fac.resize(FAC_MAX, 1);
ifac.resize(FAC_MAX, 1);
FOR(i, 1, FAC_MAX - 1) fac[i] = fac[i - 1] * i;
ifac[FAC_MAX - 1] = T(1) / fac[FAC_MAX - 1];
for (int i = FAC_MAX - 2; i >= 1; i--)
ifac[i] = ifac[i + 1] * T(i + 1);
}
T aPb(int a, int b) {
if (b < 0 || a < b)
return T(0);
return fac[a] * ifac[a - b];
}
T aCb(int a, int b) {
if (b < 0 || a < b)
return T(0);
return fac[a] * ifac[a - b] * ifac[b];
}
T nHk(int n, int k) {
if (n == 0 && k == 0)
return T(1);
if (n <= 0 || k < 0)
return 0;
return aCb(n + k - 1, k);
} // nHk = (n+k-1)Ck : n is separator
T pairCombination(int n) {
if (n % 2 == 1)
return T(0);
return fac[n] * ifac[n / 2] / (T(2) ^ (n / 2));
}
// combination of paris for n
};
typedef ModInt<1000000007> mint;
int main(void) {
// Your code here!
int n, m;
cin >> n >> m;
vector<int> p(m);
vector<string> s(m);
rep(i, m) cin >> p[i] >> s[i];
int pena = 0;
int AC = 0;
vector<bool> ac(n + 1);
vector<int> wa(m, 0);
rep(i, n + 1) ac[i] = false;
rep(i, m) {
if (ac[p[i]])
continue;
else {
if (s[i] == "WA")
wa[p[i]]++;
else {
ac[p[i]] = true;
AC++;
pena += wa[p[i]];
}
}
}
cout << AC << " " << pena << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i <= end; i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> auto MAX(const T &a) {
return *max_element(a.begin(), a.end());
}
template <class T> auto MIN(const T &a) {
return *min_element(a.begin(), a.end());
}
template <class T, class U> U SUM(const T &a, const U &v) {
return accumulate(a.begin(), a.end(), v);
}
template <class T, class U> U COUNT(const T &a, const U &v) {
return count(a.begin(), a.end(), v);
}
template <class T, class U> int LOWER(const T &a, const U &v) {
return lower_bound(a.begin(), a.end(), v) - a.begin();
}
template <class T, class U> int UPPER(const T &a, const U &v) {
return upper_bound(a.begin(), a.end(), v) - a.begin();
}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
int LCM(int a, int b) {
int g = GCD(a, b);
return a / g * b;
}
//---------------------------------------------------------------------------------------------------
template <int MOD> struct ModInt {
static const int Mod = MOD;
unsigned x;
ModInt() : x(0) {}
ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
int get() const { return (int)x; }
ModInt &operator+=(ModInt that) {
if ((x += that.x) >= MOD)
x -= MOD;
return *this;
}
ModInt &operator-=(ModInt that) {
if ((x += MOD - that.x) >= MOD)
x -= MOD;
return *this;
}
ModInt &operator*=(ModInt that) {
x = (unsigned long long)x * that.x % MOD;
return *this;
}
ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
ModInt inverse() const {
long long a = x, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
std::swap(a, b);
u -= t * v;
std::swap(u, v);
}
return ModInt(u);
}
bool operator==(ModInt that) const { return x == that.x; }
bool operator!=(ModInt that) const { return x != that.x; }
ModInt operator-() const {
ModInt t;
t.x = x == 0 ? 0 : Mod - x;
return t;
}
};
template <int MOD> ostream &operator<<(ostream &st, const ModInt<MOD> a) {
st << a.get();
return st;
};
template <int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
ModInt<MOD> r = 1;
while (k) {
if (k & 1)
r *= a;
a *= a;
k >>= 1;
}
return r;
}
template <typename T, int FAC_MAX> struct Comb {
vector<T> fac, ifac;
Comb() {
fac.resize(FAC_MAX, 1);
ifac.resize(FAC_MAX, 1);
FOR(i, 1, FAC_MAX - 1) fac[i] = fac[i - 1] * i;
ifac[FAC_MAX - 1] = T(1) / fac[FAC_MAX - 1];
for (int i = FAC_MAX - 2; i >= 1; i--)
ifac[i] = ifac[i + 1] * T(i + 1);
}
T aPb(int a, int b) {
if (b < 0 || a < b)
return T(0);
return fac[a] * ifac[a - b];
}
T aCb(int a, int b) {
if (b < 0 || a < b)
return T(0);
return fac[a] * ifac[a - b] * ifac[b];
}
T nHk(int n, int k) {
if (n == 0 && k == 0)
return T(1);
if (n <= 0 || k < 0)
return 0;
return aCb(n + k - 1, k);
} // nHk = (n+k-1)Ck : n is separator
T pairCombination(int n) {
if (n % 2 == 1)
return T(0);
return fac[n] * ifac[n / 2] / (T(2) ^ (n / 2));
}
// combination of paris for n
};
typedef ModInt<1000000007> mint;
int main(void) {
// Your code here!
int n, m;
cin >> n >> m;
vector<int> p(m);
vector<string> s(m);
rep(i, m) cin >> p[i] >> s[i];
int pena = 0;
int AC = 0;
vector<bool> ac(n + 1);
vector<int> wa(n + 1, 0);
rep(i, n + 1) ac[i] = false;
rep(i, m) {
if (ac[p[i]])
continue;
else {
if (s[i] == "WA")
wa[p[i]]++;
else {
ac[p[i]] = true;
AC++;
pena += wa[p[i]];
}
}
}
cout << AC << " " << pena << endl;
}
| replace | 150 | 151 | 150 | 151 | 0 | |
p02802 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
using namespace std;
int main() {
ll N, M;
ll seikai = 0, pena = 0;
cin >> N >> M;
vector<ll> count(N, 0);
vector<ll> ans(N, 0);
rep(i, M) {
ll p;
string S;
cin >> p >> S;
if (ans[p - 1] == 1)
continue;
if (S == "AC")
ans[p - 1] = 1;
else
count[p - 1]++;
}
rep(j, M) {
seikai += ans[j];
if (ans[j] == 1)
pena += count[j];
}
cout << seikai << " " << pena << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
using namespace std;
int main() {
ll N, M;
ll seikai = 0, pena = 0;
cin >> N >> M;
vector<ll> count(N, 0);
vector<ll> ans(N, 0);
rep(i, M) {
ll p;
string S;
cin >> p >> S;
if (ans[p - 1] == 1)
continue;
if (S == "AC")
ans[p - 1] = 1;
else
count[p - 1]++;
}
rep(j, N) {
seikai += ans[j];
if (ans[j] == 1)
pena += count[j];
}
cout << seikai << " " << pena << endl;
return 0;
}
| replace | 30 | 31 | 30 | 31 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
int main() {
int N, M;
cin >> N >> M;
set<int> st;
int fail = 0;
vector<int> f(M + 1, 0);
rep(i, M) {
int a;
string b;
cin >> a >> b;
if (b == "AC" && !(st.count(a))) {
st.insert(a);
fail += f[a];
} else {
if (st.count(a)) {
continue;
} else {
f[a]++;
}
}
}
cout << st.size() << " " << fail << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
int main() {
int N, M;
cin >> N >> M;
set<int> st;
int fail = 0;
vector<int> f(N + 1, 0);
rep(i, M) {
int a;
string b;
cin >> a >> b;
if (b == "AC" && !(st.count(a))) {
st.insert(a);
fail += f[a];
} else {
if (st.count(a)) {
continue;
} else {
f[a]++;
}
}
}
cout << st.size() << " " << fail << endl;
}
| replace | 11 | 12 | 11 | 12 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
int main() {
int N, M;
cin >> N >> M;
vector<bool> Ans(N);
vector<int> pena(N);
rep(i, M) {
int p;
string s;
cin >> p >> s;
if (Ans.at(p - 1))
continue;
if (s == "AC") {
Ans.at(p - 1) = true;
} else {
pena.at(p)++;
}
}
int num = 0, p = 0;
rep(i, N) {
if (Ans.at(i) == true) {
p += pena.at(i);
num++;
}
}
cout << num << " " << p << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
int main() {
int N, M;
cin >> N >> M;
vector<bool> Ans(N);
vector<int> pena(N);
rep(i, M) {
int p;
string s;
cin >> p >> s;
if (Ans.at(p - 1))
continue;
if (s == "AC") {
Ans.at(p - 1) = true;
} else {
pena.at(p - 1)++;
}
}
int num = 0, p = 0;
rep(i, N) {
if (Ans.at(i) == true) {
p += pena.at(i);
num++;
}
}
cout << num << " " << p << endl;
} | replace | 19 | 20 | 19 | 20 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 2) >= this->size() (which is 2)
|
p02802 | C++ | Runtime Error | #pragma GCC optimize("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define all(c) (c).begin(), (c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(), (c).rend()
#define ifr(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m, n, r) \
m.reserve(n); \
m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os \
tree<int, null_type, less<int>, rb_tree_tag, \
tree_order_statistics_node_update>
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd() { return 0ll; }
template <typename T, typename... Args> T gcd(T a, Args... args) {
return __gcd(a, (__typeof(a))gcd(args...));
}
typedef map<ll, ll> mll;
typedef map<string, ll> msll;
typedef unordered_map<ll, ll> umap;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mod 1000000007
#define N 100001
ll pen[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
ll n, m;
cin >> n >> m;
ll a[n], ac = 0, x;
string y;
ifr(i, 0, n) a[i] = pen[i] = 0;
for (int i = 0; i < m; i++) {
cin >> x >> y;
x--;
if (y[0] == 'W') {
if (!a[x])
pen[x]++;
} else {
if (!a[x]) {
ac++;
a[x] = 1;
}
}
}
ll pe = 0;
ifr(i, 0, n) if (a[i]) pe += pen[i];
cout << ac << " " << pe;
return 0;
} | #pragma GCC optimize("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define all(c) (c).begin(), (c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(), (c).rend()
#define ifr(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m, n, r) \
m.reserve(n); \
m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os \
tree<int, null_type, less<int>, rb_tree_tag, \
tree_order_statistics_node_update>
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd() { return 0ll; }
template <typename T, typename... Args> T gcd(T a, Args... args) {
return __gcd(a, (__typeof(a))gcd(args...));
}
typedef map<ll, ll> mll;
typedef map<string, ll> msll;
typedef unordered_map<ll, ll> umap;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mod 1000000007
#define N 100001
ll pen[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n, m;
cin >> n >> m;
ll a[n], ac = 0, x;
string y;
ifr(i, 0, n) a[i] = pen[i] = 0;
for (int i = 0; i < m; i++) {
cin >> x >> y;
x--;
if (y[0] == 'W') {
if (!a[x])
pen[x]++;
} else {
if (!a[x]) {
ac++;
a[x] = 1;
}
}
}
ll pe = 0;
ifr(i, 0, n) if (a[i]) pe += pen[i];
cout << ac << " " << pe;
return 0;
} | replace | 53 | 56 | 53 | 54 | -11 | |
p02802 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
int main() {
long long N, M;
std::cin >> N >> M;
std::map<long long, long long> C;
std::vector<long long> D(N + 1);
long long wa = 0;
long long ac = 0;
for (int i = 0; i < M; ++i) {
long long c;
std::string s;
std::cin >> c >> s;
if (s == "WA" && D[c] != 1) {
D[c] = 5;
++C[c];
++wa;
}
if (s == "AC" && D[c] != 1) {
D[c] = 1;
++ac;
}
}
for (int i = 0; i < M + 1; ++i) {
if (D[i] == 5)
wa -= C[i];
}
std::cout << ac << " " << wa << std::endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
int main() {
long long N, M;
std::cin >> N >> M;
std::map<long long, long long> C;
std::vector<long long> D(N + 1);
long long wa = 0;
long long ac = 0;
for (int i = 0; i < M; ++i) {
long long c;
std::string s;
std::cin >> c >> s;
if (s == "WA" && D[c] != 1) {
D[c] = 5;
++C[c];
++wa;
}
if (s == "AC" && D[c] != 1) {
D[c] = 1;
++ac;
}
}
for (int i = 0; i < N + 1; ++i) {
if (D[i] == 5)
wa -= C[i];
}
std::cout << ac << " " << wa << std::endl;
return 0;
}
| replace | 30 | 31 | 30 | 31 | 0 | |
p02802 | C++ | Runtime Error | #include <algorithm>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
long long n, m;
int ans = 0, cnt = 0;
cin >> n >> m;
string s;
vector<int> w(10005);
map<int, int> ac;
long long p;
rep(i, m) {
cin >> p >> s;
if (ac[p] == 0 && s == "WA") {
w[p]++;
} else if (ac[p] == 0 && s == "AC") {
cnt += w[p];
ac[p]++;
ans++;
}
}
cout << ans << " " << cnt;
} | #include <algorithm>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
long long n, m;
int ans = 0, cnt = 0;
cin >> n >> m;
string s;
vector<int> w(100005);
map<int, int> ac;
long long p;
rep(i, m) {
cin >> p >> s;
if (ac[p] == 0 && s == "WA") {
w[p]++;
} else if (ac[p] == 0 && s == "AC") {
cnt += w[p];
ac[p]++;
ans++;
}
}
cout << ans << " " << cnt;
} | replace | 21 | 22 | 21 | 22 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template <class F> auto recursive(F f) {
return [f](auto... a) { return f(f, a...); };
}
template <class I, class V = typename I::value_type>
V sum_up(const I &l, const I &r) {
V v;
for (I i = l; i != r; i++)
v = i == l ? *i : v + *i;
return v;
}
template <class I, class T = iterator_traits<I>> I operator+(I it, int n) {
for (int i = 0; i < n; i++)
it++;
return it;
}
template <class I, class T = iterator_traits<I>> I operator-(I it, int n) {
for (int i = 0; i < n; i++)
it--;
return it;
}
template <class T>
using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> using vector2d = vector<vector<T>>;
struct fixprec {
int x;
fixprec(int d) : x(d) {}
};
ostream &operator<<(ostream &o, fixprec f) {
return o << fixed << setprecision(f.x);
}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
int N, M;
cin >> N >> M;
vector<int> P(N, 0), S(N, 0);
queue<int> q;
for (int i = 0; i < M; i++) {
int p;
string s;
cin >> p >> s;
p--;
if (s == "WA" && !S[p])
P[p]++;
if (s == "AC")
S[p] = 1;
}
for (int i = 0; i < M; i++) {
if (!S[i])
P[i] = 0;
}
cout << accumulate(WHOLE(S), 0) << " " << accumulate(WHOLE(P), 0) << endl;
return 0;
}
| #include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template <class F> auto recursive(F f) {
return [f](auto... a) { return f(f, a...); };
}
template <class I, class V = typename I::value_type>
V sum_up(const I &l, const I &r) {
V v;
for (I i = l; i != r; i++)
v = i == l ? *i : v + *i;
return v;
}
template <class I, class T = iterator_traits<I>> I operator+(I it, int n) {
for (int i = 0; i < n; i++)
it++;
return it;
}
template <class I, class T = iterator_traits<I>> I operator-(I it, int n) {
for (int i = 0; i < n; i++)
it--;
return it;
}
template <class T>
using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> using vector2d = vector<vector<T>>;
struct fixprec {
int x;
fixprec(int d) : x(d) {}
};
ostream &operator<<(ostream &o, fixprec f) {
return o << fixed << setprecision(f.x);
}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
int N, M;
cin >> N >> M;
vector<int> P(N, 0), S(N, 0);
queue<int> q;
for (int i = 0; i < M; i++) {
int p;
string s;
cin >> p >> s;
p--;
if (s == "WA" && !S[p])
P[p]++;
if (s == "AC")
S[p] = 1;
}
for (int i = 0; i < N; i++) {
if (!S[i])
P[i] = 0;
}
cout << accumulate(WHOLE(S), 0) << " " << accumulate(WHOLE(P), 0) << endl;
return 0;
}
| replace | 52 | 53 | 52 | 53 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int round(int a, int b) {
if ((a % b) * 2 >= b) {
return (a / b) + 1;
}
return a / b;
}
int gcd(int a, int b) {
int c;
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
} // 最大公約数
int lcm(int a, int b) {
int c = gcd(a, b);
a /= c;
return a * b;
} // 最小公倍数
int nCr(int a, int b) {
int i, r = 1;
for (i = 1; i <= b; i++) {
r *= (a + 1 - i);
r /= i;
}
return r;
} // コンビネーション
int nHr(int a, int b) { return nCr(a + b - 1, b); } // 重複組み合わせ
int fact(int a) {
int i, r = 1;
for (i = 1; i <= a; i++) {
r *= i;
}
return r;
} // 階乗
int pow(int a, int b) {
int i, r = 1;
for (i = 1; i <= b; i++) {
r *= a;
}
return r;
} // a~bまでの階乗
int dsum(int x) {
int r = 0;
while (x) {
r += (x % 10);
x /= 10;
}
return r;
} // 数字の各位の和
int dsumb(int x, int b) {
int r = 0;
while (x) {
r += (x % b);
x /= b;
}
return r;
} // b進数の各位の和?
int sankaku(int x) { return ((1 + x) * x) / 2; } // 三角数 xまでの和
// 以下long long ver
long long llmax(long long a, long long b) {
if (a > b) {
return a;
}
return b;
}
long long llmin(long long a, long long b) {
if (a < b) {
return a;
}
return b;
}
long long llzt(long long a, long long b) { return llmax(a, b) - llmin(a, b); }
long long llround(long long a, long long b) {
if ((a % b) * 2 >= b) {
return (a / b) + 1;
}
return a / b;
}
long long llceil(long long a, long long b) {
if (a % b == 0) {
return a / b;
}
return (a / b) + 1;
}
long long llgcd(long long a, long long b) {
long long c;
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
long long lllcm(long long a, long long b) {
long long c = llgcd(a, b);
a /= c;
return a * b;
}
long long llnCr(long long a, long long b) {
long long i, r = 1;
for (i = 1; i <= b; i++) {
r *= (a + 1 - i);
r /= i;
}
return r;
}
long long llnHr(long long a, long long b) { return llnCr(a + b - 1, b); }
long long llfact(long long a) {
long long i, r = 1;
for (i = 1; i <= a; i++) {
r *= i;
}
return r;
}
long long llpow(long long a, long long b) {
long long i, r = 1;
for (i = 1; i <= b; i++) {
r *= a;
}
return r;
}
long long lldsum(long long x) {
long long r = 0;
while (x) {
r += (x % 10);
x /= 10;
}
return r;
}
long long lldsumb(long long x, long long b) {
long long r = 0;
while (x) {
r += (x % b);
x /= b;
}
return r;
}
long long llsankaku(long long x) { return ((1 + x) * x) / 2; }
// double
double dbmax(double a, double b) {
if (a > b) {
return a;
}
return b;
}
double dbmin(double a, double b) {
if (a < b) {
return a;
}
return b;
}
double dbzt(double a, double b) { return dbmax(a, b) - dbmin(a, b); }
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
#define forr(i, a, b) \
; \
for (int i = (a); i < (b); i++)
#define clean(arr, val) memset(arr, val, sizeof(arr))
#define forn(i, n) forr(i, 0, n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
bool is_prime(int x) {
if (x <= 1)
return false;
for (int i = 2; i * i <= x; i++) {
if (x % i == 0)
return false;
}
return true;
}
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
bool chmin(int a, int b) {
if (a > b) {
a = b;
return true;
}
return false;
}
bool chmax(int a, int b) {
if (a < b) {
a = b;
return true;
}
return false;
}
/*CODE START HERE*/
int main() {
int n, m;
cin >> n >> m;
bool AC[n];
forn(i, n) { AC[i] = false; }
int pena[n];
forn(i, n) { pena[i] = 0; }
int ac = 0;
forn(i, m) {
int p;
string s;
cin >> p >> s;
if (!AC[p - 1] && s == "WA") {
pena[i]++;
} else if (!AC[p - 1] && s == "AC") {
AC[p - 1] = true;
ac++;
}
}
int sum_pena = 0 forn(i, n) {
if (AC[i]) {
sum_pena += pena[i];
}
}
cout << ac << ' ' << sum_pena << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int round(int a, int b) {
if ((a % b) * 2 >= b) {
return (a / b) + 1;
}
return a / b;
}
int gcd(int a, int b) {
int c;
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
} // 最大公約数
int lcm(int a, int b) {
int c = gcd(a, b);
a /= c;
return a * b;
} // 最小公倍数
int nCr(int a, int b) {
int i, r = 1;
for (i = 1; i <= b; i++) {
r *= (a + 1 - i);
r /= i;
}
return r;
} // コンビネーション
int nHr(int a, int b) { return nCr(a + b - 1, b); } // 重複組み合わせ
int fact(int a) {
int i, r = 1;
for (i = 1; i <= a; i++) {
r *= i;
}
return r;
} // 階乗
int pow(int a, int b) {
int i, r = 1;
for (i = 1; i <= b; i++) {
r *= a;
}
return r;
} // a~bまでの階乗
int dsum(int x) {
int r = 0;
while (x) {
r += (x % 10);
x /= 10;
}
return r;
} // 数字の各位の和
int dsumb(int x, int b) {
int r = 0;
while (x) {
r += (x % b);
x /= b;
}
return r;
} // b進数の各位の和?
int sankaku(int x) { return ((1 + x) * x) / 2; } // 三角数 xまでの和
// 以下long long ver
long long llmax(long long a, long long b) {
if (a > b) {
return a;
}
return b;
}
long long llmin(long long a, long long b) {
if (a < b) {
return a;
}
return b;
}
long long llzt(long long a, long long b) { return llmax(a, b) - llmin(a, b); }
long long llround(long long a, long long b) {
if ((a % b) * 2 >= b) {
return (a / b) + 1;
}
return a / b;
}
long long llceil(long long a, long long b) {
if (a % b == 0) {
return a / b;
}
return (a / b) + 1;
}
long long llgcd(long long a, long long b) {
long long c;
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
long long lllcm(long long a, long long b) {
long long c = llgcd(a, b);
a /= c;
return a * b;
}
long long llnCr(long long a, long long b) {
long long i, r = 1;
for (i = 1; i <= b; i++) {
r *= (a + 1 - i);
r /= i;
}
return r;
}
long long llnHr(long long a, long long b) { return llnCr(a + b - 1, b); }
long long llfact(long long a) {
long long i, r = 1;
for (i = 1; i <= a; i++) {
r *= i;
}
return r;
}
long long llpow(long long a, long long b) {
long long i, r = 1;
for (i = 1; i <= b; i++) {
r *= a;
}
return r;
}
long long lldsum(long long x) {
long long r = 0;
while (x) {
r += (x % 10);
x /= 10;
}
return r;
}
long long lldsumb(long long x, long long b) {
long long r = 0;
while (x) {
r += (x % b);
x /= b;
}
return r;
}
long long llsankaku(long long x) { return ((1 + x) * x) / 2; }
// double
double dbmax(double a, double b) {
if (a > b) {
return a;
}
return b;
}
double dbmin(double a, double b) {
if (a < b) {
return a;
}
return b;
}
double dbzt(double a, double b) { return dbmax(a, b) - dbmin(a, b); }
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
#define forr(i, a, b) \
; \
for (int i = (a); i < (b); i++)
#define clean(arr, val) memset(arr, val, sizeof(arr))
#define forn(i, n) forr(i, 0, n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
bool is_prime(int x) {
if (x <= 1)
return false;
for (int i = 2; i * i <= x; i++) {
if (x % i == 0)
return false;
}
return true;
}
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
bool chmin(int a, int b) {
if (a > b) {
a = b;
return true;
}
return false;
}
bool chmax(int a, int b) {
if (a < b) {
a = b;
return true;
}
return false;
}
/*CODE START HERE*/
int main() {
int n, m;
cin >> n >> m;
bool AC[n];
forn(i, n) { AC[i] = false; }
int pena[n];
forn(i, n) { pena[i] = 0; }
int ac = 0;
forn(i, m) {
int p;
string s;
cin >> p >> s;
if (!AC[p - 1] && s == "WA") {
pena[p - 1]++;
} else if (!AC[p - 1] && s == "AC") {
AC[p - 1] = true;
ac++;
}
}
int sum_pena = 0 forn(i, n) {
if (AC[i]) {
sum_pena += pena[i];
}
}
cout << ac << ' ' << sum_pena << endl;
} | replace | 221 | 222 | 221 | 222 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
int main() {
int N, M;
cin >> N >> M;
vector<int> p(M);
vector<string> S(M);
rep(i, M) cin >> p.at(i) >> S.at(i);
vector<int> AC(N, 0), WA(N, 0);
for (int i = 0; i < M; i++) {
if (AC.at(p.at(i) - 1) == 0) {
if (S.at(i) == "WA")
WA.at(p.at(i) - 1)++;
else
AC.at(p.at(i) - 1)++;
}
}
for (int i = 0; i < M; i++) {
if (AC.at(i) == 0)
WA.at(i) = 0;
}
int ac = accumulate(all(AC), 0);
int wa = accumulate(all(WA), 0);
cout << ac << " " << wa << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
int main() {
int N, M;
cin >> N >> M;
vector<int> p(M);
vector<string> S(M);
rep(i, M) cin >> p.at(i) >> S.at(i);
vector<int> AC(N, 0), WA(N, 0);
for (int i = 0; i < M; i++) {
if (AC.at(p.at(i) - 1) == 0) {
if (S.at(i) == "WA")
WA.at(p.at(i) - 1)++;
else
AC.at(p.at(i) - 1)++;
}
}
for (int i = 0; i < N; i++) {
if (AC.at(i) == 0)
WA.at(i) = 0;
}
int ac = accumulate(all(AC), 0);
int wa = accumulate(all(WA), 0);
cout << ac << " " << wa << endl;
return 0;
}
| replace | 24 | 25 | 24 | 26 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 2) >= this->size() (which is 2)
|
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
template <class T> void sort(vector<T> &v) { sort(v.begin(), v.end()); }
int main() {
int n, m;
cin >> n >> m;
vector<int> p(m);
vector<string> s(m);
for (int i = 0; i < m; i++)
cin >> p[i] >> s[i];
for (int i = 0; i < m; i++)
p[i]--;
vector<int> pen(m);
set<int> done;
for (int i = 0; i < m; i++) {
if (s[i] == "WA" && done.count(p[i]) == 0)
pen[p[i]]++;
if (s[i] == "AC")
done.insert(p[i]);
}
set<int> sac;
for (int i = 0; i < m; i++)
if (s[i] == "AC")
sac.insert(p[i]);
vector<int> ac;
for (auto itr = sac.begin(); itr != sac.end(); itr++)
ac.push_back(*itr);
int ans = 0;
for (auto i : ac)
ans += pen[i];
cout << ac.size() << " " << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
template <class T> void sort(vector<T> &v) { sort(v.begin(), v.end()); }
int main() {
int n, m;
cin >> n >> m;
vector<int> p(m);
vector<string> s(m);
for (int i = 0; i < m; i++)
cin >> p[i] >> s[i];
for (int i = 0; i < m; i++)
p[i]--;
vector<int> pen(n);
set<int> done;
for (int i = 0; i < m; i++) {
if (s[i] == "WA" && done.count(p[i]) == 0)
pen[p[i]]++;
if (s[i] == "AC")
done.insert(p[i]);
}
set<int> sac;
for (int i = 0; i < m; i++)
if (s[i] == "AC")
sac.insert(p[i]);
vector<int> ac;
for (auto itr = sac.begin(); itr != sac.end(); itr++)
ac.push_back(*itr);
int ans = 0;
for (auto i : ac)
ans += pen[i];
cout << ac.size() << " " << ans << endl;
return 0;
} | replace | 14 | 15 | 14 | 15 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// ll lcm(ll x, ll y){ return x*y/__gcd(x, y);}
int main() {
ll N, M;
cin >> N >> M;
bool ac[N + 1];
int wa[N + 1];
for (ll i = 1; i <= N; i++) {
ac[i] = false;
wa[i] = 0;
}
ll n_ac = 0;
ll n_wa = 0;
for (ll i = 0; i < M; i++) {
ll p;
string s;
cin >> p >> s;
if (ac[p]) {
continue;
}
if (!ac[p] && s == "AC") {
n_ac++;
ac[p] = true;
continue;
}
if (!ac[p] && s == "WA") {
wa[i + 1]++;
continue;
}
}
for (ll i = 1; i <= N; i++) {
if (ac[i]) {
n_wa += wa[i];
}
}
cout << n_ac << ' ' << n_wa;
// for(ll i=0; i<n; i++){}
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// ll lcm(ll x, ll y){ return x*y/__gcd(x, y);}
int main() {
ll N, M;
cin >> N >> M;
bool ac[N + 1];
int wa[N + 1];
for (ll i = 1; i <= N; i++) {
ac[i] = false;
wa[i] = 0;
}
ll n_ac = 0;
ll n_wa = 0;
for (ll i = 0; i < M; i++) {
ll p;
string s;
cin >> p >> s;
if (ac[p]) {
continue;
}
if (!ac[p] && s == "AC") {
n_ac++;
ac[p] = true;
continue;
}
if (!ac[p] && s == "WA") {
wa[p]++;
continue;
}
}
for (ll i = 1; i <= N; i++) {
if (ac[i]) {
n_wa += wa[i];
}
}
cout << n_ac << ' ' << n_wa;
// for(ll i=0; i<n; i++){}
}
| replace | 28 | 29 | 28 | 29 | 0 | |
p02802 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
// output
#define SPBR(w, n) std::cout << (w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define RFOR(i, a, n) for (int i = (n)-1; i >= (a); --i)
#define REP(i, n) for (int i = 0; i < int(n); ++i)
#define RREP(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define IN(a, x, b) (a <= x && x < b)
#define OUT(a, x, b) (x < a || b <= x)
template <class T> inline T chmax(T &a, const T b) {
return a = (a < b) ? b : a;
}
template <class T> inline T chmin(T &a, const T b) {
return a = (a > b) ? b : a;
}
// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;
using namespace std;
signed main() {
int N, M;
cin >> N >> M;
pair<int, int> ans = make_pair(0, 0);
vector<int> cnt(M + 10, 0);
vector<bool> used(M + 10, false);
REP(k, M) {
int i;
string s;
cin >> i >> s;
i--;
if (used[i])
continue;
if (s == "WA")
cnt[i]++;
else {
used[i] = true;
ans.first++;
ans.second += cnt[i];
}
}
cout << ans.first << " " << ans.second << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
// output
#define SPBR(w, n) std::cout << (w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define RFOR(i, a, n) for (int i = (n)-1; i >= (a); --i)
#define REP(i, n) for (int i = 0; i < int(n); ++i)
#define RREP(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define IN(a, x, b) (a <= x && x < b)
#define OUT(a, x, b) (x < a || b <= x)
template <class T> inline T chmax(T &a, const T b) {
return a = (a < b) ? b : a;
}
template <class T> inline T chmin(T &a, const T b) {
return a = (a > b) ? b : a;
}
// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;
using namespace std;
signed main() {
int N, M;
cin >> N >> M;
pair<int, int> ans = make_pair(0, 0);
vector<int> cnt(100100, 0);
vector<bool> used(100100, false);
REP(k, M) {
int i;
string s;
cin >> i >> s;
i--;
if (used[i])
continue;
if (s == "WA")
cnt[i]++;
else {
used[i] = true;
ans.first++;
ans.second += cnt[i];
}
}
cout << ans.first << " " << ans.second << endl;
return 0;
} | replace | 46 | 48 | 46 | 48 | 0 | |
p02802 | C++ | Runtime Error | //
// じょえチャンネル
// 高評価・チャンネル登録よろしくお願いします!
// https://www.youtube.com/watch?v=gPFr7q7eLL8
//
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define P pair<ll, ll>
#define sz(x) (ll) x.size()
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define VE vector<ll>
#define COUT(x) cout << (x) << endl
#define MA map<ll, ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll, VE, greater<ll>>
#define COUT(x) cout << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define EPS (1e-10)
#define pb push_back
const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long INF = 1LL << 60;
const double PI = acos(-1.0);
using Graph = vector<VE>;
struct mint {
ll x; // typedef long long ll;
mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
mint operator-() const { return mint(-x); }
mint &operator+=(const mint a) {
if ((x += a.x) >= MOD)
x -= MOD;
return *this;
}
mint &operator-=(const mint a) {
if ((x += MOD - a.x) >= MOD)
x -= MOD;
return *this;
}
mint &operator*=(const mint a) {
(x *= a.x) %= MOD;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res += a;
}
mint operator-(const mint a) const {
mint res(*this);
return res -= a;
}
mint operator*(const mint a) const {
mint res(*this);
return res *= a;
}
mint pow(ll t) const {
if (!t)
return 1;
mint a = pow(t >> 1);
a *= a;
if (t & 1)
a *= *this;
return a;
}
// for prime MOD
mint inv() const { return pow(MOD - 2); }
mint &operator/=(const mint a) { return (*this) *= a.inv(); }
mint operator/(const mint a) const {
mint res(*this);
return res /= a;
}
};
struct combination {
vector<mint> fact, ifact;
combination(int n) : fact(n + 1), ifact(n + 1) {
// assert(n < MOD);
fact[0] = 1;
for (int i = 1; i <= n; ++i)
fact[i] = fact[i - 1] * i;
ifact[n] = fact[n].inv();
for (int i = n; i >= 1; --i)
ifact[i - 1] = ifact[i] * i;
}
mint operator()(int n, int k) {
if (k < 0 || k > n)
return 0;
return fact[n] * ifact[k] * ifact[n - k];
}
};
struct edge {
ll to, cost;
};
ll gcd(ll a, ll b) {
if (a < b)
swap(a, b);
if (b == 0)
return a;
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
ll lcm(ll a, ll b) {
ll g = gcd(a, b);
return a * b / g;
}
bool prime(ll n) {
for (ll i = 2; i <= sqrt(n); i++) {
if (n % i == 0)
return false;
}
return n != 1;
}
map<ll, ll> prime_factor(ll n) {
map<ll, ll> ret;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
vector<pair<char, int>> RunLength(string s) {
if (s.size() == 0)
return {};
vector<pair<char, int>> res(1, pair<char, int>(s[0], 0));
for (char p : s) {
if (res.back().first == p) {
res.back().second++;
} else {
res.emplace_back(p, 1);
}
}
return res;
}
// Digit Count
int GetDigit(int num) { return log10(num) + 1; }
// bit calculation[how many "1"] (= __builtin_popcount())
int bit_count(int n) {
int cnt = 0;
while (n > 0) {
if (n % 2 == 1)
cnt++;
n /= 2;
}
return cnt;
}
mint POW(mint n, int p) {
if (p == 0)
return 1;
if (p % 2 == 0) {
mint t = POW(n, p / 2);
return t * t;
}
return n * POW(n, p - 1);
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// cout << fixed << setprecision(15);
int n, m;
cin >> n >> m;
VE ac(n), wa(n);
rep(i, n) {
int p;
string s;
cin >> p >> s;
p--;
if (s == "AC") {
ac[p] = 1;
} else {
if (ac[p] == 0) {
wa[p]++;
}
}
}
int ans = 0, ans2 = 0;
rep(i, n) {
if (ac[i]) {
ans++;
ans2 += wa[i];
}
}
cout << ans << endl << ans2 << endl;
return 0;
} | //
// じょえチャンネル
// 高評価・チャンネル登録よろしくお願いします!
// https://www.youtube.com/watch?v=gPFr7q7eLL8
//
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define P pair<ll, ll>
#define sz(x) (ll) x.size()
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define VE vector<ll>
#define COUT(x) cout << (x) << endl
#define MA map<ll, ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll, VE, greater<ll>>
#define COUT(x) cout << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define EPS (1e-10)
#define pb push_back
const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long INF = 1LL << 60;
const double PI = acos(-1.0);
using Graph = vector<VE>;
struct mint {
ll x; // typedef long long ll;
mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
mint operator-() const { return mint(-x); }
mint &operator+=(const mint a) {
if ((x += a.x) >= MOD)
x -= MOD;
return *this;
}
mint &operator-=(const mint a) {
if ((x += MOD - a.x) >= MOD)
x -= MOD;
return *this;
}
mint &operator*=(const mint a) {
(x *= a.x) %= MOD;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res += a;
}
mint operator-(const mint a) const {
mint res(*this);
return res -= a;
}
mint operator*(const mint a) const {
mint res(*this);
return res *= a;
}
mint pow(ll t) const {
if (!t)
return 1;
mint a = pow(t >> 1);
a *= a;
if (t & 1)
a *= *this;
return a;
}
// for prime MOD
mint inv() const { return pow(MOD - 2); }
mint &operator/=(const mint a) { return (*this) *= a.inv(); }
mint operator/(const mint a) const {
mint res(*this);
return res /= a;
}
};
struct combination {
vector<mint> fact, ifact;
combination(int n) : fact(n + 1), ifact(n + 1) {
// assert(n < MOD);
fact[0] = 1;
for (int i = 1; i <= n; ++i)
fact[i] = fact[i - 1] * i;
ifact[n] = fact[n].inv();
for (int i = n; i >= 1; --i)
ifact[i - 1] = ifact[i] * i;
}
mint operator()(int n, int k) {
if (k < 0 || k > n)
return 0;
return fact[n] * ifact[k] * ifact[n - k];
}
};
struct edge {
ll to, cost;
};
ll gcd(ll a, ll b) {
if (a < b)
swap(a, b);
if (b == 0)
return a;
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
ll lcm(ll a, ll b) {
ll g = gcd(a, b);
return a * b / g;
}
bool prime(ll n) {
for (ll i = 2; i <= sqrt(n); i++) {
if (n % i == 0)
return false;
}
return n != 1;
}
map<ll, ll> prime_factor(ll n) {
map<ll, ll> ret;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
vector<pair<char, int>> RunLength(string s) {
if (s.size() == 0)
return {};
vector<pair<char, int>> res(1, pair<char, int>(s[0], 0));
for (char p : s) {
if (res.back().first == p) {
res.back().second++;
} else {
res.emplace_back(p, 1);
}
}
return res;
}
// Digit Count
int GetDigit(int num) { return log10(num) + 1; }
// bit calculation[how many "1"] (= __builtin_popcount())
int bit_count(int n) {
int cnt = 0;
while (n > 0) {
if (n % 2 == 1)
cnt++;
n /= 2;
}
return cnt;
}
mint POW(mint n, int p) {
if (p == 0)
return 1;
if (p % 2 == 0) {
mint t = POW(n, p / 2);
return t * t;
}
return n * POW(n, p - 1);
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// cout << fixed << setprecision(15);
int n, m;
cin >> n >> m;
VE ac(n), wa(n);
rep(i, m) {
int p;
string s;
cin >> p >> s;
p--;
if (s == "AC") {
ac[p] = 1;
} else {
if (ac[p] == 0) {
wa[p]++;
}
}
}
int ans = 0, ans2 = 0;
rep(i, n) {
if (ac[i]) {
ans++;
ans2 += wa[i];
}
}
cout << ans << endl << ans2 << endl;
return 0;
} | replace | 239 | 240 | 239 | 240 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> cnt(m), b(n);
int res = 0;
for (int i = 0; i < m; i++) {
int p;
cin >> p, p--;
string c;
cin >> c;
if (c == "AC") {
if (b[p] == 0) {
b[p] = 1;
res += cnt[p];
}
}
if (c == "WA") {
cnt[p]++;
}
}
cout << accumulate(begin(b), end(b), 0) << " " << res << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> cnt(n), b(n);
int res = 0;
for (int i = 0; i < m; i++) {
int p;
cin >> p, p--;
string c;
cin >> c;
if (c == "AC") {
if (b[p] == 0) {
b[p] = 1;
res += cnt[p];
}
}
if (c == "WA") {
cnt[p]++;
}
}
cout << accumulate(begin(b), end(b), 0) << " " << res << endl;
return 0;
} | replace | 6 | 7 | 6 | 7 | 0 | |
p02802 | C++ | Runtime Error | #include <iostream>
#include <string>
#include <vector>
int main() {
int N = 0, M = 0;
std::cin >> N >> M;
int p;
std::string S;
std::vector<std::pair<bool, int>> c(N);
for (int i = 0; i < N; i++) {
c[i].first = false;
c[i].second = 0;
}
std::pair<int, int> ans;
for (int i = 0; i < M; i++) {
std::cin >> p >> S;
if (c[p - 1].first)
continue;
if (S == "AC") {
c[p - 1].first = true;
ans.first++;
ans.second += c[i].second;
} else if (S == "WA")
c[p - 1].second++;
}
std::cout << ans.first << " " << ans.second << std::endl;
return 0;
} | #include <iostream>
#include <string>
#include <vector>
int main() {
int N = 0, M = 0;
std::cin >> N >> M;
int p;
std::string S;
std::vector<std::pair<bool, int>> c(N);
for (int i = 0; i < N; i++) {
c[i].first = false;
c[i].second = 0;
}
std::pair<int, int> ans;
for (int i = 0; i < M; i++) {
std::cin >> p >> S;
if (c[p - 1].first)
continue;
if (S == "AC") {
c[p - 1].first = true;
ans.first++;
ans.second += c[p - 1].second;
} else if (S == "WA")
c[p - 1].second++;
}
std::cout << ans.first << " " << ans.second << std::endl;
return 0;
} | replace | 24 | 25 | 24 | 25 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb emplace_back
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) {
os << "{";
rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
os << "}";
return os;
}
template <typename T> T dup(T x, T y) { return (x + y - 1) / y; };
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
struct in {
const size_t n = 0;
in() = default;
in(size_t n) : n(n){};
template <typename T> operator T() {
T ret;
cin >> ret;
return ret;
}
template <typename T> operator vector<T>() {
assert(n != 0);
vector<T> ret(n);
for (auto &x : ret)
cin >> x;
return ret;
}
};
using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;
constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;
void Main() {
int n, m;
cin >> n >> m;
vint ac(n, 0);
vint wa(n, 0);
rep(i, m) {
int p = in();
--p;
string s = in();
if (s == "AC") {
ac[p] = 1;
} else {
if (!ac[p]) {
++wa[p];
}
}
}
int wacnt = 0;
rep(i, m) {
if (ac[i])
wacnt += wa[i];
}
cout << accumulate(ALL(ac), 0) << " " << wacnt << endl;
}
signed main() {
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(15);
Main();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb emplace_back
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) {
os << "{";
rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
os << "}";
return os;
}
template <typename T> T dup(T x, T y) { return (x + y - 1) / y; };
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
struct in {
const size_t n = 0;
in() = default;
in(size_t n) : n(n){};
template <typename T> operator T() {
T ret;
cin >> ret;
return ret;
}
template <typename T> operator vector<T>() {
assert(n != 0);
vector<T> ret(n);
for (auto &x : ret)
cin >> x;
return ret;
}
};
using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;
constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;
void Main() {
int n, m;
cin >> n >> m;
vint ac(n, 0);
vint wa(n, 0);
rep(i, m) {
int p = in();
--p;
string s = in();
if (s == "AC") {
ac[p] = 1;
} else {
if (!ac[p]) {
++wa[p];
}
}
}
int wacnt = 0;
rep(i, n) {
if (ac[i])
wacnt += wa[i];
}
cout << accumulate(ALL(ac), 0) << " " << wacnt << endl;
}
signed main() {
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(15);
Main();
return 0;
}
| replace | 83 | 84 | 83 | 84 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fast_IO \
ios::sync_with_stdio(0); \
cin.tie(0);
using namespace std;
int wa[10500];
bool ac[10500];
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
wa[i] = 0;
ac[i] = false;
}
int wan = 0, acn = 0;
int p;
string s;
while (m--) {
cin >> p >> s;
if (ac[p] == true)
continue;
if (s == "AC") {
ac[p] = true;
acn++;
wan += wa[p];
} else if (s == "WA") {
wa[p]++;
}
}
cout << acn << " " << wan << endl;
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fast_IO \
ios::sync_with_stdio(0); \
cin.tie(0);
using namespace std;
int wa[105000];
bool ac[105000];
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
wa[i] = 0;
ac[i] = false;
}
int wan = 0, acn = 0;
int p;
string s;
while (m--) {
cin >> p >> s;
if (ac[p] == true)
continue;
if (s == "AC") {
ac[p] = true;
acn++;
wan += wa[p];
} else if (s == "WA") {
wa[p]++;
}
}
cout << acn << " " << wan << endl;
return 0;
}
| replace | 8 | 10 | 8 | 10 | 0 | |
p02802 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <unordered_map>
typedef long long ll;
typedef long double ld;
using namespace std;
int main() {
ll n, m, p[100010], ac = 0, wa = 0;
string s[100010];
unordered_map<ll, int> score;
cin >> n >> m;
for (ll i = 0; i < m; ++i) {
cin >> p[i] >> s[i];
}
for (ll i = 0; i < m; ++i) {
if (s[i] == "AC" && score[p[i]] != 1) {
score[p[i]] = 1;
++ac;
for (ll j = i - 1; j >= 0; --j) {
if (s[j] == "WA" && p[i] == p[j])
++wa;
}
}
}
cout << ac << " " << wa;
}
| #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <unordered_map>
typedef long long ll;
typedef long double ld;
using namespace std;
int main() {
ll n, m, p[100010], ac = 0, wa = 0;
string s[100010];
unordered_map<ll, int> score;
cin >> n >> m;
for (ll i = 0; i < m; ++i) {
cin >> p[i] >> s[i];
}
for (ll i = 0; i < m; ++i) {
if (score[p[i]] != -1) {
if (s[i] == "WA")
++score[p[i]];
else {
wa += score[p[i]];
++ac;
score[p[i]] = -1;
}
}
}
cout << ac << " " << wa;
}
| replace | 23 | 29 | 23 | 30 | TLE | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <queue>
#include <stdio.h>
#include <string.h>
#define F first
#define S second
#define R cin >>
#define Z class
#define ll long long
#define ln cout << '\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n", a)
#define mem(a) memset(a, 0, sizeof(a))
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define tr(it, c) for (iter(c) it = (c).begin(); it != (c).end(); it++)
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll i, j, k, x, y, z, p, q;
ll n, m, tmp;
string s[200000];
string str;
ll sum = 0, ac = 0, wa = 0;
ll strr[200005];
cin >> m >> n;
if (n == 0) {
cout << 0 << " " << 0 << endl;
return 0;
} else {
vector<int> c(n);
vector<int> aced(n);
ll no;
rep(i, n) {
cin >> no;
cin >> str;
if (aced[no] == 1)
continue;
if (str[0] == 'W') {
c[no]++;
} else {
sum += c[no];
aced[no] = 1;
ac++;
}
}
cout << ac << " " << sum << endl;
return 0;
}
} | #include <bits/stdc++.h>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <queue>
#include <stdio.h>
#include <string.h>
#define F first
#define S second
#define R cin >>
#define Z class
#define ll long long
#define ln cout << '\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n", a)
#define mem(a) memset(a, 0, sizeof(a))
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define tr(it, c) for (iter(c) it = (c).begin(); it != (c).end(); it++)
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll i, j, k, x, y, z, p, q;
ll n, m, tmp;
string s[200000];
string str;
ll sum = 0, ac = 0, wa = 0;
ll strr[200005];
cin >> m >> n;
if (n == 0) {
cout << 0 << " " << 0 << endl;
return 0;
} else {
vector<int> c(m);
vector<int> aced(m);
ll no;
rep(i, n) {
cin >> no;
cin >> str;
if (aced[no] == 1)
continue;
if (str[0] == 'W') {
c[no]++;
} else {
sum += c[no];
aced[no] = 1;
ac++;
}
}
cout << ac << " " << sum << endl;
return 0;
}
} | replace | 41 | 43 | 41 | 43 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, h) for (int i = 0; i < h; ++i)
#define rep1(i, h) for (int i = 0; i <= h; ++i)
#define rep2(i, k, h) for (int i = k; i < h; ++i)
#define rep3(i, k, h) for (int i = k; i <= h; ++i)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf
typedef pair<int, int> int_pair;
typedef pair<string, string> string_pair;
int main() {
int n, m;
cin >> n >> m;
vector<int> ac(n), pena(n);
rep(i, m) {
int p;
string s;
cin >> p >> s;
--p;
if (ac[p])
continue;
if (s == "AC") {
ac[p] = 1;
} else {
pena[p]++;
}
}
int AC = 0, PENA = 0;
rep(i, m) {
AC += ac[i];
if (ac[i])
PENA += pena[i];
}
printf("%d %d\n", AC, PENA);
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, h) for (int i = 0; i < h; ++i)
#define rep1(i, h) for (int i = 0; i <= h; ++i)
#define rep2(i, k, h) for (int i = k; i < h; ++i)
#define rep3(i, k, h) for (int i = k; i <= h; ++i)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf
typedef pair<int, int> int_pair;
typedef pair<string, string> string_pair;
int main() {
int n, m;
cin >> n >> m;
vector<int> ac(n), pena(n);
rep(i, m) {
int p;
string s;
cin >> p >> s;
--p;
if (ac[p])
continue;
if (s == "AC") {
ac[p] = 1;
} else {
pena[p]++;
}
}
int AC = 0, PENA = 0;
rep(i, n) {
AC += ac[i];
if (ac[i])
PENA += pena[i];
}
printf("%d %d\n", AC, PENA);
} | replace | 33 | 34 | 33 | 34 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, p, tsum = 0, bsum = 0, csum = 0;
string s;
cin >> N >> M;
vector<bool> ac(N, false);
vector<int> acn(N, 0);
for (int i = 0; i < M; i++) {
s = "", p = -1;
cin >> p >> s;
if (p == -1)
break;
if (!(ac.at(p - 1))) {
if (s == "AC") {
ac.at(p - 1) = true;
tsum += 1;
} else if (s == "WA") {
acn.at(p - 1) = acn.at(p - 1) + 1;
}
}
}
for (int i = 0; i < M; i++) {
if (ac.at(i)) {
csum += acn.at(i);
}
}
cout << tsum << " " << csum << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, p, tsum = 0, bsum = 0, csum = 0;
string s;
cin >> N >> M;
vector<bool> ac(N, false);
vector<int> acn(N, 0);
for (int i = 0; i < M; i++) {
s = "", p = -1;
cin >> p >> s;
if (p == -1)
break;
if (!(ac.at(p - 1))) {
if (s == "AC") {
ac.at(p - 1) = true;
tsum += 1;
} else if (s == "WA") {
acn.at(p - 1) = acn.at(p - 1) + 1;
}
}
}
for (int i = 0; i < N; i++) {
if (ac.at(i)) {
csum += acn.at(i);
}
}
cout << tsum << " " << csum << endl;
}
| replace | 25 | 26 | 25 | 26 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector<bool>::_M_range_check: __n (which is 2) >= this->size() (which is 2)
|
p02802 | C++ | 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;
cin >> n >> m;
vector<int> ac(n), pena(n);
rep(i, m) {
int p;
string s;
cin >> p >> s;
if (ac.at(p))
continue;
if (s == "WA") {
pena.at(p)++;
} else {
ac.at(p) = 1;
}
}
int AC = 0;
int PENA = 0;
rep(i, n) {
AC += ac.at(i);
if (ac.at(i))
PENA += pena.at(i);
}
cout << AC << " " << PENA << endl;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> ac(n), pena(n);
rep(i, m) {
int p;
string s;
cin >> p >> s;
p--;
if (ac.at(p))
continue;
if (s == "WA") {
pena.at(p)++;
} else {
ac.at(p) = 1;
}
}
int AC = 0;
int PENA = 0;
rep(i, n) {
AC += ac.at(i);
if (ac.at(i))
PENA += pena.at(i);
}
cout << AC << " " << PENA << endl;
} | insert | 12 | 12 | 12 | 13 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 2) >= this->size() (which is 2)
|
p02802 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <cctype>
#include <cfloat>
#include <climits>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stdio.h>
#include <string>
#include <unordered_map>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), pt(n);
int ans = 0;
int PT = 0;
for (int i = 0; i < n; i++) {
a.at(i) = 0;
pt.at(i) = 0;
}
for (int i = 0; i < m; i++) {
int p;
string s;
cin >> p >> s;
if (!a.at(p - 1) && s == "AC") {
a.at(p - 1) = 1;
}
if (!a.at(p - 1) && s == "WA") {
pt.at(p - 1)++;
}
}
for (int i = 0; i < n; i++) {
if (a.at(i)) {
ans++;
PT += pt.at(i - 1);
}
}
cout << ans << " " << PT << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cctype>
#include <cfloat>
#include <climits>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stdio.h>
#include <string>
#include <unordered_map>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), pt(n);
int ans = 0;
int PT = 0;
for (int i = 0; i < n; i++) {
a.at(i) = 0;
pt.at(i) = 0;
}
for (int i = 0; i < m; i++) {
int p;
string s;
cin >> p >> s;
if (!a.at(p - 1) && s == "AC") {
a.at(p - 1) = 1;
}
if (!a.at(p - 1) && s == "WA") {
pt.at(p - 1)++;
}
}
for (int i = 0; i < n; i++) {
if (a.at(i)) {
ans++;
PT += pt.at(i);
}
}
cout << ans << " " << PT << endl;
return 0;
} | replace | 39 | 40 | 39 | 40 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 2)
|
p02802 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>
// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP
typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;
namespace tools {
template <typename T>
void read(::std::istream &is, ::std::vector<T> &vector,
const typename ::std::vector<T>::size_type size) {
vector.reserve(size);
::std::copy_n(::std::istream_iterator<T>(is), size,
::std::back_inserter(vector));
}
template <typename T>
void read(::std::vector<T> &vector,
const typename ::std::vector<T>::size_type size) {
::tools::read(::std::cin, vector, size);
}
template <typename T, ::std::size_t N>
void read(::std::istream &is, ::std::array<T, N> &array) {
::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
}
template <typename T, ::std::size_t N> void read(::std::array<T, N> &array) {
::tools::read(::std::cin, array);
}
} // namespace tools
#endif
// main.cpp
int main() {
i64 N, M;
std::cin >> N >> M;
std::vector<i64> passed(N, false);
std::vector<i64> penalties(N, 0);
for (i64 i = 0; i < M; ++i) {
i64 p;
std::string S;
std::cin >> p >> S;
--p;
if (!passed[p]) {
if (S == "AC") {
passed[p] = true;
} else {
++penalties[p];
}
}
}
for (i64 i = 0; i < M; ++i) {
if (!passed[i]) {
penalties[i] = 0;
}
}
std::cout << std::count(passed.begin(), passed.end(), true) << ' '
<< std::accumulate(penalties.begin(), penalties.end(),
static_cast<i64>(0))
<< std::endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>
// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP
typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;
namespace tools {
template <typename T>
void read(::std::istream &is, ::std::vector<T> &vector,
const typename ::std::vector<T>::size_type size) {
vector.reserve(size);
::std::copy_n(::std::istream_iterator<T>(is), size,
::std::back_inserter(vector));
}
template <typename T>
void read(::std::vector<T> &vector,
const typename ::std::vector<T>::size_type size) {
::tools::read(::std::cin, vector, size);
}
template <typename T, ::std::size_t N>
void read(::std::istream &is, ::std::array<T, N> &array) {
::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
}
template <typename T, ::std::size_t N> void read(::std::array<T, N> &array) {
::tools::read(::std::cin, array);
}
} // namespace tools
#endif
// main.cpp
int main() {
i64 N, M;
std::cin >> N >> M;
std::vector<i64> passed(N, false);
std::vector<i64> penalties(N, 0);
for (i64 i = 0; i < M; ++i) {
i64 p;
std::string S;
std::cin >> p >> S;
--p;
if (!passed[p]) {
if (S == "AC") {
passed[p] = true;
} else {
++penalties[p];
}
}
}
for (i64 i = 0; i < N; ++i) {
if (!passed[i]) {
penalties[i] = 0;
}
}
std::cout << std::count(passed.begin(), passed.end(), true) << ' '
<< std::accumulate(penalties.begin(), penalties.end(),
static_cast<i64>(0))
<< std::endl;
return 0;
} | replace | 63 | 64 | 63 | 64 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, m;
cin >> n >> m;
vector<int> ac(n), pena(n);
for (int i = 0; i < m; i++) {
int p;
string s;
cin >> p >> s;
p--;
if (ac[p] == 1)
continue;
if (s == "AC")
ac[p] = 1;
else
pena[p]++;
}
int AC = 0, PENA = 0;
for (int i = 0; i < m; i++) {
AC += ac[i];
if (ac[i] == 1)
PENA += pena[i];
}
printf("%d %d\n", AC, PENA);
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, m;
cin >> n >> m;
vector<int> ac(n), pena(n);
for (int i = 0; i < m; i++) {
int p;
string s;
cin >> p >> s;
p--;
if (ac[p] == 1)
continue;
if (s == "AC")
ac[p] = 1;
else
pena[p]++;
}
int AC = 0, PENA = 0;
for (int i = 0; i < n; i++) {
AC += ac[i];
if (ac[i] == 1)
PENA += pena[i];
}
printf("%d %d\n", AC, PENA);
}
| replace | 20 | 21 | 20 | 21 | 0 | |
p02802 | Python | Runtime Error | N, M = map(int, input().split())
accepted = [0] * N
penalties = [0] * N
for _ in range(M):
p, ac = input().split()
p, ac = int(p), ac == "AC"
accepted[p] |= ac
penalties[p] += not accepted[p]
print(sum(accepted), sum(p for ac, p in zip(accepted, penalties) if ac))
| N, M = map(int, input().split())
accepted = [0] * N
penalties = [0] * N
for _ in range(M):
p, ac = input().split()
p, ac = int(p) - 1, ac == "AC"
accepted[p] |= ac
penalties[p] += not accepted[p]
print(sum(accepted), sum(p for ac, p in zip(accepted, penalties) if ac))
| replace | 5 | 6 | 5 | 6 | IndexError: list index out of range | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02802/Python/s182965476.py", line 7, in <module>
accepted[p] |= ac
IndexError: list index out of range
|
p02802 | Python | Runtime Error | n, m = map(int, input().split())
scores = [[0, False] for _ in range(n)]
for _ in range(m):
p, S = input().split()
p = int(p)
if scores[p][1]:
continue
if S == "AC":
scores[p][1] = True
continue
if S == "WA":
scores[p][0] += 1
score = pena = 0
for count, ac in scores:
if ac:
score += 1
pena += count
print(score, pena)
| n, m = map(int, input().split())
scores = [[0, False] for _ in range(n + 1)]
for _ in range(m):
p, S = input().split()
p = int(p)
if scores[p][1]:
continue
if S == "AC":
scores[p][1] = True
continue
if S == "WA":
scores[p][0] += 1
score = pena = 0
for count, ac in scores:
if ac:
score += 1
pena += count
print(score, pena)
| replace | 2 | 3 | 2 | 3 | IndexError: list index out of range | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02802/Python/s650750562.py", line 9, in <module>
if scores[p][1]:
IndexError: list index out of range
|
p02802 | Python | Runtime Error | N, M = map(int, input().split())
pS = {}
for i in range(N):
pS[i] = [0, 0, 0] # is_ac, penatly, AC
for i in range(M):
p, S = input().split()
p = int(p) - 1
if pS[p][0] == 0 and S == "WA":
pS[p][1] += 1
elif pS[p][0] == 0 and S == "AC":
pS[p][0] = 1
pS[p][2] = 1
AC = 0
penatly = 0
for i in range(N):
if pS[p][0] == 1:
penatly += pS[int(i)][1]
AC += pS[int(i)][2]
print(AC, penatly)
| N, M = map(int, input().split())
pS = {}
for i in range(N):
pS[i] = [0, 0, 0] # is_ac, penatly, AC
for i in range(M):
p, S = input().split()
p = int(p) - 1
if pS[p][0] == 0 and S == "WA":
pS[p][1] += 1
elif pS[p][0] == 0 and S == "AC":
pS[p][0] = 1
pS[p][2] = 1
AC = 0
penatly = 0
for i in range(N):
if pS[i][0] == 1:
penatly += pS[int(i)][1]
AC += pS[int(i)][2]
print(AC, penatly)
| replace | 17 | 18 | 17 | 18 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main() {
int n, m;
cin >> n >> m;
vector<int> p(m + 1);
vector<string> s(m + 1);
for (int i = 1; i <= m; i++)
cin >> p[i] >> s[i];
vector<int> waNum(n + 1);
int acNum = 0;
vector<bool> ok(n + 1);
for (int i = 1; i <= m; i++) {
if (s[i] == "WA" && !ok[p[i]]) {
waNum[i]++;
}
if (s[i] == "AC" && !ok[p[i]]) {
acNum++;
ok[p[i]] = true;
}
}
int waAns = 0;
for (int i = 1; i <= n; i++) {
if (!ok[i])
continue;
waAns += waNum[i];
}
cout << acNum << " " << waAns << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main() {
int n, m;
cin >> n >> m;
vector<int> p(m + 1);
vector<string> s(m + 1);
for (int i = 1; i <= m; i++)
cin >> p[i] >> s[i];
vector<int> waNum(n + 1);
int acNum = 0;
vector<bool> ok(n + 1);
for (int i = 1; i <= m; i++) {
if (s[i] == "WA" && !ok[p[i]]) {
waNum[p[i]]++;
}
if (s[i] == "AC" && !ok[p[i]]) {
acNum++;
ok[p[i]] = true;
}
}
int waAns = 0;
for (int i = 1; i <= n; i++) {
if (!ok[i])
continue;
waAns += waNum[i];
}
cout << acNum << " " << waAns << endl;
} | replace | 16 | 17 | 16 | 17 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n - 1); i >= 0; i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector<vector<ll>>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
// 0 false, 1 true
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ ceil(a)
int main() {
ll n, m;
cin >> n >> m;
vector<ll> ac(n);
vector<ll> wa(n);
rep(i, m) {
ll p;
string s;
cin >> p >> s;
if (s == "AC") {
ac.at(p)++;
}
if (s == "WA") {
if (ac.at(p) == 0) {
wa.at(p)++;
}
}
}
ll ac_ans = 0;
ll wa_ans = 0;
rep(i, n) {
if (ac.at(i) != 0) {
ac_ans++;
wa_ans += wa.at(i);
}
}
cout << ac_ans << " " << wa_ans << endl;
}
| #include <bits/stdc++.h>
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n - 1); i >= 0; i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector<vector<ll>>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
// 0 false, 1 true
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ ceil(a)
int main() {
ll n, m;
cin >> n >> m;
vector<ll> ac(n);
vector<ll> wa(n);
rep(i, m) {
ll p;
string s;
cin >> p >> s;
p--;
if (s == "AC") {
ac.at(p)++;
}
if (s == "WA") {
if (ac.at(p) == 0) {
wa.at(p)++;
}
}
}
ll ac_ans = 0;
ll wa_ans = 0;
rep(i, n) {
if (ac.at(i) != 0) {
ac_ans++;
wa_ans += wa.at(i);
}
}
cout << ac_ans << " " << wa_ans << endl;
}
| insert | 40 | 40 | 40 | 41 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 2) >= this->size() (which is 2)
|
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;
int main(void) {
ll N, M;
cin >> N >> M;
vector<ll> wacount(N + 1, 0), account(N + 1, 0);
for (ll i = 0; i < M; i++) {
ll p;
string S;
cin >> p >> S;
if (account[p] != 0) {
continue;
}
if (S == "WA") {
wacount[p]++;
} else if (S == "AC") {
account[p]++;
}
}
ll answa = 0;
for (ll p = 1; p <= M; p++) {
if (account[p]) {
answa += wacount[p];
}
}
cout << accumulate(account.begin(), account.end(), 0) << " " << answa << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;
int main(void) {
ll N, M;
cin >> N >> M;
vector<ll> wacount(N + 1, 0), account(N + 1, 0);
for (ll i = 0; i < M; i++) {
ll p;
string S;
cin >> p >> S;
if (account[p] != 0) {
continue;
}
if (S == "WA") {
wacount[p]++;
} else if (S == "AC") {
account[p]++;
}
}
ll answa = 0;
for (ll p = 1; p <= N; p++) {
if (account[p]) {
answa += wacount[p];
}
}
cout << accumulate(account.begin(), account.end(), 0) << " " << answa << endl;
return 0;
}
| replace | 25 | 26 | 25 | 26 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;
int main() {
int N, M;
cin >> N >> M;
vi AC(M), WA(N);
int ac = 0, wa = 0;
rep(i, M) {
int p;
string S;
cin >> p >> S;
if (S == "AC") {
if (AC.at(p - 1) == 0) {
ac++;
wa += WA.at(p - 1);
}
AC.at(p - 1) = 1;
} else {
WA.at(p - 1)++;
}
}
cout << ac << " " << wa << endl;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;
int main() {
int N, M;
cin >> N >> M;
vi AC(N), WA(N);
int ac = 0, wa = 0;
rep(i, M) {
int p;
string S;
cin >> p >> S;
if (S == "AC") {
if (AC.at(p - 1) == 0) {
ac++;
wa += WA.at(p - 1);
}
AC.at(p - 1) = 1;
} else {
WA.at(p - 1)++;
}
}
cout << ac << " " << wa << endl;
} | replace | 18 | 19 | 18 | 19 | 0 | |
p02802 | C++ | Runtime Error |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define PB pop_back
#define nn "\n"
#define O_O \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define all(p) p.begin(), p.end()
#define zz(v) v.size()
#define ss ' '
#define S(a) scanf("%lld", &a)
#define SS(a, b) scanf("%lld %lld", &a, &b)
#define SSS(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define pi acos(-1.0)
typedef long long ll;
typedef vector<ll> vll;
ll a[100500] = {0};
string b[100500];
int main() {
// O_O ;
ll n, m, temp = 0, temp2 = 0, temp3, w[10000] = {0}, ans = 0;
cin >> n >> m;
for (ll i = 1; i <= m; i++) {
cin >> temp3;
// a[temp3];
cin >> b[temp3];
// cout<<a[temp3]<<nn;
if (a[temp3] == 0 && b[temp3] == "WA") {
w[temp3]++;
}
else if (a[temp3] == 0 && b[temp3] == "AC") {
temp++;
a[temp3] = 1;
ans = ans + w[temp3];
// cout<<temp<<nn;
}
}
cout << temp << " " << ans << nn;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define PB pop_back
#define nn "\n"
#define O_O \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define all(p) p.begin(), p.end()
#define zz(v) v.size()
#define ss ' '
#define S(a) scanf("%lld", &a)
#define SS(a, b) scanf("%lld %lld", &a, &b)
#define SSS(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define pi acos(-1.0)
typedef long long ll;
typedef vector<ll> vll;
ll a[100500] = {0};
string b[100500];
int main() {
// O_O ;
ll n, m, temp = 0, temp2 = 0, temp3, w[100000] = {0}, ans = 0;
cin >> n >> m;
for (ll i = 1; i <= m; i++) {
cin >> temp3;
// a[temp3];
cin >> b[temp3];
// cout<<a[temp3]<<nn;
if (a[temp3] == 0 && b[temp3] == "WA") {
w[temp3]++;
}
else if (a[temp3] == 0 && b[temp3] == "AC") {
temp++;
a[temp3] = 1;
ans = ans + w[temp3];
// cout<<temp<<nn;
}
}
cout << temp << " " << ans << nn;
return 0;
}
| replace | 26 | 27 | 26 | 27 | 0 | |
p02802 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int, int>
#define heap priority_queue
#define all(k) k.begin(), k.end()
#define rall(k) k.rbegin(), k.rend()
#define len(v) ((int)v.size())
#define fa(a, c) for (auto &a : c)
#define endl '\n'
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
vector<int> ac(11111);
vector<int> wa(111111);
string sit;
int p;
int pen = 0, acs = 0;
cin >> n >> m;
while (m--) {
cin >> p >> sit;
if (sit == "AC" and !ac[p]) {
ac[p] = 1;
pen += wa[p];
} else if (sit == "WA") {
wa[p]++;
}
}
fa(b, ac) acs += b;
cout << acs << ' ' << pen << endl;
}
| #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int, int>
#define heap priority_queue
#define all(k) k.begin(), k.end()
#define rall(k) k.rbegin(), k.rend()
#define len(v) ((int)v.size())
#define fa(a, c) for (auto &a : c)
#define endl '\n'
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
vector<int> ac(111111);
vector<int> wa(111111);
string sit;
int p;
int pen = 0, acs = 0;
cin >> n >> m;
while (m--) {
cin >> p >> sit;
if (sit == "AC" and !ac[p]) {
ac[p] = 1;
pen += wa[p];
} else if (sit == "WA") {
wa[p]++;
}
}
fa(b, ac) acs += b;
cout << acs << ' ' << pen << endl;
}
| replace | 30 | 31 | 30 | 31 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define el endl
typedef long long ll;
typedef long double ld;
int main() {
struct s {
bool is_ac;
int penalty;
};
int n, m, pena = 0, ac = 0;
cin >> n >> m;
vector<s> sv(n);
rep(i, m) {
int p_n;
string res;
cin >> p_n;
cin >> res;
if (res == "AC") {
if (!sv[p_n].is_ac) {
sv[p_n].is_ac = true;
ac++;
pena += sv[p_n].penalty;
}
} else {
sv[p_n].penalty++;
}
}
cout << ac << " " << pena << el;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define el endl
typedef long long ll;
typedef long double ld;
int main() {
struct s {
bool is_ac;
int penalty;
};
int n, m, pena = 0, ac = 0;
cin >> n >> m;
vector<s> sv(n);
rep(i, m) {
int p_n;
string res;
cin >> p_n;
cin >> res;
p_n--;
if (res == "AC") {
if (!sv[p_n].is_ac) {
sv[p_n].is_ac = true;
ac++;
pena += sv[p_n].penalty;
}
} else {
sv[p_n].penalty++;
}
}
cout << ac << " " << pena << el;
}
| insert | 24 | 24 | 24 | 26 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, m, ans, wa, i, b;
cin >> n >> m;
ll w[n];
wa = 0;
ans = 0;
for (i = 0; i <= m; i++) {
w[i] = 0;
}
string c;
for (i = 0; i < m; i++) {
cin >> b >> c;
if (w[b] != -1) {
if (c == "WA") {
w[b] += 1;
}
if (c == "AC") {
wa += w[b];
w[b] = -1;
ans += 1;
}
}
}
cout << ans << " " << wa;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, m, ans, wa, i, b;
cin >> n >> m;
ll w[n];
wa = 0;
ans = 0;
for (i = 0; i <= n; i++) {
w[i] = 0;
}
string c;
for (i = 0; i < m; i++) {
cin >> b >> c;
if (w[b] != -1) {
if (c == "WA") {
w[b] += 1;
}
if (c == "AC") {
wa += w[b];
w[b] = -1;
ans += 1;
}
}
}
cout << ans << " " << wa;
} | replace | 10 | 11 | 10 | 11 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
// #define DEBUG
int main(void) {
ll N, M;
cin >> N >> M;
vector<ll> p(M);
vector<string> S(M);
vector<bool> isCorrectProb(N, false); // 問題(i)が正当したか否か
ll correct_ans_num = 0; // 正答数
vector<ll> kai_correct_ans_num(N, 0); // 正当したらtrueに
ll ng_ans_to_correct_num = 0; // 正答までの失敗数
for (ll i = 0; i < M; i++) {
cin >> p[i] >> S[i]; // 代入
// 注意! 正当済みの場合、カウントしない
if (isCorrectProb[p[i]] == true) {
continue;
}
// 失敗の場合、失敗数をカウント
// if(S[i] == "WA")
if (equal(S[i].begin(), S[i].end(), "WA") == true) {
// ng_ans_to_correct_num++;
kai_correct_ans_num[p[i]]++; // 最後にtrueになるかチェック
} else {
correct_ans_num++;
isCorrectProb[p[i]] = true;
ng_ans_to_correct_num += kai_correct_ans_num[p[i]];
}
}
cout << correct_ans_num << " " << ng_ans_to_correct_num;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
// #define DEBUG
int main(void) {
ll N, M;
cin >> N >> M;
vector<ll> p(M);
vector<string> S(M);
vector<bool> isCorrectProb(N + 1, false); // 問題(i)が正当したか否か
ll correct_ans_num = 0; // 正答数
vector<ll> kai_correct_ans_num(N + 1, 0); // 正当したらtrueに
ll ng_ans_to_correct_num = 0; // 正答までの失敗数
for (ll i = 0; i < M; i++) {
cin >> p[i] >> S[i]; // 代入
// 注意! 正当済みの場合、カウントしない
if (isCorrectProb[p[i]] == true) {
continue;
}
// 失敗の場合、失敗数をカウント
// if(S[i] == "WA")
if (equal(S[i].begin(), S[i].end(), "WA") == true) {
// ng_ans_to_correct_num++;
kai_correct_ans_num[p[i]]++; // 最後にtrueになるかチェック
} else {
correct_ans_num++;
isCorrectProb[p[i]] = true;
ng_ans_to_correct_num += kai_correct_ans_num[p[i]];
}
}
cout << correct_ans_num << " " << ng_ans_to_correct_num;
return 0;
} | replace | 13 | 17 | 13 | 17 | 0 | |
p02802 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
while (true) {
int m, n;
cin >> m >> n;
map<int, int> was;
map<int, int> acs;
int sum = 0;
for (int i = 0; i < n; i++) {
int a;
string b;
cin >> a >> b;
if (b == "WA")
was[a]++;
else {
if (!acs.count(a))
sum += was[a];
acs[a] = 1;
}
}
cout << acs.size() << " " << sum << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
// while(true)
{
int m, n;
cin >> m >> n;
map<int, int> was;
map<int, int> acs;
int sum = 0;
for (int i = 0; i < n; i++) {
int a;
string b;
cin >> a >> b;
if (b == "WA")
was[a]++;
else {
if (!acs.count(a))
sum += was[a];
acs[a] = 1;
}
}
cout << acs.size() << " " << sum << endl;
}
return 0;
} | replace | 4 | 5 | 4 | 6 | TLE | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int, int>
#define fo(i, a, b) for (reg i = a; i <= b; i++)
#define fd(i, a, b) for (reg i = a; i >= b; i--)
#define cr const reg &
using namespace std;
const int inf = 2147483647;
const int N = 101;
I int _max(cr x, cr y) { return x > y ? x : y; }
I int _min(cr x, cr y) { return x < y ? x : y; }
I int read() {
reg x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
return x * f;
}
I void ptt(cr x) {
if (x >= 10)
ptt(x / 10);
putchar(x % 10 + '0');
}
I void put(cr x) { x < 0 ? putchar('-'), ptt(-x) : ptt(x); }
I void pr1(cr x) { put(x), putchar(' '); }
I void pr2(cr x) { put(x), puts(""); }
bool ok[N];
int cnt[N];
int main() {
int n = read(), m = read();
int A = 0, B = 0;
while (m--) {
int now = read();
string s;
cin >> s;
if (s == "AC") {
if (!ok[now]) {
ok[now] = 1, A++, B += cnt[now];
}
} else {
cnt[now]++;
}
}
pr1(A), pr2(B);
}
| #include <bits/stdc++.h>
#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int, int>
#define fo(i, a, b) for (reg i = a; i <= b; i++)
#define fd(i, a, b) for (reg i = a; i >= b; i--)
#define cr const reg &
using namespace std;
const int inf = 2147483647;
const int N = 1e5 + 1;
I int _max(cr x, cr y) { return x > y ? x : y; }
I int _min(cr x, cr y) { return x < y ? x : y; }
I int read() {
reg x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
return x * f;
}
I void ptt(cr x) {
if (x >= 10)
ptt(x / 10);
putchar(x % 10 + '0');
}
I void put(cr x) { x < 0 ? putchar('-'), ptt(-x) : ptt(x); }
I void pr1(cr x) { put(x), putchar(' '); }
I void pr2(cr x) { put(x), puts(""); }
bool ok[N];
int cnt[N];
int main() {
int n = read(), m = read();
int A = 0, B = 0;
while (m--) {
int now = read();
string s;
cin >> s;
if (s == "AC") {
if (!ok[now]) {
ok[now] = 1, A++, B += cnt[now];
}
} else {
cnt[now]++;
}
}
pr1(A), pr2(B);
}
| replace | 15 | 16 | 15 | 16 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;
int main() {
int n, m;
cin >> n >> m;
vector<int> p(m);
vector<string> s(m);
for (int i = 0; i < m; i++)
cin >> p[i] >> s[i];
vector<bool> a(n, false); // n問の問題
vector<int> k(n, 0);
int ac = 0;
int wa = 0;
for (int i = 0; i < m; i++) {
if (a[p[i] - 1] == false) {
if (s[i] == "WA")
k[p[i] - 1]++;
if (s[i] == "AC") {
a[p[i] - 1] = true;
ac++;
}
}
}
for (int i = 0; i < n; i++) {
if (a[i] == true) {
wa += k[p[i] - 1];
}
}
cout << ac << " " << wa << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;
int main() {
int n, m;
cin >> n >> m;
vector<int> p(m);
vector<string> s(m);
for (int i = 0; i < m; i++)
cin >> p[i] >> s[i];
vector<bool> a(n, false); // n問の問題
vector<int> k(n, 0);
int ac = 0;
int wa = 0;
for (int i = 0; i < m; i++) {
if (a[p[i] - 1] == false) {
if (s[i] == "WA")
k[p[i] - 1]++;
if (s[i] == "AC") {
a[p[i] - 1] = true;
ac++;
}
}
}
for (int i = 0; i < n; i++) {
if (a[i] == true) {
wa += k[i];
}
}
cout << ac << " " << wa << endl;
}
| replace | 35 | 36 | 35 | 36 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
for (auto v : (V)) \
cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */
int main() {
/* code */
int N, M;
cin >> N >> M;
vector<int> P(M);
vector<string> S(M);
REP(i, M) { cin >> P[i] >> S[i]; }
ll ac = 0LL, wa = 0LL;
set<int> ACed;
vector<int> WABuf(M + 100);
REP(i, M) {
if (ACed.find((P[i])) != ACed.end()) {
continue;
}
if (S[i] == "AC") {
ACed.insert(P[i]);
++ac;
wa += WABuf[P[i]];
} else {
WABuf[P[i]]++;
}
}
cout << ac << " " << wa << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
for (auto v : (V)) \
cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */
int main() {
/* code */
int N, M;
cin >> N >> M;
vector<int> P(M);
vector<string> S(M);
REP(i, M) { cin >> P[i] >> S[i]; }
ll ac = 0LL, wa = 0LL;
set<int> ACed;
vector<int> WABuf(N + 1, 0);
REP(i, M) {
if (ACed.find((P[i])) != ACed.end()) {
continue;
}
if (S[i] == "AC") {
ACed.insert(P[i]);
++ac;
wa += WABuf[P[i]];
} else {
WABuf[P[i]]++;
}
}
cout << ac << " " << wa << endl;
return 0;
} | replace | 22 | 23 | 22 | 23 | 0 | |
p02802 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;
int main() {
int N, M;
cin >> N >> M;
vector<bool> isACs(N, false);
vector<int> WANums(N, 0);
int penaltyNum = 0;
for (int i = 0; i < M; ++i) {
int pi;
cin >> pi;
--pi;
string Si;
cin >> Si;
if (Si == "AC") {
if (isACs[pi])
continue;
penaltyNum += WANums[pi];
isACs[pi] = true;
} else {
++WANums[i];
}
}
int ACNum = count_if(isACs.begin(), isACs.end(),
[](const bool isAC) { return isAC; });
cout << ACNum << ' ' << penaltyNum << '\n';
}
| #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;
int main() {
int N, M;
cin >> N >> M;
vector<bool> isACs(N, false);
vector<int> WANums(N, 0);
int penaltyNum = 0;
for (int i = 0; i < M; ++i) {
int pi;
cin >> pi;
--pi;
string Si;
cin >> Si;
if (Si == "AC") {
if (isACs[pi])
continue;
penaltyNum += WANums[pi];
isACs[pi] = true;
} else {
++WANums[pi];
}
}
int ACNum = count_if(isACs.begin(), isACs.end(),
[](const bool isAC) { return isAC; });
cout << ACNum << ' ' << penaltyNum << '\n';
}
| replace | 35 | 36 | 35 | 36 | 0 | |
p02802 | C++ | Runtime Error | /*---> 16 January 2020 <--- > 12:06:36 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
// #pragma GCC target ("sse4")
#include <bits/stdc++.h>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
// template <class T> using Tree = tree<T, null_type, less<T>,
// rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18 + 5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define __ \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int, int>>
#define vvi vector<vector<int>>
#define PRINT_TIME \
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \
c i) {
sim > struct rge {
c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i;
ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int, int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N = 1e5 + 5;
int prob[N], pen[N];
int32_t main() {
__ int n, m;
cin >> n >> m;
int x;
string s;
int ans = 0;
for (int i = 0; i < m; i++) {
cin >> x >> s;
if (s == "WA") {
if (!prob[x])
pen[x]++;
} else {
if (!prob[x])
ans++;
prob[x] = 1;
}
}
cout << ans << " ";
ans = 0;
for (int i = 1; i <= n; i++) {
if (prob[x])
ans += pen[x];
}
cout << ans << "\n";
return 0;
} | /*---> 16 January 2020 <--- > 12:06:36 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
// #pragma GCC target ("sse4")
#include <bits/stdc++.h>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
// template <class T> using Tree = tree<T, null_type, less<T>,
// rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18 + 5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define __ \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int, int>>
#define vvi vector<vector<int>>
#define PRINT_TIME \
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \
c i) {
sim > struct rge {
c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i;
ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int, int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N = 1e5 + 5;
int prob[N], pen[N];
int32_t main() {
__ int n, m;
cin >> n >> m;
int x;
string s;
int ans = 0;
for (int i = 0; i < m; i++) {
cin >> x >> s;
if (s == "WA") {
if (!prob[x])
pen[x]++;
} else {
if (!prob[x])
ans++;
prob[x] = 1;
}
}
cout << ans << " ";
ans = 0;
for (int i = 1; i <= n; i++) {
if (prob[i])
ans += pen[i];
}
cout << ans << "\n";
return 0;
} | replace | 92 | 94 | 92 | 94 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#include <cmath>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> func(int64_t x) {
vector<pair<int64_t, int64_t>> p;
for (int64_t i = 2; i * i <= x; i++) {
int cnt = 0;
if (x % i == 0) {
while (x % i == 0) {
cnt++;
x /= i;
}
p.push_back(make_pair(i, cnt));
}
}
if (x != 1) {
p.push_back(make_pair(x, 1));
}
return p;
}
int main() {
int N, M;
cin >> N >> M;
vector<bool> ok(N, false);
vector<int> wa(M);
int W = 0, A = 0;
for (int i = 0; i < M; i++) {
int p;
string s;
cin >> p >> s;
if (ok[p]) {
continue;
}
if (s == "AC") {
A++;
W += wa[p];
ok[p] = true;
} else {
wa[p]++;
}
}
cout << A << " " << W << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#include <cmath>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> func(int64_t x) {
vector<pair<int64_t, int64_t>> p;
for (int64_t i = 2; i * i <= x; i++) {
int cnt = 0;
if (x % i == 0) {
while (x % i == 0) {
cnt++;
x /= i;
}
p.push_back(make_pair(i, cnt));
}
}
if (x != 1) {
p.push_back(make_pair(x, 1));
}
return p;
}
int main() {
int N, M;
cin >> N >> M;
vector<bool> ok(N, false);
vector<int> wa(N);
int W = 0, A = 0;
for (int i = 0; i < M; i++) {
int p;
string s;
cin >> p >> s;
if (ok[p]) {
continue;
}
if (s == "AC") {
A++;
W += wa[p];
ok[p] = true;
} else {
wa[p]++;
}
}
cout << A << " " << W << endl;
return 0;
} | replace | 41 | 42 | 41 | 42 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
int main() {
int64_t n, m, ans, penalty;
int64_t p;
string s;
ans = 0;
penalty = 0;
cin >> n >> m;
vector<int> ac(n);
vector<int> wa(n);
for (int64_t i = 0; i < n; i++) {
ac.at(i) = 0;
wa.at(i) = 0;
}
// vector<int> p(m);
// vector<string> s(m);
// vector<int> a(n-1);
for (int i = 0; i < m; i++) {
// cin>>p.at(i);
// cin>>s.at(i);
cin >> p;
cin >> s;
if (s == "AC" && ac.at(p - 1) == 0) {
ac.at(p - 1) = 1;
ans += 1;
} else if (s == "WA" && ac.at(p - 1) == 0) {
penalty += 1;
wa.at(p - 1) += 1;
}
}
for (int i = 0; i < n; i++) {
if (ac.at(i) == 0)
penalty -= wa.at(p - 1);
}
cout << ans << " " << penalty << endl;
} | #include <bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
int main() {
int64_t n, m, ans, penalty;
int64_t p;
string s;
ans = 0;
penalty = 0;
cin >> n >> m;
vector<int> ac(n);
vector<int> wa(n);
for (int64_t i = 0; i < n; i++) {
ac.at(i) = 0;
wa.at(i) = 0;
}
// vector<int> p(m);
// vector<string> s(m);
// vector<int> a(n-1);
for (int i = 0; i < m; i++) {
// cin>>p.at(i);
// cin>>s.at(i);
cin >> p;
cin >> s;
if (s == "AC" && ac.at(p - 1) == 0) {
ac.at(p - 1) = 1;
ans += 1;
} else if (s == "WA" && ac.at(p - 1) == 0) {
penalty += 1;
wa.at(p - 1) += 1;
}
}
for (int i = 0; i < n; i++) {
if (ac.at(i) == 0)
penalty -= wa.at(i);
}
cout << ans << " " << penalty << endl;
} | replace | 39 | 40 | 39 | 40 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> ac(N - 1, 0), wa(N - 1, 0);
int num;
string result;
int ac_cnt = 0, wa_cnt = 0;
for (int i = 0; i < M; i++) {
cin >> num >> result;
if (result == "AC") {
if (ac[num - 1] == 1) {
continue;
} else {
ac[num - 1] = 1;
ac_cnt += 1;
wa_cnt += wa[num - 1];
}
} else {
if (ac[num - 1] == 1) {
continue;
} else {
wa[num - 1] = wa[num - 1] + 1;
}
}
}
cout << ac_cnt << " " << wa_cnt << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> ac(N, 0), wa(N, 0);
int num;
string result;
int ac_cnt = 0, wa_cnt = 0;
for (int i = 0; i < M; i++) {
cin >> num >> result;
if (result == "AC") {
if (ac[num - 1] == 1) {
continue;
} else {
ac[num - 1] = 1;
ac_cnt += 1;
wa_cnt += wa[num - 1];
}
} else {
if (ac[num - 1] == 1) {
continue;
} else {
wa[num - 1] = wa[num - 1] + 1;
}
}
}
cout << ac_cnt << " " << wa_cnt << endl;
}
| replace | 7 | 8 | 7 | 8 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define N 200100
#define pii pair<int, int>
#define rep(i, k, n) for (int i = k; i < n; i++)
#define vi vector<int>
#define inf 1e9
void solve() {
int n, m;
cin >> n >> m;
map<int, int> mp;
map<int, bool> ms;
ll ans = 0;
ll acs = 0;
while (m--) {
int x;
string s;
cin >> x >> s;
if (s == "AC" && ms[x] == false) {
ans += mp[x];
acs++;
ms[x] = true;
} else if (s == "WA") {
mp[x]++;
}
}
cout << acs << " " << ans << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w+", stdout);
#endif
solve();
} | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define N 200100
#define pii pair<int, int>
#define rep(i, k, n) for (int i = k; i < n; i++)
#define vi vector<int>
#define inf 1e9
void solve() {
int n, m;
cin >> n >> m;
map<int, int> mp;
map<int, bool> ms;
ll ans = 0;
ll acs = 0;
while (m--) {
int x;
string s;
cin >> x >> s;
if (s == "AC" && ms[x] == false) {
ans += mp[x];
acs++;
ms[x] = true;
} else if (s == "WA") {
mp[x]++;
}
}
cout << acs << " " << ans << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
} | delete | 34 | 38 | 34 | 34 | 0 | |
p02802 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define P pair<int, int>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<P> judge(n);
int ac = 0, wa = 0;
rep(i, m) {
int p;
cin >> p;
string s;
cin >> s;
if (s == "AC" && judge[p].first == 0) {
judge[p].first++;
ac++;
wa += judge[p].second;
} else
judge[p].second++;
}
cout << ac << " " << wa << endl;
return 0;
} | #include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define P pair<int, int>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<P> judge(n);
int ac = 0, wa = 0;
rep(i, m) {
int p;
cin >> p;
p--;
string s;
cin >> s;
if (s == "AC" && judge[p].first == 0) {
judge[p].first++;
ac++;
wa += judge[p].second;
} else
judge[p].second++;
}
cout << ac << " " << wa << endl;
return 0;
}
| insert | 14 | 14 | 14 | 15 | 0 | |
p02802 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using ll = long long;
#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)
using namespace std;
int digit(int n) { return (int)(log10(n) + 1); }
// 152-d
int main() {
int n, m;
cin >> n >> m;
int sucsum = 0, missum = 0;
int p;
string s;
vector<int> miscnt(m, 0);
vector<bool> misflg(m, false);
rep(i, 0, m) {
cin >> p >> s;
p--;
if (s == "AC" && misflg[p] == false) {
sucsum++;
missum += miscnt[p];
misflg[p] = true;
} else {
miscnt[p]++;
}
}
cout << sucsum << " " << missum << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using ll = long long;
#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)
using namespace std;
int digit(int n) { return (int)(log10(n) + 1); }
// 152-d
int main() {
int n, m;
cin >> n >> m;
int sucsum = 0, missum = 0;
int p;
string s;
vector<int> miscnt(n, 0);
vector<bool> misflg(n, false);
rep(i, 0, m) {
cin >> p >> s;
p--;
if (s == "AC" && misflg[p] == false) {
sucsum++;
missum += miscnt[p];
misflg[p] = true;
} else {
miscnt[p]++;
}
}
cout << sucsum << " " << missum << endl;
return 0;
}
| replace | 23 | 25 | 23 | 25 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.