a guest Oct 20th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n,x=map(int,input().split())
  2. a=[]
  3. q=0
  4. for i in range (n):
  5.     a,b=map(str,input().split())
  6.     if a=='+':
  7.         x+=int(b)
  8.     else:
  9.         if x>=int(b):
  10.             x-=int(b)
  11.         else:
  12.             q+=1
  13. print(x,q)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand