Interesting! That's much,
much easier to implement. That could be written in 2 minutes, whereas mine took about 20. I now feel like I'll be wasting so much time on this contest by not using the STL. I'll have to ask the judges what they want to see...
It's interesting to note that mine is about 200% faster on the file with half a million integers. I guess that's because the stl map isn't a hash table. And your code worked, but you had a mismatched bracket before the greater than sign.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <map>
int main() {
unsigned n, x, size, mode=0;
freopen("mode.in", "rt", stdin);
scanf("%d\n", &n);
std::map<int,int> counts;
while (n--) {
scanf("%d\n", &x);
if (( size = ++counts[x]) > mode) mode = size;
}
printf("%d\n", mode);
return 0;
}