Navi and his company
Practice
3.3 (166 votes)
Ready
Basic programming
Approved
Very easy
Very Easy
Problem
16% Success 4313 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Navi is a CEO of a famous IT based software company. He is hiring some new developers to work in his company. He already know the number of new projects and number of hirings at particular timestamp. He will assign one project to one developer and that developer will work alone on that project . Your task is to help Navi in finding the number of projects that will still be unassigned. A project will go unassigned if there is no free developer at that time. . You will be given the chronological order of project requirements and recruit hirings, find the number of projects which will go unassigned.

Input

  • First line of the input will contain T (No. of test cases).
  • For each test case, first line will contain a integer N.
  • Next each N line will contain either an integer X (No. of hirings) or a string "New Project" .

Output

  • For every test case, print the answer in a new line.

Constraints

  • 1 ≤ T ≤ 10
  • 1 ≤ N ≤ 105
  • 1 ≤ X ≤ 5

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
1 votes
Tags:
Easy-Medium
Points:20
200 votes
Tags:
ApprovedBinary SearchEasyOpenSorting
Points:20
30 votes
Tags:
Ad-HocBasic ProgrammingEasy