For this Question: Newton loves playing the ancient game of Chips. It is played on a directed graph consisting of N vertices and M edges. Each vertex of the graph initially contains A<sub>i</sub> chips. A move is defined as:

Choose a vertex i, such that the number of chips at vertex i is exactly equal to the out-degree of vertex i. Also, the number of chips at vertex i must be positive. Then, for each edge from i to v, shift exactly one chip from vertex i to vertex v.

It is guaranteed that the graph does not contain directed cycles. A player's score is the number of moves that they perform. It can be shown that the score will always be finite. Print the maximum score that can be attained by a player. 

Further, suppose the player is allowed to place extra chips on some of the vertices. Formally, if the player is allowed to increase the initial number of chips at each vertex i to B<sub>i</sub>  (where B<sub>i</sub> &ge; A<sub>i</sub>), then print the minimum number of extra chips needed to increase the maximum score of the game. If it is not possible to increase the score of the game, print -1.The first line of the input contains the number of test cases, T (1 &le; T &le; 10<sup>5</sup>).
The first line of each test case consists of two integers N (1&le; N &le; 10<sup>5</sup>) and M (0 &le; M &le; min(2×10<sup>5</sup>, N(N - 1)/2)) — the number of vertices and edges respectively. 
The second line consists of N integers — A<sub>1</sub>, A<sub>2</sub>, ... A<sub>N</sub> (0 &le; A<sub>i</sub> &le; 10<sup>5</sup>).
Then M lines follow, the i<sup>th</sup> line containing two integers u<sub>i</sub> and v<sub>i</sub> — denoting there is an edge from u<sub>i</sub> to v<sub>i</sub>. There are no self-loops or multiple edges in the given graph.
It is guaranteed that the sum of N over all test cases is less than 3×10<sup>5</sup> and the sum of M over all test cases is less than 4×10<sup>5</sup>. For each test case, print two space separated integers. The first integer denotes the maximum score of the game. The second integer denotes the minimum number of chips that must be added to some vertices so that the maximum score of the game increases. If the score of the game cannot be increased, print -1 instead.Sample Input 1:
2
2 1
1 1
1 2
2 1
2 2
1 2
Sample Output 1:
1 -1
0 -1

Sample Input 2:
1
4 3
1 0 0 2
1 2
3 2
2 4
Sample Output 2:
2 1, I have written this Solution Code: #include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define reads(s) string s; cin >> s;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define setprec cout << fixed << showpoint << setprecision(20);
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const ll N = 6e5 + 10;

int n, m;
vvi adj, adjrev;
vi vis, topo;

void dfs (int cur)
{
    vis[cur] = true;
    for (int i: adj[cur])
        if (!vis[i])
            dfs(i);

    topo.pb(cur);
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    read(t);
    while(t--)
    {
        cin >> n >> m;
        adj.assign(n + 1, vi(0));
        adjrev.assign(n + 1, vi(0));
        vis.assign(n + 1, 0);

        readarr(a, n);
        int d[n + 1] = {};
        FOR (i, 1, m)
        {
            readb(x, y);
            adj[x].pb(y);
            adjrev[y].pb(x);
            d[x]++;
        }

        topo.clear();
        FOR (i, 1, n)
            if (!vis[i])
                dfs(i);

        reverse(all(topo));
        int dp[n + 1] = {}, ans = 0, mn = inf;

        for (int i: topo)
        {
            if (a[i] > d[i] || d[i] == 0) continue;

            int sum = a[i];
            for (int j: adjrev[i]) sum += dp[j];
            dp[i] = sum/d[i];
            ans += dp[i];

            int x = d[i] - sum%d[i];
            if (x + a[i] <= d[i]) mn = min(mn, x);
        }

        cout << ans << " ";
        if (mn < inf) cout << mn << endl;
        else cout << -1 << endl;
    }
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?