Solution of spoj classical problems