func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   int q;   vector<pair<int, int> > v;   vector<pair<int, int> > V;   vector<int> amount;   int root = 0;   int en = 100002 - 1;   struct MaximumFlow {     static const long long int InfCapacity = LLONG_MAX;     struct Edge {       int to;       long long int capacity;       int rev;     };     vector<vector<Edge> > g;     void init(int n) { g.assign(n, vector<Edge>()); }     void add(int i, int j, long long int capacity) {       Edge e, f;       e.to = j, f.to = i;       e.capacity = capacity, f.capacity = 0;       g[i].push_back(e);       g[j].push_back(f);       g[i].back().rev = (int)g[j].size() - 1;       g[j].back().rev = (int)g[i].size() - 1;     }     void addB(int i, int j, long long int capacity) {       Edge e, f;       e.to = j, f.to = i;       e.capacity = capacity, f.capacity = capacity;       g[i].push_back(e);       g[j].push_back(f);       g[i].back().rev = (int)g[j].size() - 1;       g[j].back().rev = (int)g[i].size() - 1;     }     long long int maximumFlow(int s, int t) {       int n = g.size();       vector<int> level(n);       long long int total = 0;       bool update;       do {         update = false;         fill(level.begin(), level.end(), -1);         level[s] = 0;         queue<int> q;         q.push(s);         for (int d = n; !q.empty() && level[q.front()] < d;) {           int u = q.front();           q.pop();           if (u == t) d = level[u];           for (auto e = g[u].begin(); e != g[u].end(); e++)             if (e->capacity > 0 && level[e->to] == -1)               q.push(e->to), level[e->to] = level[u] + 1;         }         vector<int> iter(n);         for (int i = 0; i < n; i++) iter[i] = (int)g[i].size() - 1;         while (1) {           long long int f = augment(level, iter, s, t, InfCapacity);           if (f == 0) break;           total += f;           update = true;         }       } while (update);       return total;     }     long long int augment(vector<int> &level, vector<int> &iter, int u, int t,                           long long int f) {       if (u == t || f == 0) return f;       int lv = level[u];       if (lv == -1) return 0;       level[u] = -1;       for (; iter[u] >= 0; --iter[u]) {         Edge &e = g[u][iter[u]];         if (level[e.to] <= lv) continue;         long long int l = augment(level, iter, e.to, t, min(f, e.capacity));         if (l == 0) continue;         e.capacity -= l;         g[e.to][e.rev].capacity += l;         level[u] = lv;         return l;       }       return 0;     }   };   MaximumFlow f;   void add_edge(int a, int b, int c) { f.add(a, b, c); }   int b;   int lab[10002];   int linkk[10002];   int main() {     cin >> n >> b >> q;     while (q--) {       int c, d;       scanf( %d%d , &c, &d);       v.push_back(make_pair(c, d));     }     v.push_back(make_pair(b, n));     sort(v.begin(), v.end());     int pr = 1;     int cnt = 0;     for (int i = 0; i < v.size(); i++) {       int res = v[i].second - cnt;       if (res < 0) {         puts( unfair );         return 0;       }       V.push_back(make_pair(pr, v[i].first));       amount.push_back(res);       cnt = v[i].second;       pr = v[i].first + 1;     }     int C = 11451;     for (int i = 0; i < V.size(); i++) {       linkk[i] = C;       C++;     }     f.init(100002);     for (int i = 0; i < 5; i++) {       add_edge(root, i + 1, n / 5);     }     for (int i = 1; i <= b; i++) {       lab[i] = 5 + i;       add_edge((i % 5) + 1, lab[i], 1);       add_edge(lab[i],                linkk[lower_bound(V.begin(), V.end(), make_pair(i, INT_MAX)) -                      V.begin() - 1],                1);     }     for (int i = 0; i < V.size(); i++) {       add_edge(linkk[i], en, amount[i]);     }     int ans = f.maximumFlow(root, en);     if (ans == n) {       puts( fair );     } else {       puts( unfair );     }     return 0;   }   