func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n, m;     cin >> n >> m;     vector<int> a(n), b(n);     for (int i = (0); i < (m); i++) {       int x, y;       cin >> x >> y;       --x;       --y;       y = (y - x + n) % n;       b[x] = a[x]++ ? min(b[x], y) : y;     }     for (int i = (0); i < (n); i++)       if (a[i]) {         a[i] = a[i] * n + b[i] + i;         b[i] = a[i] - n;       }     for (int i = (0); i < (n); i++)       if (i) a[i] = max(a[i], a[i - 1]);     for (int i = (n); i-- > (0);)       if (i < n - 1) b[i] = max(b[i], b[i + 1]);     for (int i = (0); i < (n); i++)       cout << max(i ? a[i - 1] : 0, b[i]) - i <<    ;   }   