func_code_string: #include <bits/stdc++.h>   using namespace std;   const int NMAX = 20, LMAX = 400000, INF = ~0u >> 1;   int K, L = 1, f1[2 * LMAX], f2[LMAX], f3[LMAX];   long long A, B;   int gcd(int x, int y) {     if (!y) return x;     return gcd(y, x % y);   }   int main() {     int i, j;     scanf( %I64d %I64d %d , &B, &A, &K);     for (i = 2, L = 2; i <= K; i += 1) L = i * L / gcd(L, i);     f1[0] = f2[0] = f3[0] = 0;     if (B - A <= (long long)2 * L) {       for (i = 1; A + i - 1 != B; i += 1) {         f1[i] = f1[i - 1] + 1;         for (j = 2; j <= K; j += 1) {           if (i >= (A + i) % j) f1[i] = min(f1[i], f1[i - (A + i) % j] + 1);         }       }       printf( %d n , f1[i - 1]);     } else {       for (i = 1; i <= L && (A + i - 1) % L; i += 1) {         f1[i] = f1[i - 1] + 1;         for (j = 2; j <= K; j += 1) {           if ((long long)i >= (A + i) % j)             f1[i] = min(f1[i], f1[i - (A + i) % j] + 1);         }       }       for (i = 1; i <= L; i += 1) {         f2[i] = f2[i - 1] + 1;         for (j = 2; j <= K; j += 1) {           if (i >= i % j) f2[i] = min(f2[i], f2[i - i % j] + 1);         }       }       for (i = 1; i <= L && (i - 1) != B % L; i += 1) {         f3[i] = f3[i - 1] + 1;         for (j = 2; j <= K; j += 1) {           if (i >= i % j) f3[i] = min(f3[i], f3[i - i % j] + 1);         }       }       printf( %I64d n , f1[(A + L - 1) / L * L - A] +                             (long long)f2[L] * (B / L - (A + L - 1) / L) +                             f3[i - 1]);     }     exit(0);   }   