the code for solve the uva problems