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 <iostream> using namespace std; typedef long long LL; LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; } LL lcm(LL x, LL y) { return x / gcd(x, y) * y; } // |S| s.t. S = {x | 0<=x<m, x%a!=0,x%b!=0} LL f(LL m, LL a, LL b) { // cout << m/a << " " << m/b << " " << m/lcm(a,b) << endl; return m - (m / a + m / b - m / lcm(a, b)); } int main(void) { LL a, b, c, d; cin >> a >> b >> c >> d; cout << f(b + 1, c, d) - f(a, c, d) << endl; return 0; }
#include <iostream> using namespace std; typedef long long LL; LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; } LL lcm(LL x, LL y) { return x / gcd(x, y) * y; } // |S| s.t. S = {x | 0<=x<=m, x%a!=0,x%b!=0} LL f(LL m, LL a, LL b) { // cout << m/a << " " << m/b << " " << m/lcm(a,b) << endl; return m - (m / a + m / b - m / lcm(a, b)); } int main(void) { LL a, b, c, d; cin >> a >> b >> c >> d; cout << f(b, c, d) - f(a - 1, c, d) << endl; return 0; }
[ "expression.operation.binary.remove" ]
805,047
805,048
u023463844
cpp
p02995
#include <bits/stdc++.h> using namespace std; int count_baisu(int long long x, int long long A, int long long B) { // cout <<B/x - (A-1)/x <<endl; return B / x - (A - 1) / x; } int long long Gratest_Common_Deviser(int long long a, int long long b) { int long long r = b % a; while (r != 0) { b = a; a = r; r = b % a; } // cout << a; return a; } int long long Least_Common_Muliple(int long long a, int long long b) { // cout << a*b /Gratest_Common_Deviser(a,b); return a * b / Gratest_Common_Deviser(a, b); } int main() { int long long a, b, c, d; cin >> a >> b >> c >> d; int long long ans = 0; ans += b - a + 1; // cout << ans<<endl; ans -= count_baisu(c, a, b); ans -= count_baisu(d, a, b); ans += count_baisu(Least_Common_Muliple(c, d), a, b); cout << ans; }
#include <bits/stdc++.h> using namespace std; int long long count_baisu(int long long x, int long long A, int long long B) { // cout <<B/x - (A-1)/x <<endl; return B / x - (A - 1) / x; } int long long Gratest_Common_Deviser(int long long a, int long long b) { int long long r = b % a; while (r != 0) { b = a; a = r; r = b % a; } // cout << a; return a; } int long long Least_Common_Muliple(int long long a, int long long b) { // cout << a*b /Gratest_Common_Deviser(a,b); return a * b / Gratest_Common_Deviser(a, b); } int main() { int long long a, b, c, d; cin >> a >> b >> c >> d; int long long ans = 0; ans += b - a + 1; // cout << ans<<endl; ans -= count_baisu(c, a, b); ans -= count_baisu(d, a, b); ans += count_baisu(Least_Common_Muliple(c, d), a, b); cout << ans; }
[]
805,049
805,050
u260907804
cpp
p02995
#include <iostream> using namespace std; long long lcm(int a, int b) { long long x = a * b; /* 自然数 a > b を確認・入替 */ if (a < b) { long long tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ long long r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return x / b; } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long a, b; long long CD = lcm(C, D); A--; a = A - (A / C + A / D - A / CD); b = B - (B / C + B / D - B / CD); cout << b - a; }
#include <iostream> using namespace std; long long lcm(long long a, long long b) { long long x = a * b; /* 自然数 a > b を確認・入替 */ if (a < b) { long long tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ long long r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return x / b; } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long a, b; long long CD = lcm(C, D); A--; a = A - (A / C + A / D - A / CD); b = B - (B / C + B / D - B / CD); cout << b - a; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
805,060
805,061
u644568158
cpp
p02995
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, a, b) for (int i = a; i < (b); ++i) #define all(x) (x).begin(), (x).end() const int INF = 1000000007; typedef long long ll; using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } 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); } ll solve(ll a, ll c, ll d) { ll g = gcd(c, d); return a - a / c - a / d + a / g; } int main() { // ios::sync_with_stdio(false);cin.tie(nullptr); ll a, b, c, d; cin >> a >> b >> c >> d; cout << solve(b, c, d) - solve(a - 1, c, d) << endl; return 0; }
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, a, b) for (int i = a; i < (b); ++i) #define all(x) (x).begin(), (x).end() const int INF = 1000000007; typedef long long ll; using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } 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); } ll solve(ll a, ll c, ll d) { ll g = gcd(c, d); return a - a / c - a / d + a / (c / g * d); } int main() { // ios::sync_with_stdio(false);cin.tie(nullptr); ll a, b, c, d; cin >> a >> b >> c >> d; cout << solve(b, c, d) - solve(a - 1, c, d) << endl; return 0; }
[]
805,076
805,077
u820341516
cpp
p02995
#include <algorithm> #include <iostream> #include <vector> using namespace std; long long gcd(long long a, long long b); long long lcm(long long a, long long b); int main() { long long a, b, c, d; cin >> a >> b >> c >> d; a--; long long ansb = b; long long ansa = a; ansb -= b / c; ansb -= b / d; ansb += b / lcm(c, d); ansa -= a / c; ansa -= a / d; ansb += a / lcm(c, d); cout << ansb - ansa << endl; return 0; } long long gcd(long long a, long long b) { if (a < b) { long long t = a; a = b; b = t; } long long r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
#include <algorithm> #include <iostream> #include <vector> using namespace std; long long gcd(long long a, long long b); long long lcm(long long a, long long b); int main() { long long a, b, c, d; cin >> a >> b >> c >> d; a--; long long ansb = b; long long ansa = a; ansb -= b / c; ansb -= b / d; ansb += b / lcm(c, d); ansa -= a / c; ansa -= a / d; ansa += a / lcm(c, d); cout << ansb - ansa << endl; return 0; } long long gcd(long long a, long long b) { if (a < b) { long long t = a; a = b; b = t; } long long r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
[ "assignment.variable.change", "identifier.change" ]
805,081
805,082
u955202970
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long euc(long long x, long long y) { long long gcd; while (y >= 1) { if (y == 1) { gcd = 1; break; } if (y > x) { swap(x, y); } if (x % y == 0) { gcd = y; break; } else { x = x % y; } } return gcd; } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long E = C * D / euc(C, D); long long Cmin; A % C == 0 ? Cmin = A / C : Cmin = A / C + 1; long long Cmax = B / C; long long Dmin; A % D == 0 ? Dmin = A / C : Dmin = A / D + 1; long long Dmax = B / D; long long Emin; A % D == 0 ? Emin = A / E : Emin = A / E + 1; long long Emax = B / E; long long ans = B - A + 1 - (Cmax - Cmin + 1) - (Dmax - Dmin + 1) + (Emax - Emin + 1); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; long long euc(long long x, long long y) { long long gcd; while (y >= 1) { if (y == 1) { gcd = 1; break; } if (y > x) { swap(x, y); } if (x % y == 0) { gcd = y; break; } else { x = x % y; } } return gcd; } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long E = C * D / euc(C, D); long long Cmin; A % C == 0 ? Cmin = A / C : Cmin = A / C + 1; long long Cmax = B / C; long long Dmin; A % D == 0 ? Dmin = A / D : Dmin = A / D + 1; long long Dmax = B / D; long long Emin; A % E == 0 ? Emin = A / E : Emin = A / E + 1; long long Emax = B / E; long long ans = B - A + 1 - (Cmax - Cmin + 1) - (Dmax - Dmin + 1) + (Emax - Emin + 1); cout << ans << endl; }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change", "control_flow.loop.for.condition.change" ]
805,092
805,093
u342075214
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, C, D; cin >> A >> B >> C >> D; int64_t LCM, Cc = C, Dc = D, r; while (Cc % Dc != 0) { r = Cc % Dc; Cc = Dc, Dc = r; } LCM = C * D / r; int64_t ans_1 = B / C + B / D - B / LCM; int64_t ans_2 = (A - 1) / C + (A - 1) / D - (A - 1) / LCM; cout << (B - A + 1) - (ans_1 - ans_2) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, C, D; cin >> A >> B >> C >> D; int64_t LCM, Cc = C, Dc = D, r = Dc; while (Cc % Dc != 0) { r = Cc % Dc; Cc = Dc; Dc = r; } LCM = C * D / r; int64_t ans_1 = B / C + B / D - B / LCM; int64_t ans_2 = (A - 1) / C + (A - 1) / D - (A - 1) / LCM; cout << (B - A + 1) - (ans_1 - ans_2) << endl; }
[ "variable_declaration.value.change" ]
805,109
805,110
u227176034
cpp
p02995
#define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < n; i++) #include <bits/stdc++.h> #include <numeric> using namespace std; typedef long long ll; const int mod = 1e+9 + 7; int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll gcd = C / __gcd(C, D) * D; ll cok = B / C - A / C; if (A % C == 0) cok++; ll dok = B / D - A / D; if (A & D == 0) dok++; ll cdok = B / (gcd)-A / (gcd); if (A % (gcd) == 0) cdok++; ll ans = B - A + 1 - (cok + dok - cdok); cout << ans << endl; }
#define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < n; i++) #include <bits/stdc++.h> #include <numeric> using namespace std; typedef long long ll; const int mod = 1e+9 + 7; int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll gcd = C / __gcd(C, D) * D; ll cok = B / C - A / C; if (A % C == 0) cok++; ll dok = B / D - A / D; if (A % D == 0) dok++; ll cdok = B / (gcd)-A / (gcd); if (A % (gcd) == 0) cdok++; ll ans = B - A + 1 - (cok + dok - cdok); cout << ans << endl; }
[ "control_flow.branch.if.condition.change" ]
805,120
805,121
u138273120
cpp
p02995
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i)) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll INF = (1ll << 60); ll gcd(ll a, ll b) { ll tmp; ll c; if (a < b) { tmp = a; a = b; b = tmp; } do { c = a % b; a = b; b = c; } while (c != 0); return a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main(void) { ll a, b, c, d, e; cin >> a >> b >> c >> d; e = lcm(c, d); cout << (b - (b / c + b / d - b / e)) - (a - (((a - 1) / c + (a - 1) / d - (a - 1) / e))) << endl; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i)) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll INF = (1ll << 60); ll gcd(ll a, ll b) { ll tmp; ll c; if (a < b) { tmp = a; a = b; b = tmp; } do { c = a % b; a = b; b = c; } while (c != 0); return a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main(void) { ll a, b, c, d, e; cin >> a >> b >> c >> d; e = lcm(c, d); cout << (b - (b / c + b / d - b / e)) - (a - 1 - (((a - 1) / c + (a - 1) / d - (a - 1) / e))) << endl; }
[ "expression.operation.binary.add" ]
805,124
805,125
u880221923
cpp
p02995
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; ll GCD(ll a, ll b) { return (b > 0) ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return a / GCD(a, b) * b; } int main() { ll a, b; ll c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1; ans -= (b / c) - (a / c) + (a % c == 0); if (c != d) { ans -= (b / d) - (a / d) + (a % d == 0); ll e = LCM(c, d); ans += (b / e) - (a / e) - (a % e == 0); } cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; ll GCD(ll a, ll b) { return (b > 0) ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return a / GCD(a, b) * b; } int main() { ll a, b; ll c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1; ans -= (b / c) - (a / c) + (a % c == 0); if (c != d) { ans -= (b / d) - (a / d) + (a % d == 0); ll e = LCM(c, d); ans += (b / e) - (a / e) + (a % e == 0); } cout << ans << endl; }
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
805,126
805,127
u068713120
cpp
p02995
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; ll GCD(ll a, ll b) { return (b > 0) ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return a / GCD(a, b) * b; } int main() { ll a, b; ll c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1; ans -= (b / c) - (a / c) + (a % c == 0); if (c != d) { ans -= (b / d) - (a / d) + (a % d == 0); ll e = LCM(c, d); ans += (b / e) + (a / e) - (a % e == 0); } cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; ll GCD(ll a, ll b) { return (b > 0) ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return a / GCD(a, b) * b; } int main() { ll a, b; ll c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1; ans -= (b / c) - (a / c) + (a % c == 0); if (c != d) { ans -= (b / d) - (a / d) + (a % d == 0); ll e = LCM(c, d); ans += (b / e) - (a / e) + (a % e == 0); } cout << ans << endl; }
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
805,128
805,127
u068713120
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long g = c / __gcd(c, d) * d; long long ret = 0; ret = (b - a) + 1; // cout << g << endl; ret = ret - (b / c) - (b / d) + (b / g); // cout << ret << endl;; ret = ret + ((a - 1) / c) + ((a - 1) / d) - (a / g); cout << ret << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long g = c / __gcd(c, d) * d; long long ret = 0; ret = (b - a) + 1; // cout << g << endl; ret = ret - (b / c) - (b / d) + (b / g); // cout << ret << endl;; ret = ret + ((a - 1) / c) + ((a - 1) / d) - ((a - 1) / g); cout << ret << endl; }
[]
805,150
805,151
u383179205
cpp
p02995
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REPS(i, n) for (int i = 1; i <= (int)(n); i++) using namespace std; using ll = long long; using ld = long double; ll gcd(ll m, ll n) { ll tmp; while (m % n != 0) { tmp = n; n = m % n; m = tmp; } return n; } ll lcm(ll m, ll n) { return m * n / gcd(m, n); } int main(void) { ll A, B, C, D; cin >> A >> B >> C >> D; // CとDの最小公倍数を求める ll CD; CD = lcm(C, D); int divisors; divisors = (B / C + B / D - B / CD) - ((A - 1) / C + (A - 1) / D - (A - 1) / CD); cout << 1 + B - A - divisors << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REPS(i, n) for (int i = 1; i <= (int)(n); i++) using namespace std; using ll = long long; using ld = long double; ll gcd(ll m, ll n) { ll tmp; while (m % n != 0) { tmp = n; n = m % n; m = tmp; } return n; } ll lcm(ll m, ll n) { return m * n / gcd(m, n); } int main(void) { ll A, B, C, D; cin >> A >> B >> C >> D; // CとDの最小公倍数を求める ll CD; CD = lcm(C, D); ll divisors; divisors = (B / C + B / D - B / CD) - ((A - 1) / C + (A - 1) / D - (A - 1) / CD); cout << 1 + B - A - divisors << endl; }
[ "variable_declaration.type.change" ]
805,159
805,160
u986754154
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll int a, b, c, d; cin >> a >> b >> c >> d; ll int n = b - a + 1; ll int x1 = a / c; ll int y1 = b / c; ll int x2 = a / d; ll int y2 = b / d; ll int c1, c2, c3; if (x1 * y1 == 0 || a % c != 0) c1 = y1 - x1; else c1 = y1 - x1 + 1; if (x2 * y2 == 0 || a % d != 0) c2 = y2 - x2; else c2 = y2 - x2 + 1; int l = (c * d) / __gcd(c, d); ll int x3 = a / l; ll int y3 = b / l; if (x3 * y3 == 0 || a % l != 0) c3 = y3 - x3; else c3 = y3 - x3 + 1; cout << n - c1 - c2 + c3; }
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll int a, b, c, d; cin >> a >> b >> c >> d; ll int n = b - a + 1; ll int x1 = a / c; ll int y1 = b / c; ll int x2 = a / d; ll int y2 = b / d; ll int c1, c2, c3; if (x1 * y1 == 0 || a % c != 0) c1 = y1 - x1; else c1 = y1 - x1 + 1; if (x2 * y2 == 0 || a % d != 0) c2 = y2 - x2; else c2 = y2 - x2 + 1; ll int l = (c * d) / __gcd(c, d); ll int x3 = a / l; ll int y3 = b / l; if (x3 * y3 == 0 || a % l != 0) c3 = y3 - x3; else c3 = y3 - x3 + 1; cout << n - c1 - c2 + c3; }
[]
805,176
805,177
u294547216
cpp
p02995
#include <bits/stdc++.h> //#include <boost/math/common_factor.hpp> using namespace std; #define ll long long int #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define mod 1000000007 #define endl '\n' ll gcd(ll a, ll b) { for (;;) { if (a == 0) return b; b %= a; if (b == 0) return a; a %= b; } } ll lcm(ll a, ll b) { ll temp = gcd(a, b); return temp ? (a / temp * b) : 0; } int main() { fast ll a, b, c, d; cin >> a >> b >> c >> d; ll div = 0; div = div + (b / c) - ((a - 1) / c); // cout<<div<<endl; div = div + (b / d) - ((a - 1) / d); // cout<<div<<endl; // ll lcm=boost::math::lcm(a,b); ll lc = lcm(a, b); ll rep = 0; rep = rep + (b / lc) - ((a - 1) / lc); // cout<<div<<" "<<rep<<endl; cout << b - a + 1 - div + rep; #ifndef ONLINE_JUDGE cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif }
#include <bits/stdc++.h> //#include <boost/math/common_factor.hpp> using namespace std; #define ll long long int #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define mod 1000000007 #define endl '\n' ll gcd(ll a, ll b) { for (;;) { if (a == 0) return b; b %= a; if (b == 0) return a; a %= b; } } ll lcm(ll a, ll b) { ll temp = gcd(a, b); return temp ? (a / temp * b) : 0; } int main() { fast ll a, b, c, d; cin >> a >> b >> c >> d; ll div = 0; div = div + (b / c) - ((a - 1) / c); // cout<<div<<endl; div = div + (b / d) - ((a - 1) / d); // cout<<div<<endl; // ll lcm=boost::math::lcm(a,b); ll lc = lcm(c, d); ll rep = 0; rep = rep + (b / lc) - ((a - 1) / lc); // cout<<div<<" "<<rep<<endl; cout << b - a + 1 - div + rep; #ifndef ONLINE_JUDGE cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif }
[ "identifier.change", "call.arguments.change" ]
805,178
805,179
u734938632
cpp
p02995
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> using namespace std; long long gcd(long long n, long long m) { if (n % m == 0) { return m; } else { return gcd(m, n % m); } } long long lcm(long long n, long long m) { return n * m / gcd(n, m); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long A_div, B_div; A_div = (A - 1) / C + (A - 1) / D - (A - 1) / lcm(C, D); B_div = B / C + B / D - B / lcm(C, D); cout << (B - B_div) - (A - A_div) << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> using namespace std; long long gcd(long long n, long long m) { if (n % m == 0) { return m; } else { return gcd(m, n % m); } } long long lcm(long long n, long long m) { return n * m / gcd(n, m); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long A_div, B_div; A_div = (A - 1) / C + (A - 1) / D - (A - 1) / lcm(C, D); B_div = B / C + B / D - B / lcm(C, D); cout << (B - B_div) - ((A - 1) - A_div) << endl; }
[]
805,182
805,183
u323542775
cpp
p02995
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> using namespace std; long long gcd(long long n, long long m) { if (n % m == 0) { return m; } else { return gcd(m, n % m); } } long long lcm(long long n, long long m) { return n * m / gcd(n, m); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long A_div, B_div; A_div = (A - 1) / C + (A - 1) / D - (A - 1) / lcm(C, D); B_div = B / C + B / D + B / lcm(C, D); cout << (B - B_div) - (A - A_div) << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> using namespace std; long long gcd(long long n, long long m) { if (n % m == 0) { return m; } else { return gcd(m, n % m); } } long long lcm(long long n, long long m) { return n * m / gcd(n, m); } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long A_div, B_div; A_div = (A - 1) / C + (A - 1) / D - (A - 1) / lcm(C, D); B_div = B / C + B / D - B / lcm(C, D); cout << (B - B_div) - ((A - 1) - A_div) << endl; }
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
805,184
805,183
u323542775
cpp
p02995
#include <bits/stdc++.h> #define fastio() ios_base::sync_with_stdio(false); using namespace std; typedef long long ll; typedef long double ld; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll cntC = (b / c) - ((a - 1) / c); ll cntD = (b / d) - ((a - 1) / d); ll g = (c * d) / __gcd(c, d); ll cntG = (b / g) - (a / g); cout << 1 + b - a - (cntC + cntD - cntG) << endl; return 0; }
#include <bits/stdc++.h> #define fastio() ios_base::sync_with_stdio(false); using namespace std; typedef long long ll; typedef long double ld; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll cntC = (b / c) - ((a - 1) / c); ll cntD = (b / d) - ((a - 1) / d); ll g = (c * d) / __gcd(c, d); ll cntG = (b / g) - ((a - 1) / g); cout << 1 + b - a - (cntC + cntD - cntG) << endl; return 0; }
[]
805,189
805,190
u211631457
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, a, n) for (ll i = a; i < (ll)(n); i++) #define memi cout << endl #define kono(n) cout << fixed << setprecision(n) #define all(c) (c).begin(), (c).end() #define pb push_back #define hina cout << ' ' #define in(n) cin >> n #define in2(n, m) cin >> n >> m #define in3(n, m, l) cin >> n >> m >> l #define out(n) cout << n const ll mei = (ll)1e9 + 7; int main() { ll a, b, c, d, g, s, t, u; in2(a, b); in2(c, d); s = c; t = d; while (s > 0 && t > 0) { if (s > t) s = s % t; else t = t % s; if (s == 0) g = t; if (t == 0) g = s; } g = b * c / g; s = (a - 1) / c; s += (a - 1) / d; s -= (a - 1) / g; t = b / c; t += b / d; t -= b / g; u = t - s; out(b - a + 1 - u); memi; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, a, n) for (ll i = a; i < (ll)(n); i++) #define memi cout << endl #define kono(n) cout << fixed << setprecision(n) #define all(c) (c).begin(), (c).end() #define pb push_back #define hina cout << ' ' #define in(n) cin >> n #define in2(n, m) cin >> n >> m #define in3(n, m, l) cin >> n >> m >> l #define out(n) cout << n const ll mei = (ll)1e9 + 7; int main() { ll a, b, c, d, g, s, t, u; in2(a, b); in2(c, d); s = c; t = d; while (s > 0 && t > 0) { if (s > t) s = s % t; else t = t % s; if (s == 0) g = t; if (t == 0) g = s; } g = (d * c) / g; s = (a - 1) / c; s += (a - 1) / d; s -= (a - 1) / g; t = b / c; t += b / d; t -= b / g; u = t - s; out(b - a + 1 - u); memi; }
[ "assignment.value.change", "expression.operation.binary.change" ]
805,200
805,201
u917049698
cpp
p02995
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; using namespace std; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; a = a - 1; ll ans_a = 0; ll ans_b = 0; ans_b = b / c + b / d - b / lcm(c, d); ans_a = a / c + a / d - a / lcm(c, d); cout << a - b - ans_a + ans_b << endl; return 0; }
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; using namespace std; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; a = a - 1; ll ans_a = 0; ll ans_b = 0; ans_b = b / c + b / d - b / lcm(c, d); ans_a = a / c + a / d - a / lcm(c, d); cout << b - a - ans_b + ans_a << endl; return 0; }
[ "expression.operation.binary.remove" ]
805,206
805,207
u745267317
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long Euclid(long long x, long long y) { long long S = y % x; while (S != 0) { S = y % x; if (S == 0) return x; y = x; x = S; } return y; } int main(void) { long long A, B, C, D; cin >> A >> B >> C >> D; long long E = C * D / Euclid(C, D); cout << B - (B / C + B / D - B / E) - (A - 1 - ((A - 1) / C + (A - 1) / D - (A - 1) / E)) << endl; }
#include <bits/stdc++.h> using namespace std; long long Euclid(long long x, long long y) { long long S = y % x; while (x != 0) { S = y % x; if (S == 0) return x; y = x; x = S; } return 1; } int main(void) { long long A, B, C, D; cin >> A >> B >> C >> D; long long E = C * D / Euclid(C, D); cout << B - (B / C + B / D - B / E) - (A - 1 - ((A - 1) / C + (A - 1) / D - (A - 1) / E)) << endl; }
[ "identifier.change", "control_flow.loop.condition.change", "identifier.replace.remove", "literal.replace.add", "function.return_value.change" ]
805,208
805,209
u406634703
cpp
p02995
#include <bits/stdc++.h> #define ll long long using namespace std; ll a, b, c, d; inline ll read() { ll s = 0, w = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') w *= -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { s = s * 10 + ch - '0'; ch = getchar(); } return s * w; } inline ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; } inline void work() { a = read(), b = read(), c = read(), d = read(); ll lcm = c * d / gcd(c, d); printf("%lld\n", (b - a + 1) - (b / c - (a - 1) / c) - (b / d - (a - 1) / d) + (b / lcm - a / lcm)); } int main() { work(); return 0; }
#include <bits/stdc++.h> #define ll long long using namespace std; ll a, b, c, d; inline ll read() { ll s = 0, w = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') w *= -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { s = s * 10 + ch - '0'; ch = getchar(); } return s * w; } inline ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; } inline void work() { a = read(), b = read(), c = read(), d = read(); ll lcm = c * d / gcd(c, d); printf("%lld\n", (b - a + 1) - (b / c - (a - 1) / c) - (b / d - (a - 1) / d) + (b / lcm - (a - 1) / lcm)); } int main() { work(); return 0; }
[ "call.arguments.change" ]
805,211
805,212
u093420168
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll findLCD(ll X, ll Y) { ll g; ll A = max(X, Y); ll B = min(X, Y); ll iniA = A; ll iniB = B; if (A == B) g = A; else { if (A % B == 0) g = B; while (true) { g = A % B; A = B; B = g; if (A % B == 0) break; } } ll a = iniA / g; ll b = iniB / g; ll ans = a * b * g; return ans; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll whole = B - A + 1; ll ac = A / C; ll bc = B / C; ll canC = bc - ac; if (A % C == 0) canC++; ll ad = A / D; ll bd = B / D; ll canD = bd - ad; if (A % D == 0) canD++; ll LCD = findLCD(C, D); ll acd = A / LCD; ll bcd = B / LCD; ll canboth = bcd - acd; if (A % LCD == 0) canboth++; ll ans = whole - (canC + canD - canboth); // cout << canC << endl; // cout << canD << endl; // cout << canboth << endl; // cout << whole << endl; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll findLCD(ll X, ll Y) { ll g; ll A = max(X, Y); ll B = min(X, Y); ll iniA = A; ll iniB = B; if (A == B) g = A; else { if (A % B == 0) g = B; else { while (true) { g = A % B; A = B; B = g; if (A % B == 0) break; } } } ll a = iniA / g; ll b = iniB / g; ll ans = a * b * g; return ans; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll whole = B - A + 1; ll ac = A / C; ll bc = B / C; ll canC = bc - ac; if (A % C == 0) canC++; ll ad = A / D; ll bd = B / D; ll canD = bd - ad; if (A % D == 0) canD++; ll LCD = findLCD(C, D); ll acd = A / LCD; ll bcd = B / LCD; ll canboth = bcd - acd; if (A % LCD == 0) canboth++; ll ans = whole - (canC + canD - canboth); // cout << canC << endl; // cout << canD << endl; // cout << canboth << endl; // cout << whole << endl; cout << ans << endl; return 0; }
[ "control_flow.branch.else.add" ]
805,215
805,216
u241312295
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define sort(s) sort(s.begin(), s.end()) #define reverse(s) reverse(s.begin(), s.end()) #define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++) const ll mod = 1e9 + 7; //最大公約数 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最小公倍数 ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } //素数判定 bool isPrime(ll x) { ll i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1; } //桁和 int digsum(ll n) { int res = 0; while (n > 0) { res += n % 10; n /= 10; } return res; } //桁数 int dignum(ll n) { int res = 0; while (n > 0) { res++; n /= 10; } return res; } //文字列中の特定の文字カウント ll stringcount(string s, char c) { return count(s.cbegin(), s.cend(), c); } //階乗 ll ka(ll i) { ll res = 1; while (i > 0) { res = res * i; i--; } return res; } // ncr ll ncr(ll x, ll y) { ll a = x; ll b = 1; if (y > (x / 2)) { y = x - y; } for (ll i = 1; i < y; i++) { a *= x - i; b *= i + 1; } return a / b; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll x = b - (b / c + b / d) + b / lcm(c, d); ll y = (a - 1) - ((a - 1) / c + (a - 1) / d) + a / lcm(c, d); ll ans = x - y; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define sort(s) sort(s.begin(), s.end()) #define reverse(s) reverse(s.begin(), s.end()) #define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++) const ll mod = 1e9 + 7; //最大公約数 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最小公倍数 ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } //素数判定 bool isPrime(ll x) { ll i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1; } //桁和 int digsum(ll n) { int res = 0; while (n > 0) { res += n % 10; n /= 10; } return res; } //桁数 int dignum(ll n) { int res = 0; while (n > 0) { res++; n /= 10; } return res; } //文字列中の特定の文字カウント ll stringcount(string s, char c) { return count(s.cbegin(), s.cend(), c); } //階乗 ll ka(ll i) { ll res = 1; while (i > 0) { res = res * i; i--; } return res; } // ncr ll ncr(ll x, ll y) { ll a = x; ll b = 1; if (y > (x / 2)) { y = x - y; } for (ll i = 1; i < y; i++) { a *= x - i; b *= i + 1; } return a / b; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll x = b - (b / c + b / d) + b / lcm(c, d); ll y = (a - 1) - ((a - 1) / c + (a - 1) / d) + (a - 1) / lcm(c, d); ll ans = x - y; cout << ans << endl; }
[]
805,221
805,222
u584787460
cpp
p02995
#include <bits/stdc++.h> #define repeat(i, n) for (int(i) = 0; i < (n); i++) using namespace std; typedef long long ll; const double EPS = numeric_limits<double>::epsilon(); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) % b; } ll f(ll x, ll c, ll d) { ll result = x; result -= x / c; result -= x / d; result += x / lcm(c, d); return result; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll result = f(B, C, D) - f(A - 1, C, D); cout << result << endl; return 0; }
#include <bits/stdc++.h> #define repeat(i, n) for (int(i) = 0; i < (n); i++) using namespace std; typedef long long ll; const double EPS = numeric_limits<double>::epsilon(); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll f(ll x, ll c, ll d) { ll result = x; result -= x / c; result -= x / d; result += x / lcm(c, d); return result; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll result = f(B, C, D) - f(A - 1, C, D); cout << result << endl; return 0; }
[ "expression.operator.arithmetic.change", "function.return_value.change", "expression.operation.binary.change" ]
805,225
805,226
u822130495
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long int saisyou(long long int C, long long int D) { long long int LCM = (C * D) / __gcd(C, D); return LCM; } int main() { long long int A, B; long long int C, D; cin >> A >> B >> C >> D; long long int saisyo1 = B / saisyou(C, D); long long int c1 = B / C; // Cで割り切れる long long int d1 = B / D; // Dで割り切れる long long int ansm = B - (c1 + d1 - saisyo1); // CでもDでも割り切れない long long int saisyo2 = A / saisyou(C, D); long long int c2 = (A - 1) / C; long long int d2 = (A - 1) / D; long long int ansn = (A - 1) - (c2 + d2 - saisyo2); long long int ans = ansm - ansn; cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; long long int saisyou(long long int C, long long int D) { long long int LCM = (C * D) / __gcd(C, D); return LCM; } int main() { long long int A, B; long long int C, D; cin >> A >> B >> C >> D; long long int saisyo1 = B / saisyou(C, D); long long int c1 = B / C; // Cで割り切れる long long int d1 = B / D; // Dで割り切れる long long int ansm = B - (c1 + d1 - saisyo1); // CでもDでも割り切れない long long int saisyo2 = (A - 1) / saisyou(C, D); long long int c2 = (A - 1) / C; long long int d2 = (A - 1) / D; long long int ansn = (A - 1) - (c2 + d2 - saisyo2); long long int ans = ansm - ansn; cout << ans; return 0; }
[]
805,234
805,235
u231455327
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { long long int A, B; long int C, D; long long int c1, c2, c3, c4; // Taking input cin >> A >> B >> C >> D; c1 = B / C - A / C; c2 = B / D - A / D; // c3 : lcm of A & B c3 = (A * B) / __gcd(A, B); c4 = B / c3 - A / c3; if (A % C == 0) c1 += 1; if (A % D == 0) c2 += 1; if (A % c3 == 0) c4 += 1; cout << B - A + 1 - c1 - c2 + c4 << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int A, B; long int C, D; long long int c1, c2, c3, c4; // Taking input cin >> A >> B >> C >> D; c1 = B / C - A / C; c2 = B / D - A / D; // c3 : lcm of A & B c3 = (C * D) / __gcd(C, D); c4 = B / c3 - A / c3; if (A % C == 0) c1 += 1; if (A % D == 0) c2 += 1; if (A % c3 == 0) c4 += 1; cout << B - A + 1 - c1 - c2 + c4 << '\n'; // cout << "c1 : "<< c1 << "c2 : "<< c2 << "c4 : "<< c4 <<'\n'; return 0; }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change", "call.arguments.change" ]
805,253
805,254
u551519692
cpp
p02995
#include <bits/stdc++.h> using namespace std; long a, b, c, d; long gcd(long a, long b) { if (b == 0) return a; return gcd(b, a % b); } long lcm(long a, long b) { return a / gcd(a, b) * b; } long sub(long n) { return n - n / c - n / d + n / lcm(c, d); } int main() { cin >> a >> b >> c >> d; cout << sub(b + 1) - sub(a) << endl; }
#include <bits/stdc++.h> using namespace std; long a, b, c, d; long gcd(long a, long b) { if (b == 0) return a; return gcd(b, a % b); } long lcm(long a, long b) { return a / gcd(a, b) * b; } long sub(long n) { return n - n / c - n / d + n / lcm(c, d); } int main() { cin >> a >> b >> c >> d; cout << sub(b) - sub(a - 1) << endl; }
[ "expression.operation.binary.remove" ]
805,265
805,266
u993619636
cpp
p02995
#include <bits/stdc++.h> using namespace std; using ll = long long; ll f(ll x, ll d) { return x - x / d; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll x = f(b, c) - f(a - 1, c); ll y = f(b, d) - f(a - 1, d); ll g = __gcd(c, d); ll z = f(b, g) - f(a - 1, g); cout << x + y - z << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; ll f(ll x, ll d) { return x - x / d; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll x = f(b, c) - f(a - 1, c); ll y = f(b, d) - f(a - 1, d); ll g = c / __gcd(c, d) * d; ll z = f(b, g) - f(a - 1, g); cout << x + y - z << endl; }
[ "assignment.change" ]
805,267
805,268
u946322619
cpp
p02995
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <set> #include <string> #include <vector> #define mod 1000000007 #define ten5 100005 #define PI 3.1415926 using namespace std; long long int getGCD(long long int, long long int); int main() { // int m,n,o=0,i,j,k; long long int sum = 0, sum2 = 0, n1 = 0, n2 = 0, n3; double ans = 0.0, half; long long int m, n, o, i, j, k = 0, now = 0; long long int a, b, c, d, gcd, hcf; // float f,g,h; // char now,pre; cin >> a >> b >> c >> d; sum = b - a + 1; gcd = getGCD(c, d); hcf = c / gcd * d; n1 = (b) / c - (a - 1) / c; n2 = (b) / d - (a - 1) / c; n3 = (b) / hcf - (a - 1) / hcf; sum = sum - n1 - n2 + n3; cout << sum; return 0; } long long int getGCD(long long int m, long long int n) { if (n == 0) return m; else return getGCD(n, m % n); }
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <set> #include <string> #include <vector> #define mod 1000000007 #define ten5 100005 #define PI 3.1415926 using namespace std; long long int getGCD(long long int, long long int); int main() { // int m,n,o=0,i,j,k; long long int sum = 0, sum2 = 0, n1 = 0, n2 = 0, n3; double ans = 0.0, half; long long int m, n, o, i, j, k = 0, now = 0; long long int a, b, c, d, gcd, hcf; // float f,g,h; // char now,pre; cin >> a >> b >> c >> d; sum = b - a + 1; gcd = getGCD(c, d); hcf = c / gcd * d; n1 = (b) / c - (a - 1) / c; n2 = (b) / d - (a - 1) / d; n3 = (b) / hcf - (a - 1) / hcf; sum = sum - n1 - n2 + n3; cout << sum; return 0; } long long int getGCD(long long int m, long long int n) { if (n == 0) return m; else return getGCD(n, m % n); }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
805,271
805,272
u763410402
cpp
p02995
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = int(a); i < int(b); ++i) using namespace std; typedef long long ll; int INF = (1LL << 30) - 1; int MOD = 1e9 + 7; ll A, B, C, D; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll func(ll x) { return (x / C) + (x / D) - (x / lcm(C, D)); } main() { cin >> A >> B >> C >> D; cout << func(B) - func(A - 1) << endl; }
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = int(a); i < int(b); ++i) using namespace std; typedef long long ll; int INF = (1LL << 30) - 1; int MOD = 1e9 + 7; ll A, B, C, D; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll func(ll x) { return x - ((x / C) + (x / D) - (x / lcm(C, D))); } main() { cin >> A >> B >> C >> D; cout << func(B) - func(A - 1) << endl; }
[ "function.return_value.change" ]
805,275
805,276
u157322125
cpp
p02995
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; ll gcd(ll c, ll d) { return c ? gcd(c, d % c) : c; } ll lcm(ll c, ll d) { return (c / gcd(c, d) * d); } ll f(ll x, ll c, ll d) { ll res = x; res -= x / c; res -= x / d; res += x / lcm(c, d); return res; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = 0; ans = f(b, c, d) - f(a - 1, c, d); cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; ll gcd(ll c, ll d) { return d ? gcd(d, c % d) : c; } ll lcm(ll c, ll d) { return (c / gcd(c, d) * d); } ll f(ll x, ll c, ll d) { ll res = x; res -= x / c; res -= x / d; res += x / lcm(c, d); return res; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = 0; ans = f(b, c, d) - f(a - 1, c, d); cout << ans << endl; }
[ "identifier.change", "control_flow.loop.for.condition.change", "function.return_value.change", "call.arguments.change", "expression.operation.binary.change" ]
805,293
805,294
u147556624
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll b, ll c) { return c ? gcd(c, b % c) : b; } ll lcm(ll b, ll c) { return b / gcd(b, c) * c; } ll f(ll a, ll b, ll c) { ll ans = a; ans -= a / b; ans -= a / c; ans += a / lcm(b, c); return ans; } int main() { ll A, B, C, D; cin >> A, B, C, D; ll ans = f(B, C, D) - f(A - 1, C, D); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll b, ll c) { return c ? gcd(c, b % c) : b; } ll lcm(ll b, ll c) { return b / gcd(b, c) * c; } ll f(ll a, ll b, ll c) { ll ans = a; ans -= a / b; ans -= a / c; ans += a / lcm(b, c); return ans; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll ans = f(B, C, D) - f(A - 1, C, D); cout << ans << endl; }
[]
805,295
805,296
u147556624
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long ll; template <typename TypeInt> TypeInt G_C_D(TypeInt a, TypeInt b) { if (a < 0) a = -a; if (b < 0) b = -b; while (b != 0) { a %= b; if (a == 0) return b; b %= a; } return a; } template <typename TypeInt> TypeInt L_C_M(TypeInt a, TypeInt b) { if (a == 0 && b == 0) return 0; return a / G_C_D(a, b) * b; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll aqc = (A - 1) / C; ll aqd = (A - 1) / D; ll bqc = B / C; ll bqd = B / D; ll lcm = L_C_M(C, D); ll bqab = B / lcm; ll aqab = A / lcm; ll ans = B - A + 1 - (bqc - aqc) - (bqd - aqd) + (bqab - aqab); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long ll; template <typename TypeInt> TypeInt G_C_D(TypeInt a, TypeInt b) { if (a < 0) a = -a; if (b < 0) b = -b; while (b != 0) { a %= b; if (a == 0) return b; b %= a; } return a; } template <typename TypeInt> TypeInt L_C_M(TypeInt a, TypeInt b) { if (a == 0 && b == 0) return 0; return a / G_C_D(a, b) * b; } int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll aqc = (A - 1) / C; ll aqd = (A - 1) / D; ll bqc = B / C; ll bqd = B / D; ll lcm = L_C_M(C, D); ll bqab = B / lcm; ll aqab = (A - 1) / lcm; ll ans = B - A + 1 - (bqc - aqc) - (bqd - aqd) + (bqab - aqab); cout << ans << endl; }
[]
805,326
805,327
u981304949
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define what_is(x) cerr << #x << " is " << x << endl; #define what_is_v(x) \ cerr << #x << " is "; \ for (auto &e : (x)) \ cerr << e << ' '; \ cerr << '\n'; // vector, set #define what_is_a(x, n) \ cerr << #x << " is "; \ for (int i = 0; i < n; i++) \ cerr << x[i] << ' '; \ cerr << '\n'; // n first element of array #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define st first #define nd second #define cerr_pair(x) '{' << x.st << ", " << x.nd << '}' #define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl; #define pwhat_is_v(x) \ cerr << #x << " is "; \ for (auto &e : (x)) \ cerr << cerr_pair(e) << ' '; \ cerr << '\n'; // vector, set #define pwhat_is_a(x, n) \ cerr << #x << " is "; \ for (int i = 0; i < n; i++) \ cerr << cerr_pair(x[i]) << ' '; \ cerr << '\n'; // n first element of array #define endl '\n' #define int long long typedef pair<int, int> pii; const int N = 1e5 + 5; const int INF = 1e9; const int MOD = 1e9 + 7; int a, b, c, d; int cound_divisors(int n, int d) { return n / d; } int range_count(int l, int r, int d) { return cound_divisors(r, d) - cound_divisors(l - 1, d); } int32_t main() { IOS // freopen("input.txt", "r", stdin); cin >> a >> b >> c >> d; int lcm = (c * d) / __gcd(a, b); int ans = (b - a + 1) - range_count(a, b, c) - range_count(a, b, d) + range_count(a, b, lcm); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define what_is(x) cerr << #x << " is " << x << endl; #define what_is_v(x) \ cerr << #x << " is "; \ for (auto &e : (x)) \ cerr << e << ' '; \ cerr << '\n'; // vector, set #define what_is_a(x, n) \ cerr << #x << " is "; \ for (int i = 0; i < n; i++) \ cerr << x[i] << ' '; \ cerr << '\n'; // n first element of array #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define st first #define nd second #define cerr_pair(x) '{' << x.st << ", " << x.nd << '}' #define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl; #define pwhat_is_v(x) \ cerr << #x << " is "; \ for (auto &e : (x)) \ cerr << cerr_pair(e) << ' '; \ cerr << '\n'; // vector, set #define pwhat_is_a(x, n) \ cerr << #x << " is "; \ for (int i = 0; i < n; i++) \ cerr << cerr_pair(x[i]) << ' '; \ cerr << '\n'; // n first element of array #define endl '\n' #define int long long typedef pair<int, int> pii; const int N = 1e5 + 5; const int INF = 1e9; const int MOD = 1e9 + 7; int a, b, c, d; int cound_divisors(int n, int d) { return n / d; } int range_count(int l, int r, int d) { return cound_divisors(r, d) - cound_divisors(l - 1, d); } int32_t main() { IOS // freopen("input.txt", "r", stdin); cin >> a >> b >> c >> d; int lcm = (c * d) / __gcd(c, d); int ans = (b - a + 1) - range_count(a, b, c) - range_count(a, b, d) + range_count(a, b, lcm); cout << ans << endl; return 0; }
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
805,335
805,336
u411771230
cpp
p02995
#include <bits/stdc++.h> #include <iomanip> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef long l; typedef pair<int, int> P; const int INF = 100100100; const double PI = 3.141592653589; ll gcd(ll a, ll b) { if (a < b) swap(a, b); ll c = a % b; if (c == 0) return b; else return gcd(b, c); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = 0; ll f = gcd(c, d); f = f * (c / f) * (d / f); ans = (b - a + 1) - (b / c - a / c) - (b / d - a / d) + (b / f - a / f); // cout<<f<<endl; if (a % c == 0) ans -= 1; if (a % d == 0) ans -= 1; if (a / (c * d)) ans += 1; // cout<<(b-a+1)<<" "<<b/c-a/c<<" "<<b/d-a/d<<" "<<b/(c*d)-a/(c*d)<<endl; cout << ans << endl; return 0; }
#include <bits/stdc++.h> #include <iomanip> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef long l; typedef pair<int, int> P; const int INF = 100100100; const double PI = 3.141592653589; ll gcd(ll a, ll b) { if (a < b) swap(a, b); ll c = a % b; if (c == 0) return b; else return gcd(b, c); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = 0; ll f = gcd(c, d); f = f * (c / f) * (d / f); ans = (b - a + 1) - (b / c - a / c) - (b / d - a / d) + (b / f - a / f); // cout<<f<<endl; if (a % c == 0) ans -= 1; if (a % d == 0) ans -= 1; if (a % f == 0) ans += 1; // cout<<(b-a+1)<<" "<<b/c-a/c<<" "<<b/d-a/d<<" "<<b/(c*d)-a/(c*d)<<endl; cout << ans << endl; return 0; }
[]
805,342
805,340
u634999820
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; //最大公約数 long long x, y, gcd = 1; x = c; y = d; long long sw; if (y < x) { sw = x; x = y; y = sw; } vector<long long> gc(1000, 0); // xの約数 int count = 0; for (long long i = 1; i * i < x; i++) { if (x % i == 0) { count++; gc.at(count * 2) = i; gc.at(count * 2 + 1) = x / i; } } sort(gc.begin(), gc.end(), greater<long long>()); for (long long i = 0; i < gc.size(); i++) { if (y % gc.at(i) == 0) { gcd = gc.at(i); break; } } long long v = (c * d) / gcd; //個数判定 long long da, db; da = (a - 1) - ((a - 1) / c + (a - 1) / d - (a - 1) / v); // aの個数 db = b - (b / c + b / d - b / v); // bの個数 long long ans; ans = db - da; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; //最大公約数 long long x, y, gcd = 1; x = c; y = d; long long sw; if (y < x) { sw = x; x = y; y = sw; } vector<long long> gc(1000, 1); // xの約数 int count = 0; for (long long i = 1; i * i < x; i++) { if (x % i == 0) { count++; gc.at(count * 2) = i; gc.at(count * 2 + 1) = x / i; } } sort(gc.begin(), gc.end(), greater<long long>()); for (long long i = 0; i < gc.size(); i++) { if (y % gc.at(i) == 0) { gcd = gc.at(i); break; } } long long v = (c * d) / gcd; //個数判定 long long da, db; da = (a - 1) - ((a - 1) / c + (a - 1) / d - (a - 1) / v); // aの個数 db = b - (b / c + b / d - b / v); // bの個数 long long ans; ans = db - da; cout << ans << endl; }
[ "literal.number.change", "call.arguments.change" ]
805,346
805,347
u830237447
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long e = max(c, d); long long f = min(c, d); long long r = e % f; while (r != 0) { e = f; f = r; r = e % f; } int s = c * d / f; cout << fixed << setprecision(10); cout << b - a + 1 - (b / c - (a - 1) / c) - (b / d - (a - 1) / d) + (b / s - (a - 1) / s) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long e = max(c, d); long long f = min(c, d); long long r = e % f; while (r != 0) { e = f; f = r; r = e % f; } long long s = c * d / f; cout << fixed << setprecision(20); cout << b - a + 1 - (b / c - (a - 1) / c) - (b / d - (a - 1) / d) + (b / s - (a - 1) / s) << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "literal.number.change", "io.output.change" ]
805,355
805,356
u882039496
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll A, B; int C, D; cin >> A >> B >> C >> D; ll gcd_CD = C * D / __gcd(C, D); ll not_ans = (B / C - (A - 1) / C) + (B / D - (A - 1) / D) - (B / gcd_CD - (A - 1) / gcd_CD); cout << (B - A + 1) - not_ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll gcd_CD = C * D / __gcd(C, D); ll not_ans = (B / C - (A - 1) / C) + (B / D - (A - 1) / D) - (B / gcd_CD - (A - 1) / gcd_CD); cout << (B - A + 1) - not_ans << endl; return 0; }
[]
805,381
805,382
u476833465
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll A, B; int C, D; cin >> A >> B >> C >> D; int gcd_CD = C * D / __gcd(C, D); ll not_ans = (B / C - (A - 1) / C) + (B / D - (A - 1) / D) - (B / gcd_CD - (A - 1) / gcd_CD); cout << (B - A + 1) - not_ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll gcd_CD = C * D / __gcd(C, D); ll not_ans = (B / C - (A - 1) / C) + (B / D - (A - 1) / D) - (B / gcd_CD - (A - 1) / gcd_CD); cout << (B - A + 1) - not_ans << endl; return 0; }
[ "variable_declaration.type.change" ]
805,383
805,382
u476833465
cpp
p02995
#include <algorithm> #include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { long long g = gcd(a, b); return a / g * b; } int main() { long long int a, b, c, d; cin >> a >> b >> c >> d; cout << (b - (b / c + b / d - b / lcm(c, d))) - (a - 1 - ((a - 1) / c + (a - 1) / d - b / lcm(c, d))) << endl; }
#include <algorithm> #include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { long long g = gcd(a, b); return a / g * b; } int main() { long long int a, b, c, d; cin >> a >> b >> c >> d; cout << (b - (b / c + b / d - b / lcm(c, d))) - (a - 1 - ((a - 1) / c + (a - 1) / d - (a - 1) / lcm(c, d))) << endl; }
[ "io.output.change" ]
805,387
805,388
u530329977
cpp
p02995
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll a, b, c, d, tmp, x, hoge, r, tmpc, tmpd; cin >> a >> b >> c >> d; x = c * d; tmpc = c; tmpd = d; if (tmpc < tmpd) { tmp = tmpc; tmpc = tmpd; tmpd = tmp; } /* ユークリッドの互除法 */ r = tmpc % tmpd; while (r != 0) { tmpc = tmpd; tmpd = r; r = tmpc % tmpd; } hoge = x / tmpd; ll ans; ll huga = b / c - (a - 1) / c + b / d - (a - 1) / c - b / hoge + (a - 1) / hoge; ans = b - a - huga + 1; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll a, b, c, d, tmp, x, hoge, r, tmpc, tmpd; cin >> a >> b >> c >> d; x = c * d; tmpc = c; tmpd = d; if (tmpc < tmpd) { tmp = tmpc; tmpc = tmpd; tmpd = tmp; } /* ユークリッドの互除法 */ r = tmpc % tmpd; while (r != 0) { tmpc = tmpd; tmpd = r; r = tmpc % tmpd; } hoge = x / tmpd; ll ans; ll huga = b / c - (a - 1) / c + b / d - (a - 1) / d - b / hoge + (a - 1) / hoge; ans = b - a - huga + 1; cout << ans << endl; return 0; }
[ "identifier.change", "expression.operation.binary.change" ]
805,395
805,396
u364916333
cpp
p02995
/* _ _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ / _||||| -:- |||||_ \ | | \\\ - /'| | | | \_| `\`---'// |_/ | \ .-\__ `-. -'__/-. / ___`. .' /--.--\ `. .'___ ."" '< `.___\_<|>_/___.' _> \"". | | : `- \`. ;`. _/; .'/ / .' ; | \ \ `-. \_\_`. _.'_/_/ -' _.' / ===========`-.`___`-.__\ \___ /__.-'_.'_.-'================ Please give me AC. */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using int64 = long long; using uint64 = unsigned long long; using vi = vector<int>; using vl = vector<int64>; using pii = pair<int, int>; using pll = pair<int64, int64>; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define all(v) (v).begin(), (v).end() #define print(x) cout << (x) << '\n' #define print2(x, y) cout << (x) << ' ' << (y) << '\n' #define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n' #define printn(v) \ rep(i, (v).size() - 1) cout << (v)[i] << ' '; \ cout << (v)[n - 1] << '\n'; #define debug(x) cerr << #x << ": " << (x) << '\n' #define debug2(x, y) \ cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n' #define debug3(x, y, z) \ cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " \ << (z) << '\n' #define dbg(v) \ for (size_t _ = 0; _ < v.size(); ++_) { \ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; \ } // constant const int INF = (1 << 30) - 1; const int64 INF64 = (1LL << 62) - 1; // End of template. // x 以下の自然数でdで割り切れるものの個数 int64 f(int64 x, int64 d) { return x / d; } int64 gcd(int64 a, int64 b) { if (a < b) return gcd(b, a); int64 r; while ((r = a % b)) { a = b; b = r; } return b; } int64 lcm(int64 a, int64 b) { return a * b / gcd(a, b); } int main() { cout << fixed << setprecision(15); ios::sync_with_stdio(false); cin.tie(nullptr); int64 a, b, c, d; cin >> a >> b >> c >> d; a--; int64 y = b - (f(b, c) + f(b, d) - f(b, lcm(c, d))); int64 x = a - (f(a, c) + f(a, d) - f(b, lcm(c, d))); print(y - x); return 0; }
/* _ _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ / _||||| -:- |||||_ \ | | \\\ - /'| | | | \_| `\`---'// |_/ | \ .-\__ `-. -'__/-. / ___`. .' /--.--\ `. .'___ ."" '< `.___\_<|>_/___.' _> \"". | | : `- \`. ;`. _/; .'/ / .' ; | \ \ `-. \_\_`. _.'_/_/ -' _.' / ===========`-.`___`-.__\ \___ /__.-'_.'_.-'================ Please give me AC. */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using int64 = long long; using uint64 = unsigned long long; using vi = vector<int>; using vl = vector<int64>; using pii = pair<int, int>; using pll = pair<int64, int64>; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define all(v) (v).begin(), (v).end() #define print(x) cout << (x) << '\n' #define print2(x, y) cout << (x) << ' ' << (y) << '\n' #define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n' #define printn(v) \ rep(i, (v).size() - 1) cout << (v)[i] << ' '; \ cout << (v)[n - 1] << '\n'; #define debug(x) cerr << #x << ": " << (x) << '\n' #define debug2(x, y) \ cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n' #define debug3(x, y, z) \ cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " \ << (z) << '\n' #define dbg(v) \ for (size_t _ = 0; _ < v.size(); ++_) { \ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; \ } // constant const int INF = (1 << 30) - 1; const int64 INF64 = (1LL << 62) - 1; // End of template. // x 以下の自然数でdで割り切れるものの個数 int64 f(int64 x, int64 d) { return x / d; } int64 gcd(int64 a, int64 b) { if (a < b) return gcd(b, a); int64 r; while ((r = a % b)) { a = b; b = r; } return b; } int64 lcm(int64 a, int64 b) { return a * b / gcd(a, b); } int main() { cout << fixed << setprecision(15); ios::sync_with_stdio(false); cin.tie(nullptr); int64 a, b, c, d; cin >> a >> b >> c >> d; a--; int64 y = b - (f(b, c) + f(b, d) - f(b, lcm(c, d))); int64 x = a - (f(a, c) + f(a, d) - f(a, lcm(c, d))); print(y - x); return 0; }
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
805,397
805,398
u061984624
cpp
p02995
/* _ _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ / _||||| -:- |||||_ \ | | \\\ - /'| | | | \_| `\`---'// |_/ | \ .-\__ `-. -'__/-. / ___`. .' /--.--\ `. .'___ ."" '< `.___\_<|>_/___.' _> \"". | | : `- \`. ;`. _/; .'/ / .' ; | \ \ `-. \_\_`. _.'_/_/ -' _.' / ===========`-.`___`-.__\ \___ /__.-'_.'_.-'================ Please give me AC. */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using int64 = long long; using uint64 = unsigned long long; using vi = vector<int>; using vl = vector<int64>; using pii = pair<int, int>; using pll = pair<int64, int64>; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define all(v) (v).begin(), (v).end() #define print(x) cout << (x) << '\n' #define print2(x, y) cout << (x) << ' ' << (y) << '\n' #define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n' #define printn(v) \ rep(i, (v).size() - 1) cout << (v)[i] << ' '; \ cout << (v)[n - 1] << '\n'; #define debug(x) cerr << #x << ": " << (x) << '\n' #define debug2(x, y) \ cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n' #define debug3(x, y, z) \ cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " \ << (z) << '\n' #define dbg(v) \ for (size_t _ = 0; _ < v.size(); ++_) { \ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; \ } // constant const int INF = (1 << 30) - 1; const int64 INF64 = (1LL << 62) - 1; // End of template. // x 以下の自然数でdで割り切れるものの個数 int64 f(int64 x, int64 d) { return x / d; } int64 gcd(int64 a, int64 b) { if (a < b) return gcd(b, a); int64 r; while ((r = a % b)) { a = b; b = r; } return b; } int64 lcm(int64 a, int64 b) { return a * b / gcd(a, b); } int main() { cout << fixed << setprecision(15); ios::sync_with_stdio(false); cin.tie(nullptr); int64 a, b, c, d; cin >> a >> b >> c >> d; a--; int64 y = b - (f(b, c) + f(b, d) - f(b, lcm(c, d))); int64 x = a - (f(a, c) + f(a, d) - f(b, lcm(a, d))); print(y - x); return 0; }
/* _ _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ / _||||| -:- |||||_ \ | | \\\ - /'| | | | \_| `\`---'// |_/ | \ .-\__ `-. -'__/-. / ___`. .' /--.--\ `. .'___ ."" '< `.___\_<|>_/___.' _> \"". | | : `- \`. ;`. _/; .'/ / .' ; | \ \ `-. \_\_`. _.'_/_/ -' _.' / ===========`-.`___`-.__\ \___ /__.-'_.'_.-'================ Please give me AC. */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using int64 = long long; using uint64 = unsigned long long; using vi = vector<int>; using vl = vector<int64>; using pii = pair<int, int>; using pll = pair<int64, int64>; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define all(v) (v).begin(), (v).end() #define print(x) cout << (x) << '\n' #define print2(x, y) cout << (x) << ' ' << (y) << '\n' #define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n' #define printn(v) \ rep(i, (v).size() - 1) cout << (v)[i] << ' '; \ cout << (v)[n - 1] << '\n'; #define debug(x) cerr << #x << ": " << (x) << '\n' #define debug2(x, y) \ cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n' #define debug3(x, y, z) \ cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " \ << (z) << '\n' #define dbg(v) \ for (size_t _ = 0; _ < v.size(); ++_) { \ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; \ } // constant const int INF = (1 << 30) - 1; const int64 INF64 = (1LL << 62) - 1; // End of template. // x 以下の自然数でdで割り切れるものの個数 int64 f(int64 x, int64 d) { return x / d; } int64 gcd(int64 a, int64 b) { if (a < b) return gcd(b, a); int64 r; while ((r = a % b)) { a = b; b = r; } return b; } int64 lcm(int64 a, int64 b) { return a * b / gcd(a, b); } int main() { cout << fixed << setprecision(15); ios::sync_with_stdio(false); cin.tie(nullptr); int64 a, b, c, d; cin >> a >> b >> c >> d; a--; int64 y = b - (f(b, c) + f(b, d) - f(b, lcm(c, d))); int64 x = a - (f(a, c) + f(a, d) - f(a, lcm(c, d))); print(y - x); return 0; }
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
805,399
805,398
u061984624
cpp
p02995
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; int gcm(int a, int b) { //最大公約数を返す while (b != 0) { a = a % b; swap(a, b); } return a; }; int lcm(int a, int b) { //最小公倍数を返す int init_a = a, init_b = b; while (b != 0) { a = a % b; swap(a, b); } return init_a * init_b / a; }; int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll K = (B - B / C - B / D + B / lcm(C, D)); ll L = ((A - 1) - (A - 1) / C - (A - 1) / D + (A - 1) / lcm(C, D)); cout << K - L; return 0; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; int gcm(int a, int b) { //最大公約数を返す while (b != 0) { a = a % b; swap(a, b); } return a; }; ll lcm(ll a, ll b) { //最小公倍数を返す ll init_a = a, init_b = b; while (b != 0) { a = a % b; swap(a, b); } return init_a * init_b / a; }; int main() { ll A, B, C, D; cin >> A >> B >> C >> D; ll K = (B - B / C - B / D + B / lcm(C, D)); ll L = ((A - 1) - (A - 1) / C - (A - 1) / D + (A - 1) / lcm(C, D)); cout << K - L; return 0; }
[ "variable_declaration.type.change" ]
805,402
805,403
u982721693
cpp
p02995
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; #define MEM(a, b) memset((a), (b), sizeof(a)) const LL INF = 1e9 + 7; const int N = 2e3 + 10; LL gcd(LL a, LL b) { return b == 0 ? a : gcd(b, b % a); } LL solve(LL a, LL b, LL d) { return b / d - (a - 1) / d; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); LL a, b, c, d; cin >> a >> b >> c >> d; LL lcm = d / gcd(c, d) * c; cout << solve(a, b, 1) - solve(a, b, c) - solve(a, b, d) + solve(a, b, lcm) << endl; return 0; }
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; #define MEM(a, b) memset((a), (b), sizeof(a)) const LL INF = 1e9 + 7; const int N = 2e3 + 10; LL gcd(LL a, LL b) { return b == 0 ? a : gcd(b, a % b); } LL solve(LL a, LL b, LL d) { return b / d - (a - 1) / d; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); LL a, b, c, d; cin >> a >> b >> c >> d; LL lcm = d / gcd(c, d) * c; cout << solve(a, b, 1) - solve(a, b, c) - solve(a, b, d) + solve(a, b, lcm) << endl; return 0; }
[ "expression.operation.binary.remove" ]
805,409
805,410
u861345985
cpp
p02995
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; #define MEM(a, b) memset((a), (b), sizeof(a)) const LL INF = 1e9 + 7; const int N = 2e3 + 10; LL gcd(LL a, LL b) { return b == 0 ? a : gcd(b, b % a); } LL solve(LL a, LL b, LL d) { return b / d - (a - 1) / d; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); LL a, b, c, d; cin >> a >> b >> c >> d; LL lcm = d / gcd(c, d) * d; cout << solve(a, b, 1) - solve(a, b, c) - solve(a, b, d) + solve(a, b, lcm) << endl; return 0; }
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; #define MEM(a, b) memset((a), (b), sizeof(a)) const LL INF = 1e9 + 7; const int N = 2e3 + 10; LL gcd(LL a, LL b) { return b == 0 ? a : gcd(b, a % b); } LL solve(LL a, LL b, LL d) { return b / d - (a - 1) / d; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); LL a, b, c, d; cin >> a >> b >> c >> d; LL lcm = d / gcd(c, d) * c; cout << solve(a, b, 1) - solve(a, b, c) - solve(a, b, d) + solve(a, b, lcm) << endl; return 0; }
[ "expression.operation.binary.remove", "identifier.change", "expression.operation.binary.change" ]
805,411
805,410
u861345985
cpp
p02995
/* g++ -std=c++14 -O2 -Wall a.cpp -o a && a g++ -std=c++14 -O2 -Wall a.cpp -o a && a < in.txt > out.txt */ // io #include <iostream> //#include <fstream> //http://www.cplusplus.com/reference/fstream/fstream/ //#include <cstdio> #include <iomanip> //http://www.cplusplus.com/reference/iomanip/ #include <limits> // util #include <algorithm> #include <cstring> #include <string> //#include <utility> //#include <functional> //http://www.cplusplus.com/reference/functional/ //#include <cstdlib> #include <cmath> //#include <complex> //#include <random> //#include <bitset> // containers https://en.cppreference.com/w/cpp/container #include <queue> #include <set> #include <vector> //#include <map> //#include <unordered_set> //#include <unordered_map> // time //#include <ctime> //#include <chrono> // https://en.cppreference.com/w/cpp/header/chrono // http://www.cplusplus.com/reference/chrono/ using namespace std; typedef vector<int> arri; typedef vector<float> arrf; typedef pair<int, int> pairi; typedef long long ll; typedef long double ld; const int mod = 1e9 + 7; const ll inf = 0x7fffffffffffffff; const ll infneg = -0x7fffffffffffffff; // file input routed to stdinout /* std::ifineam inFile("input.txt"); std::ofineam outFile("output.txt"); std::cin.rdbuf(inFile.rdbuf()); std::cout.rdbuf(outFile.rdbuf()); */ ll lcm(ll &c, ll &d) { return ((c * d) / __gcd(c, d)); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll divs = (b / c - a / c) + (b / d - a / d); divs -= (b / lcm(c, d) - a / lcm(c, d)); cout << (b - a + 1) - divs; }
/* g++ -std=c++14 -O2 -Wall a.cpp -o a && a g++ -std=c++14 -O2 -Wall a.cpp -o a && a < in.txt > out.txt */ // io #include <iostream> //#include <fstream> //http://www.cplusplus.com/reference/fstream/fstream/ //#include <cstdio> #include <iomanip> //http://www.cplusplus.com/reference/iomanip/ #include <limits> // util #include <algorithm> #include <cstring> #include <string> //#include <utility> //#include <functional> //http://www.cplusplus.com/reference/functional/ //#include <cstdlib> #include <cmath> //#include <complex> //#include <random> //#include <bitset> // containers https://en.cppreference.com/w/cpp/container #include <queue> #include <set> #include <vector> //#include <map> //#include <unordered_set> //#include <unordered_map> // time //#include <ctime> //#include <chrono> // https://en.cppreference.com/w/cpp/header/chrono // http://www.cplusplus.com/reference/chrono/ using namespace std; typedef vector<int> arri; typedef vector<float> arrf; typedef pair<int, int> pairi; typedef long long ll; typedef long double ld; const int mod = 1e9 + 7; const ll inf = 0x7fffffffffffffff; const ll infneg = -0x7fffffffffffffff; // file input routed to stdinout /* std::ifineam inFile("input.txt"); std::ofineam outFile("output.txt"); std::cin.rdbuf(inFile.rdbuf()); std::cout.rdbuf(outFile.rdbuf()); */ ll lcm(ll &c, ll &d) { return ((c * d) / __gcd(c, d)); } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; a--; ll divs = (b / c - a / c) + (b / d - a / d); divs -= (b / lcm(c, d) - a / lcm(c, d)); cout << (b - a) - divs; }
[ "expression.unary.arithmetic.add", "expression.operation.binary.remove" ]
805,412
805,413
u027395921
cpp
p02995
#include <iostream> using namespace std; typedef long long LL; LL a, b, c, d; LL gcd(LL x, LL y) { if (x > y) { LL t = x; x = y; y = t; } if (x == 0) return y; return gcd(y % x, x); } int main() { cin >> a >> b >> c >> d; LL l = c * d / gcd(c, d); LL A = a - 1, B = b; A -= a / c; A -= a / d; A += a / l; B -= b / c; B -= b / d; B += b / l; cout << B - A << endl; return 0; }
#include <iostream> using namespace std; typedef long long LL; LL a, b, c, d; LL gcd(LL x, LL y) { if (x > y) { LL t = x; x = y; y = t; } if (x == 0) return y; return gcd(y % x, x); } int main() { cin >> a >> b >> c >> d; a--; LL l = c * d / gcd(c, d); LL A = a, B = b; A -= a / c; A -= a / d; A += a / l; B -= b / c; B -= b / d; B += b / l; cout << B - A << endl; return 0; }
[ "expression.unary.arithmetic.add", "expression.operation.binary.remove" ]
805,436
805,437
u047554023
cpp
p02995
#include <bits/stdc++.h> using namespace std; using S = set<long long>; using D = deque<long long>; using L = vector<long long>; using M = map<int, long long>; using A = vector<vector<long long>>; using Q = priority_queue<long long>; using U = unordered_map<int, long long>; // mapとの違いはkeyの順番を保持していない #define sorted(vector) sort(vector.begin(), vector.end()) // O(nlongn) #define vmin(vector) *min_element(vector.begin(), vector.end()) // O(N) #define vmax(vector) *max_element(vector.begin(), vector.end()) // O(N) #define vsum(vector) accumulate(vector.begin(), vector.end(), 0) // O(N) #define vcount(vector, a) count(vector.begin(), vector.end(), a) // O(N) #define bisect_left(vector, a) \ (lower_bound(vector.begin(), vector.end(), a) - vector.begin()) #define bisect_right(vector, a) \ (upper_bound(vector.begin(), vector.end(), a) - vector.begin()) #define vfind(vector, a) \ find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな //存在確認はmap!!!!!!!!!!!!!か配列に埋め込んでcontinueで回避 //__gcd(a,b)はコンパイラがGCC時のみ int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long a, b, c, d, x, y, z; cin >> a >> b >> c >> d; long long g = c * d / __gcd(c, d); x = b / c - (a - 1) / c; y = b / d - (a - 1) / d; z = (-a / g + b / g); cout << b - a - (x + y - z) + 1 << endl; }
#include <bits/stdc++.h> using namespace std; using S = set<long long>; using D = deque<long long>; using L = vector<long long>; using M = map<int, long long>; using A = vector<vector<long long>>; using Q = priority_queue<long long>; using U = unordered_map<int, long long>; // mapとの違いはkeyの順番を保持していない #define sorted(vector) sort(vector.begin(), vector.end()) // O(nlongn) #define vmin(vector) *min_element(vector.begin(), vector.end()) // O(N) #define vmax(vector) *max_element(vector.begin(), vector.end()) // O(N) #define vsum(vector) accumulate(vector.begin(), vector.end(), 0) // O(N) #define vcount(vector, a) count(vector.begin(), vector.end(), a) // O(N) #define bisect_left(vector, a) \ (lower_bound(vector.begin(), vector.end(), a) - vector.begin()) #define bisect_right(vector, a) \ (upper_bound(vector.begin(), vector.end(), a) - vector.begin()) #define vfind(vector, a) \ find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな //存在確認はmap!!!!!!!!!!!!!か配列に埋め込んでcontinueで回避 //__gcd(a,b)はコンパイラがGCC時のみ int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long a, b, c, d, x, y, z; cin >> a >> b >> c >> d; long long g = c * d / __gcd(c, d); x = b / c - (a - 1) / c; y = b / d - (a - 1) / d; z = (-(a - 1) / g + b / g); cout << b - a - (x + y - z) + 1 << endl; }
[]
805,457
805,458
u367130284
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define ll long long ll gcd(ll x, ll y) { ll r; while ((r = x % y) != 0) { x = y; y = r; } return y; } ll lcm(ll x, ll y) { x /= __gcd(x, y); // y /= gcd(x, y); return (x * y); } int main() { cin.tie(0); ios::sync_with_stdio(false); long long a, b, c, d; cin >> a >> b >> c >> d; long long aa = (a - 1) / c; long long bb = b / c; long long cc = (a - 1) / d; long long dd = b / d; long long e = lcm(c, d); long long ee = (a - 1) / e; long long eee = b / e; cout << (b - a) - (bb - aa) - (dd - cc) + (ee - eee) + 1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long ll gcd(ll x, ll y) { ll r; while ((r = x % y) != 0) { x = y; y = r; } return y; } ll lcm(ll x, ll y) { x /= gcd(x, y); // y /= gcd(x, y); return (x * y); } int main() { cin.tie(0); ios::sync_with_stdio(false); long long a, b, c, d; cin >> a >> b >> c >> d; long long aa = (a - 1) / c; long long bb = b / c; long long cc = (a - 1) / d; long long dd = b / d; long long e = lcm(c, d); long long ee = (a - 1) / e; long long eee = b / e; cout << (b - a) - (bb - aa) - (dd - cc) + (eee - ee) + 1 << endl; return 0; }
[ "assignment.value.change", "identifier.change", "call.function.change", "expression.operation.binary.remove" ]
805,461
805,462
u423624748
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define ll long long ll gcd(ll x, ll y) { ll r; while ((r = x % y) != 0) { x = y; y = r; } return y; } ll lcm(ll x, ll y) { x /= gcd(x, y); // y /= gcd(x, y); return (x * y); } int main() { cin.tie(0); ios::sync_with_stdio(false); long long a, b, c, d; cin >> a >> b >> c >> d; long long aa = (a - 1) / c; long long bb = b / c; long long cc = (a - 1) / d; long long dd = b / d; long long e = lcm(c, d); long long ee = (a - 1) / e; long long eee = b / e; cout << (b - a) - (bb - aa) - (dd - cc) + (ee - eee) + 1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long ll gcd(ll x, ll y) { ll r; while ((r = x % y) != 0) { x = y; y = r; } return y; } ll lcm(ll x, ll y) { x /= gcd(x, y); // y /= gcd(x, y); return (x * y); } int main() { cin.tie(0); ios::sync_with_stdio(false); long long a, b, c, d; cin >> a >> b >> c >> d; long long aa = (a - 1) / c; long long bb = b / c; long long cc = (a - 1) / d; long long dd = b / d; long long e = lcm(c, d); long long ee = (a - 1) / e; long long eee = b / e; cout << (b - a) - (bb - aa) - (dd - cc) + (eee - ee) + 1 << endl; return 0; }
[ "expression.operation.binary.remove" ]
805,463
805,462
u423624748
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define ll long long typedef pair<ll, ll> P; #define M 1000000007 ll lcm(ll a, ll b) { if (a < b) swap(a, b); return a % b ? lcm(b, a % b) : b; } ll gcd(ll a, ll b) { return a * b / lcm(a, b); } int main() { ll n, k, a, b; cin >> n >> k >> a >> b; cout << n - k + 1 - ((n / a - (k - 1) / a) + (n / b - (k - 1) / b) - (n / gcd(a, b) - (k - 1) / gcd(a, b))); }
#include <bits/stdc++.h> using namespace std; #define ll long long typedef pair<ll, ll> P; #define M 1000000007 ll lcm(ll a, ll b) { if (a < b) swap(a, b); return a % b ? lcm(b, a % b) : b; } ll gcd(ll a, ll b) { return a * b / lcm(a, b); } int main() { ll n, k, a, b; cin >> k >> n >> a >> b; cout << n - k + 1 - ((n / a - (k - 1) / a) + (n / b - (k - 1) / b) - (n / gcd(a, b) - (k - 1) / gcd(a, b))); }
[ "expression.operation.binary.remove" ]
805,470
805,471
u987476436
cpp
p02995
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <unordered_map> #include <vector> using namespace std; int lcm(long long x, long long y) { long long tmp, a, b; if (x > y) { b = x; a = y; } else { a = x; b = y; } while (a > 0) { tmp = a; a = b % a; b = tmp; } return x * y / b; } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long c_tmp = b / c - (a - 1) / c; long long d_tmp = b / d - (a - 1) / d; long long cd_tmp = b / lcm(c, d) - (a - 1) / lcm(c, d); cout << b - a + 1 - (c_tmp + d_tmp - cd_tmp) << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <unordered_map> #include <vector> using namespace std; long long lcm(long long x, long long y) { long long tmp, a, b; if (x > y) { b = x; a = y; } else { a = x; b = y; } while (a > 0) { tmp = a; a = b % a; b = tmp; } return x * y / b; } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long c_tmp = b / c - (a - 1) / c; long long d_tmp = b / d - (a - 1) / d; long long cd_tmp = b / lcm(c, d) - (a - 1) / lcm(c, d); cout << b - a + 1 - (c_tmp + d_tmp - cd_tmp) << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
805,480
805,481
u448407332
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; //ユークリッド互除法 long long p = min(c, d); long long q = max(c, d); long long r = q % p; while (r != 0) { q = p; p = r; r = q % p; } long long lcm_cd = c * d / q; // cとdの最小公倍数 long long num_m_c = b / c - (a - 1) / c; // cの倍数の数 long long num_m_d = b / d - (a - 1) / d; // dの倍数の数 long long num_m_cd = b / lcm_cd - (a - 1) / lcm_cd; // c,dの最小公倍数の数 long long ans = b - (a - 1) - (num_m_c + num_m_d - num_m_cd); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; //ユークリッド互除法 long long p = min(c, d); long long q = max(c, d); long long r = q % p; while (r != 0) { q = p; p = r; r = q % p; } long long lcm_cd = c * d / p; // cとdの最小公倍数 long long num_m_c = b / c - (a - 1) / c; // cの倍数の数 long long num_m_d = b / d - (a - 1) / d; // dの倍数の数 long long num_m_cd = b / lcm_cd - (a - 1) / lcm_cd; // c,dの最小公倍数の数 long long ans = b - (a - 1) - (num_m_c + num_m_d - num_m_cd); cout << ans << endl; }
[ "identifier.change", "expression.operation.binary.change" ]
805,492
805,493
u237713747
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); } ll lcd(ll a, ll b) { return (a / gcd(a, b) * b); } ll f(ll x, ll c, ll d) { ll ans = x; ans -= x / c; ans -= x / d; ans += x / lcd(c, d); return ans; } int main() { ll a, b; ll c, d; cin >> a >> b; cin >> c >> d; // cout << lcd(c,d) << endl ; cout << f(b, c, d) - f(a, c, d) << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); } ll lcd(ll a, ll b) { return (a / gcd(a, b) * b); } ll f(ll x, ll c, ll d) { ll ans = x; ans -= x / c; ans -= x / d; ans += x / lcd(c, d); return ans; } int main() { ll a, b; ll c, d; cin >> a >> b; cin >> c >> d; // cout << lcd(c,d) << endl ; cout << f(b, c, d) - f(a - 1, c, d) << endl; }
[ "expression.operation.binary.add" ]
805,496
805,497
u854161810
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(void) { ll a, b, count = 0; ll c, d; cin >> a >> b >> c >> d; if (c < d) swap(c, d); // for(ll i = (a - 1) / c + 1; i * c <= b; i++) // count++; // for(ll i = (a - 1) / d + 1; i * d <= b; i++) // count++; // // int x = c * d; // int r = c % d; // while(r != 0){ // c = d; // d = r; // r = c % d; // } // // for(ll i = (a - 1) / (x / d) + 1; i * (x / d) <= b; i++) // count--; // for(ll i = a; i <= b; i++){ // if(i % c != 0){ // if(i % d != 0){ // count++; // } // } // } count += b / c - (a - 1) / c; count += b / d - (a - 1) / d; ll x = c * d; ll r = c % d; while (r != 0) { c = d; d = r; r = c % d; } count -= b / (x / d) - a / (x / d); cout << b - a + 1 - count << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(void) { ll a, b, count = 0; ll c, d; cin >> a >> b >> c >> d; if (c < d) swap(c, d); // for(ll i = (a - 1) / c + 1; i * c <= b; i++) // count++; // for(ll i = (a - 1) / d + 1; i * d <= b; i++) // count++; // // int x = c * d; // int r = c % d; // while(r != 0){ // c = d; // d = r; // r = c % d; // } // // for(ll i = (a - 1) / (x / d) + 1; i * (x / d) <= b; i++) // count--; // for(ll i = a; i <= b; i++){ // if(i % c != 0){ // if(i % d != 0){ // count++; // } // } // } count += b / c - (a - 1) / c; count += b / d - (a - 1) / d; ll x = c * d; ll r = c % d; while (r != 0) { c = d; d = r; r = c % d; } count -= b / (x / d) - (a - 1) / (x / d); cout << b - a + 1 - count << endl; return 0; }
[]
805,500
805,501
u326152409
cpp
p02995
#include <bits/stdc++.h> #include <numeric> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { ll a, b; int c, d; cin >> a >> b >> c >> d; ll e = b / c - (a - 1) / c; ll f = b / d - (a - 1) / d; ll g = c * d / gcd(c, d); ll h = b / g - (a - 1) / g; cout << (b - a + 1) - (e + f - h) << endl; return 0; }
#include <bits/stdc++.h> #include <numeric> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int 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 e = b / c - (a - 1) / c; ll f = b / d - (a - 1) / d; ll g = c * d / gcd(c, d); ll h = b / g - (a - 1) / g; cout << (b - a + 1) - (e + f - h) << endl; return 0; }
[]
805,528
805,529
u374190629
cpp
p02995
#include <iostream> using namespace std; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } long long f1(long long X1, long long C1, long long D1) { long long G1 = GCD(C1, D1); long long L1 = C1 / G1 * D1; return X1 - X1 / C1 - X1 / D1 + X1 / L1; } int main() { int A, B, C, D; cin >> A >> B >> C >> D; cout << f1(B, C, D) - f1(A - 1, C, D) << endl; }
#include <iostream> using namespace std; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } long long f1(long long X1, long long C1, long long D1) { long long G1 = GCD(C1, D1); long long L1 = C1 / G1 * D1; return X1 - X1 / C1 - X1 / D1 + X1 / L1; } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; cout << f1(B, C, D) - f1(A - 1, C, D) << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
805,535
805,536
u506858457
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using vi = vector<int>; using vvi = vector<vector<int>>; int gcd(int a, int b) { if (a < b) swap(a, b); while (a % b != 0) { a = a % b; swap(a, b); } return b; } int main() { long a, b, c, d, e; cin >> a >> b >> c >> d; e = gcd(c, d); long anc = b / c - (a - 1) / c; long ant = b / d - (a - 1) / d; long ane = b / e - (a - 1) / e; cout << b - a + 1 - anc - ant + ane << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using vi = vector<int>; using vvi = vector<vector<int>>; int gcd(int a, int b) { if (a < b) swap(a, b); while (a % b != 0) { a = a % b; swap(a, b); } return b; } int main() { long a, b, c, d, e; cin >> a >> b >> c >> d; e = c * d / gcd(c, d); long anc = b / c - (a - 1) / c; long ant = b / d - (a - 1) / d; long ane = b / e - (a - 1) / e; cout << b - a + 1 - anc - ant + ane << endl; }
[ "assignment.change" ]
805,539
805,540
u422633119
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll c_count = 0, d_count = 0; c_count = (b) / c - (a - 1) / c; d_count = (b) / d - (a - 1) / d; ll gcd = d % c, kioku = c * d; while (gcd != 0) { d = c; c = gcd; gcd = d % c; } ll lcm = kioku / c; ll ans = b - a + 1 + (((b - 1) / lcm) - (a / lcm)) - (c_count + d_count); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll c_count = 0, d_count = 0; c_count = (b) / c - (a - 1) / c; d_count = (b) / d - (a - 1) / d; ll gcd = d % c, kioku = c * d; while (gcd != 0) { d = c; c = gcd; gcd = d % c; } ll lcm = kioku / c; ll ans = b - a + 1 + (((b) / lcm) - ((a - 1) / lcm)) - (c_count + d_count); cout << ans << endl; return 0; }
[ "expression.operation.binary.remove" ]
805,587
805,588
u843292252
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll c_count = 0, d_count = 0; c_count = (b) / c - (a - 1) / c; d_count = (b) / d - (a - 1) / d; ll gcd = d % c, kioku = c * d; while (gcd != 0) { d = c; c = gcd; gcd = d % c; } ll lcm = kioku / c; ll ans = b - a + 1 + ((b / lcm) - (a / lcm)) - (c_count + d_count); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll c_count = 0, d_count = 0; c_count = (b) / c - (a - 1) / c; d_count = (b) / d - (a - 1) / d; ll gcd = d % c, kioku = c * d; while (gcd != 0) { d = c; c = gcd; gcd = d % c; } ll lcm = kioku / c; ll ans = b - a + 1 + (((b) / lcm) - ((a - 1) / lcm)) - (c_count + d_count); cout << ans << endl; return 0; }
[]
805,589
805,588
u843292252
cpp
p02995
// template #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<long long, long long> LP; #define INF 999999999 #define MOD 1000000007 #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++) #define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define REP_IN(i, n, x) \ for (ll i = 0; i < n; i++) \ in >> x; #define REP_OUT(i, n, x) \ for (ll i = 0; i < n; i++) \ out << x << endl; #define ALL(v) v.begin(), v.end() #define SORT(v) sort(ALL(v)) #define UNIQUE(v) \ sort(ALL(v)); \ v.erase(unique(ALL(v)), v.end()); #define SIZE(x) ((ll)(x).size()) #define REVERSE(v) reverse(ALL(v)) // true / false #define BIN_SEARCH(v, a) binary_search(ALL(v), a) // index #define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin()) #define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin()) #define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a)) #define DEL(v, i) v.erase(v.begin() + i) #define INSERT(v, i, a) v.insert(v.begin() + i, a) ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; #define out cout #define in cin template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } // template end int main() { ios::sync_with_stdio(false); cin.tie(0); ll A, B, C, D, ans, ansA, ansB, CDgcd, CDlcm; in >> A >> B >> C >> D; CDlcm = lcm(C, D); ansA = (A - 1) - floor((A - 1) / C) - floor((A - 1) / D) + floor((A - 1) / CDlcm); ansB = B - floor(B / C) - floor(B / D) + floor(B / CDlcm); ans = ansB - ansA; out << ans << endl; // vector<ll> X(N); }
// template #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<long long, long long> LP; #define INF 999999999 #define MOD 1000000007 #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++) #define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define REP_IN(i, n, x) \ for (ll i = 0; i < n; i++) \ in >> x; #define REP_OUT(i, n, x) \ for (ll i = 0; i < n; i++) \ out << x << endl; #define ALL(v) v.begin(), v.end() #define SORT(v) sort(ALL(v)) #define UNIQUE(v) \ sort(ALL(v)); \ v.erase(unique(ALL(v)), v.end()); #define SIZE(x) ((ll)(x).size()) #define REVERSE(v) reverse(ALL(v)) // true / false #define BIN_SEARCH(v, a) binary_search(ALL(v), a) // index #define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin()) #define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin()) #define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a)) #define DEL(v, i) v.erase(v.begin() + i) #define INSERT(v, i, a) v.insert(v.begin() + i, a) ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; #define out cout #define in cin template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } // template end int main() { ios::sync_with_stdio(false); cin.tie(0); ll A, B, C, D, ans, ansA, ansB, CDgcd, CDlcm; in >> A >> B >> C >> D; CDlcm = lcm(C, D); ansA = (A - 1) - ((A - 1) / C) - ((A - 1) / D) + ((A - 1) / CDlcm); ansB = B - (B / C) - (B / D) + (B / CDlcm); ans = ansB - ansA; out << ans << endl; // vector<ll> X(N); }
[]
805,608
805,609
u703877026
cpp
p02995
#include <algorithm> #include <iostream> #define ll long long using namespace std; ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; int x = b / c + b / d - b / lcm(c, d); a--; int y = a / c + a / d - a / lcm(c, d); cout << (b - a) - (x - y) << endl; return 0; }
#include <algorithm> #include <iostream> #define ll long long using namespace std; 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 x = b / c + b / d - b / lcm(c, d); a--; ll y = a / c + a / d - a / lcm(c, d); cout << (b - a) - (x - y) << endl; return 0; }
[ "variable_declaration.type.change" ]
805,616
805,617
u412908746
cpp
p02995
#include <stdio.h> #include <stdlib.h> long int lcm(long int C, long int D); int main(void) { long int A, B, C, D, uni, L; scanf("%ld %ld %ld %ld", &A, &B, &C, &D); L = lcm(C, D); uni = B / C + B / D - B / L - (A - 1) / C - (A - 1) / D + (A - 1) / L; printf("%ld", B - A + 1 - uni); return 0; } long int lcm(long int C, long int D) { long int a, b, r; a = C; b = D; r = a % b; while (1) { if (r == 0) break; a = b; b = r; r = a % b; } return C * D * b; }
#include <stdio.h> #include <stdlib.h> long int lcm(long int C, long int D); int main(void) { long int A, B, C, D, uni, L; scanf("%ld %ld %ld %ld", &A, &B, &C, &D); L = lcm(C, D); uni = B / C + B / D - B / L - (A - 1) / C - (A - 1) / D + (A - 1) / L; printf("%ld", B - A + 1 - uni); return 0; } long int lcm(long int C, long int D) { long int a, b, r; a = C; b = D; r = a % b; while (1) { if (r == 0) break; a = b; b = r; r = a % b; } return C * D / b; }
[ "expression.operator.arithmetic.change", "function.return_value.change", "expression.operation.binary.change" ]
805,622
805,623
u651802048
cpp
p02995
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; long long lcm(long long x, long long y) { long long sum = x * y; long long tmp = x; long long i = y; long long ret; if (x > y) { tmp = y; i = x; } ret = i % tmp; while (ret != 0LL) { i = tmp; tmp = ret; ret = i % tmp; } return (sum / ret); } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long a_to = ((a - 1LL) / c) + ((a - 1LL) / d) - ((a - 1LL) / lcm(c, d)); long long b_to = (b / c) + (b / d) - (b / lcm(c, d)); long long ret = (b - a + 1LL) - (b_to - a_to); cout << ret << endl; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; long long lcm(long long x, long long y) { long long sum = x * y; long long tmp = x; long long i = y; long long ret; if (x > y) { tmp = y; i = x; } ret = i % tmp; while (ret != 0LL) { i = tmp; tmp = ret; ret = i % tmp; } return (sum / tmp); } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long a_to = ((a - 1LL) / c) + ((a - 1LL) / d) - ((a - 1LL) / lcm(c, d)); long long b_to = (b / c) + (b / d) - (b / lcm(c, d)); long long ret = (b - a + 1LL) - (b_to - a_to); cout << ret << endl; }
[ "identifier.change", "function.return_value.change", "expression.operation.binary.change" ]
805,624
805,625
u100586344
cpp
p02995
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; long long lcm(long long x, long long y) { long long sum = x * y; long long tmp = x; long long i = y; long long ret; if (x > y) { tmp = y; i = x; } ret = i % tmp; while (!ret != 0LL) { i = tmp; tmp = ret; ret = i % tmp; } return (sum / ret); } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long a_to = ((a - 1LL) / c) + ((a - 1LL) / d) - ((a - 1LL) / lcm(c, d)); long long b_to = (b / c) + (b / d) - (b / lcm(c, d)); long long ret = (b - a + 1LL) - (b_to - a_to); cout << ret << endl; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; long long lcm(long long x, long long y) { long long sum = x * y; long long tmp = x; long long i = y; long long ret; if (x > y) { tmp = y; i = x; } ret = i % tmp; while (ret != 0LL) { i = tmp; tmp = ret; ret = i % tmp; } return (sum / tmp); } int main() { long long a, b, c, d; cin >> a >> b >> c >> d; long long a_to = ((a - 1LL) / c) + ((a - 1LL) / d) - ((a - 1LL) / lcm(c, d)); long long b_to = (b / c) + (b / d) - (b / lcm(c, d)); long long ret = (b - a + 1LL) - (b_to - a_to); cout << ret << endl; }
[ "expression.operation.unary.logical.remove", "control_flow.loop.condition.change", "identifier.change", "function.return_value.change", "expression.operation.binary.change" ]
805,626
805,625
u100586344
cpp
p02995
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { int r; cin >> a >> b; if (b > a) { r = a; a = b; b = r; } while (1) { r = a % b; if (r == 0) break; a = b; b = r; } return b; } int main() { int64_t A, B, LCM, cnum = 0, dnum = 0, lcmnum = 0; int C, D, GCD; cin >> A >> B >> C >> D; GCD = gcd(C, D); LCM = C * D / GCD; cnum = B / C - (A - 1) / C; dnum = B / D - (A - 1) / D; lcmnum = B / LCM - (A - 1) / LCM; cout << B - A + 1 - (cnum + dnum - lcmnum) << endl; }
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { int r; cin >> a >> b; if (b > a) { r = a; a = b; b = r; } while (1) { r = a % b; if (r == 0) break; a = b; b = r; } return b; } int main() { int64_t A, B, LCM, cnum = 0, dnum = 0, lcmnum = 0, C, D, GCD; cin >> A >> B >> C >> D; GCD = gcd(C, D); LCM = C * D / GCD; cnum = B / C - (A - 1) / C; dnum = B / D - (A - 1) / D; lcmnum = B / LCM - (A - 1) / LCM; cout << B - A + 1 - (cnum + dnum - lcmnum) << endl; }
[]
805,627
805,628
u481581904
cpp
p02995
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d, cc = 0; cin >> a >> b >> c >> d; long long lcm, gcd; long long C = c, D = d, r; if (c > d) { C = d; D = c; } r = a % b; while (r != 0) { C = D; D = r; r = C % D; } gcd = D; lcm = (c * d) / gcd; cc += ((b / c) + (b / d) - (b / lcm)); cc -= (((a - 1) / c) + ((a - 1) / d) - ((a - 1) / lcm)); cc = (b - a + 1) - cc; cout << cc << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d, cc = 0; cin >> a >> b >> c >> d; long long lcm, gcd; long long C = c, D = d, r; if (c > d) { C = d; D = c; } r = C % D; while (r != 0) { C = D; D = r; r = C % D; } gcd = D; lcm = (c * d) / gcd; cc += ((b / c) + (b / d) - (b / lcm)); cc -= (((a - 1) / c) + ((a - 1) / d) - ((a - 1) / lcm)); cc = (b - a + 1) - cc; cout << cc << endl; }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
805,640
805,641
u477516105
cpp
p02995
#include <bits/stdc++.h> using namespace std; using int64 = long long; int64 gcd(int a, int b) { if (a < b) return gcd(b, a); int r = a % b; if (r == 0) return b; else return gcd(b, r); } int main() { int64 a, b, c, d; cin >> a >> b >> c >> d; int64 lcm = c * d * gcd(c, d); int64 ans = 0; auto f = [&](int64 x) { int64 val = 0; val += x; val -= x / c; val -= x / d; val += x / lcm; return val; }; ans += f(b); ans -= f(a - 1); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; using int64 = long long; int64 gcd(int64 a, int64 b) { if (a < b) return gcd(b, a); int64 r = a % b; if (r == 0) return b; else return gcd(b, r); } int main() { int64 a, b, c, d; cin >> a >> b >> c >> d; int64 lcm = c * d / gcd(c, d); // cout << "lcm: " << lcm << endl; int64 ans = 0; auto f = [&](int64 x) { int64 val = 0; val += x; val -= x / c; val -= x / d; val += x / lcm; return val; }; ans += f(b); ans -= f(a - 1); cout << ans << endl; }
[ "variable_declaration.type.change", "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
805,642
805,643
u771276542
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long a, b, c, d; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long lcm(long long a, long long b) { return a * b / gcd(a, b); } int main() { 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; }
#include <bits/stdc++.h> using namespace std; long long a, b, c, d; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long lcm(long long a, long long b) { return a * b / gcd(a, b); } int main() { 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.arguments.change", "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change", "io.output.change" ]
805,651
805,652
u713051936
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long a, b, c, d; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long lcm(long long a, long long b) { return a * b / gcd(a, b); } int main() { 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; }
#include <bits/stdc++.h> using namespace std; long long a, b, c, d; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long lcm(long long a, long long b) { return a * b / gcd(a, b); } int main() { 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.arguments.change" ]
805,653
805,652
u713051936
cpp
p02995
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <string> #include <vector> using namespace std; long long int gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } long long int solve(long long int n, long long int c, long long int d) { long long int c1 = n / c; long long int c2 = n / d; long long int gc = gcd(c, d); long long int lcm = c * d / gc; long long int c3 = n / lcm; return n - c1 - c2 + c3; } int main() { long long int a, b, c, d = 0; cin >> a >> b >> c >> d; cout << solve(b, c, d) - solve(a, c, d) << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <string> #include <vector> using namespace std; long long int gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } long long int solve(long long int n, long long int c, long long int d) { long long int c1 = n / c; long long int c2 = n / d; long long int gc = gcd(c, d); long long int lcm = c * d / gc; long long int c3 = n / lcm; return n - c1 - c2 + c3; } int main() { long long int a, b, c, d = 0; cin >> a >> b >> c >> d; cout << solve(b, c, d) - solve(a - 1, c, d) << endl; }
[ "expression.operation.binary.add" ]
805,674
805,675
u372177994
cpp
p02995
//前置き #pragma region #include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() #define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i) #define REP(i, n) FOR(i, 0, n) #define SORT(a) sort(all(a)) #define REVERSE(a) reverse(all(a)) #define PRINT(str) printf(#str "\n") #define yOUT PRINT(Yes) #define nOUT PRINT(No) #define YOUT PRINT(YES) #define NOUT PRINT(NO) bool EVEN(ll a); ll gcd(ll a, ll b); ll lcm(ll a, ll b); #pragma endregion int calc(ll a, ll b, ll x) { if (a % x == 0) return b / x - a / x + 1; else return b / x - a / x; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll e = lcm(c, d); ll cntc = calc(a, b, c), cntd = calc(a, b, d), cnte = calc(a, b, e); cout << b - a + 1 - (cntc + cntd - cnte) << endl; } //関数定義 #pragma region //偶数 -> true :: 奇数 -> false bool EVEN(ll a) { return a % 2 - 1; } //最大公約数 ll gcd(ll a, ll b) { if (!b) return a; return gcd(b, a % b); } //最小公倍数 ll lcm(ll a, ll b) { return a * b / gcd(a, b); } #pragma endregion
//前置き #pragma region #include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() #define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i) #define REP(i, n) FOR(i, 0, n) #define SORT(a) sort(all(a)) #define REVERSE(a) reverse(all(a)) #define PRINT(str) printf(#str "\n") #define yOUT PRINT(Yes) #define nOUT PRINT(No) #define YOUT PRINT(YES) #define NOUT PRINT(NO) bool EVEN(ll a); ll gcd(ll a, ll b); ll lcm(ll a, ll b); #pragma endregion ll calc(ll a, ll b, ll x) { if (a % x == 0) return b / x - a / x + 1; else return b / x - a / x; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll e = lcm(c, d); ll cntc = calc(a, b, c), cntd = calc(a, b, d), cnte = calc(a, b, e); cout << b - a + 1 - (cntc + cntd - cnte) << endl; } //関数定義 #pragma region //偶数 -> true :: 奇数 -> false bool EVEN(ll a) { return a % 2 - 1; } //最大公約数 ll gcd(ll a, ll b) { if (!b) return a; return gcd(b, a % b); } //最小公倍数 ll lcm(ll a, ll b) { return a * b / gcd(a, b); } #pragma endregion
[]
805,689
805,690
u833064541
cpp
p02995
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long double ld; typedef long long int ll; typedef unsigned long long int ull; typedef vector<int> vi; typedef vector<char> vc; typedef vector<string> vs; typedef vector<pair<int, int>> vpii; typedef vector<vector<int>> vvi; typedef vector<vector<char>> vvc; typedef vector<vector<string>> vvs; #define rep(i, n) for (i = 0; i < (n); ++i) #define rrep(i, n) for (i 1; i <= (n); ++i) #define drep(i, n) for (i(n) - 1; i >= 0; --i) #define fin(ans) cout << (ans) << endl #define P 1000000007 #define STI(s) atoi(s.c_str()) // string to int #define mp(p, q) make_pair(p, q) #define Sort(a) sort(a.begin(), a.end()) 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; } const int INF = INT_MAX; const long long LLINF = 1LL << 60; // g++ -std=c++1z main.cpp //./a.exe bool isPrime(int x) { int i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1; } 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; } int main(void) { ios::sync_with_stdio(false); cin.tie(0); ////////////////////////////////////////////////////// int a, b, c, d, n, e, f, l, h, i, j; cin >> a >> b >> c >> d; n = b - a + 1; if (a % c == 0) { e = b / c - a / c + 1; } else { e = b / c - a / c; } if (a % d == 0) { f = b / d - a / d + 1; } else { f = b / d - a / d; } l = lcm(c, d); if (a % l == 0) { h = b / l - a / l + 1; } else { h = b / l - a / l; } i = e + f - h; j = n - i; cout << j << endl; ////////////////////////////////////////////////////// return 0; }
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long double ld; typedef long long int ll; typedef unsigned long long int ull; typedef vector<int> vi; typedef vector<char> vc; typedef vector<string> vs; typedef vector<pair<int, int>> vpii; typedef vector<vector<int>> vvi; typedef vector<vector<char>> vvc; typedef vector<vector<string>> vvs; #define rep(i, n) for (i = 0; i < (n); ++i) #define rrep(i, n) for (i 1; i <= (n); ++i) #define drep(i, n) for (i(n) - 1; i >= 0; --i) #define fin(ans) cout << (ans) << endl #define P 1000000007 #define STI(s) atoi(s.c_str()) // string to int #define mp(p, q) make_pair(p, q) #define Sort(a) sort(a.begin(), a.end()) 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; } const int INF = INT_MAX; const long long LLINF = 1LL << 60; // g++ -std=c++1z main.cpp //./a.exe bool isPrime(int x) { int i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1; } 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; } int main(void) { ios::sync_with_stdio(false); cin.tie(0); ////////////////////////////////////////////////////// ll a, b, c, d, n, e, f, l, h, i, j; cin >> a >> b >> c >> d; n = b - a + 1; if (a % c == 0) { e = b / c - a / c + 1; } else { e = b / c - a / c; } if (a % d == 0) { f = b / d - a / d + 1; } else { f = b / d - a / d; } l = lcm(c, d); if (a % l == 0) { h = b / l - a / l + 1; } else { h = b / l - a / l; } i = e + f - h; j = n - i; cout << j << endl; ////////////////////////////////////////////////////// return 0; }
[ "variable_declaration.type.change" ]
805,691
805,692
u373984877
cpp
p02995
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; ll Pow(ll a, ll b, ll c) { ll ans = 1; a %= c; while (b) { if (b & 1) ans = (ans * a) % c; a = (a * a) % c; b >>= 1; } return (ans % c); } bool cmp(const int &a, const int &b) { return a < b; } ll gcd(ll x, ll y) { return x % y == 0 ? y : gcd(y, x % y); } ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } int main() { ll a, b, c, d; scanf("%lld%lld%lld%lld", &a, &b, &c, &d); ll tmp = lcm(c, d); ll t1 = b / c - (a - 1) / c; ll t2 = b / d - (a - 1) / d; ll t3 = b / tmp - (a - a) / tmp; printf("%lld\n", b - a + 1 - t1 - t2 + t3); return 0; }
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; ll Pow(ll a, ll b, ll c) { ll ans = 1; a %= c; while (b) { if (b & 1) ans = (ans * a) % c; a = (a * a) % c; b >>= 1; } return (ans % c); } bool cmp(const int &a, const int &b) { return a < b; } ll gcd(ll x, ll y) { return x % y == 0 ? y : gcd(y, x % y); } ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } int main() { ll a, b, c, d; scanf("%lld%lld%lld%lld", &a, &b, &c, &d); ll tmp = lcm(c, d); ll t1 = b / c - (a - 1) / c; ll t2 = b / d - (a - 1) / d; ll t3 = b / tmp - (a - 1) / tmp; printf("%lld\n", b - a + 1 - t1 - t2 + t3); return 0; }
[ "identifier.replace.remove", "literal.replace.add", "expression.operation.binary.change" ]
805,693
805,694
u337067848
cpp
p02995
#include <iostream> using namespace std; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { long long A, B, C, D, G; long long L; long long cnt; cin >> A >> B >> C >> D; G = GCD(A, B); L = C * D / G; A = A - 1; // cnt = (B - B / C - B / D + B / L)-((A-1)- (A - 1)/C-(A-1)/D+(A-1)/L); cnt = (B - B / C - B / D + B / L) - (A - A / C - A / D + A / L); cout << cnt << endl; return 0; }
#include <iostream> using namespace std; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { long long A, B, C, D, G; long long L; long long cnt; cin >> A >> B >> C >> D; G = GCD(C, D); L = C * D / G; A = A - 1; // cnt = (B - B / C - B / D + B / L)-((A-1)- (A - 1)/C-(A-1)/D+(A-1)/L); cnt = (B - B / C - B / D + B / L) - (A - A / C - A / D + A / L); cout << cnt << endl; return 0; }
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
805,701
805,702
u372187342
cpp
p02995
#include <algorithm> #include <iostream> #include <numeric> #include <vector> using namespace std; long long int gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } int lcm(long long int a, long long int b) { return a * b / gcd(a, b); } int main() { long long int a, b, c, d; long long int num1, num2, num3; long long int num4, num5, num6; long long int ans; cin >> a >> b >> c >> d; num1 = (a - 1) / c; num2 = (a - 1) / d; num3 = (a - 1) / lcm(c, d); num4 = b / c; num5 = b / d; num6 = b / lcm(c, d); // cout << num1 << num2 << num3 << num4 << num5 << num6 <<endl; ans = (b - a + 1) - (num4 + num5 - num6) + (num1 + num2 - num3); cout << ans << endl; return 0; } // o o o // 4 5 6 7 8 9 // 4 5 // 4 5 6 // 4 5 6 7 8 9 10 // 5 6 7 8 9 10 11 9 10 11 12 13 14 15 // 2 4 // 3 1 0 // 7-4 // o o o // 10 11 12 13 14 15 16 17 18 19 20
#include <algorithm> #include <iostream> #include <numeric> #include <vector> using namespace std; long long int gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } long long int lcm(long long int a, long long int b) { return a * b / gcd(a, b); } int main() { long long int a, b, c, d; long long int num1, num2, num3; long long int num4, num5, num6; long long int ans; cin >> a >> b >> c >> d; num1 = (a - 1) / c; num2 = (a - 1) / d; num3 = (a - 1) / lcm(c, d); num4 = b / c; num5 = b / d; num6 = b / lcm(c, d); // cout << num1 << num2 << num3 << num4 << num5 << num6 <<endl; ans = (b - a + 1) - (num4 + num5 - num6) + (num1 + num2 - num3); cout << ans << endl; return 0; } // o o o // 4 5 6 7 8 9 // 4 5 // 4 5 6 // 4 5 6 7 8 9 10 // 5 6 7 8 9 10 11 9 10 11 12 13 14 15 // 2 4 // 3 1 0 // 7-4 // o o o // 10 11 12 13 14 15 16 17 18 19 20
[ "variable_declaration.type.widen.change" ]
805,707
805,708
u552004736
cpp
p02995
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; #define dame \ { \ puts("-1"); \ return 0; \ } #define yn \ { puts("Yes"); } \ else { \ puts("No"); \ } // long version long long int GCD(long long int x, long long int y) { if (x > y) { long long int swap = x; x = y; y = swap; } while (true) { if (y % x == 0) { return x; } else { long long int amari = y % x; y = x; x = amari; } } } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1 - (b / c - (a - 1) / c) + (b / d - (a - 1) / d) + b / (c * d / GCD(c, d)) - (a - 1) / (c * d / GCD(c, d)); cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; #define dame \ { \ puts("-1"); \ return 0; \ } #define yn \ { puts("Yes"); } \ else { \ puts("No"); \ } // long version long long int GCD(long long int x, long long int y) { if (x > y) { long long int swap = x; x = y; y = swap; } while (true) { if (y % x == 0) { return x; } else { long long int amari = y % x; y = x; x = amari; } } } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1 - (b / c - (a - 1) / c) - (b / d - (a - 1) / d) + b / (c * d / GCD(c, d)) - (a - 1) / (c * d / GCD(c, d)); cout << ans << endl; return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
805,709
805,710
u791593901
cpp
p02995
#include <bits/stdc++.h> using namespace std; int gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } int main() { long long A, B, C, D; int count = 0; cin >> A >> B >> C >> D; count = B / C - (A - 1) / C; count += B / D - (A - 1) / D; count -= B / lcm(D, C) - (A - 1) / lcm(D, C); cout << B - A + 1 - count << endl; // LONG Problem }
#include <bits/stdc++.h> using namespace std; int gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } int main() { long long A, B, C, D; long long count = 0; cin >> A >> B >> C >> D; count = B / C - (A - 1) / C; count += B / D - (A - 1) / D; count -= B / lcm(D, C) - (A - 1) / lcm(D, C); cout << B - A + 1 - count << endl; // LONG Problem }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
805,711
805,712
u792521295
cpp
p02995
#include <bits/stdc++.h> using namespace std; using lint = long long; template <class T = int> using V = vector<T>; template <class T = int> using VV = V<V<T>>; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int a, b, c, d; cin >> a >> b >> c >> d; int e; e = c * d / __gcd(c, d); int kekka1; kekka1 = b - b / c - b / d - b / e; int kekka2; if (a == 1) kekka2 = 0; else kekka2 = (a - 1) - (a - 1) / c - (a - 1) / d - (a - 1) / e; cout << kekka1 - kekka2 << '\n'; }
#include <bits/stdc++.h> using namespace std; using lint = long long; template <class T = int> using V = vector<T>; template <class T = int> using VV = V<V<T>>; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); lint a, b, c, d; cin >> a >> b >> c >> d; lint e; e = c * d / __gcd(c, d); lint kekka1; kekka1 = b - b / c - b / d + b / e; lint kekka2; if (a == 1) kekka2 = 0; else kekka2 = (a - 1) - (a - 1) / c - (a - 1) / d + (a - 1) / e; cout << kekka1 - kekka2 << '\n'; }
[ "variable_declaration.type.change", "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
805,718
805,719
u853585082
cpp
p02995
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; long func(long x, long y) { long r = y % x, tmpgcd; while (r != 0) { y = x; x = r; r = y % x; } tmpgcd = x; return tmpgcd; } int main() { long a, b, c, d; std::cin >> a >> b >> c >> d; long sum = b - a + 1; // std::cout << sum << std::endl; long lcm = a * b / func(a, b); // std::cout << lcm << std::endl; long sumc = (b / c) - ((a - 1) / c); long sumd = (b / d) - ((a - 1) / d); long candd = (b / lcm) - ((a - 1) / lcm); /* std::cout << sumc << std::endl; std::cout << sumd << std::endl; std::cout << candd << std::endl; */ long ans = sum - sumc - sumd + candd; std::cout << ans << std::endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; long func(long x, long y) { long r = y % x, tmpgcd; while (r != 0) { y = x; x = r; r = y % x; } tmpgcd = x; return tmpgcd; } int main() { long a, b, c, d; std::cin >> a >> b >> c >> d; long sum = b - a + 1; // std::cout << sum << std::endl; long lcm = c * d / func(c, d); // std::cout << lcm << std::endl; long sumc = (b / c) - ((a - 1) / c); long sumd = (b / d) - ((a - 1) / d); long candd = (b / lcm) - ((a - 1) / lcm); /* std::cout << sumc << std::endl; std::cout << sumd << std::endl; std::cout << candd << std::endl; */ long ans = sum - sumc - sumd + candd; std::cout << ans << std::endl; return 0; }
[ "identifier.change", "expression.operation.binary.change", "call.arguments.change" ]
805,722
805,723
u832726997
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define rep(i, s, n) for (int i = (int)s; i < (int)n; i++) #define ll long long int main() { ll A, B; int C, D; cin >> A >> B >> C >> D; int gcd = __gcd(C, D); ll lcm = C * D / gcd; ll a = A - 1; ll r = B - (ll)(B / C) - (ll)(B / D) + (ll)(B / lcm); ll l = a - (ll)(a / C) - (ll)(a / D) + (ll)(a / lcm); ll ans = r - l; cout << ans << endl; };
#include <bits/stdc++.h> using namespace std; #define rep(i, s, n) for (int i = (int)s; i < (int)n; i++) #define ll long long int main() { ll A, B, C, D; cin >> A >> B >> C >> D; int gcd = __gcd(C, D); ll lcm = C * D / gcd; ll a = A - 1; ll r = B - (ll)(B / C) - (ll)(B / D) + (ll)(B / lcm); ll l = a - (ll)(a / C) - (ll)(a / D) + (ll)(a / lcm); ll ans = r - l; cout << ans << endl; };
[]
805,733
805,734
u987594251
cpp
p02995
#include <bits/stdc++.h> #include <cmath> #include <math.h> using namespace std; using ll = long long; bool is_int_lround(double x) { return std::lround(x) == x; } int ketasuu(int x) { int n = 0; while (x > 0) { x /= 10; n++; } return n; } ll gcd11(ll x, ll y) { long long a = max(x, y), b = min(x, y), c = a % b; while (c != 0) { a = b; b = c; c = a % b; } return b; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll count = 0, cans = 0, dans = 0, cdans = 0; cans = b / c - (a - 1) / c; dans = b / d - (a - 1) / d; cdans = c * d / gcd11(c, d); count = b - a + 1 - (cans + dans - (b - a + 1) / cdans); cout << count << endl; }
#include <bits/stdc++.h> #include <cmath> #include <math.h> using namespace std; using ll = long long; bool is_int_lround(double x) { return std::lround(x) == x; } int ketasuu(int x) { int n = 0; while (x > 0) { x /= 10; n++; } return n; } ll gcd11(ll x, ll y) { long long a = max(x, y), b = min(x, y), c = a % b; while (c != 0) { a = b; b = c; c = a % b; } return b; } int main() { ll a, b, c, d; cin >> a >> b >> c >> d; ll count = 0, cans = 0, dans = 0, cdans = 0; cans = b / c - (a - 1) / c; dans = b / d - (a - 1) / d; cdans = c * d / gcd11(c, d); count = b - a + 1 - (cans + dans - (b / cdans) + (a - 1) / cdans); cout << count << endl; }
[]
805,743
805,744
u776056110
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<long long> vll; typedef pair<int, int> pii; typedef vector<pii> vii; #define ll long long #define ff first #define ss second #define pb push_back #define mkp make_pair #define sz size() #define forf(a, b, c) for (int i = a; i <= b; i += c) #define forr(a, b, c) for (int i = a; i >= b; i -= c) #define all(a) a.begin(), a.end() #define mem(a, b) memset(a, b, sizeof(a)) #define pi 2 * acos(0.0) #define End return 0; #define nl endl #define scan1(a) scanf("%d", &a) #define scan2(a, b) scanf("%d %d", &a, &b) #define scan3(a, b, c) scanf("%d %d %d", &a, &b, &c) #define scanl(a) scanf("%lld", &a) #define scanll(a, b) scanf("%lld %lld", &a, &b) #define scanlll(a, b, c) scanf("%lld %lld %lld", &a, &b, &c) #define print1(a) printf("%d", a) #define print2(a, b) printf("%d %d", a, b) #define print3(a, b, c) printf("%d %d %d", a, b, c) #define printl(a) printf("%lld", a) #define printll(a, b) printf("%lld %lld", a, b) #define printlll(a, b, c) printf("%lld %lld %lld", a, b, c) #define MAXN 100000007 #define INF 0x3f3f3f3f bool mark[100005]; vi prime; void seive(ll N) { for (int i = 2; i <= N; i++) { if (mark[i] == false) { prime.pb(i); for (int j = i + i; j < N; j += i) mark[j] = true; } } } // freopen("input.txt", "r", stdin); int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll a, b, c, d; cin >> a >> b >> c >> d; long long total = b - a + 1; ll cb = b / c; ll db = b / d; ll ca = --a / c; ll da = a / d; ll tc = cb - ca; ll td = (db - da); ll lcm = (c / __gcd(c, d)) * d; ll tla = ++a / lcm; ll tlb = b / lcm; ll tl = tlb - tla; cout << total - (tc + td - tl) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<long long> vll; typedef pair<int, int> pii; typedef vector<pii> vii; #define ll long long #define ff first #define ss second #define pb push_back #define mkp make_pair #define sz size() #define forf(a, b, c) for (int i = a; i <= b; i += c) #define forr(a, b, c) for (int i = a; i >= b; i -= c) #define all(a) a.begin(), a.end() #define mem(a, b) memset(a, b, sizeof(a)) #define pi 2 * acos(0.0) #define End return 0; #define nl endl #define scan1(a) scanf("%d", &a) #define scan2(a, b) scanf("%d %d", &a, &b) #define scan3(a, b, c) scanf("%d %d %d", &a, &b, &c) #define scanl(a) scanf("%lld", &a) #define scanll(a, b) scanf("%lld %lld", &a, &b) #define scanlll(a, b, c) scanf("%lld %lld %lld", &a, &b, &c) #define print1(a) printf("%d", a) #define print2(a, b) printf("%d %d", a, b) #define print3(a, b, c) printf("%d %d %d", a, b, c) #define printl(a) printf("%lld", a) #define printll(a, b) printf("%lld %lld", a, b) #define printlll(a, b, c) printf("%lld %lld %lld", a, b, c) #define MAXN 100000007 #define INF 0x3f3f3f3f bool mark[100005]; vi prime; void seive(ll N) { for (int i = 2; i <= N; i++) { if (mark[i] == false) { prime.pb(i); for (int j = i + i; j < N; j += i) mark[j] = true; } } } // freopen("input.txt", "r", stdin); int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll a, b, c, d; cin >> a >> b >> c >> d; long long total = b - a + 1; ll cb = b / c; ll db = b / d; ll ca = --a / c; ll da = a / d; ll tc = cb - ca; ll td = (db - da); ll lcm = (c / __gcd(c, d)) * d; ll tla = a / lcm; ll tlb = b / lcm; ll tl = tlb - tla; cout << total - (tc + td - tl) << endl; return 0; }
[]
805,758
805,759
u615763347
cpp
p02995
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define ll long long // int 2×10の9乗 int main() { ll a, b; int c, d; cin >> a >> b >> c >> d; ll ans = 0; ll C = b / c, D = b / d, l = c * d / __gcd(c, d), L = b / l; ll ansk1 = b - (C + D - L); ll CC = (a - 1) / c, DD = (a - 1) / d, LL = (a - 1) / l; ll ansk2 = (a - 1) - (CC + DD - LL); ans = ansk1 - ansk2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define ll long long // int 2×10の9乗 int main() { ll a, b; ll c, d; cin >> a >> b >> c >> d; ll ans = 0; ll C = b / c, D = b / d, l = c * d / __gcd(c, d), L = b / l; ll ansk1 = b - (C + D - L); ll CC = (a - 1) / c, DD = (a - 1) / d, LL = (a - 1) / l; ll ansk2 = (a - 1) - (CC + DD - LL); ans = ansk1 - ansk2; cout << ans << endl; }
[ "variable_declaration.type.change" ]
805,766
805,767
u510383220
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll x, ll y) { if (x < y) swap(x, y); if (y == 0) return x; return gcd(x % y, 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 ans = b - a + 1; ans -= (b / c - (a - 1) / c); ans -= (b / d - (a - 1) / d); ll x = lcm(a, b); ans += (b / x - (a - 1) / x); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll x, ll y) { if (x < y) swap(x, y); if (y == 0) return x; return gcd(x % y, 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 ans = b - a + 1; ans -= (b / c - (a - 1) / c); ans -= (b / d - (a - 1) / d); ll x = lcm(c, d); ans += (b / x - (a - 1) / x); cout << ans << endl; }
[ "identifier.change", "call.arguments.change" ]
805,770
805,771
u774417629
cpp
p02995
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef long long int llint; #define MM 1000000000 #define MOD MM + 7 #define pi pair<int, int> #define pl pair<ll, ll> #define chmax(a, b) (a < b ? a = b : 0) #define chmin(a, b) (a > b ? a = b : 0) const long double PI = acos(-1); int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; int GCD(int x, int y) { return y ? GCD(y, x % y) : x; } ll a, b, c, d; ll gcd(ll a, ll b) { ll r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } int main() { cin >> a >> b >> c >> d; ll ans = b - a + 1; if (c == 1 || d == 1) { cout << 0 << endl; return 0; } ll bb = b / c - (a - 1) / c; ll aa = b / d - (a - 1) / d; ll G = gcd(max(c, d), min(c, d)); ll lcm = c * d / G; ll abl = b / lcm - a / lcm; // cout << "bb=" << bb << ",aa = " << aa << ",lcm=" << lcm << ",abl=" << abl // << endl; ans -= (bb + aa - abl); cout << ans << endl; }
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef long long int llint; #define MM 1000000000 #define MOD MM + 7 #define pi pair<int, int> #define pl pair<ll, ll> #define chmax(a, b) (a < b ? a = b : 0) #define chmin(a, b) (a > b ? a = b : 0) const long double PI = acos(-1); int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; int GCD(int x, int y) { return y ? GCD(y, x % y) : x; } ll a, b, c, d; ll gcd(ll a, ll b) { ll r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } int main() { cin >> a >> b >> c >> d; ll ans = b - a + 1; if (c == 1 || d == 1) { cout << 0 << endl; return 0; } ll bb = b / c - (a - 1) / c; ll aa = b / d - (a - 1) / d; ll G = gcd(max(c, d), min(c, d)); ll lcm = c * d / G; ll abl = b / lcm - (a - 1) / lcm; // cout << "bb=" << bb << ",aa = " << aa << ",lcm=" << lcm << ",abl=" << abl // << endl; ans -= (bb + aa - abl); cout << ans << endl; }
[]
805,792
805,793
u342051078
cpp
p02995
#include <iostream> using namespace std; long long koubaisuu(long long a, long long b); long long koubaisuu2(long long a, long long b); int main() { long long a, b, c, d, cd, ans[5]; cin >> a >> b >> c >> d; ans[0] = b / c - (a - 1) / c; ans[1] = b / d - (a - 1) / d; cd = koubaisuu2(c, d); ans[2] = b / (cd) - (a - 1) / (cd); ans[3] = ans[0] + ans[1] - ans[2]; cout << b - a + 1 - ans[3]; } long long koubaisuu(long long a, long long b) { long long aa, bb; aa = a; bb = b; while (aa != bb) { if (aa > bb) bb += b; else aa += a; } return aa; } long long koubaisuu2(long long a, long long b) { long long buffer[2] = {0, 0}; if (b > a) { buffer[0] = a; a = b; b = buffer[0]; } buffer[0] = a * b; while (buffer[1] != 0) { buffer[1] = a % b; a = b; b = buffer[1]; } return buffer[0] / a; }
#include <iostream> using namespace std; long long koubaisuu(long long a, long long b); long long koubaisuu2(long long a, long long b); int main() { long long a, b, c, d, cd, ans[5]; cin >> a >> b >> c >> d; ans[0] = b / c - (a - 1) / c; ans[1] = b / d - (a - 1) / d; cd = koubaisuu2(c, d); ans[2] = b / (cd) - (a - 1) / (cd); ans[3] = ans[0] + ans[1] - ans[2]; cout << b - a + 1 - ans[3]; } long long koubaisuu(long long a, long long b) { long long aa, bb; aa = a; bb = b; while (aa != bb) { if (aa > bb) bb += b; else aa += a; } return aa; } long long koubaisuu2(long long a, long long b) { long long buffer[2] = {1, 1}; if (b > a) { buffer[0] = a; a = b; b = buffer[0]; } buffer[0] = a * b; while (buffer[1] != 0) { buffer[1] = a % b; a = b; b = buffer[1]; } return buffer[0] / a; }
[ "literal.number.change" ]
805,796
805,797
u778738287
cpp
p02995
#include <iostream> using namespace std; long long koubaisuu(long long a, long long b); long long koubaisuu2(long long a, long long b); int main() { long long a, b, c, d, cd, ans[5]; cin >> a >> b >> c >> d; ans[0] = b / c - (a - 1) / c; ans[1] = b / d - (a - 1) / d; cd = koubaisuu2(c, d); ans[2] = b / (cd) - (a - 1) / (cd); ans[3] = ans[0] + ans[1] - ans[2]; cout << b - a + 1 - ans[3]; } long long koubaisuu(long long a, long long b) { long long aa, bb; aa = a; bb = b; while (aa != bb) { if (aa > bb) bb += b; else aa += a; } return aa; } long long koubaisuu2(long long a, long long b) { long long buffer[2]; if (b > a) { buffer[0] = a; a = b; b = buffer[0]; } buffer[0] = a * b; while (buffer[1] != 0) { buffer[1] = a % b; a = b; b = buffer[1]; } return buffer[0] / a; }
#include <iostream> using namespace std; long long koubaisuu(long long a, long long b); long long koubaisuu2(long long a, long long b); int main() { long long a, b, c, d, cd, ans[5]; cin >> a >> b >> c >> d; ans[0] = b / c - (a - 1) / c; ans[1] = b / d - (a - 1) / d; cd = koubaisuu2(c, d); ans[2] = b / (cd) - (a - 1) / (cd); ans[3] = ans[0] + ans[1] - ans[2]; cout << b - a + 1 - ans[3]; } long long koubaisuu(long long a, long long b) { long long aa, bb; aa = a; bb = b; while (aa != bb) { if (aa > bb) bb += b; else aa += a; } return aa; } long long koubaisuu2(long long a, long long b) { long long buffer[2] = {1, 1}; if (b > a) { buffer[0] = a; a = b; b = buffer[0]; } buffer[0] = a * b; while (buffer[1] != 0) { buffer[1] = a % b; a = b; b = buffer[1]; } return buffer[0] / a; }
[ "variable_declaration.value.change" ]
805,798
805,797
u778738287
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() { ios::sync_with_stdio(false); cin.tie(0); ll A, B, C, D; cin >> A >> B >> C >> D; ll m1 = B / C - A / C; ll m2 = B / D - A / D; ll lcm = (C * D); lcm /= gcd(max(C, D), min(C, D)); ll m3 = B / lcm - A / lcm; if (A % lcm == 0) m3++; if (A % C == 0) m1++; if (A % D == 0) m2++; cout << B - A + 1 - m1 - m2 << endl; return 0; }
#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() { ios::sync_with_stdio(false); cin.tie(0); ll A, B, C, D; cin >> A >> B >> C >> D; ll m1 = B / C - A / C; ll m2 = B / D - A / D; ll lcm = (C * D); lcm /= gcd(max(C, D), min(C, D)); ll m3 = B / lcm - A / lcm; if (A % lcm == 0) m3++; if (A % C == 0) m1++; if (A % D == 0) m2++; cout << B - A + 1 - m1 - m2 + m3 << endl; return 0; }
[ "expression.operation.binary.add" ]
805,805
805,806
u781659997
cpp
p02995
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vi; typedef vector<string> vs; typedef pair<ll, ll> P; typedef vector<P> vp; #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define REPR(i, n) for (int i = n - 1; i >= 0; i--) #define FORR(i, n, m) for (int i = n - 1; i >= m; i--) #define ARR(array) for (int i = 0; i < array.size(); i++) #define all(in) in.begin(), in.end() #define ALL(in, K) in, in + K #define INF 1e18 #define MOD 1000000007 #define SIZE 10005 #define PI 3.14159265358979323846 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最小公約数 ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } //最大公倍数 ll input() { ll a; cin >> a; return a; } int main() { cin.tie(0); ios::sync_with_stdio(false); ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1; ans += (a - 1) / c; ans -= b / c; ans += (a - 1) / d; ans -= b / d; ans -= (a - 1) / (c * d); ans += b / (c * d); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vi; typedef vector<string> vs; typedef pair<ll, ll> P; typedef vector<P> vp; #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define REPR(i, n) for (int i = n - 1; i >= 0; i--) #define FORR(i, n, m) for (int i = n - 1; i >= m; i--) #define ARR(array) for (int i = 0; i < array.size(); i++) #define all(in) in.begin(), in.end() #define ALL(in, K) in, in + K #define INF 1e18 #define MOD 1000000007 #define SIZE 10005 #define PI 3.14159265358979323846 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数 ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } //最小公倍数 ll input() { ll a; cin >> a; return a; } int main() { cin.tie(0); ios::sync_with_stdio(false); ll a, b, c, d; cin >> a >> b >> c >> d; ll ans = b - a + 1; ans += (a - 1) / c; ans -= b / c; ans += (a - 1) / d; ans -= b / d; ans -= (a - 1) / lcm(c, d); ans += b / lcm(c, d); cout << ans << endl; }
[ "call.add", "assignment.value.change", "expression.operation.binary.change" ]
805,817
805,818
u288432959
cpp
p02995
#include <bits/stdc++.h> using namespace std; int function1(long a, long b) { long long r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long s; long long r = B / C - (A - 1) / C; long long t = B / D - (A - 1) / D; long long p = function1(min(C, D), max(C, D)); p = C * D / p; long long q = B / p - A / p; cout << B + 1 - A - r - t + q << endl; }
#include <bits/stdc++.h> using namespace std; int function1(long a, long b) { long long r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } int main() { long long A, B, C, D; cin >> A >> B >> C >> D; long long s; long long r = B / C - (A - 1) / C; long long t = B / D - (A - 1) / D; long long p = function1(min(C, D), max(C, D)); p = C * D / p; long long q = B / p - (A - 1) / p; cout << B + 1 - A - r - t + q << endl; }
[]
805,821
805,822
u910028046
cpp
p02995
#include <iostream> using namespace std; long gcd(long a, long b) { if (a % b == 0) { return (b); } else { return (gcd(b, a % b)); } } 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 num = b - a + 1; long ans = (b / c) + (b / d) - (b / lcm(c, d)) + (a / lcm(c, d)) - ((a - 1) / c) - ((a - 1) / d); cout << num - ans << endl; return 0; }
#include <iostream> using namespace std; long gcd(long a, long b) { if (a % b == 0) { return (b); } else { return (gcd(b, a % b)); } } 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 num = b - a + 1; long ans = (b / c) + (b / d) - (b / lcm(c, d)) + ((a - 1) / lcm(c, d)) - ((a - 1) / c) - ((a - 1) / d); cout << num - ans << endl; return 0; }
[]
805,827
805,828
u900267897
cpp
p02995
#include <iostream> using namespace std; int main() { long a, b, c, d, cd = 0, r[1000000000000]; // cdはcとdの最小公倍数 cin >> a >> b >> c >> d; r[0] = max(c, d) % min(c, d); if (r[0] == 0) cd = c * d / min(c, d); else { r[1] = min(c, d) % r[0]; for (int j = 0;; j++) { if (r[j + 1] == 0) { cd = c * d / r[j]; break; } else { r[j + 2] = r[j] % r[j + 1]; if (r[j + 2] == 0) { cd = c * d / r[j + 1]; break; } } } } cout << (b - (b / c + b / d - b / cd)) - (a - 1 - ((a - 1) / c + (a - 1) / d - (a - 1) / cd)); return 0; }
#include <iostream> using namespace std; int main() { long a, b, c, d, cd = 0, r[1000000]; // cdはcとdの最小公倍数 cin >> a >> b >> c >> d; r[0] = max(c, d) % min(c, d); if (r[0] == 0) cd = c * d / min(c, d); else { r[1] = min(c, d) % r[0]; for (int j = 0;; j++) { if (r[j + 1] == 0) { cd = c * d / r[j]; break; } else { r[j + 2] = r[j] % r[j + 1]; if (r[j + 2] == 0) { cd = c * d / r[j + 1]; break; } } } } cout << (b - (b / c + b / d - b / cd)) - (a - 1 - ((a - 1) / c + (a - 1) / d - (a - 1) / cd)); return 0; }
[ "literal.number.change", "variable_declaration.array_dimensions.change" ]
805,839
805,840
u164385976
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long gcd(long long x, long long y) { if (x < y) swap(x, y); if (y == 0) return x; return gcd(y, x % y); } long long lcm(long long x, long long y) { return x / gcd(x, y) * y; } long long a, b, c, d; long long f(int x) { return x - (x / c) - (x / d) + x / lcm(c, d); } int main() { cin >> a >> b >> c >> d; long long ans = f(b) - f(a - 1); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; long long gcd(long long x, long long y) { if (x < y) swap(x, y); if (y == 0) return x; return gcd(y, x % y); } long long lcm(long long x, long long y) { return x / gcd(x, y) * y; } long long a, b, c, d; long long f(long long x) { return x - (x / c) - (x / d) + x / lcm(c, d); } int main() { cin >> a >> b >> c >> d; long long ans = f(b) - f(a - 1); cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
805,847
805,848
u703214333
cpp
p02995
#include <bits/stdc++.h> using namespace std; long long a, b, c, d; long long f(int x) { return x - x / c - x / d + x / ((c * d) / __gcd(c, d)); } int main() { cin >> a >> b >> c >> d; long long ans = f(b) - f(a - 1); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; long long a, b, c, d; long long f(long long x) { return x - x / c - x / d + x / ((c * d) / __gcd(c, d)); } int main() { cin >> a >> b >> c >> d; long long ans = f(b) - f(a - 1); cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
805,849
805,850
u703214333
cpp
p02995
#include <algorithm> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REP2(i, s, n) for (int i = s; i < n; i++) #define REP_1(i, n) for (int i = 1; i < n + 1; i++) #define bitSearch(bit, n) for (int bit = 0; bit < (1 << N); bit++) using namespace std; void printAns(int a) { cout << a << endl; } void yesno(bool a) { if (a) cout << "Yes" << endl; else cout << "No" << endl; } void YESNO(bool a) { if (a) cout << "YES" << endl; else cout << "NO" << endl; } typedef long long ll; typedef unsigned long ul; typedef long double ld; 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; } ll INF = 10000000; ll mod = 1000000007; // 10^9+7 int multi(ll A, ll B, ll M) { ll L = (A - 1) / M + 1; ll R = B / M; return R - L + 1; } ll lcm(ll a, ll b) { if (a < b) { ll tmp = a; a = b; b = tmp; } ll x = a * b; ll r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return x / b; } //番号ズレ注意!! int main() { ll A, B, C, D; cin >> A >> B >> C >> D; cout << B - A + 1 - multi(A, B, C) - multi(A, B, D) + multi(A, B, lcm(C, D)); }
#include <algorithm> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REP2(i, s, n) for (int i = s; i < n; i++) #define REP_1(i, n) for (int i = 1; i < n + 1; i++) #define bitSearch(bit, n) for (int bit = 0; bit < (1 << N); bit++) using namespace std; void printAns(int a) { cout << a << endl; } void yesno(bool a) { if (a) cout << "Yes" << endl; else cout << "No" << endl; } void YESNO(bool a) { if (a) cout << "YES" << endl; else cout << "NO" << endl; } typedef long long ll; typedef unsigned long ul; typedef long double ld; 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; } ll INF = 10000000; ll mod = 1000000007; // 10^9+7 ll multi(ll A, ll B, ll M) { ll L = (A - 1) / M + 1; ll R = B / M; return R - L + 1; } ll lcm(ll a, ll b) { if (a < b) { ll tmp = a; a = b; b = tmp; } ll x = a * b; ll r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return x / b; } //番号ズレ注意!! int main() { ll A, B, C, D; cin >> A >> B >> C >> D; cout << B - A + 1 - multi(A, B, C) - multi(A, B, D) + multi(A, B, lcm(C, D)); }
[]
805,851
805,852
u741556152
cpp
p02995
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <numeric> #include <string> #include <vector> #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 FORR(i, m, n) for (int i = m; i >= n; i--) #define VSORT(v) sort(v.begin(), v.end()); #define VE vector<int> #define VEP vector<pair<int, int>> #define llong long long #define pb(a) push_back(a) using namespace std; long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { llong a, b; int c, d; cin >> a >> b >> c >> d; int gcd_cd = GCD(c, d); llong b_div_c = b / c; llong b_div_d = b / d; llong b_div_cd = b / (c * d / gcd_cd); llong a_div_c = (a - 1) / c; llong a_div_d = (a - 1) / d; llong a_div_cd = (a - 1) / (c * d / gcd_cd); llong b_num = b - (b_div_c + b_div_d - b_div_cd); llong a_num = (a - 1) - (a_div_c + a_div_d - a_div_cd); cout << b_num - a_num << endl; return 0; }
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <numeric> #include <string> #include <vector> #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 FORR(i, m, n) for (int i = m; i >= n; i--) #define VSORT(v) sort(v.begin(), v.end()); #define VE vector<int> #define VEP vector<pair<int, int>> #define llong long long #define pb(a) push_back(a) using namespace std; long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { llong a, b; llong c, d; cin >> a >> b >> c >> d; llong gcd_cd = GCD(c, d); llong b_div_c = b / c; llong b_div_d = b / d; llong b_div_cd = b / (c * d / gcd_cd); llong a_div_c = (a - 1) / c; llong a_div_d = (a - 1) / d; llong a_div_cd = (a - 1) / (c * d / gcd_cd); llong b_num = b - (b_div_c + b_div_d - b_div_cd); llong a_num = (a - 1) - (a_div_c + a_div_d - a_div_cd); cout << b_num - a_num << endl; return 0; }
[ "variable_declaration.type.change" ]
805,892
805,893
u343110708
cpp
p02995
#include <bits/stdc++.h> #define debug(x) cerr << #x << ": " << x << '\n'; using namespace std; using ll = long long; using P = pair<int, int>; const int INF = (int)1e9; const int MOD = (int)1e9 + 7; #ifndef GCD #define GCD // solve ax+by=gcd(a, b) // return gcd(a, b) template <typename T> T gcd(const T a, const T b, T *const px = nullptr, T *const py = nullptr) { if (py == nullptr) { if (b == 0) return a; return gcd(b, a % b); } T d = a; if (b != 0) { d = gcd(b, a % b, py, px); *py -= (a / b) * *px; } else { *px = 1; *py = 0; } return d; } #endif #ifndef LCM #define LCM // return lcm(a, b) template <typename T> T lcm(const T a, const T b) { T ret = a / gcd(a, b); ret *= b; return ret; } #endif int main(void) { ll A, B, C, D; cin >> A >> B >> C >> D; ll res = B - A + 1; res -= B / C - (A - 1) / C; res -= B / D - (A - 1) / D; int E = lcm(C, D); res += B / E - (A - 1) / E; cout << res << '\n'; return 0; }
#include <bits/stdc++.h> #define debug(x) cerr << #x << ": " << x << '\n'; using namespace std; using ll = long long; using P = pair<int, int>; const int INF = (int)1e9; const int MOD = (int)1e9 + 7; #ifndef GCD #define GCD // solve ax+by=gcd(a, b) // return gcd(a, b) template <typename T> T gcd(const T a, const T b, T *const px = nullptr, T *const py = nullptr) { if (py == nullptr) { if (b == 0) return a; return gcd(b, a % b); } T d = a; if (b != 0) { d = gcd(b, a % b, py, px); *py -= (a / b) * *px; } else { *px = 1; *py = 0; } return d; } #endif #ifndef LCM #define LCM // return lcm(a, b) template <typename T> T lcm(const T a, const T b) { T ret = a / gcd(a, b); ret *= b; return ret; } #endif int main(void) { ll A, B, C, D; cin >> A >> B >> C >> D; ll res = B - A + 1; res -= B / C - (A - 1) / C; res -= B / D - (A - 1) / D; ll E = lcm(C, D); res += B / E - (A - 1) / E; cout << res << '\n'; return 0; }
[ "variable_declaration.type.change" ]
805,900
805,901
u660834360
cpp