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
p03045
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <vector> #define rep(i, N) for (int i = 0; i < (int)N; i++) using namespace std; typedef long long ll; const ll LLINF = 9223372036854775807; const int INF = pow(2, 29); const int MOD = 1000000007; s...
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <vector> #define rep(i, N) for (int i = 0; i < (int)N; i++) using namespace std; typedef long long ll; const ll LLINF = 9223372036854775807; const int INF = pow(2, 29); const int MOD = 1000000007; s...
insert
48
48
48
50
0
p03045
C++
Runtime Error
// https://atcoder.jp/contests/abc126/tasks/abc126_e #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> PII; typedef pair<ll...
// https://atcoder.jp/contests/abc126/tasks/abc126_e #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> PII; typedef pair<ll...
replace
62
64
62
63
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); } return x * f; } const int N = 1e...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); } return x * f; } const int N = 1e...
replace
21
22
21
22
0
p03045
C++
Runtime Error
#include <algorithm> #include <cfloat> #include <complex> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #inc...
#include <algorithm> #include <cfloat> #include <complex> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #inc...
insert
39
39
39
40
-11
p03045
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <vector> using namespace std; class DisjointSet { public: vector<int> rank, p; DisjointSet() {} DisjointSet(int size) { rank.resize(size, 0); p.resize(size, 0); for (int i = 0; i < size; i++) makeSet(i); }...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <vector> using namespace std; class DisjointSet { public: vector<int> rank, p; DisjointSet() {} DisjointSet(int size) { rank.resize(size, 0); p.resize(size, 0); for (int i = 0; i < size; i++) makeSet(i); }...
replace
60
62
60
62
0
p03045
C++
Time Limit Exceeded
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++) #define REP1(i, n) for (ll i = 1; i < n; i++) #define REPR(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, m, n) for (ll i = m; i < n; i++) #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.ren...
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++) #define REP1(i, n) for (ll i = 1; i < n; i++) #define REPR(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, m, n) for (ll i = m; i < n; i++) #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.ren...
replace
22
23
22
23
TLE
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct DSU { int n; vector<int> ps; vector<int> rank; int num_components; DSU(int n) : n(n), ps(n), num_components(n) { for (int i = 0; i < n; ++i) { ps[i] = i; rank[i] = 0; } } int parent(int i) { if (ps[i] == i) { return i; ...
#include <bits/stdc++.h> using namespace std; struct DSU { int n; vector<int> ps; vector<int> rank; int num_components; DSU(int n) : n(n), ps(n), num_components(n), rank(n) { for (int i = 0; i < n; ++i) { ps[i] = i; rank[i] = 0; } } int parent(int i) { if (ps[i] == i) { ret...
replace
9
10
9
10
-11
p03045
C++
Time Limit Exceeded
#include "bits/stdc++.h" using namespace std; struct UnionFind { vector<int> par; UnionFind(int N) : par(N) { for (int i = 0; i < N; i++) par[i] = i; } int root(int x) { if (par[x] == x) return x; return root(par[x]); } void unite(int x, int y) { int rx = root(x); int ry...
#include "bits/stdc++.h" using namespace std; struct UnionFind { vector<int> par; UnionFind(int N) : par(N) { for (int i = 0; i < N; i++) par[i] = i; } int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); } void unite(int x, int y) { int rx = root(x); ...
replace
15
16
15
16
TLE
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define lli long long int #define ulli unsigned long long int #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define loop(i, a, b) for (lli i = a; i < b...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define lli long long int #define ulli unsigned long long int #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define loop(i, a, b) for (lli i = a; i < b...
delete
72
76
72
72
-11
p03045
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) int n, m, ans; vector<int> x, y, z, p; int find(int x) { while (x != p[x]) x = p[x]; return x; } voi...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) int n, m, ans; vector<int> x, y, z, p; int find(int x) { if (p[x] == x) return x; return p[x] = find...
replace
12
15
12
15
TLE
p03045
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long int ll; typedef pair<int, int> P; #define all(x) x.begin(), x.end() const ll mod =...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long int ll; typedef pair<int, int> P; #define all(x) x.begin(), x.end() const ll mod =...
replace
62
63
62
63
0
p03045
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, a) for (int i = (int)0; i < (int)a; ++i) #define pb push_back #define eb ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, a) for (int i = (int)0; i < (int)a; ++i) #define pb push_back #define eb ...
replace
72
73
72
73
0
p03045
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; const int a = 1e5 + 1000; int f[a]; int findf(int q) { if (f[q] < 0) { return q; } else { return findf(f[q]); } } int main() { int N; int M; cin >> N >> M; for (int i = 0; i < a; i++) { f[i] = -1; } for (int i = 0; i < M; i++)...
#include <algorithm> #include <iostream> using namespace std; const int a = 1e5 + 1000; int f[a]; int findf(int q) { if (f[q] < 0) { return q; } else { f[q] = findf(f[q]); return f[q]; } } int main() { int N; int M; cin >> N >> M; for (int i = 0; i < a; i++) { f[i] = -1; } for (int i...
replace
11
12
11
13
TLE
p03045
C++
Runtime Error
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef vector<int> VI; #define FOR(i, n) for (int(i) = 0; (i) < (n); (i)++) #define FOR1(i, n) for (i...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef vector<int> VI; #define FOR(i, n) for (int(i) = 0; (i) < (n); (i)++) #define FOR1(i, n) for (i...
replace
66
67
66
67
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxN = 2e5 + 7; const int maxV = 90010; // const int INF = 1e9+9; const ll INF = (1ll) << 60; const int MOD = 1e9 + 7; int fa[maxN]; int get(int x) { if (x == fa[x]) return fa[x]; else fa[x] = get(fa[x]...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxN = 2e5 + 7; const int maxV = 90010; // const int INF = 1e9+9; const ll INF = (1ll) << 60; const int MOD = 1e9 + 7; int fa[maxN]; int get(int x) { if (x == fa[x]) return fa[x]; else fa[x] = get(fa[x]...
replace
18
20
18
20
0
p03045
C++
Time Limit Exceeded
#include <stdio.h> const int maxn = 1e5 + 7; int pre[maxn]; bool you[maxn]; int Find(int x) { int p, tmp; p = x; while (x != pre[x]) x = pre[x]; while (p != x) { tmp = pre[x]; pre[x] = x; p = tmp; } return x; } void join(int x, int y) { int fx = Find(x); int fy = Find(y); if (fx != fy)...
#include <stdio.h> const int maxn = 1e5 + 7; int pre[maxn]; bool you[maxn]; int Find(int x) { if (pre[x] == x) return x; else return pre[x] = Find(pre[x]); } void join(int x, int y) { int fx = Find(x); int fy = Find(y); if (fx != fy) pre[fx] = fy; } int main() { int n, m, sum = 0, jian = 0; sc...
replace
5
15
5
9
TLE
p03045
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int fa[100007]; int find_(int x) { if (fa[x] != x) return find_(fa[x]); return fa[x]; } int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) fa[i] = i; for (int i = 1; i <= m; ++i) { int x, y, z; scanf("%d%d%d", &x, &y, &z);...
#include <bits/stdc++.h> using namespace std; int fa[100007]; int find_(int x) { if (fa[x] != x) return fa[x] = find_(fa[x]); return fa[x]; } int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) fa[i] = i; for (int i = 1; i <= m; ++i) { int x, y, z; scanf("%d%d%d", &x, ...
replace
5
6
5
6
TLE
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using Graph = vector<vector<ll>>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++) #define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--) const int dx[4] = {1, 0, -1, 0...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using Graph = vector<vector<ll>>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++) #define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--) const int dx[4] = {1, 0, -1, 0...
replace
105
106
105
107
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second #define pi pair<ll, ll> #define pii pair<ll, pi> #define pb push_back #define mk make_pair const int siz = 1e5 + 7; vector<int> par; int getparent(int x) { if (par[x] == x) return x; return par[x] = getparent(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second #define pi pair<ll, ll> #define pii pair<ll, pi> #define pb push_back #define mk make_pair const int siz = 1e5 + 7; vector<int> par; int getparent(int x) { if (par[x] == x) return x; return par[x] = getparent(...
replace
24
28
24
28
-11
p03045
Python
Runtime Error
# union-findで行けそう。 n, m = map(int, input().split()) par = [-1] * (n + 1) def find(a): if par[a] < 0: return a else: par[a] = find(par[a]) return par[a] def unite(a, b): a = find(a) b = find(b) if a == b: return False else: if par[a] < par[b]: ...
# union-findで行けそう。 n, m = map(int, input().split()) par = [-1] * (n + 1) def find(a): if par[a] < 0: return a else: par[a] = find(par[a]) return par[a] def unite(a, b): a = find(a) b = find(b) if a == b: return False else: if par[a] < par[b]: ...
replace
22
24
22
24
0
p03045
Python
Runtime Error
N, M = [int(_) for _ in input().split()] XYZ = [[int(_) for _ in input().split()] for _ in range(M)] UF = list(range(N + 1)) def find(x): if UF[x] != x: UF[x] = find(UF[x]) return UF[x] def unite(x, y): UF[find(x)] = find(y) def same(x, y): return find(x) == find(y) for x, y, z in XYZ: ...
import sys sys.setrecursionlimit(100000) N, M = [int(_) for _ in input().split()] XYZ = [[int(_) for _ in input().split()] for _ in range(M)] UF = list(range(N + 1)) def find(x): if UF[x] != x: UF[x] = find(UF[x]) return UF[x] def unite(x, y): UF[find(x)] = find(y) def same(x, y): return...
insert
0
0
0
3
0
p03045
Python
Runtime Error
n, m = map(int, input().split()) p = list(range(n)) def find(x): if p[x] != x: p[x] = find(p[x]) return p[x] def union(x, y): x, y = find(x), find(y) p[y] = x for _ in range(m): x, y, z = [int(i) - 1 for i in input().split()] if find(x) != find(y): union(x, y) ans = set()...
n, m = map(int, input().split()) p = list(range(n)) def find(x): if p[x] != x: p[x] = find(p[x]) return p[x] def union(x, y): x, y = find(x), find(y) p[x] = p[y] = min(x, y) for _ in range(m): x, y, z = [int(i) - 1 for i in input().split()] if find(x) != find(y): union(x, ...
replace
13
14
13
14
0
p03045
Python
Runtime Error
import sys # 再帰上限の変更(デフォルトは1000) sys.setrecursionlimit(10**20) N, M = map(int, input().split()) XYZ = [list(map(int, input().split())) for i in range(M)] # XがわかればYがわかるので、あるAiがわかったときどこまでわかるか?をグラフにしてDFSで探索 graph = [[] for i in range(N + 1)] seen = [0] * (N + 1) for X, Y, Z in XYZ: graph[X].append(Y) graph[Y...
import sys # 再帰上限の変更(デフォルトは1000) # 大きくしすぎるとREするらしい sys.setrecursionlimit(10**9) N, M = map(int, input().split()) XYZ = [list(map(int, input().split())) for i in range(M)] # XがわかればYがわかるので、あるAiがわかったときどこまでわかるか?をグラフにしてDFSで探索 graph = [[] for i in range(N + 1)] seen = [0] * (N + 1) for X, Y, Z in XYZ: graph[X].appe...
replace
3
4
3
5
OverflowError: Python int too large to convert to C int
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03045/Python/s787539670.py", line 4, in <module> sys.setrecursionlimit(10 ** 20) OverflowError: Python int too large to convert to C int
p03045
C++
Runtime Error
#include <bits/stdc++.h> using ll = long long; using namespace std; ll mod = 998244353; int N, M; vector<int> path[100001]; int pathed[100000] = {0}; void dfs(int now) { // cout << now << endl; pathed[now] = 1; for (int i(0); i < path[now].size(); i++) { int next = path[now][i]; if (pathed[next] == 0) ...
#include <bits/stdc++.h> using ll = long long; using namespace std; ll mod = 998244353; int N, M; vector<int> path[100001]; int pathed[100001] = {0}; void dfs(int now) { // cout << now << endl; pathed[now] = 1; for (int i(0); i < path[now].size(); i++) { int next = path[now][i]; if (pathed[next] == 0) ...
replace
7
8
7
8
0
p03045
C++
Runtime Error
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <set> #include <vector> static const int IINF = 1 << 30; static const long long LINF = 1LL << 60; static const long long MOD = 1.0e+9 + 7; template <typename T> std::vector<T> vectors(std::size_t n, T val) { return std::vector<T>(n,...
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <set> #include <vector> static const int IINF = 1 << 30; static const long long LINF = 1LL << 60; static const long long MOD = 1.0e+9 + 7; template <typename T> std::vector<T> vectors(std::size_t n, T val) { return std::vector<T>(n,...
replace
70
73
70
73
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define all(n) begin(n), end(n) struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; const long long INF = numeric_limits<long long>::max(); ty...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define all(n) begin(n), end(n) struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; const long long INF = numeric_limits<long long>::max(); ty...
replace
52
53
52
53
0
p03045
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define mod 1000000007 #define fr first #define se second #define ll long long #define PI 3.1415926535 #define pb push_back #define mpr make_pair #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define Senky_Bansal ios_base::sync_with_stdio(false); #define IIIT_ALLAHABAD ...
#include <bits/stdc++.h> #define mod 1000000007 #define fr first #define se second #define ll long long #define PI 3.1415926535 #define pb push_back #define mpr make_pair #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define Senky_Bansal ios_base::sync_with_stdio(false); #define IIIT_ALLAHABAD ...
replace
21
28
21
24
TLE
p03045
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; struct UnionFind { vector<int> d; UnionFind(int n = 0) : d(n, -1) {} int find(int x) { if (d[x] < 0) return x; return d[x] = find(d[x]); } bool unite(in...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; struct UnionFind { vector<int> d; UnionFind(int n = 0) : d(n, -1) {} int find(int x) { if (d[x] < 0) return x; return d[x] = find(d[x]); } bool unite(in...
insert
39
39
39
41
0
p03045
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) using Node = pair<int, bool>; // 親ノード番号(1始まり,0は親なし), 探索済みフラグ using NodeList = vector<Node>; int rootIndex(int index, NodeList ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) using Node = pair<int, bool>; // 親ノード番号(1始まり,0は親なし), 探索済みフラグ using NodeList = vector<Node>; int rootIndex(int index, NodeList ...
replace
11
13
11
17
TLE
p03045
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_set> #include <v...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_set> #include <v...
insert
164
164
164
166
0
p03045
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; #define INF ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; #define INF ...
replace
100
101
100
101
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (long long i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1000000007; const ll INF = 10000000000; #define all(v) v.begin(), v.end() vector<ll> par(100000); vector<ll> ran(100000); void init(ll n) { rep(i, n) { ...
#include <bits/stdc++.h> #define rep(i, n) for (long long i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1000000007; const ll INF = 10000000000; #define all(v) v.begin(), v.end() vector<ll> par(100000); vector<ll> ran(100000); void init(ll n) { rep(i, n) { ...
replace
45
46
45
46
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct UnionFind { vector<int> d; UnionFind(int n = 0) : d(n, -1) {} int find(int x) { if (d[x] < 0) return x; return d[x] = find(d[x]); } bool unite(int x, int y) { x = find(x); y = find(y); if (x == y) return false; if (d[x] ...
#include <bits/stdc++.h> using namespace std; struct UnionFind { vector<int> d; UnionFind(int n = 0) : d(n, -1) {} int find(int x) { if (d[x] < 0) return x; return d[x] = find(d[x]); } bool unite(int x, int y) { x = find(x); y = find(y); if (x == y) return false; if (d[x] ...
insert
36
36
36
39
0
p03045
C++
Runtime Error
#include <iostream> #include <map> #include <vector> using namespace std; struct UnionFind { vector<int> data; UnionFind(int sz) { data.assign(sz, -1); } bool unite(int x, int y) { x = find(x), y = find(y); if (x == y) return (false); if (data[x] > data[y]) swap(x, y); data[x] += da...
#include <iostream> #include <map> #include <vector> using namespace std; struct UnionFind { vector<int> data; UnionFind(int sz) { data.assign(sz, -1); } bool unite(int x, int y) { x = find(x), y = find(y); if (x == y) return (false); if (data[x] > data[y]) swap(x, y); data[x] += da...
replace
37
38
37
38
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct UnionFind { vector<int> par; UnionFind(int n) : par(n, -1) {} void init(int n) { par.assign(n, -1); } int root(int x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool same(int x, int y) { return root(x) == root...
#include <bits/stdc++.h> using namespace std; struct UnionFind { vector<int> par; UnionFind(int n) : par(n, -1) {} void init(int n) { par.assign(n, -1); } int root(int x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool same(int x, int y) { return root(x) == root...
replace
48
49
48
49
0
p03045
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <set> #include <string> #include <utility> #include <vector> using namespace std; // Union-Find class UnionFind { private: // parents[i] >= 0 なら i の親 // parents[i] < 0 で、根。abs(parents[i])がその木に属する頂点数 vector<int> parents; int n_root; public: ...
#include <algorithm> #include <cstdio> #include <iostream> #include <set> #include <string> #include <utility> #include <vector> using namespace std; // Union-Find class UnionFind { private: // parents[i] >= 0 なら i の親 // parents[i] < 0 で、根。abs(parents[i])がその木に属する頂点数 vector<int> parents; int n_root; public: ...
insert
71
71
71
73
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct Union { vector<int> par; Union(int a) { par = vector<int>(a, -1); } int find(int a) { if (par[a] < 0) { return a; } else { return par[a] = find(par[a]); } } bool same(int a, int b) { return (find(a) == find(b)); } int size(int a) {...
#include <bits/stdc++.h> using namespace std; struct Union { vector<int> par; Union(int a) { par = vector<int>(a, -1); } int find(int a) { if (par[a] < 0) { return a; } else { return par[a] = find(par[a]); } } bool same(int a, int b) { return (find(a) == find(b)); } int size(int a) {...
replace
38
39
38
39
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct Union { vector<int> par; Union(int a) { par = vector<int>(a, -1); } int find(int a) { if (par[a] < 0) { return a; } else { return par[a] = find(par[a]); } } bool same(int a, int b) { return (find(a) == find(b)); } int size(int a) {...
#include <bits/stdc++.h> using namespace std; struct Union { vector<int> par; Union(int a) { par = vector<int>(a, -1); } int find(int a) { if (par[a] < 0) { return a; } else { return par[a] = find(par[a]); } } bool same(int a, int b) { return (find(a) == find(b)); } int size(int a) {...
replace
32
33
32
33
0
p03045
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; int main() { int i, j, k; int N, M, x, y, z; cin >> N >> M; vector<vector<int>> to(N); vector<bool> d(N, false); for (i = 0; i < M; i++) { cin >> x >> y >> z; to[x].pus...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; int main() { int i, j, k; int N, M, x, y, z; cin >> N >> M; vector<vector<int>> to(N); vector<bool> d(N, false); for (i = 0; i < M; i++) { cin >> x >> y >> z; x--; ...
insert
17
17
17
19
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define repr(i, a, b) for (int i = a; i < b; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define invrepr(i, a, b) for (int i = b - 1; i >= a; i--) #define invrep(i, n) invrepr(i, 0, n) const int MOD = 1e9 + 7; struct UnionFind { vector<int> p...
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define repr(i, a, b) for (int i = a; i < b; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define invrepr(i, a, b) for (int i = b - 1; i >= a; i--) #define invrep(i, n) invrepr(i, 0, n) const int MOD = 1e9 + 7; struct UnionFind { vector<int> p...
replace
44
45
44
45
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define f(i, x, n) for (int i = x; i < n; i++) #define all(c) c.begin(), c.end() #define deg(x) cout << x << " " using ll = long long; using pll = pair<ll, ll>; using pii = pair<int, int>; const in...
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define f(i, x, n) for (int i = x; i < n; i++) #define all(c) c.begin(), c.end() #define deg(x) cout << x << " " using ll = long long; using pll = pair<ll, ll>; using pii = pair<int, int>; const in...
replace
32
36
32
33
-11
p03045
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int mod = 1000000007; vector<int> g[100005]; int z[100005]; void dfs(int x, int p) { for (int i : g[x]) if (i != p) { z[i] = 1; d...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int mod = 1000000007; vector<int> g[100005]; int z[100005]; void dfs(int x, int p) { for (int i : g[x]) if (i != p && !z[i]) { z[i] = 1...
replace
15
16
15
16
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i) #define all(n) begin(n), end(n) using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vl = vector<ll>; using vs ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i) #define all(n) begin(n), end(n) using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vl = vector<ll>; using vs ...
insert
51
51
51
53
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; using Graph = vector<vector<int>>; using P = pair<int, int>; int main() { int N, M; cin >> N >> M; Graph edge(M); rep(i, M) { int x, y, z; cin >> x >> y >> z; --x; --y; e...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; using Graph = vector<vector<int>>; using P = pair<int, int>; int main() { int N, M; cin >> N >> M; Graph edge(N); rep(i, M) { int x, y, z; cin >> x >> y >> z; --x; --y; e...
replace
10
11
10
11
-11
p03045
C++
Runtime Error
#include <bits/stdc++.h> /* #include<algorithm> #include<array> #include<cassert> #include<cmath> #include<cstdlib> #include<functional> #include<iomanip> #include<iostream> #include<map> #include<numeric> #include<queue> #include<set> #include<stack> #include<string> #include<typeinfo> #include<utility> #include<vecto...
#include <bits/stdc++.h> /* #include<algorithm> #include<array> #include<cassert> #include<cmath> #include<cstdlib> #include<functional> #include<iomanip> #include<iostream> #include<map> #include<numeric> #include<queue> #include<set> #include<stack> #include<string> #include<typeinfo> #include<utility> #include<vecto...
replace
109
110
109
110
0
p03045
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; using Graph = vector<vector<int>>; // 深さ優先探索 vector<bool> seen; void dfs(const Graph &G, int v) { seen[v] = true; for (auto next_v : G[v]) { if (seen[next_v]) continue; dfs(G, next_v); // 再帰的に探索 } } int main() { // 頂点数と辺数 int N, M; c...
#include <iostream> #include <vector> using namespace std; using Graph = vector<vector<int>>; // 深さ優先探索 vector<bool> seen; void dfs(const Graph &G, int v) { seen[v] = true; for (auto next_v : G[v]) { if (seen[next_v]) continue; dfs(G, next_v); // 再帰的に探索 } } int main() { // 頂点数と辺数 int N, M; c...
replace
26
28
26
28
0
p03045
C++
Runtime Error
#include <cstdio> #include <iostream> #define maxn 100005 using namespace std; int cnt, head[maxn], vis[maxn], ans, n, m; struct fdfdfd { int next, to; } e[maxn]; void addedge(int x, int y) { e[++cnt].to = y; e[cnt].next = head[x]; head[x] = cnt; } void dfs(int u) { vis[u] = 1; for (int i = head[u]; i; i = ...
#include <cstdio> #include <iostream> #define maxn 100005 using namespace std; int cnt, head[maxn], vis[maxn], ans, n, m; struct fdfdfd { int next, to; } e[maxn << 1]; void addedge(int x, int y) { e[++cnt].to = y; e[cnt].next = head[x]; head[x] = cnt; } void dfs(int u) { vis[u] = 1; for (int i = head[u]; i;...
replace
7
8
7
8
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define lli long long int #define REP(i, s, n) for (int i = s; i < n; i++) #define MOD 1000000007 #define NUM 2520 #define INF (1LL << 50) #define DEBUG 1 #define mp(a, b) make_pair(a, b) #define SORT(V) sort(V.begin(), V.end()) #define PI 3.14159265358979 signed main() ...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define REP(i, s, n) for (int i = s; i < n; i++) #define MOD 1000000007 #define NUM 2520 #define INF (1LL << 50) #define DEBUG 1 #define mp(a, b) make_pair(a, b) #define SORT(V) sort(V.begin(), V.end()) #define PI 3.14159265358979 signed main() ...
replace
19
20
19
20
0
p03045
C++
Time Limit Exceeded
// shan61916 #include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); ...
// shan61916 #include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); ...
replace
17
18
17
18
TLE
p03045
C++
Runtime Error
#include <bits/stdc++.h> #define _CRT_SECURE_NO_WARNINGS #define ll long long #define BUF 1e5 #define INF 1 << 30 using namespace std; ll MOD = 1e9 + 7; ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z; string S, T; ll ans = 0; struct UnionFind { vector<int> rank, parent, num; UnionFind(){}; UnionFind(int si...
#include <bits/stdc++.h> #define _CRT_SECURE_NO_WARNINGS #define ll long long #define BUF 1e5 #define INF 1 << 30 using namespace std; ll MOD = 1e9 + 7; ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z; string S, T; ll ans = 0; struct UnionFind { vector<int> rank, parent, num; UnionFind(){}; UnionFind(int si...
replace
53
54
53
54
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> #define mod 1000000007 #define mod998 998244353 #define sp ' ' #define intmax 2147483647 #define llmax 9223372036854775807 #define mkp make_pair typedef long long ll; using namespace std; int N, M, X, Y, Z, c, t[100000]; int T(int x) { if (t[x] < 0) return x; else t[x] = T(t[x]); ...
#include <bits/stdc++.h> #define mod 1000000007 #define mod998 998244353 #define sp ' ' #define intmax 2147483647 #define llmax 9223372036854775807 #define mkp make_pair typedef long long ll; using namespace std; int N, M, X, Y, Z, c, t[100000]; int T(int x) { if (t[x] < 0) return x; return t[x] = T(t[x]); } ...
replace
15
17
15
16
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; using ll = long long; #define repi(n) for (int i = 0; i < (n); i++) #define repj(n) for (int j = 0; j < (n); j++) #define repk(n) for (int k = 0; k < (n); k++) #define repl(n) for (int l = 0; l < (n); l++) #define rep(i, n) for (int i = 0; (...
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; using ll = long long; #define repi(n) for (int i = 0; i < (n); i++) #define repj(n) for (int j = 0; j < (n); j++) #define repk(n) for (int k = 0; k < (n); k++) #define repl(n) for (int l = 0; l < (n); l++) #define rep(i, n) for (int i = 0; (...
replace
182
185
182
185
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vs = vector<string>; using vll = vector<long long>; using vvi = vector<vector<int>>; using vvll = vector<vector<long long>>; template <class T>...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vs = vector<string>; using vll = vector<long long>; using vvi = vector<vector<int>>; using vvll = vector<vector<long long>>; template <class T>...
replace
59
60
59
63
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; struct UnionFind { vector<int> d; UnionFind(int n = 0) : d(n, -1) {} int find(int x) { if (d[x] < 0) return x; return d[x] = find(d[x]); } bool unite(int x, int y) { x = find(x); y = find(y); ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; struct UnionFind { vector<int> d; UnionFind(int n = 0) : d(n, -1) {} int find(int x) { if (d[x] < 0) return x; return d[x] = find(d[x]); } bool unite(int x, int y) { x = find(x); y = find(y); ...
insert
35
35
35
37
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> // include all standard C++ libraries using namespace std; // Loops #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define _rrep(i, n) rrepi(i, n, 0) #define rrepi(i, a, b) for (int i = int(a) - 1; i ...
#include <bits/stdc++.h> // include all standard C++ libraries using namespace std; // Loops #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define _rrep(i, n) rrepi(i, n, 0) #define rrepi(i, a, b) for (int i = int(a) - 1; i ...
replace
125
126
125
126
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // types typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<ld, ld> pdd; typedef vector<ll> vll; // macros #define ALL(a) a.begin(), a.end() #define SZ(a) ((int)a.size()) #define FI first #define SE second #def...
#include <bits/stdc++.h> using namespace std; // types typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<ld, ld> pdd; typedef vector<ll> vll; // macros #define ALL(a) a.begin(), a.end() #define SZ(a) ((int)a.size()) #define FI first #define SE second #def...
replace
87
88
87
88
0
p03045
C++
Runtime Error
#include <cstdio> #include <iostream> #include <vector> using namespace std; int n, m; vector<int> ve[100005]; int cnt; bool v[100005]; void dfs(int p) { if (v[p]) return; v[p] = true; for (int i = 0; i < ve[p].size(); i++) { dfs(ve[p][i]); } } int main() { scanf("%d%d", &n, &m); while (m--) { ...
#include <cstdio> #include <iostream> #include <vector> using namespace std; int n, m; vector<int> ve[100005]; int cnt; bool v[100005]; void dfs(int p) { if (v[p]) return; v[p] = true; for (int i = 0; i < ve[p].size(); i++) { dfs(ve[p][i]); } } int main() { scanf("%d%d", &n, &m); while (m--) { ...
replace
24
25
24
25
-11
p03045
C++
Runtime Error
// 7/4 #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; struct UnionFind { vector<int> d; UnionFind(int n = 0) : d(n, -1) {} int find(int x) { if (d[x] < 0) return x; return d[x] = find(d[x]); } bool un...
// 7/4 #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; struct UnionFind { vector<int> d; UnionFind(int n = 0) : d(n, -1) {} int find(int x) { if (d[x] < 0) return x; return d[x] = find(d[x]); } bool un...
replace
58
59
58
59
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; 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 (a > b) { a = b; return 1; } return 0; } #define _...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; 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 (a > b) { a = b; return 1; } return 0; } #define _...
insert
65
65
65
67
0
p03045
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; const int MAXM = 1e5 + 10; int n, m; int x[MAXM], y[MAXM], z[MAXM]; class UnionFind { vector<int> size_; vector<int> parent_; public: UnionFind(int n) { size_.reserve(n); parent_.reserve(n); for (int i = 0; i < n; i++) { size_.push_b...
#include <iostream> #include <vector> using namespace std; const int MAXM = 1e5 + 10; int n, m; int x[MAXM], y[MAXM], z[MAXM]; class UnionFind { vector<int> size_; vector<int> parent_; public: UnionFind(int n) { size_.reserve(n); parent_.reserve(n); for (int i = 0; i < n; i++) { size_.push_b...
insert
68
68
68
70
0
p03045
C++
Time Limit Exceeded
#include "bits/stdc++.h" using ll = long long; using namespace std; ll ans[101010]; ll find(ll x) { if (ans[x] == x) // root return x; return find(ans[x]); } void uni(ll x, ll y) { ans[find(x)] = find(y); } int main() { ll N, M; cin >> N >> M; ll x, y, z; for (ll i = 0; i <= N; i++) { ans[i] = i...
#include "bits/stdc++.h" using ll = long long; using namespace std; ll ans[101010]; ll find(ll x) { if (ans[x] == x) // root return x; return ans[x] = find(ans[x]); } void uni(ll x, ll y) { ans[find(x)] = find(y); } int main() { ll N, M; cin >> N >> M; ll x, y, z; for (ll i = 0; i <= N; i++) { a...
replace
9
10
9
10
TLE
p03045
C++
Time Limit Exceeded
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define MOD (1000000007) using namespace std; ...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define MOD (1000000007) using namespace std; ...
replace
53
54
53
54
TLE
p03045
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; using ll = long long; int INF = numeric_limits<int>::max() / 2; ll LINF = numeric_limits<ll>::max() / 2; int MOD = 1e9 + 7; class UnionFind { std::vector<int> data; public: UnionFind(int size) : data(size, -1) {} bool unite(int x, int y) { x = root(x); y = r...
#include "bits/stdc++.h" using namespace std; using ll = long long; int INF = numeric_limits<int>::max() / 2; ll LINF = numeric_limits<ll>::max() / 2; int MOD = 1e9 + 7; class UnionFind { std::vector<int> data; public: UnionFind(int size) : data(size, -1) {} bool unite(int x, int y) { x = root(x); y = r...
insert
36
36
36
38
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; #ifdef _DEBUG inline void dump() { cerr << endl; } template <typename Head> void dump(Head &&head) { cerr << head; dump(); } template <typename Head, typename... Tail> void dump(Head &&head, Tail &&....
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; #ifdef _DEBUG inline void dump() { cerr << endl; } template <typename Head> void dump(Head &&head) { cerr << head; dump(); } template <typename Head, typename... Tail> void dump(Head &&head, Tail &&....
replace
72
75
72
75
0
p03045
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define RI register int typedef long long LL; int fa[100005], vis[100005]; int Find(int x) { return x == fa[x] ? x : Find(fa[x]); } int main() { int n, m; scanf("%d %d", &n, &m); for (RI i = 1; i <= n; ++i) fa[i] = i; for (RI i = 1, x, y, z; i <= m; ++i) scanf("%d %d %d", &x, ...
#include <bits/stdc++.h> #define RI register int typedef long long LL; int fa[100005], vis[100005]; int Find(int x) { return x == fa[x] ? x : fa[x] = Find(fa[x]); } int main() { int n, m; scanf("%d %d", &n, &m); for (RI i = 1; i <= n; ++i) fa[i] = i; for (RI i = 1, x, y, z; i <= m; ++i) scanf("%d %d %...
replace
5
6
5
6
TLE
p03045
C++
Runtime Error
#include <cstdlib> #include <iostream> #include <queue> #include <stdio.h> #include <vector> typedef struct _xyz { int x; int y; int z; } xyz; typedef struct _node { std::vector<int> nbr; // zero-based numbering (node_arr[nbr] } node; int main(void) { int n, m; scanf("%d%d", &n, &m); xyz *xyz_arr = (xy...
#include <cstdlib> #include <iostream> #include <queue> #include <stdio.h> #include <vector> typedef struct _xyz { int x; int y; int z; } xyz; typedef struct _node { std::vector<int> nbr; // zero-based numbering (node_arr[nbr] } node; int main(void) { int n, m; scanf("%d%d", &n, &m); xyz *xyz_arr = (xy...
replace
33
34
33
34
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> #define _overload(_1, _2, _3, name, ...) name #define _rep(i, n) _range(i, 0, n) #define _range(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload(__VA_ARGS__, _range, _rep, )(__VA_ARGS__) #define _rrep(i, n) _rrange(i, n, 0) #define _rrange(i, a, b) for (int i = int(a)...
#include <bits/stdc++.h> #define _overload(_1, _2, _3, name, ...) name #define _rep(i, n) _range(i, 0, n) #define _range(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload(__VA_ARGS__, _range, _rep, )(__VA_ARGS__) #define _rrep(i, n) _rrange(i, n, 0) #define _rrange(i, a, b) for (int i = int(a)...
insert
85
85
85
86
0
p03045
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <memory> #include <queue> #include <regex> #include <set> #include <sstream> #include <stac...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <memory> #include <queue> #include <regex> #include <set> #include <sstream> #include <stac...
replace
139
141
139
141
0
p03045
C++
Runtime Error
#include <cmath> #include <iostream> #include <vector> using namespace std; using ll = long long; const double pi = acos(-1); #define FOR(i, a, b) for (ll i = (a), __last_##i = (b); i < __last_##i; i++) #define RFOR(i, a, b) for (ll i = (b)-1, __last_##i = (a); i >= __last_##i; i--) #define REP(i, n) FOR(i, 0, n) #defi...
#include <cmath> #include <iostream> #include <vector> using namespace std; using ll = long long; const double pi = acos(-1); #define FOR(i, a, b) for (ll i = (a), __last_##i = (b); i < __last_##i; i++) #define RFOR(i, a, b) for (ll i = (b)-1, __last_##i = (a); i >= __last_##i; i--) #define REP(i, n) FOR(i, 0, n) #defi...
replace
97
98
97
98
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } ret...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } ret...
insert
68
68
68
70
0
p03045
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; const int INF = 1 << 30; const ll MOD = 1e9 + 7; const double EPS = 1e-9; struct UnionFind { ...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; const int INF = 1 << 30; const ll MOD = 1e9 + 7; const double EPS = 1e-9; struct UnionFind { ...
replace
61
62
61
62
0
p03045
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; using ll = long long int; using pii = pair<int, int>; using pil = pair<int, ll>; // Graph.h start-------------------------------------------- #pragma once #include <vector> using Weight = long long; struct Vertex; using Vertices = std::vector<Vertex *>; struct Edge; us...
#include "bits/stdc++.h" using namespace std; using ll = long long int; using pii = pair<int, int>; using pil = pair<int, ll>; // Graph.h start-------------------------------------------- #pragma once #include <vector> using Weight = long long; struct Vertex; using Vertices = std::vector<Vertex *>; struct Edge; us...
replace
111
112
111
112
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; bool isEven(int x) { if (x % 2 == 0) return true; else return false; } class UnionFind { public: vector<int> parent; UnionFind(int n) : parent(n) { for (int i = 0; i < n; i++) { parent[i] = i; } } int root(int x) { if (parent[x] == ...
#include <bits/stdc++.h> using namespace std; bool isEven(int x) { if (x % 2 == 0) return true; else return false; } class UnionFind { public: vector<int> parent; UnionFind(int n) : parent(n) { for (int i = 0; i < n; i++) { parent[i] = i; } } int root(int x) { if (parent[x] == ...
replace
44
47
44
47
0
p03045
C++
Runtime Error
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define rep2(i, n) for (int i = 0; i <= n; i++) #define repr(i, a, n) for (int i = a; i < n; i++) #define all(a) a.begin(), a.end() #de...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define rep2(i, n) for (int i = 0; i <= n; i++) #define repr(i, a, n) for (int i = a; i < n; i++) #define all(a) a.begin(), a.end() #de...
replace
57
58
57
58
0
p03045
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; using ll = long long; const ll MOD = 1000000007; #define rep(i, a, b) for (ll i = a; i < b; i++) #define range(i) (i).begin(), (i).end() #define rrange(i) (...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; using ll = long long; const ll MOD = 1000000007; #define rep(i, a, b) for (ll i = a; i < b; i++) #define range(i) (i).begin(), (i).end() #define rrange(i) (...
replace
67
68
67
68
-11
p03045
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; class unionFind { int nodeSize; vector<int> parent; public: unionFind(int n) : nodeSize(n) { parent = vector<int>(n + 1, -1); } int getRoot(int a) { if (parent[a] < 0) { return a; } return parent[a] = getRoot(p...
#include <algorithm> #include <iostream> #include <vector> using namespace std; class unionFind { int nodeSize; vector<int> parent; public: unionFind(int n) : nodeSize(n) { parent = vector<int>(n + 1, -1); } int getRoot(int a) { if (parent[a] < 0) { return a; } return parent[a] = getRoot(p...
replace
40
41
40
41
0
p03045
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define repp(i, l, r) for (int i = (l); i < (r); i++) #define per(i, n) for (int i = ((n)-1); i >= 0; i--) #define perr(i, l, r) for (int i = ((r)-1); i >= (l); i--) #define all(x) (x).begin(), (x).end() #define MOD 100000000...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define repp(i, l, r) for (int i = (l); i < (r); i++) #define per(i, n) for (int i = ((n)-1); i >= 0; i--) #define perr(i, l, r) for (int i = ((r)-1); i >= (l); i--) #define all(x) (x).begin(), (x).end() #define MOD 100000000...
replace
31
32
31
32
0
p03047
Python
Runtime Error
N, K = map(int, input()) print(N - K + 1)
N, K = map(int, input().split()) print(N - K + 1)
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/p03047/Python/s597421224.py", line 1, in <module> N, K = map(int, input()) ValueError: invalid literal for int() with base 10: ' '
p03047
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define fi first #define se second #define pii pair<int, int> #define mp make_pair #define pb push_back #define space putchar(' ') #define enter putchar('\n') #define eps 1e-10 #define MAXN 1005 #define ivorysi using namespace std; typedef long long int64; typedef unsigned int u32; typedef doub...
#include <bits/stdc++.h> #define fi first #define se second #define pii pair<int, int> #define mp make_pair #define pb push_back #define space putchar(' ') #define enter putchar('\n') #define eps 1e-10 #define MAXN 1005 // #define ivorysi using namespace std; typedef long long int64; typedef unsigned int u32; typedef d...
replace
10
11
10
11
TLE
p03047
C++
Runtime Error
#include <iostream> using namespace std; int main() { int x, y, z, n; int count = 0; cin >> x >> y >> z >> n; int x_c = 0; int y_c = 0; while (true) { y_c = 0; if (n - x_c * x < 0) break; while (true) { if (n - x_c * x - y_c * y < 0) break; if ((n - x_c * x - y_c * y) ...
#include <iostream> using namespace std; int main() { int x, y; cin >> x >> y; cout << x - y + 1 << endl; return 0; }
replace
4
23
4
7
TLE
p03047
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int mother = 1, child = 1; for (int i = n; i >= n - k + 1; i--) { child *= i; } for (int i = 1; i <= k; i++) { mother *= i; } cout << child / mother << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; cout << n - k + 1 << endl; }
replace
6
15
6
7
0
p03047
C++
Runtime Error
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; int a = 1; int b = 1; for (int i = 0; i < K; i++) { a *= N - i; } for (int j = 0; j < K; j++) { b *= K - j; } int ans = a / b; cout << ans << endl; return 0; }
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; int ans = N - K + 1; cout << ans << endl; return 0; }
replace
10
22
10
11
0
p03047
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { int N = 0, K = 0; cin >> N >> K; int P = 1, R = 1; for (int i = 0; i < N; ++i) { P = (N - i) * P; R = (K - i) * R; } int ans = P / R; cout << ans << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { int N = 0, K = 0; cin >> N >> K; int P = 1, R = 1; int ans = N - K + 1; cout << ans << endl; return 0; }
replace
13
19
13
14
-8
p03047
C++
Runtime Error
#include <iostream> using namespace std; int main(int argc, char *argv[]) { int N, K; cin >> N >> K; int pattern = 0; for (int l = 1; l <= N; l++) { if (l + (K - 1) <= N) { pattern++; } } cout << pattern << endl; return 1; }
#include <iostream> using namespace std; int main(int argc, char *argv[]) { int N, K; cin >> N >> K; int pattern = 0; for (int l = 1; l <= N; l++) { if (l + (K - 1) <= N) { pattern++; } } cout << pattern << endl; return 0; }
replace
19
20
19
20
1
p03047
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef vector<LL> VLL; typedef vector<ULL> V...
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef vector<LL> VLL; typedef vector<ULL> V...
replace
1,016
1,021
1,016
1,018
0
p03047
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int #define ld long double #define F first #define S second #define P pair<int, int> #define V vector #define pb push_back #define db(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << na...
#include <bits/stdc++.h> using namespace std; #define int long long int #define ld long double #define F first #define S second #define P pair<int, int> #define V vector #define pb push_back #define db(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << na...
delete
29
34
29
29
0
p03047
Python
Runtime Error
N, K = map(int, input()) print(N - (K - 1))
N, K = map(int, input().split()) print(N - (K - 1))
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/p03047/Python/s207697669.py", line 1, in <module> N, K = map(int, input()) ValueError: invalid literal for int() with base 10: ' '
p03047
C++
Runtime Error
#include "stdio.h" int main() { int K, N; scanf("%d %d", N, K); printf("%d", N - K + 1); return 0; }
#include "stdio.h" int main() { int K, N, a; scanf("%d %d", &N, &K); a = N - K + 1; printf("%d", a); return 0; }
replace
2
5
2
6
-11
p03048
C++
Time Limit Exceeded
#include "bits/stdc++.h" using namespace std; #define ll long long #define endl '\n' #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = int(a); i < int(b); i++) #define pb emplace_back #define all(x) (x).begin(), (x).end() int mod = 1e9 + 7; int mod2 = 998244353; const int INF = 1e9...
#include "bits/stdc++.h" using namespace std; #define ll long long #define endl '\n' #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = int(a); i < int(b); i++) #define pb emplace_back #define all(x) (x).begin(), (x).end() int mod = 1e9 + 7; int mod2 = 998244353; const int INF = 1e9...
replace
19
23
19
21
TLE
p03048
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1000000007; int main() { ll R, G, B, N; cin >> R >> G >> B >> N; ll ans = 0; ll r = N / R; for (ll i = r; i >= 0; i--) { ll n = N - i * R; if (n == 0) { ans++; continue; } else { ll g = n / G; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1000000007; int main() { ll R, G, B, N; cin >> R >> G >> B >> N; ll ans = 0; ll r = N / R; for (ll i = r; i >= 0; i--) { ll n = N - i * R; if (n == 0) { ans++; continue; } else { ll g = n / G; ...
replace
22
31
22
24
TLE
p03048
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long int int R, G, B, N; string S; vector<ll> vec(100000); int main() { int count = 0; cin >> R >> G >> B >> N; for (int i = 0; i <= N / R; i++) { for (int j = 0; j <= N / G; j++) { for (int k = 0; k <= N / B; k++) { if (i * R + j *...
#include <bits/stdc++.h> using namespace std; #define ll long long int int R, G, B, N; string S; vector<ll> vec(100000); int main() { int count = 0; cin >> R >> G >> B >> N; for (int i = 0; i <= N / R; i++) { for (int j = 0; j <= N / G; j++) { if ((N - (i * R + j * G)) >= 0 && (N - (i * R + j * G)) % ...
replace
13
16
13
16
TLE
p03048
C++
Time Limit Exceeded
#include <stdio.h> int main() { int r, g, b, n; int ans = 0; int i, j, k; scanf("%d%d%d%d", &r, &g, &b, &n); // printf ("%d %d %d %d\n",r,g,b,n); for (i = 0; i <= (n / r) + 1; ++i) { for (j = 0; j <= (n / g) + 1; ++j) { for (k = 0; k < (n / b) + 1; ++k) { if (r * i + g * j + k * b == n) { ...
#include <stdio.h> int main() { int r, g, b, n; int ans = 0; int i, j, k; scanf("%d%d%d%d", &r, &g, &b, &n); // printf ("%d %d %d %d\n",r,g,b,n); for (i = 0; i <= (n / r) + 10; ++i) { for (j = 0; j <= (n / g) + 10; ++j) { int p = n - i * r - g * j; if (p % b == 0 && p / b >= 0) ans++...
replace
7
14
7
12
TLE
p03048
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int R, G, B, N, r, g, b, sum = 0; vector<int> rgb(3); cin >> rgb.at(0) >> rgb.at(1) >> rgb.at(2) >> N; sort(rgb.begin(), rgb.end()); R = rgb.at(0); G = rgb.at(1); B = rgb.at(2); for (int r = 0; r < N / R + 1; r++) { int N1 = (N - R * r) / G...
#include <bits/stdc++.h> using namespace std; int main() { int R, G, B, N, r, g, b, sum = 0; vector<int> rgb(3); cin >> rgb.at(0) >> rgb.at(1) >> rgb.at(2) >> N; sort(rgb.begin(), rgb.end()); R = rgb.at(0); G = rgb.at(1); B = rgb.at(2); for (int r = 0; r < N / R + 1; r++) { int N1 = (N - R * r) / G...
replace
14
20
14
16
TLE
p03048
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define LONGLONGMAX 9223372036854775807 #define LONGLONGMIN -9223372036854775807 #define INTMAX 32767 #define INTMIN -32767 #define ROUNDUP(divisor, dividend) (divisor + (dividend - 1)) / dividend int r, g, b, n; int main() { cin >> r >> g >> b >> n; int c = 0; for (s...
#include <bits/stdc++.h> using namespace std; #define LONGLONGMAX 9223372036854775807 #define LONGLONGMIN -9223372036854775807 #define INTMAX 32767 #define INTMIN -32767 #define ROUNDUP(divisor, dividend) (divisor + (dividend - 1)) / dividend int r, g, b, n; int main() { cin >> r >> g >> b >> n; int c = 0; for (i...
replace
11
17
11
17
TLE
p03048
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main(int argc, char *argv[]) { int R, G, B, N; cin >> R >> G >> B >> N; int ret = 0; for (int i = 0; i <= N / R; ++i) { int rest = N - i * R; if (rest < 0) continue; for (int j = 0; j <= rest / G; ++j) { int rest2 = rest - j * G; if (...
#include <iostream> using namespace std; int main(int argc, char *argv[]) { int R, G, B, N; cin >> R >> G >> B >> N; int ret = 0; for (int i = 0; i <= N / R; ++i) { int rest = N - i * R; if (rest < 0) continue; for (int j = 0; j <= rest / G; ++j) { int rest2 = rest - j * G; if (...
replace
17
25
17
19
TLE
p03048
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <math.h> #define ll long long int #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, n) using namespace std; int main() { int R, G, B, N; cin >> R >> G >> B >> N; int ans = 0; REP(r, N / R + ...
#include <algorithm> #include <iostream> #include <math.h> #define ll long long int #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, n) using namespace std; int main() { int R, G, B, N; cin >> R >> G >> B >> N; int ans = 0; REP(r, N / R + ...
replace
20
26
20
22
TLE
p03048
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int r, g, b, n; int cnt = 0; cin >> r >> g >> b >> n; if (g > r && g > b) { int tmp = g; g = r; r = tmp; } if (b > g && b > r) { int tmp = b; b = r; r = tmp; } for (int i = 0; i <= n / r; i++) { for (int j = 0; j <= n / ...
#include <iostream> using namespace std; int main() { int r, g, b, n; int cnt = 0; cin >> r >> g >> b >> n; if (g > r && g > b) { int tmp = g; g = r; r = tmp; } if (b > g && b > r) { int tmp = b; b = r; r = tmp; } for (int i = 0; i <= n / r; i++) { for (int j = 0; j <= n / ...
replace
23
28
23
25
TLE
p03048
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define INF 100000000 #define ll long long #define REP(i, n) for (int i = 0; i < n; i++) #define REPP(i, m, n) for (int i = m; i < n; i++) #define de cout << "debug" << endl; int main() { int R, G, B, N; cin >> R >> G >> B >> N; int cnt = 0; REP(i, (N + 1) / R + 1...
#include <bits/stdc++.h> using namespace std; #define INF 100000000 #define ll long long #define REP(i, n) for (int i = 0; i < n; i++) #define REPP(i, m, n) for (int i = m; i < n; i++) #define de cout << "debug" << endl; int main() { int R, G, B, N; cin >> R >> G >> B >> N; int cnt = 0; REP(i, N / R + 1) { ...
replace
13
20
13
19
TLE
p03048
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main(void) { int r, g, b, n; cin >> r; cin >> g; cin >> b; cin >> n; int cnt = 0; for (int i = 0; i < n / r + 1; i++) { for (int j = 0; j < (n - i * r) / g + 1; j++) { for (int k = 0; k < (n - i * r - j * g) / b + 1; k++) { if (i * r + j...
#include <bits/stdc++.h> using namespace std; int main(void) { int r, g, b, n; cin >> r; cin >> g; cin >> b; cin >> n; int cnt = 0; for (int i = 0; i < n / r + 1; i++) { for (int j = 0; j < (n - i * r) / g + 1; j++) { if ((n - i * r - j * g) % b == 0) cnt++; } } cout << cnt << e...
replace
12
19
12
14
TLE
p03048
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int R, G, B, N; cin >> R >> G >> B >> N; int ans = 0; for (int r = 0; R * r <= N; r++) { for (int g = 0; R * r + G * g <= N; g++) { for (int b = 0; R * r + G * g + B * b <= N; b++) { if (R * r + G * g + B * b == N) { ans+...
#include <bits/stdc++.h> using namespace std; int main() { int R, G, B, N; cin >> R >> G >> B >> N; int ans = 0; for (int r = 0; R * r <= N; r++) { for (int g = 0; R * r + G * g <= N; g++) { int a = N - (R * r + G * g); if (a % B == 0) ans++; } } cout << ans << endl; retu...
replace
12
18
12
15
TLE