buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; long long N; long long A[100]; int main() { cin >> N; for (long long i = 0; i < N; i++) { cin >> A[i]; } long long ans = 1000; for (long long i = 0; i < N; i++) { if (A[i] < A[i + 1]) { long long stock = ans / A[i]; long long money = ans % A...
#include <bits/stdc++.h> using namespace std; long long N; long long A[100]; int main() { cin >> N; for (long long i = 0; i < N; i++) { cin >> A[i]; } long long ans = 1000; for (long long i = 0; i < N; i++) { while (i < N && A[i] < A[i + 1]) { long long stock = ans / A[i]; long long mon...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 7, 8, 9, 0, 52, 0, 89], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98]]
1
134
#pragma GCC optimize("O2") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\...
#pragma GCC optimize("O2") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 73]]
1
227
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < n; i++) #define Rep(i, m, n) for (long long i = m; i < n; i++) #define REP(i, m, n, p) for (long long i = m; i < n; i += p) #define all(v) v.begin(), v.end() #define pq priority_queue #define bcnt(n) __builtin_popcountll(n) const...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < n; i++) #define Rep(i, m, n) for (long long i = m; i < n; i++) #define REP(i, m, n, p) for (long long i = m; i < n; i += p) #define all(v) v.begin(), v.end() #define pq priority_queue #define bcnt(n) __builtin_popcountll(n) const...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107]]
1
5,713
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define PI 3.14159265359 #define INF 1000100100 #define MOD 1000000007 #define all(x) (x).begin(), (x).end() typedef long long ll; #define P pair<int, int> #define PP pair<P, int> #define T tuple<int, int, int> using namespace std; int main() { l...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define PI 3.14159265359 #define INF 1000100100 #define MOD 1000000007 #define all(x) (x).begin(), (x).end() typedef long long ll; #define P pair<int, int> #define PP pair<P, int> #define T tuple<int, int, int> using namespace std; int main() { l...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 73]]
1
152
n=int(input()) gold=1000 kabu=0 lst=list(map(int,input().split())) for i in range(n-1): if lst[i]<lst[i+1]: kabu,gold=divmod(gold,lst[i]) elif lst[i]>lst[i+1]: gold+=kabu*lst[i] kabu=0 gold+=kabu*lst[-1] print(gold)
n=int(input()) gold=1000 kabu=0 lst=list(map(int,input().split())) for i in range(n-1): if lst[i]<lst[i+1]: tmp,gold=divmod(gold,lst[i]) kabu+=tmp if lst[i]>lst[i+1]: gold+=kabu*lst[i] kabu=0 gold+=kabu*lst[-1] print(gold)
[["-", 64, 196, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 684, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
104
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <vector> #define SPBR(w, n) std::cout << (w + 1 == n ...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <vector> #define SPBR(w, n) std::cout << (w + 1 == n ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 73]]
1
388
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long long money = 1000; long long stock = 0; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; i < N - 1; i++) { if (A[i] < A[i + 1]) { stock += money / A[i]; money -= stock...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long long money = 1000; long long stock = 0; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; i < N - 1; i++) { if (A[i] < A[i + 1]) { stock += money / A[i]; money -= money...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 85], ["+", 0, 11, 12, 16, 31, 16, 12, 69, 28, 22], ["+", 12, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["+", 12, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 12, 16, 31, 16, 12, 69, 341, 342, 0, 73]...
1
169
N = int(input()) A = list(map(int, input().split())) money = 1000 stock = 0 for i in range(N): if i == N - 1: money += stock * A[i] break if A[i] < A[i + 1]: stock += money // A[i] money -= A[i] * stock elif A[i] > A[i + 1]: money += A[i] * stock stock = 0 ...
N = int(input()) A = list(map(int, input().split())) money = 1000 stock = 0 for i in range(N): if i == N - 1: money += stock * A[i] break if A[i] < A[i + 1]: stock += money // A[i] money %= A[i] elif A[i] > A[i + 1]: money += A[i] * stock stock = 0 print(mo...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 132], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 17, 48], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 12, 22]]
5
112
#include <bits/stdc++.h> using namespace std; void solve(long long N, std::deque<long long> A) { int m = 1000; int s = 0; A.push_back(0); for (int i = 0; i < N; i++) { if (A[i + 1] > A[i]) { s = m / A[i]; m = m % A[i]; } else if (A[i + 1] > A[i]) { // pass } else { m += A[i]...
#include <bits/stdc++.h> using namespace std; void solve(long long N, std::deque<long long> A) { long long m = 1000; long long s = 0; A.push_back(0); for (int i = 0; i < N; i++) { if (A[i + 1] > A[i]) { s += m / A[i]; m = m % A[i]; } else if (A[i + 1] > A[i]) { // pass } else { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
211
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0), ios::sync_with_stdio(false); int n; cin >> n; vector<int> a(n); for (auto &&i : a) cin >> i; vector<pair<int, int>> v; int b = 0, s = 1; for (int i = 1; i < n; ++i) { if (a.at(i) > a.at(s)) s = i; if (b < s && a.at...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0), ios::sync_with_stdio(false); int n; cin >> n; vector<int> a(n); for (auto &&i : a) cin >> i; vector<pair<int, int>> v; int b = 0, s = 1; for (int i = 1; i < n; ++i) { if (a.at(i) >= a.at(b)) s = i; if (b < s && a.a...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 22], ["+", 15, 339, 51, 16, 12, 2, 3, 4, 0, 22]]
1
234
n = int(input()) a = list(map(int,input().split())) dp = [0] * n dp[0] = 1000 for i in range(1, n): dp[i] = max(dp[i-1], dp[i-1] // a[i-1] * a[i] + dp[i-1] % a[i-1]) print(dp[i-1])
n = int(input()) a = list(map(int,input().split())) dp = [0] * n dp[0] = 1000 for i in range(1, n): dp[i] = max(dp[i-1], dp[i-1] // a[i-1] * a[i] + dp[i-1] % a[i-1]) print(dp[-1])
[["-", 0, 652, 3, 4, 0, 206, 206, 657, 31, 22]]
5
104
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main() { int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; ll ans = 1000; rep(i, n - 1) { if (a[i] < a[i + 1]) { ans += (a[i + 1] - a[i]) * ans / a[i]; } } cout ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main() { int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; ll ans = 1000; rep(i, n - 1) { if (a[i] < a[i + 1]) { ans += (a[i + 1] - a[i]) * (ans / a[i]); } } cou...
[["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
1
120
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <functional> #include <iostream> #include <limits> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define rep0(i, n) for...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <functional> #include <iostream> #include <limits> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define rep0(i, n) for...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
583
#include <bits/stdc++.h> using namespace std; int main() { int a[100], b = 1000, n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } int j = 1; a[n + 1] = 0; for (int i = 1; i <= n; i++) { if (a[i + 1] > a[i]) { continue; } else { int z = b % a[j]; b /= a[j]; b *...
#include <bits/stdc++.h> using namespace std; int main() { long long int a[100], b = 1000, n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } long long int j = 1; a[n + 1] = 0; for (int i = 1; i <= n; i++) { if (a[i + 1] >= a[i]) { continue; } else { int z = b % a[j]; ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
142
#include <bits/stdc++.h> using namespace std; #define int long long #define flash \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.t...
#include <bits/stdc++.h> using namespace std; #define int long long #define flash \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.t...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
189
#include <bits/stdc++.h> using namespace std; #define loop(i, x, z) for (int i = x; i < z; i++) using ll = long long; ll n, A[82], ans = 1000, stock = 0, rem = 0; int main() { cin >> n; loop(i, 0, n) cin >> A[i]; loop(i, 0, n) { if (A[i + 1] > A[i]) { stock = ans / A[i]; rem = ans % A[i]; an...
#include <bits/stdc++.h> using namespace std; #define loop(i, x, z) for (int i = x; i < z; i++) using ll = long long; ll n, A[82], ans = 1000, stock = 0, rem = 0; int main() { cin >> n; loop(i, 0, n) cin >> A[i]; loop(i, 0, n - 1) { if (A[i + 1] > A[i]) { stock = ans / A[i]; rem = ans % A[i]; ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29]]
1
143
n = int(input()) a = list(map(int, input().split())) a_cur = a[0] m = 1000 s = 0 for i in range(1, n): a_next = a[i] if a_cur < a_next: # buy s += m // a_cur m -= s * a_cur else: # sell m += s * a_cur s = 0 a_cur = a_next m += s * a_cur print(m)
n = int(input()) a = list(map(int, input().split())) a_cur = a[0] m = 1000 s = 0 for i in range(1, n): a_next = a[i] if a_cur < a_next: # buy s += m // a_cur m -= m // a_cur * a_cur else: # sell m += s * a_cur s = 0 a_cur = a_next m += s * a_cur print(m)
[["-", 64, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["+", 0, 1, 0, 677, 12, 657, 31, 657, 31, 22], ["+", 0, 1, 0, 677, 12, 657, 31, 657, 17, 676], ["+", 0, 1, 0, 677, 12, 657, 31, 657, 12, 22]]
5
92
N = int(input()) A = list(map(int, input().split())) wallet = 1000 stock = 0 for i in range(N - 1): if A[i] < A[i + 1] and wallet > 0: # 次値上がり and 金がある→買う action = wallet // A[i] if wallet >= action * A[i]: stock += wallet // A[i] wallet -= stock * A[i] elif A[i] > A[...
N = int(input()) A = list(map(int, input().split())) wallet = 1000 stock = 0 for i in range(N - 1): if A[i] < A[i + 1] and wallet > 0: # 次値上がり and 金がある→買う action = wallet // A[i] if wallet >= action * A[i]: stock += wallet // A[i] wallet -= action * A[i] elif A[i] > A[...
[["-", 64, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 31, 22]]
5
136
N=int(input()) A=list(map(int,input().split())) tmp=A[0] ans=1000 kabu=0 for i in range(1,N): if tmp < A[i]: if kabu==0: kabu=ans//tmp ans=ans%tmp tmp=A[i] elif tmp > A[i]: ans+=kabu*tmp kabu=0 tmp=A[i] if kabu > 0: ans+=kabu*A[-1] print(an...
N=int(input()) A=list(map(int,input().split())) tmp=A[0] ans=1000 kabu=0 for i in range(1,N): if tmp < A[i]: if kabu==0: kabu=ans//tmp ans=ans%tmp tmp=A[i] elif tmp > A[i]: ans+=kabu*tmp kabu=0 tmp=A[i] tmp=A[i] if kabu > 0: ans+=kabu*A...
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 0, 73]]
5
116
from collections import defaultdict,deque import math def gcd(a,b): return b if not a%b else gcd(b,a%b) def lcm(a,b): return (a*b)//gcd(a,b) def main(): n = int(input()) a=[int(i) for i in input().split()] stocks = 0 money = 1000 for i in range(n-1): if(a[i] < a[i+1]): s...
from collections import defaultdict,deque import math def gcd(a,b): return b if not a%b else gcd(b,a%b) def lcm(a,b): return (a*b)//gcd(a,b) def main(): n = int(input()) a=[int(i) for i in input().split()] money = 1000 for i in range(n-1): stocks = 0 if(a[i] < a[i+1]): ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
154
#include <bits/stdc++.h> using namespace std; signed main() { int n, a[80], sell, money, kabu, ans; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } ans = 1000; for (int i = 1; i < n; i++) { money = 1000, kabu = 0; for (int j = 0; j < i; j++) { if (a[j] < a[j + 1]) { kabu ...
#include <bits/stdc++.h> using namespace std; signed main() { int n, a[80]; long long money, kabu, ans; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } ans = 1000; for (int i = 1; i < n; i++) { money = 1000, kabu = 0; for (int j = 0; j < i; j++) { if (a[j] < a[j + 1]) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
190
N = int(input()) A = list(map(int, input().split())) M = 1000 X = 0 for i in range(N-1): if A[i] < A[i+1]: X = int(M/A[i]) M = int(M - X * A[i]) M = M + X * A[i+1] print(int(M))
N = int(input()) A = list(map(int, input().split())) M = 1000 X = 0 for i in range(N-1): if A[i] < A[i+1]: X = int(M/A[i]) M = int(M - X * A[i]) M = M + X * A[i+1] X = 0 print(int(M))
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
97
#include <algorithm> #include <bitset> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> #define db double #define vi vector<int> #define pb push_back #define fi first #define se second #define ll long long #define ld long double #define maxn...
#include <algorithm> #include <bitset> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> #define db double #define vi vector<int> #define pb push_back #define fi first #define se second #define ll long long #define ld long double #define maxn...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 64, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["-", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["+", 0, 57, 75, 76, 0, 9, 0, 116, 0, 117]]
1
416
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf = 1e9; #define mod 1000000007 #define what_is(x) cerr << #x << " is " << x << "\n"; #define read(x) freopen("in.txt", "r", stdin); #define write(x) freopen("out.txt", "w", stdout); #define Fast ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf = 1e9; #define mod 1000000007 #define what_is(x) cerr << #x << " is " << x << "\n"; #define read(x) freopen("in.txt", "r", stdin); #define write(x) freopen("out.txt", "w", stdout); #define Fast ...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
196
n = gets.chomp.to_i a = gets.chomp.split.map(&:to_i) ans = 1000 (1...n).each do |i| have_stock = 0 have_stock = ans / a[i] if a[i] < a[i+1] ans += (a[i+1]- a[i]) * have_stock end puts ans
n = gets.chomp.to_i a = gets.chomp.split.map(&:to_i) a.unshift(0) ans = 1000 (1...n).each do |i| have_stock = 0 have_stock = ans / a[i] if a[i] < a[i+1] ans += (a[i+1]- a[i]) * have_stock end puts ans
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 486, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 24], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 612], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 25]]
4
77
n = gets.chomp.to_i a_n = gets.chomp.split.map(&:to_i) stock = 0 money = 1000 a_n.each.with_index(0) do |a_i, i| if i == a_n.length - 1 money = money + stock * a_i stock = 0 next end if a_i < a_n[i+1] && money >= stock stock = money / a_i money = money - stock * a_i elsif a_i > a_n[i+1] ...
n = gets.chomp.to_i a_n = gets.chomp.split.map(&:to_i) stock = 0 money = 1000 a_n.each.with_index(0) do |a_i, i| if i == a_n.length - 1 money = money + stock * a_i stock = 0 next end if a_i < a_n[i+1] && money >= a_i stock = money / a_i money = money - stock * a_i elsif a_i > a_n[i+1] ...
[["+", 8, 736, 0, 121, 15, 738, 12, 738, 12, 22], ["-", 8, 736, 0, 121, 64, 749, 0, 662, 31, 22], ["-", 8, 736, 0, 121, 75, 759, 75, 95, 0, 95]]
4
110
#include <bits/stdc++.h> using namespace std; int main() { int n; int64_t mon = 1000, cor = 0; cin >> n; vector<int> vec(n); vector<char> act(n, 'n'); for (int i = 0; i < n; i++) cin >> vec.at(i); if (vec.at(0) < vec.at(1)) act.at(0) = 'b'; for (int i = 1; i < n - 1; i++) { if (vec.at(i) ...
#include <bits/stdc++.h> using namespace std; int main() { int n; int64_t mon = 1000, cor = 0; cin >> n; vector<int> vec(n); vector<char> act(n, 'n'); for (int i = 0; i < n; i++) cin >> vec.at(i); if (vec.at(0) < vec.at(1)) act.at(0) = 'b'; for (int i = 1; i < n - 1; i++) { if (vec.at(i) ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 109]]
1
314
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define endl "\n" #define loop(i, s, e) for (int i = s; i < e; i++) #define int long long #define vi vector<int> #define S(v) sort(v...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define endl "\n" #define loop(i, s, e) for (int i = s; i < e; i++) #define int long long #define vi vector<int> #define S(v) sort(v...
[["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 20], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 19]]
1
544
N = int(input()) A = list(map(int, input().split())) m = 1000 s = 0 for i in range(N-1): if A[i]<A[i+1]: s = m//A[i] m = m%A[i] m += s*A[i] s = 0 print(m)
N = int(input()) A = list(map(int, input().split())) m = 1000 s = 0 idx = 0 for i in range(N-1): if A[i]<A[i+1]: s = m//A[i] m = m%A[i] m += s*A[i+1] s = 0 print(m)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 677, 12, 657, 12, 206, 206, 657, 17, 72], ["+", 0, 677, 12, 657, 12, 206, 206, 657, 12, 612]]
5
85
N = int(input()) A = list(map(int, input().split())) buy = 0 money = 1000 for i in range(N-1): if buy != 0: money += buy*A[i] if A[i] < A[i+1]: buy = money // A[i] money -= buy * A[i] if buy != 0: money += buy*A[-1] print(money)
N = int(input()) A = list(map(int, input().split())) buy = 0 money = 1000 for i in range(N-1): if buy != 0: money += buy*A[i] buy = 0 if A[i] < A[i+1]: buy = money // A[i] money -= buy * A[i] if buy != 0: money += buy*A[-1] print(money)
[["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
101
N = int(input()) A = list(map(int, input().split())) kabu = 0 money = 1000 for i in range(N): money += kabu*A[i] kabu = 0 if i!=N-1: if A[i]<A[i+1]: kabu += money//A[i] money %= 0 else: continue print(money)
N = int(input()) A = list(map(int, input().split())) kabu = 0 money = 1000 for i in range(N): money += kabu*A[i] kabu = 0 if i!=N-1: if A[i]<=A[i+1]: kabu += money//A[i] money %= A[i] else: pass print(money)
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 19], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 0, 70], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 206...
5
88
n = gets.to_i a = gets.split.map(&:to_i) money = 1000 stock = 0 n.times do |idx| current = a[idx] if idx.zero? if a[idx+1] > current stock, money = money.divmod(current) end elsif idx == n - 1 money += stock * current stock = 0 else if a[idx+1] < current money += stock * current ...
n = gets.to_i a = gets.split.map(&:to_i) money = 1000 stock = 0 n.times do |idx| current = a[idx] if idx.zero? if a[idx+1] > current stock, money = money.divmod(current) end elsif idx == n - 1 money += stock * current stock = 0 else if a[idx+1] < current money += stock * current ...
[["+", 75, 95, 0, 121, 75, 759, 15, 738, 17, 98], ["+", 0, 121, 75, 759, 15, 738, 12, 738, 31, 22], ["+", 0, 121, 75, 759, 15, 738, 12, 738, 17, 20], ["+", 0, 121, 75, 759, 15, 738, 12, 738, 12, 22]]
4
115
n = gets.to_i a = gets.split.map(&:to_i) money = 1000 stock = 0 n.times do |idx| current = a[idx] if idx.zero? if a[idx+1] > current stock, money = money.divmod(current) end elsif idx == n - 1 money += stock * current stock = 0 else if a[idx-1] <= current && a[idx+1] < current mo...
n = gets.to_i a = gets.split.map(&:to_i) money = 1000 stock = 0 n.times do |idx| current = a[idx] if idx.zero? if a[idx+1] > current stock, money = money.divmod(current) end elsif idx == n - 1 money += stock * current stock = 0 else if a[idx-1] <= current && a[idx+1] < current mo...
[["+", 75, 95, 0, 121, 75, 759, 15, 738, 17, 98], ["+", 0, 121, 75, 759, 15, 738, 12, 738, 31, 22], ["+", 0, 121, 75, 759, 15, 738, 12, 738, 17, 20], ["+", 0, 121, 75, 759, 15, 738, 12, 738, 12, 22]]
4
133
package main import ( "fmt" ) func main() { var N int fmt.Scanf("%d", &N) A := make([]int, N) for i := 0; i < N; i++ { fmt.Scanf("%d", &A[i]) } var money int = 1000 var kabu int = 0 for i := 0; i < N-1; i++ { if A[i] < A[i+1] { kabu = money / A[i] } money = money + kabu*(A[i+1]-A[i]) } fmt....
package main import ( "fmt" ) func main() { var N int fmt.Scanf("%d", &N) A := make([]int, N) for i := 0; i < N; i++ { fmt.Scanf("%d", &A[i]) } var money int = 1000 var kabu int = 0 for i := 0; i < N-1; i++ { kabu = 0 if A[i] < A[i+1] { kabu = money / A[i] } money = money + kabu*(A[i+1]-A[i]...
[["+", 0, 7, 8, 196, 0, 436, 31, 432, 0, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 436, 17, 32], ["+", 0, 7, 8, 196, 0, 436, 12, 432, 0, 433], ["+", 0, 435, 8, 196, 0, 7, 8, 196, 0, 165]]
7
153
#include "bits/stdc++.h" using namespace std; typedef long long ll; template <typename TYPE> void print_vec(const vector<TYPE> &v) { for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; } template <typename TYPE> void print_vec2(const vector<vector<TYPE>> &v) { cout << endl; cout <<...
#include "bits/stdc++.h" using namespace std; typedef long long ll; template <typename TYPE> void print_vec(const vector<TYPE> &v) { for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; } template <typename TYPE> void print_vec2(const vector<vector<TYPE>> &v) { cout << endl; cout <<...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
515
N = int(input()) *A, = map(int, input().split()) money, stock = 1000, 0 for a, nxt in zip(A, A[1:]): money += stock * a if a <= nxt: stock, money = divmod(money, a) money += stock * A[-1] print(money)
N = int(input()) *A, = map(int, input().split()) money, stock = 1000, 0 for a, nxt in zip(A, A[1:]): money += stock * a stock = 0 if a <= nxt: stock, money = divmod(money, a) money += stock * A[-1] print(money)
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
80
from bisect import bisect_right def main(): N = int(input()) A = list(map(int, input().split())) INF = 10 ** 18 last_max = A[0] last_min = A[0] money = 1000 stock = 0 old_trend = 0 trend = A[1] - A[0] buy_point = [] bought_point = [] for i in range(N-1): trend ...
from bisect import bisect_right def main(): N = int(input()) A = list(map(int, input().split())) INF = 10 ** 18 last_max = A[0] last_min = A[0] money = 1000 stock = 0 old_trend = 0 trend = A[1] - A[0] buy_point = [] bought_point = [] for i in range(N-1): trend ...
[["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 18], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 20]]
5
281
#include <bits/stdc++.h> using namespace std; #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 ALL(obj) (obj).begin(), (obj).end() #define INF 1e9 #define LINF 1e15 typedef long long ll; int N; vector<ll> ans(16, LIN...
#include <bits/stdc++.h> using namespace std; #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 ALL(obj) (obj).begin(), (obj).end() #define INF 1e9 #define LINF 1e15 typedef long long ll; int N; vector<ll> ans(16, LIN...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
1
642
#include <bits/stdc++.h> using namespace std; using ll = long long; vector<ll> solve(int N, vector<int> X, vector<int> Y, vector<int> P) { const ll inf = 1LL << 62; vector<vector<int>> xsel(1 << N, vector<int>(N)); vector<vector<int>> ysel(1 << N, vector<int>(N)); for (int i = 0; i < 1 << N; i++) { for (in...
#include <bits/stdc++.h> using namespace std; using ll = long long; vector<ll> solve(int N, vector<int> X, vector<int> Y, vector<int> P) { const ll inf = 1LL << 62; vector<vector<int>> xsel(1 << N, vector<int>(N)); vector<vector<int>> ysel(1 << N, vector<int>(N)); for (int i = 0; i < 1 << N; i++) { for (in...
[["-", 15, 339, 51, 16, 31, 23, 0, 16, 31, 13], ["-", 15, 339, 51, 16, 31, 23, 0, 16, 17, 151], ["+", 15, 339, 51, 16, 31, 23, 0, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 23, 0, 16, 17, 152]]
1
527
#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <cassert> #include <cfloat> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #...
#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <cassert> #include <cfloat> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #...
[["+", 31, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
631
#include <bits/stdc++.h> using namespace std; int n, a[20]; long long P[20], X[20], Y[20], Re[20]; void Gen(int I, int A[]) { if (I == n) { int k1 = 0, k2 = 0; long long Vx[17], Vy[17], Mi[17]; Vx[0] = 0; Vy[0] = 0; for (int i = 0; i < n; i++) { Mi[i] = 0; if (a[i] == 1) { V...
#include <bits/stdc++.h> using namespace std; int n, a[20]; long long P[20], X[20], Y[20], Re[20]; void Gen(int I, int A[]) { if (I == n) { int k1 = 0, k2 = 0; long long Vx[17], Vy[17], Mi[17]; Vx[0] = 0; Vy[0] = 0; for (int i = 0; i < n; i++) { Mi[i] = 0; if (a[i] == 1) { V...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19]]
1
532
#include "bits/stdc++.h" using namespace std; #define int long long #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i) #define FOR(i, s, n) for (int i = s; i < (int)n; ++i) #define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i) #define ALL(a) a.begin(), a.en...
#include "bits/stdc++.h" using namespace std; #define int long long #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i) #define FOR(i, s, n) for (int i = s; i < (int)n; ++i) #define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i) #define ALL(a) a.begin(), a.en...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
573
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include ...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include ...
[["-", 0, 124, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 124, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
1,562
#include <bits/stdc++.h> using namespace std; #define DEBUG(x) cerr << #x << ": " << x << endl; #define DEBUG_VEC(v) \ cerr << #v << ":"; \ for (int i = 0; i < v.size(); i++) ...
#include <bits/stdc++.h> using namespace std; #define DEBUG(x) cerr << #x << ": " << x << endl; #define DEBUG_VEC(v) \ cerr << #v << ":"; \ for (int i = 0; i < v.size(); i++) ...
[["-", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["-", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341...
1
1,142
#include <bits/stdc++.h> #define ll long long #define db double using namespace std; const int M = 20; const ll INF = 0x3f3f3f3f3f3f3f3f; int n; ll ans[M]; pair<pair<int, int>, ll> a[M]; vector<int> dis(M); bool vis[M][2]; ll count() { ll re = 0; for (int i = 0; i < n; i++) re += a[i].second * dis[i]; return ...
#include <bits/stdc++.h> #define ll long long #define db double using namespace std; const int M = 20; const ll INF = 0x3f3f3f3f3f3f3f3f; int n; ll ans[M]; pair<pair<int, int>, ll> a[M]; vector<int> dis(M); bool vis[M][2]; ll count() { ll re = 0; for (int i = 0; i < n; i++) re += a[i].second * dis[i]; return ...
[["-", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22], ["-", 0, 2, 3, 4, 0, 16, 31, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 16, 31, 118, 119, 120], ["-", 0, 2, 3, 4, 0, 16, 12, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 16, 12, 118, 119, 120]]
1
525
#include <bits/stdc++.h> #define int long long using pii = std::pair<int, int>; using namespace std; const int maxn = 85; int n, a[maxn]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int money = 1000, stocks = 0; for (int i = 0; i < ...
#include <bits/stdc++.h> #define int long long using pii = std::pair<int, int>; using namespace std; const int maxn = 85; int n, a[maxn]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int money = 1000, stocks = 0; for (int i = 0; i < ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
170
// c++ -std=gnu++14 a.cpp #include <algorithm> #include <bitset> #include <climits> #include <complex> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #in...
// c++ -std=gnu++14 a.cpp #include <algorithm> #include <bitset> #include <climits> #include <complex> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #in...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
1,356
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1000000007; // const ll MOD = 998244353; const ll INF = MOD * MOD; const long double EPS = 1e-12; struct mint { ll x; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() const { return mint(-x); }...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1000000007; // const ll MOD = 998244353; const ll INF = MOD * MOD; const long double EPS = 1e-12; struct mint { ll x; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() const { return mint(-x); }...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
14,972
# 解説と 提出 #15122924 を参考に作成. # 遅い. PyPyで出すと通る. はず. # import sys # sys.setrecursionlimit(10 ** 6) # import bisect # from collections import deque # from decorator import stop_watch # # # @stop_watch def solve(N, X, Y, P): inf = 10 ** 18 cnb_N = 2 ** N # 前計算 # # 集落の部分集合毎の、Y軸X軸へのそれぞれの最短経路 to_x = [[0] * ...
# 解説と 提出 #15122924 を参考に作成. # 遅い. PyPyで出すと通る. はず. # import sys # sys.setrecursionlimit(10 ** 6) # import bisect # from collections import deque # from decorator import stop_watch # # # @stop_watch def solve(N, X, Y, P): inf = 10 ** 18 cnb_N = 2 ** N # 前計算 # # 集落の部分集合毎の、Y軸X軸へのそれぞれの最短経路 to_x = [[0] * ...
[["-", 0, 662, 12, 657, 31, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 31, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
436
#pragma region Macros #pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define ld long double #define rep2(i, a, b) for (ll i = a; i <= b; ++i) #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep3(i, a, b) for (ll i = a; i >= b; --i) #define pii pair<int, int> #define pll pair<ll, ll> #defi...
#pragma region Macros #pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define ld long double #define rep2(i, a, b) for (ll i = a; i <= b; ++i) #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep3(i, a, b) for (ll i = a; i >= b; --i) #define pii pair<int, int> #define pll pair<ll, ll> #defi...
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
2,988
l, r, d = map(int,input().rstrip("\n").split(" ")) answer = (r // d) - (l // d) print(answer)
l, r, d = map(int,input().rstrip("\n").split(" ")) answer = (r // d) - ((l-1) // d) print(answer)
[["+", 12, 657, 12, 23, 0, 657, 31, 23, 0, 24], ["+", 12, 23, 0, 657, 31, 23, 0, 657, 17, 33], ["+", 12, 23, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 12, 657, 12, 23, 0, 657, 31, 23, 0, 25]]
5
45
#include <bits/stdc++.h> using namespace std; int main() { int L, R, d; cin >> L, R, d; int count = 0; for (int i = L; i <= R; i++) { if (i % d == 0) count++; } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int L, R, d; cin >> L >> R >> d; int count = 0; for (int i = L; i <= R; i++) { if (i % d == 0) count++; } cout << count << endl; }
[["-", 0, 14, 8, 9, 0, 1, 0, 34, 0, 21], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["-", 8, 9, 0, 1, 0, 34, 12, 34, 0, 21], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
65
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll l, r, d; cin >> l >> r >> d; cout << (r - 1) / d - l / d << "\n"; }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll l, r, d; cin >> l >> r >> d; cout << (r) / d - (l - 1) / d << "\n"; }
[["-", 12, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["-", 12, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 25]]
1
48
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5 + 10; #define fi first #define se second #define pb push_back #define mp make_pair #define wzh(x) cerr << #x << ' ' << x << endl int l, r, d; int main() { ios::sync_with_stdio(false); cin >> l >> r >> d; cout << (d + l - 1) / l ...
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5 + 10; #define fi first #define se second #define pb push_back #define mp make_pair #define wzh(x) cerr << #x << ' ' << x << endl int l, r, d; int main() { ios::sync_with_stdio(false); cin >> l >> r >> d; cout << (r / d) - (l - 1...
[["+", 31, 16, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 85], ["-", 12, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 24], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["...
1
84
l, r, x = map(int, input().split(' ')) ans = r // x - (l-1) // x
l, r, x = map(int, input().split(' ')) ans = r // x - (l-1) // x print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
34
L, R, d = map(int, input().split()) count = 0 for i in range(L, R): if i % d == 0: count = count + 1 print(count)
L, R, d = map(int, input().split()) count = 0 for i in range(L, R + 1): if i % d == 0: count = count + 1 print(count)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
47
L,R,d = map(int, input().split()) minumum = math.ceil(L/d) maximum = R//d if maximum - minumum >=0: print(maximum - minumum+1) else: print(0)
import math L,R,d = map(int, input().split()) minumum = math.ceil(L/d) maximum = R//d if maximum - minumum >=0: print(maximum - minumum+1) else: print(0)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
54
l,r,d=map(int,input().split()) for x in range(l,r+1): if x%d==0: c=c+1 print(c)
l,r,d=map(int,input().split()) c=0 for x in range(l,r+1): if x%d==0: c=c+1 print(c)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
46
import sys input = sys.stdin.readline def main(): ans = 0 l,r,d = map(int, input().split()) ans = (r//d) - (l//d) if l == d: ans += 1 print(ans) if __name__ == '__main__': main()
import sys input = sys.stdin.readline def main(): ans = 0 l,r,d = map(int, input().split()) ans = (r//d) - (l//d) if l%d == 0: ans += 1 print(ans) if __name__ == '__main__': main()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612]]
5
70
#include <bits/stdc++.h> #define two(a) (1 << (a)) #define LINF (1ll << 61) #define EPS (1e-14) #define Lshift(a, b) ((a) << (b)) #define Rshift(a, b) ((a) >> (b)) #define rep(a, b) for (a = 0; a < b; a++) #define xrep(a, b, c) for (a = b; a < c; a++) #define INF (1 << 29) #define sz(a) int(a.size()) #define mset(x) me...
#include <bits/stdc++.h> #define two(a) (1 << (a)) #define LINF (1ll << 61) #define EPS (1e-14) #define Lshift(a, b) ((a) << (b)) #define Rshift(a, b) ((a) >> (b)) #define rep(a, b) for (a = 0; a < b; a++) #define xrep(a, b, c) for (a = b; a < c; a++) #define INF (1 << 29) #define sz(a) int(a.size()) #define mset(x) me...
[["+", 12, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 16, 12, 23, 0, 16, 31, 23, 0, 25]]
1
164
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int l, r, d; cin >> l >> r >> d; int ans = 0; for (int i = l; i <= r; i++) if (i % d) ans++; 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 P = pair<int, int>; int main() { int l, r, d; cin >> l >> r >> d; int ans = 0; for (int i = l; i <= r; i++) if (i % d == 0) ans++; cout << ans << endl; }
[["+", 0, 7, 8, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 7, 8, 57, 15, 339, 51, 16, 12, 13]]
1
85
#include <bits/stdc++.h> using namespace std; int main() { int l, r, d; int co = 0; cin >> l >> r >> d; for (int i = l; i <= r; i++) { if (i % d) co++; } cout << co << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int l, r, d; int co = 0; cin >> l >> r >> d; for (int i = l; i <= r; i++) { if (i % d == 0) co++; } cout << co << endl; }
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
63
#include <cstdio> #include <iostream> using namespace std; int main() { int m, n, s, t = 0; cin >> m >> n >> s; for (int i = m; i <= n; i++) { if (i % n == 0) t++; } cout << t; return 0; }
#include <cstdio> #include <iostream> using namespace std; int main() { int m, n, s, t = 0; cin >> m >> n >> s; for (int i = m; i <= n; i++) { if (i % s == 0) t++; } cout << t; return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
67
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 17, 72], ["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 27, 17, 29]]
1
377
L,R,d = map(int,input().split()) r = R//4 l = (L-1)//4 print(r-l)
L,R,d = map(int,input().split()) r = R//d l = (L-1)//d print(r-l)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
38
#include <bits/stdc++.h> using namespace std; #define ll long long int #define inv(name, Type, size) \ vector<Type> name(size); \ for (int index = 0; index < n; index++) \ c...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define inv(name, Type, size) \ vector<Type> name(size); \ for (int index = 0; index < n; index++) \ c...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
208
#include <fstream> #include <iostream> using namespace std; int main() { // freopen("in.txt","t",stdin); int l, r, d; cin >> l >> r >> d; int cnt = 0; while (l <= d) { if (l % d == 0) cnt++; l++; } cout << cnt << endl; return 0; }
#include <fstream> #include <iostream> using namespace std; int main() { // freopen("in.txt","t",stdin); int l, r, d; cin >> l >> r >> d; int cnt = 0; while (l <= r) { if (l % d == 0) cnt++; l++; } cout << cnt << endl; return 0; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
66
#include <bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define F first #define S second #define mod 1000000007 #define dbg(n) cout << #n << ' ' << n << endl; #define dbg_v(v) \ cout << #v << ":"; ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define F first #define S second #define mod 1000000007 #define dbg(n) cout << #n << ' ' << n << endl; #define dbg_v(v) \ cout << #v << ":"; ...
[["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 25], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
145
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MAX 10000001 #define mod 1000000007 ll computeTotient(ll n) { ll res = n; ll tmp = n; for (int i = 2; i <= sqrt(tmp); i++) { if (n % i == 0) { res -= (res / i); while (n % i == 0) n /= i; } } if (n > 1) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MAX 10000001 #define mod 1000000007 ll computeTotient(ll n) { ll res = n; ll tmp = n; for (int i = 2; i <= sqrt(tmp); i++) { if (n % i == 0) { res -= (res / i); while (n % i == 0) n /= i; } } if (n > 1) { ...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
163
#include <bits/stdc++.h> #define ll long long #define ld long double #define pb push_back #define ip pair<ll, ll> #define vii vector<ll> #define vpp vector<ip> #define vdd vector<ld> #define vb vector<bool> #define pi pair<ll, ip> #define sc(x) scanf("%lli", &x) #define c(x) cin >> x #define fo(i, k, n) for (int i = k;...
#include <bits/stdc++.h> #define ll long long #define ld long double #define pb push_back #define ip pair<ll, ll> #define vii vector<ll> #define vpp vector<ip> #define vdd vector<ld> #define vb vector<bool> #define pi pair<ll, ip> #define sc(x) scanf("%lli", &x) #define c(x) cin >> x #define fo(i, k, n) for (int i = k;...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22]]
1
561
//-------------------------------------------------------------------------------- // Code By: // ###### # ###### // ## # # # // ##### ## ##### ## # //### // ## # # # # # //# // ## # ##### #####...
//-------------------------------------------------------------------------------- // Code By: // ###### # ###### // ## # # # // ##### ## ##### ## # //### // ## # # # # # //# // ## # ##### #####...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
613
L, R, d = map(int, input().split()) count = 0 for i in range(L, R + 1): if i // d == 0: count += 1 print(count)
L, R, d = map(int, input().split()) count = 0 for i in range(L, R + 1): if i % d == 0: count += 1 print(count)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 676], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109]]
5
47
#line 2 "../../library/template.hpp" #include <bits/stdc++.h> using namespace std; using ll = long long; using pl = pair<ll, ll>; using vl = vector<ll>; #define rep(i, n) for (ll i = 0; i < (ll)n; i++) #define rep3(i, l, r) for (ll i = l; i < (ll)r; i++) #define per(i, n) for (ll i = (ll)n - 1; i >= 0; i--) #define per...
#line 2 "../../library/template.hpp" #include <bits/stdc++.h> using namespace std; using ll = long long; using pl = pair<ll, ll>; using vl = vector<ll>; #define rep(i, n) for (ll i = 0; i < (ll)n; i++) #define rep3(i, l, r) for (ll i = l; i < (ll)r; i++) #define per(i, n) for (ll i = (ll)n - 1; i >= 0; i--) #define per...
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 60], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
428
#include <iostream> int main(void) { using namespace std; int l, r, d, cnt; int i; cin >> l >> r >> d; for (i = l; i < r; i++) { if (i % d == 0) { cnt++; } } cout << cnt << endl; return 0; }
#include <iostream> int main(void) { using namespace std; int l, r, d, cnt = 0; int i; cin >> l >> r >> d; for (i = l; i <= r; i++) { if (i % d == 0) { cnt++; } } cout << cnt << endl; return 0; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
70
#include <algorithm> #include <iostream> using namespace std; int main(void) { int l, r, d; cin >> l >> r >> d; cout << r / d - l / d; }
#include <algorithm> #include <iostream> using namespace std; int main(void) { int l, r, d; cin >> l >> r >> d; cout << r / d - (l - 1) / d; }
[["+", 0, 16, 12, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 16, 12, 16, 12, 16, 31, 23, 0, 25]]
1
40
lst = input().split() L = int(lst[0]) R = int(lst[1]) d = int(lst[2]) if L % d != 0: L = L + d - (L % d) if R % d != 0: R = R - d + (R % d) result = int(((R - L) / d) + 1) print(result)
lst = input().split() L = int(lst[0]) R = int(lst[1]) d = int(lst[2]) if L % d != 0: L = L + d - (L % d) if R % d != 0: R = R - (R % d) result = int(((R - L) / d) + 1) print(result)
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72]]
5
92
L, R, d = [int(x) for x in input().split()] compteur = 0 for i in range(L, R+1): if i%d == 0: k += 1
L, R, d = [int(x) for x in input().split()] compteur = 0 for i in range(L, R+1): if i%d == 0: compteur += 1 print(compteur)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
47
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { int L, R, d, count = 0; cin >> L >> R >> d...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { int L, R, d, count = 0; cin >> L >> R >> d...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
117
#include <bits/stdc++.h> using namespace std; #define async \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define Int long long int #define let auto #define of : #define all(y) y.begin(), y.end() #def...
#include <bits/stdc++.h> using namespace std; #define async \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define Int long long int #define let auto #define of : #define all(y) y.begin(), y.end() #def...
[["-", 0, 1, 0, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 16, 12, 16, 31, 16, 31, 22]]
1
78
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define all(x) x.begin(), x.end() #define pb push_back #define pf push_front...
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define all(x) x.begin(), x.end() #define pb push_back #define pf push_front...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
130
#include <bits/stdc++.h> using namespace std; int main() { int l, r, d; cin >> l >> r >> d; int count = 0; for (int i = l; i <= r; i++) { if (i % count == 0) count++; } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int l, r, d; cin >> l; cin >> r; cin >> d; int count = 0; for (int i = l; i <= r; i++) { if (i % d == 0) count++; } cout << count << endl; }
[["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
65
#include <iostream> using namespace std; int main() { int n, m, r, t = 0; cin >> n >> m >> r; for (int i = n; i <= m; i++) { if (i % r == 0) t++; } return 0; }
#include <iostream> using namespace std; int main() { int n, m, r, t = 0; cin >> n >> m >> r; for (int i = n; i <= m; i++) { if (i % r == 0) t++; } cout << t; return 0; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
61
L,R,d=map(int,input().split()) if R%d!=0: print(int(R/d)-int(L/d)) else: print(int(R/d)-int(L/d)+1)
L,R,d=map(int,input().split()) if L%d!=0: print(int(R/d)-int(L/d)) else: print(int(R/d)-int(L/d)+1)
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22]]
5
61
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define test ...
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define test ...
[["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 85], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 24], ["-", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33]]
1
392
#include <bits/stdc++.h> using namespace std; int main() { int l, R, d; cin >> l >> R >> d; cout << (R - l) / d; }
#include <bits/stdc++.h> using namespace std; int main() { int l, R, d; cin >> l >> R >> d; cout << (R / d - (l - 1) / d); }
[["+", 0, 16, 12, 23, 0, 16, 31, 16, 17, 85], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 12, 23, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 12, 23, 0, 25]]
1
37
// let input = "6 20 7"; function main(input) { input = input.trim(); let list = input.split(" "); let min = parseInt(list[0]); let max = parseInt(list[1]); let a = parseInt(list[2]); let dai = Math.floor(max / a); let syou = Math.floor(min / a); let answer = dai - syou; console.log(answer); } // mai...
// let input = "6 20 7"; function main(input) { input = input.trim(); let list = input.split(" "); let min = parseInt(list[0]) - 1; let max = parseInt(list[1]); let a = parseInt(list[2]); let dai = Math.floor(max / a); let syou = Math.floor(min / a); let answer = dai - syou; console.log(answer); } //...
[["+", 8, 556, 0, 570, 0, 200, 51, 16, 17, 33], ["+", 8, 556, 0, 570, 0, 200, 51, 16, 12, 555]]
2
121
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int l, r, d; cin >> l >> r >> d; cout << (r - l + 1) / d << '\n'; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int l, r, d; cin >> l >> r >> d; cout << r / d - (l - 1) / d << '\n'; }
[["-", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 85], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22], ["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 24], ["-", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33]]
1
57
l, r, d = map(int, input().split()) ans = 0 for i in range(l, r+1): if i % d: ans += 1 print(ans)
l, r, d = map(int, input().split()) ans = 0 for i in range(l, r+1): if i % d == 0: ans += 1 print(ans)
[["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
45
def solve(L,R,d): count = 0 for i in range(L,R+1): if i % d == 0: count += 1 return count L, R, D = map(int, input().split()) print(solve(L,R,d))
def solve(L,R,d): count = 0 for i in range(L,R+1): if i % d == 0: count += 1 return count L, R, d = map(int, input().split()) print(solve(L,R,d))
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22]]
5
66
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n + 1; i++) #define all(A) A.begin(), A.end() typedef long long ll; int main() { int L, R, d; cin >> L >> R >> d; cout << (R - L + 1) / d << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n + 1; i++) #define all(A) A.begin(), A.end() typedef long long ll; int main() { int L, R, d; cin >> L >> R >> d; cout << R / d - (L - 1) / d << endl; }
[["-", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 85], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22], ["+", 31, 16, 12, 16, 12, 16, 31, 23, 0, 24], ["-", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33]]
1
68
l,r,d=map(int,input().split()) i=0 count=0 for i in range(l,r): if i%d==0: count+=1 print(count)
l,r,d=map(int,input().split()) i=0 count=0 for i in range(l,r+1): if i%d==0: count+=1 print(count)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
48
l,R, d = map(int, input()).split() a =0 for i in range(l,R): if i % d == 0: a = a+1 print(a)
l,R, d = map(int, input().split()) a =0 for i in range(l,R+1): if i % d == 0: a = a+1 print(a)
[["-", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
47
L, R, d = gets.split.map(&:to_i) puts d==1 ? R/d - L/d + 1 : R/d - L/d
L, R, d = gets.split.map(&:to_i) puts L%d==0 ? R/d - L/d + 1 : R/d - L/d
[["+", 3, 4, 0, 754, 15, 738, 31, 738, 31, 743], ["+", 3, 4, 0, 754, 15, 738, 31, 738, 17, 109], ["-", 0, 652, 3, 4, 0, 754, 15, 738, 12, 612], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 12, 612]]
4
37
l, r, d = gets.chomp.split(' ').map(&:to_i) count = 0 (l..r).each { |i| count + i % d == 0 ? 1 : 0 } puts count
l, r, d = gets.chomp.split(' ').map(&:to_i) count = 0 (l..r).each { |i| count += i % d == 0 ? 1 : 0 } puts count
[["-", 8, 734, 0, 754, 15, 738, 31, 738, 17, 72], ["+", 0, 652, 196, 196, 8, 734, 0, 755, 17, 107]]
4
50
#include <iostream> using namespace std; int main() { int l, r, k, ans = 0; cin >> l >> r >> k; for (int i = l; i <= r; i++) ans += i & k == 0; cout << ans; }
#include <iostream> using namespace std; int main() { int l, r, k, ans = 0; cin >> l >> r >> k; for (int i = l; i <= r; i++) ans += i % k == 0; cout << ans; }
[["-", 0, 7, 8, 1, 0, 11, 12, 16, 17, 67], ["+", 8, 1, 0, 11, 12, 16, 31, 16, 17, 109]]
1
57
#include <bits/stdc++.h> #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define unmap unordered_map<int, int>...
#include <bits/stdc++.h> #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define unmap unordered_map<int, int>...
[["-", 0, 14, 8, 9, 0, 7, 26, 11, 17, 107], ["-", 0, 14, 8, 9, 0, 7, 26, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29]]
1
109
#include <bits/stdc++.h> using namespace std; int main() { int l, r, d; cin >> l >> r >> d; if (l > r) cout << 0 << endl; else cout << (r / d) - (l / d) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int l, r, d; cin >> l >> r >> d; if (l > r) cout << 0 << endl; else cout << (r / d) - ((l - 1) / d) << endl; }
[["+", 12, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 16, 12, 23, 0, 16, 31, 23, 0, 25]]
1
56
#include <iostream> using namespace std; int main() { int l, r, x; cin >> l >> r >> x; cout << (r / x - l / x) << endl; }
#include <iostream> using namespace std; int main() { int l, r, x; cin >> l >> r >> x; cout << (r / x - (l - 1) / x) << endl; }
[["+", 12, 23, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 23, 0, 16, 12, 16, 31, 23, 0, 25]]
1
41
#include <bits/stdc++.h> using namespace std; #define LL long long #define DD long double #define M 1000000007 #define INF 1e18 void setIO(string s = "") { cin.sync_with_stdio(0); cin.tie(0); if (s.size()) s += ".in", freopen(s.c_str(), "r", stdin); } int tt = 1; void solve() { int c = 0, l, r, d; cin...
#include <bits/stdc++.h> using namespace std; #define LL long long #define DD long double #define M 1000000007 #define INF 1e18 void setIO(string s = "") { cin.sync_with_stdio(0); cin.tie(0); if (s.size()) s += ".in", freopen(s.c_str(), "r", stdin); } int tt = 1; void solve() { int c = 0, l, r, d; cin...
[["-", 8, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
157
#include <bits/stdc++.h> using namespace std; int main(void) { int l; int r; int d; cin >> l >> r >> d; int cnt; for (int i = l; l <= r; l++) { if (i % d == 0) { cnt++; } } cout << cnt << endl; }
#include <bits/stdc++.h> using namespace std; int main(void) { int l; int r; int d; cin >> l >> r >> d; int cnt = 0; for (int i = l; i <= r; i++) { if (i % d == 0) { cnt++; } } cout << cnt << endl; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22]]
1
68