func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MaxN = 1e4 + 10;   int n, b, q;   pair<int, int> h[MaxN];   unordered_map<int, int> e[MaxN];   vector<int> c[MaxN];   int flow, parent[MaxN], mini, curr;   void dfs(int x) {     if (parent[q + 6] != -1) return;     for (int i = 0; i < c[x].size(); i++) {       if (e[x][c[x][i]] > 0 && parent[c[x][i]] == -1) {         parent[c[x][i]] = x;         dfs(c[x][i]);       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> b >> q;     for (int i = 0; i < q; i++) cin >> h[i].first >> h[i].second;     for (int i = 1; i <= 5; i++) {       c[0].push_back(i);       c[i].push_back(0);       e[0][i] = n / 5;       e[i][0] = 0;     }     sort(h, h + q);     h[q].first = b;     h[q].second = n;     q++;     for (int i = q - 1; i >= 0; i--) {       e[i + 6][q + 6] = h[i].second;       e[q + 6][i + 6] = 0;       c[i + 6].push_back(q + 6);       c[q + 6].push_back(i + 6);       if (i < q - 1) {         e[i + 7][q + 6] -= h[i].second;         if (e[i + 7][q + 6] < 0) {           cout <<  unfair ;           return 0;         }       }       for (int j = 0; j < 5; j++) {         e[j + 1][i + 6] = h[i].first / 5;         if (j > 0 && h[i].first % 5 >= j) e[j + 1][i + 6]++;         e[i + 6][j + 1] = 0;         c[j + 1].push_back(i + 6);         c[i + 6].push_back(j + 1);         if (i < q - 1) e[j + 1][i + 7] -= e[j + 1][i + 6];       }     }     while (true) {       for (int i = 0; i < MaxN; i++) parent[i] = -1;       parent[0] = 0;       dfs(0);       if (parent[q + 6] == -1) break;       curr = q + 6;       mini = 1e6;       while (curr != 0) {         mini = min(mini, e[parent[curr]][curr]);         curr = parent[curr];       }       flow += mini;       curr = q + 6;       while (curr != 0) {         e[parent[curr]][curr] -= mini;         e[curr][parent[curr]] += mini;         curr = parent[curr];       }     }     if (flow == n)       cout <<  fair ;     else       cout <<  unfair ;     return 0;   }   