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
p02994
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, L; cin >> N >> L; vector<int> v(N); for (int i = 0; i <= N; i++) { v[i] = L + i; } int m = 100000; int t; for (size_t i = 0; i < N; i++) { if (m > abs(v[i])) { m = abs(v[i]); t = i; } } int sum = accumula...
#include <bits/stdc++.h> using namespace std; int main() { int N, L; cin >> N >> L; vector<int> v(N); for (int i = 0; i < N; i++) { v[i] = L + i; } int m = 100000; int t; for (size_t i = 0; i < N; i++) { if (m > abs(v[i])) { m = abs(v[i]); t = i; } } int sum = accumulat...
replace
9
10
9
10
0
p02994
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { vector<int> v; bool positive = false, negative = false, zero = false; int n, l, j = 0, sum = 0; cin >> n >> l; for (int i = 1; i <= n; i++) { int k = l + i - 1; if (k > 0) positive = true; else if...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { vector<int> v; bool positive = false, negative = false, zero = false; int n, l, j = 0, sum = 0; cin >> n >> l; for (int i = 1; i <= n; i++) { int k = l + i - 1; if (k > 0) positive = true; else if...
replace
21
22
21
22
-11
p02994
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
delete
40
44
40
40
0
Time elapsed: 32ms
p02994
C++
Runtime Error
#include <bits/stdc++.h> #include <numeric> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i < (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)-1); i > 0; i--) #define ALL(x) (x).begin(), (x).end() #define SZ(x)...
#include <bits/stdc++.h> #include <numeric> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i < (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)-1); i > 0; i--) #define ALL(x) (x).begin(), (x).end() #define SZ(x)...
replace
41
42
41
42
0
p02994
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define IO() \ assert(freopen("in.in", "rt", stdin)), \ assert(freopen("out.out", "wt", stdout)) #define FastIO() ios::sync_with_stdio(false); #define debug(x) co...
#include <bits/stdc++.h> using namespace std; #define IO() \ assert(freopen("in.in", "rt", stdin)), \ assert(freopen("out.out", "wt", stdout)) #define FastIO() ios::sync_with_stdio(false); #define debug(x) co...
replace
88
89
88
89
-6
d5cc937b-fdd4-4fbb-b454-194905e97da8.out: /home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02994/C++/s202288301.cpp:92: int main(): Assertion `freopen("in.in", "rt", stdin)' failed.
p02994
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, L; cin >> N >> L; vector<int> a(N); for (int i = 0; i < N; i++) { a.at(i) = L + i; } int ans = 0; if (a.at(0) >= 0) { for (int i = 1; i < N; i++) { ans += a.at(i); } } else if (a.at(N) <= 0) { for (int i = 0; i ...
#include <bits/stdc++.h> using namespace std; int main() { int N, L; cin >> N >> L; vector<int> a(N); for (int i = 0; i < N; i++) { a.at(i) = L + i; } int ans = 0; if (a.at(0) >= 0) { for (int i = 1; i < N; i++) { ans += a.at(i); } } else if (a.at(N - 1) <= 0) { for (int i = 0...
replace
19
20
19
20
0
p02995
C++
Runtime Error
#include <bits/stdc++.h> #define LL long long #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPA(i, n) for (int i = 1; i < (n); ++i) #define PII pair<int, int> #define PLI pair<long long, int> #define PLL pair<long long, long long> #define PDD pair<double, double> #define MOD ((int)1e9 + 7) #define INF ((int)...
#include <bits/stdc++.h> #define LL long long #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPA(i, n) for (int i = 1; i < (n); ++i) #define PII pair<int, int> #define PLI pair<long long, int> #define PLL pair<long long, long long> #define PDD pair<double, double> #define MOD ((int)1e9 + 7) #define INF ((int)...
delete
67
72
67
67
0
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; else return gcd(b, a % b); } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; // ユークリッド互除法 long long p = min(c, d); long long q = max(c, d); long long r = q % p; while (...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; else return gcd(b, a % b); } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; // ユークリッド互除法 long long p = min(c, d); long long q = max(c, d); long long r = q % p; while (...
replace
25
26
25
26
0
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define speed_up \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define rep(i, a...
#include <bits/stdc++.h> #define ll long long #define speed_up \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define rep(i, a...
replace
13
28
13
16
TLE
p02995
C++
Runtime Error
#include <iostream> using namespace std; int main() { long long int a, b, c, d, Cmax, Cmin, Dmax, Dmin; long long int ans; long long int Emax, Emin; cin >> a >> b >> c >> d; Cmax = b / c; Cmin = a / c; if (a % c == 0) { Cmin--; } Dmax = b / d; Dmin = a / d; if (a % d == 0) { Dmin--; } ...
#include <iostream> using namespace std; int main() { long long int a, b, c, d, Cmax, Cmin, Dmax, Dmin; long long int ans; long long int Emax, Emin; cin >> a >> b >> c >> d; Cmax = b / c; Cmin = a / c; if (a % c == 0) { Cmin--; } Dmax = b / d; Dmin = a / d; if (a % d == 0) { Dmin--; } ...
replace
18
19
18
19
0
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); long long a, b, c, d; cin >> a >> b >> c >> d; a--; long long lcm = (c * d) / __gcd(c, d); long long abc = (b / c - (a - 1) / c); long long abd = (b / d - (a - 1) / ...
#include <bits/stdc++.h> using namespace std; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); long long a, b, c, d; cin >> a >> b >> c >> d; a--; long long lcm = (c * d) / __gcd(c, d); long long abc = (b / c - a / c); long long abd = (b / d - a / d); long l...
replace
13
16
13
16
0
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long h = max(c, d); d = min(c, d); c = h; long long k = 1; while ((k * c) % d != 0) { k++; } k = k * c; long long sc = a / c; if (a % c) { sc++; } long long ec = b / c; lo...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long h = max(c, d); d = min(c, d); c = h; long long k = __gcd(c, d); k = d / k; k = k * c; long long sc = a / c; if (a % c) { sc++; } long long ec = b / c; long long sd = a / d;...
replace
9
13
9
11
TLE
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; // 最大公約数 long long x, y, gcd = 1; x = c; y = d; long long sw; if (y < x) { sw = x; x = y; y = sw; } vector<long long> gc(1000, 0); // xの約数 int count = 0; for (long long i ...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; // 最大公約数 long long x, y, gcd = 1; x = c; y = d; long long sw; if (y < x) { sw = x; x = y; y = sw; } vector<long long> gc(1000, 1); // xの約数 int count = 0; for (long long i ...
replace
19
20
19
20
0
p02995
C++
Runtime Error
#include <bits/stdc++.h> #define repeat(i, n) for (int(i) = 0; i < (n); i++) using namespace std; typedef long long ll; const double EPS = numeric_limits<double>::epsilon(); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) % b; } ll f(ll x, ll c, ll d) { ll result = x; ...
#include <bits/stdc++.h> #define repeat(i, n) for (int(i) = 0; i < (n); i++) using namespace std; typedef long long ll; const double EPS = numeric_limits<double>::epsilon(); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll f(ll x, ll c, ll d) { ll result = x; ...
replace
7
8
7
8
0
p02995
C++
Runtime Error
// C - Anti-Division #include <bits/stdc++.h> using namespace std; typedef long long ll; // const int INF = 2147483647; // const ll INF = 9223372036854775807; // const int MOD = 1e9 + 7; ll get_gcd(ll x, ll y) { if (x < y) { swap(x, y); } ll m = x % y; while (m != 0) { x = y; y = m; m = x %...
// C - Anti-Division #include <bits/stdc++.h> using namespace std; typedef long long ll; // const int INF = 2147483647; // const ll INF = 9223372036854775807; // const int MOD = 1e9 + 7; ll get_gcd(ll x, ll y) { if (x < y) { swap(x, y); } ll m = x % y; while (m != 0) { x = y; y = m; m = x %...
replace
29
30
29
30
0
p02995
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <functional> // for less using namespace __gnu_pbds; using namespace std; // typedef tree<ll, null_type, less<ll>, rb_tree_tag, // tree_order_statistics_node_update> ordered_set; #define ll long long #define pb push_back #define ppb pop_back #define...
#include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <functional> // for less using namespace __gnu_pbds; using namespace std; // typedef tree<ll, null_type, less<ll>, rb_tree_tag, // tree_order_statistics_node_update> ordered_set; #define ll long long #define pb push_back #define ppb pop_back #define...
delete
87
91
87
87
0
p02995
C++
Runtime Error
#include <iostream> using namespace std; int main() { long a, b, c, d, cd = 0, r[1000000000000]; // cdはcとdの最小公倍数 cin >> a >> b >> c >> d; r[0] = max(c, d) % min(c, d); if (r[0] == 0) cd = c * d / min(c, d); else { r[1] = min(c, d) % r[0]; for (int j = 0;; j++) { if (r[j + 1] == 0) { ...
#include <iostream> using namespace std; int main() { long a, b, c, d, cd = 0, r[1000000]; // cdはcとdの最小公倍数 cin >> a >> b >> c >> d; r[0] = max(c, d) % min(c, d); if (r[0] == 0) cd = c * d / min(c, d); else { r[1] = min(c, d) % r[0]; for (int j = 0;; j++) { if (r[j + 1] == 0) { cd = ...
replace
4
5
4
5
-11
p02995
C++
Time Limit Exceeded
#include <iostream> #define ull unsigned long long using namespace std; ull gcd(ull x, ull y) { ull r; do { r = x % y; x = y; y = r; } while (r != 0); return x; } ull hcd(ull x, int y, ull z) { return (x * y / z); } int main() { ull a, b, c, d, i, c1 = 0, g, h; cin >> a >> b >> c >> d; c1 += b...
#include <iostream> #define ull unsigned long long using namespace std; ull gcd(ull x, ull y) { ull r; do { r = x % y; x = y; y = r; } while (r != 0); return x; } ull hcd(ull x, int y, ull z) { return (x * y / z); } int main() { ull a, b, c, d, i, c1 = 0, g, h; cin >> a >> b >> c >> d; c1 += b...
replace
24
33
24
30
TLE
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll findLCD(ll X, ll Y) { ll g; ll A = max(X, Y); ll B = min(X, Y); ll iniA = A; ll iniB = B; if (A == B) g = A; else { if (A % B == 0) g = B; while (true) { g = A % B; A = B; B = g; if (A % B ==...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll findLCD(ll X, ll Y) { ll g; ll A = max(X, Y); ll B = min(X, Y); ll iniA = A; ll iniB = B; if (A == B) g = A; else { if (A % B == 0) g = B; else { while (true) { g = A % B; A = B; B = g;...
replace
16
22
16
24
0
p02995
C++
Runtime Error
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define int long long #define endl '\n' #define null nullptr #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define pb push_back #...
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define int long long #define endl '\n' #define null nullptr #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define pb push_back #...
replace
36
40
36
40
0
p02995
C++
Time Limit Exceeded
/* ID: arunesh2 TASK: ride LANG: C++ */ /* LANG can be C++11 or C++14 for those more recent releases */ #include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { while (a != b) { if (a > b) a = a - b; else b = b - a; } return a; } // Function to return LCM of tw...
/* ID: arunesh2 TASK: ride LANG: C++ */ /* LANG can be C++11 or C++14 for those more recent releases */ #include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { while (a != b) { if (a > b) a = a - b; else b = b - a; } return a; } // Function to return LCM of tw...
replace
31
52
31
38
TLE
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long count = 0; for (long long i = a; a <= i && i <= b; ++i) { if (i % c != 0 && i % d != 0) { ++count; } } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long ans = b - a + 1; ans -= ((b / c) - ((a - 1) / c)); ans -= ((b / d) - ((a - 1) / d)); long long p = (d * c) / __gcd(d, c); ans += ((b / p)) - ((a - 1) / (p)); cout << ans << endl; }
replace
6
13
6
12
TLE
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; a--; ll e = a / __gcd(a, b) * b; ll ans = b - (b / c) - (b / d) + (b / e) - a + (a / c) + (a / d) - (a / e); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; a--; ll e = c * d / __gcd(c, d); ll ans = b - (b / c) - (b / d) + (b / e) - a + (a / c) + (a / d) - (a / e); cout << ans << endl; }
replace
7
8
7
8
0
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gd(ll x, ll y) { if (x <= y) return gd(y, x); if (x % y == 0) return y; else return gd(min(x, y), max(x, y) % min(x, y)); } ll lm(ll x, ll y) { return (x * y) / gd(x, y); } int main() { ll a, b, c, d; cin >> a >> b >> c >> ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gd(ll x, ll y) { if (x < y) return gd(y, x); if (x % y == 0) return y; else return gd(min(x, y), max(x, y) % min(x, y)); } ll lm(ll x, ll y) { return (x * y) / gd(x, y); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d...
replace
5
6
5
6
TLE
p02995
C++
Time Limit Exceeded
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdlib> #include <map> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; const double pi = acos(-1); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdlib> #include <map> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; const double pi = acos(-1); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a...
replace
20
56
20
30
TLE
p02995
C++
Runtime Error
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #defin...
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #defin...
replace
37
38
37
38
0
p02995
C++
Runtime Error
#include <iostream> using namespace std; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } long long f1(long long X1, long long C1, long long D1) { long long G1 = GCD(C1, D1); long long L1 = C1 / G1 * D1; return X1 - X1 / C1 - X1 / D1 ...
#include <iostream> using namespace std; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } long long f1(long long X1, long long C1, long long D1) { long long G1 = GCD(C1, D1); long long L1 = C1 / G1 * D1; return X1 - X1 / C1 - X1 / D1 ...
replace
15
16
15
16
0
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; ll gcd(ll c, ll d) { return c ? gcd(c, d % c) : c; } ll lcm(ll c, ll d) { return (c / gcd(c, d) * d); } ll f(ll x, ll c, ll d) { ll res = x; res -= x / c; res -= x / d; res += x / lcm(c, d); r...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; ll gcd(ll c, ll d) { return d ? gcd(d, c % d) : c; } ll lcm(ll c, ll d) { return (c / gcd(c, d) * d); } ll f(ll x, ll c, ll d) { ll res = x; res -= x / c; res -= x / d; res += x / lcm(c, d); r...
replace
5
6
5
6
TLE
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll b, ll c) { return c ? gcd(c, b % c) : b; } ll lcm(ll b, ll c) { return b / gcd(b, c) * c; } ll f(ll a, ll b, ll c) { ll ans = a; ans -= a / b; ans -= a / c; ans += a / lcm(b, c); return ans; } int main() { ll A, B, C, D; c...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll b, ll c) { return c ? gcd(c, b % c) : b; } ll lcm(ll b, ll c) { return b / gcd(b, c) * c; } ll f(ll a, ll b, ll c) { ll ans = a; ans -= a / b; ans -= a / c; ans += a / lcm(b, c); return ans; } int main() { ll A, B, C, D; ...
replace
20
21
20
22
0
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define int long long int32_t main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); int a, b, c, d; cin >> a >> b >> c >> d; int g = (...
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define int long long int32_t main() { // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); // #endif ios_base::sync_with_stdio(false); cin.tie(NULL); int a, b, c, d; cin >> a >> b >> c...
replace
6
10
6
10
0
p02995
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; long long lcm(long long x, long long y) { long long sum = x * y; long long tmp = x; long long i = y; long long ret; if (x > y) { tmp = y; i = x; } ret = i % tmp; while (ret != 0LL) { i = tmp;...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; long long lcm(long long x, long long y) { long long sum = x * y; long long tmp = x; long long i = y; long long ret; if (x > y) { tmp = y; i = x; } ret = i % tmp; while (ret != 0LL) { i = tmp;...
replace
24
25
24
25
-8
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long Cdiv = B / C - (A - 1) / C; long long Ddiv = B / D - (A - 1) / D; long long CDdiv; long long minCD = min(C, D); long long lcm; long long gcd = 1; long long Cs = C; long long Ds = D; ...
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long Cdiv = B / C - (A - 1) / C; long long Ddiv = B / D - (A - 1) / D; long long CDdiv; long long minCD = min(C, D); long long lcm; long long gcd = 1; long long Cs = C; long long Ds = D; ...
replace
15
16
15
16
TLE
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { if (y) return gcd(y, x % y); else return x; } int main(void) { long long a, b, po = 0; int c, d, t; po += b / c - (a - 1) / c; po += b / d - (a - 1) / d; t = c * d / gcd(c, d); po -= b / t - (a - 1) / t; cout << b - a + 1 ...
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { if (y) return gcd(y, x % y); else return x; } int main(void) { long long a, b, po = 0, c, d, t; cin >> a >> b >> c >> d; po += b / c - (a - 1) / c; po += b / d - (a - 1) / d; t = c * d / gcd(c, d); po -= b / t - (a - 1) / t;...
replace
11
13
11
13
0
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename T, typename L> using gpp_map = tre...
#include <bits/stdc++.h> using namespace std; /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename T, typename L> using gpp_map = tre...
replace
115
117
115
117
0
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; ll Pow(ll a, ll b, ll c) { ll ans = 1; a %= c; while (b) { if (b & 1) ans = (ans * a) % c; a = (a * a) % c; b >>= 1; } return (ans % c); } bool cmp(const int &a, const int &b) { return a < b...
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; ll Pow(ll a, ll b, ll c) { ll ans = 1; a %= c; while (b) { if (b & 1) ans = (ans * a) % c; a = (a * a) % c; b >>= 1; } return (ans % c); } bool cmp(const int &a, const int &b) { return a < b...
replace
27
48
27
31
TLE
p02995
Python
Runtime Error
from math import gcd def main(): A, B, C, D = map(int, input().split()) Q_AC, R_AC = A // C, A % C Q_AD, R_AD = A // D, A % D Q_BC, R_BC = B // C, B % C Q_BD, R_BD = B // D, B % D Q_ACD, R_ACD = A // lcm(C, D), A % lcm(C, D) Q_BCD, R_BCD = B // lcm(C, D), B % lcm(C, D) N_C = num_baisu(...
from fractions import gcd def main(): A, B, C, D = map(int, input().split()) Q_AC, R_AC = A // C, A % C Q_AD, R_AD = A // D, A % D Q_BC, R_BC = B // C, B % C Q_BD, R_BD = B // D, B % D Q_ACD, R_ACD = A // lcm(C, D), A % lcm(C, D) Q_BCD, R_BCD = B // lcm(C, D), B % lcm(C, D) N_C = num_b...
replace
0
1
0
1
0
p02995
Python
Runtime Error
from math import gcd A, B, C, D = [int(x) for x in input().split(" ")] c = (B // C) - (A // C) + int(A % C == 0) d = (B // D) - (A // D) + int(A % D == 0) lcm_cd = (C * D) // gcd(C, D) cd = (B // (lcm_cd)) - (A // (lcm_cd)) + int(A % (lcm_cd) == 0) c_or_d = c + d - cd print((B - A + 1) - c_or_d)
from fractions import gcd A, B, C, D = [int(x) for x in input().split(" ")] c = (B // C) - (A // C) + int(A % C == 0) d = (B // D) - (A // D) + int(A % D == 0) lcm_cd = (C * D) // gcd(C, D) cd = (B // (lcm_cd)) - (A // (lcm_cd)) + int(A % (lcm_cd) == 0) c_or_d = c + d - cd print((B - A + 1) - c_or_d)
replace
0
1
0
1
0
p02995
Python
Runtime Error
from math import gcd A, B, C, D = map(int, input().split()) C_div = B // C - (A - 1) // C D_div = B // D - (A - 1) // D CD = C * D // gcd(C, D) CD_div = B // CD - (A - 1) // CD print(B - A + 1 - C_div - D_div + CD_div)
from fractions import gcd A, B, C, D = map(int, input().split()) C_div = B // C - (A - 1) // C D_div = B // D - (A - 1) // D CD = C * D // gcd(C, D) CD_div = B // CD - (A - 1) // CD print(B - A + 1 - C_div - D_div + CD_div)
replace
0
1
0
1
0
p02995
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define INF 1e18 #define int long long #define rep(i, n) for (int i = 0; i < n; i++) int gcd(int x, ...
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define INF 1e18 #define int long long #define rep(i, n) for (int i = 0; i < n; i++) int gcd(int x, ...
replace
17
22
17
18
0
p02995
Python
Runtime Error
from math import gcd A, B, C, D = map(int, input().split()) G = gcd(C, D) L = C * D // G ca = (A - 1) // C cb = B // C da = (A - 1) // D db = B // D la = (A - 1) // L lb = B // L div = cb + db - (ca + da) - (lb - la) print(B - (A - 1) - div)
from fractions import gcd A, B, C, D = map(int, input().split()) G = gcd(C, D) L = C * D // G ca = (A - 1) // C cb = B // C da = (A - 1) // D db = B // D la = (A - 1) // L lb = B // L div = cb + db - (ca + da) - (lb - la) print(B - (A - 1) - div)
replace
0
1
0
1
0
p02995
Python
Runtime Error
from math import gcd a, b, c, d = map(int, input().split()) e = (c * d) // gcd(c, d) c_min = a + (c - a % c) if (a % c) != 0 else a c_max = b - b % c d_min = a + (d - a % d) if (a % d) != 0 else a d_max = b - b % d e_min = a + (e - a % e) if (a % e) != 0 else a e_max = b - b % e n_c = (c_max - c_min) // c + 1 if c_...
from fractions import gcd a, b, c, d = map(int, input().split()) e = (c * d) // gcd(c, d) c_min = a + (c - a % c) if (a % c) != 0 else a c_max = b - b % c d_min = a + (d - a % d) if (a % d) != 0 else a d_max = b - b % d e_min = a + (e - a % e) if (a % e) != 0 else a e_max = b - b % e n_c = (c_max - c_min) // c + 1 ...
replace
0
1
0
1
0
p02995
Python
Runtime Error
from math import gcd a, b, c, d = map(int, input().split()) def cnt_div(a, b, x): q, r = divmod(a, x) if r == 0: m = q - 1 else: m = q n = b // x return n - m num_c = cnt_div(a, b, c) num_d = cnt_div(a, b, d) lcm = int((c * d) / gcd(c, d)) num_c_d_gcd = cnt_div(a, b, lcm) pr...
from fractions import gcd a, b, c, d = map(int, input().split()) def cnt_div(a, b, x): q, r = divmod(a, x) if r == 0: m = q - 1 else: m = q n = b // x return n - m num_c = cnt_div(a, b, c) num_d = cnt_div(a, b, d) lcm = int((c * d) / gcd(c, d)) num_c_d_gcd = cnt_div(a, b, lcm...
replace
0
1
0
1
0
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define rep2(i, s, n) for (long long i = (s); i < (long long)(n); i++) #define repi(i, n) for (int i = 0; i < (int)(n); i++) #define rep2i(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(v) v.begin(...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define rep2(i, s, n) for (long long i = (s); i < (long long)(n); i++) #define repi(i, n) for (int i = 0; i < (int)(n); i++) #define rep2i(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(v) v.begin(...
replace
71
76
71
75
TLE
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int x, long long int y) { long long int tmp; long long int r; if (x > y) { tmp = x; x = y; y = tmp; } r = y % x; while (r != 0) { y = x; x = r; r = y % x; } return x; } int main() { long long int a, b, ...
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int x, long long int y) { long long int tmp; long long int r; if (x > y) { tmp = x; x = y; y = tmp; } r = y % x; while (r != 0) { y = x; x = r; r = y % x; } return x; } int main() { long long int a, b, ...
replace
22
25
22
27
0
p02995
C++
Runtime Error
#include <algorithm> #include <cstdlib> #include <iomanip> //小数点以下を表示させる(setprecision()) #include <iostream> //入出力 #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define debug(...
#include <algorithm> #include <cstdlib> #include <iomanip> //小数点以下を表示させる(setprecision()) #include <iostream> //入出力 #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define debug(...
replace
43
48
43
44
-8
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b, c, d, g, x = 0; cin >> a >> b >> c >> d; for (int64_t h = min(c, d) / 2; h > 0; h--) { if (c % h == 0 && d % h == 0) { g = h; break; } } x = c * d / g; cout << (b - a + 1) - (b / c + b / d + (a - 1) / x) + ...
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b, c, d, g, x = 0; cin >> a >> b >> c >> d; x = c * d / __gcd(c, d); cout << (b - a + 1) - (b / c + b / d + (a - 1) / x) + ((a - 1) / c + (a - 1) / d + b / x) << endl; }
replace
8
16
8
9
0
p02995
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { ll r; while (b != 0) { r = a % b; a = b; b = r; } return a; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll cnt_b = 0; ll cnt_a = 0; ll t_a = 0, t_b = 0;...
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { ll r; while (b != 0) { r = a % b; a = b; b = r; } return a; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll cnt_b = 0; ll cnt_a = 0; ll t_a = 0, t_b = 0;...
replace
26
33
26
28
TLE
p02995
C++
Time Limit Exceeded
#include "bits/stdc++.h" using namespace std; template <typename T> T gcd(T a, T b) { if (b == 0) { return a; } else { return gcd(b, a % b); } } template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); } void Main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long g = gcd(c, d...
#include "bits/stdc++.h" using namespace std; template <typename T> T gcd(T a, T b) { if (b == 0) { return a; } else { return gcd(b, a % b); } } template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); } void Main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long g = gcd(c, d...
replace
19
29
19
23
TLE
p02995
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #include <functional> // for less // #include "graph.cpp" #define ll long long #define loop(i, n) for (int i = 0; i < n; ++i) #define rep(i, x, n) for (int i = x; i <= n; ++i) #define iteloop(type, data...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #include <functional> // for less // #include "graph.cpp" #define ll long long #define loop(i, n) for (int i = 0; i < n; ++i) #define rep(i, x, n) for (int i = x; i <= n; ++i) #define iteloop(type, data...
replace
21
22
21
22
-8
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(void) { ll a, b, c, d; cin >> a >> b >> c >> d; int count = 0; for (int i = a; i <= b; i++) { if (i % c != 0 && i % d != 0) count++; } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(void) { ll a, b, c, d; cin >> a >> b >> c >> d; ll div_c = b / c - (a - 1) / c; ll div_d = b / d - (a - 1) / d; ll count = div_c + div_d - (b / (c * d / (__gcd(c, d)))) + ((a - 1) / (c * d / (__gcd(c, d)))); ll ans = ...
replace
6
12
6
14
TLE
p02995
C++
Runtime Error
/* _ _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ ...
/* _ _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ ...
replace
101
102
101
102
0
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define _Pi 3.1415926535 using namespace std; typedef long long ll; long long gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll nC = 0, nD = 0, nCD...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define _Pi 3.1415926535 using namespace std; typedef long long ll; long long gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll nC, nD, nCD; nC =...
replace
16
36
16
20
TLE
p02995
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define what_is(x) cerr << #x << " is " << x << endl; #define what_is_v(x) \ cerr << #x << " is "; \ for (auto &e : (x)) ...
#include <bits/stdc++.h> using namespace std; #define what_is(x) cerr << #x << " is " << x << endl; #define what_is_v(x) \ cerr << #x << " is "; \ for (auto &e : (x)) ...
replace
49
51
49
50
0
p02995
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long double ld; typedef long long int ll; ty...
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long double ld; typedef long long int ll; ty...
replace
72
73
72
73
0
p02995
C++
Runtime Error
#include <iostream> using namespace std; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { long long A, B, C, D, G; long long L; long long cnt; cin >> A >> B >> C >> D; G = GCD(A, B); L = C * D / G; A = A - ...
#include <iostream> using namespace std; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { long long A, B, C, D, G; long long L; long long cnt; cin >> A >> B >> C >> D; G = GCD(C, D); L = C * D / G; A = A - ...
replace
20
21
20
21
0
p02995
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; if (c < d) swap(c, d); ll x = c, y = d; ll r = x % y; while (r != 0) { x = y; y = r; r = x % y; } ll lcm = c * d /...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; if (c < d) swap(c, d); ll x = c, y = d; ll r = x % y; while (r != 0) { x = y; y = r; r = x % y; } ll lcm = c * d /...
replace
22
43
22
24
TLE
p02996
C++
Runtime Error
#include <functional> #include <iostream> #include <map> #include <queue> #include <vector> int main(int argc, char *argv[]) { int N; std::cin >> N; std::map<long int, std::vector<long int>, std::greater<long int>> jobs; long int A, B; for (int i = 0; i < N; ++i) { std::cin >> A >> B; if (jobs.find(B...
#include <functional> #include <iostream> #include <map> #include <queue> #include <vector> int main(int argc, char *argv[]) { int N; std::cin >> N; std::map<long int, std::vector<long int>, std::greater<long int>> jobs; long int A, B; for (int i = 0; i < N; ++i) { std::cin >> A >> B; if (jobs.find(B...
replace
31
32
31
32
-11
p02996
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; typedef long double ld; const double pi = acos(-1.0); const ll mod = pow(10, 9) + 7; const ll INF = pow(2, 31) - 1; typedef pair<int, int> P; typedef vector<int> vi; template <class T> bool chmax(T &a, c...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef long double ld; const double pi = acos(-1.0); const ll mod = pow(10, 9) + 7; const ll INF = pow(2, 31) - 1; typedef pair<int, int> P; typedef vector<int> vi; template <class T> bool chmax(T &a, c...
replace
42
43
42
43
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define rep(i, n) for (ll i = 0; i < n; ++i) #define loop(i, m, n) for (ll i = m; i < n; ++i) #define ggr \ getchar(); ...
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define rep(i, n) for (ll i = 0; i < n; ++i) #define loop(i, m, n) for (ll i = m; i < n; ++i) #define ggr \ getchar(); ...
replace
85
86
85
86
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct node { int c, lim; bool operator<(const node &y) { return lim < y.lim; } }; node a[100100]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d%d", &a[i].c, &a[i].lim); } sort(a + 1, a + n + 1); int cnt = 0; int fg = 1;...
#include <bits/stdc++.h> using namespace std; struct node { int c, lim; bool operator<(const node &y) { return lim < y.lim; } }; node a[200200]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d%d", &a[i].c, &a[i].lim); } sort(a + 1, a + n + 1); int cnt = 0; int fg = 1;...
replace
6
7
6
7
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef struct ss { int a, b; bool operator<(const ss &x) const { if (x.b != b) return b < x.b; } } s; s node[200007]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d%d", &node[i].a, &node[i].b); } sort(node + 1, n...
#include <bits/stdc++.h> using namespace std; typedef struct ss { int a, b; bool operator<(const ss &x) const { if (x.b != b) return b < x.b; else return a < x.a; } } s; s node[200007]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d%d", &node[i].a, &nod...
insert
7
7
7
9
0
p02996
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; typedef long long LL; const int maxn = 200007; struct thing { int t; int e; } a[maxn]; bool cmp(thing x, thing y) { if (x.e > y.e) { return false; } else return true; } ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; typedef long long LL; const int maxn = 200007; struct thing { int t; int e; } a[maxn]; bool cmp(thing x, thing y) { if (x.e > y.e) { return false; } else if (x.e == y.e) { ...
insert
17
17
17
19
0
p02996
C++
Runtime Error
#include <algorithm> #include <iostream> #define maxn 20005 using namespace std; int n, sum = 0; struct job { int a, b; } jobs[maxn]; int cmp(job x, job y) { return x.b < y.b; } int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> jobs[i].a >> jobs[i].b; } sort(jobs + 1, jobs + n + 1, cmp); ...
#include <algorithm> #include <iostream> #define maxn 200005 using namespace std; int n, sum = 0; struct job { int a, b; } jobs[maxn]; int cmp(job x, job y) { return x.b < y.b; } int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> jobs[i].a >> jobs[i].b; } sort(jobs + 1, jobs + n + 1, cmp); ...
replace
2
3
2
3
0
p02996
C++
Runtime Error
#include <algorithm> #include <cstdio> using namespace std; struct node { int st; int ed; // start&end } a[1005]; // 结构体 bool cmp(node x, node y) { return x.ed < y.ed; } int main() { int n, i, t = 0, ans = 1, total = 0; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%d%d", &a[i].st, &a[i].ed); sort(a...
#include <algorithm> #include <cstdio> using namespace std; struct node { int st; int ed; } a[200005]; bool cmp(node x, node y) { return x.ed < y.ed; } int main() { int n, i, t = 0, ans = 1, total = 0; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%d%d", &a[i].st, &a[i].ed); sort(a + 1, a + n + 1, cm...
replace
5
7
5
7
0
p02996
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; using lint = int64_t; int main() { int N; pair<lint, lint> p[100010]; cin >> N; for (int i = 1; i <= N; i++) { cin >> p[i].second; cin >> p[i].first; } sort(p + 1, p + 1 + N); int time = 0; lint sum = 0; for (int i = 1; i <= N; i...
#include <algorithm> #include <iostream> using namespace std; using lint = int64_t; int main() { int N; pair<lint, lint> p[200010]; cin >> N; for (int i = 1; i <= N; i++) { cin >> p[i].second; cin >> p[i].first; } sort(p + 1, p + 1 + N); int time = 0; lint sum = 0; for (int i = 1; i <= N; i...
replace
7
8
7
8
0
p02996
C++
Runtime Error
#include <algorithm> #include <iostream> #include <utility> using namespace std; int n; pair<int, int> a[100000]; int main() { cin >> n; for (int i = 0; i < n; ++i) cin >> a[i].second >> a[i].first; sort(a, a + n); int tv = 0, f = 0; for (int i = 0; i < n; ++i) { tv += a[i].second; if (a[i].first ...
#include <algorithm> #include <iostream> #include <utility> using namespace std; int n; pair<int, int> a[200000]; int main() { cin >> n; for (int i = 0; i < n; ++i) cin >> a[i].second >> a[i].first; sort(a, a + n); int tv = 0, f = 0; for (int i = 0; i < n; ++i) { tv += a[i].second; if (a[i].first ...
replace
5
6
5
6
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define ld long double using namespace std; ll n; vector<pair<ll, ll>> v(100005); int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> v[i].second >> v[i].first; } while (v.size() > n) v.pop_back(); sort(v.begin(), v.end()); ll cur; for (int i =...
#include <bits/stdc++.h> #define ll long long #define ld long double using namespace std; ll n; vector<pair<ll, ll>> v(200005); int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> v[i].second >> v[i].first; } while (v.size() > n) v.pop_back(); sort(v.begin(), v.end()); ll cur; for (int i =...
replace
5
6
5
6
0
p02996
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #define D first #define T second using namespace std; long long n, s; pair<int, int> a[100005]; int main() { int i; cin >> n; for (i = 0; i < n; i++) scanf("%d%d", &a[i].T, &a[i].D); sort(a, a + n); for (i = 0; i < n; i++) { s += a[i].T; ...
#include <algorithm> #include <cstdio> #include <iostream> #define D first #define T second using namespace std; long long n, s; pair<int, int> a[200005]; int main() { int i; cin >> n; for (i = 0; i < n; i++) scanf("%d%d", &a[i].T, &a[i].D); sort(a, a + n); for (i = 0; i < n; i++) { s += a[i].T; ...
replace
8
9
8
9
0
p02996
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; const int MAX = 100000; int main() { int N; pair<int, int> x[MAX]; cin >> N; for (int i = 0...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; const int MAX = 200001; int main() { int N; pair<int, int> x[MAX]; cin >> N; for (int i = 0...
replace
13
14
13
14
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long ll int b[200005]; ll int a[200005]; bool compare(const pair<ll int, int> p1, const pair<ll int, int> p2) { if (b[p1.second] == b[p2.second]) { return p1.first < p2.second; } return b[p1.second] < b[p2.second]; } ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long ll int b[200005]; ll int a[200005]; bool compare(const pair<ll int, int> p1, const pair<ll int, int> p2) { if (b[p1.second] == b[p2.second]) { return p1.first < p2.first; } return b[p1.second] < b[p2.second]; } i...
replace
8
9
8
9
0
p02996
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> X; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; X.push_back(make_pair(b, a)); sort(X.begin(), X.end()); long long sum = 0; for (auto j : X) { sum += j.second; if (sum...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> X; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; X.push_back(make_pair(b, a)); } sort(X.begin(), X.end()); long long sum = 0; for (auto j : X) { sum += j.second; if (sum > j.f...
replace
11
19
11
19
TLE
p02996
C++
Time Limit Exceeded
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0; i...
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0...
replace
0
1
0
1
TLE
p02996
C++
Runtime Error
#include <algorithm> #include <cstdlib> #include <iomanip> //小数点以下を表示させる(setprecision()) #include <iostream> //入出力 #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define debug(...
#include <algorithm> #include <cstdlib> #include <iomanip> //小数点以下を表示させる(setprecision()) #include <iostream> //入出力 #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define debug(...
replace
47
50
47
49
-11
p02996
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define inf 2147483647 #define rep(i, a, b) for (int i = a; i < b; i++) #define rr read() #define ll long ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define inf 2147483647 #define rep(i, a, b) for (int i = a; i < b; i++) #define rr read() #define ll long ...
replace
36
37
36
37
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)n; i++) #define ALL(a) (a).begin(), (a).end() const ll mod = 1e9 + 7; bool compare(pair<int, int> a, pair<int, int> b) { if (a.second != b.second) return a.second < b.second; } int main() { int n; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)n; i++) #define ALL(a) (a).begin(), (a).end() const ll mod = 1e9 + 7; bool compare(pair<int, int> a, pair<int, int> b) { if (a.second != b.second) return a.second < b.second; else return a.first <...
insert
10
10
10
12
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long a[200010]; long long b[200010]; long long v[500000] = {0}; int main() { long long n, ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; v[b[i]] += a[i]; } sort(b, b + n); for (int i = 0; i < n; i++) { if (b[i] == b[i - 1]...
#include <bits/stdc++.h> using namespace std; long long a[200010]; long long b[200010]; map<int, int> v; int main() { long long n, ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; v[b[i]] += a[i]; } sort(b, b + n); for (int i = 0; i < n; i++) { if (b[i] == b[i - 1] && i) ...
replace
4
5
4
5
0
p02996
C++
Runtime Error
// Written By NewbieChd #include <algorithm> #include <cctype> #include <cstdio> #define int long long using namespace std; const int BUF = 1000000; char buf[BUF], *p1, *p2; inline char getChar() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2) ? EOF : *p1++; } i...
// Written By NewbieChd #include <algorithm> #include <cctype> #include <cstdio> #define int long long using namespace std; const int BUF = 1000000; char buf[BUF], *p1, *p2; inline char getChar() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2) ? EOF : *p1++; } i...
replace
25
26
25
26
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; struct node { int a, b; } a[N]; int cmp(node a, node b) { return a.b < b.b; } int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i].a >> a[i].b; sort(a + 1, a + n + 1, cmp); int t = 0; for (int i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; struct node { int a, b; } a[N]; int cmp(node a, node b) { return a.b < b.b; } int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i].a >> a[i].b; sort(a + 1, a + n + 1, cmp); int t = 0; for (int i = 1; i <= n; i++) { ...
replace
2
3
2
3
0
p02996
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <queue> using namespace std; const int Maxn = 2e5; int N; struct Node { int t1, t2; bool operator<(const Node &rhs) const { return t2 < rhs.t2; } } A[2 * Maxn + 5]; priority_queue<int> q; int main() { #ifdef LOACL freopen("in.txt", "r", stdin); freopen("out.txt"...
#include <algorithm> #include <cstdio> #include <queue> using namespace std; const int Maxn = 2e5; int N; struct Node { int t1, t2; bool operator<(const Node &rhs) const { return t2 < rhs.t2; } } A[2 * Maxn + 5]; priority_queue<int> q; int main() { #ifdef LOACL freopen("in.txt", "r", stdin); freopen("out.txt"...
insert
29
29
29
31
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; struct each { int x, y; } a[N]; bool com(each x, each y) { if (x.y == y.y) return x.x < y.x; return x.y < y.y; } int n; int main() { int t = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y); sort(a...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; struct each { int x, y; } a[N]; bool com(each x, each y) { if (x.y == y.y) return x.x < y.x; return x.y < y.y; } int n; int main() { int t = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y); sort(a...
replace
2
3
2
3
0
p02996
C++
Runtime Error
#include <algorithm> #include <iostream> #include <utility> using namespace std; const int MAX = 100005; int main() { pair<int, int> A[MAX]; int N, a, b; cin >> N; for (int i = 0; i < N; ++i) { cin >> a >> b; A[i].first = b; A[i].second = a; } sort(A, A + N); int temp = 0; for (int i = 0;...
#include <algorithm> #include <iostream> #include <utility> using namespace std; const int MAX = 200005; int main() { pair<int, int> A[MAX]; int N, a, b; cin >> N; for (int i = 0; i < N; ++i) { cin >> a >> b; A[i].first = b; A[i].second = a; } sort(A, A + N); int temp = 0; for (int i = 0;...
replace
4
5
4
5
0
p02996
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_s...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_s...
replace
51
58
51
52
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long int ll; typedef pair<int, int> P; int n; P tasks[101010]; int main() { cin >> n; rep(i, n) { cin >> tasks[i].second >> tasks[i].first; if (tasks[i].first < tasks[i].second) { cout << ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long int ll; typedef pair<int, int> P; int n; P tasks[202020]; int main() { cin >> n; rep(i, n) { cin >> tasks[i].second >> tasks[i].first; if (tasks[i].first < tasks[i].second) { cout << ...
replace
7
8
7
8
0
p02996
C++
Runtime Error
// Keep working hard :) #include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout...
// Keep working hard :) #include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout...
replace
20
21
20
21
0
p02996
C++
Runtime Error
// temprates #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <tuple> #include <vector> ...
// temprates #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <tuple> #include <vector> ...
replace
40
43
40
41
0
p02996
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> typedef long long ll; using namespace std; int main(void) { ll n, i; ll t = 0; pair<ll, ll> p[100000]; cin >> n; for (i = 0; i < n; i++) { cin >> p[i].second >> p[i].first; ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> typedef long long ll; using namespace std; int main(void) { ll n, i; ll t = 0; pair<ll, ll> p[200000]; cin >> n; for (i = 0; i < n; i++) { cin >> p[i].second >> p[i].first; ...
replace
13
14
13
14
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vll = vector<ll>; using P = pair<int, int>; constexpr int INF = 1e9; constexpr ll INFLL = 1e18; constexpr int MOD = 1e9 + 7; const ld PI = acosl(-1); #define rep(i, n) for (int i = 0; i < (n); ++...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vll = vector<ll>; using P = pair<int, int>; constexpr int INF = 1e9; constexpr ll INFLL = 1e18; constexpr int MOD = 1e9 + 7; const ld PI = acosl(-1); #define rep(i, n) for (int i = 0; i < (n); ++...
replace
23
24
23
24
-11
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define vi vector<int> #define vii vector<pair<int, int>> #define rep(i, a, b) for (int i = a; i < b; i++) #define repD(i, a, b) for (int i = a; i > b; i--) #define pb push_back #define pii pair<int, int> #define ff first #define ...
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define vi vector<int> #define vii vector<pair<int, int>> #define rep(i, a, b) for (int i = a; i < b; i++) #define repD(i, a, b) for (int i = a; i > b; i--) #define pb push_back #define pii pair<int, int> #define ff first #define ...
replace
35
36
35
36
0
p02996
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <stdio.h> #include <vector> #define int long long using namespace std; #define rep(s, i, n) for (int i = s; i < n; i++) #define c(n) cout << n << endl; pair<int, int> a[114514]; signed main() { int n; cin >> n; rep(0, i, n) { ci...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <stdio.h> #include <vector> #define int long long using namespace std; #define rep(s, i, n) for (int i = s; i < n; i++) #define c(n) cout << n << endl; pair<int, int> a[214514]; signed main() { int n; cin >> n; rep(0, i, n) { ci...
replace
10
11
10
11
0
p02996
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define ll long long #defi...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define ll long long #defi...
replace
28
29
28
29
0
p02996
C++
Runtime Error
/* Life Before Death, Strength Before Weakness, Journey Before Destination ------------------------------------------------------------------------ You don't become great by trying to be great. You become great by wanting to do something, and then doing it so hard that you become great in the process. */ // #pragma co...
/* Life Before Death, Strength Before Weakness, Journey Before Destination ------------------------------------------------------------------------ You don't become great by trying to be great. You become great by wanting to do something, and then doing it so hard that you become great in the process. */ // #pragma co...
replace
52
53
52
53
0
p02996
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { int N; cin >> N; pair<long long, long long> pairs[100100]; long long sum; sum = 0; for (int i = 0; i < N; i++) { cin >> pairs[i].second; cin >> pairs[i].first; } sort(pairs, pairs + N); for (int i = 0; i < N; i++) { ...
#include <algorithm> #include <iostream> using namespace std; int main() { int N; cin >> N; pair<long long, long long> pairs[200200]; long long sum; sum = 0; for (int i = 0; i < N; i++) { cin >> pairs[i].second; cin >> pairs[i].first; } sort(pairs, pairs + N); for (int i = 0; i < N; i++) { ...
replace
7
8
7
8
0
p02996
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <memory> #include <set> #include <vector> #define ll long long using namespace std; const int NMAX = 100000 + 3; int c[NMAX], d[NMAX], a[NMAX]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <memory> #include <set> #include <vector> #define ll long long using namespace std; const int NMAX = 200000 + 3; int c[NMAX], d[NMAX], a[NMAX]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { ...
replace
13
14
13
14
0
p02996
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; #define INF 10000...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; #define INF 10000...
replace
74
75
74
75
0
p02996
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long...
insert
41
41
41
43
TLE
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define reg register #define rep(a, b, c) for (reg int a = b, a##end = c; a <= a##end; ++a) #define drep(a, b, c) for (reg int a = b, a##end = c; a >= a##end; --a) char IO; int rd() { int s = 0, f = 0; while (IO = getchar(), IO < '0' || IO > '9'...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define reg register #define rep(a, b, c) for (reg int a = b, a##end = c; a <= a##end; ++a) #define drep(a, b, c) for (reg int a = b, a##end = c; a >= a##end; --a) char IO; int rd() { int s = 0, f = 0; while (IO = getchar(), IO < '0' || IO > '9'...
replace
37
38
37
38
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef struct { int a; int b; } ab; ab s[100100]; int com(ab t1, ab t2) { return t1.b < t2.b; } int main() { int n, flag = 1, ti = 0; cin >> n; for (int i = 0; i < n; i++) scanf("%d%d", &s[i].a, &s[i].b); sort(s, s + n, com); for (int i = 0; i < n; i++) {...
#include <bits/stdc++.h> using namespace std; typedef struct { int a; int b; } ab; ab s[200100]; int com(ab t1, ab t2) { return t1.b < t2.b; } int main() { int n, flag = 1, ti = 0; cin >> n; for (int i = 0; i < n; i++) scanf("%d%d", &s[i].a, &s[i].b); sort(s, s + n, com); for (int i = 0; i < n; i++) {...
replace
6
7
6
7
0
p02996
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; int main() { int N; cin >> N; int A[100100], B[100100]; P C[100100]; bool flag = true; for (int i = 0; i < N; i++) { ll a, b; cin >> a >> b; if (b < a) flag = false; C[i] = P(b, a); } // ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; int main() { int N; cin >> N; ; P C[200100]; bool flag = true; for (int i = 0; i < N; i++) { ll a, b; cin >> a >> b; if (b < a) flag = false; C[i] = P(b, a); } // sort(C, C + N); ll no...
replace
8
10
8
10
0
p02996
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; #define ll long long const ll N = 2 * 1e5; ll n, m; struct node { ll a, b; } f[N]; bool cmp(node a, node b) { return a.b < b.b; } int main() { cin >> n; for (int i = 1; i <= n; i++) scanf("...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; #define ll long long const int N = 3 * 1e5; ll n, m; struct node { ll a, b; } f[N]; bool cmp(node a, node b) { return a.b < b.b; } int main() { cin >> n; for (int i = 1; i <= n; i++) scanf(...
replace
9
10
9
10
0
p02996
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> typedef long long int ll; #define rep(i, a, b) for (int i = (a); i < (b); i++) using namespace std; int N; int sum = 0; bool judge = true; int main(void) { pair<int, int> a[100001]; cin >> N; rep(i, 0, N) cin >> a[i].second >> a[i].first; sort(a, a + ...
#include <algorithm> #include <iostream> #include <vector> typedef long long int ll; #define rep(i, a, b) for (int i = (a); i < (b); i++) using namespace std; int N; int sum = 0; bool judge = true; int main(void) { pair<int, int> a[200001]; cin >> N; rep(i, 0, N) cin >> a[i].second >> a[i].first; sort(a, a + ...
replace
12
13
12
13
0