#include
using namespace std;
int main() {
int i;
int a[i];
int n;
cin>>n;
int sum=0;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
{
sum=sum+a[i];
if(sum>=0)
cout<<a[i]<<"\n";
else
exit(0);
}
return 0;
}
its my approach to the question of simple input .Getting test cases failed but running fine in my compiler.