#include <iostream>
#include <vector>
using namespace std;
int f(vector<int> &u){
int k = 1;
bool has_negative = false;
for(auto &i : u){
if(i < 0){
k *= i;
has_negative = true;
}
return k * has_negative;
signed main(){
const int n = 5;
vector<vector<int>> a(n, vector<int> (n));
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
cin >> a[i][j];
cout << "Product of negatives in " << i + 1 << " line is " << f(a[i]) << "\n";
#include <iostream>
#include <vector>
using namespace std;
int f(vector<int> &u){
int k = 1;
bool has_negative = false;
for(auto &i : u){
if(i < 0){
k *= i;
has_negative = true;
}
}
return k * has_negative;
}
signed main(){
const int n = 5;
vector<vector<int>> a(n, vector<int> (n));
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
cin >> a[i][j];
for(int i = 0; i < n; i++)
cout << "Product of negatives in " << i + 1 << " line is " << f(a[i]) << "\n";
}