func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int dp[360361];   long long int k;   bool reach(long long int from, long long int to) {     if (from <= to) return false;     long long int d = from - to;     if (d == 1) return true;     for (long long int i = (long long int)(from - to + 1);          i < ((long long int)(k + 1)); i++)       if (to % i == 0 && to + i > from) return true;     return false;   }   long long int calc(long long int from, long long int to) {     for (long long int i = (long long int)(from); i < ((long long int)(to + 1));          i++)       dp[i] = 999999;     dp[from] = 0;     for (long long int i = (long long int)(from + 1);          i < ((long long int)(to + 1)); i++) {       for (long long int j = i - 1; j >= max(from, i - k + 1); j--) {         if (reach(i, j)) dp[i] = min(dp[i], dp[j] + 1);       }     }     return dp[to];   }   int main() {     long long int a, b;     cin >> a >> b >> k;     a -= 360360 * (b / 360360);     b = b % 360360;     if (a < 360360) {       cout << calc(b, a) << endl;     } else {       long long int res = 0;       res += calc(b, 360360);       long long int nums = (a - (a % 360360) - 360360) / 360360;       res += calc(0, 360360) * nums;       res += calc(0, a % 360360);       cout << res << endl;     }     return 0;   }   