my own solution for usaco