gets the answer correct on sample input, but something is breaking