**Physical Address**

304 North Cardinal St.

Dorchester Center, MA 02124

Recently, Devendra went to Goa with his friends. Devendra is well known for not following a budget.

He had Rs. ZZ at the start of the trip and has already spent Rs. YY on the trip. There are three kinds of water sports one can enjoy, with prices Rs. AA, BB, and CC. He wants to try each sport at least once.

If he can try all of them at least once output `YES`

, otherwise output `NO`

.

- The first line of input contains a single integer TT, denoting the number of test cases. The description of TT test cases follows.
- Each test case consists of a single line of input containing five space-separated integers Z,Y,A,B,CZ,Y,A,B,C.

For each test case, print a single line containing the answer to that test case — `YES`

if Devendra can try each ride at least once, and `NO`

otherwise.

You may print each character of the string in uppercase or lowercase (for example, the strings “yEs”, “yes”, “Yes” and “YES” will all be treated as identical).

- 1≤T≤101≤T≤10
- 104≤Z≤105104≤Z≤105
- 0≤Y≤Z0≤Y≤Z
- 100≤A,B,C≤5000100≤A,B,C≤5000

```
3
25000 22000 1000 1500 700
10000 7000 100 300 500
15000 5000 2000 5000 3000
```

```
NO
YES
YES
```

**Test Case 1:** After spending Rs. 2200022000 on the trip already, Devendra is left with Rs. 30003000. The water sports cost a total of 1000+1500+700=32001000+1500+700=3200. So, he does not have enough money left to try all the watersports.

**Test Case 2:** After spending Rs. 1000010000 on the trip, he is left with Rs. 30003000. The water sports cost a total of 100+300+500=900100+300+500=900. So, he has enough money to try all the watersports.

**Test Case 3:** After spending Rs. 50005000 on the trip, he is left with Rs. 1000010000. The water sports cost a total of 2000+5000+3000=100002000+5000+3000=10000. So, he still has enough money left to try all the watersports.

```
#include <iostream>
using namespace std;
int main() {
int T,Z,Y,A,B,C;
int cost;
cin>>T;
int arr[T][6];
for(int x=0;x<T;x++)
{
for(int y=0;y<5;y++)
{
cin>>arr[x][y];
}
}
for(int z=0;z<T;z++){
int amt_left=(arr[z][0]-arr[z][1]);
cost=(arr[z][2]+arr[z][3]+arr[z][4]);
if(amt_left>=cost){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
return 0;
}
```

```
for i in range(int(input())):
z,y,a,b,c=map(int,input().split())
if((z-y-a-b-c)>=0):
print("yes")
else:
print("no")
```

In our experience, we suggest you solve this Devendra and Water Sports CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Devendra and Water Sports Problem is available on Hacker Rank for Free, if you are stuck anywhere between a compilation, just visit Queslers to get Devendra and Water Sports CodeChef Solution.

I hope this Devendra and Water Sports CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

**More CodeChef Solutions >>**

Olympics Ranking CodeChef Solution

Problem Difficulties CodeChef Solution

Chef and Bulb Invention CodeChef Solution