My friend's friend made a function for inputing unsigned integers. It's faster than scanf and much faster than cin. But I made a small change and I think it's a bit faster now. But I'm not sure. Here's the old function:
1 2 3 4 5 6 7 8
int scanInt ()
{
char c;
while (!isdigit (c = getchar ()));
int ret = c - '0';
while (isdigit (c = getchar ())) ret = (ret * 10) + (c - '0');
return ret;
}