Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <bits/stdc++.h>using namespace std;const int MAXN = 1e5+10;int N, M;int degree[MAXN];struct Edge { int to, next; }e[MAXN<<1];int head[MAXN], stkptr = 0;inline void addEdge(int u, int v){e[stkptr] = {v, head[u]};head[u] = stkptr++;}int main(){int T; cin >> T;while(T--){stkptr = 0;memset(degree, 0, sizeof degree);memset(head, -1, sizeof head);cin >> N >> M;while(M--){int a, b;scanf("%d%d", &a, &b);addEdge(a, b);