#[allow(unused_macros)] macro_rules! debug { ($($e:expr), *) => {println!(concat!($(stringify!($e), " = {:?}\n"), *), $($e), *)} } fn main() { let (n, m) = get::tuple::(); let xss = get::lists::(m); let syakutori = |xs: &[isize], k| { use std::cmp::Ordering::*; let mut acc = xs[0]; let mut i = 0; let mut j = 0; while i {return true}, (_, true, false) => {i += 1; j += 1; acc += xs[i]}, (Less, _, false) => {j += 1; acc += xs[j]}, (_, _, true) => {return false}, (Greater, _, _) => {acc -= xs[i]; i += 1}, } } unreachable!() }; let succeed = || { let mut ans = false; let mut acc = vec![0; n]; for i in 0 .. m { for j in 0 .. n {acc[j] += xss[i][j]} if syakutori(&acc, 777) {ans = true; break} } // debug!(acc); ans }; let ans = if succeed() {"YES"} else {"NO"}; println!("{}", ans) } #[allow(dead_code)] mod get { use std::io::*; use std::str::*; pub fn val() -> T { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().parse::().ok().unwrap() } pub fn vals(n: usize) -> Vec { let mut vec: Vec = vec![]; for _ in 0 .. n { vec.push(val()); } vec } pub fn tuple() -> (T1, T2) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::().ok().unwrap(); let y = it.next().unwrap().parse::().ok().unwrap(); (x, y) } pub fn tuples(n: usize) -> Vec<(T1, T2)> { let mut vec: Vec<(T1, T2)> = vec![]; for _ in 0 .. n { vec.push(tuple()); } vec } pub fn tuple3() -> (T1, T2, T3) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::().ok().unwrap(); let y = it.next().unwrap().parse::().ok().unwrap(); let z = it.next().unwrap().parse::().ok().unwrap(); (x, y, z) } pub fn tuple3s(n: usize) -> Vec<(T1, T2, T3)> { let mut vec: Vec<(T1, T2, T3)> = vec![]; for _ in 0 .. n { vec.push(tuple3()); } vec } pub fn list() -> Vec { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().split_whitespace().map(|t| t.parse::().ok().unwrap()).collect() } pub fn lists(h: usize) -> Vec> { let mut mat: Vec> = vec![]; for _ in 0 .. h { mat.push(list()); } mat } pub fn chars() -> Vec { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().chars().collect() } }