doesn't work with UVA's file i/o (time limit)
not UVA optimized
-