My ICPC solution