Believe it or not, the Sex Bob-ombs have become a world famous band and are currently on world tour! As their bookkeeper you must oversee their day to day finances and provide regular reports.
Every few weeks you compile a list of their expenses (in whole USD) in the order they were incurred.
For example, the list
378
-95
2234
means that $378 was deposited to their account, and after that $95 was withdrawn, and after that $2234 was deposited.
You want to make sure that the running sum of these values never goes below some threshold value T. You decide to write a program to do this for you.
Challenge
Write a program or function that takes in a single integer T and a list of integers. If the running sum of the list of integers is ever less than T, then print or return a falsy value, otherwise print or return a truthy value.
You may use any usual input methods (stdin, from file, command line, arguments to function).
- At the start of the list the running sum is 0. So a positive T means the result is always falsy.
+
will never be in front of positive integers.- The list may contain 0.
- The list may be empty.
Test Cases
T is -5 in all of these.
Falsy:
-6
1
2
3
-20
200
-300
1000
Truthy:
[empty list]
-5
4
-3
-6
Scoring
The submission with the fewest bytes wins. Tiebreaker goes to earliest posted submission.