#include "bits/stdc++.h" using namespace std; #define DEBUG(x) cout<<#x<<": "< #define vl vector #define vii vector< vector > #define vll vector< vector > #define vs vector #define pii pair #define pis pair #define psi pair const int inf = 1000000001; const ll INF = 1e18 * 2; #define MOD 1000000007 #define mod 1000000009 #define pi 3.14159265358979323846 #define Sp(p) cout<> n >> m; vi a(n); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { int temp; cin >> temp; a[j] += temp; } int left = 0, right = 0, sum = 0; while (right < n && left < n) { if (sum < 777) { if (right < n) { sum += a[right++]; } else { break; } } else { sum -= a[left++]; } if (sum == 777) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }