func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int a, t, f, k, y = 0, w, j = 0, x = 0;     cin >> a >> t >> f >> k;     w = t;     for (;;) {       if (x == 0) {         if (j % 2 == 1) j++;         if (j == k) break;         if (w >= f) {           x = f;           w -= f;         } else {           cout << -1;           return 0;         }       } else if (x == f) {         if (j % 2 == 0) {           if (w >= (a - f) * 2) {             x = a;             w -= (a - f);           } else if (w >= a - f) {             if (j == k - 1) {               x = a;               w -= (a - f);             } else {               w = t;               x = a;               w -= (a - f);               y++;             }           } else {             if (t >= a - f) {               w = t;               x = a;               w -= (a - f);               y++;             } else {               cout << -1;               return 0;             }           }         } else {           if (w >= f * 2) {             x = 0;             w -= f;           } else if (w >= f) {             if (j == k - 1) {               x = 0;               w -= f;             } else {               w = t;               x = 0;               w -= f;               y++;             }           } else {             if (t >= f) {               w = t;               x = 0;               w -= f;               y++;             } else {               cout << -1;               return 0;             }           }         }       } else if (x == a) {         if (j % 2 == 0) j++;         if (j == k) break;         if (w >= a - f) {           x = f;           w -= (a - f);         } else {           cout << -1;           return 0;         }       }       if (j == k) break;     }     cout << y;   }   