Easy Beginners Problems > Ad-hoc

**Mahammad** likes online shopping very much. That is why, he purchases a lot of items from online stores using his debit card. Recently, he just thought that something was going wrong with his bank account. He suspected that someone used his card and deleted some transaction messages. You are here to check whether there is a problem or everything is okay with his card. Keep in mind that **you can not withdraw more money than debit card's current amount**. Input: --- The first line contains one integer **T** which is number of test cases. **(1<=T<= 100)**. You are given two numbers **a**, **b** in separate lines representing the initial and final amount in the balance of the card **( 0<=a, b <=10^9)**. The next line contains one integer **N** which indicates the number of transaction messages. And the following **N** lines contains transaction message which is in the form of one string which can be **“in”** or **“out”** and one positive integer **x**. <br> **If the input string is “in” it means the balance is increased by x dollars, and the latter one means x dollars are taken out from the card (1<=N<=1000, x <= 10^9)**. Output: ------- For each of the test cases output **“yes”** if everything is okay with the transaction messages, and **“no”** otherwise. Sample Input ------------ 2 20 5 3 out 10 out 10 in 5 20 5 4 in 10 out 15 out 25 in 30 Sample Output ------------- yes no

Mahmud Allahverdiyev

Language |
Time Limit (seconds) |

C | 1.00 |

C++ | 1.00 |

C++14 | 1.00 |

C# | 2.00 |

Go | 2.00 |

Java | 2.00 |

JavaScript | 2.00 |

Objective-C | 2.00 |

Perl | 2.00 |

PHP | 2.00 |

Python | 2.00 |

Python3 | 2.00 |

Ruby | 2.00 |

VB.Net | 2.00 |

Solve/Submission

# | User | Language | Timing |
---|---|---|---|

01 | feodorv | C | 0.00s |

02 | moshiur_cse15 | Cpp | 0.01s |

03 | Chayti_Saha98 | Cpp14 | 0.01s |

04 | alamin__7 | Cpp | 0.01s |

05 | kzvd4729 | Cpp | 0.01s |

06 | Gazi_Mohaimin_Iqbal | Cpp14 | 0.01s |

07 | _c_k_r_ | Cpp | 0.01s |

08 | Bruteforcekid | Cpp14 | 0.01s |

09 | int_elligent | Cpp | 0.01s |

10 | shakil2021 | C | 0.01s |

11 | MBSTU_RAKIB_NR | Cpp14 | 0.01s |

12 | dipta007 | Cpp | 0.01s |

13 | mamun4122 | Cpp | 0.01s |

14 | sahedsohel | Cpp | 0.01s |

15 | JACKAL1586 | Cpp14 | 0.01s |

16 | imranziad | Cpp | 0.01s |

17 | shihabmridha | Cpp14 | 0.01s |

18 | astinaam | Cpp14 | 0.01s |

19 | sayedgkm | Cpp | 0.01s |

20 | fsshakkhor | Cpp14 | 0.01s |

21 | shishir09 | Cpp14 | 0.01s |

22 | kitorp | Cpp14 | 0.01s |

23 | SIU_LasToNe | Cpp | 0.01s |

24 | afzalul | C | 0.01s |

25 | FariD | Cpp | 0.01s |

26 | souravahmed | C | 0.01s |

27 | Nasif_44th | C | 0.01s |

28 | Sarwar05 | Cpp | 0.02s |

29 | prottoy919 | Cpp | 0.02s |

30 | hiddenhopes | Cpp | 0.02s |

31 | Reayz | Cpp | 0.02s |

32 | pulak_ict_mbstu | Cpp14 | 0.02s |

33 | arafat_hasan | Cpp14 | 0.02s |

34 | rayhan50001 | Cpp | 0.02s |

35 | mhiceiu | Cpp | 0.02s |

36 | Logic_Hunter | Cpp14 | 0.02s |

37 | plab0n | Cpp | 0.02s |

38 | t0whid | Cpp | 0.02s |

39 | haasib | Cpp | 0.02s |

40 | ehsan_sshuvo | Cpp | 0.02s |

41 | robincse14 | Cpp | 0.02s |

42 | zyyxxx | Cpp14 | 0.02s |

43 | emrul | Cpp14 | 0.02s |

44 | tariqiitju | Cpp | 0.02s |

45 | taskin1995 | Cpp | 0.02s |

46 | evan | Cpp14 | 0.02s |

47 | PKP_007 | Cpp | 0.02s |

48 | I_See_You | Cpp14 | 0.02s |

49 | duronto20 | Cpp | 0.02s |

50 | ArifKhanShubro | Cpp | 0.02s |

Copyright © 2015-2016 Dev Skill.

Feedback
#### Your feedback is our precious!

## Thank you for providing feedback! Our developers will be happy :)

## Sorry there was a problem when submitting the feedback. Please try again. :(