integer::N,M,i,j,k,switch=0,X integer,allocatable,dimension(:,:)::a integer,allocatable,dimension(:)::b read *,N,M allocate(a(M,N),b(N)) b=0 do i=1,M read *,a(i,:) end do do i=1,M do j=1,N if(j==1) then do k=1,N b(k)=b(k)+a(i,k) end do if(sum(b(:))<777) exit end if if(b(j)==0) cycle do k=1,N if(b(k)==0) cycle if(sum(b(j:k))==777) then switch=1 end if if(sum(b(j:k))>=777) exit end do if(sum(b(j:k))==777) exit end do if(sum(b(j:k))==777) exit end do if(switch==1) then print *,'YES' else print *,'NO' end if end