removed sorting. Got +1 on kattis for that so probably good to keep for now. Also added dprint() function for debug prints.