func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long n, t, x, y;     long long pos_ji, pos_ou;     while (~scanf( %lld%lld , &n, &t)) {       while (t--) {         scanf( %lld%lld , &x, &y);         long long ji = n / 2 * n + (n + 1) / 2 + 1;         long long ou = n / 2 * n + 1;         pos_ji = (x - 1) * n + y;         if (n % 2 != 0) {           if (pos_ji % 2 == 0)             printf( %lld n , ji + (pos_ji - 1) / 2);           else             printf( %lld n , (pos_ji + 1) / 2);         } else {           if (x % 2 != 0 && y % 2 != 0) {             printf( %lld n , (x / 2) * n + (y + 1) / 2);           } else if (x % 2 != 0 && y % 2 == 0) {             printf( %lld n , ou + (x / 2) * n + (y - 1) / 2);           } else if (x % 2 == 0 && y % 2 != 0) {             printf( %lld n , ou + n / 2 + (x - 2) / 2 * n + y / 2);           } else             printf( %lld n , n / 2 + (x - 2) / 2 * n + y / 2);         }       }     }     return 0;   }   