My code:
#include<bits/stdc++.h> using namespace std; int main() { int n,m,i,j; while(scanf("%d %d",&n,&m)==2) { int cnt=0; for(i=0; i<n; i++) { bool goal_missed=false; int val=0; for(j=0; j<m; j++) { cin>>val; if(!val) { goal_missed=true; } } if(!goal_missed) { cnt++; } } cout<<cnt<<endl; } return 0; }