C : Sibling Rivalry

Time Limit : 2 sec, Memory Limit : 262144 KB

Problem statement is available from here.