Test case2 time limit

in test case 2 there is time limit please give me the solution of the code

Hey Rishab, mention the problem’s exact name and share your code’s ide link also.

Given a list of numbers, stop processing input after cummulative sum of all the input becomes negative
solution:
#include
using namespace std;
int main()
{
int i,sum=0;
while(sum>=0)
{
cin>>i;
if(i>-1000 && i<1000)
{
sum=sum+i;
if(sum<0)
{
break;
}
cout<<i<<endl;
}
else
{
continue;
}

}

}

Hey Rishab, your logic is correct but you have used some unnecessary checks that’s why it was giving error. I have commented them in your code you can check this