func_code_string: #include <bits/stdc++.h>   using namespace std;   int lastr, lastc;   int n, m, a, b;   int row1[10], rcnt, ans;   int main() {     int i, j, k;     while (scanf( %d%d%d%d , &n, &m, &a, &b) != EOF) {       if (m == 1) {         printf( 1 n );         continue;       }       lastr = (n + m - 1) / m;       lastc = n % m;       lastc = lastc == 0 ? m : lastc;       ans = 0, rcnt = 0;       row1[++rcnt] = (a + m - 1) / m;       if ((b + m - 1) / m != (a + m - 1) / m) {         if ((b + m - 1) / m == (a + m - 1) / m + 1)           row1[++rcnt] = (b + m - 1) / m;         else           row1[++rcnt] = row1[1] + 1, row1[++rcnt] = (b + m - 1) / m;       }       int ta = a % m, tb = b % m;       if (ta == 0) ta = m;       if (tb == 0) tb = m;       if (rcnt == 1)         printf( 1 n );       else if (rcnt == 2) {         if (ta == 1 &&             (row1[2] != lastr && tb == m || row1[2] == lastr && tb == lastc))           printf( 1 n );         else           printf( 2 n );       } else {         if (ta == 1 &&             (row1[3] != lastr && tb == m || row1[3] == lastr && tb == lastc))           printf( 1 n );         else if (ta == 1 || tb == m || ta - 1 == tb ||                  (lastr == row1[3] && lastc == tb))           printf( 2 n );         else           printf( 3 n );       }     }   }   