copied everything from codejudge