func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long int N = 1e5 + 5;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int n, m;     cin >> n >> m;     vector<long long int> G[N];     for (long long int i = 0; i < m; ++i) {       long long int a, b;       cin >> a >> b;       G[a].push_back(b);     }     long long int rnd[N];     for (long long int i = 1; i < n + 1; ++i) {       long long int z = G[i].size();       rnd[i] = z - 1;     }     long long int far[N];     for (long long int i = 1; i < n + 1; ++i) {       far[i] = N * N * N;       if (rnd[i] >= 0) {         for (long long int j = 0; j < G[i].size(); ++j) {           long long int x = G[i][j];           if (x > i)             far[i] = min(x - i, far[i]);           else             far[i] = min(n - i + x, far[i]);         }       }       if (G[i].size() == 0) far[i] = 0;     }     for (long long int i = 1; i < n + 1; ++i) {       long long int mx = 0;       for (long long int j = 1; j < n + 1; ++j) {         long long int s = 0;         if (rnd[j] > 0 || far[j] > 0) {           long long int z = j - i;           if (j < i) z = n - i + j;           s = z + rnd[j] * n + far[j];         }         mx = max(s, mx);       }       cout << mx <<    ;     }     cout <<   n ;     return 0;   }   