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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
p03115 | C++ | Time Limit Exceeded | %:pragma GCC optimize("Ofast", "inline")
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i++)
#define re0(i, n) for (rint i = 0; i < (int)n; i++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
typedef long long lo;
template <typename tp> inline void read(tp &x) {
x = 0;
char c = getchar();
int f = 0;
for (; c < '0' || c > '9'; f |= c == '-', c = getchar())
;
for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar())
;
if (f)
x = -x;
}
#define int long long
const int N = 1e5 + 233;
const int inf = -5e17;
int n, x[N], y[N], qy;
signed main(void) {
srand(20021214);
read(n);
rep(i, n) read(x[i]), read(y[i]);
auto isBlack = [&](int o) {
bool pa = 0;
rep(i, n) if (y[i] <= o && o <= x[i] + y[i] - inf) {
int nc = x[i] - inf;
int mc = o - y[i];
pa ^= nc == (nc | mc);
}
return pa;
};
while (!isBlack(qy = (y[rand() % n + 1] + rand() % 10)))
;
for (int k = 61; k >= 0; k--) {
if (isBlack(qy + (1ll << k))) {
qy |= 1ll << k;
}
}
cout << qy + inf << "\n";
}
| %:pragma GCC optimize("Ofast", "inline")
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i++)
#define re0(i, n) for (rint i = 0; i < (int)n; i++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
typedef long long lo;
template <typename tp> inline void read(tp &x) {
x = 0;
char c = getchar();
int f = 0;
for (; c < '0' || c > '9'; f |= c == '-', c = getchar())
;
for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar())
;
if (f)
x = -x;
}
#define int long long
const int N = 1e5 + 233;
const int inf = -5e17;
int n, x[N], y[N], qy;
signed main(void) {
srand(20021214);
read(n);
rep(i, n) read(x[i]), read(y[i]);
auto isBlack = [&](int o) {
bool pa = 0;
rep(i, n) if (y[i] <= o && o <= x[i] + y[i] - inf) {
int nc = x[i] - inf;
int mc = o - y[i];
pa ^= nc == (nc | mc);
}
return pa;
};
while (!isBlack(qy = rand() % 10))
;
for (int k = 61; k >= 0; k--) {
if (isBlack(qy + (1ll << k))) {
qy |= 1ll << k;
}
}
cout << qy + inf << "\n";
}
| replace | 39 | 40 | 39 | 40 | TLE | |
p03115 | C++ | Time Limit Exceeded | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
using namespace std;
typedef long long ll;
int n;
ll x[100001], y[100001];
ll px[200001], py[200001];
bool pz[200001];
ll tae(ll x, ll y, int id) { // y<2^59
if (x == px[id] && y == py[id])
return pz[id];
bool eq = 1, sm = 0;
for (int i = 58; i >= 0; i--) {
if ((x & (1LL << i))) {
if ((y & (1LL << i)))
sm = eq;
else {
sm ^= eq;
eq = 0;
}
} else {
if ((y & (1LL << i)))
sm = 0;
}
}
px[id] = x, py[id] = y, pz[id] = (eq ^ sm);
return eq ^ sm;
}
int qry(ll l, ll r) {
int sum = 0;
for (int i = 1; i <= n; i++) {
ll ty = y[i] + (1LL << 58);
ll xl = max(0LL, l - x[i]);
ll xr = min(ty, r - x[i]);
if (xl > xr)
continue;
sum ^= tae(xr, ty, i * 2 - 1) % 2;
if (xl != x[i])
sum ^= tae(xl - 1, ty, i * 2);
}
return sum;
}
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
ll l = -1.232323e17, r = 1.0669e17;
while (l != r) {
ll mid = l + (r - l) / 2;
int sum = qry(l, mid);
if (sum % 2 == 0)
l = mid + 1;
else
r = mid;
}
cout << l << endl;
} | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
using namespace std;
typedef long long ll;
int n;
ll x[100001], y[100001];
ll px[200001], py[200001];
bool pz[200001];
ll tae(ll x, ll y, int id) { // y<2^59
if (x == px[id] && y == py[id])
return pz[id];
bool eq = 1, sm = 0;
for (int i = 58; i >= 0; i--) {
if (eq == 0 && sm == 0)
break;
if ((x & (1LL << i))) {
if ((y & (1LL << i)))
sm = eq;
else {
sm ^= eq;
eq = 0;
}
} else {
if ((y & (1LL << i)))
sm = 0;
}
}
px[id] = x, py[id] = y, pz[id] = (eq ^ sm);
return eq ^ sm;
}
int qry(ll l, ll r) {
int sum = 0;
for (int i = 1; i <= n; i++) {
ll ty = y[i] + (1LL << 58);
ll xl = max(0LL, l - x[i]);
ll xr = min(ty, r - x[i]);
if (xl > xr)
continue;
sum ^= tae(xr, ty, i * 2 - 1) % 2;
if (xl != x[i])
sum ^= tae(xl - 1, ty, i * 2);
}
return sum;
}
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
ll l = -1.232323e17, r = 1.0669e17;
while (l != r) {
ll mid = l + (r - l) / 2;
int sum = qry(l, mid);
if (sum % 2 == 0)
l = mid + 1;
else
r = mid;
}
cout << l << endl;
} | insert | 15 | 15 | 15 | 17 | TLE | |
p03116 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i, n) for (int i = 0; i < n; i++)
#define mkp make_pair
#define pin pair<int, int>
pin solve(V<pin> &ab, int ex) {
if (!ex) {
return mkp(1, 0);
}
V<V<pin>> qab(2);
int sz = ab.size();
qab[0].reserve(sz);
qab[1].reserve(sz);
for (pin x : ab) {
qab[x.second & 1].push_back(mkp(x.first / 2, x.second / 2));
if (x.first & 1) {
qab[(x.second + 1) & 1].push_back(mkp(x.first / 2, (x.second + 1) / 2));
}
}
V<vel> c(2, vel(2));
rep(i, 2) {
for (pin x : qab[i]) {
int qc = (2 * x.first + x.second) % 3;
c[i][0] ^= ((qc + 1) & 1);
c[i][1] ^= (qc & 1);
}
}
rep(i, 2) {
if (!c[1 - i][0] && !c[1 - i][1]) {
pin ans = solve(qab[i], ex - 1);
ans.first *= 2;
ans.second *= 2;
ans.second += i;
return ans;
}
}
for (pin &v : ab) {
v.first++;
}
pin ans = solve(ab, ex);
ans.first--;
return ans;
}
signed main() {
long long inf = 2e17;
int n;
scanf("%lld", &n);
V<pin> ab(n);
rep(i, n) {
long long a, b;
scanf("%lld", &a);
scanf("%lld", &b);
ab[i] = {a + inf, b + inf};
}
pin ret = solve(ab, 70);
cout << ret.first - inf << " " << ret.second - inf << "\n";
} | #include <iostream>
#include <vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i, n) for (int i = 0; i < n; i++)
#define mkp make_pair
#define pin pair<int, int>
pin solve(V<pin> &ab, int ex) {
if (!ex) {
return mkp(1, 0);
}
V<V<pin>> qab(2);
int sz = ab.size();
qab[0].reserve(sz);
qab[1].reserve(sz);
for (pin x : ab) {
qab[x.second & 1].push_back(mkp(x.first / 2, x.second / 2));
if (x.first & 1) {
qab[(x.second + 1) & 1].push_back(mkp(x.first / 2, (x.second + 1) / 2));
}
}
V<vel> c(2, vel(2));
rep(i, 2) {
for (pin x : qab[i]) {
int qc = (2 * x.first + x.second) % 3;
c[i][0] ^= ((qc + 1) & 1);
if (qc) {
c[i][1] ^= 1;
}
}
}
rep(i, 2) {
if (!c[1 - i][0] && !c[1 - i][1]) {
pin ans = solve(qab[i], ex - 1);
ans.first *= 2;
ans.second *= 2;
ans.second += i;
return ans;
}
}
for (pin &v : ab) {
v.first++;
}
pin ans = solve(ab, ex);
ans.first--;
return ans;
}
signed main() {
long long inf = 2e17;
int n;
scanf("%lld", &n);
V<pin> ab(n);
rep(i, n) {
long long a, b;
scanf("%lld", &a);
scanf("%lld", &b);
ab[i] = {a + inf, b + inf};
}
pin ret = solve(ab, 70);
cout << ret.first - inf << " " << ret.second - inf << "\n";
} | replace | 28 | 29 | 28 | 31 | 0 | |
p03116 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define V vector
#define L long
#define W V<L>
L E = 70;
W S(V<W> p) {
if (!E) {
return {1, 0};
}
V<V<W>> T(2);
for (W x : p) {
T[x[1] & 1].push_back({x[0] / 2, x[1] / 2});
if (x[0] & 1) {
T[(x[1] + 1) & 1].push_back({x[0] / 2, (x[1] + 1) / 2});
}
}
for (L i; i < 2; i++) {
L c = 0;
for (W x : T[!i]) {
L Q = (2 * x[0] + x[1]) % 3;
c ^= Q + 1;
}
if (!c) {
E--;
W A = S(T[i]);
A[0] *= 2;
A[1] *= 2;
A[1] += i;
return A;
}
}
for (W &v : p) {
v[0]++;
}
W A = S(p);
A[0]--;
return A;
}
int main() {
L M = 2e17, n, a, b;
cin >> n;
V<W> p;
while (n--) {
cin >> a >> b;
p[n] = {a + M, b + M};
}
W x = S(p);
cout << x[0] - M << " " << x[1] - M;
} | #include <bits/stdc++.h>
using namespace std;
#define V vector
#define L long
#define W V<L>
L E = 70;
W S(V<W> p) {
if (!E) {
return {1, 0};
}
V<V<W>> T(2);
for (W x : p) {
T[x[1] & 1].push_back({x[0] / 2, x[1] / 2});
if (x[0] & 1) {
T[(x[1] + 1) & 1].push_back({x[0] / 2, (x[1] + 1) / 2});
}
}
for (L i; i < 2; i++) {
L c = 0;
for (W x : T[!i]) {
L Q = (2 * x[0] + x[1]) % 3;
c ^= Q + 1;
}
if (!c) {
E--;
W A = S(T[i]);
A[0] *= 2;
A[1] *= 2;
A[1] += i;
return A;
}
}
for (W &v : p) {
v[0]++;
}
W A = S(p);
A[0]--;
return A;
}
int main() {
L M = 2e17, n, a, b;
cin >> n;
V<W> p(n);
while (n--) {
cin >> a >> b;
p[n] = {a + M, b + M};
}
W x = S(p);
cout << x[0] - M << " " << x[1] - M;
} | replace | 42 | 43 | 42 | 43 | -11 | |
p03116 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i, n) for (int i = 0; i < n; i++)
#define mkp make_pair
#define pin pair<int, int>
pin solve(V<pin> &ab, int ex) {
if (!ex) {
return mkp(1, 0);
}
V<V<pin>> qab(2);
int sz = ab.size();
qab[0].reserve(sz);
qab[1].reserve(sz);
for (pin &x : ab) {
qab[x.second & 1].push_back(mkp(x.first / 2, x.second / 2));
if (x.first & 1) {
qab[(x.second + 1) & 1].push_back(mkp(x.first / 2, (x.second + 1) / 2));
}
}
rep(i, 2) {
int c;
for (pin &x : qab[1 - i]) {
int qc = (2 * x.first + x.second) % 3;
c ^= (qc + 1);
}
if (!c) {
pin ans = solve(qab[i], ex - 1);
ans.first *= 2;
ans.second *= 2;
ans.second += i;
return ans;
}
}
for (pin &v : ab) {
v.first++;
}
pin ans = solve(ab, ex);
ans.first--;
return ans;
}
signed main() {
long long inf = 2e17;
int n;
scanf("%lld", &n);
V<pin> ab(n);
rep(i, n) {
long long a, b;
scanf("%lld", &a);
scanf("%lld", &b);
ab[i] = {a + inf, b + inf};
}
pin ret = solve(ab, 70);
cout << ret.first - inf << " " << ret.second - inf << "\n";
}
| #include <iostream>
#include <vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i, n) for (int i = 0; i < n; i++)
#define mkp make_pair
#define pin pair<int, int>
pin solve(V<pin> &ab, int ex) {
if (!ex) {
return mkp(1, 0);
}
V<V<pin>> qab(2);
int sz = ab.size();
qab[0].reserve(sz);
qab[1].reserve(sz);
for (pin &x : ab) {
qab[x.second & 1].push_back(mkp(x.first / 2, x.second / 2));
if (x.first & 1) {
qab[(x.second + 1) & 1].push_back(mkp(x.first / 2, (x.second + 1) / 2));
}
}
rep(i, 2) {
int c = 0;
for (pin &x : qab[1 - i]) {
int qc = (2 * x.first + x.second) % 3;
c ^= (qc + 1);
}
if (!c) {
pin ans = solve(qab[i], ex - 1);
ans.first *= 2;
ans.second *= 2;
ans.second += i;
return ans;
}
}
for (pin &v : ab) {
v.first++;
}
pin ans = solve(ab, ex);
ans.first--;
return ans;
}
signed main() {
long long inf = 2e17;
int n;
scanf("%lld", &n);
V<pin> ab(n);
rep(i, n) {
long long a, b;
scanf("%lld", &a);
scanf("%lld", &b);
ab[i] = {a + inf, b + inf};
}
pin ret = solve(ab, 70);
cout << ret.first - inf << " " << ret.second - inf << "\n";
}
| replace | 24 | 25 | 24 | 25 | -11 | |
p03118 | C++ | Runtime Error | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i, 1, n)
#define REP(i, n) FOR(i, 0, (int)(n)-1)
#define R(i, n) REP(i, n)
#define VI vector<int>
#define PII pair<int, int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
template <class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template <class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }
template <class TH> void _dbg(const char *sdbg, TH h) {
cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
while (*sdbg != ',')
cerr << *sdbg++;
cerr << '=' << h << ',';
_dbg(sdbg + 1, a...);
}
template <class T> ostream &operator<<(ostream &os, vector<T> V) {
os << "[";
for (auto vv : V)
os << vv << ",";
return os << "]";
}
template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) {
return os << "(" << P.st << "," << P.nd << ")";
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr \
if (0) \
cout
#endif
const int P = 1e9 + 7;
void add(int &a, int b) {
a += b;
if (a >= P)
a -= P;
}
void sub(int &a, int b) {
a -= b;
if (a < 0)
a += P;
}
int mul(int a, int b) { return a * b % P; }
struct war {
int a, b, c;
void operator+=(war x) {
add(a, x.a);
add(b, x.b);
add(c, x.c);
}
void operator-=(war x) {
sub(a, x.a);
sub(b, x.b);
sub(c, x.c);
}
void operator*=(war x) {
c = mul(c, x.a);
add(c, mul(a, x.c));
add(c, mul(b, x.b));
b = mul(b, x.a);
add(b, mul(a, x.b));
a = mul(a, x.a);
}
};
const int MAX = 1001;
int dp[MAX][3];
war licz1(int x) {
war res = {0, 1, 0};
R(i, x - 1) { res -= {0, dp[i + 1][2], 0}; }
debug(x, res.b * 3 % P);
return res;
}
war licz2(int x) {
debug(x);
if (x == 1) {
return {(P + 1) / 2, 0, (P - 1) / 2};
}
war res = {1, 0, 0};
res -= licz2(x - 1);
R(i, 2 * x - 2) {
war pom = licz1((i + 1) / 2);
pom *= {0, 1, 0};
res -= pom;
}
return res;
}
int pot(int a, int w) {
int r = 1;
while (w) {
if (w & 1) {
r = r * a % P;
}
w /= 2;
a = a * a % P;
}
return r;
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(11);
cerr << fixed << setprecision(6);
dp[0][1] = dp[0][0] = 1;
dp[0][2] = 0;
R(i, MAX) if (i) R(j, 3) {
R(k, i) {
add(dp[i][j], mul(pot(2 * i - 1 + j, P - 2),
mul(dp[k][j / 2], dp[i - k - 1][(j + 1) / 2])));
}
}
debug(dp[0][2]);
debug(dp[1][2] * 3 % P);
debug(dp[2][2] * 5 % P);
debug(dp[3][2] * 7 % P);
int n;
string z;
cin >> n >> z;
R(i, n - 1) if (z[i] == 'X' && z[i + 1] == 'X') {
cout << "0 0 0\n";
return 0;
}
int ile = 0;
war res = {1, 0, 0};
vector<int> x;
R(i, n) {
if (z[i] == '-') {
if (i && z[i - 1] == '-') {
x.PB(ile);
ile = 0;
}
} else {
ile++;
}
}
debug(ile, x);
if (x.empty()) {
res = licz2(ile);
} else {
res *= licz1(ile);
res *= licz1(x[0]);
R(i, SZ(x)) if (i) { res *= {dp[x[i]][2], 0, 0}; }
}
cout << res.a << " " << res.b << " " << res.c << "\n";
}
| #pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i, 1, n)
#define REP(i, n) FOR(i, 0, (int)(n)-1)
#define R(i, n) REP(i, n)
#define VI vector<int>
#define PII pair<int, int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
template <class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template <class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }
template <class TH> void _dbg(const char *sdbg, TH h) {
cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
while (*sdbg != ',')
cerr << *sdbg++;
cerr << '=' << h << ',';
_dbg(sdbg + 1, a...);
}
template <class T> ostream &operator<<(ostream &os, vector<T> V) {
os << "[";
for (auto vv : V)
os << vv << ",";
return os << "]";
}
template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) {
return os << "(" << P.st << "," << P.nd << ")";
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr \
if (0) \
cout
#endif
const int P = 1e9 + 7;
void add(int &a, int b) {
a += b;
if (a >= P)
a -= P;
}
void sub(int &a, int b) {
a -= b;
if (a < 0)
a += P;
}
int mul(int a, int b) { return a * b % P; }
struct war {
int a, b, c;
void operator+=(war x) {
add(a, x.a);
add(b, x.b);
add(c, x.c);
}
void operator-=(war x) {
sub(a, x.a);
sub(b, x.b);
sub(c, x.c);
}
void operator*=(war x) {
c = mul(c, x.a);
add(c, mul(a, x.c));
add(c, mul(b, x.b));
b = mul(b, x.a);
add(b, mul(a, x.b));
a = mul(a, x.a);
}
};
const int MAX = 1001;
int dp[MAX][3];
war licz1(int x) {
war res = {0, 1, 0};
R(i, x - 1) { res -= {0, dp[i + 1][2], 0}; }
debug(x, res.b * 3 % P);
return res;
}
war licz2(int x) {
debug(x);
if (x == 1) {
return {(P + 1) / 2, 0, (P - 1) / 2};
}
war res = {1, 0, 0};
res -= licz2(x - 1);
R(i, 2 * x - 2) {
war pom = licz1((i + 1) / 2);
pom *= {0, 1, 0};
res -= pom;
}
return res;
}
int pot(int a, int w) {
int r = 1;
while (w) {
if (w & 1) {
r = r * a % P;
}
w /= 2;
a = a * a % P;
}
return r;
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(11);
cerr << fixed << setprecision(6);
dp[0][1] = dp[0][0] = 1;
dp[0][2] = 0;
R(i, MAX) if (i) R(j, 3) {
R(k, i) {
add(dp[i][j], mul(pot(2 * i - 1 + j, P - 2),
mul(dp[k][j / 2], dp[i - k - 1][(j + 1) / 2])));
}
}
debug(dp[0][2]);
debug(dp[1][2] * 3 % P);
debug(dp[2][2] * 5 % P);
debug(dp[3][2] * 7 % P);
int n;
string z;
cin >> n >> z;
if (n == 1 && z[0] == '-') {
cout << (P + 1) / 2 << " 0 " << (P + 1) / 2 << "\n";
return 0;
}
R(i, n - 1) if (z[i] == 'X' && z[i + 1] == 'X') {
cout << "0 0 0\n";
return 0;
}
int ile = 0;
war res = {1, 0, 0};
vector<int> x;
R(i, n) {
if (z[i] == '-') {
if (i && z[i - 1] == '-') {
x.PB(ile);
ile = 0;
}
} else {
ile++;
}
}
debug(ile, x);
if (x.empty()) {
res = licz2(ile);
} else {
res *= licz1(ile);
res *= licz1(x[0]);
R(i, SZ(x)) if (i) { res *= {dp[x[i]][2], 0, 0}; }
}
cout << res.a << " " << res.b << " " << res.c << "\n";
}
| insert | 154 | 154 | 154 | 158 | 0 | |
p03125 | C++ | Runtime Error | #include <stdio.h>
int main(void) {
int a, b;
scanf("%d %d", a, b);
if (b % a == 0) {
printf("%d\n", a + b);
} else {
printf("%d\n", b - a);
}
return 0;
}
| #include <stdio.h>
int main(void) {
int a, b;
scanf("%d %d", &a, &b);
if (b % a == 0) {
printf("%d\n", a + b);
} else {
printf("%d\n", b - a);
}
return 0;
} | replace | 3 | 4 | 3 | 4 | -11 | |
p03125 | C++ | Runtime Error | // AUTHOR:BlackBox Inc.//
#include <bits/stdc++.h>
#include <tr1/unordered_map>
#include <unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define endl "\n"
#define vpii vector<pair<int, int>>
#define vs vector<string>
#define lin1(x) \
ll int x; \
x = scan();
#define lin2(x, y) \
ll int x, y; \
x = scan(), y = scan();
#define lin3(x, y, z) \
ll int x, y, z; \
x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x, y) make_pair(x, y)
#define mx(a, b) (a) > (b) ? (a) : (b)
#define mn(a, b) (a) < (b) ? (a) : (b)
#define fori(s, e) for (i = s; i <= e; i++)
#define forj(s, e) for (j = s; j <= e; j++)
#define fork(s, e) for (k = s; k <= e; k++)
#define rep(i, s, e) for (int i = s; i <= e; i++)
#define brep(i, s, e) for (int i = s; i >= e; i--)
#define all(x) x.begin(), x.end()
#define mem(x, y) memset(x, y, sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast \
std::ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
using namespace std;
using namespace std::tr1;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
}
| // AUTHOR:BlackBox Inc.//
#include <bits/stdc++.h>
#include <tr1/unordered_map>
#include <unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define endl "\n"
#define vpii vector<pair<int, int>>
#define vs vector<string>
#define lin1(x) \
ll int x; \
x = scan();
#define lin2(x, y) \
ll int x, y; \
x = scan(), y = scan();
#define lin3(x, y, z) \
ll int x, y, z; \
x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x, y) make_pair(x, y)
#define mx(a, b) (a) > (b) ? (a) : (b)
#define mn(a, b) (a) < (b) ? (a) : (b)
#define fori(s, e) for (i = s; i <= e; i++)
#define forj(s, e) for (j = s; j <= e; j++)
#define fork(s, e) for (k = s; k <= e; k++)
#define rep(i, s, e) for (int i = s; i <= e; i++)
#define brep(i, s, e) for (int i = s; i >= e; i--)
#define all(x) x.begin(), x.end()
#define mem(x, y) memset(x, y, sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast \
std::ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
using namespace std;
using namespace std::tr1;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
}
| delete | 44 | 48 | 44 | 44 | 0 | |
p03125 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << b + a;
else
cout << b - a;
return 0;
} | #include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << b + a;
else
cout << b - a;
return 0;
} | delete | 5 | 8 | 5 | 5 | 0 | |
p03125 | C++ | Runtime Error | #include <cstdio>
using namespace std;
int A, B, C;
int main() {
if (B % A) {
C = B - A;
} else {
C = B + A;
}
printf("%d\n", C);
} | #include <cstdio>
using namespace std;
int A, B, C;
int main() {
scanf("%d %d", &A, &B);
if (B % A) {
C = B - A;
} else {
C = B + A;
}
printf("%d\n", C);
} | insert | 7 | 7 | 7 | 9 | -8 | |
p03125 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a, b;
cin >> b >> a;
if (a % b == 0)
cout << a + b << endl;
else
cout << a - b << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a, b;
cin >> b >> a;
if (a % b == 0)
cout << a + b << endl;
else
cout << a - b << endl;
return 0;
} | replace | 3 | 7 | 3 | 4 | 0 | |
p03125 | C++ | Runtime Error | /*************************************************************************
> File Name: A.cc
> Author: sqwlly
> Mail: sqw.lucky@gmail.com
> Created Time: 2019年02月16日 星期六 20时04分07秒
************************************************************************/
#include <iostream>
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.in", "r", stdin);
#endif
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
}
| /*************************************************************************
> File Name: A.cc
> Author: sqwlly
> Mail: sqw.lucky@gmail.com
> Created Time: 2019年02月16日 星期六 20时04分07秒
************************************************************************/
#include <iostream>
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
}
| replace | 14 | 17 | 14 | 15 | 0 | |
p03125 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
string op;
cin >> A >> op >> B;
if (A % B == 0) {
if (op == "+") {
cout << A + B << endl;
}
} else {
cout << B - A << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << B - A << endl;
}
}
| replace | 5 | 12 | 5 | 8 | 0 | |
p03125 | Python | Runtime Error | a = int(input())
b = int(input())
r = a + b if b % a == 0 else b - a
print(r)
| a, b = list(map(int, input().split()))
r = a + b if b % a == 0 else b - a
print(r)
| replace | 0 | 2 | 0 | 1 | ValueError: invalid literal for int() with base 10: '4 12' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03125/Python/s844412029.py", line 1, in <module>
a = int(input())
ValueError: invalid literal for int() with base 10: '4 12'
|
p03125 | C++ | Runtime Error | /***
* ___ ___
* /\ \ /\ \ _____
* \:\ \ \:\ \ /::\ \ ___
* ___
* \:\ \ \:\ \ /:/\:\ \ /\__\
* /\__\
* _____\:\ \ ___ \:\ \ ___ ___ ___ ___ /:/
* /::\__\ /:/__/ /:/ /
* /::::::::\__\ /\ \ \:\__\ /\ \ /\__\ /\ \ /\__\ /:/_/:/\:|__|
* /::\ \ /:/__/
* \:\~~\~~\/__/ \:\ \ /:/ / \:\ \ /:/ / \:\ \ /:/ / \:\/:/ /:/ /
* \/\:\ \__ /::\ \
* \:\ \ \:\ /:/ / \:\ /:/ / \:\ /:/ / \::/_/:/ /
* ~~\:\/\__\ /:/\:\ \
* \:\ \ \:\/:/ / \:\/:/ / \:\/:/ / \:\/:/ / \::/
* / \/__\:\ \
* \:\__\ \::/ / \::/ / \::/ / \::/ / /:/ /
* \:\__\
* \/__/ \/__/ \/__/ \/__/ \/__/ \/__/
* \/__/
*
* @author : Dylan Dsouza (dsouzadyn@gmail.com)
* @created : Saturday Feb 16, 2019 22:47:36 IST
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("in.txt", "rt", stdin);
#endif
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << B - A << endl;
}
return 0;
}
| /***
* ___ ___
* /\ \ /\ \ _____
* \:\ \ \:\ \ /::\ \ ___
* ___
* \:\ \ \:\ \ /:/\:\ \ /\__\
* /\__\
* _____\:\ \ ___ \:\ \ ___ ___ ___ ___ /:/
* /::\__\ /:/__/ /:/ /
* /::::::::\__\ /\ \ \:\__\ /\ \ /\__\ /\ \ /\__\ /:/_/:/\:|__|
* /::\ \ /:/__/
* \:\~~\~~\/__/ \:\ \ /:/ / \:\ \ /:/ / \:\ \ /:/ / \:\/:/ /:/ /
* \/\:\ \__ /::\ \
* \:\ \ \:\ /:/ / \:\ /:/ / \:\ /:/ / \::/_/:/ /
* ~~\:\/\__\ /:/\:\ \
* \:\ \ \:\/:/ / \:\/:/ / \:\/:/ / \:\/:/ / \::/
* / \/__\:\ \
* \:\__\ \::/ / \::/ / \::/ / \::/ / /:/ /
* \:\__\
* \/__/ \/__/ \/__/ \/__/ \/__/ \/__/
* \/__/
*
* @author : Dylan Dsouza (dsouzadyn@gmail.com)
* @created : Saturday Feb 16, 2019 22:47:36 IST
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << B - A << endl;
}
return 0;
}
| delete | 33 | 37 | 33 | 33 | 0 | |
p03125 | C++ | Runtime Error | #include <iostream>
using namespace std;
int a, b;
int main() {
if (b % a == 0)
cout << a + b;
else
cout << b - a;
return 0;
} | #include <iostream>
using namespace std;
int a, b;
int main() {
cin >> a >> b;
if (b % a == 0)
cout << a + b;
else
cout << b - a;
return 0;
} | insert | 4 | 4 | 4 | 5 | -8 | |
p03125 | Python | Runtime Error | A, B = list(map(int, input()))
if B % A == 0:
print(A + B)
else:
print(B - A)
| A, B = list(map(int, input().split()))
if B % A == 0:
print(A + B)
else:
print(B - A)
| replace | 0 | 1 | 0 | 1 | ValueError: invalid literal for int() with base 10: ' ' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03125/Python/s504979530.py", line 1, in <module>
A, B = list(map(int, input()))
ValueError: invalid literal for int() with base 10: ' '
|
p03125 | Python | Runtime Error | def main():
a, b = map(int, input().split())
if b / a % 0:
print(a + b)
else:
print(b - a)
if __name__ == "__main__":
main()
| def main():
a, b = map(int, input().split())
if b % a == 0:
print(a + b)
else:
print(b - a)
if __name__ == "__main__":
main()
| replace | 2 | 3 | 2 | 3 | ZeroDivisionError: float modulo | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03125/Python/s513765690.py", line 11, in <module>
main()
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03125/Python/s513765690.py", line 4, in main
if b / a % 0:
ZeroDivisionError: float modulo
|
p03125 | Python | Runtime Error | a, b = [int(x) for x in input().split()]
print([a + b, b - a][int(b % a)])
| a, b = [int(x) for x in input().split()]
print([a + b, b - a][int(bool(b % a))])
| replace | 1 | 2 | 1 | 2 | 0 | |
p03125 | Python | Runtime Error | a, b = map(int, input())
if b % a == 0:
print(a + b)
else:
print(b - a)
| a, b = map(int, input().split())
if b % a == 0:
print(a + b)
else:
print(b - a)
| replace | 0 | 1 | 0 | 1 | ValueError: invalid literal for int() with base 10: ' ' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03125/Python/s517301094.py", line 1, in <module>
a, b = map(int, input())
ValueError: invalid literal for int() with base 10: ' '
|
p03125 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int int64_t
int a, b;
int32_t main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> a >> b;
cout << (b % a ? b - a : a + b);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define int int64_t
int a, b;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> a >> b;
cout << (b % a ? b - a : a + b);
return 0;
} | delete | 6 | 10 | 6 | 6 | -8 | |
p03126 | Python | Runtime Error | n, m = map(int, input().split())
r = [0 for x in range(0, m)]
for _ in range(0, n):
a = [x for x in map(int, input().split())]
for i in a[1:]:
r[i - 1] += 1
print(f"{len([x for x in r if x == n])}")
| n, m = map(int, input().split())
r = [0 for x in range(0, m)]
for _ in range(0, n):
a = [x for x in map(int, input().split())]
for i in a[1:]:
r[i - 1] += 1
print("{}".format(len([x for x in r if x == n])))
| replace | 9 | 10 | 9 | 10 | 0 | |
p03126 | Python | Runtime Error | from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for i in range(n):
tmp = list(map(int, input().split()))
for a in tmp[1:]:
d[a] += 1
cnt = 0
for value in range(d.values()):
if value == n:
cnt += 1
print(cnt)
| from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for i in range(n):
tmp = list(map(int, input().split()))
for a in tmp[1:]:
d[a] += 1
cnt = 0
for value in d.values():
if value == n:
cnt += 1
print(cnt)
| replace | 10 | 11 | 10 | 11 | TypeError: 'dict_values' object cannot be interpreted as an integer | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03126/Python/s949301200.py", line 11, in <module>
for value in range(d.values()):
TypeError: 'dict_values' object cannot be interpreted as an integer
|
p03126 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> cnt(M, 0);
int ans = 0;
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A;
cin >> A;
A--;
cnt[A]++;
}
}
for (int i = 0; i < N; i++) {
if (cnt[M] = N) {
ans++;
}
}
cout << ans << endl;
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> cnt(M, 0);
int ans = 0;
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A;
cin >> A;
A--;
cnt[A]++;
}
}
for (int i = 0; i < M; i++) {
if (cnt[i] == N) {
ans++;
}
}
cout << ans << endl;
}
| replace | 19 | 21 | 19 | 21 | 0 | |
p03126 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
int n, m;
int k[m], a[30][30];
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> k[i];
for (int j = 0; j < k[i]; j++) {
cin >> a[i][j];
}
}
int cnt = 0;
bool like;
for (int i = 1; i < m + 1; i++) { // m種類の食べ物
like = true;
for (int j = 0; j < n; j++) { // 各人の好物に入っているか
bool in = false;
for (int l = 0; l < k[j]; l++) {
if (a[j][l] == i)
in = true;
}
if (!in) {
like = false;
break;
}
}
if (like)
cnt++;
}
cout << cnt << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int n, m;
int k[30], a[30][30];
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> k[i];
for (int j = 0; j < k[i]; j++) {
cin >> a[i][j];
}
}
int cnt = 0;
bool like;
for (int i = 1; i < m + 1; i++) { // m種類の食べ物
like = true;
for (int j = 0; j < n; j++) { // 各人の好物に入っているか
bool in = false;
for (int l = 0; l < k[j]; l++) {
if (a[j][l] == i)
in = true;
}
if (!in) {
like = false;
break;
}
}
if (like)
cnt++;
}
cout << cnt << endl;
return 0;
}
| replace | 5 | 6 | 5 | 6 | 0 | |
p03126 | C++ | Runtime Error |
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <sys/timeb.h>
#include <vector>
using namespace std;
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295
typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
struct Edge {
int from, to, cost;
bool operator<(Edge e) { return cost < e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T> using vec = vector<T>;
template <class T> using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}
template <class T> struct augEdge {
T from, to;
int cost;
bool operator<(augEdge e) { return cost < e.cost; }
bool operator>(augEdge e) { return cost > e.cost; }
};
template <class T> using augGraph = vector<augEdge<T>>;
bool pairCompare(const Pi &firstElof, const Pi &secondElof) {
return firstElof.second > secondElof.second;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
int ans = 0;
vvi a(m + 3);
rep(i, n) {
int t;
cin >> t;
rep(j, t) {
int x;
cin >> x;
a[i].push_back(x);
}
}
repr(i, 1, 31) {
bool f = true;
rep(j, n) {
if (find(all(a[j]), i) == a[j].end()) {
f = false;
}
}
if (f) {
ans++;
}
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <sys/timeb.h>
#include <vector>
using namespace std;
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295
typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
struct Edge {
int from, to, cost;
bool operator<(Edge e) { return cost < e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T> using vec = vector<T>;
template <class T> using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}
template <class T> struct augEdge {
T from, to;
int cost;
bool operator<(augEdge e) { return cost < e.cost; }
bool operator>(augEdge e) { return cost > e.cost; }
};
template <class T> using augGraph = vector<augEdge<T>>;
bool pairCompare(const Pi &firstElof, const Pi &secondElof) {
return firstElof.second > secondElof.second;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
int ans = 0;
vvi a(n + 3);
rep(i, n) {
int t;
cin >> t;
rep(j, t) {
int x;
cin >> x;
a[i].push_back(x);
}
}
repr(i, 1, 31) {
bool f = true;
rep(j, n) {
if (find(all(a[j]), i) == a[j].end()) {
f = false;
}
}
if (f) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| replace | 85 | 86 | 85 | 86 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) rep(i, (n) + 1)
#define per(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define pere(i, n) rep(i, (n) + 1)
#define all(x) (x).begin(), (x).end()
#define SP << " " <<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
typedef long long LL;
typedef long double LD;
int main() {
int n, m;
cin >> n >> m;
vector<int> c(n, 0);
int k, a;
for (int i = 0; i < n; i++) {
cin >> k;
for (int j = 0; j < k; j++) {
cin >> a;
c[a - 1]++;
}
}
int ans = 0;
for (int i = 0; i < m; i++) {
if (c[i] == n)
ans++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) rep(i, (n) + 1)
#define per(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define pere(i, n) rep(i, (n) + 1)
#define all(x) (x).begin(), (x).end()
#define SP << " " <<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
typedef long long LL;
typedef long double LD;
int main() {
int n, m;
cin >> n >> m;
vector<int> c(m, 0);
int k, a;
for (int i = 0; i < n; i++) {
cin >> k;
for (int j = 0; j < k; j++) {
cin >> a;
c[a - 1]++;
}
}
int ans = 0;
for (int i = 0; i < m; i++) {
if (c[i] == n)
ans++;
}
cout << ans << endl;
return 0;
} | replace | 19 | 20 | 19 | 20 | 0 | |
p03126 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void) {
int N, M;
cin >> N >> M;
int *K;
K = new int[N];
int **A = new int *[N];
for (int j = 0; j < M; j++) {
A[j] = new int[M];
}
for (int i = 0; i < N; i++) {
cin >> K[i];
for (int j = 0; j < K[i]; j++) {
cin >> A[i][j];
}
}
int *count;
count = new int[M];
for (int i = 0; i < N; i++) {
for (int j = 0; j < K[i]; j++) {
count[A[i][j] - 1]++;
}
}
int kindnum = 0;
for (int i = 0; i < M; i++) {
if (count[i] == N) {
kindnum++;
}
}
cout << kindnum << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void) {
int N, M;
cin >> N >> M;
int *K;
K = new int[N];
int **A = new int *[N];
for (int j = 0; j < N; j++) {
A[j] = new int[M];
}
for (int i = 0; i < N; i++) {
cin >> K[i];
for (int j = 0; j < K[i]; j++) {
cin >> A[i][j];
}
}
int *count;
count = new int[M];
for (int i = 0; i < N; i++) {
for (int j = 0; j < K[i]; j++) {
count[A[i][j] - 1]++;
}
}
int kindnum = 0;
for (int i = 0; i < M; i++) {
if (count[i] == N) {
kindnum++;
}
}
cout << kindnum << endl;
return 0;
} | replace | 16 | 17 | 16 | 17 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) \
; \
for (int i = 1; i <= n; ++i)
using ll = long long;
using P = pair<int, int>;
int main() {
int n, m;
cin >> n >> m;
vector<int> A(m + 10);
vector<int> B(m + 10);
vector<int> k(n);
rep(i, n) {
cin >> k[i];
rep(j, k[i]) {
cin >> A[j];
B[A[j]] += 1;
}
}
int count = 0;
rep(i, m) {
if (B[i] == n)
++count;
}
cout << count << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) \
; \
for (int i = 1; i <= n; ++i)
using ll = long long;
using P = pair<int, int>;
int main() {
int n, m;
cin >> n >> m;
vector<int> A(m + 10);
vector<int> B(m + 10);
vector<int> k(n + 10);
rep(i, n) {
cin >> k[i];
rep(j, k[i]) {
cin >> A[j];
B[A[j]] += 1;
}
}
int count = 0;
rep(i, m) {
if (B[i] == n)
++count;
}
cout << count << endl;
return 0;
}
| replace | 13 | 14 | 13 | 14 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int b[105];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
int k;
scanf("%d", &k);
for (int j = 1; j <= k; j++) {
int x;
scanf("%d", x);
b[x]++;
}
}
int ans = 0;
for (int i = 1; i <= m; i++)
if (b[i] == n)
ans++;
printf("%d\n", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int b[105];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
int k;
scanf("%d", &k);
for (int j = 1; j <= k; j++) {
int x;
scanf("%d", &x);
b[x]++;
}
}
int ans = 0;
for (int i = 1; i <= m; i++)
if (b[i] == n)
ans++;
printf("%d\n", ans);
return 0;
} | replace | 11 | 12 | 11 | 12 | -11 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
int cnt[m + 1];
fill(cnt, cnt + n + 1, 0);
for (int i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int a;
cin >> a;
cnt[a]++;
}
}
int ans = 0;
for (int i = 1; i <= m; i++) {
if (cnt[i] == n)
ans++;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
int cnt[m + 1];
fill(cnt, cnt + m + 1, 0);
for (int i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int a;
cin >> a;
cnt[a]++;
}
}
int ans = 0;
for (int i = 1; i <= m; i++) {
if (cnt[i] == n)
ans++;
}
cout << ans << endl;
}
| replace | 7 | 8 | 7 | 8 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
int a[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
a[i][j] = 0;
}
}
for (int i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int num;
cin >> num;
a[i][num - 1] = 1;
}
}
int count = 0;
for (int i = 0; i < m; i++) {
int flag = 0;
for (int j = 0; j < n; j++) {
if (a[j][i] != 1) {
flag = 1;
}
}
if (flag == 0) {
count++;
}
}
cout << count << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
int a[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
a[i][j] = 0;
}
}
for (int i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int num;
cin >> num;
a[i][num - 1] = 1;
}
}
int count = 0;
for (int i = 0; i < m; i++) {
int flag = 0;
for (int j = 0; j < n; j++) {
if (a[j][i] != 1) {
flag = 1;
}
}
if (flag == 0) {
count++;
}
}
cout << count << endl;
} | replace | 9 | 10 | 9 | 10 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int N, M;
cin >> N >> M;
int cnt[M];
int ans = 0;
for (int i = 0; i < M; i++)
cnt[i] = 0;
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A[K];
cin >> A[i];
cnt[A[i] - 1]++;
}
}
for (int i = 0; i < M; i++) {
if (cnt[i] == N)
ans++;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
int N, M;
cin >> N >> M;
int cnt[M];
int ans = 0;
for (int i = 0; i < M; i++)
cnt[i] = 0;
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A;
cin >> A;
cnt[A - 1]++;
}
}
for (int i = 0; i < M; i++) {
if (cnt[i] == N)
ans++;
}
cout << ans << endl;
return 0;
}
| replace | 16 | 19 | 16 | 19 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<vector<bool>> match(N, vector<bool>(M, 0));
int k, m;
for (int i = 0; i < N; ++i) {
cin >> k;
for (int j = 0; j < k; ++j) {
cin >> m;
match.at(i).at(m) = 1;
}
}
bool like;
int num;
for (int i = 0; i < M; ++i) {
like = 1;
for (int j = 0; j < N; ++j) {
like *= match.at(j).at(i);
}
num += like;
}
cout << num << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<vector<bool>> match(N, vector<bool>(M, 0));
int k, m;
for (int i = 0; i < N; ++i) {
cin >> k;
for (int j = 0; j < k; ++j) {
cin >> m;
match.at(i).at(m - 1) = 1;
}
}
bool like;
int num;
for (int i = 0; i < M; ++i) {
like = 1;
for (int j = 0; j < N; ++j) {
like *= match.at(j).at(i);
}
num += like;
}
cout << num << endl;
} | replace | 12 | 13 | 12 | 13 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<set<int>> A(N);
for (int i = 0; i < N; i++) {
set<int> a;
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int c;
cin >> c;
a.insert(c);
}
A.at(i) = a;
}
int ans = 0;
for (int i = 1; i <= M; i++) {
bool x = true;
for (int j = 0; j < N; j++) {
if (!A.at(i).count(j)) {
x = false;
break;
}
}
if (x)
ans++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<set<int>> A(N);
for (int i = 0; i < N; i++) {
set<int> a;
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int c;
cin >> c;
a.insert(c);
}
A.at(i) = a;
}
int ans = 0;
for (int i = 1; i <= M; i++) {
bool x = true;
for (int j = 0; j < N; j++) {
if (!A.at(j).count(i)) {
x = false;
break;
}
}
if (x)
ans++;
}
cout << ans << endl;
return 0;
} | replace | 21 | 22 | 21 | 22 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)
|
p03126 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m;
int num = 0;
int count = 0;
cin >> n >> m;
vector<vector<int>> item = vector<vector<int>>(n, vector<int>(m, 0));
for (int i = 0; i < n; i++) {
cin >> item[i][0];
for (int j = 0; j < item[i][0]; j++) {
cin >> item[i][j + 1];
}
}
vector<int> ans(m, 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < item[i][0]; j++) {
ans[item[i][j + 1] - 1]++;
}
}
for (int i : ans) {
if (i == n) {
count++;
}
}
cout << count << endl;
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m;
int num = 0;
int count = 0;
cin >> n >> m;
vector<vector<int>> item = vector<vector<int>>(n, vector<int>(m + 1, 0));
for (int i = 0; i < n; i++) {
cin >> item[i][0];
for (int j = 0; j < item[i][0]; j++) {
cin >> item[i][j + 1];
}
}
vector<int> ans(m, 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < item[i][0]; j++) {
ans[item[i][j + 1] - 1]++;
}
}
for (int i : ans) {
if (i == n) {
count++;
}
}
cout << count << endl;
return 0;
} | replace | 10 | 11 | 10 | 11 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
const ll INF = 1LL << 60;
int main() {
ll n, m, k;
cin >> n >> m;
vector<ll> tab(m, 0);
ll ans = 0;
rep(i, n) {
cin >> k;
vector<ll> a(k);
rep(j, k) {
cin >> a[j];
++tab[a[j]];
}
}
for (auto itr = tab.begin(); itr != tab.end(); ++itr) {
if (*itr == n) {
++ans;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
const ll INF = 1LL << 60;
int main() {
ll n, m, k;
cin >> n >> m;
vector<ll> tab(m, 0);
ll ans = 0;
rep(i, n) {
cin >> k;
vector<ll> a(k);
rep(j, k) {
cin >> a[j];
++tab[a[j] - 1];
}
}
for (auto itr = tab.begin(); itr != tab.end(); ++itr) {
if (*itr == n) {
++ans;
}
}
cout << ans << endl;
} | replace | 42 | 43 | 42 | 43 | 0 | |
p03126 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> suki(m, 0);
string line;
for (int i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int id;
cin >> id;
suki[id - 1]++;
}
}
int likecount = 0;
for (int l : suki) {
if (l == n)
likecount++;
}
cout << likecount << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> suki(m, 0);
string line;
for (int i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int id;
cin >> id;
suki[id - 1]++;
}
}
int likecount = 0;
for (int i = 0; i < suki.size(); i++) {
if (suki[i] == n)
likecount++;
}
cout << likecount << endl;
} | replace | 18 | 20 | 18 | 20 | TLE | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, i, r = 0;
cin >> n >> m;
set<int> s[i];
for (i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int a;
cin >> a;
s[i].insert(a);
}
}
for (int j = 1; j <= m; j++) {
bool b = 1;
for (i = 0; i < n; i++) {
if (s[i].count(j)) {
} else {
b = 0;
break;
}
}
if (b)
r++;
}
cout << r << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, i, r = 0;
cin >> n >> m;
set<int> s[n];
for (i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int a;
cin >> a;
s[i].insert(a);
}
}
for (int j = 1; j <= m; j++) {
bool b = 1;
for (i = 0; i < n; i++) {
if (s[i].count(j)) {
} else {
b = 0;
break;
}
}
if (b)
r++;
}
cout << r << endl;
return 0;
}
| replace | 6 | 7 | 6 | 7 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> K(N);
vector<vector<int>> A(N, vector<int>(K));
for (int i = 0; i < N; ++i) {
cin >> K[i];
for (int j = 0; j < K[i]; ++j) {
cin >> A[i][j];
}
}
vector<int> like(M);
int ans = 0;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < K[i]; ++j) {
like[A[i][j] - 1]++;
}
}
for (int i = 0; i < M; ++i) {
if (like[i] == N) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> K(N);
vector<vector<int>> A(N, vector<int>(M));
for (int i = 0; i < N; ++i) {
cin >> K[i];
for (int j = 0; j < K[i]; ++j) {
cin >> A[i][j];
}
}
vector<int> like(M);
int ans = 0;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < K[i]; ++j) {
like[A[i][j] - 1]++;
}
}
for (int i = 0; i < M; ++i) {
if (like[i] == N) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| replace | 7 | 8 | 7 | 8 | 0 | |
p03126 | C++ | Runtime Error | // おまじない
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<long int> v(m);
for (int i = 0; i < n; i++) {
int f = 0;
cin >> f;
for (int j = 0; j < f; j++) {
int a = 0;
cin >> a;
v.at(a) += 1;
}
}
int s = 0;
for (int i = 0; i < m; i++) {
if (v.at(i) == n) {
s++;
}
}
cout << s << endl;
}
| // おまじない
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<long int> v(m);
for (int i = 0; i < n; i++) {
int f = 0;
cin >> f;
for (int j = 0; j < f; j++) {
int a = 0;
cin >> a;
v.at(a - 1) += 1;
}
}
int s = 0;
for (int i = 0; i < m; i++) {
if (v.at(i) == n) {
s++;
}
}
cout << s << endl;
}
| replace | 19 | 20 | 19 | 20 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
vector<int> food(n, 0);
REP(i, n) {
int k;
cin >> k;
REP(j, k) {
int food_num;
cin >> food_num;
food[food_num - 1]++;
}
}
int ans = 0;
REP(i, m) {
if (food[i] == n)
ans++;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
vector<int> food(m, 0);
REP(i, n) {
int k;
cin >> k;
REP(j, k) {
int food_num;
cin >> food_num;
food[food_num - 1]++;
}
}
int ans = 0;
REP(i, m) {
if (food[i] == n)
ans++;
}
cout << ans << endl;
} | replace | 10 | 11 | 10 | 11 | 0 | |
p03126 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <time.h>
#include <tuple>
#include <vector>
// #include "bits/stdc++.h"
using namespace std;
// using namespace std::vector;
#define rep(i, a, b) for (ll i = (a); i < (b); ++i)
// #define M_PI 3.1415926535
#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll bur(ll N, ll X);
bool IsPrime(int num);
int main(void) {
ll N = 0;
ll A = 0;
ll B = 0;
ll C = 0;
ll D = 0;
ll M = 0;
ll K = 0;
// ll T = 0;
// ll M = 0;
// ll h[400][400] = {};
ll b[30][30] = {};
ll c[30] = {};
ll d[100] = {};
// ll v[3] = {};
// ll *c, *s, *n;
string S[50], T[50], U[52];
char fi[50], fv[50];
ll count = 0;
float count2 = 0;
float sum = 0;
ll min = 1000000000000;
ll max = 1;
ll dist1 = 0;
ll dist2 = 0;
ll dist3 = 0;
ll now = 0;
int tmax = 0;
int tmax2 = 0;
// int flag = 0;
char temp, head;
// int is = 0;
bool start = false;
// char p;
float all = 0;
ll leng = 1;
ll state = 2;
bool down = true;
cin >> N >> M;
vector<int> KK(N);
rep(i, 0, N) {
cin >> KK[i];
rep(j, 0, KK[i]) { cin >> b[i][j]; }
}
rep(j, 0, N) {
// cout << KK[j] << endl;
rep(i, 0, KK[j]) {
c[b[j][i]]++;
// cout << b[j][i] << endl;
}
}
rep(j, 0, M + 1) {
// cout << c[j] << endl;
if (c[j] == N)
all++;
}
cout << all << endl;
// cout << dist1-dist2 << endl;
/*vector<pair<int,int>> tr(N);
rep(i, 0, N) {
cin >> tr[i].first;
count += tr[i].first;
}
rep(i, 0, N) {
cin >> tr[i].second;
count2 += tr[i].second;
}
if (count < count2) {
cout << -1 << endl;
return 0;
}
rep(i, 0, N) {
if (tr[i].first < tr[i].second) {
sum += tr[i].second - tr[i].first;
niku++;
}
else {
ov[all] += tr[i].first - tr[i].second;
all++;
}
}
sort(ov.begin(), ov.end(), greater<>());
int xx = 0;
while (sum > 0) {
sum -= ov[xx];
xx++;
niku++;
}*/
// cout << niku << endl;
// x = (ll *)malloc((N+1) * sizeof(ll));
// c = (ll *)malloc((N) * sizeof(ll));
// cin >> D >> G;
// vector<pair<int,int>> tr(M);
// vector<pair<int,int>> qes(Q);
// sort(c.begin(), c.end());
// cout << c[2] - c[1] << endl;
/*A = N / 1000;
N %= 1000;
B = N / 100;
N %= 100;
C = N / 10;
N %= 10;
D = N;*/
// cin >> N >> M;
// vector<pair<int,int>> c(M);
////vector<pair<int, int>> e(M);
// vector<ll> d(M);
// rep(i, 0, M) {
// cin >> c[i].first >> c[i].second;
// //e[i].first = c[i].first;
// //e[i].second = c[i].second;
//}
////sort(c.begin(), c.end());
//
// rep(i, 0, M) {
//
//
// rep(j, 0, M) {
// if (c[i].first == c[j].first && c[j].second < c[i].second) {
// d[i]++;
// //cout << j << endl;
// }
// }
// cout << std::setfill('0') << std::right << std::setw(6) << c[i].first;
// cout << std::setfill('0') << std::right << std::setw(6) << d[i]+1 <<
//endl;
//}
return 0;
}
ll bur(ll N, ll X) {
ll pan = 1;
ll pat = 1;
ll burg = 0;
if (X > burg) {
if (N == 0)
return pat;
burg += pan;
burg += bur(N - 1, X);
burg += pat;
burg += bur(N - 1, X);
burg += pan;
}
return burg;
}
ll gcd(ll a, ll b) {
/* 自然数 a > b を確認・入替 */
if (a < b) {
ll tmp = a;
a = b;
b = tmp;
}
ll x = b;
ll y = a;
/* ユークリッドの互除法 */
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return y / b * x;
}
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
} | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <time.h>
#include <tuple>
#include <vector>
// #include "bits/stdc++.h"
using namespace std;
// using namespace std::vector;
#define rep(i, a, b) for (ll i = (a); i < (b); ++i)
// #define M_PI 3.1415926535
#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll bur(ll N, ll X);
bool IsPrime(int num);
int main(void) {
ll N = 0;
ll A = 0;
ll B = 0;
ll C = 0;
ll D = 0;
ll M = 0;
ll K = 0;
// ll T = 0;
// ll M = 0;
// ll h[400][400] = {};
ll b[100][100] = {};
ll c[100] = {};
ll d[100] = {};
// ll v[3] = {};
// ll *c, *s, *n;
string S[50], T[50], U[52];
char fi[50], fv[50];
ll count = 0;
float count2 = 0;
float sum = 0;
ll min = 1000000000000;
ll max = 1;
ll dist1 = 0;
ll dist2 = 0;
ll dist3 = 0;
ll now = 0;
int tmax = 0;
int tmax2 = 0;
// int flag = 0;
char temp, head;
// int is = 0;
bool start = false;
// char p;
float all = 0;
ll leng = 1;
ll state = 2;
bool down = true;
cin >> N >> M;
vector<int> KK(N);
rep(i, 0, N) {
cin >> KK[i];
rep(j, 0, KK[i]) { cin >> b[i][j]; }
}
rep(j, 0, N) {
// cout << KK[j] << endl;
rep(i, 0, KK[j]) {
c[b[j][i]]++;
// cout << b[j][i] << endl;
}
}
rep(j, 0, M + 1) {
// cout << c[j] << endl;
if (c[j] == N)
all++;
}
cout << all << endl;
// cout << dist1-dist2 << endl;
/*vector<pair<int,int>> tr(N);
rep(i, 0, N) {
cin >> tr[i].first;
count += tr[i].first;
}
rep(i, 0, N) {
cin >> tr[i].second;
count2 += tr[i].second;
}
if (count < count2) {
cout << -1 << endl;
return 0;
}
rep(i, 0, N) {
if (tr[i].first < tr[i].second) {
sum += tr[i].second - tr[i].first;
niku++;
}
else {
ov[all] += tr[i].first - tr[i].second;
all++;
}
}
sort(ov.begin(), ov.end(), greater<>());
int xx = 0;
while (sum > 0) {
sum -= ov[xx];
xx++;
niku++;
}*/
// cout << niku << endl;
// x = (ll *)malloc((N+1) * sizeof(ll));
// c = (ll *)malloc((N) * sizeof(ll));
// cin >> D >> G;
// vector<pair<int,int>> tr(M);
// vector<pair<int,int>> qes(Q);
// sort(c.begin(), c.end());
// cout << c[2] - c[1] << endl;
/*A = N / 1000;
N %= 1000;
B = N / 100;
N %= 100;
C = N / 10;
N %= 10;
D = N;*/
// cin >> N >> M;
// vector<pair<int,int>> c(M);
////vector<pair<int, int>> e(M);
// vector<ll> d(M);
// rep(i, 0, M) {
// cin >> c[i].first >> c[i].second;
// //e[i].first = c[i].first;
// //e[i].second = c[i].second;
//}
////sort(c.begin(), c.end());
//
// rep(i, 0, M) {
//
//
// rep(j, 0, M) {
// if (c[i].first == c[j].first && c[j].second < c[i].second) {
// d[i]++;
// //cout << j << endl;
// }
// }
// cout << std::setfill('0') << std::right << std::setw(6) << c[i].first;
// cout << std::setfill('0') << std::right << std::setw(6) << d[i]+1 <<
//endl;
//}
return 0;
}
ll bur(ll N, ll X) {
ll pan = 1;
ll pat = 1;
ll burg = 0;
if (X > burg) {
if (N == 0)
return pat;
burg += pan;
burg += bur(N - 1, X);
burg += pat;
burg += bur(N - 1, X);
burg += pan;
}
return burg;
}
ll gcd(ll a, ll b) {
/* 自然数 a > b を確認・入替 */
if (a < b) {
ll tmp = a;
a = b;
b = tmp;
}
ll x = b;
ll y = a;
/* ユークリッドの互除法 */
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return y / b * x;
}
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
} | replace | 38 | 40 | 38 | 40 | 0 | |
p03126 | C++ | Runtime Error | #include <iostream>
#include <stdio.h>
using namespace std;
int main(void) {
int N, M;
scanf("%d %d", &N, &M);
int menu[30] = {0};
for (int i = 0; i < N; i++) {
int K;
scanf("%d", &K);
for (int i = 0; i < K; i++) {
int A;
scanf("%d", &A);
menu[A]++;
}
}
int ans = 0;
for (int i = 0; i < M; i++) {
if (menu[i] == N)
ans++;
}
printf("%d\n", ans);
return 0;
}
| #include <iostream>
#include <stdio.h>
using namespace std;
int main(void) {
int N, M;
scanf("%d %d", &N, &M);
int menu[30] = {0};
for (int i = 0; i < N; i++) {
int K;
scanf("%d", &K);
for (int i = 0; i < K; i++) {
int A;
scanf("%d", &A);
menu[A - 1]++;
}
}
int ans = 0;
for (int i = 0; i < M; i++) {
if (menu[i] == N)
ans++;
}
printf("%d\n", ans);
return 0;
}
| replace | 14 | 15 | 14 | 15 | 0 | |
p03126 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
typedef long long ll;
int main(void) {
int N, M;
cin >> N >> M;
vector<int> like(N, 0);
rep(i, N) {
int K;
cin >> K;
rep(j, K) {
int id;
cin >> id;
like[id - 1]++;
}
}
int ans = 0;
rep(i, M) {
// cout << i << ":" << like[i] << endl;
if (like[i] == N)
ans++;
}
cout << ans << endl;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
typedef long long ll;
int main(void) {
int N, M;
cin >> N >> M;
vector<int> like(M, 0);
rep(i, N) {
int K;
cin >> K;
rep(j, K) {
int id;
cin >> id;
like[id - 1]++;
}
}
int ans = 0;
rep(i, M) {
// cout << i << ":" << like[i] << endl;
if (like[i] == N)
ans++;
}
cout << ans << endl;
}
| replace | 16 | 17 | 16 | 17 | 0 | |
p03126 | C++ | Runtime Error | // Foods Loved by Everyone
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, x, y) for (int i = x; i < y; i++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a / __gcd(a, b) * b)
#define range(a) (a).begin(), (a).end()
#define pb push_back
const int inf = 2147483647;
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>> a(n);
rep(i, 0, n) {
int k;
cin >> k;
a[i].resize(k);
rep(j, 0, k) {
int c;
cin >> c;
a[i].pb(c);
}
}
vector<int> t(m);
rep(i, 0, n) {
rep(j, 0, a[i].size()) { t[a[i][j] - 1]++; }
}
int ans = 0;
rep(i, 0, m) if (t[i] == n) ans++;
cout << ans << endl;
return 0;
} | // Foods Loved by Everyone
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, x, y) for (int i = x; i < y; i++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a / __gcd(a, b) * b)
#define range(a) (a).begin(), (a).end()
#define pb push_back
const int inf = 2147483647;
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>> a(n);
rep(i, 0, n) {
int k;
cin >> k;
rep(j, 0, k) {
int c;
cin >> c;
a[i].pb(c);
}
}
vector<int> t(m);
rep(i, 0, n) {
rep(j, 0, a[i].size()) { t[a[i][j] - 1]++; }
}
int ans = 0;
rep(i, 0, m) if (t[i] == n) ans++;
cout << ans << endl;
return 0;
} | delete | 19 | 20 | 19 | 19 | -6 | double free or corruption (out)
|
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> food(M);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A;
cin >> A;
food.at(A)++;
}
}
int count = 0;
for (int i = 0; i < M; i++) {
if (food.at(i) == N) {
count++;
}
}
cout << count << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> food(M);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A;
cin >> A;
food.at(A - 1)++;
}
}
int count = 0;
for (int i = 0; i < M; i++) {
if (food.at(i) == N) {
count++;
}
}
cout << count << endl;
}
| replace | 15 | 16 | 15 | 16 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(c) reverse((c).begin(), (c).end());
const long long MOD = 10e9 + 7;
typedef long long ll;
const double rate = 380000.0;
int main() {
int N, M;
cin >> N >> M;
vector<int> CH(M, 0);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A;
cin >> A;
CH.at(A)++;
}
}
int cnt = 0;
for (int i = 0; i < M; i++) {
if (CH.at(i) == N)
cnt++;
}
cout << cnt << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(c) reverse((c).begin(), (c).end());
const long long MOD = 10e9 + 7;
typedef long long ll;
const double rate = 380000.0;
int main() {
int N, M;
cin >> N >> M;
vector<int> CH(M, 0);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A;
cin >> A;
CH.at(A - 1)++;
}
}
int cnt = 0;
for (int i = 0; i < M; i++) {
if (CH.at(i) == N)
cnt++;
}
cout << cnt << endl;
} | replace | 19 | 20 | 19 | 20 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, m;
cin >> n >> m;
map<int, int> mp;
rep(i, 0, n) {
int k;
cin >> k;
vector<int> a(k);
rep(j, 0, k) {
cin >> a[i];
mp[a[i]]++;
}
}
int ans = 0;
for (auto i : mp) {
if (i.second == n)
ans++;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, m;
cin >> n >> m;
map<int, int> mp;
rep(i, 0, n) {
int k;
cin >> k;
vector<int> a(k);
rep(j, 0, k) {
cin >> a[j];
mp[a[j]]++;
}
}
int ans = 0;
for (auto i : mp) {
if (i.second == n)
ans++;
}
cout << ans << endl;
return 0;
}
| replace | 15 | 17 | 15 | 17 | 0 | |
p03126 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define ll long long
const double EPS = 1e-10;
int main() {
ll n, m;
ll ans = 0;
cin >> n >> m;
vector<ll> a(m, 0);
ll k, kk;
for (ll i = 0; i < n; i++) {
cin >> k;
for (ll j = 0; j < k; j++) {
cin >> kk;
a[kk]++;
}
}
for (ll i = 0; i < m; i++) {
if (a[i] == n)
ans++;
}
cout << ans << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define ll long long
const double EPS = 1e-10;
int main() {
ll n, m;
ll ans = 0;
cin >> n >> m;
vector<ll> a(m, 0);
ll k, kk;
for (ll i = 0; i < n; i++) {
cin >> k;
for (ll j = 0; j < k; j++) {
cin >> kk;
a[kk - 1]++;
}
}
for (ll i = 0; i < m; i++) {
if (a[i] == n)
ans++;
}
cout << ans << endl;
}
| replace | 24 | 25 | 24 | 25 | 0 | |
p03126 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> k(n);
vector<vector<int>> a(m, vector<int>(m));
vector<vector<int>> result(n);
for (int i = 0; i < n; i++) {
cin >> k[i];
for (int j = 0; j < k[i]; j++) {
cin >> a[i][j];
if (i == 0) {
result[i].push_back(a[i][j]);
} else {
auto res = find(result[i - 1].begin(), result[i - 1].end(), a[i][j]);
if (!(res == result[i - 1].end())) {
result[i].push_back(a[i][j]);
}
}
}
}
cout << result[n - 1].size() << endl;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> k(n);
vector<vector<int>> a(n, vector<int>(m));
vector<vector<int>> result(n);
for (int i = 0; i < n; i++) {
cin >> k[i];
for (int j = 0; j < k[i]; j++) {
cin >> a[i][j];
if (i == 0) {
result[i].push_back(a[i][j]);
} else {
auto res = find(result[i - 1].begin(), result[i - 1].end(), a[i][j]);
if (!(res == result[i - 1].end())) {
result[i].push_back(a[i][j]);
}
}
}
}
cout << result[n - 1].size() << endl;
} | replace | 9 | 10 | 9 | 10 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using p = pair<int, int>;
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
signed main() {
int N, M;
cin >> N >> M;
int A[N];
rep(i, N) A[i] = 0;
int a, k;
rep(i, N) {
cin >> k;
rep(i, k) {
cin >> a;
A[a - 1]++;
}
}
int ans = 0;
rep(i, M) {
if (A[i] == N)
ans++;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
using p = pair<int, int>;
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
signed main() {
int N, M;
cin >> N >> M;
vector<int> A(M, 0);
int a, k;
rep(i, N) {
cin >> k;
rep(i, k) {
cin >> a;
A[a - 1]++;
}
}
int ans = 0;
rep(i, M) {
if (A[i] == N)
ans++;
}
cout << ans << endl;
} | replace | 9 | 11 | 9 | 10 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0);
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ((n) ? "Yes" : "No") << '\n';
#define CFYN(n) cout << ((n) ? "YES" : "NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main(void) {
IOS int N, M;
cin >> N >> M;
vector<int> A;
REP(i, N) {
int K;
cin >> K;
REP(j, K) {
int a;
cin >> a;
a--;
A[a]++;
}
}
int ans = 0;
REP(i, M) if (A[i] == N) ans++;
cout << ans << '\n';
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0);
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ((n) ? "Yes" : "No") << '\n';
#define CFYN(n) cout << ((n) ? "YES" : "NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main(void) {
IOS int N, M;
cin >> N >> M;
vector<int> A(M);
REP(i, N) {
int K;
cin >> K;
REP(j, K) {
int a;
cin >> a;
a--;
A[a]++;
}
}
int ans = 0;
REP(i, M) if (A[i] == N) ans++;
cout << ans << '\n';
return 0;
} | replace | 21 | 22 | 21 | 22 | -11 | |
p03126 | 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++)
int main() {
int n, m;
cin >> n >> m;
vector<int> food(n);
rep(i, n) {
int k;
cin >> k;
rep(j, k) {
int a;
cin >> a;
food[a - 1]++;
}
}
int ans = 0;
rep(i, m) {
if (food[i] == n)
ans++;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
int main() {
int n, m;
cin >> n >> m;
vector<int> food(m);
rep(i, n) {
int k;
cin >> k;
rep(j, k) {
int a;
cin >> a;
food[a - 1]++;
}
}
int ans = 0;
rep(i, m) {
if (food[i] == n)
ans++;
}
cout << ans << endl;
} | replace | 8 | 9 | 8 | 9 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, ans = 0;
cin >> N >> M;
vector<int> B(M);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A;
cin >> A;
B.at(A - 1)++;
}
}
for (int i = 0; i < N; i++) {
if (B.at(i) == N) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, ans = 0;
cin >> N >> M;
vector<int> B(M);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int A;
cin >> A;
B.at(A - 1)++;
}
}
for (int i = 0; i < M; i++) {
if (B.at(i) == N) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| replace | 17 | 18 | 17 | 18 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define INF 1000007
#define MOD 998244353
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int mpow(int N, int P, int M) // 繰り返し自乗法
{
if (P == 0)
return 1;
if (P % 2 == 0) {
int t = mpow(N, P / 2, M);
return t * t % M;
}
return N * mpow(N, P - 1, M) % M;
}
signed main() {
int N, M;
cin >> N >> M;
int A[M][M];
int K[N];
rep(i, N) {
cin >> K[i];
rep(j, K[i]) { cin >> A[i][j]; }
}
int ans = 0;
rep(k, M + 1) {
int count = 0;
rep(i, N) {
rep(j, K[i]) {
if (k == A[i][j]) {
count++;
}
}
}
if (count == N) {
ans++;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define INF 1000007
#define MOD 998244353
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int mpow(int N, int P, int M) // 繰り返し自乗法
{
if (P == 0)
return 1;
if (P % 2 == 0) {
int t = mpow(N, P / 2, M);
return t * t % M;
}
return N * mpow(N, P - 1, M) % M;
}
signed main() {
int N, M;
cin >> N >> M;
int A[N][M];
int K[N];
rep(i, N) {
cin >> K[i];
rep(j, K[i]) { cin >> A[i][j]; }
}
int ans = 0;
rep(k, M + 1) {
int count = 0;
rep(i, N) {
rep(j, K[i]) {
if (k == A[i][j]) {
count++;
}
}
}
if (count == N) {
ans++;
}
}
cout << ans << endl;
} | replace | 24 | 25 | 24 | 25 | 0 | |
p03126 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define mk(a, b) make_pair(a, b)
#define pii pair<int, int>
using namespace std;
inline int read() {
int X = 0, w = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-')
w = -1;
c = getchar();
}
while (c >= '0' && c <= '9')
X = (X << 3) + (X << 1) + c - '0', c = getchar();
return X * w;
}
typedef long long ll;
const int N = 1e5 + 5;
int num[55];
int main() {
int n, m, k, x;
n = read();
m = read();
for (int i = 1; i <= n; i++) {
k = read();
for (int j = 1; j <= k; k++) {
x = read();
num[x]++;
}
}
int ans = 0;
for (int i = 1; i <= m; i++) {
if (num[i] == n)
ans++;
}
cout << ans;
} | #include <bits/stdc++.h>
#define mk(a, b) make_pair(a, b)
#define pii pair<int, int>
using namespace std;
inline int read() {
int X = 0, w = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-')
w = -1;
c = getchar();
}
while (c >= '0' && c <= '9')
X = (X << 3) + (X << 1) + c - '0', c = getchar();
return X * w;
}
typedef long long ll;
const int N = 1e5 + 5;
int num[55];
int main() {
int n, m, k, x;
n = read();
m = read();
for (int i = 1; i <= n; i++) {
k = read();
for (int j = 1; j <= k; j++) {
x = read();
num[x]++;
}
}
int ans = 0;
for (int i = 1; i <= m; i++) {
if (num[i] == n)
ans++;
}
cout << ans;
} | replace | 25 | 26 | 25 | 26 | TLE | |
p03126 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N, M;
cin >> N;
cin >> M;
int K[N];
int A[M][M];
int min = 30;
int num = 0;
for (int j = 0; j < N; j++) {
cin >> K[j];
if (min > K[j]) {
min = K[j];
num = j;
}
for (int i = 0; i < K[j]; i++) {
cin >> A[j][i];
}
}
int count = 0;
int sum = 0;
for (int k = 0; k < min; k++) {
count = 0;
for (int j = 0; j < N; j++) {
for (int i = 0; i < K[j]; i++) {
if (A[num][k] == A[j][i])
count = count + 1;
}
}
if (count == N)
sum = sum + 1;
}
cout << sum << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N, M;
cin >> N;
cin >> M;
int K[N];
int A[N][M];
int min = 30;
int num = 0;
for (int j = 0; j < N; j++) {
cin >> K[j];
if (min > K[j]) {
min = K[j];
num = j;
}
for (int i = 0; i < K[j]; i++) {
cin >> A[j][i];
}
}
int count = 0;
int sum = 0;
for (int k = 0; k < min; k++) {
count = 0;
for (int j = 0; j < N; j++) {
for (int i = 0; i < K[j]; i++) {
if (A[num][k] == A[j][i])
count = count + 1;
}
}
if (count == N)
sum = sum + 1;
}
cout << sum << endl;
return 0;
}
| replace | 11 | 12 | 11 | 12 | 0 | |
p03126 | Python | Runtime Error | N, M = map(int, input().split())
inputs = [[i for i in input().split()] for _ in range(N)]
ans = set(inputs[0])
for item in inputs:
ans &= set(inputs[1:])
print(len(ans))
| N, M = map(int, input().split())
inputs = [[i for i in input().split()] for _ in range(N)]
ans = set(inputs[0])
for item in inputs:
ans &= set(item[1:])
print(len(ans))
| replace | 6 | 7 | 6 | 7 | TypeError: unhashable type: 'list' | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03126/Python/s588663845.py", line 7, in <module>
ans &= set(inputs[1:])
TypeError: unhashable type: 'list'
|
p03126 | Python | Runtime Error | N, M = map(int, input().split())
favorites = {*tuple(range(1, M + 1))}
for _ in range(N):
K, *fav = map(int, input().split())
favorites = favorites & set(fav)
print(len(favorites))
| N, M = map(int, input().split())
favorites = set(i for i in range(1, M + 1))
for _ in range(N):
K, *fav = map(int, input().split())
favorites = favorites & set(fav)
print(len(favorites))
| replace | 1 | 2 | 1 | 2 | 0 | |
p03126 | Python | Runtime Error | N, M = map(int, input().split())
loved_by_everyone = [0] * M
for _ in range(N):
like_list = list(map(int, input().split()))
for like in like_list[1:]:
loved_by_everyone[like] += 1
kinds = 0
for food in loved_by_everyone:
kinds += 1 if food == N else 0
print(kinds)
| N, M = map(int, input().split())
loved_by_everyone = [0] * M
for _ in range(N):
like_list = list(map(int, input().split()))
for like in like_list[1:]:
loved_by_everyone[like - 1] += 1
kinds = 0
for food in loved_by_everyone:
kinds += 1 if food == N else 0
print(kinds)
| replace | 5 | 6 | 5 | 6 | 0 | |
p03126 | Python | Runtime Error | n, m = map(int, input().split())
res = [0] * m
for i in range(n):
o = list(map(int, input().split()))
for j, x in enumerate(o):
if j != 0:
res[x] += 1
ans = sum(1 for x in res if x == n)
print(ans)
| n, m = map(int, input().split())
res = [0] * m
for i in range(n):
o = list(map(int, input().split()))
for j, x in enumerate(o):
if j != 0:
res[x - 1] += 1
ans = sum(1 for x in res if x == n)
print(ans)
| replace | 7 | 8 | 7 | 8 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n + 1); i++)
int main() {
int N, M;
cin >> N >> M;
vector<int> A(M);
vector<int> K(N);
rep(i, N) {
cin >> K[i];
vector<int> C(K[i]);
rep(j, K[i]) {
cin >> C[i];
A[C[i] - 1]++;
}
}
int cnt = 0;
rep(i, M) {
if (A[i] == N) {
cnt++;
}
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n + 1); i++)
int main() {
int N, M;
cin >> N >> M;
vector<int> A(M);
vector<int> K(N);
rep(i, N) {
cin >> K[i];
vector<int> C(K[i]);
rep(j, K[i]) {
cin >> C[j];
A[C[j] - 1]++;
}
}
int cnt = 0;
rep(i, M) {
if (A[i] == N) {
cnt++;
}
}
cout << cnt << endl;
}
| replace | 16 | 18 | 16 | 18 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define ANS cout << ans << endl
#define all(a) a.begin(), a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define VIin(a) \
for (int i = 0; i < a.size(); i++) \
cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1e9 + 7;
const long long INF = 1LL << 60;
/*最大公約数*/ int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
/*最小公倍数*/ int lcm(int a, int b) {
int g = gcd(a, b);
return a / g * b;
}
/*素数判定*/ int isPrime(int n) {
if (n < 2) {
return 0;
}
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
return 0;
}
}
return 1;
}
/*約数列挙*/ vector<int> getDivisor(int n) {
vector<int> v;
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
v.push_back(i);
if (i != n / i) {
v.push_back(n / i);
}
}
}
sort(v.begin(), v.end());
return v;
}
//----------------------------------------------
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
VI like(m, 0);
rep(i, n) {
int k;
cin >> k;
VI a(k, 0);
rep(j, k) {
cin >> a[i];
like[a[i] - 1]++;
}
}
int ans = 0;
rep(i, m) if (like[i] == n) ans++;
ANS;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define ANS cout << ans << endl
#define all(a) a.begin(), a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define VIin(a) \
for (int i = 0; i < a.size(); i++) \
cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1e9 + 7;
const long long INF = 1LL << 60;
/*最大公約数*/ int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
/*最小公倍数*/ int lcm(int a, int b) {
int g = gcd(a, b);
return a / g * b;
}
/*素数判定*/ int isPrime(int n) {
if (n < 2) {
return 0;
}
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
return 0;
}
}
return 1;
}
/*約数列挙*/ vector<int> getDivisor(int n) {
vector<int> v;
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
v.push_back(i);
if (i != n / i) {
v.push_back(n / i);
}
}
}
sort(v.begin(), v.end());
return v;
}
//----------------------------------------------
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
VI like(m, 0);
rep(i, n) {
int k;
cin >> k;
VI a(k, 0);
rep(j, k) {
cin >> a[j];
like[a[j] - 1]++;
}
}
int ans = 0;
rep(i, m) if (like[i] == n) ans++;
ANS;
return 0;
} | replace | 63 | 65 | 63 | 65 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> A(M);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int As;
cin >> As;
A.at(As - 1)++;
}
}
int ans = 0;
for (int i = 0; i < N; i++) {
if (A.at(i) == N) {
ans++;
}
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> A(M);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int As;
cin >> As;
A.at(As - 1)++;
}
}
int ans = 0;
for (int i = 0; i < M; i++) {
if (A.at(i) == N) {
ans++;
}
}
cout << ans << endl;
}
| replace | 26 | 27 | 26 | 27 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, K, a, count = 0;
cin >> N >> M;
vector<int> menu(M);
for (int i = 0; i < N; i++) {
cin >> K;
for (int j = 0; j < K; j++) {
cin >> a;
menu.at(a - 1)++;
}
}
for (int i = 0; i < N; i++)
if (menu.at(i) == N)
count++;
cout << count << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, K, a, count = 0;
cin >> N >> M;
vector<int> menu(M);
for (int i = 0; i < N; i++) {
cin >> K;
for (int j = 0; j < K; j++) {
cin >> a;
menu.at(a - 1)++;
}
}
for (int i = 0; i < M; i++)
if (menu.at(i) == N)
count++;
cout << count << endl;
} | replace | 14 | 15 | 14 | 15 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> tpl;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(c) reverse((c).begin(), (c).end())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define RREP(i, n) RFOR(i, n, 0)
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL << 60;
const long long MOD = 1000000007;
#define CLR(a) memset((a), 0, sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
int main(void) {
int N, M;
cin >> N >> M;
VVI pref(N, VI(0, M));
REP(i, N) {
int k;
cin >> k;
REP(j, k) {
int a;
cin >> a;
a--;
pref[i][a] = 1;
}
}
int ans = 0;
REP(i, M) {
bool flag = true;
REP(j, N) {
if (pref[j][i] == 0) {
flag = false;
break;
}
}
if (flag)
ans++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> tpl;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(c) reverse((c).begin(), (c).end())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define RREP(i, n) RFOR(i, n, 0)
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL << 60;
const long long MOD = 1000000007;
#define CLR(a) memset((a), 0, sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
int main(void) {
int N, M;
cin >> N >> M;
VVI pref(N, VI(M, 0));
REP(i, N) {
int k;
cin >> k;
REP(j, k) {
int a;
cin >> a;
a--;
pref[i][a] = 1;
}
}
int ans = 0;
REP(i, M) {
bool flag = true;
REP(j, N) {
if (pref[j][i] == 0) {
flag = false;
break;
}
}
if (flag)
ans++;
}
cout << ans << endl;
return 0;
} | replace | 63 | 64 | 63 | 64 | -11 | |
p03126 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, k, a, c = 0;
cin >> n >> m;
vector<int> v(m, 0);
for (int i = 0; i < n; i++) {
cin >> k;
for (int j = 0; j < k; k++) {
cin >> a;
v[a - 1]++;
}
}
for (int i = 0; i < m; i++)
if (v[i] == n)
c++;
cout << c << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, k, a, c = 0;
cin >> n >> m;
vector<int> v(m, 0);
for (int i = 0; i < n; i++) {
cin >> k;
for (int j = 0; j < k; j++) {
cin >> a;
v[a - 1]++;
}
}
for (int i = 0; i < m; i++)
if (v[i] == n)
c++;
cout << c << endl;
return 0;
} | replace | 9 | 10 | 9 | 10 | TLE | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vin = vector<int>;
using vll = vector<long long>;
using vdo = vector<double>;
using vvin = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vvdo = vector<vector<double>>;
using vstr = vector<string>;
using vvstr = vector<vector<string>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define _GLIBCXX_DEBUG
int main() {
int n, m;
cin >> n >> m;
vin k(n);
vvin a(n, vin(m));
rep(i, n) {
cin >> k[i];
rep(j, k[i]) cin >> a[i][j];
}
vin b(m, 0);
for (int i = 1; i <= m; i++) {
rep(j, n) {
rep(l, k[j]) {
if (a[j][l] == i)
b[i]++;
}
}
}
int sum = 0;
rep(i, m) {
if (b[i] == n)
sum++;
}
cout << sum << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vin = vector<int>;
using vll = vector<long long>;
using vdo = vector<double>;
using vvin = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vvdo = vector<vector<double>>;
using vstr = vector<string>;
using vvstr = vector<vector<string>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define _GLIBCXX_DEBUG
int main() {
int n, m;
cin >> n >> m;
vin k(n);
vvin a(n, vin(m));
rep(i, n) {
cin >> k[i];
rep(j, k[i]) cin >> a[i][j];
}
vin b(m, 0);
for (int i = 1; i <= m; i++) {
rep(j, n) {
rep(l, k[j]) {
if (a[j][l] == i)
b[i - 1]++;
}
}
}
int sum = 0;
rep(i, m) {
if (b[i] == n)
sum++;
}
cout << sum << endl;
} | replace | 28 | 29 | 28 | 29 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <map> // pair
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> A(N, vector<int>(M, 0));
vector<int> K(M);
for (int i = 0; i < N; i++) {
cin >> K.at(i);
for (int j = 0; j < K.at(i); j++) {
int temp;
cin >> temp;
A.at(i).at(temp - 1) = 1;
}
}
int ans = 0;
for (int i = 0; i < M; i++) {
int count = 0;
for (int j = 0; j < N; j++) {
count += A.at(j).at(i);
}
if (count == N)
ans++;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
#include <map> // pair
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> A(N, vector<int>(M, 0));
vector<int> K(M);
for (int i = 0; i < N; i++) {
int ind;
cin >> ind;
for (int j = 0; j < ind; j++) {
int temp;
cin >> temp;
A.at(i).at(temp - 1) = 1;
}
}
int ans = 0;
for (int i = 0; i < M; i++) {
int count = 0;
for (int j = 0; j < N; j++) {
count += A.at(j).at(i);
}
if (count == N)
ans++;
}
cout << ans << endl;
}
| replace | 11 | 13 | 11 | 14 | 0 | |
p03126 | C++ | Runtime Error |
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> kk(n, 0);
for (int i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int a;
cin >> a;
a--;
++kk[a];
}
}
int ans = 0;
for (int i = 0; i < m; i++) {
if (kk[i] == n) {
++ans;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> kk(m, 0);
for (int i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int a;
cin >> a;
a--;
++kk[a];
}
}
int ans = 0;
for (int i = 0; i < m; i++) {
if (kk[i] == n) {
++ans;
}
}
cout << ans << endl;
return 0;
} | replace | 9 | 10 | 9 | 10 | 0 | |
p03126 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int typeArray[m];
int like[n][m];
for (int i = 0; i < n; i++) {
int typeCount;
cin >> typeCount;
typeArray[i] = typeCount;
for (int j = 0; j < typeCount; j++) {
cin >> like[i][j];
}
}
if (n == 1) {
cout << typeArray[0] << endl;
return 0;
}
int count = 0;
for (int i = 0; i < typeArray[0]; i++) {
int matchNum = like[0][i];
for (int j = 1; j < n; j++) {
bool isMatch = false;
for (int k = 0; k < typeArray[j]; k++) {
if (matchNum == like[j][k]) {
isMatch = true;
break;
}
}
if (!isMatch) {
break;
}
if (j == n - 1) {
count++;
}
}
}
cout << count << endl;
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int typeArray[n];
int like[n][m];
for (int i = 0; i < n; i++) {
int typeCount;
cin >> typeCount;
typeArray[i] = typeCount;
for (int j = 0; j < typeCount; j++) {
cin >> like[i][j];
}
}
if (n == 1) {
cout << typeArray[0] << endl;
return 0;
}
int count = 0;
for (int i = 0; i < typeArray[0]; i++) {
int matchNum = like[0][i];
for (int j = 1; j < n; j++) {
bool isMatch = false;
for (int k = 0; k < typeArray[j]; k++) {
if (matchNum == like[j][k]) {
isMatch = true;
break;
}
}
if (!isMatch) {
break;
}
if (j == n - 1) {
count++;
}
}
}
cout << count << endl;
return 0;
} | replace | 8 | 9 | 8 | 9 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <map>
using namespace std;
int main(void) {
int N, M;
cin >> N >> M;
vector<int> K(N);
vector<vector<int>> A(N, vector<int>(N));
for (int i = 0; i < N; i++) {
cin >> K[i];
int j = 0;
while (j < K[i]) {
cin >> A[i][j];
j++;
}
}
map<int, int> mp;
for (int i = 0; i < N; i++) {
for (int j = 0; j < K[i]; j++) {
if (mp.count(A[i][j]))
mp[A[i][j]]++;
else
mp[A[i][j]] = 1;
}
}
int Count = 0;
for (auto p : mp) {
if (N == p.second)
Count++;
}
cout << Count << endl;
}
| #include <bits/stdc++.h>
#include <map>
using namespace std;
int main(void) {
int N, M;
cin >> N >> M;
vector<int> K(N);
vector<vector<int>> A(N, vector<int>(M));
for (int i = 0; i < N; i++) {
cin >> K[i];
int j = 0;
while (j < K[i]) {
cin >> A[i][j];
j++;
}
}
map<int, int> mp;
for (int i = 0; i < N; i++) {
for (int j = 0; j < K[i]; j++) {
if (mp.count(A[i][j]))
mp[A[i][j]]++;
else
mp[A[i][j]] = 1;
}
}
int Count = 0;
for (auto p : mp) {
if (N == p.second)
Count++;
}
cout << Count << endl;
} | replace | 7 | 8 | 7 | 8 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> K(N, 0);
for (int i = 0; i < N; i++) {
int a;
cin >> a;
for (int j = 0; j < a; j++) {
int A;
cin >> A;
A--;
K[A]++;
}
}
int count = 0;
for (int i = 0; i < M; i++) {
if (K[i] == N) {
count++;
}
}
cout << count << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> K(M, 0);
for (int i = 0; i < N; i++) {
int a;
cin >> a;
for (int j = 0; j < a; j++) {
int A;
cin >> A;
A--;
K[A]++;
}
}
int count = 0;
for (int i = 0; i < M; i++) {
if (K[i] == N) {
count++;
}
}
cout << count << endl;
}
| replace | 5 | 6 | 5 | 6 | 0 | |
p03126 | C++ | Runtime Error | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int N, M;
int ans = 0;
cin >> N >> M;
vector<int> like_foods(M, 0);
rep(i, N) {
int k;
cin >> k;
vector<int> A(k);
rep(j, k) cin >> A[j];
for (int a : A) {
like_foods[a] += 1;
}
}
for (int food : like_foods) {
if (food == N) {
ans++;
}
}
cout << ans << endl;
} | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int N, M;
int ans = 0;
cin >> N >> M;
vector<int> like_foods(M, 0);
rep(i, N) {
int k;
cin >> k;
vector<int> A(k);
rep(j, k) cin >> A[j];
for (int a : A) {
like_foods[a - 1] += 1;
}
}
for (int food : like_foods) {
if (food == N) {
ans++;
}
}
cout << ans << endl;
} | replace | 17 | 18 | 17 | 18 | 0 | |
p03126 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
int K[N], A[N][M];
int ansv = 0;
int ans = 0;
for (int i = 0; i < N; i++) {
cin >> K[i];
for (int j = 0; j < K[i]; j++) {
cin >> A[i][j];
}
}
for (int i = 0; i < K[0]; i++) {
ansv = 0;
for (int j = 0; j < N; j++) {
for (int k = 0; k < K[i]; k++) {
if (A[0][i] == A[j][k]) {
ansv++;
}
}
}
if (ansv == N) {
ans++;
}
}
cout << ans << endl;
} | #include <iostream>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
int K[N], A[N][M];
int ansv = 0;
int ans = 0;
for (int i = 0; i < N; i++) {
cin >> K[i];
for (int j = 0; j < K[i]; j++) {
cin >> A[i][j];
}
}
for (int i = 0; i < K[0]; i++) {
ansv = 0;
for (int j = 0; j < N; j++) {
for (int k = 0; k < K[j]; k++) {
if (A[0][i] == A[j][k]) {
ansv++;
}
}
}
if (ansv == N) {
ans++;
}
}
cout << ans << endl;
} | replace | 21 | 22 | 21 | 22 | 0 | |
p03126 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main() {
int N, M;
cin >> N >> M;
vector<int> cnt(N);
rep(i, N) {
int K;
cin >> K;
rep(j, K) {
int A;
cin >> A;
A--;
cnt[A]++;
}
}
int ans = 0;
rep(i, M) {
if (cnt[i] == N) {
ans++;
}
}
cout << ans;
cout << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main() {
int N, M;
cin >> N >> M;
vector<int> cnt(M);
rep(i, N) {
int K;
cin >> K;
rep(j, K) {
int A;
cin >> A;
A--;
cnt[A]++;
}
}
int ans = 0;
rep(i, M) {
if (cnt[i] == N) {
ans++;
}
}
cout << ans;
cout << endl;
return 0;
} | replace | 13 | 14 | 13 | 14 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
int ctoi(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
return 0;
}
ll factorial(ll n) {
if (n == 1) {
return 1;
}
ll ans = factorial(n - 1);
return ans * n;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
bool is_prime(ll n) {
for (ll i = 2; i * i <= n; i++) {
if (n % i == 0)
return false;
}
return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
if (n == 0)
return 1;
ll res = mod_pow(x * x % mod, n / 2, mod);
if (n & 1)
res = res * x % mod;
return res;
}
int main() {
ll n, m;
cin >> n >> m;
vector<ll> v(m, 0);
rep(i, n) {
ll k;
cin >> k;
rep(j, k) {
ll tmp;
v.at(tmp - 1)++;
}
}
ll res = 0;
rep(i, m) {
if (v.at(i) == n)
res++;
}
cout << res << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
int ctoi(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
return 0;
}
ll factorial(ll n) {
if (n == 1) {
return 1;
}
ll ans = factorial(n - 1);
return ans * n;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
bool is_prime(ll n) {
for (ll i = 2; i * i <= n; i++) {
if (n % i == 0)
return false;
}
return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
if (n == 0)
return 1;
ll res = mod_pow(x * x % mod, n / 2, mod);
if (n & 1)
res = res * x % mod;
return res;
}
int main() {
ll n, m;
cin >> n >> m;
vector<ll> v(m, 0);
rep(i, n) {
ll k;
cin >> k;
rep(j, k) {
ll tmp;
cin >> tmp;
v.at(tmp - 1)++;
}
}
ll res = 0;
rep(i, m) {
if (v.at(i) == n)
res++;
}
cout << res << endl;
} | insert | 65 | 65 | 65 | 66 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 140047065350734) >= this->size() (which is 4)
|
p03126 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> v(M);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
vector<int> foods(K);
for (int j = 0; j < K; j++)
cin >> foods[j];
for (int f : foods)
v[f]++;
}
int count = 0;
for (int ff : v)
if (ff == N)
count++;
cout << count << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> v(M);
for (int i = 0; i < N; i++) {
int K;
cin >> K;
vector<int> foods(K);
for (int j = 0; j < K; j++)
cin >> foods[j];
for (int f : foods)
v[f - 1]++;
}
int count = 0;
for (int ff : v)
if (ff == N)
count++;
cout << count << endl;
return 0;
}
| replace | 18 | 19 | 18 | 19 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> f(m);
int a, b, c;
for (int i = 0; i < n; i++) {
f.at(i) = 0;
}
for (int i = 0; i < n; i++) {
cin >> a;
for (int j = 0; j < a; j++) {
cin >> b;
f.at(b - 1) += 1;
}
}
for (int i = 0; i < m; i++) {
if (f.at(i) == n) {
c += 1;
}
}
cout << c << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> f(m);
int a, b, c;
for (int i = 0; i < m; i++) {
f.at(i) = 0;
}
for (int i = 0; i < n; i++) {
cin >> a;
for (int j = 0; j < a; j++) {
cin >> b;
f.at(b - 1) += 1;
}
}
for (int i = 0; i < m; i++) {
if (f.at(i) == n) {
c += 1;
}
}
cout << c << endl;
}
| replace | 11 | 12 | 11 | 12 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
auto k = vector<int>(n, 0);
auto a = vector<vector<int>>(n, vector<int>(n, 0));
for (int i = 0; i < n; i++) {
cin >> k[i];
for (int j = 0; j < k[i]; j++) {
cin >> a[i][j];
}
}
auto v = vector<int>(m + 1, 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < k[i]; j++) {
v[a[i][j]]++;
}
}
cout << count_if(v.begin(), v.end(), [&n](int i) { return n == i; });
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
auto k = vector<int>(n, 0);
auto a = vector<vector<int>>(n, vector<int>(m, 0));
for (int i = 0; i < n; i++) {
cin >> k[i];
for (int j = 0; j < k[i]; j++) {
cin >> a[i][j];
}
}
auto v = vector<int>(m + 1, 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < k[i]; j++) {
v[a[i][j]]++;
}
}
cout << count_if(v.begin(), v.end(), [&n](int i) { return n == i; });
} | replace | 7 | 8 | 7 | 8 | 0 | |
p03126 | C++ | Runtime Error | #include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
set<int> food, likefood[M];
int A[N][M], K[N];
for (int i = 0; i < N; i++) {
cin >> K[i];
for (int k = 0; k < K[i]; k++) {
cin >> A[i][k];
likefood[i].insert(A[i][k]);
}
}
for (int i = 1; i <= M; i++)
food.insert(i);
for (int i = 0; i < N; i++) {
for (int f = 1; f <= M; f++) {
if (likefood[i].count(f) == 0)
food.erase(f);
}
}
cout << food.size() << endl;
return 0;
}
| #include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
set<int> food, likefood[N];
int A[N][M], K[N];
for (int i = 0; i < N; i++) {
cin >> K[i];
for (int k = 0; k < K[i]; k++) {
cin >> A[i][k];
likefood[i].insert(A[i][k]);
}
}
for (int i = 1; i <= M; i++)
food.insert(i);
for (int i = 0; i < N; i++) {
for (int f = 1; f <= M; f++) {
if (likefood[i].count(f) == 0)
food.erase(f);
}
}
cout << food.size() << endl;
return 0;
} | replace | 20 | 21 | 20 | 21 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<vector<bool>> A(M, vector<bool>(M, false));
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int a;
cin >> a;
A[i][a - 1] = true;
}
}
int ans = 0;
for (int i = 0; i < M; i++) {
bool judge = true;
for (int j = 0; j < N; j++) {
judge &= A[j][i];
}
if (judge) {
ans++;
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<vector<bool>> A(N, vector<bool>(M, false));
for (int i = 0; i < N; i++) {
int K;
cin >> K;
for (int j = 0; j < K; j++) {
int a;
cin >> a;
A[i][a - 1] = true;
}
}
int ans = 0;
for (int i = 0; i < M; i++) {
bool judge = true;
for (int j = 0; j < N; j++) {
judge &= A[j][i];
}
if (judge) {
ans++;
}
}
cout << ans << endl;
return 0;
} | replace | 8 | 9 | 8 | 9 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, ans = 0;
cin >> n >> m;
vector<vector<int>> data(n, vector<int>(m));
vector<int> like(m);
for (int i = 0; i < n; i++) {
cin >> data.at(i).at(0);
for (int j = 0; j < data.at(i).at(0); j++) {
cin >> data.at(i).at(j + 1);
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < data.at(i).at(0); j++) {
like.at(data.at(i).at(j + 1) - 1)++;
}
}
for (int i = 0; i < m; i++) {
if (like.at(i) == n)
ans++;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, ans = 0;
cin >> n >> m;
vector<vector<int>> data(n * m, vector<int>(n * m));
vector<int> like(m * n);
for (int i = 0; i < n; i++) {
cin >> data.at(i).at(0);
for (int j = 0; j < data.at(i).at(0); j++) {
cin >> data.at(i).at(j + 1);
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < data.at(i).at(0); j++) {
like.at(data.at(i).at(j + 1) - 1)++;
}
}
for (int i = 0; i < m; i++) {
if (like.at(i) == n)
ans++;
}
cout << ans << endl;
} | replace | 6 | 8 | 6 | 8 | 0 | |
p03126 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> v(m, 0);
int k, a;
for (int i = 0; i < n; i++) {
cin >> k;
for (int j = 0; j < k; j++) {
cin >> a;
v.at(a - 1)++;
}
}
sort(v.begin(), v.end());
int i = m - 1, ans = 0;
while (v.at(i) == n && i >= 0) {
ans++;
i--;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> v(m, 0);
int k, a;
for (int i = 0; i < n; i++) {
cin >> k;
for (int j = 0; j < k; j++) {
cin >> a;
v.at(a - 1)++;
}
}
sort(v.begin(), v.end());
int ans = 0;
for (int i = m - 1; i >= 0; i--) {
if (v.at(i) == n) {
ans++;
}
}
cout << ans << endl;
} | replace | 18 | 22 | 18 | 23 | 0 | |
p03126 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll a, b;
cin >> a >> b;
vector<ll> vec(b);
for (ll i = 0; i < a; i++) {
ll c;
cin >> c;
for (ll j = 0; i < c; j++) {
ll d;
cin >> d;
vec.at(d - 1) += 1;
}
}
ll e = 0;
for (ll i = 0; i < b; i++) {
if (vec.at(i) == a) {
e += 1;
}
}
cout << e << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll a, b;
cin >> a >> b;
vector<ll> vec(b);
for (ll i = 0; i < a; i++) {
ll c;
cin >> c;
for (ll j = 0; j < c; j++) {
ll d;
cin >> d;
vec.at(d - 1) += 1;
}
}
ll e = 0;
for (ll i = 0; i < b; i++) {
if (vec.at(i) == a) {
e += 1;
}
}
cout << e << endl;
return 0;
}
| replace | 11 | 12 | 11 | 12 | TLE | |
p03126 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, d, e;
cin >> a >> b;
vector<int> c(b, 0);
for (int i = 0; i < a; i++) {
cin >> d;
for (int j = 0; j < d; j++) {
cin >> e;
c.at(e - 1)++;
}
}
int count = 0;
for (int i = 0; i < b; b++) {
if (c.at(i) == a)
count++;
}
cout << count << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, d, e;
cin >> a >> b;
vector<int> c(b, 0);
for (int i = 0; i < a; i++) {
cin >> d;
for (int j = 0; j < d; j++) {
cin >> e;
c.at(e - 1)++;
}
}
int count;
for (int i = 0; i < b; i++) {
if (c.at(i) == a)
count++;
}
cout << count << endl;
} | replace | 14 | 16 | 14 | 16 | TLE | |
p03127 | C++ | Time Limit Exceeded | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int main() {
ll N;
cin >> N;
vector<ll> hp(N, 0);
rep(i, N) { cin >> hp[i]; }
sort(hp.begin(), hp.end());
ll min = hp[0];
rep(i, N) {
rep(j, N) {
ll ret = gcd(hp[i], hp[j]);
if (ret != 0 & min > ret) {
min = ret;
}
}
}
cout << min << endl;
return 0;
}
| #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int main() {
ll N;
cin >> N;
vector<ll> hp(N, 0);
rep(i, N) { cin >> hp[i]; }
sort(hp.begin(), hp.end());
ll min = hp[0];
rep(i, N - 1) {
ll ret = gcd(min, hp[i + 1]);
if (ret != 0 & ret < min) {
min = ret;
}
}
cout << min << endl;
return 0;
}
| replace | 30 | 36 | 30 | 34 | TLE | |
p03127 | C++ | Time Limit Exceeded | #include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int min;
min = a[0];
for (int i = 1; i < n; i++) {
if (min > a[i]) {
min = a[i];
}
}
int co = 1;
for (int i = min; i > 2; i--) {
bool flag = true;
for (int k = 0; k < n; k++) {
if (a[k] % i != 0) {
flag = false;
break;
}
}
if (flag) {
co = i;
break;
}
}
if (co == 1) {
bool flag = true;
for (int k = 0; k < n; k++) {
if (a[k] % 2 != 0) {
flag = false;
break;
}
}
if (flag) {
co = 2;
}
}
cout << co << endl;
return 0;
}
| #include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int min;
min = a[0];
for (int i = 1; i < n; i++) {
if (min > a[i]) {
min = a[i];
}
}
int co = 1;
for (int i = min; i > 2; i -= 2) {
bool flag = true;
for (int k = 0; k < n; k++) {
if (a[k] % i != 0) {
flag = false;
break;
}
}
if (flag) {
co = i;
break;
}
}
if (co == 1) {
bool flag = true;
for (int k = 0; k < n; k++) {
if (a[k] % 2 != 0) {
flag = false;
break;
}
}
if (flag) {
co = 2;
}
}
cout << co << endl;
return 0;
}
| replace | 25 | 26 | 25 | 26 | TLE | |
p03127 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <vector>
int gcd(int x, int y) {
int r;
while ((r = x % y) != 0) {
x = y;
y = r;
}
return y;
}
int main() {
int n, a[10001], t;
std::cin >> n;
for (int i = 0; i < n; i++) {
std::cin >> a[i];
}
t = a[0];
for (int i = 1; i < n; i++) {
t = gcd(t, a[i]);
}
std::cout << t << std::endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <vector>
int gcd(int x, int y) {
int r;
while ((r = x % y) != 0) {
x = y;
y = r;
}
return y;
}
int main() {
int n, a[100001], t;
std::cin >> n;
for (int i = 0; i < n; i++) {
std::cin >> a[i];
}
t = a[0];
for (int i = 1; i < n; i++) {
t = gcd(t, a[i]);
}
std::cout << t << std::endl;
return 0;
}
| replace | 21 | 22 | 21 | 22 | 0 | |
p03127 | Python | Runtime Error | from math import gcd
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
ans = gcd(ans, a[i])
print(ans)
| from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
ans = gcd(ans, a[i])
print(ans)
| replace | 0 | 1 | 0 | 1 | 0 | |
p03127 | C++ | Runtime Error | #include <algorithm>
#include <functional>
#include <iostream>
using namespace std;
#define MAX_N 100000
int gcd(int n, int m) {
if (n % m) {
return gcd(m, n % m);
} else {
return m;
}
}
int main() {
int N;
int A[MAX_N] = {0};
int min = 1e9 + 100;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A, A + N);
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (A[i] >= A[j]) {
if (A[j] % A[i]) {
min = std::min(min, A[i] % A[j]);
A[i] %= A[j];
} else {
min = std::min(min, A[j]);
A[i] = A[j];
}
} else {
if (A[j] % A[i]) {
min = std::min(min, A[j] % A[i]);
A[j] %= A[i];
} else {
min = std::min(min, A[i]);
A[j] = A[i];
}
}
}
}
cout << min << endl;
}
| #include <algorithm>
#include <functional>
#include <iostream>
using namespace std;
#define MAX_N 100000
int gcd(int n, int m) {
if (n % m) {
return gcd(m, n % m);
} else {
return m;
}
}
int main() {
int N;
int A[MAX_N] = {0};
int min = 1e9 + 100;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A, A + N);
for (int i = 1; i < N; i++) {
min = std::min(min, gcd(A[i], A[0]));
}
cout << min << endl;
}
| replace | 24 | 44 | 24 | 26 | 0 | |
p03127 | C++ | Runtime Error | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define pii std::pair<int, int>
#define pli std::pair<ll, int>
#define pil std::pair<int, ll>
#define psi std::pair<string, int>
#define pll std::pair<ll, ll>
#define pci std::pair<char, int>
#define sll(x) scanf("%lld", &x)
#define prll(x) printf("%lld ", x)
#define pri(x) printf("%d ", x)
#define si(x) scanf("%d", &x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int, int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int, ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
const ll INF = 10000000000000;
const ll mod = 1e9 + 7;
using namespace std;
void add(ll &a, ll b) {
a += b;
if (a >= mod)
a -= mod;
}
ll mul(ll a, ll b) { return (a * b) % mod; }
ull Pow(ull a, ull b) {
if (b == 0)
return 1;
ull c = Pow(a, b / 2);
if (b % 2)
return (a * ((c * c) % mod)) % mod;
return (c * c) % mod;
}
int main() {
IOS;
cout.precision(30);
int n;
cin >> n;
vll a(n);
for (int i = 0; i < n; i++)
cin >> n;
sort(a.begin(), a.end());
ll gcd = 0;
for (int i = 0; i < n; i++)
gcd = __gcd(a[i], gcd);
cout << gcd << endl;
return 0;
}
| #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define pii std::pair<int, int>
#define pli std::pair<ll, int>
#define pil std::pair<int, ll>
#define psi std::pair<string, int>
#define pll std::pair<ll, ll>
#define pci std::pair<char, int>
#define sll(x) scanf("%lld", &x)
#define prll(x) printf("%lld ", x)
#define pri(x) printf("%d ", x)
#define si(x) scanf("%d", &x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int, int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int, ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
const ll INF = 10000000000000;
const ll mod = 1e9 + 7;
using namespace std;
void add(ll &a, ll b) {
a += b;
if (a >= mod)
a -= mod;
}
ll mul(ll a, ll b) { return (a * b) % mod; }
ull Pow(ull a, ull b) {
if (b == 0)
return 1;
ull c = Pow(a, b / 2);
if (b % 2)
return (a * ((c * c) % mod)) % mod;
return (c * c) % mod;
}
int main() {
IOS;
cout.precision(30);
int n;
cin >> n;
vll a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a.begin(), a.end());
ll gcd = 0;
for (int i = 0; i < n; i++)
gcd = __gcd(a[i], gcd);
cout << gcd << endl;
return 0;
}
| replace | 60 | 61 | 60 | 61 | 0 | |
p03127 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;
int gcd(int a, int b) {
if (a < b) {
int tmp = a;
a = b;
b = tmp;
}
return a % b == 0 ? b : gcd(b, a % b);
}
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = gcd(a[0], a[1]);
for (int i = 2; i < n;) {
ans = gcd(ans, a[i]);
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;
int gcd(int a, int b) {
if (a < b) {
int tmp = a;
a = b;
b = tmp;
}
return a % b == 0 ? b : gcd(b, a % b);
}
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = gcd(a[0], a[1]);
for (int i = 2; i < n; i++) {
ans = gcd(ans, a[i]);
}
cout << ans << endl;
return 0;
}
| replace | 25 | 26 | 25 | 26 | TLE | |
p03127 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
using namespace std;
int main(void) {
ll n;
cin >> n;
ll mini;
bool bf = true;
vector<ll> a(n);
rep(i, n) { cin >> a[i]; }
sort(a.begin(), a.end());
while (bf) {
bf = false;
for (int i = 1; i < n; i++) {
if (a[i] % a[0] != 0) {
ll temp = a[i] % a[0];
bf = true;
a.erase(a.begin() + i);
a.insert(a.begin(), a[i] % a[0]);
}
}
}
cout << a[0] << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
using namespace std;
int main(void) {
ll n;
cin >> n;
ll mini;
bool bf = true;
vector<ll> a(n);
rep(i, n) { cin >> a[i]; }
sort(a.begin(), a.end());
while (bf) {
bf = false;
for (int i = 1; i < n; i++) {
if (a[i] % a[0] != 0) {
ll temp = a[i] % a[0];
bf = true;
a.erase(a.begin() + i);
a.insert(a.begin(), temp);
}
}
}
cout << a[0] << endl;
return 0;
} | replace | 22 | 23 | 22 | 23 | 0 | |
p03127 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
using namespace std;
long long A[10101];
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A, A + N);
int id;
while (A[N - 2] != 0) {
for (int i = 0; i < N; i++) {
if (A[i] > 0) {
id = i;
break;
}
}
if (id == N - 1)
break;
for (int i = id + 1; i < N; i++) {
A[i] %= A[id];
}
sort(A, A + N);
}
cout << A[N - 1] << endl;
} | #include <algorithm>
#include <iostream>
using namespace std;
long long A[101010];
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A, A + N);
int id;
while (A[N - 2] != 0) {
for (int i = 0; i < N; i++) {
if (A[i] > 0) {
id = i;
break;
}
}
if (id == N - 1)
break;
for (int i = id + 1; i < N; i++) {
A[i] %= A[id];
}
sort(A, A + N);
}
cout << A[N - 1] << endl;
} | replace | 5 | 6 | 5 | 6 | 0 | |
p03127 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <vector>
int gcd(int a, int b) {
if (a > b) {
return gcd(b, a);
} else {
if (b % a == 0) {
return a;
} else {
return gcd(b % a, a);
}
}
}
int main() {
int n;
std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++)
std::cin >> a[i];
int ans = a[0];
for (auto x : a) {
bool flag = true;
for (auto y : a) {
int r = gcd(x, y);
if (r == 1) {
std::cout << r << std::endl;
return 0;
}
ans = std::min(r, ans);
if (flag && r == x || r == y)
flag = false;
}
if (flag)
break;
}
std::cout << ans << std::endl;
}
| #include <algorithm>
#include <iostream>
#include <vector>
int gcd(int a, int b) {
if (a > b) {
return gcd(b, a);
} else {
if (b % a == 0) {
return a;
} else {
return gcd(b % a, a);
}
}
}
int main() {
int n;
std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++)
std::cin >> a[i];
int ans = a[0];
for (int i = 1; i < n; i++) {
ans = gcd(ans, a[i]);
}
std::cout << ans << std::endl;
}
| replace | 23 | 37 | 23 | 25 | TLE | |
p03127 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
typedef long long ll;
int main() {
ll n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
sort(all(a));
ll ans = 0;
for (int i = 0; i < n; i++) {
a[i + 1] = gcd(a[i], a[i + 1]);
}
cout << a[n - 1] << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
typedef long long ll;
int main() {
ll n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
sort(all(a));
for (int i = 0; i < n - 1; i++) {
a[i + 1] = gcd(a[i], a[i + 1]);
}
cout << a[n - 1] << endl;
}
| replace | 15 | 17 | 15 | 16 | 0 | |
p03127 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int int64_t
const int M = 35;
int n, ans, a[M];
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> a[1];
ans = a[1];
for (int i = 2; i <= n; i++) {
cin >> a[i];
ans = __gcd(ans, a[i]);
}
cout << ans;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int int64_t
const int M = 1e5 + 5;
int n, ans, a[M];
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> a[1];
ans = a[1];
for (int i = 2; i <= n; i++) {
cin >> a[i];
ans = __gcd(ans, a[i]);
}
cout << ans;
return 0;
}
| replace | 3 | 4 | 3 | 4 | 0 | |
p03127 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int gcd(int a, int b) {
if (b >= a)
return gcd(b, a);
if (b == 0)
return a;
return gcd(b, a % b);
}
int main() {
int n, ret;
cin >> n >> ret;
for (int i = 1; i < n; i++) {
int a;
cin >> a;
ret = gcd(ret, a);
}
cout << ret;
return 0;
} | #include <iostream>
using namespace std;
int gcd(int a, int b) {
if (b > a)
return gcd(b, a);
if (b == 0)
return a;
return gcd(b, a % b);
}
int main() {
int n, ret;
cin >> n >> ret;
for (int i = 1; i < n; i++) {
int a;
cin >> a;
ret = gcd(ret, a);
}
cout << ret;
return 0;
} | replace | 4 | 5 | 4 | 5 | TLE |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.