Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
9 values
p02995
#include <bits/stdc++.h> using namespace std; #define int long long #define fo(a, b) for (int a = 0; a < b; a++) int wari(int a, int b) { if (a % b == 0) return a / b; else return a / b + 1; } int keta(int a) { double b = a; b = log10(b); int c = b; return c + 1; } int souwa(int a) { return a * (a + 1) / 2; } int lcm(int a, int b) { int d = a, e = b, f; if (a < b) swap(a, b); int c, m = 1; while (m) { c = a % b; if (c == 0) { f = a; m--; } else { a = b; b = c; } } return d * e / f; } signed main() { int a, b, c, d, e; cin >> a >> b >> c >> d; e = lcm(c, d); a--; int f, g, h, i; f = b / c - a / c; g = b / d - a / d; h = b / e - c / e; i = f + g - h; a++; cout << b - a + 1 - i << endl; }
#include <bits/stdc++.h> using namespace std; #define int long long #define fo(a, b) for (int a = 0; a < b; a++) int wari(int a, int b) { if (a % b == 0) return a / b; else return a / b + 1; } int keta(int a) { double b = a; b = log10(b); int c = b; return c + 1; } int souwa(int a) { return a * (a + 1) / 2; } int lcm(int a, int b) { int d = a, e = b, f; if (a < b) swap(a, b); int c, m = 1; while (m) { c = a % b; if (c == 0) { f = b; m--; } else { a = b; b = c; } } return d * e / f; } signed main() { int a, b, c, d, e; cin >> a >> b >> c >> d; e = lcm(c, d); // cout<<e<<endl; a--; int f, g, h, i; f = b / c - a / c; g = b / d - a / d; h = b / e - a / e; i = f + g - h; a++; cout << b - a + 1 - i << endl; }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
805,905
805,906
u322177979
cpp
p02995
#include <bits/stdc++.h> using namespace std; using ll = long long; ll euq(ll, ll); int main() { ll A, B, C, D, count = 0, k = 1; cin >> A >> B >> C >> D; ll lmc = (C * D) / euq(C, D); count += B / C + B / D - B / lmc; count -= (A - 1) / C + (A - 1) / D + (A - 1) / lmc; cout << (B - A + 1) - count << endl; } ll euq(ll a, ll b) { if (b > a) return euq(b, a); ll r; while ((r = a % b)) { a = b; b = r; } return b; }
#include <bits/stdc++.h> using namespace std; using ll = long long; ll euq(ll, ll); int main() { ll A, B, C, D, count = 0, k = 1; cin >> A >> B >> C >> D; ll lmc = (C * D) / euq(C, D); count += B / C + B / D - B / lmc; count -= (A - 1) / C + (A - 1) / D - (A - 1) / lmc; cout << (B - A + 1) - count << endl; } ll euq(ll a, ll b) { if (b > a) return euq(b, a); ll r; while ((r = a % b)) { a = b; b = r; } return b; }
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
805,909
805,910
u703503553
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; int cd = C * D / gcd(C, D); ll a = (A - 1) - ((A - 1) / C + (A - 1) / D - (A - 1) / cd); ll b = B - (B / C + B / D - B / cd); cout << b - a << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll cd = C * D / gcd(C, D); ll a = (A - 1) - ((A - 1) / C + (A - 1) / D - (A - 1) / cd); ll b = B - (B / C + B / D - B / cd); cout << b - a << endl; }
[ "variable_declaration.type.change" ]
805,924
805,925
u679366464
cpp
p02995
#include <iostream> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long cdiv, ddiv, cddiv; long long cd; cdiv = b / c - a / c; if (a % c == 0) cdiv++; ddiv = b / d - a / d; if (a % d == 0) ddiv++; long long cc = c; long long dd = d; while (cc != dd) { if (cc > dd) { cc -= dd; } else { dd -= cc; } } cd = c * d / cc; cddiv = b / cd - a / cd; if (a % cd == 0) cddiv--; cout << b - a + 1 - (cdiv + ddiv - cddiv) << endl; return 0; }
#include <iostream> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long cdiv, ddiv, cddiv; long long cd; cdiv = b / c - a / c; if (a % c == 0) cdiv++; ddiv = b / d - a / d; if (a % d == 0) ddiv++; long long cc = c; long long dd = d; while (cc != dd) { if (cc > dd) { cc -= dd; } else { dd -= cc; } } cd = c * d / cc; cddiv = b / cd - a / cd; if (a % cd == 0) cddiv++; cout << b - a + 1 - (cdiv + ddiv - cddiv) << endl; return 0; }
[]
805,926
805,927
u639203570
cpp
p02995
// C,Dの最小公倍数を求めたい //ユークリッドの互除法で最大公約数を求めたら公式で出せる #include <iostream> using namespace std; long int euclideam(long int c, long int d); //最大公約数 long int euclideam(long int c, long int d) { long int w, C = c, D = d; if (C < D) { w = C; C = D; D = w; } while (D != 0) { w = C % D; C = D; D = w; } return C; } int main() { long int a, b, c, d, ans; cin >> a >> b >> c >> d; long int x = c * d / euclideam(c, d); ans = b - b / d - b / c + b / x; ans -= a - a / c - a / d + a / x; cout << ans; }
// C,Dの最小公倍数を求めたい //ユークリッドの互除法で最大公約数を求めたら公式で出せる #include <iostream> using namespace std; long int euclideam(long int c, long int d); //最大公約数 long int euclideam(long int c, long int d) { long int w, C = c, D = d; if (C < D) { w = C; C = D; D = w; } while (D != 0) { w = C % D; C = D; D = w; } return C; } int main() { long int a, b, c, d, ans; cin >> a >> b >> c >> d; long int x = c * d / euclideam(c, d); ans = b - b / d - b / c + b / x; a--; ans -= a - a / c - a / d + a / x; cout << ans; }
[ "expression.unary.arithmetic.add" ]
805,928
805,929
u924527074
cpp
p02995
#include <bits/stdc++.h> #include <cmath> #include <iostream> #include <limits> #include <numeric> #include <string> #include <vector> using namespace std; int gcd(long long int a, long long int b) { long long int r, tmp; if (a < b) { tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } int lcm(long long int a, long long int b, long long int c) { return c * (a / c) * (b / c); } int main(void) { long long int a, b, c, d; cin >> a >> b >> c >> d; long long int f = lcm(c, d, gcd(c, d)); // cout<<f<<endl; long long int X = b / c - (a - 1) / c; long long int Y = b / d - (a - 1) / d; long long int Z = b / f - (a - 1) / f; // cout<<X<<Y<<Z<<endl; cout << (b - a + 1) - X - Y + Z << endl; }
#include <bits/stdc++.h> #include <cmath> #include <iostream> #include <limits> #include <numeric> #include <string> #include <vector> using namespace std; long long int gcd(long long int a, long long int b) { long long int r, tmp; if (a < b) { tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } long long int lcm(long long int a, long long int b, long long int c) { return c * (a / c) * (b / c); } int main(void) { long long int a, b, c, d; cin >> a >> b >> c >> d; long long int f = lcm(c, d, gcd(c, d)); // cout<<f<<endl; long long int X = b / c - (a - 1) / c; long long int Y = b / d - (a - 1) / d; long long int Z = b / f - (a - 1) / f; // cout<<X<<Y<<Z<<endl; cout << (b - a + 1) - X - Y + Z << endl; }
[ "variable_declaration.type.widen.change" ]
805,932
805,933
u939401127
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define INF 1 << 30 #define endl '\n' #define maxn 100005 #define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); typedef long long ll; const double PI = acos(-1.0); #define dbg(x) cerr << #x << " = " << x << endl; #define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl; #define dbg3(x, y, z) \ cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " \ << z << endl; const ll mod = 1e9 + 7; ll gcd(ll x, ll y) { if (x < y) { ll z = x; x = y; y = z; } if (x % y == 0) return y; else return gcd(y, x % y); } int main() { FASTIO /* //double start_time = clock(); #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); freopen("error.txt", "w", stderr); #endif //*/ int T; // cin >> T; T = 1; for (int cs = 1; cs <= T; cs++) { ll a, b, c, d; cin >> a >> b >> c >> d; ll tot = b - a + 1; ll lcm = c * d / gcd(c, d); a--; // cerr << lcm << endl; ll divide = b / c + b / d - a / c - a / d - b / lcm - a / lcm; // cerr << (b/c) <<" "<< (b/d) << " "<< b/(c * d) << " "<< (a - 1)/c << " // "<< (a - 1)/d<<endl; cerr << tot << " "<<divide << endl; ll ans = tot - divide; cout << ans << endl; } // double end_time = clock(); // printf( "Time = %lf ms\n", ( (end_time - start_time) / // CLOCKS_PER_SEC)*1000); return 0; }
#include <bits/stdc++.h> using namespace std; #define INF 1 << 30 #define endl '\n' #define maxn 100005 #define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); typedef long long ll; const double PI = acos(-1.0); #define dbg(x) cerr << #x << " = " << x << endl; #define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl; #define dbg3(x, y, z) \ cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " \ << z << endl; const ll mod = 1e9 + 7; ll gcd(ll x, ll y) { if (x < y) { ll z = x; x = y; y = z; } if (x % y == 0) return y; else return gcd(y, x % y); } int main() { FASTIO /* //double start_time = clock(); #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); freopen("error.txt", "w", stderr); #endif //*/ int T; // cin >> T; T = 1; for (int cs = 1; cs <= T; cs++) { ll a, b, c, d; cin >> a >> b >> c >> d; ll tot = b - a + 1; ll lcm = c * d / gcd(c, d); a--; // cerr << lcm << endl; ll divide = (b / c) + b / d - a / c - a / d - b / lcm + a / lcm; // divide += (b/d) - (a/d); // divide -= // cerr << (b/c) <<" "<< (b/d) << " "<< b/(c * d) << " "<< (a - 1)/c << " // "<< (a - 1)/d<<endl; cerr << tot << " "<<divide << endl; ll ans = tot - divide; cout << ans << endl; } // double end_time = clock(); // printf( "Time = %lf ms\n", ( (end_time - start_time) / // CLOCKS_PER_SEC)*1000); return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
805,955
805,956
u802237789
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define popcnt(a) __builtin_popcount(a) #define IO() \ assert(freopen("in.in", "rt", stdin)), \ assert(freopen("out.out", "wt", stdout)) #define FastIO() ios::sync_with_stdio(false); #define debug(x) cout << __LINE__ << ": " << #x << " = " << (x) << endl typedef long long ll; const ll MOD = 1e9 + 7; const int N = 1e7 + 9, M = 1e5 + 9, OO = 0x3f3f3f3f; const double EPS = 1e-10; // inline int readi(){int n;scanf("%d", &n);return n;} // inline ll readll(){ll n;scanf("%lld", &n);return n;} // inline char readc(){char c;scanf("%c ", &c);return c;} // inline double readd(){double n;scanf("%lf", &n);return n;} inline bool dCMP(const long double &a, const long double &b) { return fabsl(a - b) < EPS; } int arr[N]; int main() { #ifdef _LOCAL_DEFINE IO(); #endif ll a, b, c, d; scanf("%lld%lld%lld%lld", &a, &b, &c, &d); ll ans = 0; ans += (b / c - (a - 1) / c); ans += (b / d - (a - 1) / d); int lcm = (c * d) / __gcd(c, d); ans -= (b / lcm - (a - 1) / lcm); printf("%lld", (b - a + 1) - ans); return 0; }
#include <bits/stdc++.h> using namespace std; #define popcnt(a) __builtin_popcount(a) #define IO() \ assert(freopen("in.in", "rt", stdin)), \ assert(freopen("out.out", "wt", stdout)) #define FastIO() ios::sync_with_stdio(false); #define debug(x) cout << __LINE__ << ": " << #x << " = " << (x) << endl typedef long long ll; const ll MOD = 1e9 + 7; const int N = 1e7 + 9, M = 1e5 + 9, OO = 0x3f3f3f3f; const double EPS = 1e-10; // inline int readi(){int n;scanf("%d", &n);return n;} // inline ll readll(){ll n;scanf("%lld", &n);return n;} // inline char readc(){char c;scanf("%c ", &c);return c;} // inline double readd(){double n;scanf("%lf", &n);return n;} inline bool dCMP(const long double &a, const long double &b) { return fabsl(a - b) < EPS; } int arr[N]; int main() { #ifdef _LOCAL_DEFINE IO(); #endif ll a, b, c, d; scanf("%lld%lld%lld%lld", &a, &b, &c, &d); ll ans = 0; ans += (b / c - (a - 1) / c); ans += (b / d - (a - 1) / d); ll lcm = (c * d) / __gcd(c, d); ans -= (b / lcm - (a - 1) / lcm); printf("%lld", (b - a + 1) - ans); return 0; }
[ "variable_declaration.type.change" ]
805,959
805,960
u970872504
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); } int main(void) { long long A, B, C, D; cin >> A >> B >> C >> D; long long i; long long count = 0; int C_divable_count = 0; int D_divable_count = 0; int CD_divable_count = 0; C_divable_count = B / C - (A - 1) / C; D_divable_count = B / D - (A - 1) / D; CD_divable_count = B / (C * D / gcd(C, D)) - (A - 1) / (C * D / gcd(C, D)); count = B - (A - 1) - C_divable_count - D_divable_count + CD_divable_count; cout << count << endl; }
#include <bits/stdc++.h> using namespace std; long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); } int main(void) { long long A, B, C, D; cin >> A >> B >> C >> D; long long i; long long count = 0; long long C_divable_count = 0; long long D_divable_count = 0; long long CD_divable_count = 0; C_divable_count = B / C - (A - 1) / C; D_divable_count = B / D - (A - 1) / D; CD_divable_count = B / (C * D / gcd(C, D)) - (A - 1) / (C * D / gcd(C, D)); count = B - (A - 1) - C_divable_count - D_divable_count + CD_divable_count; cout << count << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
805,961
805,962
u209053759
cpp
p02995
#include <bits/stdc++.h> using namespace std; int gcd(long long a, long long b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } int main() { long long a, b, c, d, i; cin >> a >> b >> c >> d; int z = c * d / gcd(c, d); long long sum = b / c + b / d - b / z; long long x = (a - 1) / c + (a - 1) / d + -(a - 1) / z; cout << b - a + 1 - sum + x << endl; }
#include <bits/stdc++.h> using namespace std; int gcd(long long a, long long b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } int main() { long long a, b, c, d, i; cin >> a >> b >> c >> d; long long z = c * d / gcd(c, d); long long sum = b / c + b / d - b / z; long long x = (a - 1) / c + (a - 1) / d + -(a - 1) / z; cout << b - a + 1 - sum + x << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
805,969
805,970
u827250617
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int sum = b - a + 1; sum -= (b / c - (a - 1) / c); sum -= (b / d - (a - 1) / d); int x = c * d; int tmp; if (d < c) { tmp = c; c = d; d = tmp; } tmp = d % c; while (tmp != 0) { d = c; c = tmp; tmp = d % c; } x /= c; sum += (b / x - (a - 1) / x); cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long a, b, c, d; cin >> a >> b >> c >> d; long sum = b - a + 1; sum -= (b / c - (a - 1) / c); sum -= (b / d - (a - 1) / d); long x = c * d; long tmp; if (d < c) { tmp = c; c = d; d = tmp; } tmp = d % c; while (tmp != 0) { d = c; c = tmp; tmp = d % c; } x /= c; sum += (b / x - (a - 1) / x); cout << sum << endl; }
[ "variable_declaration.type.primitive.change" ]
805,975
805,976
u891544435
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, ans = 0, i, G; long long gcd(long long x, long long y) { if (x < y) return gcd(y, x); long long r; while ((r = x % y)) { x = y; y = r; } return y; } int main() { cin >> a >> b >> c >> d; if (c == 1 || d == 1) { cout << b - a + 1 << endl; return 0; } ans = (b - a + 1); G = gcd(c, d); // cout << ans << endl; long long l = c * d / G; ans -= ((b / c) - ((a - 1) / c)); // cout << ans << endl; ans -= ((b / d) - ((a - 1) / d)); // cout << ans << endl; ans += ((b / l) - ((a - 1) / l)); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, ans = 0, i, G; long long gcd(long long x, long long y) { if (x < y) return gcd(y, x); long long r; while ((r = x % y)) { x = y; y = r; } return y; } int main() { cin >> a >> b >> c >> d; if (c == 1 || d == 1) { cout << 0 << endl; return 0; } ans = (b - a + 1); G = gcd(c, d); // cout << ans << endl; long long l = c * d / G; ans -= ((b / c) - ((a - 1) / c)); // cout << ans << endl; ans -= ((b / d) - ((a - 1) / d)); // cout << ans << endl; ans += ((b / l) - ((a - 1) / l)); cout << ans << endl; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "io.output.change", "expression.operation.binary.remove" ]
805,997
805,998
u660351670
cpp
p02995
#include <iostream> using namespace std; int gcd(int x, int y) { if (y == 0) return x; else return gcd(y, x % y); } int main() { int a, b, c, d; cin >> a >> b >> c >> d; a -= 1; cout << b - b / c - b / d + b / (c * d / gcd(c, d)) - (a - a / c - a / d + a / (c * d / gcd(c, d))); }
#include <iostream> using namespace std; int gcd(long long x, long long y) { if (y == 0) return x; else return gcd(y, x % y); } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; a -= 1; cout << b - b / c - b / d + b / (c * d / gcd(c, d)) - (a - a / c - a / d + a / (c * d / gcd(c, d))); }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
806,007
806,008
u859897687
cpp
p02995
#include <cmath> #include <iostream> using namespace std; int main() { long A, B, C, D, sum_A, sum_B; cin >> A >> B >> C >> D; sum_B = B - B / C - B / D; if (C < D) { int tmp; tmp = C; C = D; D = tmp; } int g = C % D, c, d; // Euclid c = C; d = D; while (g != 0) { c = d; d = g; g = c % d; } int l = (C * D) / d; sum_B += B / l; sum_A = (A - 1) - (A - 1) / C - (A - 1) / D; g = C % D; c = C; d = D; while (g != 0) { c = d; d = g; g = c % d; } l = (C * D) / d; sum_A += A / l; cout << sum_B - sum_A << endl; return 0; }
#include <cmath> #include <iostream> using namespace std; int main() { long A, B, C, D, sum_A, sum_B; cin >> A >> B >> C >> D; sum_B = B - B / C - B / D; if (C < D) { int tmp; tmp = C; C = D; D = tmp; } long g = C % D, c, d; // Euclid c = C; d = D; while (g != 0) { c = d; d = g; g = c % d; } long l = (C * D) / d; sum_B += B / l; sum_A = (A - 1) - (A - 1) / C - (A - 1) / D; g = C % D; c = C; d = D; while (g != 0) { c = d; d = g; g = c % d; } l = (C * D) / d; sum_A += (A - 1) / l; cout << sum_B - sum_A << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
806,022
806,023
u348109388
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long euclid(long long a, long long b) { long long temp; if (a < b) { temp = a; a = b; b = temp; } if (b < 1) return -1; if (a % b == 0) return b; return euclid(b, a % b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long N = B - A + 1; long long p = C * D / euclid(C, D); long long ac; long long ad; long long acd; if (A % C == 0) { ac = A; } else { ac = A - (C - A % C); } if (A % D == 0) { ad = A; } else { ad = A - (D - A % D); } if (A % p == 0) { acd = A; } else { acd = A + (p - A % p); } long long bc = B - B % C; long long bd = B - B % D; long long bcd = B - B % p; long long x = bc / C - ac / C + 1; long long y = bd / D - ad / D + 1; long long z = bcd / p - acd / p + 1; long long ans = N - (x + y - z); if (A == B) { if (A % C != 0 && A % D != 0) { ans = 1; } else { ans = 0; } } if (C == D) { ans = N - x; } cout << ans << endl; // cout <<ac<<" "<<ad<<" "<<acd<<" "<<bc<<" "<<bd<<" "<<bcd<<endl; }
#include <bits/stdc++.h> using namespace std; long long euclid(long long a, long long b) { long long temp; if (a < b) { temp = a; a = b; b = temp; } if (b < 1) return -1; if (a % b == 0) return b; return euclid(b, a % b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long N = B - A + 1; long long p = C * D / euclid(C, D); long long ac; long long ad; long long acd; if (A % C == 0) { ac = A; } else { ac = A + (C - A % C); } if (A % D == 0) { ad = A; } else { ad = A + (D - A % D); } if (A % p == 0) { acd = A; } else { acd = A + (p - A % p); } long long bc = B - B % C; long long bd = B - B % D; long long bcd = B - B % p; long long x = bc / C - ac / C + 1; long long y = bd / D - ad / D + 1; long long z = bcd / p - acd / p + 1; long long ans = N - (x + y - z); if (A == B) { if (A % C != 0 && A % D != 0) { ans = 1; } else { ans = 0; } } if (C == D) { ans = N - x; } cout << ans << endl; // cout <<ac<<" "<<ad<<" "<<acd<<" "<<bc<<" "<<bd<<" "<<bcd<<endl; }
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
806,037
806,038
u341309363
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long euclid(long long a, long long b) { long long temp; if (a < b) { temp = a; a = b; b = temp; } if (b < 1) return -1; if (a % b == 0) return b; return euclid(b, a % b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long N = B - A + 1; long long p = C * D / euclid(C, D); long long ac; long long ad; long long acd; if (A % C == 0) { ac = A; } else { ac = A + -(A % C); } if (A % D == 0) { ad = A; } else { ad = A - (A % D); } if (A % p == 0) { acd = A; } else { acd = A + (p - A % p); } long long bc = B - B % C; long long bd = B - B % D; long long bcd = B - B % p; long long x = bc / C - ac / C + 1; long long y = bd / D - ad / D + 1; long long z = bcd / p - acd / p + 1; long long ans = N - (x + y - z); if (A == B) { if (A % C != 0 && A % D != 0) { ans = 1; } else { ans = 0; } } if (C == D) { ans = N - x; } cout << ans << endl; // cout <<ac<<" "<<ad<<" "<<acd<<" "<<bc<<" "<<bd<<" "<<bcd<<endl; }
#include <bits/stdc++.h> using namespace std; long long euclid(long long a, long long b) { long long temp; if (a < b) { temp = a; a = b; b = temp; } if (b < 1) return -1; if (a % b == 0) return b; return euclid(b, a % b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long N = B - A + 1; long long p = C * D / euclid(C, D); long long ac; long long ad; long long acd; if (A % C == 0) { ac = A; } else { ac = A + (C - A % C); } if (A % D == 0) { ad = A; } else { ad = A + (D - A % D); } if (A % p == 0) { acd = A; } else { acd = A + (p - A % p); } long long bc = B - B % C; long long bd = B - B % D; long long bcd = B - B % p; long long x = bc / C - ac / C + 1; long long y = bd / D - ad / D + 1; long long z = bcd / p - acd / p + 1; long long ans = N - (x + y - z); if (A == B) { if (A % C != 0 && A % D != 0) { ans = 1; } else { ans = 0; } } if (C == D) { ans = N - x; } cout << ans << endl; // cout <<ac<<" "<<ad<<" "<<acd<<" "<<bc<<" "<<bd<<" "<<bcd<<endl; }
[ "expression.operation.unary.arithmetic.remove", "assignment.change", "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
806,039
806,038
u341309363
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long euclid(long a, long b) { long long temp; if (a < b) { temp = a; a = b; b = temp; } if (b < 1) return -1; if (a % b == 0) return b; return euclid(b, a % b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long N = B - A + 1; long long p = C * D / euclid(C, D); long long ac; long long ad; long long acd; if (A % C == 0) { ac = A; } else { ac = A + (C - A % C); } if (A % D == 0) { ad = A; } else { ad = A + (D - A % D); } if (A % p == 0) { acd = A; } else { acd = A + (p - A % p); } long long bc = B - B % C; long long bd = B - B % D; long long bcd = B - B % p; long long x = bc / C - ac / C + 1; long long y = bd / D - ad / D + 1; long long z = bcd / p - acd / p + 1; int ans = N - (x + y - z); if (A == B) { if (A % C != 0 && A % D != 0) { ans = 1; } else { ans = 0; } } if (C == D) { ans = N - x; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; long long euclid(long long a, long long b) { long long temp; if (a < b) { temp = a; a = b; b = temp; } if (b < 1) return -1; if (a % b == 0) return b; return euclid(b, a % b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long N = B - A + 1; long long p = C * D / euclid(C, D); long long ac; long long ad; long long acd; if (A % C == 0) { ac = A; } else { ac = A + (C - A % C); } if (A % D == 0) { ad = A; } else { ad = A + (D - A % D); } if (A % p == 0) { acd = A; } else { acd = A + (p - A % p); } long long bc = B - B % C; long long bd = B - B % D; long long bcd = B - B % p; long long x = bc / C - ac / C + 1; long long y = bd / D - ad / D + 1; long long z = bcd / p - acd / p + 1; long long ans = N - (x + y - z); if (A == B) { if (A % C != 0 && A % D != 0) { ans = 1; } else { ans = 0; } } if (C == D) { ans = N - x; } cout << ans << endl; // cout <<ac<<" "<<ad<<" "<<acd<<" "<<bc<<" "<<bd<<" "<<bcd<<endl; }
[ "variable_declaration.type.widen.change", "variable_declaration.type.primitive.change" ]
806,040
806,038
u341309363
cpp
p02995
#include <stdio.h> typedef long long int ll; ll gcd(ll m, ll n) { if (m < n) { ll temp = m; m = n; n = temp; } ll r = m % n; while (r != 0) { m = n; n = r; r = m % n; } return n; } ll function(ll a, ll c, ll d) { ll count = 0; // a以下の自然数でcとdで割り切れない ll gcm = (c * d) / gcd(c, d); count = (a / c) + (a / d) - (a / gcm); return count; } int main(void) { ll a, b, c, d; scanf("%lld %lld %lld %lld", &a, &b, &c, &d); printf("%lld\n", function(b, c, d) - function(a - 1, c, d)); return 0; }
#include <stdio.h> typedef long long int ll; ll gcd(ll m, ll n) { if (m < n) { ll temp = m; m = n; n = temp; } ll r = m % n; while (r != 0) { m = n; n = r; r = m % n; } return n; } ll function(ll a, ll c, ll d) { ll count = 0; // a以下の自然数でcとdで割り切れない ll lcm = (c * d) / gcd(c, d); count = (a / c) + (a / d) - (a / lcm); return a - count; } int main(void) { ll a, b, c, d; scanf("%lld %lld %lld %lld", &a, &b, &c, &d); printf("%lld\n", function(b, c, d) - function(a - 1, c, d)); return 0; }
[ "variable_declaration.name.change", "identifier.change", "assignment.value.change", "expression.operation.binary.change" ]
806,087
806,088
u497418592
cpp
p02995
#include <stdio.h> typedef long long int ll; ll gcd(ll m, ll n) { if (m < n) { ll temp = m; m = n; n = temp; } ll r = m % n; while (r != 0) { m = n; n = r; r = m % n; } return n; } ll function(ll a, ll c, ll d) { ll count = 0; // a以下の自然数でcとdで割り切れない ll gcm = (c * d) / gcd(c, d); count = (a / c) + (a / d) - (a / gcm); return count; } int main(void) { ll a, b, c, d; scanf("%lld %lld %lld %lld", &a, &b, &c, &d); printf("%lld\n", function(b, c, d) - function(a, c, d)); return 0; }
#include <stdio.h> typedef long long int ll; ll gcd(ll m, ll n) { if (m < n) { ll temp = m; m = n; n = temp; } ll r = m % n; while (r != 0) { m = n; n = r; r = m % n; } return n; } ll function(ll a, ll c, ll d) { ll count = 0; // a以下の自然数でcとdで割り切れない ll lcm = (c * d) / gcd(c, d); count = (a / c) + (a / d) - (a / lcm); return a - count; } int main(void) { ll a, b, c, d; scanf("%lld %lld %lld %lld", &a, &b, &c, &d); printf("%lld\n", function(b, c, d) - function(a - 1, c, d)); return 0; }
[ "variable_declaration.name.change", "identifier.change", "assignment.value.change", "expression.operation.binary.change" ]
806,089
806,088
u497418592
cpp
p02995
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> 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; return sout.str(); } // math //------------------------------------------- template <class T> inline T sqr(T x) { return x * x; } // typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define EXISTch(s, c) \ ((((s).find_first_of(c)) != std::string::npos) ? 1 : 0) // cがあれば1 if(1) #define SORT(c) sort((c).begin(), (c).end()) #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) // constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const int INF = (int)1000000007; const LL MOD = (LL)1000000007; // 10^9+7 const LL INF2 = (LL)100000000000000000; // 10^18 LL gcd(LL a, LL b) { return b != 0 ? gcd(b, a % b) : a; } LL lcm(LL a, LL b) { return a * b / gcd(a, b); } LL solve(LL n, LL c, LL d) { LL val = 0; val += n / c + n / d; val -= n / lcm(c, d); return val; } int main() { LL l, r, c, d; cin >> l >> r >> c >> d; LL ans = solve(r, c, d) - solve(l - 1, c, d); cout << ans << endl; return 0; }
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> 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; return sout.str(); } // math //------------------------------------------- template <class T> inline T sqr(T x) { return x * x; } // typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define EXISTch(s, c) \ ((((s).find_first_of(c)) != std::string::npos) ? 1 : 0) // cがあれば1 if(1) #define SORT(c) sort((c).begin(), (c).end()) #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) // constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const int INF = (int)1000000007; const LL MOD = (LL)1000000007; // 10^9+7 const LL INF2 = (LL)100000000000000000; // 10^18 LL gcd(LL a, LL b) { return b != 0 ? gcd(b, a % b) : a; } LL lcm(LL a, LL b) { return a * b / gcd(a, b); } LL solve(LL n, LL c, LL d) { LL val = 0; val += n / c + n / d; val -= n / lcm(c, d); return n - val; } int main() { LL l, r, c, d; cin >> l >> r >> c >> d; LL ans = solve(r, c, d) - solve(l - 1, c, d); cout << ans << endl; return 0; }
[ "expression.operation.binary.add" ]
806,094
806,095
u874996917
cpp
p02995
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> 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; return sout.str(); } // math //------------------------------------------- template <class T> inline T sqr(T x) { return x * x; } // typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define EXISTch(s, c) \ ((((s).find_first_of(c)) != std::string::npos) ? 1 : 0) // cがあれば1 if(1) #define SORT(c) sort((c).begin(), (c).end()) #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) // constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const int INF = (int)1000000007; const LL MOD = (LL)1000000007; // 10^9+7 const LL INF2 = (LL)100000000000000000; // 10^18 LL gcd(LL a, LL b) { return b != 0 ? gcd(b, a % b) : a; } LL lcm(LL a, LL b) { return a * b / gcd(a, b); } LL solve(LL n, LL c, LL d) { LL val = 0; val += n / c + n / d; val -= lcm(c, d); return val; } int main() { LL l, r, c, d; cin >> l >> r >> c >> d; LL ans = solve(r, c, d) - solve(l - 1, c, d); cout << ans << endl; return 0; }
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> 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; return sout.str(); } // math //------------------------------------------- template <class T> inline T sqr(T x) { return x * x; } // typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define EXISTch(s, c) \ ((((s).find_first_of(c)) != std::string::npos) ? 1 : 0) // cがあれば1 if(1) #define SORT(c) sort((c).begin(), (c).end()) #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) // constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const int INF = (int)1000000007; const LL MOD = (LL)1000000007; // 10^9+7 const LL INF2 = (LL)100000000000000000; // 10^18 LL gcd(LL a, LL b) { return b != 0 ? gcd(b, a % b) : a; } LL lcm(LL a, LL b) { return a * b / gcd(a, b); } LL solve(LL n, LL c, LL d) { LL val = 0; val += n / c + n / d; val -= n / lcm(c, d); return n - val; } int main() { LL l, r, c, d; cin >> l >> r >> c >> d; LL ans = solve(r, c, d) - solve(l - 1, c, d); cout << ans << endl; return 0; }
[ "assignment.change" ]
806,096
806,095
u874996917
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define ll long long ll solve(ll l, ll r, ll div) { return r / div - (l - 1) / div; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll gcm = a * b / __gcd(a, b); cout << (b - a + 1) - (solve(a, b, c) + solve(a, b, d) - solve(a, b, gcm)); }
#include <bits/stdc++.h> using namespace std; #define ll long long ll solve(ll l, ll r, ll div) { return r / div - (l - 1) / div; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll gcm = c * d / __gcd(c, d); cout << (b - a + 1) - (solve(a, b, c) + solve(a, b, d) - solve(a, b, gcm)); }
[ "identifier.change", "expression.operation.binary.change", "call.arguments.change" ]
806,099
806,100
u914762730
cpp
p02995
#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; 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; cout << b - a + 1 - po << endl; return 0; }
#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; cout << b - a + 1 - po << endl; return 0; }
[]
806,110
806,111
u088895504
cpp
p02995
#include <iostream> long long gcd(long long x_g, long long y_g) { long long tmp_small; long long tmp_big; long long tmp; if (x_g < y_g) { tmp_big = y_g; tmp_small = x_g; } else { tmp_big = x_g; tmp_small = y_g; } while (false) { tmp = (tmp_big % tmp_small); if (tmp == 0) { return tmp_small; break; } tmp_big = tmp_small; tmp_small = tmp; } return tmp_small; } long long lcm(long long x, long long y) { return x * y / gcd(x, y); } long long A, B, C, D; int main() { std::cin >> A >> B >> C >> D; long long E = lcm(C, D); if (false) std::cout << "E:" << E << "\n"; long long ans = B - A + 1; ans -= (B / D) - ((A - 1) / D); if (false) std::cout << "D:" << D << " " << (B / D) - ((A - 1) / D) << "\n"; ans -= (B / C) - ((A - 1) / C); if (false) std::cout << (B / C) - ((A - 1) / C) << "\n"; ans += (B / E) - ((A - 1) / E); if (false) std::cout << (B / E) - ((A - 1) / E) << "\n"; std::cout << ans << "\n"; return 0; }
#include <iostream> long long gcd(long long x_g, long long y_g) { long long tmp_small; long long tmp_big; long long tmp; if (x_g < y_g) { tmp_big = y_g; tmp_small = x_g; } else { tmp_big = x_g; tmp_small = y_g; } while (true) { tmp = (tmp_big % tmp_small); if (tmp == 0) { return tmp_small; break; } tmp_big = tmp_small; tmp_small = tmp; } return tmp_small; } long long lcm(long long x, long long y) { return x * y / gcd(x, y); } long long A, B, C, D; int main() { std::cin >> A >> B >> C >> D; long long E = lcm(C, D); if (false) std::cout << "E:" << E << "\n"; long long ans = B - A + 1; ans -= (B / D) - ((A - 1) / D); if (false) std::cout << "D:" << D << " " << (B / D) - ((A - 1) / D) << "\n"; ans -= (B / C) - ((A - 1) / C); if (false) std::cout << (B / C) - ((A - 1) / C) << "\n"; ans += (B / E) - ((A - 1) / E); if (false) std::cout << (B / E) - ((A - 1) / E) << "\n"; std::cout << ans << "\n"; return 0; }
[ "misc.opposites", "control_flow.loop.condition.change" ]
806,112
806,113
u290584325
cpp
p02995
#include <iostream> int main(void) { using namespace std; long long a, b, c, d; cin >> a >> b >> c >> d; a -= 1; long long count_div_c = b / c - a / c; long long count_div_d = b / d - a / d; long long x = c, y = d; while (true) { if (x < y) { swap(x, y); } if (y == 0) { break; } x %= y; } long long cd_lcm = c * d / x; long long count_div_cd_lcm = b / cd_lcm - a / cd_lcm; long long ret = b - count_div_d - count_div_c - a + count_div_cd_lcm + 1; std::cout << ret << endl; return 0; }
#include <iostream> int main(void) { using namespace std; long long a, b, c, d; cin >> a >> b >> c >> d; a--; long long count_div_c = b / c - a / c; long long count_div_d = b / d - a / d; long long x = c, y = d; while (true) { if (x < y) { swap(x, y); } if (y == 0) { break; } x %= y; } long long cd_lcm = c * d / x; long long count_div_cd_lcm = b / cd_lcm - a / cd_lcm; long long ret = b - count_div_d - count_div_c - a + count_div_cd_lcm; std::cout << ret << endl; return 0; }
[ "expression.operation.binary.remove" ]
806,114
806,115
u894129918
cpp
p02995
#include <iostream> typedef long long ll; using namespace std; ll div(ll n, ll C, ll D) { ll nC = n / C; ll nD = n / D; ll r = C % D; ll t = C * D; while (r != 0) { C = D; D = r; r = C % D; } return nC + nD - n / (t / D); } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; if (C < D) { ll tmp = C; C = D; D = tmp; } cout << div(B, C, D) - div(A - 1, C, D) << "\n"; }
#include <iostream> typedef long long ll; using namespace std; ll div(ll n, ll C, ll D) { ll nC = n / C; ll nD = n / D; ll r = C % D; ll t = C * D; while (r != 0) { C = D; D = r; r = C % D; } return n - (nC + nD) + n / (t / D); } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; if (C < D) { ll tmp = C; C = D; D = tmp; } cout << div(B, C, D) - div(A - 1, C, D) << "\n"; }
[ "function.return_value.change", "expression.operation.binary.change" ]
806,140
806,141
u002428461
cpp
p02995
#include <bits/stdc++.h> using namespace std; // define #define int long long #define UNIQUE(v) v.erase(unique(all(v)), v.end()); #define ZIP(v) sort(all(v)), UNIQUE(v) #define ADD(a, b) a = (a + b) % mod #define SUB(a, b) a = (a + mod - b) % mod #define MUL(a, b) a = (((a) % mod) * ((b) % mod)) % mod #define rollcall cout << "I'm Sucu." << endl; #define repi(i, m, n) for (int i = m; i < n; i++) #define drep(i, n, m) for (int i = n; i >= m; i--) #define rep(i, n) repi(i, 0, n) #define rrep(i, n) repi(i, 1, n + 1) #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define dmp(x, y) make_pair(x, y) #define dmt(x, y, z) make_tuple(x, y, z) #define pb(x) push_back(x) #define pf(x) push_front(x) #define fi first #define se second // debug template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) { os << "(" << p.first << "," << p.second << ")"; return os; } template <typename T, typename U, typename V> ostream &operator<<(ostream &os, const tuple<T, U, V> &t) { os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")"; return os; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto it = v.begin(); it != v.end(); ++it) { if (it != v.begin()) os << " "; os << *it; } return os; } template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp) { for (auto x : mp) os << "(" << x.first << "," << x.second << ")" << endl; return os; } template <typename T, int SIZE> int array_length(const T (&)[SIZE]) { return SIZE; } template <typename T, int N> void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true) { if (t == -1) { rep(i, s) { if (i) cout << " "; cout << a[i]; } } else repi(i, s, t) { if (i != s) cout << " "; cout << a[i]; } if (f) cout << "\n"; } template <typename T, int N1, int N2> void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2) { rep(i, h) { rep(j, w) { cout << a[i][j] << " \n"[j == w - 1]; } } } string substr(const string &str, int S1, int S2 = -1) { if (S2 == -1) return str.substr(S1); return str.substr(S1, S2 - S1); } // typedef typedef complex<double> Point; typedef pair<int, int> P; typedef pair<int, P> PP; typedef pair<P, int> Pi; typedef tuple<int, int, int> TT; typedef pair<int, TT> PT; typedef vector<int> vi; typedef deque<int> dq; const int inf = 1e9 + 7; const int INF = 1e18 + 7; // int sum = accumulate(a, a+n, 0LL); // int mx = max_element(a, a+n); // int mn = min_element(a, a+n); // int cnt = count(a, a+n, k); //公約数 int gcd(int a, int b) { if (a == 0 || b == 0) return max(a, b); if (a == b) return a; if (a > b) a = a % b; else b = b % a; return gcd(a, b); } //公倍数 int lcm(int a, int b) { if (a == 0) return 0; return a / gcd(a, b) * b; } signed main() { int a, b, c, d; cin >> a >> b >> c >> d; int ans = 0; ans += b / c - (a - 1) / c; ans += b / d - (a - 1) / d; ans -= b / (c * d) - (a - 1) / lcm(c, d); cout << (b - a + 1) - ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; // define #define int long long #define UNIQUE(v) v.erase(unique(all(v)), v.end()); #define ZIP(v) sort(all(v)), UNIQUE(v) #define ADD(a, b) a = (a + b) % mod #define SUB(a, b) a = (a + mod - b) % mod #define MUL(a, b) a = (((a) % mod) * ((b) % mod)) % mod #define rollcall cout << "I'm Sucu." << endl; #define repi(i, m, n) for (int i = m; i < n; i++) #define drep(i, n, m) for (int i = n; i >= m; i--) #define rep(i, n) repi(i, 0, n) #define rrep(i, n) repi(i, 1, n + 1) #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define dmp(x, y) make_pair(x, y) #define dmt(x, y, z) make_tuple(x, y, z) #define pb(x) push_back(x) #define pf(x) push_front(x) #define fi first #define se second // debug template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) { os << "(" << p.first << "," << p.second << ")"; return os; } template <typename T, typename U, typename V> ostream &operator<<(ostream &os, const tuple<T, U, V> &t) { os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")"; return os; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto it = v.begin(); it != v.end(); ++it) { if (it != v.begin()) os << " "; os << *it; } return os; } template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp) { for (auto x : mp) os << "(" << x.first << "," << x.second << ")" << endl; return os; } template <typename T, int SIZE> int array_length(const T (&)[SIZE]) { return SIZE; } template <typename T, int N> void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true) { if (t == -1) { rep(i, s) { if (i) cout << " "; cout << a[i]; } } else repi(i, s, t) { if (i != s) cout << " "; cout << a[i]; } if (f) cout << "\n"; } template <typename T, int N1, int N2> void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2) { rep(i, h) { rep(j, w) { cout << a[i][j] << " \n"[j == w - 1]; } } } string substr(const string &str, int S1, int S2 = -1) { if (S2 == -1) return str.substr(S1); return str.substr(S1, S2 - S1); } // typedef typedef complex<double> Point; typedef pair<int, int> P; typedef pair<int, P> PP; typedef pair<P, int> Pi; typedef tuple<int, int, int> TT; typedef pair<int, TT> PT; typedef vector<int> vi; typedef deque<int> dq; const int inf = 1e9 + 7; const int INF = 1e18 + 7; // int sum = accumulate(a, a+n, 0LL); // int mx = max_element(a, a+n); // int mn = min_element(a, a+n); // int cnt = count(a, a+n, k); //公約数 int gcd(int a, int b) { if (a == 0 || b == 0) return max(a, b); if (a == b) return a; if (a > b) a = a % b; else b = b % a; return gcd(a, b); } //公倍数 int lcm(int a, int b) { if (a == 0) return 0; return a / gcd(a, b) * b; } signed main() { int a, b, c, d; cin >> a >> b >> c >> d; int ans = 0; ans += b / c - (a - 1) / c; ans += b / d - (a - 1) / d; // cout << ans << endl; ans -= b / lcm(c, d) - (a - 1) / lcm(c, d); // cout << ans << endl; cout << (b - a + 1) - ans << endl; return 0; }
[ "call.add", "assignment.value.change", "expression.operation.binary.change" ]
806,156
806,157
u691493208
cpp
p02995
#include <iostream> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll ged(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll a, b, c, d; ll ans = 0; cin >> a >> b >> c >> d; ll q = b - a + 1; ll s = b / c - a / c; if (a % c == 0) s++; ll h = b / d - a / d; if (a % d == 0) h++; ll f = max(c, d); ll g = b / f - a / f; if (a % f == 0) g++; ans = q - s - h + g; cout << ans; }
#include <iostream> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll ged(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll a, b, c, d; ll ans = 0; cin >> a >> b >> c >> d; ll q = b - a + 1; ll s = b / c - a / c; if (a % c == 0) s++; ll h = b / d - a / d; if (a % d == 0) h++; ll f = ged(c, d); ll g = b / f - a / f; if (a % f == 0) g++; ans = q - s - h + g; cout << ans; }
[ "identifier.change", "call.function.change" ]
806,158
806,159
u848650181
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long ct(long long a, long long b, long long c) { long long ct1 = (a % c == 0) ? a / c : (a + c) / c, ct2 = b / c; return ct2 - ct1 + 1; } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long lcm = (c * d) / (long long)__gcd(c, d); int ans = ct(a, b, c) + ct(a, b, d) - ct(a, b, lcm); cout << b - a + 1 - ans << endl; }
#include <bits/stdc++.h> using namespace std; long long ct(long long a, long long b, long long c) { long long ct1 = (a % c == 0) ? a / c : (a + c) / c, ct2 = b / c; return ct2 - ct1 + 1; } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long lcm = (c * d) / (long long)__gcd(c, d); long long ans = ct(a, b, c) + ct(a, b, d) - ct(a, b, lcm); cout << b - a + 1 - ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
806,168
806,169
u372798233
cpp
p02995
#include <iostream> #define rop(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 n, ll c, ll d) { int as = n; as -= n / c; as -= n / d; as -= n / lcm(c, d); return as; } int main() { ll a, b, c, d; ll ans; cin >> a >> b >> c >> d; ans = f(b, c, d) - f(a - 1, c, d); cout << ans << endl; return 0; }
#include <iostream> #define rop(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 n, ll c, ll d) { ll as = n; as -= n / c; as -= n / d; as += n / lcm(c, d); return as; } int main() { ll a, b, c, d; ll ans; cin >> a >> b >> c >> d; ans = f(b, c, d) - f(a - 1, c, d); cout << ans << endl; return 0; }
[ "variable_declaration.type.change", "expression.operator.change" ]
806,187
806,188
u722986066
cpp
p02995
#include <iostream> #define rop(i, n) for (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 n, ll c, ll d) { int as = n; as -= n / c; as -= n / d; as -= n / lcm(c, d); return as; } int main() { ll a, b, c, d; ll ans; cin >> a >> b >> c >> d; ans = f(b, c, d) - f(a - 1, c, d); cout << ans << endl; return 0; }
#include <iostream> #define rop(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 n, ll c, ll d) { ll as = n; as -= n / c; as -= n / d; as += n / lcm(c, d); return as; } int main() { ll a, b, c, d; ll ans; cin >> a >> b >> c >> d; ans = f(b, c, d) - f(a - 1, c, d); cout << ans << endl; return 0; }
[ "variable_declaration.type.change", "expression.operator.change" ]
806,189
806,188
u722986066
cpp
p02995
#include <iostream> using namespace std; long long gcd(long long c, long long d) { return d ? gcd(d, c % d) : c; } long long lcm(long long c, long long d) { return c / gcd(c, d) * d; } int main() { long long a, b; long long c, d, cd; cin >> a >> b >> c >> d; long long c1, c2, d1, d2, cd1, cd2; c2 = b / c; d2 = b / d; c1 = (a - 1) / c; d1 = (a - 1) / d; int ans; long long sd = lcm(c, d); cd2 = b / sd; cd1 = (a - 1) / sd; ans = b - a + 1 - (c2 - c1) - (d2 - d1) + (cd2 - cd1); cout << ans << endl; }
#include <iostream> using namespace std; long long gcd(long long c, long long d) { return d ? gcd(d, c % d) : c; } long long lcm(long long c, long long d) { return c / gcd(c, d) * d; } int main() { long long a, b; long long c, d, cd; cin >> a >> b >> c >> d; long long c1, c2, d1, d2, cd1, cd2; c2 = b / c; d2 = b / d; c1 = (a - 1) / c; d1 = (a - 1) / d; long long ans; long long sd = lcm(c, d); cd2 = b / sd; cd1 = (a - 1) / sd; ans = b - a + 1 - (c2 - c1) - (d2 - d1) + (cd2 - cd1); cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
806,221
806,222
u056123277
cpp
p02995
#include <bits/stdc++.h> using namespace std; using ll = long long; int GCD(ll x, ll y) { if (x % y == 0) return y; else return GCD(y, x % y); } int LCM(ll x, ll y) { return x * y / GCD(x, y); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll c_num = b / c - (a - 1) / c; ll d_num = b / d - (a - 1) / d; ll cd_num = b / LCM(c, d) - (a - 1) / LCM(c, d); cout << b - a + 1 - c_num - d_num + cd_num << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; ll GCD(ll x, ll y) { if (x % y == 0) return y; else return GCD(y, x % y); } ll LCM(ll x, ll y) { return x * y / GCD(x, y); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll c_num = b / c - (a - 1) / c; ll d_num = b / d - (a - 1) / d; ll cd_num = b / LCM(c, d) - (a - 1) / LCM(c, d); cout << b - a + 1 - c_num - d_num + cd_num << endl; }
[]
806,225
806,226
u560381579
cpp
p02995
#include <iostream> using namespace std; long long gcd(long long a, long long b) { if (a < b) swap(a, b); while (b) { swap(a, b); b %= a; } return a; } long long lo(long long a, long long b) { return a * b / gcd(a, b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long K = lo(C, D); long long p = B / C - (A - 1) / C; long long q = B / D - (A - 1) / C; long long r = B / K - (A - 1) / C; long long s = (B - A + 1) - (p + q - r); cout << s << endl; }
#include <iostream> using namespace std; long long gcd(long long a, long long b) { if (a < b) swap(a, b); while (b) { swap(a, b); b %= a; } return a; } long long lo(long long a, long long b) { return a * b / gcd(a, b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long K = lo(C, D); // cout << K << endl; long long p = B / C - (A - 1) / C; long long q = B / D - (A - 1) / D; long long r = B / K - (A - 1) / K; long long s = (B - A + 1) - (p + q - r); cout << s << endl; }
[ "identifier.change", "expression.operation.binary.change" ]
806,242
806,243
u058186113
cpp
p02995
#include <iostream> using namespace std; long long gcd(long long a, long long b) { long long temp; while (a % b != 0) { temp = b; b = a % b; a = temp; } return b; } int countDivisor(long long min_dividend, long long max_dividend, long long divisor) { int count = 0; long long min = ((min_dividend + (divisor - 1)) / divisor); long long max = max_dividend / divisor; if (min * divisor >= min_dividend && max_dividend >= max * divisor) { count += max - min + 1; } return count; } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; int count = 0; count += countDivisor(A, B, C); count += countDivisor(A, B, D); long long g = C * D / gcd(C, D); count -= countDivisor(A, B, g); cout << (B - A + 1) - count << endl; }
#include <iostream> using namespace std; long long gcd(long long a, long long b) { long long temp; while (a % b != 0) { temp = b; b = a % b; a = temp; } return b; } long countDivisor(long long min_dividend, long long max_dividend, long long divisor) { long count = 0; long long min = ((min_dividend + (divisor - 1)) / divisor); long long max = max_dividend / divisor; if (min * divisor >= min_dividend && max_dividend >= max * divisor) { count += max - min + 1; } return count; } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long count = 0; count += countDivisor(A, B, C); count += countDivisor(A, B, D); long long g = C * D / gcd(C, D); count -= countDivisor(A, B, g); cout << (B - A + 1) - count << endl; }
[ "variable_declaration.type.primitive.change" ]
806,244
806,245
u829844117
cpp
p02995
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <sstream> #include <stdio.h> #include <string> #include <tuple> #include <vector> #define FORi(N) for (int i = 0; i < N; ++i) #define FORj(N) for (int j = 0; j < N; ++j) #define FORk(N) for (int k = 0; k < N; ++k) using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; ll gcd(ll m, ll n) { if (n == 0) return abs(m); return (gcd(n, m % n)); } void putYN(bool b) { if (b) { cout << "Yes" << endl; } else { cout << "No" << endl; } } void swap(ll &a, ll &b) { ll tmp = a; a = b; b = tmp; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll CD = C * D; B += 1; ll lowA = (A / CD) * CD; ll lowB = (B / CD) * CD; ll B_A = B - A; ll sum = B_A; sum -= B / C + B / D - B / (CD / gcd(C, D)); sum += A / C + A / D - A / (CD / gcd(C, D)); // if(B_A%CD==0)sum+=1; // if(B%CD==0)sum++; // if(lowA!=A) // sum -= (A-lowA+1)/C+(A-lowA+1)/D; // if(upB!=B) // sum += (B-lowB+1)/C+(B-lowB+1)/D; // else sum-=1; // if(lowA==A)sum+=1; // if(upB==B)sum+=1; cout << sum << endl; return 0; }
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <sstream> #include <stdio.h> #include <string> #include <tuple> #include <vector> #define FORi(N) for (int i = 0; i < N; ++i) #define FORj(N) for (int j = 0; j < N; ++j) #define FORk(N) for (int k = 0; k < N; ++k) using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; ll gcd(ll m, ll n) { if (n == 0) return abs(m); return (gcd(n, m % n)); } void putYN(bool b) { if (b) { cout << "Yes" << endl; } else { cout << "No" << endl; } } void swap(ll &a, ll &b) { ll tmp = a; a = b; b = tmp; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll CD = C * D; /*if(A==B&&A%C!=0&&A%D!=0){ cout<<1<<endl; return 0; } if(A==B){ cout<<0<<endl; return 0; }*/ A -= 1; // B-=1; ll lowA = (A / CD) * CD; ll lowB = (B / CD) * CD; ll B_A = B - A; ll sum = B_A; sum -= B / C + B / D - B / (CD / gcd(C, D)); sum += A / C + A / D - A / (CD / gcd(C, D)); // if(B_A%CD==0)sum+=1; // if(B%CD==0)sum++; // if(lowA!=A) // sum -= (A-lowA+1)/C+(A-lowA+1)/D; // if(upB!=B) // sum += (B-lowB+1)/C+(B-lowB+1)/D; // else sum-=1; // if(lowA==A)sum+=1; // if(upB==B)sum+=1; cout << sum << endl; return 0; }
[ "assignment.change" ]
806,250
806,251
u373586461
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { ll r; while ((r = a % b)) { a = b; b = r; } return b; } int main() { ll A, B, C, D, ans; cin >> A >> B >> C >> D; ll numc = 0, numd = 0, numgcd = 0; numgcd = gcd(C, D); /*if(B%C == 0){ numc = B/C - A/C+1; }else{ numc = B/C - A/C; } if(B%D == 0){ numd = B/D - A/D+1; }else{ numd = B/D - A/D; }*/ int aaa = (C * D) / numgcd; numc = B / C - (A - 1) / C; numd = B / D - (A - 1) / D; int numnew = B / aaa - (A - 1) / aaa; ans = B - A + 1 - (numc + numd - numnew); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { ll r; while ((r = a % b)) { a = b; b = r; } return b; } int main() { ll A, B, C, D, ans; cin >> A >> B >> C >> D; ll numc = 0, numd = 0, numgcd = 0; numgcd = gcd(C, D); /*if(B%C == 0){ numc = B/C - A/C+1; }else{ numc = B/C - A/C; } if(B%D == 0){ numd = B/D - A/D+1; }else{ numd = B/D - A/D; }*/ ll aaa = (C * D) / numgcd; numc = B / C - (A - 1) / C; numd = B / D - (A - 1) / D; ll numnew = B / aaa - (A - 1) / aaa; ans = B - A + 1 - (numc + numd - numnew); cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
806,254
806,255
u845882023
cpp
p02995
#include <bits/stdc++.h> #include <sstream> using namespace std; int cntn(long n, long a, long b) { return b / n - (a - 1) / n; } int main() { long a, b, c, d; cin >> a >> b >> c >> d; long ans = 0; long prod = c * d; long u = b - a + 1; ans = u - cntn(c, a, b) - cntn(d, a, b); long r = d % c; while (r != 0) { d = c; c = r; r = d % c; } ans += cntn(prod / c, a, b); cout << ans << endl; }
#include <bits/stdc++.h> #include <sstream> using namespace std; long cntn(long n, long a, long b) { return b / n - (a - 1) / n; } int main() { long a, b, c, d; cin >> a >> b >> c >> d; long ans = 0; long prod = c * d; long u = b - a + 1; ans = u - cntn(c, a, b) - cntn(d, a, b); long r = d % c; while (r != 0) { d = c; c = r; r = d % c; } ans += cntn(prod / c, a, b); cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
806,261
806,262
u448354193
cpp
p02995
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { int r; if (x < y) swap(x, y); while (y > 0) { r = x % y; x = y; y = r; } return x; } int main() { long long a, b; int c, d; cin >> a >> b >> c >> d; long long g = gcd(c, d); long long cd = c * d / g; long long nc = b / c - (a - 1) / c; long long nd = b / d - (a - 1) / d; long long ncd = b / cd - (a - 1) / cd; cout << b - a + 1 - nc - nd + ncd << endl; }
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { int r; if (x < y) swap(x, y); while (y > 0) { r = x % y; x = y; y = r; } return x; } int main() { long long a, b; long long c, d; cin >> a >> b >> c >> d; long long g = gcd(c, d); unsigned long long cd = c * d / g; long long nc = b / c - (a - 1) / c; long long nd = b / d - (a - 1) / d; long long ncd = b / cd - (a - 1) / cd; cout << b - a + 1 - nc - nd + ncd << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
806,272
806,273
u594803920
cpp
p02995
//#include "pch.h" #include <algorithm> #include <iomanip> #include <iostream> #include <numeric> #include <stdlib.h> #include <string> using namespace std; int main() { long A, B, C, D; cin >> A >> B >> C >> D; long lcm; int r = C % D; long lcd = C * D; long ans; int C_1, C_2, D_1, D_2, call, dall, lcd1, lcd2, lcdall; C_1 = (A - 1) / C; C_2 = B / C; call = C_2 - C_1; // cout<<call<<endl; D_1 = (A - 1) / D; D_2 = B / D; dall = D_2 - D_1; // cout<<dall<<endl; while (r != 0) { C = D; D = r; r = C % D; } int gcd = D; lcd /= D; // cout<<"lcd "<<lcd<<endl; lcd1 = (A - 1) / lcd; lcd2 = B / lcd; lcdall = lcd2 - lcd1; // cout<<lcdall<<endl; ans = B - A + 1 - (call + dall - lcdall); cout << ans << endl; }
//#include "pch.h" #include <algorithm> #include <iomanip> #include <iostream> #include <numeric> #include <stdlib.h> #include <string> using namespace std; int main() { long A, B, C, D; cin >> A >> B >> C >> D; long lcm; int r = C % D; long lcd = C * D; long ans; long C_1, C_2, D_1, D_2, call, dall, lcd1, lcd2, lcdall; C_1 = (A - 1) / C; C_2 = B / C; call = C_2 - C_1; // cout<<call<<endl; D_1 = (A - 1) / D; D_2 = B / D; dall = D_2 - D_1; // cout<<dall<<endl; while (r != 0) { C = D; D = r; r = C % D; } int gcd = D; lcd /= D; // cout<<"lcd "<<lcd<<endl; lcd1 = (A - 1) / lcd; lcd2 = B / lcd; lcdall = lcd2 - lcd1; // cout<<lcdall<<endl; ans = B - A + 1 - (call + dall - lcdall); cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
806,274
806,275
u919992484
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b, c, d, e, f; cin >> a >> b >> c >> d; e = c; f = d; int64_t p, q, r, s, t, u, x, tmp, R, w; x = c * d; if (c < d) { tmp = c; c = d; d = tmp; } R = c % d; while (R != 0) { c = d; d = R; R = c % d; } w = x / d; c = e; d = f; p = (a + (c - 1)) / c; q = b / c; r = (a + (d - 1)) / d; s = b / d; t = (a + (w - 1)) / w; u = b / w; int64_t y = b - a - q + p - s + r + t - u; cout << y << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b, c, d, e, f; cin >> a >> b >> c >> d; e = c; f = d; int64_t p, q, r, s, t, u, x, tmp, R, w; x = c * d; if (c < d) { tmp = c; c = d; d = tmp; } R = c % d; while (R != 0) { c = d; d = R; R = c % d; } w = x / d; c = e; d = f; p = (a + (c - 1)) / c; q = b / c; r = (a + (d - 1)) / d; s = b / d; t = (a + (w - 1)) / w; u = b / w; int64_t y; y = b - a - q + p - s + r + u - t; cout << y << endl; }
[ "variable_declaration.add", "expression.operation.binary.remove", "assignment.change" ]
806,281
806,282
u567252408
cpp
p02995
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; long long euclid(long long m, long long n) { long long m1 = m, n1 = n, tmp = 0; while (n1 != 0) { tmp = n1; n1 = m1 % n1; m1 = tmp; } return m1; } long long lcm(long long m, long long n) { return (m / euclid(m, n)) * n; } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long mother = b - a + 1; long long common = lcm(c, d); long long dividable = (b / c - (a - 1) / c) + (b / d - (a - 1) / d) - (b / common + (a - 1) / common); cout << mother - dividable << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; long long euclid(long long m, long long n) { long long m1 = m, n1 = n, tmp = 0; while (n1 != 0) { tmp = n1; n1 = m1 % n1; m1 = tmp; } return m1; } long long lcm(long long m, long long n) { return (m / euclid(m, n)) * n; } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long mother = b - a + 1; long long common = lcm(c, d); long long dividable = (b / c - (a - 1) / c) + (b / d - (a - 1) / d) - (b / common - (a - 1) / common); cout << mother - dividable << endl; return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
806,289
806,290
u115306811
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long ans = 0; long long ta = c, tb = d, r, tmp; if (ta < tb) { tmp = ta; ta = b; tb = tmp; } r = ta % tb; while (r != 0) { ta = tb; tb = r; r = ta % tb; } tmp = (a - 1) - (a - 1) / c - (a - 1) / d + (a - 1) / (c * d / tb); ans = b - b / c - b / d + b / (c * d / tb); cout << ans - tmp << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long ans = 0; long long ta = c, tb = d, r, tmp; if (ta < tb) { tmp = ta; ta = tb; tb = tmp; } r = ta % tb; while (r != 0) { ta = tb; tb = r; r = ta % tb; } tmp = (a - 1) - (a - 1) / c - (a - 1) / d + (a - 1) / (c * d / tb); ans = b - b / c - b / d + b / (c * d / tb); cout << ans - tmp << endl; }
[ "assignment.value.change", "identifier.change" ]
806,300
806,301
u405230134
cpp
p02995
#include <algorithm> #include <iostream> using namespace std; using LLI = long long int; LLI gcd(LLI a, LLI b) { if (a == 0) return b; return gcd(a % b, a); } int main() { LLI a, b, c, d; cin >> a >> b >> c >> d; LLI cd = (c * d) / gcd(max(c, d), min(c, d)); LLI ab_c = b / c - a / c + (a % c == 0 ? 1 : 0); LLI ab_d = b / d - a / d + (a % d == 0 ? 1 : 0); LLI ab_cd = b / cd - a / cd + (a % cd == 0 ? 1 : 0); cout << b - a - (ab_c + ab_d - ab_cd) + 1 << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; using LLI = long long int; LLI gcd(LLI a, LLI b) { if (a == 0) return b; return gcd(b % a, a); } int main() { LLI a, b, c, d; cin >> a >> b >> c >> d; LLI cd = c * d / gcd(max(c, d), min(c, d)); LLI ab_c = b / c - a / c + (a % c == 0 ? 1 : 0); LLI ab_d = b / d - a / d + (a % d == 0 ? 1 : 0); LLI ab_cd = b / cd - a / cd + (a % cd == 0 ? 1 : 0); cout << b - a - (ab_c + ab_d - ab_cd) + 1 << endl; return 0; }
[ "expression.operation.binary.remove" ]
806,304
806,305
u559820201
cpp
p02995
#include <algorithm> #include <cstdio> #include <iostream> #include <string> using namespace std; int main(int argc, char const *argv[]) { unsigned long long int a, b, c, d, g; cin >> a >> b >> c >> d; g = __gcd(c, d); printf("%lld", (b - a + 1) - ((b / c + b / d - b / g) - ((a - 1) / c + (a - 1) / d - (a - 1) / g))); return 0; }
#include <algorithm> #include <cstdio> #include <iostream> #include <string> using namespace std; int main(int argc, char const *argv[]) { unsigned long long int a, b, c, d, g; cin >> a >> b >> c >> d; g = c * d / __gcd(c, d); printf("%lld", (b - a + 1) - ((b / c + b / d - b / g) - ((a - 1) / c + (a - 1) / d - (a - 1) / g))); return 0; }
[ "assignment.change" ]
806,312
806,313
u455317716
cpp
p02995
#include <cstdint> #include <iostream> using namespace std; int64_t baisuu(const int64_t &a, const int64_t &b) { return a / b; } int64_t gcd(int64_t a, int64_t b) { if (a < b) { a ^= b; b ^= a; a ^= b; } if (a % b == 0) return b; else return gcd(b, a % b); } int64_t gcm(int64_t a, int64_t b) { return a * b / gcd(a, b); } int main(void) { int64_t a, b, c, d; cin >> a >> b >> c >> d; int64_t ac, ad, bc, bd, acd, bcd; int64_t g = gcm(c, d); ac = baisuu(a - 1, c); ad = baisuu(a - 1, d); bc = baisuu(b, c); bd = baisuu(b, d); acd = baisuu(a, g); bcd = baisuu(b, g); int64_t bwareru = (bc + bd - bcd) - (ac + ad - acd); int64_t result = b - a + 1 - bwareru; cout << result << endl; return 0; }
#include <cstdint> #include <iostream> using namespace std; int64_t baisuu(const int64_t &a, const int64_t &b) { return a / b; } int64_t gcd(int64_t a, int64_t b) { if (a < b) { a ^= b; b ^= a; a ^= b; } if (a % b == 0) return b; else return gcd(b, a % b); } int64_t gcm(int64_t a, int64_t b) { return a * b / gcd(a, b); } int main(void) { int64_t a, b, c, d; cin >> a >> b >> c >> d; int64_t ac, ad, bc, bd, acd, bcd; int64_t g = gcm(c, d); ac = baisuu(a - 1, c); ad = baisuu(a - 1, d); bc = baisuu(b, c); bd = baisuu(b, d); acd = baisuu(a - 1, g); bcd = baisuu(b, g); int64_t bwareru = (bc + bd - bcd) - (ac + ad - acd); int64_t result = b - a + 1 - bwareru; cout << result << endl; return 0; }
[ "assignment.change" ]
806,317
806,318
u445575414
cpp
p02995
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <utility> #include <vector> using namespace std; #define mod 1000000007 long long int gcd(long long int m, long long int n) { if (n == 0) return m; return gcd(n, m % n); } long long int solve(long long int n, long long int c, long long int d) { // 1 ~ n - 1のうちcでもdでも割り切れないものの数 // 全部の数は n - 1 // 割り切れるものの数は n / c return n - 1 - (n / c) - (n / d) + (n / (c * d / gcd(max(c, d), min(c, d)))); } int main() { long long int a, b, c, d; cin >> a >> b >> c >> d; cout << solve(b + 1, c, d) - solve(a, c, d) << endl; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <utility> #include <vector> using namespace std; #define mod 1000000007 long long int gcd(long long int m, long long int n) { if (n == 0) return m; return gcd(n, m % n); } long long int solve(long long int n, long long int c, long long int d) { // 1 ~ nのうちcでもdでも割り切れないものの数 // 全部の数は n // 割り切れるものの数は n / c return n - (n / c) - (n / d) + (n / (c * d / gcd(max(c, d), min(c, d)))); } int main() { long long int a, b, c, d; cin >> a >> b >> c >> d; cout << solve(b, c, d) - solve(a - 1, c, d) << endl; }
[ "expression.operation.binary.remove" ]
806,327
806,328
u261965335
cpp
p02995
#include <bits/stdc++.h> typedef long long LL; #define FOR(i, a, b) for (LL i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) using namespace std; LL p = 1000000007ll; LL gcd(LL x, LL y) { return (!x || !y) ? x + y : gcd(y, x % y); } LL lcm(LL x, LL y) { return x / gcd(x, y) * y; } LL solve(LL n, LL c, LL d) { return n - (n / c) - (n / d) + n / lcm(c, d); } int main(void) { LL a, b, c, d; cin >> a >> b >> c >> d; ++b; cout << solve(b, c, d) - solve(a, c, d) << endl; return 0; }
#include <bits/stdc++.h> typedef long long LL; #define FOR(i, a, b) for (LL i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) using namespace std; LL p = 1000000007ll; LL gcd(LL x, LL y) { return (!x || !y) ? x + y : gcd(y, x % y); } LL lcm(LL x, LL y) { return x / gcd(x, y) * y; } LL solve(LL n, LL c, LL d) { return n - (n / c) - (n / d) + n / lcm(c, d); } int main(void) { LL a, b, c, d; cin >> a >> b >> c >> d; --a; cout << solve(b, c, d) - solve(a, c, d) << endl; return 0; }
[]
806,357
806,358
u633757735
cpp
p02995
#include <iostream> using namespace std; long Gcd(long m, long n) { long temp = 0; while (m % n != 0) { temp = n; n = m % n; m = temp; } return n; } long Lcm(long m, long n) { return m * n / Gcd(m, n); } int main() { long A, B, C, D; cin >> A >> B >> C >> D; long div_c = B / C; long div_c_out = (A - 1) / C; div_c -= div_c_out; long div_d = B / D; long div_d_out = (A - 1) / D; div_d -= div_d_out; long lcm = Lcm(C, D); long div_cd = B / lcm; long div_cd_out = A / lcm; div_cd -= div_cd_out; long res = B - A + 1 - (div_c - div_cd + div_d); cout << res << endl; return 0; }
#include <iostream> using namespace std; long Gcd(long m, long n) { long temp = 0; while (m % n != 0) { temp = n; n = m % n; m = temp; } return n; } long Lcm(long m, long n) { return m * n / Gcd(m, n); } int main() { long A, B, C, D; cin >> A >> B >> C >> D; long div_c = B / C; long div_c_out = (A - 1) / C; div_c -= div_c_out; long div_d = B / D; long div_d_out = (A - 1) / D; div_d -= div_d_out; long lcm = Lcm(C, D); long div_cd = B / lcm; long div_cd_out = (A - 1) / lcm; div_cd -= div_cd_out; long res = B - A + 1 - (div_c - div_cd + div_d); cout << res << endl; return 0; }
[]
806,365
806,366
u762603420
cpp
p02995
#include <bits/stdc++.h> #include <numeric> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) #define p(x) cout << (x) << endl; #define pv(v) \ for (auto a : v) { \ cout << a << endl; \ } long gcd(long a, long b) { long buff = a; if (a < b) { a = b; b = buff; } return b ? gcd(b, a % b) : a; } int main() { long a, b, c, d; cin >> a >> b >> c >> d; long lcm = a * b / gcd(a, b); long x = b / c; long y = b / d; long xy = b / lcm; long i = (a - 1) / c; long j = (a - 1) / d; long ij = (a - 1) / lcm; long sumb = x + y - xy; long suma = i + j - ij; p((b - sumb) - (a - 1) + suma); }
#include <bits/stdc++.h> #include <numeric> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) #define p(x) cout << (x) << endl; #define pv(v) \ for (auto a : v) { \ cout << a << endl; \ } long gcd(long a, long b) { long buff = a; if (a < b) { a = b; b = buff; } return b ? gcd(b, a % b) : a; } int main() { long a, b, c, d; cin >> a >> b >> c >> d; long lcm = c * d / gcd(c, d); long x = b / c; long y = b / d; long xy = b / lcm; long i = (a - 1) / c; long j = (a - 1) / d; long ij = (a - 1) / lcm; long sumb = x + y - xy; long suma = i + j - ij; p((b - sumb) - (a - 1) + suma); }
[ "identifier.change", "expression.operation.binary.change", "call.arguments.change" ]
806,367
806,368
u900303768
cpp
p02995
#include "math.h" #include <algorithm> #include <functional> #include <iostream> #include <numeric> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (long long i = (a); i < (b); i++) #define RFOR(i, a, b) for (long long i = (b)-1; i >= (a); i--) #define REP(i, n) for (long long i = 0; i < (n); i++) #define RREP(i, n) for (long long i = (n)-1; i >= 0; i--) #define inf long long_MAX / 3 #define INF long long_MAX / 3 #define PB push_back #define pb push_back #define MP make_pair #define mp make_pair #define ALL(a) (a).begin(), (a).end() #define all(a) (a).begin(), (a).end() #define SET(a, c) memset(a, c, sizeof a) #define CLR(a) memset(a, 0, sizeof a) #define PII pair<long long, long long> #define pii pair<long long, long long> #define pcc pair<char, char> #define pic pair<long long, char> #define pci pair<char, long long> #define VS vector<string> #define VI vector<long long> #define debug(x) cout << #x << ": " << x << endl #define DEBUG(x) cout << #x << ": " << x << endl #define MIN(a, b) (a > b ? b : a) #define MAX(a, b) (a > b ? a : b) #define pi 2 * acos(0.0) #define INFILE() freopen("in0.txt", "r", stdin) #define OUTFILE() freopen("out0.txt", "w", stdout) #define in scanf #define out prlong longf #define LL long long #define ll long long #define ULL unsigned long long #define ull unsigned long long #define eps 1e-14 #define FST first #define SEC second long long a, b; long long c, d; long long ggd(long long number1, long long number2) { long long m = number1; long long n = number2; if (number2 > number1) { m = number2; n = number1; } while (m % n != 0) { long long temp = n; n = m % n; m = temp; } return n; } long long lcm(long long number1, long long number2) { return number1 * number2 / ggd(number1, number2); } int main() { cin >> a >> b >> c >> d; // cout << ggd(c,d); long long sum = b - a + 1; long long ccount = b / c - (a - 1) / c; long long dcount = b / d - (a - 1) / d; // cout << dcount; long long cd = lcm(c, d); long long cdcount = b / cd - a / cd; cout << sum - ccount - dcount + cdcount; }
#include "math.h" #include <algorithm> #include <functional> #include <iostream> #include <numeric> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (long long i = (a); i < (b); i++) #define RFOR(i, a, b) for (long long i = (b)-1; i >= (a); i--) #define REP(i, n) for (long long i = 0; i < (n); i++) #define RREP(i, n) for (long long i = (n)-1; i >= 0; i--) #define inf long long_MAX / 3 #define INF long long_MAX / 3 #define PB push_back #define pb push_back #define MP make_pair #define mp make_pair #define ALL(a) (a).begin(), (a).end() #define all(a) (a).begin(), (a).end() #define SET(a, c) memset(a, c, sizeof a) #define CLR(a) memset(a, 0, sizeof a) #define PII pair<long long, long long> #define pii pair<long long, long long> #define pcc pair<char, char> #define pic pair<long long, char> #define pci pair<char, long long> #define VS vector<string> #define VI vector<long long> #define debug(x) cout << #x << ": " << x << endl #define DEBUG(x) cout << #x << ": " << x << endl #define MIN(a, b) (a > b ? b : a) #define MAX(a, b) (a > b ? a : b) #define pi 2 * acos(0.0) #define INFILE() freopen("in0.txt", "r", stdin) #define OUTFILE() freopen("out0.txt", "w", stdout) #define in scanf #define out prlong longf #define LL long long #define ll long long #define ULL unsigned long long #define ull unsigned long long #define eps 1e-14 #define FST first #define SEC second long long a, b; long long c, d; long long ggd(long long number1, long long number2) { long long m = number1; long long n = number2; if (number2 > number1) { m = number2; n = number1; } while (m % n != 0) { long long temp = n; n = m % n; m = temp; } return n; } long long lcm(long long number1, long long number2) { return number1 * number2 / ggd(number1, number2); } int main() { cin >> a >> b >> c >> d; // cout << ggd(c,d); long long sum = b - a + 1; long long ccount = b / c - (a - 1) / c; long long dcount = b / d - (a - 1) / d; // cout << dcount; long long cd = lcm(c, d); long long cdcount = b / cd - (a - 1) / cd; // debug(sum); // debug(ccount); // debug(dcount); // debug(cdcount); // debug(lcm(2,2)); cout << sum - ccount - dcount + cdcount; }
[]
806,371
806,372
u032627078
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define all(v) (v).begin(), (v).end() #define fi first #define se second #define sz(x) ((int)(x).size()) using ll = long long; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define MOD 1000000007 const ll INF = 1e18; 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; } //最大公約数 ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } // 最小公倍数 ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll a, b, c, d, cnt = 0, cd; int main(int argc, char const *argv[]) { cin >> a >> b >> c >> d; cd = lcm(c, d); cout << (b - a + 1) - (b / c - (a - 1) / c) - (b / d - (a - 1) / d) + (b / (lcm(c, d)) - a / (lcm(c, d))) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define all(v) (v).begin(), (v).end() #define fi first #define se second #define sz(x) ((int)(x).size()) using ll = long long; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define MOD 1000000007 const ll INF = 1e18; 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; } //最大公約数 ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } // 最小公倍数 ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll a, b, c, d, cnt = 0, cd; int main(int argc, char const *argv[]) { cin >> a >> b >> c >> d; cd = lcm(c, d); cout << (b - a + 1) - (b / c - (a - 1) / c) - (b / d - (a - 1) / d) + (b / (lcm(c, d)) - (a - 1) / (lcm(c, d))) << endl; return 0; }
[]
806,377
806,378
u863279562
cpp
p02995
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mod = 1e9 + 7; int main() { int A, B, C, D, E; cin >> A >> B >> C >> D; //最小公倍数 int a, b, r, x, tmp; a = C; b = D; x = a * b; if (a < b) { tmp = a; a = b; b = tmp; } r = a % b; while (r != 0) { a = b; b = r; r = a % b; } E = x / b; int numAC, numAD, numAE, cntA; numAC = (A - 1) / C; numAD = (A - 1) / D; numAE = (A - 1) / E; cntA = (A - 1) - numAC - numAD + numAE; int numBC, numBD, numBE, cntB; numBC = B / C; numBD = B / D; numBE = B / E; cntB = B - numBC - numBD + numBE; cout << cntB - cntA; }
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mod = 1e9 + 7; int main() { long A, B, C, D, E; cin >> A >> B >> C >> D; //最小公倍数 long a, b, r, x, tmp; a = C; b = D; x = a * b; if (a < b) { tmp = a; a = b; b = tmp; } r = a % b; while (r != 0) { a = b; b = r; r = a % b; } E = x / b; long numAC, numAD, numAE, cntA; numAC = (A - 1) / C; numAD = (A - 1) / D; numAE = (A - 1) / E; cntA = (A - 1) - numAC - numAD + numAE; long numBC, numBD, numBE, cntB; numBC = B / C; numBD = B / D; numBE = B / E; cntB = B - numBC - numBD + numBE; cout << cntB - cntA; }
[ "variable_declaration.type.primitive.change" ]
806,379
806,380
u591779169
cpp
p02995
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = int64_t; /// <summary> /// GCDを計算します /// </summary> template <typename NumType> NumType calcGCD(NumType a, NumType b) { if (a < b) { NumType tmp = a; a = b; b = tmp; } NumType r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } /// <summary> /// 約数を数えます /// </summary> template <typename NumType> NumType cntDivisor(const NumType &num) { NumType cnt = 0; for (NumType i = 1; i * i <= num; ++i) { if (num % i == 0) { cnt++; if (i * i != num) cnt++; } } return cnt; } template <typename TypeInt> TypeInt L_C_M(TypeInt a, TypeInt b) { if (a == 0 && b == 0) { return 0; } return a * b / calcGCD<ll>(a, b); } /// <summary> /// [beg, end)の範囲を,添え字indexでループするfor文に置換します /// </summary> #define rep(i, a) for (ll i = 0; i < a; ++i) const vector<ll> dx = {0, 1, 0, -1}, dy = {1, 0, -1, 0}; #define DEBUG(x) std::cout << #x << " : " << x << "\n" /////////////////////////////////////////////////////////////////////////// int main() { cin.tie(0); ios::sync_with_stdio(false); ll A, B, C, D; cin >> A >> B >> C >> D; ll ans = 0; ll lm = L_C_M<ll>(C, D); bool a = false; if (lm != C * D) { a = true; } --A, --B; ll a_1 = A / C, a_2 = A / D, a_3 = A / lm; ll b_1 = B / C, b_2 = B / D, b_3 = B / lm; /* ll ans_1 = A - (a_1 + a_2 - a_3); ll ans_2 = B - (b_1 + b_2 - b_3); ans = ans_2 - ans_1; */ ll ans_tmp = (b_1 + b_2 - b_3) - (a_1 + a_2 - a_3); ans = B - A - ans_tmp; cout << ans << endl; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = int64_t; /// <summary> /// GCDを計算します /// </summary> template <typename NumType> NumType calcGCD(NumType a, NumType b) { if (a < b) { NumType tmp = a; a = b; b = tmp; } NumType r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } /// <summary> /// 約数を数えます /// </summary> template <typename NumType> NumType cntDivisor(const NumType &num) { NumType cnt = 0; for (NumType i = 1; i * i <= num; ++i) { if (num % i == 0) { cnt++; if (i * i != num) cnt++; } } return cnt; } template <typename TypeInt> TypeInt L_C_M(TypeInt a, TypeInt b) { if (a == 0 && b == 0) { return 0; } return a * b / calcGCD<ll>(a, b); } /// <summary> /// [beg, end)の範囲を,添え字indexでループするfor文に置換します /// </summary> #define rep(i, a) for (ll i = 0; i < a; ++i) const vector<ll> dx = {0, 1, 0, -1}, dy = {1, 0, -1, 0}; #define DEBUG(x) std::cout << #x << " : " << x << "\n" /////////////////////////////////////////////////////////////////////////// int main() { cin.tie(0); ios::sync_with_stdio(false); ll A, B, C, D; cin >> A >> B >> C >> D; ll ans = 0; ll lm = L_C_M<ll>(C, D); bool a = false; if (lm != C * D) { a = true; } --A; ll a_1 = A / C, a_2 = A / D, a_3 = A / lm; ll b_1 = B / C, b_2 = B / D, b_3 = B / lm; /* ll ans_1 = A - (a_1 + a_2 - a_3); ll ans_2 = B - (b_1 + b_2 - b_3); ans = ans_2 - ans_1; */ ll ans_tmp = (b_1 + b_2 - b_3) - (a_1 + a_2 - a_3); ans = B - A - ans_tmp; cout << ans << endl; }
[]
806,403
806,404
u976560086
cpp
p02995
#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); i > (b); i--) #define sq(x) ((x) * (x)) #define bit(x) bitset<32>(x) #define vsort(v) sort(v.begin(), v.end()) #define rvsort(v) sort(v.begin(), v.end(), greater<llint>()) #define debug(x) cout << #x << " " << (x) << endl #define ci cin #define co cout #define en endl #define ln cout << '\n' #define pb push_back #define fi first #define se second #define MOD 1000000007 typedef long long int llint; typedef pair<int, int> pii; typedef pair<llint, llint> pll; typedef vector<int> vi; typedef vector<llint> vl; typedef vector<pii> vii; typedef vector<pll> vll; template <typename Tn> Tn __lcm(Tn a, Tn b) { return a / __gcd(a, b) * b; } int main() { map<llint, int> m; llint a, b, c, d; ci >> a >> b >> c >> d; llint tmp = __lcm(c, d); co << b - a + 1 - ((b / c) + (b / d)) + ((a - 1) / c) + ((a - 1) / d) + (b / tmp) + ((a - 1) / tmp) << en; return 0; }
#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); i > (b); i--) #define sq(x) ((x) * (x)) #define bit(x) bitset<32>(x) #define vsort(v) sort(v.begin(), v.end()) #define rvsort(v) sort(v.begin(), v.end(), greater<llint>()) #define debug(x) cout << #x << " " << (x) << endl #define ci cin #define co cout #define en endl #define ln cout << '\n' #define pb push_back #define fi first #define se second #define MOD 1000000007 typedef long long int llint; typedef pair<int, int> pii; typedef pair<llint, llint> pll; typedef vector<int> vi; typedef vector<llint> vl; typedef vector<pii> vii; typedef vector<pll> vll; template <typename Tn> Tn __lcm(Tn a, Tn b) { return a / __gcd(a, b) * b; } int main() { map<llint, int> m; llint a, b, c, d; ci >> a >> b >> c >> d; llint tmp = __lcm(c, d); co << b - a + 1 - ((b / c) + (b / d)) + ((a - 1) / c) + ((a - 1) / d) + (b / tmp) - ((a - 1) / tmp) << en; return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
806,430
806,431
u966921248
cpp
p02995
/* Author - KISHAN TIWARI Dream bigger. Do bigger. Wake up with determination. Go to bed with satisfaction. */ // Sometimes later becomes never. Do it now. #include <bits/stdc++.h> using namespace std; #define ll long long #define f(i, a, b) for (ll i = a; i < b; i++) #define mod 1000000007 #define fi first #define se second #define pa pair<ll, ll> #define mp make_pair #define pb push_back #define ve vector<ll> #define vep vector<pa> #define all(a) a.begin(), a.end() #define sz(x) (ll) x.size() #define c(t) cout << t << "\n" using namespace std; class gfg { public: int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } // Function to return LCM of two numbers int lcm(int a, int b) { return (a * b) / gcd(a, b); } }; void solve() { ll a, b, c, d; cin >> a >> b >> c >> d; ll x = a / c, y = b / c; ll z = y - x; if (a % c == 0) z++; ll x1 = a / d, y1 = b / d; ll z1 = y1 - x1; if (a % d == 0) z1++; gfg g; ll f = g.lcm(c, d); ll x2 = a / f, y2 = b / f; ll z2 = y2 - x2; if (a % f == 0) z2++; ll z3 = z + z1 - z2; ll ans = b - a + 1 - z3; c(ans); } int main() { ios::sync_with_stdio(true); // freopen ("input.txt","r",stdin); // freopen ("output.txt","w",stdout); cin.tie(0); cout.tie(0); ll t = 1; // cin>>t; while (t--) { solve(); } return 0; }
/* Author - KISHAN TIWARI Dream bigger. Do bigger. Wake up with determination. Go to bed with satisfaction. */ // Sometimes later becomes never. Do it now. #include <bits/stdc++.h> using namespace std; #define ll long long #define f(i, a, b) for (ll i = a; i < b; i++) #define mod 1000000007 #define fi first #define se second #define pa pair<ll, ll> #define mp make_pair #define pb push_back #define ve vector<ll> #define vep vector<pa> #define all(a) a.begin(), a.end() #define sz(x) (ll) x.size() #define c(t) cout << t << "\n" using namespace std; class gfg { public: ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } // Function to return LCM of two numbers ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); } }; void solve() { ll a, b, c, d; cin >> a >> b >> c >> d; ll x = a / c, y = b / c; ll z = y - x; if (a % c == 0) z++; ll x1 = a / d, y1 = b / d; ll z1 = y1 - x1; if (a % d == 0) z1++; gfg g; ll f = g.lcm(c, d); ll x2 = a / f, y2 = b / f; ll z2 = y2 - x2; if (a % f == 0) z2++; ll z3 = z + z1 - z2; ll ans = b - a + 1 - z3; c(ans); } int main() { ios::sync_with_stdio(true); // freopen ("input.txt","r",stdin); // freopen ("output.txt","w",stdout); cin.tie(0); cout.tie(0); ll t = 1; // cin>>t; while (t--) { solve(); } return 0; }
[]
806,450
806,451
u218900592
cpp
p02995
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a > b) { swap(a, b); } if (a == 0) { return b; } else { gcd(a, b % a); } } int atob(int a, int b, int d) { return b / d - (a - 1) / d; } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long ans = b - a + 1; long divisor = 0; divisor += atob(a, b, c) + atob(a, b, d) - atob(a, b, (c * d) / gcd(c, d)); cout << ans - divisor; }
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a > b) { swap(a, b); } if (a == 0) { return b; } else { gcd(a, b % a); } } long atob(long a, long b, long d) { return b / d - (a - 1) / d; } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long ans = b - a + 1; long divisor = 0; divisor += atob(a, b, c) + atob(a, b, d) - atob(a, b, (c * d) / gcd(c, d)); cout << ans - divisor; }
[ "variable_declaration.type.primitive.change" ]
806,452
806,453
u885523920
cpp
p02995
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; long long gcd(long long x, long long y) { long long k = x, l = y; while (x != 0) { if (x < y) swap(x, y); x %= y; } return k * l / y; } int main() { long long A, B, C, D, E; cin >> A >> B >> C >> D; long long A1, A2, B1, B2, C1, C2; E = gcd(C, D); A1 = (A - 1) / C; A2 = B / C; B1 = (A - 1) / D; B2 = B / D; C1 = (A - 1) / E; C2 = B / E; cout << B - A - ((A2 - A1) + B2 - B1 - C2 - C1) + 1 << endl; }
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; long long gcd(long long x, long long y) { long long k = x, l = y; while (x != 0) { if (x < y) swap(x, y); x %= y; } return k * l / y; } int main() { long long A, B, C, D, E; cin >> A >> B >> C >> D; long long A1, A2, B1, B2, C1, C2; E = gcd(C, D); A1 = (A - 1) / C; A2 = B / C; B1 = (A - 1) / D; B2 = B / D; C1 = (A - 1) / E; C2 = B / E; cout << B - A - ((A2 - A1) + B2 - B1 - (C2 - C1)) + 1 << endl; }
[]
806,456
806,457
u252348942
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define int long long int A, B, C, D; int gcd(int a, int b) { int c; while (b != 0) { c = a % b; a = b; b = c; } return a; } int lcm(int a, int b) { return a * b / gcd(a, b); } signed main() { cin >> A >> B >> C >> D; int cntUntilB = B - ((B / C) + (B / D) - (B / lcm(C, D))); int cntUntilA = (A - 1) - (((A - 1) / C) + ((A - 1) / D) - (A / lcm(C, D))); cout << cntUntilB - cntUntilA; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long int A, B, C, D; int gcd(int a, int b) { int c; while (b != 0) { c = a % b; a = b; b = c; } return a; } int lcm(int a, int b) { return a * b / gcd(a, b); } signed main() { cin >> A >> B >> C >> D; int cntUntilB = B - ((B / C) + (B / D) - (B / lcm(C, D))); int cntUntilA = (A - 1) - (((A - 1) / C) + ((A - 1) / D) - ((A - 1) / lcm(C, D))); cout << cntUntilB - cntUntilA; return 0; }
[]
806,482
806,483
u093453891
cpp
p02995
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; #define rep(i, x) for (int i = 0; i < x; i++) #define SORT(x) sort(x.begin(), x.end()) #define pb(x) push_back(x) #define int long long int calc(int a, int b) { int r, x, tmp; x = a * b; /* 自然数 a > b を確認・入替 */ if (a < b) { tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while (r != 0) { a = b; b = r; r = a % b; } /* 最小公倍数を出力 */ // printf("最小公倍数 = %d\n", x/b); return x / b; } signed main(void) { int A, B, C, D; cin >> A >> B >> C >> D; int ans; int CD = calc(C, D); ans = (B / C + B / D - B / CD) - ((A - 1) / C + (A - 1) / D + (A - 1) / CD); cout << B - A + 1 - ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; #define rep(i, x) for (int i = 0; i < x; i++) #define SORT(x) sort(x.begin(), x.end()) #define pb(x) push_back(x) #define int long long int calc(int a, int b) { int r, x, tmp; x = a * b; /* 自然数 a > b を確認・入替 */ if (a < b) { tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while (r != 0) { a = b; b = r; r = a % b; } /* 最小公倍数を出力 */ // printf("最小公倍数 = %d\n", x/b); return x / b; } signed main(void) { int A, B, C, D; cin >> A >> B >> C >> D; int ans; int CD = calc(C, D); // cout << CD << endl; ans = (B / C + B / D - B / CD) - ((A - 1) / C + (A - 1) / D - (A - 1) / CD); cout << B - A + 1 - ans << endl; return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
806,486
806,487
u785975381
cpp
p02995
#include <cstdio> #include <iostream> using namespace std; typedef long long ll; ll a, b, c, d, ans; ll f(ll p, ll q) { if (q == 0) return p; return f(q, p % q); } int main() { ll t; cin >> a >> b >> c >> d; a--; ans = b / c - a / c + b / d - a / d; t = f(c, d); t = c / t * d; ans -= b / t - c / t; cout << b - a - ans << endl; return 0; }
#include <cstdio> #include <iostream> using namespace std; typedef long long ll; ll a, b, c, d, ans; ll f(ll p, ll q) { if (q == 0) return p; return f(q, p % q); } int main() { ll t; cin >> a >> b >> c >> d; a--; ans = b / c - a / c + b / d - a / d; t = f(c, d); t = c / t * d; ans -= b / t - a / t; cout << b - a - ans << endl; return 0; }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
806,510
806,511
u230265105
cpp
p02995
#define _USE_MATH_DEFINES #include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <tuple> #include <vector> using ll = long long; // LLONG_MAX #define int long long #define CONTAINS(v, n) (find((v).begin(), (v).end(), (n)) != (v).end()) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) #define ARY_SORT(a, size) sort((a), (a) + (size)) #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define REMOVE(v, a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end())) #define REVERSE(v) (reverse((v).begin(), (v).end())) #define LOWER_BOUND(v, a) (lower_bound((v).begin(), (v).end(), (a))) #define UPPER_BOUND(v, a) (upper_bound((v).begin(), (v).end(), (a))) #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define CONTAINS_MAP(m, a) (m).find((a)) != m.end() using namespace std; int A, B, C, D; //----------最大公約数---------- int gcd(int x, int y) { int r; while ((r = x % y) != 0) { x = y; y = r; } return y; } //----------最小公倍数---------- int lcm(int x, int y) { return (x / gcd(x, y) * y); } signed main() { cin >> A >> B >> C >> D; if (C > D) { int temp = C; C = D; D = C; } // A<B C<D if (D % C == 0) { int a = (B / C); int b = ((A - 1) / C); int n = a - b; cout << (B - A + 1) - n << endl; } else { int l = lcm(D, C); int a1 = B / C; int b1 = B / D; int c1 = B / l; int n1 = a1 + b1 - c1; int a2 = (A - 1) / C; int b2 = (A - 1) / D; int c2 = (A - 1) / l; int n2 = (a2 + b2 - c2); int n = n1 - n2; cout << (B - A + 1) - n << endl; } }
#define _USE_MATH_DEFINES #include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <tuple> #include <vector> using ll = long long; // LLONG_MAX #define int long long #define CONTAINS(v, n) (find((v).begin(), (v).end(), (n)) != (v).end()) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) #define ARY_SORT(a, size) sort((a), (a) + (size)) #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define REMOVE(v, a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end())) #define REVERSE(v) (reverse((v).begin(), (v).end())) #define LOWER_BOUND(v, a) (lower_bound((v).begin(), (v).end(), (a))) #define UPPER_BOUND(v, a) (upper_bound((v).begin(), (v).end(), (a))) #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define CONTAINS_MAP(m, a) (m).find((a)) != m.end() using namespace std; int A, B, C, D; //----------最大公約数---------- int gcd(int x, int y) { int r; while ((r = x % y) != 0) { x = y; y = r; } return y; } //----------最小公倍数---------- int lcm(int x, int y) { return (x / gcd(x, y) * y); } signed main() { cin >> A >> B >> C >> D; if (C > D) { int temp = C; C = D; D = temp; } // A<B C<D if (D % C == 0) { int a = (B / C); int b = ((A - 1) / C); int n = a - b; cout << (B - A + 1) - n << endl; } else { int l = lcm(D, C); int a1 = B / C; int b1 = B / D; int c1 = B / l; int n1 = a1 + b1 - c1; int a2 = (A - 1) / C; int b2 = (A - 1) / D; int c2 = (A - 1) / l; int n2 = (a2 + b2 - c2); int n = n1 - n2; cout << (B - A + 1) - n << endl; } }
[ "assignment.value.change", "identifier.change" ]
806,512
806,513
u624800360
cpp
p02995
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <string> using namespace std; long long sk(long long n, long long m) { int N = max(n, m); int M = min(n, m); if (M == 0) return N; return sk(M, N % M); } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; int tmp = 0; tmp += b / c; tmp -= (a - 1) / c; tmp += b / d; tmp -= (a - 1) / d; long long g = sk(c, d); long long l = c * d / g; tmp -= b / l; tmp += (a - 1) / l; cout << b - a + 1 - tmp << endl; /* int N, L; cin >> N >> L; int min = 99999, tmp; int sum = 0; for (int i = 1; i <= N; i++) { if (min > L + i - 1) { min = abs(L + i - 1); tmp = L + i - 1; } sum += L + i - 1; } cout << sum - tmp << endl; */ /* string s; cin >> s; for (int i = 0; i < 3; i++) { if (s[i] == s[i + 1]) { cout << "Bad" << endl; return 0; } } cout << "Good" << endl; */ return 0; }
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <string> using namespace std; long long sk(long long n, long long m) { long long N = max(n, m); long long M = min(n, m); if (M == 0) return N; return sk(M, N % M); } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long tmp = 0; tmp += b / c; tmp -= (a - 1) / c; tmp += b / d; tmp -= (a - 1) / d; long long g = sk(c, d); long long l = c * d / g; tmp -= b / l; tmp += (a - 1) / l; cout << b - a + 1 - tmp << endl; /* int N, L; cin >> N >> L; int min = 99999, tmp; int sum = 0; for (int i = 1; i <= N; i++) { if (min > L + i - 1) { min = abs(L + i - 1); tmp = L + i - 1; } sum += L + i - 1; } cout << sum - tmp << endl; */ /* string s; cin >> s; for (int i = 0; i < 3; i++) { if (s[i] == s[i + 1]) { cout << "Bad" << endl; return 0; } } cout << "Good" << endl; */ return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
806,533
806,534
u220922076
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a, _n = n; i <= _n; ++i) #define drep(i, a, n) for (int i = a, _n = n; i >= n; --i) #define debug(x) cout << #x << " = " << x << endl long long a, b, c, d; long long D(long long x) { return x - x / c - x / d + x / (c / __gcd(c, d) * d); } int main() { scanf("%lld%lld%lld%lld", &a, &b, &c, &d); cout << D(b) - D(a) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a, _n = n; i <= _n; ++i) #define drep(i, a, n) for (int i = a, _n = n; i >= n; --i) #define debug(x) cout << #x << " = " << x << endl long long a, b, c, d; long long D(long long x) { return x - x / c - x / d + x / (c / __gcd(c, d) * d); } int main() { scanf("%lld%lld%lld%lld", &a, &b, &c, &d); cout << D(b) - D(a - 1) << endl; return 0; }
[ "expression.operation.binary.add" ]
806,535
806,536
u608862204
cpp
p02995
//↓template↓ #include "bits/stdc++.h" using namespace std; #define Would #define you #define all(n) n.begin(), n.end() #define rall(n) n.rbegin(), n.rend() typedef long long ll; const ll INF = 1e18; const ll MOD = 1e9 + 7; const double pi = acos(-1); const ll SIZE = 1 << 17; int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}, alp[30]; ll fac[200005], finv[200005], inv[200005]; vector<ll> dij; struct edge { ll to, cost; }; vector<vector<edge>> G; ll mod_pow(ll a, ll b) { ll res = 1, mul = a; for (int i = 0; i < 31; ++i) { if (b >> i & 1) { res *= mul; res %= MOD; } mul = (mul * mul) % MOD; } return res; } void addedge(int from, int to, int cost) { G[from].push_back({to, cost}); G[to].push_back({from, cost}); } template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; } template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); } template <typename T> void outp(vector<T> v) { for (int i = 0; i < v.size(); ++i) { cout << v[i]; if (i != v.size() - 1) { cout << " "; } } } //↑template↑ ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll mon = lcm(c, d); ll cc = (b + c - 1) / c - (a + c - 1) / c, dd = (b + d - 1) / d - (a + d - 1) / d, cd = (b + mon - 1) / mon - (a + mon - 1) / mon; if (a % c == 0) { ++cc; } if (a % d == 0) { ++dd; } if (a % mon == 0) { ++cd; } if (b % c == 0) { ++cc; } if (b % d == 0) { ++dd; } if (b % mon == 0) { ++cd; } // cout<<cc<<" "<<dd<<" "<<cd<<endl; cout << (b - a + 1) - (cc + dd - cd) << endl; }
//↓template↓ #include "bits/stdc++.h" using namespace std; #define Would #define you #define all(n) n.begin(), n.end() #define rall(n) n.rbegin(), n.rend() typedef long long ll; const ll INF = 1e18; const ll MOD = 1e9 + 7; const double pi = acos(-1); const ll SIZE = 1 << 17; int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}, alp[30]; ll fac[200005], finv[200005], inv[200005]; vector<ll> dij; struct edge { ll to, cost; }; vector<vector<edge>> G; ll mod_pow(ll a, ll b) { ll res = 1, mul = a; for (int i = 0; i < 31; ++i) { if (b >> i & 1) { res *= mul; res %= MOD; } mul = (mul * mul) % MOD; } return res; } void addedge(int from, int to, int cost) { G[from].push_back({to, cost}); G[to].push_back({from, cost}); } template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; } template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); } template <typename T> void outp(vector<T> v) { for (int i = 0; i < v.size(); ++i) { cout << v[i]; if (i != v.size() - 1) { cout << " "; } } } //↑template↑ ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll mon = lcm(c, d); ll cc = (b + c - 1) / c - (a + c) / c, dd = (b + d - 1) / d - (a + d) / d, cd = (b + mon - 1) / mon - (a + mon) / mon; if (a % c == 0) { ++cc; } if (a % d == 0) { ++dd; } if (a % mon == 0) { ++cd; } if (b % c == 0) { ++cc; } if (b % d == 0) { ++dd; } if (b % mon == 0) { ++cd; } // cout << cc << " " << dd << " " << cd << endl; cout << (b - a + 1) - (cc + dd - cd) << endl; }
[ "expression.operation.binary.remove" ]
806,537
806,538
u539402331
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (int i = 0; i < int(n); i++) #define FOR(i, m, n) for (int i = int(m); i < int(n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define VI vector<int> #define VLL vector<long long> #define VVI vector<vector<int>> #define VVLL vector<vector<long long>> #define VC vector<char> #define VS vector<string> #define VVC vector<vector<char>> #define VB vector<bool> #define VVB vector<vector<bool>> #define fore(i, a) for (auto &i : a) typedef pair<int, int> P; template <class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1 << 30; const ll INFL = 1LL << 60; const ll mod = 1000000007; ll gcd(ll x, ll y) { if (y == 0) return x; return gcd(y, x % y); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll e = (c * d) / gcd(c, d); ll ans = b - a + 1; ll f = (b / c) - (a / c); if (a % c == 0) f++; // if (b%c == 0)f--; ll g = (b / d) - (a / d); if (a % d == 0) g++; // if (b%d == 0)g++; ll h = (b / e) - (a / e); if (a % e == 0) e++; // if (b%e == 0)e--; // cout << ans << ' ' << f << ' ' << g << ' ' << h << endl; cout << ans - f - g + h << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (int i = 0; i < int(n); i++) #define FOR(i, m, n) for (int i = int(m); i < int(n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define VI vector<int> #define VLL vector<long long> #define VVI vector<vector<int>> #define VVLL vector<vector<long long>> #define VC vector<char> #define VS vector<string> #define VVC vector<vector<char>> #define VB vector<bool> #define VVB vector<vector<bool>> #define fore(i, a) for (auto &i : a) typedef pair<int, int> P; template <class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1 << 30; const ll INFL = 1LL << 60; const ll mod = 1000000007; ll gcd(ll x, ll y) { if (y == 0) return x; return gcd(y, x % y); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll e = (c * d) / gcd(c, d); ll ans = b - a + 1; ll f = (b / c) - (a / c); if (a % c == 0) f++; // if (b%c == 0)f--; ll g = (b / d) - (a / d); if (a % d == 0) g++; // if (b%d == 0)g++; ll h = (b / e) - (a / e); if (a % e == 0) h++; // if (b%e == 0)e--; // cout << ans << ' ' << f << ' ' << g << ' ' << h << endl; cout << ans - f - g + h << endl; }
[ "identifier.change" ]
806,547
806,548
u856232850
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (int i = 0; i < int(n); i++) #define FOR(i, m, n) for (int i = int(m); i < int(n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define VI vector<int> #define VLL vector<long long> #define VVI vector<vector<int>> #define VVLL vector<vector<long long>> #define VC vector<char> #define VS vector<string> #define VVC vector<vector<char>> #define VB vector<bool> #define VVB vector<vector<bool>> #define fore(i, a) for (auto &i : a) typedef pair<int, int> P; template <class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1 << 30; const ll INFL = 1LL << 60; const ll mod = 1000000007; ll gcd(ll x, ll y) { if (y == 0) return x; return gcd(y, x % y); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll e = (c * d) / gcd(c, d); ll ans = b - a + 1; ll f = (b / c) - (a / c); if (a % c == 0) f++; // if (b%c == 0)f--; ll g = (b / d) - (a / d); if (a % d == 0) g++; // if (b%d == 0)g++; ll h = (b / e) - (a / e); if (a % e == 0) e++; // if (b%e == 0)e--; // cout << ans << ' ' << f << ' ' << g << ' ' << h << endl; cout << ans - f - g + h << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (int i = 0; i < int(n); i++) #define FOR(i, m, n) for (int i = int(m); i < int(n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define VI vector<int> #define VLL vector<long long> #define VVI vector<vector<int>> #define VVLL vector<vector<long long>> #define VC vector<char> #define VS vector<string> #define VVC vector<vector<char>> #define VB vector<bool> #define VVB vector<vector<bool>> #define fore(i, a) for (auto &i : a) typedef pair<int, int> P; template <class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1 << 30; const ll INFL = 1LL << 60; const ll mod = 1000000007; ll gcd(ll x, ll y) { if (y == 0) return x; return gcd(y, x % y); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll e = (c * d) / gcd(c, d); ll ans = b - a + 1; ll f = (b / c) - (a / c); if (a % c == 0) f++; // if (b%c == 0)f--; ll g = (b / d) - (a / d); if (a % d == 0) g++; // if (b%d == 0)g++; ll h = (b / e) - (a / e); if (a % e == 0) h++; // if (b%e == 0)e--; // cout << ans << ' ' << f << ' ' << g << ' ' << h << endl; cout << ans - f - g + h << endl; }
[ "identifier.change" ]
806,549
806,548
u856232850
cpp
p02995
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; typedef long long int LL; typedef pair<int, int> P; typedef pair<int, pair<int, int>> PP; typedef pair<LL, int> LP; const int INF = 1 << 30; const LL MAX = 1e9 + 7; void array_show(int *array, int array_n, char middle = ' ') { for (int i = 0; i < array_n; i++) printf("%d%c", array[i], (i != array_n - 1 ? middle : '\n')); } void array_show(LL *array, int array_n, char middle = ' ') { for (int i = 0; i < array_n; i++) printf("%lld%c", array[i], (i != array_n - 1 ? middle : '\n')); } void print_YES_NO(bool answer) { cout << (answer ? "YES" : "NO") << endl; } void print_Yes_No(bool answer) { cout << (answer ? "Yes" : "No") << endl; } void print_POSSIBLE_IMPOSSIBLE(bool answer) { cout << (answer ? "POSSIBLE" : "IMPOSSIBLE") << endl; } int gcd(int a, int b) { if (a < b) return gcd(b, a); if (b == 0) return a; return gcd(b, a % b); } LL num(LL a, int c, int d) { LL s = 0; s = a / c + a / d - a / (c * d / gcd(c, d)); return a - s; } int main() { LL a, b, c, d; cin >> a >> b >> c >> d; cout << num(b, c, d) - num(a - 1, c, d) << endl; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; typedef long long int LL; typedef pair<int, int> P; typedef pair<int, pair<int, int>> PP; typedef pair<LL, int> LP; const int INF = 1 << 30; const LL MAX = 1e9 + 7; void array_show(int *array, int array_n, char middle = ' ') { for (int i = 0; i < array_n; i++) printf("%d%c", array[i], (i != array_n - 1 ? middle : '\n')); } void array_show(LL *array, int array_n, char middle = ' ') { for (int i = 0; i < array_n; i++) printf("%lld%c", array[i], (i != array_n - 1 ? middle : '\n')); } void print_YES_NO(bool answer) { cout << (answer ? "YES" : "NO") << endl; } void print_Yes_No(bool answer) { cout << (answer ? "Yes" : "No") << endl; } void print_POSSIBLE_IMPOSSIBLE(bool answer) { cout << (answer ? "POSSIBLE" : "IMPOSSIBLE") << endl; } LL gcd(LL a, LL b) { if (a < b) return gcd(b, a); if (b == 0) return a; return gcd(b, a % b); } LL num(LL a, LL c, LL d) { LL s = 0; s = a / c + a / d - a / (c * d / gcd(c, d)); return a - s; } int main() { LL a, b, c, d; cin >> a >> b >> c >> d; cout << num(b, c, d) - num(a - 1, c, d) << endl; }
[]
806,554
806,555
u464804957
cpp
p02995
#include <algorithm> #include <iostream> #include <numeric> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> using namespace std; long long GCD(long long u, long long v) { while (v != 0) { long long r = u % v; u = v; v = r; } return u; } int main() { ios_base::sync_with_stdio(false); long long a, b, c, d; cin >> a >> b >> c >> d; long long all = b - b / c - b / d + b / (c * d / GCD(c, d)); --a; long long prev = a - a / c - a / d - a / (c * d / GCD(c, d)); cout << all - prev << endl; return 0; }
#include <algorithm> #include <iostream> #include <numeric> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> using namespace std; long long GCD(long long u, long long v) { while (v != 0) { long long r = u % v; u = v; v = r; } return u; } int main() { ios_base::sync_with_stdio(false); long long a, b, c, d; cin >> a >> b >> c >> d; long long all = b - b / c - b / d + b / (c * d / GCD(c, d)); --a; long long prev = a - a / c - a / d + a / (c * d / GCD(c, d)); cout << all - prev << endl; return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
806,566
806,567
u377363903
cpp
p02995
// #define DEBUGGING #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ALL(V) (V).begin(), (V).end() #define ALLR(V) (V).rbegin(), (V).rend() template <typename T> using V = vector<T>; template <typename T> using VV = V<V<T>>; template <typename T, typename U> using P = pair<T, U>; using ll = int64_t; using PLL = P<ll, ll>; template <typename T> const T &var_min(const T &t) { return t; } template <typename T> const T &var_max(const T &t) { return t; } template <typename T, typename... Tail> const T &var_min(const T &t, const Tail &...tail) { return min(t, var_min(tail...)); } template <typename T, typename... Tail> const T &var_max(const T &t, const Tail &...tail) { return max(t, var_max(tail...)); } template <typename T, typename... Tail> void chmin(T &t, const Tail &...tail) { t = var_min(t, tail...); } template <typename T, typename... Tail> void chmax(T &t, const Tail &...tail) { t = var_max(t, tail...); } template <typename T> const T &clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); } template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); } namespace init__ { struct InitIO { InitIO() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(30); } } init_io; } // namespace init__ #ifdef DEBUGGING #include "../debug.cpp" #else #define DEBUG(...) 0 #define DEBUG_SEPARATOR_LINE 0 #endif template <typename T> T make_v(T init) { return init; } template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { #define rec make_v(init, tail...) return V<decltype(rec)>(s, rec); #undef rec } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll calc(ll r, ll div) { ll mod = r % div; return r / div; } ll calc(ll l, ll r, ll div) { return calc(r + 1, div) - calc(l, div); } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll div_c = calc(A, B, C); ll div_d = calc(A, B, D); ll div_cd = calc(A, B, C / gcd(C, D) * D); cout << (B - A + 1) - (div_c + div_d - div_cd) << endl; return 0; }
// #define DEBUGGING #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ALL(V) (V).begin(), (V).end() #define ALLR(V) (V).rbegin(), (V).rend() template <typename T> using V = vector<T>; template <typename T> using VV = V<V<T>>; template <typename T, typename U> using P = pair<T, U>; using ll = int64_t; using PLL = P<ll, ll>; template <typename T> const T &var_min(const T &t) { return t; } template <typename T> const T &var_max(const T &t) { return t; } template <typename T, typename... Tail> const T &var_min(const T &t, const Tail &...tail) { return min(t, var_min(tail...)); } template <typename T, typename... Tail> const T &var_max(const T &t, const Tail &...tail) { return max(t, var_max(tail...)); } template <typename T, typename... Tail> void chmin(T &t, const Tail &...tail) { t = var_min(t, tail...); } template <typename T, typename... Tail> void chmax(T &t, const Tail &...tail) { t = var_max(t, tail...); } template <typename T> const T &clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); } template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); } namespace init__ { struct InitIO { InitIO() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(30); } } init_io; } // namespace init__ #ifdef DEBUGGING #include "../debug.cpp" #else #define DEBUG(...) 0 #define DEBUG_SEPARATOR_LINE 0 #endif template <typename T> T make_v(T init) { return init; } template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { #define rec make_v(init, tail...) return V<decltype(rec)>(s, rec); #undef rec } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll calc(ll r, ll div) { r--; return r / div; } ll calc(ll l, ll r, ll div) { return calc(r + 1, div) - calc(l, div); } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll div_c = calc(A, B, C); ll div_d = calc(A, B, D); ll div_cd = calc(A, B, C / gcd(C, D) * D); cout << (B - A + 1) - (div_c + div_d - div_cd) << endl; return 0; }
[ "variable_declaration.remove", "expression.operation.binary.change" ]
806,568
806,569
u216962796
cpp
p02995
#include <bits/stdc++.h> #define inf 0x6fffffff using namespace std; const int N = 5e6 + 10; typedef long long ll; ll read() { ll x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } ll gcd(ll a, ll b) { return (!b) ? a : gcd(b, a % b); } int main() { ll a = read(), b = read(), c = read(), d = read(); swap(a, b); ll lm = c * d / gcd(c, d); b--; cout << (a - a / c - a / d + a / lm) - (b - b / c - b / d + c / lm) << endl; return 0; }
#include <bits/stdc++.h> #define inf 0x6fffffff using namespace std; const int N = 5e6 + 10; typedef long long ll; ll read() { ll x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } ll gcd(ll a, ll b) { return (!b) ? a : gcd(b, a % b); } int main() { ll a = read(), b = read(), c = read(), d = read(); swap(a, b); ll lm = c * d / gcd(c, d); b--; cout << (a - a / c - a / d + a / lm) - (b - b / c - b / d + b / lm) << endl; return 0; }
[ "identifier.change", "io.output.change" ]
806,574
806,575
u550756195
cpp
p02995
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 1e9 #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); } // const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; // const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1; ll lcm = LCM(c, d); ans -= b / c - (a - 1) / c; ans -= b / d - (a - 1) / d; ans += b / lcm - a / lcm; cout << ans << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 1e9 #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); } // const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; // const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1; ll lcm = LCM(c, d); ans -= b / c - (a - 1) / c; ans -= b / d - (a - 1) / d; ans += b / lcm - (a - 1) / lcm; cout << ans << endl; }
[]
806,582
806,583
u222509161
cpp
p02995
#include <bits/stdc++.h> #define int long long #define P pair<int, int> #define PP pair<P, int> #define F first #define S second #define f(i, n) for (int i = 0; i < (n); i++) #define INF INT_MAX / 3 #define eps LDBL_EPSILON #define mod (int)(1000000007) #define pie 3.141592653589793238462643383279 #define Bpri priority_queue #define Spri priority_queue<P, vector<P>, greater<P>> using namespace std; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int lcm(int a, int b) { return a * b / gcd(a, b); } signed main() { int a, b, c, d; cin >> a >> b >> c >> d; a--; cout << b - b / c - b / d + b / lcm(c, d) - (a - a / c - a / d + a / lcm(b, c)) << endl; }
#include <bits/stdc++.h> #define int long long #define P pair<int, int> #define PP pair<P, int> #define F first #define S second #define f(i, n) for (int i = 0; i < (n); i++) #define INF INT_MAX / 3 #define eps LDBL_EPSILON #define mod (int)(1000000007) #define pie 3.141592653589793238462643383279 #define Bpri priority_queue #define Spri priority_queue<P, vector<P>, greater<P>> using namespace std; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int lcm(int a, int b) { return a * b / gcd(a, b); } signed main() { int a, b, c, d; cin >> a >> b >> c >> d; a--; cout << b - b / c - b / d + b / lcm(c, d) - (a - a / c - a / d + a / lcm(c, d)) << endl; }
[ "call.arguments.change", "call.arguments.add" ]
806,595
806,596
u259210975
cpp
p02995
// Gaurav Aggarwal /* useful stl array<ll,size> ar; //size(),front(),back(),fill(),empty() deque<ll> d //push_back(),push_front(),pop_front(),pop_back() vector<ll> v(size,val); //push_back(),*max_element(v.begin(),v.end()),accumulate(v.begin(),v.end(),0) stack<ll> g; //push(),pop(),top(),size(),empty() LIFO queue<ll> q; //push(),size(),front(),back(),empty() FIFO priority_queue<ll> pq */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<pii> vii; typedef vector<pll> vll; #define pb push_back #define mp make_pair #define mod 1000000007 #define p(s) cout << (s) << endl #define p2(s, t) cout << (s) << " " << (t) << endl #define For(i, a, b) for (__typeof(a) i = a; i <= b; i++) #define inp_arr(a, n) \ for (__typeof(n) i = 0; i < n; ++i) { \ cin >> a[i]; \ } #define debug_arr(a, n) \ { \ { \ for (__typeof(n) i = 0; i < n; ++i) { \ cout << a[i] << " "; \ } \ cout << "\n"; \ } \ } ll power(ll x, ll y) { ll res = 1; while (y > 0) { if (y & 1) res = (res * x) % mod; y = y >> 1; x = (x * x) % mod; } return res % mod; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("out.txt", "w", stdout); // #endif ll a, b, c, d; cin >> a >> b >> c >> d; int numc = b / c - (a - 1) / c; int numd = b / d - (a - 1) / d; ll gc = __gcd(c, d); ll lc = (c * d) / gc; // cout<<(c*d)/gc<<"\n"; int f = b / lc - (a - 1) / lc; ll ans = (b - a + 1) + f - numc - numd; cout << ans << "\n"; return 0; }
// Gaurav Aggarwal /* useful stl array<ll,size> ar; //size(),front(),back(),fill(),empty() deque<ll> d //push_back(),push_front(),pop_front(),pop_back() vector<ll> v(size,val); //push_back(),*max_element(v.begin(),v.end()),accumulate(v.begin(),v.end(),0) stack<ll> g; //push(),pop(),top(),size(),empty() LIFO queue<ll> q; //push(),size(),front(),back(),empty() FIFO priority_queue<ll> pq */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<pii> vii; typedef vector<pll> vll; #define pb push_back #define mp make_pair #define mod 1000000007 #define p(s) cout << (s) << endl #define p2(s, t) cout << (s) << " " << (t) << endl #define For(i, a, b) for (__typeof(a) i = a; i <= b; i++) #define inp_arr(a, n) \ for (__typeof(n) i = 0; i < n; ++i) { \ cin >> a[i]; \ } #define debug_arr(a, n) \ { \ { \ for (__typeof(n) i = 0; i < n; ++i) { \ cout << a[i] << " "; \ } \ cout << "\n"; \ } \ } ll power(ll x, ll y) { ll res = 1; while (y > 0) { if (y & 1) res = (res * x) % mod; y = y >> 1; x = (x * x) % mod; } return res % mod; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("out.txt", "w", stdout); // #endif ll a, b, c, d; cin >> a >> b >> c >> d; ll numc = b / c - (a - 1) / c; ll numd = b / d - (a - 1) / d; ll gc = __gcd(c, d); ll lc = (c * d) / gc; // cout<<(c*d)/gc<<"\n"; ll f = b / lc - (a - 1) / lc; ll ans = (b - a + 1) + f - numc - numd; cout << ans << "\n"; return 0; }
[ "variable_declaration.type.change" ]
806,597
806,598
u371472297
cpp
p02995
// Gaurav Aggarwal /* useful stl array<ll,size> ar; //size(),front(),back(),fill(),empty() deque<ll> d //push_back(),push_front(),pop_front(),pop_back() vector<ll> v(size,val); //push_back(),*max_element(v.begin(),v.end()),accumulate(v.begin(),v.end(),0) stack<ll> g; //push(),pop(),top(),size(),empty() LIFO queue<ll> q; //push(),size(),front(),back(),empty() FIFO priority_queue<ll> pq */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<pii> vii; typedef vector<pll> vll; #define pb push_back #define mp make_pair #define mod 1000000007 #define p(s) cout << (s) << endl #define p2(s, t) cout << (s) << " " << (t) << endl #define For(i, a, b) for (__typeof(a) i = a; i <= b; i++) #define inp_arr(a, n) \ for (__typeof(n) i = 0; i < n; ++i) { \ cin >> a[i]; \ } #define debug_arr(a, n) \ { \ { \ for (__typeof(n) i = 0; i < n; ++i) { \ cout << a[i] << " "; \ } \ cout << "\n"; \ } \ } ll power(ll x, ll y) { ll res = 1; while (y > 0) { if (y & 1) res = (res * x) % mod; y = y >> 1; x = (x * x) % mod; } return res % mod; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("out.txt", "w", stdout); // #endif ll a, b, c, d; cin >> a >> b >> c >> d; int numc = b / c - (a - 1) / c; int numd = b / d - (a - 1) / d; int gc = __gcd(c, d); int lc = (c * d) / gc; int f = b / lc - (a - 1) / lc; ll ans = (b - a + 1) + f - numc - numd; cout << ans << "\n"; return 0; }
// Gaurav Aggarwal /* useful stl array<ll,size> ar; //size(),front(),back(),fill(),empty() deque<ll> d //push_back(),push_front(),pop_front(),pop_back() vector<ll> v(size,val); //push_back(),*max_element(v.begin(),v.end()),accumulate(v.begin(),v.end(),0) stack<ll> g; //push(),pop(),top(),size(),empty() LIFO queue<ll> q; //push(),size(),front(),back(),empty() FIFO priority_queue<ll> pq */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<pii> vii; typedef vector<pll> vll; #define pb push_back #define mp make_pair #define mod 1000000007 #define p(s) cout << (s) << endl #define p2(s, t) cout << (s) << " " << (t) << endl #define For(i, a, b) for (__typeof(a) i = a; i <= b; i++) #define inp_arr(a, n) \ for (__typeof(n) i = 0; i < n; ++i) { \ cin >> a[i]; \ } #define debug_arr(a, n) \ { \ { \ for (__typeof(n) i = 0; i < n; ++i) { \ cout << a[i] << " "; \ } \ cout << "\n"; \ } \ } ll power(ll x, ll y) { ll res = 1; while (y > 0) { if (y & 1) res = (res * x) % mod; y = y >> 1; x = (x * x) % mod; } return res % mod; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("out.txt", "w", stdout); // #endif ll a, b, c, d; cin >> a >> b >> c >> d; ll numc = b / c - (a - 1) / c; ll numd = b / d - (a - 1) / d; ll gc = __gcd(c, d); ll lc = (c * d) / gc; // cout<<(c*d)/gc<<"\n"; ll f = b / lc - (a - 1) / lc; ll ans = (b - a + 1) + f - numc - numd; cout << ans << "\n"; return 0; }
[ "variable_declaration.type.change" ]
806,599
806,598
u371472297
cpp
p02995
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <unordered_map> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) using namespace std; typedef unsigned long long ul; typedef long long ll; typedef pair<int, int> PAIR; int gcd(ll a, ll b) { if (a < b) { return gcd(b, a); } while (b != 0) { ll rem = a % b; a = b; b = rem; } return a; } // 1以上A以下の倍数の数 int resRange(ll A, ll C) { return A / C; } int res(ll A, ll B, ll C) { return resRange(B, C) - resRange(A - 1, C); } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll Cbaisu = res(A, B, C); ll Dbaisu = res(A, B, D); ll lcmw = C * D / gcd(C, D); ll CDbaisu = res(A, B, lcmw); ll CorDBaisu = Cbaisu + Dbaisu - CDbaisu; cout << ((B - A + 1) - CorDBaisu); return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <unordered_map> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) using namespace std; typedef unsigned long long ul; typedef long long ll; typedef pair<int, int> PAIR; ll gcd(ll a, ll b) { if (a < b) { return gcd(b, a); } while (b != 0) { ll rem = a % b; a = b; b = rem; } return a; } // 1以上A以下の倍数の数 ll resRange(ll A, ll C) { return A / C; } ll res(ll A, ll B, ll C) { return resRange(B, C) - resRange(A - 1, C); } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll Cbaisu = res(A, B, C); ll Dbaisu = res(A, B, D); ll lcmw = C * D / gcd(C, D); ll CDbaisu = res(A, B, lcmw); ll CorDBaisu = Cbaisu + Dbaisu - CDbaisu; cout << ((B - A + 1) - CorDBaisu); return 0; }
[]
806,615
806,616
u211490974
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, e; long long gcd(int x, int y) { if (x % y == 0) return y; else return gcd(y, x % y); } long long lcm(long long x, long long y) { return x * y / gcd(x, y); } long long C(long long x) { int ret = x / c + x / d - x / e; return ret; } int main() { cin >> a >> b >> c >> d; e = lcm(c, d); cout << (b - a + 1) - C(b) + C(a - 1) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, e; long long gcd(int x, int y) { if (x % y == 0) return y; else return gcd(y, x % y); } long long lcm(long long x, long long y) { return x * y / gcd(x, y); } long long C(long long x) { long long ret = x / c + x / d - x / e; return ret; } int main() { cin >> a >> b >> c >> d; e = lcm(c, d); cout << (b - a + 1) - C(b) + C(a - 1) << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
806,619
806,620
u872406755
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define min(a, b) (a < b) ? a : b; #define max(a, b) (a > b) ? a : b; long long gcd(long long c, long long d) { return (c % d == 0) ? d : gcd(d, c % d); } long long lcd(long long a, long long b) { return a * b / gcd(a, b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; A--; long long B_C = (B - B % C) / C; long long B_D = (B - B % D) / D; long long B_CD = (B - B % lcd(C, D)) / lcd(C, D); long long A_C = (A - A % C) / C; long long A_D = (A - A % D) / D; long long A_CD = (A - A % lcd(C, D)) / lcd(C, D); int cnt = B_C - A_C + B_D - A_D - (B_CD - A_CD); cout << B - A - cnt; }
#include <bits/stdc++.h> using namespace std; #define min(a, b) (a < b) ? a : b; #define max(a, b) (a > b) ? a : b; long long gcd(long long c, long long d) { return (c % d == 0) ? d : gcd(d, c % d); } long long lcd(long long a, long long b) { return a * b / gcd(a, b); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; A--; long long B_C = (B - B % C) / C; long long B_D = (B - B % D) / D; long long B_CD = (B - B % lcd(C, D)) / lcd(C, D); long long A_C = (A - A % C) / C; long long A_D = (A - A % D) / D; long long A_CD = (A - A % lcd(C, D)) / lcd(C, D); long long cnt = B_C - A_C + B_D - A_D - (B_CD - A_CD); cout << B - A - cnt; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
806,626
806,627
u849073847
cpp
p02995
#include <cmath> #include <iostream> #include <numeric> #define pans cout << ans << endl; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; long gcd(long a, long b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } long lcm(long a, long b) { return a * b / gcd(a, b); } int main() { long a, b, c, d; cin >> a >> b >> c >> d; long divc = 0; long divd = 0; long e = lcm(c, d); long dive = 0; if (a == b) { cout << 0 << endl; return 0; } if (c == d) { divc = int(b / c) - int(a / c); if (a % c == 0) { ++divc; } cout << b - a + 1 - divc << endl; return 0; } //まずc divc = int(b / c) - int(a / c); if (a % c == 0) { ++divc; } // d divd = long(b / d) - long(a / d); if (a % d == 0) { ++divd; } // e dive = long(b / e) - long(a / e); if (a % e == 0) { ++dive; } // cout<<divc<<" "<<divd<<" "<<dive<<" "<<endl; cout << b - a + 1 - divc - divd + dive << endl; return 0; }
#include <cmath> #include <iostream> #include <numeric> #define pans cout << ans << endl; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; long gcd(long a, long b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } long lcm(long a, long b) { return a * b / gcd(a, b); } int main() { long a, b, c, d; cin >> a >> b >> c >> d; long divc = 0; long divd = 0; long e = lcm(c, d); long dive = 0; if (a == b) { cout << 0 << endl; return 0; } if (c == d) { divc = long(b / c) - long(a / c); if (a % c == 0) { ++divc; } cout << b - a + 1 - divc << endl; return 0; } //まずc divc = long(b / c) - long(a / c); if (a % c == 0) { ++divc; } // d divd = long(b / d) - long(a / d); if (a % d == 0) { ++divd; } // e dive = long(b / e) - long(a / e); if (a % e == 0) { ++dive; } // cout<<divc<<" "<<divd<<" "<<dive<<" "<<endl; cout << b - a + 1 - divc - divd + dive << endl; return 0; }
[ "assignment.value.change", "call.function.change", "expression.operation.binary.change" ]
806,628
806,629
u514429645
cpp
p02995
#include <bits/stdc++.h> using namespace std; int64_t GCD(int64_t m, int64_t n) { int64_t big, small; int64_t p = -1; big = max(m, n); small = min(m, n); while (1) { p = big % small; if (p == 0) break; big = small; small = p; } return small; } int main() { int64_t a, b, c, d; int64_t l; cin >> a >> b >> c >> d; int flag = 0; int numc, numd, numl; int64_t ans = 0; l = (c * d) / GCD(c, d); if (a % c == 0) { numc = (b / c) - (a / c) + 1; } else { numc = (b / c) - (a / c); } if (a % d == 0) { numd = (b / d) - (a / d) + 1; } else { numd = (b / d) - (a / d); } if (a % l == 0) { numl = (b / l) - (a / l) + 1; } else { numl = (b / l) - (a / l); } ans = (b - a + 1) - numc - numd + numl; // cout <<fixed<<setprecision(16)<< << endl; cout << ans << endl; // if(flag==1)cout << "Yes" <<endl; // else cout << "No" <<endl; return 0; }
#include <bits/stdc++.h> using namespace std; int64_t GCD(int64_t m, int64_t n) { int64_t big, small; int64_t p = -1; big = max(m, n); small = min(m, n); while (1) { p = big % small; if (p == 0) break; big = small; small = p; } return small; } int main() { int64_t a, b, c, d; int64_t l; cin >> a >> b >> c >> d; int flag = 0; int64_t numc, numd, numl; int64_t ans = 0; l = (c * d) / GCD(c, d); if (a % c == 0) { numc = (b / c) - (a / c) + 1; } else { numc = (b / c) - (a / c); } if (a % d == 0) { numd = (b / d) - (a / d) + 1; } else { numd = (b / d) - (a / d); } if (a % l == 0) { numl = (b / l) - (a / l) + 1; } else { numl = (b / l) - (a / l); } ans = (b - a + 1) - numc - numd + numl; // cout <<fixed<<setprecision(16)<< << endl; cout << ans << endl; // if(flag==1)cout << "Yes" <<endl; // else cout << "No" <<endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
806,635
806,636
u355424600
cpp
p02995
#include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> using namespace std; long a, b; int c, d; long cd; long ans = 0; int main() { long i; int buf, r; int buf_c, buf_d; cin >> a >> b >> c >> d; if (c < d) { // NOTHING } else { buf = c; c = d; d = buf; } buf_c = c; buf_d = d; r = buf_c % buf_d; while (r != 0) { buf_c = buf_d; buf_d = r; r = buf_c % buf_d; } cd = c * d / buf_d; // bまででcでわれるかず long b_c = b / c; // bまででdでわれるかず long b_d = b / d; // bまででどっちでも割れるかず long b_cd = b / cd; // aまででcでわれるかず long a_c = (a - 1) / c; // aまででdでわれるかず long a_d = (a - 1) / d; // aまででどっちでもわれるかず long a_cd = (a - 1) / cd; ans = (b - b_c - b_d + b_cd) - (a - 1 - a_c - a_d + a_cd); cout << ans << endl; return 0; }
#include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> using namespace std; long a, b; long c, d; long cd; long ans = 0; int main() { long i; long buf, r; long buf_c, buf_d; cin >> a >> b >> c >> d; if (c < d) { // NOTHING } else { buf = c; c = d; d = buf; } buf_c = c; buf_d = d; r = buf_c % buf_d; while (r != 0) { buf_c = buf_d; buf_d = r; r = buf_c % buf_d; } cd = c * d / buf_d; // bまででcでわれるかず long b_c = b / c; // bまででdでわれるかず long b_d = b / d; // bまででどっちでも割れるかず long b_cd = b / cd; // aまででcでわれるかず long a_c = (a - 1) / c; // aまででdでわれるかず long a_d = (a - 1) / d; // aまででどっちでもわれるかず long a_cd = (a - 1) / cd; ans = (b - b_c - b_d + b_cd) - (a - 1 - a_c - a_d + a_cd); cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
806,643
806,644
u085376000
cpp
p02995
#include <bits/stdc++.h> const int INF = 1e9; const int MOD = 1e9 + 7; const long long LINF = 1e18; #define dump(x) cout << 'x' << ' = ' << (x) << ` `; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOREACH(x, a) for (auto &(x) : (a)) typedef long long ll; using namespace std; typedef pair<ll, ll> P; template <typename T> T gcd(T a, T b) { if (a % b == 0) return b; gcd(b, a % b); } template <typename U> U gcd_multi(vector<U> A) { int n = A.size(); if (n == 1) return A[0]; int G = gcd(A[0], A[1]); if (n == 2) return G; for (int i = 2; i < n; ++i) G = gcd(G, A[i]); return G; } template <typename U> U lcm(U a, U b) { U ans = a * b / gcd(a, b); return ans; } int main(int argc, char const *argv[]) { ll a, b, c, d; cin >> a >> b >> c >> d; // 1からBまでの数を数える ll lcmx = lcm(c, d); ll bc = b / c; ll ac = (a - 1) / c; ll abc = bc - ac; ll bd = b / d; ll ad = (a - 1) / d; ll abd = bd - ad; ll bcd = b / lcmx; ll acd = a / lcmx; ll lcms = bcd - acd; ll all = b - a + 1; ll ans = all - (abc + abd - lcms); cout << ans << endl; return 0; }
#include <bits/stdc++.h> const int INF = 1e9; const int MOD = 1e9 + 7; const long long LINF = 1e18; #define dump(x) cout << 'x' << ' = ' << (x) << ` `; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOREACH(x, a) for (auto &(x) : (a)) typedef long long ll; using namespace std; typedef pair<ll, ll> P; template <typename T> T gcd(T a, T b) { if (a % b == 0) return b; gcd(b, a % b); } template <typename U> U gcd_multi(vector<U> A) { int n = A.size(); if (n == 1) return A[0]; int G = gcd(A[0], A[1]); if (n == 2) return G; for (int i = 2; i < n; ++i) G = gcd(G, A[i]); return G; } template <typename U> U lcm(U a, U b) { U ans = a * b / gcd(a, b); return ans; } int main(int argc, char const *argv[]) { ll a, b, c, d; cin >> a >> b >> c >> d; // 1からBまでの数を数える ll lcmx = lcm(c, d); ll bc = b / c; ll ac = (a - 1) / c; ll abc = bc - ac; ll bd = b / d; ll ad = (a - 1) / d; ll abd = bd - ad; ll bcd = b / lcmx; ll acd = (a - 1) / lcmx; ll lcms = bcd - acd; ll all = b - a + 1; ll ans = all - (abc + abd - lcms); cout << ans << endl; return 0; }
[]
806,653
806,654
u102602414
cpp
p02995
#include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long lld; lld gcd(lld a, lld b) { return b == 0 ? a : gcd(b, a % b); } lld lcm(lld a, lld b) { return a * b / gcd(a, b); } int main() { lld A, B, C, D; scanf("%lld%lld%lld%lld", &A, &B, &C, &D); printf("%lld", B - A + 1 - (B / C - (A - 1) / C) - (B / D - (A - 1) / D) + (B / (C * D) - (A - 1) / (C * D))); return 0; }
#include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long lld; lld gcd(lld a, lld b) { return b == 0 ? a : gcd(b, a % b); } lld lcm(lld a, lld b) { return a * b / gcd(a, b); } int main() { lld A, B, C, D; scanf("%lld%lld%lld%lld", &A, &B, &C, &D); printf("%lld", B - A + 1 - (B / C - (A - 1) / C) - (B / D - (A - 1) / D) + (B / lcm(C, D) - (A - 1) / lcm(C, D))); return 0; }
[ "call.add", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
806,657
806,658
u720394712
cpp
p02995
#include <algorithm> #include <iostream> #include <numeric> #include <vector> using namespace std; using ll = long long int; ll a, b, c, d; ll ret = 0; ll gcd(ll a, ll b) { while (b) { ll m = a % b; a = b; b = m; } return a; } ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); } int main(void) { cin >> a >> b >> c >> d; ret += b / c - (a - 1) / c; ret += b / d - (a - 1) / d; ll g = lcm(max(c, d), min(c, d)); ret -= b / g + a / g; ret = b - a + 1 - ret; cout << ret << endl; return 0; }
#include <algorithm> #include <iostream> #include <numeric> #include <vector> using namespace std; using ll = long long int; ll a, b, c, d; ll ret = 0; ll gcd(ll a, ll b) { while (b) { ll m = a % b; a = b; b = m; } return a; } ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); } int main(void) { cin >> a >> b >> c >> d; ret += b / c - (a - 1) / c; ret += b / d - (a - 1) / d; ll g = lcm(max(c, d), min(c, d)); ret -= b / g - (a - 1) / g; ret = b - a + 1 - ret; cout << ret << endl; return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
806,687
806,688
u728082661
cpp
p02995
#include <bits/stdc++.h> using namespace std; template <class T> T gcd(T x, T y) { if (!x) return y; return gcd(y % x, x); } template <class T> T lcm(T x, T y) { return x * y / gcd(x, y); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long x = B / C - (A - 1) / C; long long y = B / D - (A - 1) / D; long long z = B / lcm(C, D) - (A - 1) / (C * D); cout << (B - A + 1) - (x + y - z) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; template <class T> T gcd(T x, T y) { if (!x) return y; return gcd(y % x, x); } template <class T> T lcm(T x, T y) { return x * y / gcd(x, y); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long x = B / C - (A - 1) / C; long long y = B / D - (A - 1) / D; long long z = B / lcm(C, D) - (A - 1) / lcm(C, D); cout << (B - A + 1) - (x + y - z) << endl; return 0; }
[ "call.add", "expression.operation.binary.change" ]
806,689
806,690
u154289649
cpp
p02996
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using P = pair<int, int>; const ll INF = 1e16; void solver(int N, map<ll, ll> &ab, bool &flg) { ll t_limit{}, t_done{}; for (auto p : ab) { auto b = p.first; auto a = p.second; t_limit += b; t_done += a; if (t_limit < t_done) { flg = false; } } return; } int main() { int N; cin >> N; map<ll, ll> ab; for (int i = 0; i < N; ++i) { ll a, b; cin >> a >> b; ab[b] += a; } bool flg = true; solver(N, ab, flg); if (flg) { cout << "Yes"s << endl; } else { cout << "No"s << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using P = pair<int, int>; const ll INF = 1e16; void solver(int N, map<ll, ll> &ab, bool &flg) { ll t_limit{}, t_done{}; for (auto p : ab) { auto b = p.first; auto a = p.second; t_limit = b; t_done += a; if (t_limit < t_done) { flg = false; } } return; } int main() { int N; cin >> N; map<ll, ll> ab; for (int i = 0; i < N; ++i) { ll a, b; cin >> a >> b; ab[b] += a; } bool flg = true; solver(N, ab, flg); if (flg) { cout << "Yes"s << endl; } else { cout << "No"s << endl; } return 0; }
[ "assignment.value.change" ]
806,695
806,696
u118647609
cpp
p02996
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < n; i++) #define rep_r(i, n) for (ll i = n - 1; i >= 0; i--) #define all(x) x.begin(), x.end() #define resize(x, n) x.resize(n) using pll = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vl>; const ll INF = 1000000000000000000; const ll mod = 1000000007; const ll MAX = 100000; struct edge { ll from, to, weight; edge(ll f, ll t, ll w) : from(f), to(t), weight(w) {} }; vector<vector<edge>> edges; vector<vector<ll>> graph; vector<bool> visited; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; ll n, m, r, answer; ll timer = 0; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n; priority_queue<pll, vector<pll>, greater<pll>> task; rep(i, n) { pll t; cin >> t.second; // 仕事にかかる時間 cin >> t.first; // 締め切り task.push(t); } bool flag = true; rep(i, n) { pll t = task.top(); task.pop(); if (timer + t.second <= t.first) { timer += t.second; // printf("完了後の時刻%lld 締め切り%lld\n", timer, t.first); } else { break; flag = false; } } if (flag) printf("Yes\n"); else printf("No\n"); }
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < n; i++) #define rep_r(i, n) for (ll i = n - 1; i >= 0; i--) #define all(x) x.begin(), x.end() #define resize(x, n) x.resize(n) using pll = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vl>; const ll INF = 1000000000000000000; const ll mod = 1000000007; const ll MAX = 100000; struct edge { ll from, to, weight; edge(ll f, ll t, ll w) : from(f), to(t), weight(w) {} }; vector<vector<edge>> edges; vector<vector<ll>> graph; vector<bool> visited; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; ll n, m, r, answer; ll timer = 0; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n; priority_queue<pll, vector<pll>, greater<pll>> task; rep(i, n) { pll t; cin >> t.second; // 仕事にかかる時間 cin >> t.first; // 締め切り task.push(t); } bool flag = true; rep(i, n) { pll t = task.top(); task.pop(); if (timer + t.second <= t.first) { timer += t.second; // printf("完了後の時刻%lld 締め切り%lld\n", timer, t.first); } else { flag = false; break; } } if (flag) printf("Yes\n"); else printf("No\n"); }
[ "control_flow.break.add" ]
806,697
806,698
u915582296
cpp
p02996
#include <algorithm> #include <iostream> using namespace std; #define ll long long int main() { int n; scanf("%d", &n); pair<ll, ll> t[n]; for (int i = 0; i < n; i++) { scanf("%lld %lld", &t[i].second, &t[i].first); } sort(t, t + n); ll sum = 0; string ans = "YES"; for (int i = 0; i < n; i++) { sum += t[i].second; if (sum > t[i].first) { ans = "NO"; break; } } cout << ans << endl; }
#include <algorithm> #include <iostream> using namespace std; #define ll long long int main() { int n; scanf("%d", &n); pair<ll, ll> t[n]; for (int i = 0; i < n; i++) { scanf("%lld %lld", &t[i].second, &t[i].first); } sort(t, t + n); ll sum = 0; string ans = "Yes"; for (int i = 0; i < n; i++) { sum += t[i].second; if (sum > t[i].first) { ans = "No"; break; } } cout << ans << endl; }
[ "literal.string.change", "literal.string.case.change", "variable_declaration.value.change", "assignment.value.change" ]
806,699
806,700
u666641075
cpp
p02996
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll INF = 1e18; int main() { ll n; cin >> n; vector<P> v(n); rep(i, n) { ll a1, b1; cin >> a1 >> b1; v[i] = make_pair(b1, a1); } sort(v.begin(), v.end()); ll t = 0; rep(i, n) { t += v[i].second; if (t > v[i].first) { cout << "No"; break; } } cout << "Yes"; }
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll INF = 1e18; int main() { ll n; cin >> n; vector<P> v(n); rep(i, n) { ll a1, b1; cin >> a1 >> b1; v[i] = make_pair(b1, a1); } sort(v.begin(), v.end()); ll t = 0; rep(i, n) { t += v[i].second; if (t > v[i].first) { cout << "No"; return 0; } } cout << "Yes"; }
[ "control_flow.break.remove", "control_flow.return.add", "function.return_value.change" ]
806,703
806,704
u289381123
cpp
p02996
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int inf = 1001001001; int main() { int n; cin >> n; vector<pair<int, int>> p(n); rep(i, n) cin >> p[i].first >> p[i].second; sort(p.begin(), p.end()); int sum = 0; rep(i, n) { sum += p[i].first; if (sum > p[i].second) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int inf = 1001001001; int main() { int n; cin >> n; vector<pair<int, int>> p(n); rep(i, n) cin >> p[i].second >> p[i].first; sort(p.begin(), p.end()); int sum = 0; rep(i, n) { sum += p[i].second; if (sum > p[i].first) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; }
[ "expression.operation.binary.change", "assignment.value.change", "control_flow.branch.if.condition.change" ]
806,705
806,706
u886613668
cpp
p02996
#include <bits/stdc++.h> using namespace std; // Optimisations #pragma GCC target("avx2") #pragma GCC optimization("unroll-loops") #pragma GCC optimize("O2") // shortcuts for functions #define pb push_back #define mp make_pair #define ff first #define ss second #define all(v) v.begin(), v.end() #define prec(n) fixed << setprecision(n) #define n_l '\n' // make it python #define gcd __gcd #define append push_back #define str to_string // utility functions shortcuts #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define sswap(a, b) \ { \ a = a ^ b; \ b = a ^ b; \ a = a ^ b; \ } #define swap(a, b) \ { \ auto temp = a; \ a = b; \ b = temp; \ } #define init(dp) memset(dp, -1, sizeof(dp)); #define set0(dp) memset(dp, 0, sizeof(dp)); #define bits(x) __builtin_popcount(x) #define SORT(v) sort(all(v)) #define endl "\n" #define forr(i, n) for (ll i = 0; i < n; i++) // declaration shortcuts typedef long long int ll; #define int ll // Constants constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1}; constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1}; constexpr ll INF = 1999999999999999997; constexpr int inf = INT_MAX; constexpr int MAXSIZE = int(1e6) + 5; constexpr auto PI = 3.14159265358979323846L; constexpr auto oo = numeric_limits<int>::max() / 2 - 2; constexpr auto eps = 1e-6; constexpr auto mod = 1000000007; constexpr auto MOD = 1000000007; constexpr auto MOD9 = 1000000009; constexpr auto maxn = 100006; // void IOfile(){ // freopen(file_name, reade_mode, stdin); // freopen(file_name, write_mode, stdout); //} void fastio() { ios_base::sync_with_stdio(false); cin.tie(NULL); } int32_t main() { fastio(); int n; cin >> n; vector<pair<int, int>> v; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; v.push_back({b, a}); } sort(all(v)); int sum = -1; for (int i = 0; i < n; i++) { sum += v[i].ss; if (sum > v[i].ff) { cout << "No"; return 0; } } cout << "Yes"; }
#include <bits/stdc++.h> using namespace std; // Optimisations #pragma GCC target("avx2") #pragma GCC optimization("unroll-loops") #pragma GCC optimize("O2") // shortcuts for functions #define pb push_back #define mp make_pair #define ff first #define ss second #define all(v) v.begin(), v.end() #define prec(n) fixed << setprecision(n) #define n_l '\n' // make it python #define gcd __gcd #define append push_back #define str to_string // utility functions shortcuts #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define sswap(a, b) \ { \ a = a ^ b; \ b = a ^ b; \ a = a ^ b; \ } #define swap(a, b) \ { \ auto temp = a; \ a = b; \ b = temp; \ } #define init(dp) memset(dp, -1, sizeof(dp)); #define set0(dp) memset(dp, 0, sizeof(dp)); #define bits(x) __builtin_popcount(x) #define SORT(v) sort(all(v)) #define endl "\n" #define forr(i, n) for (ll i = 0; i < n; i++) // declaration shortcuts typedef long long int ll; #define int ll // Constants constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1}; constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1}; constexpr ll INF = 1999999999999999997; constexpr int inf = INT_MAX; constexpr int MAXSIZE = int(1e6) + 5; constexpr auto PI = 3.14159265358979323846L; constexpr auto oo = numeric_limits<int>::max() / 2 - 2; constexpr auto eps = 1e-6; constexpr auto mod = 1000000007; constexpr auto MOD = 1000000007; constexpr auto MOD9 = 1000000009; constexpr auto maxn = 100006; // void IOfile(){ // freopen(file_name, reade_mode, stdin); // freopen(file_name, write_mode, stdout); //} void fastio() { ios_base::sync_with_stdio(false); cin.tie(NULL); } int32_t main() { fastio(); int n; cin >> n; vector<pair<int, int>> v; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; v.push_back({b, a}); } sort(all(v)); int sum = 0; for (int i = 0; i < n; i++) { sum += v[i].ss; if (sum > v[i].ff) { cout << "No"; return 0; } } cout << "Yes"; }
[ "literal.number.change", "variable_declaration.value.change" ]
806,714
806,715
u397944802
cpp
p02996
#include <bits/stdc++.h> using namespace std; #define LL long long bool cmp(pair<int, int> a, pair<int, int> b) { return a.first < b.first; } int main() { ios::sync_with_stdio(0), cin.tie(0); int n, x, y; cin >> n; vector<pair<int, int>> v(n); for (int i = 0; i < n; i++) { cin >> x >> y; v.push_back({y, x}); } sort(v.begin(), v.end(), cmp); LL cur = 0; for (int i = 0; i < n; i++) { cur += v[i].second; if (cur > v[i].first) return cout << "No", 0; } cout << "Yes"; }
#include <bits/stdc++.h> using namespace std; #define LL long long bool cmp(pair<int, int> a, pair<int, int> b) { return a.first < b.first; } int main() { ios::sync_with_stdio(0), cin.tie(0); int n, x, y; cin >> n; vector<pair<int, int>> v; for (int i = 0; i < n; i++) { cin >> x >> y; v.push_back({y, x}); } sort(v.begin(), v.end(), cmp); LL cur = 0; for (int i = 0; i < n; i++) { cur += v[i].second; if (cur > v[i].first) return cout << "No", 0; } cout << "Yes"; }
[]
806,716
806,717
u280859559
cpp
p02996
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) cin >> a[i].second >> a[i].first; sort(a.begin(), a.end()); int cur = 0; for (int i = 0; i < n; i++) { cur += a[i].second; if (cur > a[i].first) { cout << "NO" << endl; return 0; } } cout << "Yes" << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) cin >> a[i].second >> a[i].first; sort(a.begin(), a.end()); int cur = 0; for (int i = 0; i < n; i++) { cur += a[i].second; if (cur > a[i].first) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
806,722
806,723
u543584809
cpp
p02996
#include <bits/stdc++.h> //#include <iomanip> #define hell 1000000007 #define M 1000000007 #define Maxi 10000000000000000 #define lcm(a, b) (a * b) / __gcd(a, b) #define ll long long #define vll vector<ll> #define vi vector<long long> #define pll vector<pair<ll, ll>> #define pb push_back //#define mp make_pair #define all(v) v.begin(), v.end() #define lbnd lower_bound #define ubnd upper_bound #define bs binary_search #define F first #define S second #define rep(i, a, b) for (i = a; i < b; i++) #define parr(a, n) \ for (i = 0; i < n; i++) \ cout << a[i] << " "; \ cout << endl; #define pcont(a) \ for (auto i : a) \ cout << i << " "; \ cout << endl; #define ret(x) return cout << x, 0; #define dbg(x) cout << #x << " is " << x << endl; #define endl '\n' // const ll infl=0x3f3f3f3f3f3f3f3fLL; #define pi 3.141592653589793238 // Debug // #define trace(x) cerr << #x << ": " << x << endl; #define trace1(x) cerr << #x << ": " << x << endl; #define trace2(x, y) \ cerr << #x << ": " << x << " | " << #y << ": " << y << endl; #define trace3(x, y, z) \ cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " \ << z << endl; #define trace4(a, b, c, d) \ cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << endl; #define trace5(a, b, c, d, e) \ cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl; #define trace6(a, b, c, d, e, f) \ cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \ << #f << ": " << f << endl; using namespace std; /*ll prime[1000006]; void fun() { for(ll i=2;i<=1000000;i++) { if(prime[i]==0) { for(ll j=i;j<=1000000;j+=i) { if(prime[j]==0) prime[j]=i; } } } }*/ /*const int MAXR = 1000005; ll cubic_root(ll x) { ll l = 0, r = MAXR; while (l != r) { ll m = (l + r + 1) / 2; if (m * m * m > x) r = m - 1; else l = m; } return l; }*/ /*ll power(ll x,ll y,ll m) { if (y == 0) return 1; ll p = power(x, y/2, m) % m; p = (p * p) % m; return (y%2 == 0)? p : (x * p) % m; }*/ /*bool checkprime(ll n) { ll i; if(n<=3) return true; if(n%2==0 || n%3==0) return false; for(i=5;i*i<=n;i+=6) { if(n%i==0 || n%(i+2)==0) return false; } return true; } ll check(ll n,ll b) { ll i,p=1,P=1,ans=1; if(n<3) return 0; for(i=1;i<=b;i++) { ans=ans*(n-i+1/i)%hell; } return ans; }*/ /*const int N = 1e6+1; ll prime[N]; //ll n; vector<ll>p; vector<int>ans; void sv() { for(int i=1;i<N;i++) prime[i]=1; for(int i=2;i*i<=N;i++) { if(prime[i]) { for(int j=i*i;j<N;j+=i) { prime[j]=0; } } } for(int i=2;i<N;i++) { if(prime[i]) p.pb(i); } return ; } */ /*void solve() { int n; cin>>n; sv(); for(auto i:p) { if(i>n) break; for(int j=1;pow(i,j)<=n;j++) ans.pb(pow(i,j)); } cout<<ans.size()<<endl; for(auto i:ans) cout<<i<<" "; cout<<endl; //cout<<"ef"<<endl; return ; }*/ /*ll m; long long fast_power(long long base, long long power) { long long result = 1; while(power > 0) { if(power % 2 == 1) { // Can also use (power & 1) to make code even faster result = (result*base) % m; } base = (base * base) % m; power = power / 2; // Can also use power >>= 1; to make code even faster } return result; }*/ int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin >> n; vector<pair<ll, ll>> v; ll i; for (i = 0; i < n; i++) { ll a, b; cin >> a >> b; v.pb({b, a}); } bool ok = true; sort(all(v)); for (i = 1; i < n; i++) { v[i].S += v[i - 1].S; } for (i = 0; i < n; i++) { if (v[i].S > v[i].F) { ok = false; break; } } if (ok) cout << "YES" << endl; else cout << "NO" << endl; }
#include <bits/stdc++.h> //#include <iomanip> #define hell 1000000007 #define M 1000000007 #define Maxi 10000000000000000 #define lcm(a, b) (a * b) / __gcd(a, b) #define ll long long #define vll vector<ll> #define vi vector<long long> #define pll vector<pair<ll, ll>> #define pb push_back //#define mp make_pair #define all(v) v.begin(), v.end() #define lbnd lower_bound #define ubnd upper_bound #define bs binary_search #define F first #define S second #define rep(i, a, b) for (i = a; i < b; i++) #define parr(a, n) \ for (i = 0; i < n; i++) \ cout << a[i] << " "; \ cout << endl; #define pcont(a) \ for (auto i : a) \ cout << i << " "; \ cout << endl; #define ret(x) return cout << x, 0; #define dbg(x) cout << #x << " is " << x << endl; #define endl '\n' // const ll infl=0x3f3f3f3f3f3f3f3fLL; #define pi 3.141592653589793238 // Debug // #define trace(x) cerr << #x << ": " << x << endl; #define trace1(x) cerr << #x << ": " << x << endl; #define trace2(x, y) \ cerr << #x << ": " << x << " | " << #y << ": " << y << endl; #define trace3(x, y, z) \ cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " \ << z << endl; #define trace4(a, b, c, d) \ cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << endl; #define trace5(a, b, c, d, e) \ cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl; #define trace6(a, b, c, d, e, f) \ cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \ << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " \ << #f << ": " << f << endl; using namespace std; /*ll prime[1000006]; void fun() { for(ll i=2;i<=1000000;i++) { if(prime[i]==0) { for(ll j=i;j<=1000000;j+=i) { if(prime[j]==0) prime[j]=i; } } } }*/ /*const int MAXR = 1000005; ll cubic_root(ll x) { ll l = 0, r = MAXR; while (l != r) { ll m = (l + r + 1) / 2; if (m * m * m > x) r = m - 1; else l = m; } return l; }*/ /*ll power(ll x,ll y,ll m) { if (y == 0) return 1; ll p = power(x, y/2, m) % m; p = (p * p) % m; return (y%2 == 0)? p : (x * p) % m; }*/ /*bool checkprime(ll n) { ll i; if(n<=3) return true; if(n%2==0 || n%3==0) return false; for(i=5;i*i<=n;i+=6) { if(n%i==0 || n%(i+2)==0) return false; } return true; } ll check(ll n,ll b) { ll i,p=1,P=1,ans=1; if(n<3) return 0; for(i=1;i<=b;i++) { ans=ans*(n-i+1/i)%hell; } return ans; }*/ /*const int N = 1e6+1; ll prime[N]; //ll n; vector<ll>p; vector<int>ans; void sv() { for(int i=1;i<N;i++) prime[i]=1; for(int i=2;i*i<=N;i++) { if(prime[i]) { for(int j=i*i;j<N;j+=i) { prime[j]=0; } } } for(int i=2;i<N;i++) { if(prime[i]) p.pb(i); } return ; } */ /*void solve() { int n; cin>>n; sv(); for(auto i:p) { if(i>n) break; for(int j=1;pow(i,j)<=n;j++) ans.pb(pow(i,j)); } cout<<ans.size()<<endl; for(auto i:ans) cout<<i<<" "; cout<<endl; //cout<<"ef"<<endl; return ; }*/ /*ll m; long long fast_power(long long base, long long power) { long long result = 1; while(power > 0) { if(power % 2 == 1) { // Can also use (power & 1) to make code even faster result = (result*base) % m; } base = (base * base) % m; power = power / 2; // Can also use power >>= 1; to make code even faster } return result; }*/ int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin >> n; vector<pair<ll, ll>> v; ll i; for (i = 0; i < n; i++) { ll a, b; cin >> a >> b; v.pb({b, a}); } bool ok = true; sort(all(v)); for (i = 1; i < n; i++) { v[i].S += v[i - 1].S; } for (i = 0; i < n; i++) { if (v[i].S > v[i].F) { ok = false; break; } } if (ok) cout << "Yes" << endl; else cout << "No" << endl; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
806,724
806,725
u964292132
cpp
p02996
#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); ++i) #define all(n) n.begin(), n.end() int main() { ios::sync_with_stdio(false); cin.tie(nullptr); // cout << fixed << setprecision(6); int n; cin >> n; vector<P> ba; rep(i, n) cin >> ba[i].second >> ba[i].first; sort(ba.rbegin(), ba.rend()); int time = ba[0].first; for (auto t : ba) { time = min(time, t.first); time -= t.second; if (time < 0) { cout << "No\n"; return 0; } } cout << "Yes\n"; return 0; }
#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); ++i) #define all(n) n.begin(), n.end() int main() { ios::sync_with_stdio(false); cin.tie(nullptr); // cout << fixed << setprecision(6); int n; cin >> n; vector<P> ba(n); rep(i, n) cin >> ba[i].second >> ba[i].first; sort(ba.rbegin(), ba.rend()); int time = ba[0].first; for (auto t : ba) { time = min(time, t.first); time -= t.second; if (time < 0) { cout << "No\n"; return 0; } } cout << "Yes\n"; return 0; }
[]
806,726
806,727
u959682820
cpp
p02996
#include <bits/stdc++.h> using namespace std; #define FOR(I, A, B) for (int I = (A); I < (B); ++I) typedef long long ll; typedef pair<int, int> P; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<P> ba(N); FOR(i, 0, N) { int a, b; cin >> a >> b; ba[i] = P(b, a); } sort(ba.begin(), ba.end()); int now = 0; FOR(i, 0, N) { int end = now + ba[i].second; if (end > ba[i].first) { cout << "NO" << endl; exit(0); } now = end; } cout << "YES" << endl; }
#include <bits/stdc++.h> using namespace std; #define FOR(I, A, B) for (int I = (A); I < (B); ++I) typedef long long ll; typedef pair<int, int> P; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<P> ba(N); FOR(i, 0, N) { int a, b; cin >> a >> b; ba[i] = P(b, a); } sort(ba.begin(), ba.end()); int now = 0; FOR(i, 0, N) { int end = now + ba[i].second; if (end > ba[i].first) { cout << "No" << endl; exit(0); } now = end; } cout << "Yes" << endl; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
806,728
806,729
u310790595
cpp
p02996
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1e9 + 7 #define mx 1000000000 #define endl '\n' int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; pair<int, int> arr[n]; ll sum = 0; for (int i = 0; i < n; i++) { cin >> arr[i].second >> arr[i].first; } sort(arr, arr + n); for (int i = 0; i < n; i++) { sum += arr[i].second; if (arr[i].first < sum) { cout << "NO"; return 0; } } cout << "YES"; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1e9 + 7 #define mx 1000000000 #define endl '\n' int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; pair<int, int> arr[n]; ll sum = 0; for (int i = 0; i < n; i++) { cin >> arr[i].second >> arr[i].first; } sort(arr, arr + n); for (int i = 0; i < n; i++) { sum += arr[i].second; if (arr[i].first < sum) { cout << "No"; return 0; } } cout << "Yes"; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
806,740
806,741
u760542644
cpp
p02996
#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>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { int n; cin >> n; vector<pair<int, int>> V(n); rep(i, n) { cin >> V.at(i).second; cin >> V.at(i).first; } bool ans = 1; sort(V.begin(), V.end()); int tim = 0; rep(i, n) { tim += V.at(i).first; if (!tim <= V.at(i).second) { ans = 0; break; } } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
#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>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { int n; cin >> n; vector<pair<int, int>> V(n); rep(i, n) { cin >> V.at(i).second; cin >> V.at(i).first; } bool ans = 1; sort(V.begin(), V.end()); int tim = 0; rep(i, n) { tim += V.at(i).second; if (!(tim <= V.at(i).first)) { ans = 0; break; } } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }
[ "assignment.value.change", "control_flow.branch.if.condition.change" ]
806,742
806,743
u028554976
cpp
p02996
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; vector<pair<ll, ll>> p(n); for (auto &i : p) cin >> i.second >> i.first; sort(p.begin(), p.end()); ll ans = 0; for (auto i : p) { ans += i.second; if (ans > i.first) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<pair<ll, ll>> p(n); for (auto &i : p) cin >> i.second >> i.first; sort(p.begin(), p.end()); ll ans = 0; for (auto i : p) { ans += i.second; if (ans > i.first) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }
[]
806,744
806,745
u526630579
cpp
p02996
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; const int mod = 1000000007; int gcd(ll a, ll b) { if (b == 0) { return a; } else { a = a % b; gcd(b, a); } } class mint { long long x; public: mint(long long x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint &a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint &a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint &a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint &a) const { mint res(*this); return res += a; } mint operator-(const mint &a) const { mint res(*this); return res -= a; } mint operator*(const mint &a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint &a) { return (*this) *= a.inv(); } mint operator/(const mint &a) const { mint res(*this); return res /= a; } friend ostream &operator<<(ostream &os, const mint &m) { os << m.x; return os; } }; int main() { ll N; cin >> N; vector<ll> A(N), B(N); vector<pair<ll, ll>> X; for (int i = 0; i < N; i++) { cin >> A[i] >> B[i]; } for (int i = 0; i < N; i++) { X.push_back(make_pair(B[i], A[i])); } sort(X.begin(), X.end()); ll sum = 0; for (int i = 0; i < N; i++) { sum += X[i].second; if (sum > X[i].first) { cout << "Np"; return 0; } } cout << "Yes"; }
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; const int mod = 1000000007; int gcd(ll a, ll b) { if (b == 0) { return a; } else { a = a % b; gcd(b, a); } } class mint { long long x; public: mint(long long x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint &a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint &a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint &a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint &a) const { mint res(*this); return res += a; } mint operator-(const mint &a) const { mint res(*this); return res -= a; } mint operator*(const mint &a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint &a) { return (*this) *= a.inv(); } mint operator/(const mint &a) const { mint res(*this); return res /= a; } friend ostream &operator<<(ostream &os, const mint &m) { os << m.x; return os; } }; int main() { ll N; cin >> N; vector<ll> A(N), B(N); vector<pair<ll, ll>> X; for (int i = 0; i < N; i++) { cin >> A[i] >> B[i]; } for (int i = 0; i < N; i++) { X.push_back(make_pair(B[i], A[i])); } sort(X.begin(), X.end()); ll sum = 0; for (int i = 0; i < N; i++) { sum += X[i].second; if (sum > X[i].first) { cout << "No"; return 0; } } cout << "Yes"; }
[ "literal.string.change", "io.output.change" ]
806,756
806,757
u272628953
cpp