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
p02934
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, sum = 0; cin >> n; double a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { sum = sum + (1 / a[i]); } cout << 1 / sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; double sum = 0.0; cin >> n; double a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { sum = sum + (1 / a[i]); } cout << 1 / sum << endl; }
replace
3
4
3
5
0
p02934
C++
Time Limit Exceeded
#include <algorithm> #include <cassert> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); size_t N; std::cin >> N; assert(N...
#include <algorithm> #include <cassert> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); size_t N; std::cin >> N; assert(N...
replace
29
30
29
30
TLE
p02934
C++
Runtime Error
#include <iostream> using namespace std; int main() { int n; double a[101], b[101]; cin >> n; int sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = 1 / a[i]; sum += b[i]; } cout << 1 / sum << endl; return 0; }
#include <iostream> using namespace std; int main() { int n; double a[101], b[101]; cin >> n; double sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = 1 / a[i]; sum += b[i]; } cout << 1 / sum << endl; return 0; }
replace
6
7
6
7
0
p02934
C++
Time Limit Exceeded
#include <algorithm> #include <cassert> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); size_t N; std::cin >> N; assert(N...
#include <algorithm> #include <cassert> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); size_t N; std::cin >> N; assert(N...
replace
29
30
29
30
TLE
p02934
C++
Runtime Error
#include <bits/stdc++.h> #define MOD 1000000007 #define MAX 10005 #define int long long #define T \ int t; \ cin >> t; ...
#include <bits/stdc++.h> #define MOD 1000000007 #define MAX 10005 #define int long long #define T \ int t; \ cin >> t; ...
replace
17
21
17
18
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p02934
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { cin.tie(0); ios::sync_with_stdio(false); int sum = 0; int n = 0; cin >> n; rep(i, n) { double A = 0; cin >> A; sum += 1 / A; } cout << 1 / sum << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { cin.tie(0); ios::sync_with_stdio(false); double sum = 0; int n = 0; cin >> n; rep(i, n) { double A = 0; cin >> A; sum += 1 / A; } cout << 1 / sum << endl; }
replace
7
8
7
8
0
p02934
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long int #define pb push_back #define rep(i, a, b, c) for (ll i = (a); i <= (b); i += (c)) #define repb(i, a, b, c) for (ll i = (a); i >= (b); i -= (c))...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long int #define pb push_back #define rep(i, a, b, c) for (ll i = (a); i <= (b); i += (c)) #define repb(i, a, b, c) for (ll i = (a); i >= (b); i -= (c))...
replace
299
300
299
300
TLE
p02934
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define debug(x) '[' << #x << " is: " << x << "] " typedef long long ll; typedef long double ld; typedef unsigned long long ull; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed; #ifndef ONLINE_JUDGE freopen("input.txt", "...
#include <bits/stdc++.h> using namespace std; #define debug(x) '[' << #x << " is: " << x << "] " typedef long long ll; typedef long double ld; typedef unsigned long long ull; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed; int n; cin >> n; double ans = 0; for ...
delete
14
17
14
14
0
p02934
C++
Runtime Error
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n = 1; cin >> n; vector<double> a(n); double s1 = 0, s2 = 1; for (int i = 0; i < n; i++) { cin >> a[n]; s1 += 1 / a[n]; } cout << 1 / s1 << endl; return 0; }
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n = 1; cin >> n; // vector<double>a(n); double a[105]; double s1 = 0, s2 = 1; for (int i = 0; i < n; i++) { cin >> a[n]; s1 += 1 / a[n]; } cout << 1 / s1 << endl; return 0; }
replace
7
8
7
9
0
p02934
C++
Runtime Error
#include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> A(N); float ans = 0; for (int i = 0; i < N; i++) { cin >> A[i]; ans += (float)1 / A[i]; } return (float)1 / ans; }
#include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> A(N); float ans = 0; for (int i = 0; i < N; i++) { cin >> A[i]; ans += (float)1 / A[i]; } cout << (float)1 / ans << endl; return 0; }
replace
16
17
16
18
7
p02934
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, a, b) for (int i = (int)a; i <= (int)b; i++) #define fi first #define sc second #define pb push_back #define all(x) x.begin(), x.end() using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pair<int, int>> vpii; typedef long long i64; typedef vecto...
#include <bits/stdc++.h> #define REP(i, a, b) for (int i = (int)a; i <= (int)b; i++) #define fi first #define sc second #define pb push_back #define all(x) x.begin(), x.end() using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pair<int, int>> vpii; typedef long long i64; typedef vecto...
replace
31
32
31
32
0
p02934
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<in...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<in...
replace
42
43
42
43
TLE
p02934
Python
Runtime Error
n = int(input()) a = list(map(int, input().split())) div = 0 for i in range(n): div += a / a[i] print(1 / div)
n = int(input()) a = list(map(int, input().split())) div = 0 for i in range(n): div += 1 / a[i] print(1 / div)
replace
5
6
5
6
TypeError: unsupported operand type(s) for /: 'list' and 'int'
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02934/Python/s178492873.py", line 6, in <module> div += a / a[i] TypeError: unsupported operand type(s) for /: 'list' and 'int'
p02934
Python
Runtime Error
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in n: ans += 1 / i print(1 / ans)
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in a: ans += 1 / i print(1 / ans)
replace
3
4
3
4
TypeError: 'int' object is not iterable
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02934/Python/s273231160.py", line 4, in <module> for i in n: TypeError: 'int' object is not iterable
p02934
Python
Runtime Error
import numpy as np N = int(input()) A = [float(input()) for _ in range(N)] nA = np.array(A) print(np.reciprocal(np.sum(np.reciprocal(nA))))
import numpy as np N = int(input()) A = [float(x) for x in input().split()] nA = np.array(A) print(np.reciprocal(np.sum(np.reciprocal(nA))))
replace
3
4
3
4
TLE
p02934
C++
Runtime Error
#include <iostream> using namespace std; int main(void) { // Your code here! int n; float gyaku[10], sum = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> gyaku[i]; gyaku[i] = 1 / gyaku[i]; sum += gyaku[i]; } cout << 1 / sum; }
#include <iostream> using namespace std; int main(void) { // Your code here! int n; float gyaku[100], sum = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> gyaku[i]; gyaku[i] = 1 / gyaku[i]; sum += gyaku[i]; } cout << 1 / sum; }
replace
5
6
5
6
0
p02935
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v; for (int i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); float res = (float)v[0]; for (int i = 1; i < n; i++) res = (float)((res + v[i]) / 2); cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); float res = (float)v[0]; for (int i = 1; i < n; i++) res = (float)((res + v[i]) / 2); cout << res << endl; return 0; }
replace
6
7
6
7
-11
p02935
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <math.h> #include <queue> #include <vector> using namespace std; void solve() { int n; cin >> n; vector<int> gu(n); for (int i = 0; i < n; i++) { cin >> gu[i]; } sort(gu.begin()...
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <math.h> #include <queue> #include <vector> using namespace std; void solve() { int n; cin >> n; vector<int> gu(n); for (int i = 0; i < n; i++) { cin >> gu[i]; } sort(gu.begin()...
replace
22
29
22
28
TLE
p02935
C++
Runtime Error
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define sz(x) (int)x.size() #define all(x) begin(x), end(x) #define debug(x) cerr << #x << " " << x << '\n' using namespace std; using ll = long long; using pii = pair<int, int>; using pli = pair<ll, int>; const int INF = 0x3f3f3f3f, N = 2e5 + 5; const ...
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define sz(x) (int)x.size() #define all(x) begin(x), end(x) #define debug(x) cerr << #x << " " << x << '\n' using namespace std; using ll = long long; using pii = pair<int, int>; using pli = pair<ll, int>; const int INF = 0x3f3f3f3f, N = 2e5 + 5; const ...
insert
17
17
17
18
-11
p02935
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; double a[10000]; int n; double ans = 0; double cnt() { double las = a[1]; for (int i = 2; i <= n; i++) { las = (a[i] + las) / 2; } return las; } int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; double a[10000]; int n; double ans = 0; double cnt() { double las = a[1]; for (int i = 2; i <= n; i++) { las = (a[i] + las) / 2; } return las; } int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + ...
replace
18
21
18
19
TLE
p02935
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; priority_queue<float, vector<float>, greater<float>> q; for (int i = 0; i < n; i++) { float y; cin >> y; q.push(y); } while (q.size() != 1) { float x = q.top(); q.pop(); float y = q.top(); q.pop(); float z = (flo...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; priority_queue<float, vector<float>, greater<float>> q; for (int i = 0; i < n; i++) { float y; cin >> y; q.push(y); } while (q.size() != 1) { float x = q.top(); q.pop(); float y = q.top(); q.pop(); fl...
insert
4
4
4
5
0
p02935
C++
Runtime Error
// 17571@nith.ac.in @Ankit Verma #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #pragma GCC optimize("O3") #ifndef ONLINE_JUDGE #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr ...
// 17571@nith.ac.in @Ankit Verma #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #pragma GCC optimize("O3") #ifndef ONLINE_JUDGE #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr ...
delete
131
135
131
131
0
p02935
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; long double v[1000]; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int n; cin >> n; long double ans = 0, val; for (int i = 0; i < n; ++i) { cin >> v[i]; } sort(v, v + n); do { val = v[0]; for (int...
#include <bits/stdc++.h> using namespace std; long double v[1000]; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int n; cin >> n; long double ans = 0, val; for (int i = 0; i < n; ++i) { cin >> v[i]; } sort(v, v + n); val = v[0]; for (int i = 1; i <...
replace
18
25
18
23
TLE
p02935
C++
Runtime Error
#include <algorithm> #include <iostream> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int n, tmp; priority_queue<int, vector<int>, greater<int>> queue; std::cin >> n; for (int i = 0; i < n; i++) { std::cin >> tmp; queue.push(tmp * 100000); ...
#include <algorithm> #include <iostream> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int n, tmp; priority_queue<int, vector<int>, greater<int>> queue; std::cin >> n; for (int i = 0; i < n; i++) { std::cin >> tmp; queue.push(tmp * 100000); ...
replace
25
26
25
26
-6
double free or corruption (out)
p02935
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, ans = 0; cin >> N; vector<float> v(N); for (int i = 0; i < N; ++i) cin >> v[i]; sort(v.begin(), v.end()); for (int i = 0; i < N; ++i) { v[i + 1] = (v[i + 1] + v[i]) / 2; } cout << v[N - 1] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, ans = 0; cin >> N; vector<float> v(N); for (int i = 0; i < N; ++i) cin >> v[i]; sort(v.begin(), v.end()); for (int i = 0; i < N - 1; ++i) { v[i + 1] = (v[i + 1] + v[i]) / 2; } cout << v[N - 1] << endl; }
replace
13
14
13
14
0
p02935
C++
Runtime Error
#include <bits/stdc++.h> #define rg register long long #define inf 21474899993647 #define min(a, b) (a < b ? a : b) #define max(a, b) (a > b ? a : b) #define ll long long #define maxn 100005 #define endl "\n" #define N 6000 const double eps = 1e-8; using namespace std; inline ll read() { char ch = getchar(); ll s =...
#include <bits/stdc++.h> #define rg register long long #define inf 21474899993647 #define min(a, b) (a < b ? a : b) #define max(a, b) (a > b ? a : b) #define ll long long #define maxn 100005 #define endl "\n" #define N 6000 const double eps = 1e-8; using namespace std; inline ll read() { char ch = getchar(); ll s =...
replace
43
47
43
49
-6
double free or corruption (out)
p02935
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rrep(i, a, b) for (int i = (int)(a); i >= (int)(b); --i) #define fore(i, a) for (auto &i : a) #define sz(a) ((int)(a).size()) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define isin(i, a, ...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rrep(i, a, b) for (int i = (int)(a); i >= (int)(b); --i) #define fore(i, a) for (auto &i : a) #define sz(a) ((int)(a).size()) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define isin(i, a, ...
replace
141
151
141
144
TLE
p02935
C++
Runtime Error
#define ll long long #define MOD 1000000007 #define mp make_pair #define pb push_back #define ff first #define ss second #define T \ long long t; \ cin >> t; ...
#define ll long long #define MOD 1000000007 #define mp make_pair #define pb push_back #define ff first #define ss second #define T \ long long t; \ cin >> t; ...
replace
27
28
27
28
0
p02935
Python
Runtime Error
N = int(input()) V = [float(v) for v in input().split()] V.sort(revese=True) for i in range(N): if len(V) == 1: print(V[0]) exit() v1 = V.pop() v2 = V.pop() V.append((v1 + v2) / 2)
N = int(input()) V = [float(v) for v in input().split()] V.sort(reverse=True) for i in range(N): if len(V) == 1: print(V[0]) exit() v1 = V.pop() v2 = V.pop() V.append((v1 + v2) / 2)
replace
2
3
2
3
TypeError: 'revese' is an invalid keyword argument for sort()
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02935/Python/s155796698.py", line 3, in <module> V.sort(revese=True) TypeError: 'revese' is an invalid keyword argument for sort()
p02935
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<float> v(N); for (int i = 0; i < N; ++i) cin >> v[i]; sort(v.begin(), v.end()); for (int j = 0; j < N; ++j) { v[j + 1] = (v[j] + v[j + 1]) / 2; } cout << v[N - 1] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<float> v(N); for (int i = 0; i < N; ++i) cin >> v[i]; sort(v.begin(), v.end()); for (int j = 0; j < N - 1; ++j) { v[j + 1] = (v[j] + v[j + 1]) / 2; } cout << v[N - 1] << endl; return 0; }
replace
12
13
12
13
0
p02935
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); double max = 0; do { double temp = arr[0]; for (int i = 1; i < n; i++) { temp += arr[i]; temp /= 2; } ...
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); double temp = arr[0]; for (int i = 1; i < n; i++) { temp += arr[i]; temp /= 2; } cout << temp; return 0; }
replace
12
24
12
20
TLE
p02935
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; vector<double> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } double max_v = 0; sort(v.begin(), v.end()); do { double value = v[0]; for (int i = 1; i < n; i++) { value = (value + v[i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; vector<double> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } double max_v = 0; sort(v.begin(), v.end()); // do { double value = v[0]; for (int i = 1; i < n; i++) { value = (value + v[i]) ...
replace
14
21
14
21
TLE
p02935
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; priority_queue<double, vector<double>, greater<double>> pt; double a, b, sum = 0; for (int i = 0; i < n; i++) { scanf("%lf", &a); pt.push(a); } while (!pt.empty()) { a = pt.top(); pt.pop(); b = pt.top(); pt...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; priority_queue<double, vector<double>, greater<double>> pt; double a, b, sum = 0; for (int i = 0; i < n; i++) { scanf("%lf", &a); pt.push(a); } while (pt.size() > 1) { a = pt.top(); pt.pop(); b = pt.top(); ...
replace
11
12
11
12
-6
double free or corruption (out)
p02935
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, n) for (int i = n; i >= 0; i++) #define REP(i, m, n) for (int i = m; i < n; i++) #define SORT(v) sort((v).begin(), (v).end()) #define REV...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, n) for (int i = n; i >= 0; i++) #define REP(i, m, n) for (int i = m; i < n; i++) #define SORT(v) sort((v).begin(), (v).end()) #define REV...
replace
30
31
30
31
0
p02935
C++
Runtime Error
#pragma GCC optimize("O3") #pragma GCC target("sse4") #include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" #include "ext/rope" using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; typedef long long ll; typedef long double ld; typedef pair<int, ...
#pragma GCC optimize("O3") #pragma GCC target("sse4") #include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" #include "ext/rope" using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; typedef long long ll; typedef long double ld; typedef pair<int, ...
replace
44
46
44
46
0
p02935
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int a[55]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); double max = 0, s; do { s = a[0]; for (int i = 0; i < n; i++) s = (s + a[i]) * 1.0 / (2 * 1.0); if (s > max) max = s; } while (next_pe...
#include <bits/stdc++.h> using namespace std; int a[55]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); double s; s = a[0]; for (int i = 0; i < n; i++) s = (s + a[i]) * 1.0 / (2 * 1.0); cout << s; }
replace
9
18
9
14
TLE
p02935
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<double> vec(3); for (int i = 0; i < n; i++) { double v; cin >> v; vec.at(i) = v; } for (int i = 0; i < n - 1; i++) { sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end()); double num; //...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<double> vec(n); for (int i = 0; i < n; i++) { double v; cin >> v; vec.at(i) = v; } for (int i = 0; i < n - 1; i++) { sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end()); double num; //...
replace
6
7
6
7
0
p02935
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; #include <bits/stdc++.h> void test_data(int N, vector<double> v) { N = 2; v = {3, 4}; cout << v[0] << endl; } int input_data(int N, vector<double> v) { cin >> N; for (int i = 0; i < N; i++) { int x; cin >> x; v.push_back(x); }; } dou...
#include <iostream> #include <vector> using namespace std; #include <bits/stdc++.h> void test_data(int N, vector<double> v) { N = 2; v = {3, 4}; cout << v[0] << endl; } int input_data(int N, vector<double> v) { cin >> N; for (int i = 0; i < N; i++) { int x; cin >> x; v.push_back(x); }; } dou...
replace
38
39
38
39
-6
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 1) >= this->size() (which is 0)
p02935
C++
Runtime Error
#include <bits/stdc++.h> #include <numeric> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, x) for (int i = 1; i <= (int)(x); i++) #define all(x) (x).begin(), (x).end() #include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> list(N); ...
#include <bits/stdc++.h> #include <numeric> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, x) for (int i = 1; i <= (int)(x); i++) #define all(x) (x).begin(), (x).end() #include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> list(N); ...
replace
20
21
20
23
-6
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 2) >= this->size() (which is 2)
p02935
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { int N; cin >> N; int array[N]; for (int i = 0; i < N; i++) { cin >> array[i]; } double d = 0.0; sort(array, array + N); d = array[0]; for (int i = 1; i < N; i++) { d = (d + array[i]) / 2; } return d; }
#include <algorithm> #include <iostream> using namespace std; int main() { int N; cin >> N; int array[N]; for (int i = 0; i < N; i++) { cin >> array[i]; } double d = 0.0; sort(array, array + N); d = array[0]; for (int i = 1; i < N; i++) { d = (d + array[i]) / 2; } cout << d << endl; }
replace
18
19
18
19
3
p02935
Python
Runtime Error
def solve(string): n, *v = map(int, string.split()) v = sorted(v, reverse=True) return str( sum(_v / 2**i for i, _v in enumerate(v[:-1], start=1)) + v[-1] / 2 ** (n - 1) ) if __name__ == "__main__": print(solve(input()))
def solve(string): n, *v = map(int, string.split()) v = sorted(v, reverse=True) return str( sum(_v / 2**i for i, _v in enumerate(v[:-1], start=1)) + v[-1] / 2 ** (n - 1) ) if __name__ == "__main__": print(solve("\n".join([input(), input()])))
replace
9
10
9
10
IndexError: list index out of range
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02935/Python/s824355619.py", line 8, in <module> print(solve(input())) File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02935/Python/s824355619.py", line 4, in solve return str(sum(_v ...
p02935
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; double a[50 + 5]; int main() { int n; double sum = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i < n - 1; i++) { a[i + 1] = (a[i] + a[i + 1]) / 2; if (i == n - 2) break; sort(a + i + 1, a + n - i -...
#include <bits/stdc++.h> using namespace std; double a[50 + 5]; int main() { int n; double sum = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); sum = (a[0] + a[1]) / 2; for (int i = 2; i < n; i++) sum = (sum + a[i]) / 2; cout << sum << endl; return 0; }
replace
11
18
11
15
0
p02936
C++
Runtime Error
/* Vivek Rathi CSE 2nd Year MNNIT */ #include <bits/stdc++.h> using namespace std; #define M 1000000007 #define ll long long int #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define debug1(x) cout << #x << " " << x << endl; #define debug2(x, y) cout << #x << " " << x << " ...
/* Vivek Rathi CSE 2nd Year MNNIT */ #include <bits/stdc++.h> using namespace std; #define M 1000000007 #define ll long long int #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define debug1(x) cout << #x << " " << x << endl; #define debug2(x, y) cout << #x << " " << x << " ...
replace
44
46
44
46
0
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define per(i, n) for (ll i = n - 1; i >= 0; i--) #define perl(i, r, l) for (ll i = r - 1; i >= l; i--) #define fi first #define se second #define mp make_pair #define pb push_...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define per(i, n) for (ll i = n - 1; i >= 0; i--) #define perl(i, r, l) for (ll i = r - 1; i >= l; i--) #define fi first #define se second #define mp make_pair #define pb push_...
replace
43
44
43
44
TLE
p02936
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <tuple> #include <vector> typedef long long ll; typedef unsigned long long ull; #define mk make...
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <tuple> #include <vector> typedef long long ll; typedef unsigned long long ull; #define mk make...
replace
21
22
21
22
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; vector<int> to[20000]; vector<int> ans; void dfs(int v, int p = -1) { for (int u : to[v]) { if (u == p) continue; ans[u] += ans[v]; dfs(u, v); } } int main() { int n, q; cin >> ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; vector<int> to[200005]; vector<int> ans; void dfs(int v, int p = -1) { for (int u : to[v]) { if (u == p) continue; ans[u] += ans[v]; dfs(u, v); } } int main() { int n, q; cin >>...
replace
5
6
5
6
0
p02936
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <string> #include <utility> #include <vector> // #include <deque> // #include <queue> // #include <array> // #include <ctime> // #include <list> #include...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <string> #include <utility> #include <vector> // #include <deque> // #include <queue> // #include <array> // #include <ctime> // #include <list> #include...
replace
150
152
150
152
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 100010; vector<int> G[N]; vector<int> Count(N); int n, q; void dfs(int now, int pre) { for (int i = 0; i < G[now].size(); i++) { int to = G[now][i]; if (to == pre) continue; Count[to] += Count[now]; dfs(to, now); } } int main() { ...
#include <bits/stdc++.h> using namespace std; const int N = 200010; vector<int> G[N]; vector<int> Count(N); int n, q; void dfs(int now, int pre) { for (int i = 0; i < G[now].size(); i++) { int to = G[now][i]; if (to == pre) continue; Count[to] += Count[now]; dfs(to, now); } } int main() { ...
replace
3
4
3
4
0
p02936
C++
Runtime Error
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <string> #include <vector> // #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 50; const int inf = 0x3f3f3f3f;...
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <string> #include <vector> // #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 50; const int inf = 0x3f3f3f3f;...
replace
17
19
17
19
0
p02936
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; vector<int> to[20005]; vector<int> ans; void dfs(int v, int p = -1) { for (int u : to[v]) { if (u == p) continue; ans[u] += ans[v]; dfs(u, v); } } int main() { int n, q; cin >> n >> q; int a,...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; vector<int> to[200005]; vector<int> ans; void dfs(int v, int p = -1) { for (int u : to[v]) { if (u == p) continue; ans[u] += ans[v]; dfs(u, v); } } int main() { int n, q; cin >> n >> q; int a...
replace
7
8
7
8
0
p02936
C++
Runtime Error
#include <algorithm> // sort #include <bits/stdc++.h> #include <ctype.h> #include <iomanip> #include <iostream> #include <map> // pair #include <math.h> #include <numeric> #include <stdio.h> #include <string> #include <vector> using namespace std; #define nin(n) ...
#include <algorithm> // sort #include <bits/stdc++.h> #include <ctype.h> #include <iomanip> #include <iostream> #include <map> // pair #include <math.h> #include <numeric> #include <stdio.h> #include <string> #include <vector> using namespace std; #define nin(n) ...
replace
18
19
18
19
0
p02936
C++
Runtime Error
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <functional> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <bitset> #include <deque> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #in...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <functional> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <bitset> #include <deque> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #in...
replace
77
78
77
81
-11
p02936
C++
Runtime Error
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() vector<vector<int>> to(100100); vector<int> x(100100); vector<bool> seen(100100, false); void dfs(int v) ...
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() const int M = 212345; vector<vector<int>> to(M); vector<int> x(M); vector<bool> seen(M, false); void dfs...
replace
8
11
8
13
0
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define INF 2e9 #define ll long long ll n, q; ll ans[200001]; queue<ll> que[200001]; ll ad[200001]; void add(ll p, ll x) { ans[p] += x; int que_s = que[p].size(); for (int k = 0; k < que_s; k++) { int s = que[p].front(); que[p].pop(); que[p].push(s); ...
#include <bits/stdc++.h> using namespace std; #define INF 2e9 #define ll long long ll n, q; ll ans[200001]; queue<ll> que[200001]; ll ad[200001]; void add(ll p, ll x) { ans[p] += x; int que_s = que[p].size(); for (int k = 0; k < que_s; k++) { int s = que[p].front(); que[p].pop(); que[p].push(s); ...
replace
17
18
17
18
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; vector<vector<int>> to; vector<int> ans; void dfs(int v, int p = -1) { rep(i, to[v].size()) { int u = to[v][i]; if (u == p) continue; ans[u] += ans[v]; dfs(u, v); } } int main(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; vector<vector<int>> to; vector<int> ans; void dfs(int v, int p = -1) { rep(i, to[v].size()) { int u = to[v][i]; if (u == p) continue; ans[u] += ans[v]; dfs(u, v); } } int main(...
insert
20
20
20
21
-11
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define M_PI 3.14159265358979323846 using namespace std; // conversion //------------------------------------------ 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; re...
#include <bits/stdc++.h> #define M_PI 3.14159265358979323846 using namespace std; // conversion //------------------------------------------ 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; re...
replace
89
90
89
90
-11
p02936
C++
Time Limit Exceeded
#include <cmath> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> using namespace std; typedef long long ll; vector<int> to[200005]; // vector の配列 vector<int>...
#include <cmath> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> using namespace std; typedef long long ll; vector<int> to[200005]; // vector の配列 vector<int>...
replace
17
18
17
19
TLE
p02936
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <vector> using namespace std; const int maxd = 1e5 + 10; struct { int v, net; } e[maxd << 1]; int f[maxd], eid, v[maxd]; void init() { eid = 0; memset(f, -1, sizeof(f)); } void insert(int x, int y) { e[eid].v = y; e[eid].net = f[x]; f[x] = e...
#include <algorithm> #include <cstdio> #include <cstring> #include <vector> using namespace std; const int maxd = 2e5 + 10; struct { int v, net; } e[maxd << 1]; int f[maxd], eid, v[maxd]; void init() { eid = 0; memset(f, -1, sizeof(f)); } void insert(int x, int y) { e[eid].v = y; e[eid].net = f[x]; f[x] = e...
replace
5
6
5
6
0
p02936
C++
Runtime Error
#include <iostream> #include <queue> #include <vector> using namespace std; vector<int> count(100000, 0); vector<int> counter(100000, 0); vector<int> vis(100000, 0); void dfs(vector<int> v[], int index) { queue<int> q; q.push(index); int sum; count[0] = counter[0]; while (!q.empty()) { int t = q.front(); ...
#include <iostream> #include <queue> #include <vector> using namespace std; vector<int> count(300000, 0); vector<int> counter(300000, 0); vector<int> vis(300000, 0); void dfs(vector<int> v[], int index) { queue<int> q; q.push(index); int sum; count[0] = counter[0]; while (!q.empty()) { int t = q.front(); ...
replace
4
7
4
7
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } int N; vector<int> G[...
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } int N; vector<int> G[...
replace
19
20
19
20
0
p02936
C++
Runtime Error
#include "bits/stdc++.h" #define MOD 1000000007 #define rep(i, n) for (ll i = 0; i < (n); i++) #define ALL(v) v.begin(), v.end() #define DUMP(i, v) \ for (ll i = 0; i < v.size(); i++) \ cout << v[i] << " " using...
#include "bits/stdc++.h" #define MOD 1000000007 #define rep(i, n) for (ll i = 0; i < (n); i++) #define ALL(v) v.begin(), v.end() #define DUMP(i, v) \ for (ll i = 0; i < v.size(); i++) \ cout << v[i] << " " using...
replace
59
61
59
61
0
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; using Edge = ll; using Graph = vector<vector<Edge>>; #define REP(i, n) for (int i = 0; i < (n); ++i) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) const ll MOD = 1000000007; const ll nmax = 8; const ll INF...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Edge = ll; using Graph = vector<vector<Edge>>; #define REP(i, n) for (int i = 0; i < (n); ++i) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) const ll MOD = 1000000007; const ll nmax = 8; const ll INF...
replace
203
204
203
204
TLE
p02936
C++
Runtime Error
#include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <ios> #include <iostream> #includ...
#include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <ios> #include <iostream> #includ...
replace
72
73
72
73
0
p02936
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; using ll = long long; #define print(n) cout << n << endl #define rep(i, a, n) for (int i = a; i < n; i++) #define ALL(s) s.begin(), s.end() #define P pair<ll, ll> #define vl vector<ll> #define vi vector<int> #define vvl vector<vector<ll>> #define vvi vector<vector<int>> con...
#include "bits/stdc++.h" using namespace std; using ll = long long; #define print(n) cout << n << endl #define rep(i, a, n) for (int i = a; i < n; i++) #define ALL(s) s.begin(), s.end() #define P pair<ll, ll> #define vl vector<ll> #define vi vector<int> #define vvl vector<vector<ll>> #define vvi vector<vector<int>> con...
replace
33
35
33
35
0
p02936
Python
Time Limit Exceeded
import sys sys.setrecursionlimit(10**6) n, q = map(int, input().split()) edges = [[] for _ in range(n)] for _ in range(n - 1): a, b = map(int, input().split()) a -= 1 b -= 1 edges[a].append(b) edges[b].append(a) counter = [0] * n for _ in range(q): p, x = map(int, input().split()) p -= 1...
import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline n, q = map(int, input().split()) edges = [[] for _ in range(n)] for _ in range(n - 1): a, b = map(int, input().split()) a -= 1 b -= 1 edges[a].append(b) edges[b].append(a) counter = [0] * n for _ in range(q): p, x = map(int, ...
insert
3
3
3
4
TLE
p02936
Python
Runtime Error
N, Q = map(int, input().split()) tree = [[0] * 1 for i in range(N)] tree_list = [0] * N end = [0] * N for index in range(N - 1): a, b = map(lambda x: int(x) - 1, input().split()) tree[a].append(b) tree[b].append(a) for index in range(Q): a, b = map(int, input().split()) a -= 1 tree_list[a] ...
import sys sys.setrecursionlimit(10000000) input = sys.stdin.readline N, Q = map(int, input().split()) tree = [[0] * 1 for i in range(N)] tree_list = [0] * N end = [0] * N for index in range(N - 1): a, b = map(lambda x: int(x) - 1, input().split()) tree[a].append(b) tree[b].append(a) for index in ran...
insert
0
0
0
5
0
p02936
Python
Time Limit Exceeded
from collections import defaultdict import sys sys.setrecursionlimit(10**6) N, Q = map(int, input().split()) e = [[] for _ in range(N + 1)] for i in range(N - 1): a, b = map(int, input().split()) e[a].append(b) q = defaultdict(int) for i in range(Q): p, x = map(int, input().split()) q[p] += x seen =...
from collections import defaultdict import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) N, Q = map(int, input().split()) e = [[] for _ in range(N + 1)] for i in range(N - 1): a, b = map(int, input().split()) e[a].append(b) q = defaultdict(int) for i in range(Q): p, x = map(int, input().sp...
insert
2
2
2
4
TLE
p02936
Python
Time Limit Exceeded
from collections import defaultdict import sys sys.setrecursionlimit(10**9) N, Q = map(int, input().split()) G = defaultdict(list) for i in range(N - 1): a, b = map(int, input().split()) a, b = a - 1, b - 1 # 0-indexed G[a].append(b) G[b].append(a) # print('G', G) V = [0] * N for _ in range(Q): ...
from collections import defaultdict import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) N, Q = map(int, input().split()) G = defaultdict(list) for i in range(N - 1): a, b = map(int, input().split()) a, b = a - 1, b - 1 # 0-indexed G[a].append(b) G[b].append(a) # print('G', G) V = [0]...
replace
3
4
3
5
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, N) for (int i = 0; i < N; i++) #define rep2(i, N) for (int i = 1; i <= N; i++) using namespace std; long long INF = 1e18; long long mod = 1e9 + 7; // status unsolved int n, q; vector<vector<int>> to(100010); long long weight[100010] = {}; void dfs(int now, int before) { if (...
#include <bits/stdc++.h> #define rep(i, N) for (int i = 0; i < N; i++) #define rep2(i, N) for (int i = 1; i <= N; i++) using namespace std; long long INF = 1e18; long long mod = 1e9 + 7; // status unsolved int n, q; vector<vector<int>> to(200010); long long weight[200010] = {}; void dfs(int now, int before) { if (...
replace
10
12
10
12
0
p02936
Python
Time Limit Exceeded
# -*- coding: utf-8 -*- import sys sys.setrecursionlimit(10**7) n, q = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(n - 1)] px = [list(map(int, input().split())) for _ in range(q)] graph = [[] for _ in range(n + 1)] for a, b in ab: graph[a].append(b) graph[b].append(a) val...
# -*- coding: utf-8 -*- import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, q = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(n - 1)] px = [list(map(int, input().split())) for _ in range(q)] graph = [[] for _ in range(n + 1)] for a, b in ab: graph[a].append(b) ...
insert
4
4
4
5
TLE
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; queue<pair<int, long>> q; void wfs(vector<vector<int>> Ed, vector<pair<long, int>> &Ve) { if (q.empty() == 0) { pair<int, long> v = q.front(); q.pop(); Ve[v.first].first += v.second; for (int i = 0; i < Ed[v.first].size(); i++) { if (Ed[v.first][i]...
#include <bits/stdc++.h> using namespace std; queue<pair<int, long>> q; void wfs(vector<vector<int>> &Ed, vector<pair<long, int>> &Ve) { if (q.empty() == 0) { pair<int, long> v = q.front(); q.pop(); Ve[v.first].first += v.second; for (int i = 0; i < Ed[v.first].size(); i++) { if (Ed[v.first][i...
replace
5
6
5
6
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct node { int ff, num; } v[20005]; int main() { int n, q; cin >> n >> q; for (int i = 1; i <= n; i++) { v[i].ff = 0; v[i].num = 0; } for (int i = 1; i <= n - 1; i++) { int x, y; cin >> x >> y; v[y].ff = x; } for (int i = 1; i <= q; i...
#include <bits/stdc++.h> using namespace std; struct node { int ff, num; } v[200005]; int main() { int n, q; cin >> n >> q; for (int i = 1; i <= n; i++) { v[i].ff = 0; v[i].num = 0; } for (int i = 1; i <= n - 1; i++) { int x, y; cin >> x >> y; v[y].ff = x; } for (int i = 1; i <= q; ...
replace
4
5
4
5
0
p02936
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; // typedef //------------------------------------------ typedef long long LL; typedef unsigned long long ULL; typedef vector<LL> VLL; typedef vector<VLL> VVLL; typedef vector<string> VS; typedef pair<LL, LL> PLL; // container util //---------------------------------------...
#include "bits/stdc++.h" using namespace std; // typedef //------------------------------------------ typedef long long LL; typedef unsigned long long ULL; typedef vector<LL> VLL; typedef vector<VLL> VVLL; typedef vector<string> VS; typedef pair<LL, LL> PLL; // container util //---------------------------------------...
replace
54
55
54
55
0
p02936
C++
Runtime Error
// #include<bits/stdc++.h> #include <cstdio> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) <<...
// #include<bits/stdc++.h> #include <cstdio> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) <<...
replace
23
24
23
24
0
p02936
Python
Time Limit Exceeded
import sys sys.setrecursionlimit(1000000) def dfs(v, par): for nv in tree[v]: if nv == par: continue add[nv] += add[v] dfs(nv, v) n, q = map(int, input().split()) tree = [[] for i in range(n)] for i in range(n - 1): a, b = map(int, input().split()) a -= 1 b -= 1 ...
import sys sys.setrecursionlimit(1000000) input = sys.stdin.readline def dfs(v, par): for nv in tree[v]: if nv == par: continue add[nv] += add[v] dfs(nv, v) n, q = map(int, input().split()) tree = [[] for i in range(n)] for i in range(n - 1): a, b = map(int, input().spli...
insert
3
3
3
4
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define sz(x) (int)((x).size()) #define F first #define S second #define pb push_back #define ub upper_bound #define lb lower_bound #define all(x) x.begin(), x.end() #define pqueue priority_queue #define mset multiset #define umap unordered_map #define Speed() ...
#include <bits/stdc++.h> #define sz(x) (int)((x).size()) #define F first #define S second #define pb push_back #define ub upper_bound #define lb lower_bound #define all(x) x.begin(), x.end() #define pqueue priority_queue #define mset multiset #define umap unordered_map #define Speed() ...
replace
32
33
32
33
0
p02936
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>; #define chmax(x, y) x = max(x, y); #define chmin(x, y) x = min(x, y); const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; const int INF = 1001001001; vector<int> to[...
#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); const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; const int INF = 1001001001; vector<int> to[...
replace
27
28
27
28
0
p02936
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin(), v.end() #define RAL...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin(), v.end() #define RAL...
insert
45
45
45
46
-11
p02936
C++
Runtime Error
#define C #ifdef C #include <stdio.h> #define abs(a) ((a) < 0 ? -(a) : (a)) #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) #define isdigit(a) ((a) >= '0' && (a) <= '9' ? true : false) #endif #ifdef Cpp #include <bits/stdc++.h> using namespace std; #endif #define freopen(x) ...
#define C #ifdef C #include <stdio.h> #define abs(a) ((a) < 0 ? -(a) : (a)) #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) #define isdigit(a) ((a) >= '0' && (a) <= '9' ? true : false) #endif #ifdef Cpp #include <bits/stdc++.h> using namespace std; #endif #define freopen(x) ...
replace
26
27
26
27
0
p02936
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; typedef struct _TREE { vector<int> connect; long long startCnt; long long totalCnt; } TREE; TREE trees[100001]; void addCounters(int beforeTree, int thisTree, long long addCounter) { trees[thisTree].totalCnt = trees[thisTree].startCnt + addCounter; ...
#include <iostream> #include <vector> using namespace std; typedef struct _TREE { vector<int> connect; long long startCnt; long long totalCnt; } TREE; TREE trees[200001]; void addCounters(int beforeTree, int thisTree, long long addCounter) { trees[thisTree].totalCnt = trees[thisTree].startCnt + addCounter; ...
replace
10
11
10
11
0
p02936
C++
Runtime Error
#include <cstdio> #include <stack> #include <vector> using namespace std; using i64 = long long; #define REP(i, stop) for (int i = 0, i##_len = stop; i < i##_len; ++i) const int is = 1 << 17; char ib[is], *ip = ib + is, it; inline char getc() { if (ip == ib + is) { fread_unlocked(ib, 1, is, stdin); ip = ib...
#include <cstdio> #include <stack> #include <vector> using namespace std; using i64 = long long; #define REP(i, stop) for (int i = 0, i##_len = stop; i < i##_len; ++i) const int is = 1 << 17; char ib[is], *ip = ib + is, it; inline char getc() { if (ip == ib + is) { fread_unlocked(ib, 1, is, stdin); ip = ib...
replace
88
90
88
93
0
p02936
C++
Runtime Error
/** * author: malviyanshiv * created: 18 August 2019 17:46:30 **/ #include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < b; i++) #define RREP(i, a, b) for (int i = a - 1; i >= b; i--) #define FORE(a) for (auto ele : a) #define ALL(a) begin(a), end(a) #define RPB(i, begin, end)...
/** * author: malviyanshiv * created: 18 August 2019 17:46:30 **/ #include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < b; i++) #define RREP(i, a, b) for (int i = a - 1; i >= b; i--) #define FORE(a) for (auto ele : a) #define ALL(a) begin(a), end(a) #define RPB(i, begin, end)...
replace
69
70
69
70
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using Int = long long int; template <typename T> void swap(T *t1, T *t2) { T *tmp = t1; t1 = t2; t2 = tmp; } vector<Int> m[100002]; Int stts[100002]; Int arr[100002]; void dfs(Int u, Int val) { stts[u] = 1; arr[u] += val; for (Int i = 0; i < m[u].size(); i++) ...
#include <bits/stdc++.h> using namespace std; using Int = long long int; template <typename T> void swap(T *t1, T *t2) { T *tmp = t1; t1 = t2; t2 = tmp; } vector<Int> m[300002]; Int stts[300002]; Int arr[300002]; void dfs(Int u, Int val) { stts[u] = 1; arr[u] += val; for (Int i = 0; i < m[u].size(); i++) ...
replace
9
12
9
12
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<vector<int>> to(20005); vector<int> ans; void dfs(int c, int p = -1) { for (int u : to.at(c)) { if (u == p) { continue; } ans.at(u) += ans.at(c); dfs(u, c); } } int main() { int n, q; cin >> n >> q; // v.resize(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<vector<int>> to(200005); vector<int> ans; void dfs(int c, int p = -1) { for (int u : to.at(c)) { if (u == p) { continue; } ans.at(u) += ans.at(c); dfs(u, c); } } int main() { int n, q; cin >> n >> q; // v.resize...
replace
4
5
4
5
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define MAXDATA 100 vector<vector<int>> to(MAXDATA); vector<bool> seen(MAXDATA, false); vector<int> ans(MAXDATA, 0); void dfs(const vector<vector<int>> &G, int v) { seen[v] = true; for (auto next_v : G[v]) { if ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define MAXDATA 200100 vector<vector<int>> to(MAXDATA); vector<bool> seen(MAXDATA, false); vector<int> ans(MAXDATA, 0); void dfs(const vector<vector<int>> &G, int v) { seen[v] = true; for (auto next_v : G[v]) { ...
replace
4
5
4
5
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define pf push_front typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define mp make_pair #define fi first #define se second typedef pair<int, int> pint; #define All(s) s.begi...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define pf push_front typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define mp make_pair #define fi first #define se second typedef pair<int, int> pint; #define All(s) s.begi...
replace
28
29
28
29
0
p02936
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, j, k) for (int i = (int)j; i <= (int)k; i++) #define per(i, j, k) for (int i = (int)j; i >= (int)k; i--) #define F(i, k) for (int i = (int)0; i < (int)k; i++) #def...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, j, k) for (int i = (int)j; i <= (int)k; i++) #define per(i, j, k) for (int i = (int)j; i >= (int)k; i--) #define F(i, k) for (int i = (int)0; i < (int)k; i++) #def...
replace
14
15
14
15
0
p02936
C++
Runtime Error
/* ****devACE**** */ #include <bits/stdc++.h> #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000007 #define rep(i, a, b) for (ll...
/* ****devACE**** */ #include <bits/stdc++.h> #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000007 #define rep(i, a, b) for (ll...
replace
20
21
20
21
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define PI acos(-1) #define eq(x, y) (fabs((x) - (y)) < eps) #define debug(x) cerr << x << endl; #define endl "\n" #define pb push_back #define min3(a, b, c) min(a, min(b, c)) #define max3(a, b, c) max(a, max(b, c)) using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef ...
#include <bits/stdc++.h> #define PI acos(-1) #define eq(x, y) (fabs((x) - (y)) < eps) #define debug(x) cerr << x << endl; #define endl "\n" #define pb push_back #define min3(a, b, c) min(a, min(b, c)) #define max3(a, b, c) max(a, max(b, c)) using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef ...
replace
16
19
16
19
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<vector<int>> T(100000); vector<int> Count(100000, 0); void solve(int a) { for (int i : T[a]) { Count[i] += Count[a]; solve(i); } return; } int main() { int N, Q, a, b, p, x; cin >> N >> Q; for (int i = 0; i < N - 1; i++) { cin >> a >> b; ...
#include <bits/stdc++.h> using namespace std; vector<vector<int>> T(200000); vector<int> Count(200000, 0); void solve(int a) { for (int i : T[a]) { Count[i] += Count[a]; solve(i); } return; } int main() { int N, Q, a, b, p, x; cin >> N >> Q; for (int i = 0; i < N - 1; i++) { cin >> a >> b; ...
replace
3
5
3
5
0
p02936
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long int; const int MAX_N = 1e5 + 10; vector<int> cost(MAX_N, 0); vector<int> ans(MAX_N, -1); vector<vector<int>> edge(MAX_N, vector<int>{}); int dfs(int frm, int n) { if (ans[n] != -1)...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long int; const int MAX_N = 3 * 1e5; vector<int> cost(MAX_N, 0); vector<int> ans(MAX_N, -1); vector<vector<int>> edge(MAX_N, vector<int>{}); int dfs(int frm, int n) { if (ans[n] != -1) ...
replace
8
9
8
9
0
p02936
C++
Runtime Error
#include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; vector<int> ki[20005]; vector<int> ans; void dfs(int u, int p = -1) { // 範囲for for (int v : ki[u]) { if (v == p) continue; ans[v] += ans[u]; dfs(v, u); } } int main...
#include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; vector<int> ki[200005]; vector<int> ans; void dfs(int u, int p = -1) { // 範囲for for (int v : ki[u]) { if (v == p) continue; ans[v] += ans[u]; dfs(v, u); } } int mai...
replace
8
9
8
9
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define hell 1000000007 #define vi vector<ll> #define pb push_back #define pii pair<ll, ll> #define vii vector<pii> #define rep(i, a, b) for (ll i = a; i < b; i++) #define sep(i, a, b) for (ll i = a - 1; i >= b; i--) #define inf (ll)(1e16) using namespace std; vi adj...
#include <bits/stdc++.h> #define ll long long int #define hell 1000000007 #define vi vector<ll> #define pb push_back #define pii pair<ll, ll> #define vii vector<pii> #define rep(i, a, b) for (ll i = a; i < b; i++) #define sep(i, a, b) for (ll i = a - 1; i >= b; i--) #define inf (ll)(1e16) using namespace std; vi adj...
replace
14
17
14
17
0
p02936
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; vector<vector<int>> adjl(200000); vector<int> res(20000, 0); void dfs(int t, int prev, int dsum) { dsum += res[t]; res[t] = dsum; for (int i = 0; i < adjl[t].size(); i++) if (adjl[t][i] != prev) dfs(adjl[t][i], t, dsum); } int main() { int...
#include <iostream> #include <vector> using namespace std; vector<vector<int>> adjl(200000); vector<int> res(200000, 0); void dfs(int t, int prev, int dsum) { dsum += res[t]; res[t] = dsum; for (int i = 0; i < adjl[t].size(); i++) if (adjl[t][i] != prev) dfs(adjl[t][i], t, dsum); } int main() { in...
replace
6
7
6
7
0
p02936
C++
Runtime Error
// aarsh01rsh@gmail.com // Aarsh Sharma #include <bits/stdc++.h> using namespace std; string to_string(string s) { return '"' + s + '"'; } string to_string(char ch) { string s(1, ch); return '\'' + s + '\''; } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? "...
// aarsh01rsh@gmail.com // Aarsh Sharma #include <bits/stdc++.h> using namespace std; string to_string(string s) { return '"' + s + '"'; } string to_string(char ch) { string s(1, ch); return '\'' + s + '\''; } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? "...
replace
61
62
61
62
0
p02936
C++
Runtime Error
// // main.cpp // Test // // Created by momoc on 2019/8/18. // Copyright © 2019年 momoc. All rights reserved. // #include <cstdio> #include <iostream> #include <queue> #include <vector> typedef long long ll; using namespace std; const int N = 10 * 5 + 1; int a[N] = {0}; vector<int> dege[N]; void bfs() { queue<int...
// // main.cpp // Test // // Created by momoc on 2019/8/18. // Copyright © 2019年 momoc. All rights reserved. // #include <cstdio> #include <iostream> #include <queue> #include <vector> typedef long long ll; using namespace std; const int N = 200000 + 1; int a[N] = {0}; vector<int> dege[N]; void bfs() { queue<int...
replace
14
15
14
15
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // counterの値を親から子に伝搬させる void dfs(int vertex, int parent, vector<vector<int>> &Tree, vector<int> &counter) { // 親のカウンターの値を足し合わせる counter[vertex] += counter[parent]; // 子に伝播させる for (const int &nxtv : Tree[vertex]) { if (nxtv == parent) continue; ...
#include <bits/stdc++.h> using namespace std; // counterの値を親から子に伝搬させる void dfs(int vertex, int parent, vector<vector<int>> &Tree, vector<int> &counter) { // 親のカウンターの値を足し合わせる counter[vertex] += counter[parent]; // 子に伝播させる for (const int &nxtv : Tree[vertex]) { if (nxtv == parent) continue; ...
replace
24
25
24
25
-11
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; void seq(vector<vector<ll>> next, vector<ll> &cnt, ll from, ll ff) { for (ll i = 0; i < next.at(from).size(); i++) { if (from != 0 && next.at(from).at(i) - 1 == ff) continue; cnt.at(next.at(from).at(i) - 1) += c...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; void seq(vector<vector<ll>> &next, vector<ll> &cnt, ll from, ll ff) { for (ll i = 0; i < next.at(from).size(); i++) { if (from != 0 && next.at(from).at(i) - 1 == ff) continue; cnt.at(next.at(from).at(i) - 1) += ...
replace
5
6
5
6
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define forn(i, n) for (int i = 0; i < n; i++) vector<int> edges[100010]; long long ans[100010]; long long bucket[100010]; void dfs(int node, int prev, long long val = 0) { val += bucket[node]; ans[node] = val; for (auto &x : edges[node]) { if (prev - x) { ...
#include <bits/stdc++.h> using namespace std; #define forn(i, n) for (int i = 0; i < n; i++) vector<int> edges[200010]; long long ans[200010]; long long bucket[200010]; void dfs(int node, int prev, long long val = 0) { val += bucket[node]; ans[node] = val; for (auto &x : edges[node]) { if (prev - x) { ...
replace
4
7
4
7
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back using namespace std; vector<long long> g[100005]; bool vis[100005]; long long lazy[100005]; long long cnt[100005]; void dfs(int i) { if (vis[i]) return; vis[i] = 1; cnt[i] += lazy[i]; for (int j = 0; j < g[i].size(); j++) { if (!vis[g[i][j]]) { cnt[g[i...
#include <bits/stdc++.h> #define pb push_back using namespace std; vector<long long> g[200005]; bool vis[200005]; long long lazy[200005]; long long cnt[200005]; void dfs(int i) { if (vis[i]) return; vis[i] = 1; cnt[i] += lazy[i]; for (int j = 0; j < g[i].size(); j++) { if (!vis[g[i][j]]) { cnt[g[i...
replace
3
7
3
7
0