#include <iostream>
#include <vector>
using namespace std;
int main(){
srand(time(NULL));
vector<int> a;
int n = rand() % 1001;
a.resize(n);
for(auto &i : a)
i = rand() % 1001 - 500;
int sum = 0, i = 0;
while(i < n && a[i] != 0){
sum += a[i] * (a[i] < 0);
i++;
}
cout << sum;
#include <iostream>
#include <vector>
using namespace std;
int main(){
srand(time(NULL));
vector<int> a;
int n = rand() % 1001;
a.resize(n);
for(auto &i : a)
i = rand() % 1001 - 500;
int sum = 0, i = 0;
while(i < n && a[i] != 0){
sum += a[i] * (a[i] < 0);
i++;
}
cout << sum;
}