Result: Accepted
Time: 10ms
Memory: 1712kB
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <deque>
#define clr(a,b) memset(a,b,sizeof(a))
#define ll long long
using namespace std;
const int maxn=1e3+10;
int n;
int main()
{
while(scanf("%d",&n)!=EOF)
{
double ans=0,a,tot=0;
while(n--)
{
cin>>a;
if(a<=0)ans+=a;
else ans+=a/2;
if(ans<0)tot++;
}
cout<<tot<<endl;
}
}