I like your way of thinking.
I was always thinking why LiveArchive Board is so inactive (why, there are ever so many rubrics with no posts in them!).
However, SWERC 2005 Data is 12Mb, what on earth they have packed there - I haven't the slightest idea
If there is ever a war between men and machines, it is easy to guess who will start it (c) Arthur Clarke
Well, I was going to post a response a week or two ago day, but you removed your post. I see it's there again (with the changed code, I guess).
I checked my Java code and there is nothing special, read graph, do BFS.
With 10^5, nodes can't fit in 2 bytes (I assume short is 2 bytes), that's where the RTE's are happening. I couldn't follow that code because I don't know C enough, stuff like "u = *head++;" just throws me off.
I have no idea why you would be getting MLE, my Java submission uses 13MB.
I've downloaded that 12Mb, made a python program that complies and executes my code with that cases, and now it's ok.
You're right, USHORT_MAX == (1 << 32)-1,
so 100,000 (btw, you gave me a striking piece of information: 10^5 != 10^4)
was not going to fit in short by no means.
Also, my AC-code isn't fast enough - 1,438 CPU - but it takes ~6000 memory.
If there is ever a war between men and machines, it is easy to guess who will start it (c) Arthur Clarke