SP18289 IITWPC4L - Maggu and Mystery
Description
Once Maggu went for an adventerous trip to mysteryland. Mysteryland is full of mysteries. There are n doors for entering into mysteryland. Maggu has to open atleast d doors to enter into mysteryland. Each door of mysteryland can only be opened by specific mystery key. Each of the door has a number lock on it and door opens only by a key of that number.
As Maggu is a small boy, he is given a mystery power for each door. A mystery power is as follows, He can increase or decrease the number of key of i^th door by atmost v\[i\]. Needless to say that msyteryland is so mysterious that keys to the locks are not fixed, they could be any integer (No need to be positive). But there is a problem, no two doors of the doors of mysteryland can be opened by same numbered keys ie if there are two or more doors that have same key, then only the first door will open. So he wants to apply mystery power operations so as to open atleast d doors. He can a apply a mystery operation on any of the door and as much times as he wishes.
As he is in haste for doing adventure, he wants to do this by using as less Mystery power operations as possible. Find out the minimum number of mystery power he needs to apply to enter into mysteryland so that he could enjoy himself :)
Input Format
First line of the input contains T denoting number of test cases (1
Output Format
For each test case, output a single line representing the answer to the problem.