Take discount or Not codechef solution
There are NN items in a shop. You know that the price of the ii-th item is AiAi. Chef wants to buy all the NN items.
There is also a discount coupon that costs XX rupees and reduces the cost of every item by YY rupees. If the price of an item was initially ≤Y≤Y, it becomes free, i.e, costs 00.
Determine whether Chef should buy the discount coupon or not. Chef will buy the discount coupon if and only if the total price he pays after buying the discount coupon is strictly less than the price he pays without buying the discount coupon.
Input Format
- The first line of input will contain a single integer TT, denoting the number of test cases. The description of the test cases follows.
- Each test case consists of two lines of input.
- The first line of the test case contains three space-separated integers — NN, XX, and YY.
- The second line contains NN space-separated integers — A1,A2,…,ANA1,A2,…,AN.
Output Format
Take discount or Not codechef solution
- For each test case, output
COUPON
if Chef should buy the discount coupon, andNO COUPON
otherwise.
Each letter of the output may be printed in either lowercase or uppercase. For example, the strings coupon
, CouPoN
, and COUPON
will all be treated as equivalent.
Constraints
- 1≤T≤10001≤T≤1000
- 1≤N≤1001≤N≤100
- 1≤X,Y≤1051≤X,Y≤105
- 1≤Ai≤1051≤Ai≤105
Sample Input 1
Take discount or Not codechef solution
5
4 30 10
15 8 22 6
4 40 10
15 8 22 6
4 34 10
15 8 22 6
2 10 100
60 80
3 30 5
50 60 50
Sample Output 1
COUPON
NO COUPON
NO COUPON
COUPON
NO COUPON
Explanation
Take discount or Not codechef solution
Test case 11: The original cost of the items is 15+8+22+6=5115+8+22+6=51. Buying the coupon costs 3030, and after buying it the cost of buying all the items is 5+0+12+0=175+0+12+0=17. The total cost of buying everything with the coupon is 30+17=4730+17=47, which is strictly less than 5151. So, Chef will buy the coupon.
Test case 22: The original cost of the items is 15+8+22+6=5115+8+22+6=51. Buying the coupon costs 4040, and after buying it the cost of buying all the items is 5+0+12+0=175+0+12+0=17. The total cost of buying everything with the coupon is 40+17=5740+17=57, which is more than 5151. So, Chef will not buy the coupon.
Test case 33: The original cost of the items is 5151. Buying the coupon costs 3434, and the cost of buying all the items after using it is 1717, making the total cost 34+17=5134+17=51. Since this is not strictly less than the original cost, Chef won’t buy the coupon.
Test case 44: The original cost of the items is 140140, the coupon costs 1010, and the cost of buying everything after using the coupon is 00. Since 10+0<14010+0<140, Chef will buy the coupon.