#include #define ll long long int main() { ll l, r, n, ret, quo, rem; scanf("%lld %lld %lld", &l, &r, &n); for (ll remainder = 0; remainder < n; ++remainder) { quo = r / n; rem = r - quo * n; if (rem < 0) { rem += n; quo -= 1; } ret = (remainder <= rem) ? quo + 1 : quo; if (l > 0) { quo = (l - 1) / n; rem = l - 1 - quo * n; if (rem < 0) { rem += n; quo -= 1; } ret -= (remainder <= rem) ? quo + 1 : quo; } printf("%lld\n", ret); } }