heap, tasks

There are solutions of some tasks from

http://informatics.mccme.ru/mod/statements/view3.php?id=1234&chapterid=1164#1