There are $$$n$$$ doors. You want to open all of them. There are some rules.
For each $$$2 \le i \le n$$$, you can open the $$$i$$$-th door only if you have already opened the ($$$i-1$$$)-th door.
Initially, you have $$$x$$$ coins.
There is a lock on the $$$i$$$-th door with a cost of $$$c_i$$$. In other words, you need to spend $$$c_i$$$ coins to open the $$$i$$$-th door. If the number of coins you currently have is strictly less than $$$c_i$$$, you will not be able to open the $$$i$$$-th door. After opening the $$$i$$$-th door, you will receive $$$a_i$$$ coins as a prize.
You can do the following operation any number of times:
Find the minimum number of operations necessary to open all the doors.
The first line contains an integer $$$t$$$ ($$$1 \le t \le 2000$$$), the number of test cases. For each test case:
For each test case, output the minimum number of operations needed to open all the doors.
31 1113 109 6 51 1 13 105 9 91 2 9
0 1 2
In the first test case, you don't need to perform any operations. You can just spend $$$1$$$ coin to open the first (and only) lock.
In the second test case, you can first set $$$c_1$$$ to $$$0$$$. Then, you can do the following: