Language: C++

// https://atcoder.jp/contests/m-solutions2019/tasks/m_solutions2019_f
//
#![allow(unused_imports)]
use std::io::*;
use std::io::Write;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

// Input macros.
// Original by tanakh: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, [ next / $t:tt ]) => {
        {
            let len = read_value!($iter, usize);
            (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, switch) => {
        {
            let ty = read_value!($iter, i32);
            if ty == 1 {
                vec![ty, read_value!($iter, i32), read_value!($iter, i32)]
            } else if ty == 2 {
                vec![ty, read_value!($iter, i32)]
            } else {
                vec![ty, read_value!($iter, i32)]
            }
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! read_line {
    ($t:tt) => {
        {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            s.trim_right().parse::<$t>().unwrap()
        }
    }
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! join {
    ($t:expr, $glue:expr) => {
        $t.into_iter().map(|w| w.to_string()).collect::<Vec<_>>().join($glue)
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}


// ===


#[derive(Clone, Debug)]
struct BitVector {
    n: usize,
    size: usize,
    data: Vec<u64>
}

impl BitVector {
    fn new(n: usize) -> Self {
        let size = (n+63)/64;
        BitVector {
            n: n,
            size: size,
            data: vec![0; size]
        }
    }

    fn get(&self, i: usize) -> bool {
        self.data[i/64]>>(i%64) & 1 != 0
    }

    fn set(&mut self, i: usize) {
        self.data[i/64] |= 1<<(i%64);
    }

    fn count(&self) -> usize {
        let mut cnt = 0;
        for i in 0..self.size {
            cnt += self.data[i].count_ones();
        }
        cnt as usize
    }
}

impl<'a> std::ops::Shl<usize> for &'a BitVector {
    type Output = BitVector;

    fn shl(self, amount: usize) -> Self::Output {
        let mut new_vector = BitVector::new(self.n);

        let diff = amount / 64;
        let diff_mod = amount % 64;
        if diff_mod == 0 {
            for i in 0..self.size-diff {
                new_vector.data[i+diff] = self.data[i];
            }
        } else {
            let lower_mask = (1<<(64-diff_mod))-1;
            let upper_mask = ((1<<diff_mod)-1)<<(64-diff_mod);
            for i in 0..self.size-diff {
                new_vector.data[i+diff] |= (self.data[i] & lower_mask)<<diff_mod;
                if i+diff+1 < self.size {
                    new_vector.data[i+diff+1] |= (self.data[i] & upper_mask)>>(64-diff_mod);
                }
            }
        }
        new_vector
    }
}


impl<'a> std::ops::Shr<usize> for &'a BitVector {
    type Output = BitVector;

    fn shr(self, amount: usize) -> Self::Output {
        let mut new_vector = BitVector::new(self.n);

        let diff = amount / 64;
        let diff_mod = amount % 64;
        if diff_mod == 0 {
            for i in diff..self.size {
                new_vector.data[i-diff] = self.data[i];
            }
        } else {
            let lower_mask = (1<<diff_mod)-1;
            let upper_mask = ((1<<(64-diff_mod))-1)<<diff_mod;
            for i in diff..self.size {
                new_vector.data[i-diff] |= (self.data[i] & upper_mask)>>diff_mod;
                if i > diff {
                    new_vector.data[i-diff-1] |= (self.data[i] & lower_mask)<<(64-diff_mod);
                }
            }
        }
        new_vector
    }
}

impl<'a> std::ops::BitAnd for &'a BitVector {
    type Output = BitVector;

    fn bitand(self, other: Self) -> Self::Output {
        let mut output = BitVector::new(self.n);
        for i in 0..self.size {
            output.data[i] = self.data[i] & other.data[i];
        }
        output
    }
}

impl std::ops::BitAndAssign for BitVector {
    fn bitand_assign(&mut self, rhs: Self) {
        for i in 0..min(self.size, rhs.size) {
            self.data[i] &= rhs.data[i];
        }
    }
}

impl<'a> std::ops::BitOr for &'a BitVector {
    type Output = BitVector;

    fn bitor(self, other: Self) -> Self::Output {
        let mut output = BitVector::new(self.n);
        for i in 0..self.size {
            output.data[i] = self.data[i] | other.data[i];
        }
        output
    }
}

impl std::ops::BitOrAssign for BitVector {
    fn bitor_assign(&mut self, rhs: Self) {
        for i in 0..min(self.size, rhs.size) {
            self.data[i] |= rhs.data[i];
        }
    }
}

impl std::ops::BitXorAssign for BitVector {
    fn bitxor_assign(&mut self, rhs: Self) {
        for i in 0..min(self.size, rhs.size) {
            self.data[i] ^= rhs.data[i];
        }
    }
}

//===

fn main() {
    input! {
        n: usize,
        table: [chars; n-1]
    };

    // 1 to n, 0 and n+1 are sentinels
    let mut wintable = vec![BitVector::new(2048); n+2];
    for i in 2..n+1 {
        for j in 1..i {
            if table[i-2][j-1] == '1' {
                // i wins j
                wintable[i].set(j);
            } else {
                wintable[j].set(i);
            }
        }
    }

    let mut dp_left = vec![BitVector::new(2048); n+2];
    let mut dp_right = vec![BitVector::new(2048); n+2];

    let mut dp_left_rev = vec![BitVector::new(2048); n+2];
    let mut dp_right_rev = vec![BitVector::new(2048); n+2];

    for i in 1..n+1 {
        dp_left[i].set(i);
        dp_right[i].set(i);
        dp_left_rev[i].set(i);
        dp_right_rev[i].set(i);
    }
    for l in 1..n {
        for i in 1..n+1 {
            if i > l {
                let lj = i-l;
                let mut ok = false;
                ok |= (&(&(&dp_left[i]>>1) & &dp_left_rev[lj]) & &wintable[i]).count() >= 1;
                ok |= wintable[i].get(lj) && (&dp_left[i] & &(&dp_right[lj]<<1)).count() >= 1;
                if ok {
                    dp_left[i].set(lj);
                    dp_left_rev[lj].set(i);
                }
                // debug!(i, lj, ok);
            }
            if i+l <= n {
                let rj = i+l;
                let mut ok1 = false;
                let mut ok2 = false;
                ok1 |= (&(&(&dp_right[i]<<1) & &dp_right_rev[rj]) & &wintable[i]).count() >= 1;
                ok2 |= wintable[i].get(rj) && (&dp_right[i] & &(&dp_left[rj]>>1)).count() >= 1;
                let ok = ok1 | ok2;
                if ok {
                    dp_right[i].set(rj);
                    dp_right_rev[rj].set(i);
                }
                // debug!(i, rj, ok1, ok2);
            }
        }
    }


    let mut count = 0;
    for i in 1..n+1 {
        if dp_left[i].get(1) && dp_right[i].get(n) {
            count += 1;
            // debug!(i);
        }
    }
    println!("{}", count);
}


Compiler output:
a.cc:3:2: error: invalid preprocessing directive #!
    3 | #![allow(unused_imports)]
      |  ^
a.cc:13:2: error: invalid preprocessing directive #[
   13 | #[allow(unused_macros)]
      |  ^
a.cc:31:2: error: invalid preprocessing directive #[
   31 | #[allow(unused_macros)]
      |  ^
a.cc:47:2: error: invalid preprocessing directive #[
   47 | #[allow(unused_macros)]
      |  ^
a.cc:54:10: error: too many decimal points in number
   54 |         (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
      |          ^~~~~~~
a.cc:60:14: error: too many decimal points in number
   60 |             (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
      |              ^~~~~~
a.cc:90:2: error: invalid preprocessing directive #[
   90 | #[allow(unused_macros)]
      |  ^
a.cc:101:2: error: invalid preprocessing directive #[
  101 | #[allow(unused_macros)]
      |  ^
a.cc:112:2: error: invalid preprocessing directive #[
  112 | #[allow(unused_macros)]
      |  ^
a.cc:119:2: error: invalid preprocessing directive #[
  119 | #[allow(unused_macros)]
      |  ^
a.cc:122:18: error: too many decimal points in number
  122 |         for i in 0..$t.len() {
      |                  ^~~~~~~~~
a.cc:128:2: error: invalid preprocessing directive #[
  128 | #[allow(unused_macros)]
      |  ^
a.cc:135:2: error: invalid preprocessing directive #[
  135 | #[allow(unused_macros)]
      |  ^
a.cc:146:2: error: invalid preprocessing directive #[
  146 | #[derive(Clone, Debug)]
      |  ^
a.cc:173:18: error: too many decimal points in number
  173 |         for i in 0..self.size {
      |                  ^~~~~~~~~~~~
a.cc:180:6: warning: multi-character literal with 29 characters exceeds 'int' size of 4 bytes
  180 | impl<'a> std::ops::Shl<usize> for &'a BitVector {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:189:22: error: too many decimal points in number
  189 |             for i in 0..self.size-diff {
      |                      ^~~~~~~~~~~~~~~~~
a.cc:195:22: error: too many decimal points in number
  195 |             for i in 0..self.size-diff {
      |                      ^~~~~~~~~~~~~~~~~
a.cc:207:6: warning: multi-character literal with 29 characters exceeds 'int' size of 4 bytes
  207 | impl<'a> std::ops::Shr<usize> for &'a BitVector {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:233:6: warning: multi-character literal with 25 characters exceeds 'int' size of 4 bytes
  233 | impl<'a> std::ops::BitAnd for &'a BitVector {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:238:18: error: too many decimal points in number
  238 |         for i in 0..self.size {
      |                  ^~~~~~~~~~~~
a.cc:247:18: error: too many decimal points in number
  247 |         for i in 0..min(self.size, rhs.size) {
      |                  ^~~~~~
a.cc:253:6: warning: multi-character literal with 24 characters exceeds 'int' size of 4 bytes
  253 | impl<'a> std::ops::BitOr for &'a BitVector {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:258:18: error: too many decimal points in number
  258 |         for i in 0..self.size {
      |                  ^~~~~~~~~~~~
a.cc:267:18: error: too many decimal points in number
  267 |         for i in 0..min(self.size, rhs.size) {
      |                  ^~~~~~
a.cc:275:18: error: too many decimal points in number
  275 |         for i in 0..min(self.size, rhs.size) {
      |                  ^~~~~~
a.cc:291:14: error: too many decimal points in number
  291 |     for i in 2..n+1 {
      |              ^~~~
a.cc:292:18: error: too many decimal points in number
  292 |         for j in 1..i {
      |                  ^~~~
a.cc:308:14: error: too many decimal points in number
  308 |     for i in 1..n+1 {
      |              ^~~~
a.cc:314:14: error: too many decimal points in number
  314 |     for l in 1..n {
      |              ^~~~
a.cc:315:18: error: too many decimal points in number
  315 |         for i in 1..n+1 {
      |                  ^~~~
a.cc:345:14: error: too many decimal points in number
  345 |     for i in 1..n+1 {
      |              ^~~~
a.cc:4:1: error: 'use' does not name a type
    4 | use std::io::*;
      | ^~~
a.cc:5:1: error: 'use' does not name a type
    5 | use std::io::Write;
      | ^~~
a.cc:6:1: error: 'use' does not name a type
    6 | use std::fmt::*;
      | ^~~
a.cc:7:1: error: 'use' does not name a type
    7 | use std::str::*;
      | ^~~
a.cc:8:1: error: 'use' does not name a type
    8 | use std::cmp::*;
      | ^~~
a.cc:9:1: error: 'use' does not name a type
    9 | use std::collections::*;
      | ^~~
a.cc:14:1: error: 'macro_rules' does not name a type
   14 | macro_rules! input {
      | ^~~~~~~~~~~
a.cc:32:1: error: 'macro_rules' does not name a type
   32 | macro_rules! input_inner {
      | ^~~~~~~~~~~
a.cc:48:1: error: 'macro_rules' does not name a type
   48 | macro_rules! read_value {
      | ^~~~~~~~~~~
a.cc:91:1: error: 'macro_rules' does not name a type
   91 | macro_rules! read_line {
      | ^~~~~~~~~~~
a.cc:102:1: error: 'macro_rules' does not name a type
  102 | macro_rules! dvec {
      | ^~~~~~~~~~~
a.cc:113:1: error: 'macro_rules' does not name a type
  113 | macro_rules! ifv {
      | ^~~~~~~~~~~
a.cc:120:1: error: 'macro_rules' does not name a type
  120 | macro_rules! fill {
      | ^~~~~~~~~~~
a.cc:129:1: error: 'macro_rules' does not name a type
  129 | macro_rules! join {
      | ^~~~~~~~~~~
a.cc:136:1: error: 'macro_rules' does not name a type
  136 | macro_rules! debug {
      | ^~~~~~~~~~~
a.cc:148:5: error: 'n' does not name a type
  148 |     n: usize,
      |     ^
a.cc:153:6: error: expected initializer before 'BitVector'
  153 | impl BitVector {
      |      ^~~~~~~~~
a.cc:180:1: error: 'impl' does not name a type
  180 | impl<'a> std::ops::Shl<usize> for &'a BitVector {
      | ^~~~
a.cc:207:1: error: 'impl' does not name a type
  207 | impl<'a> std::ops::Shr<usize> for &'a BitVector {
      | ^~~~
a.cc:233:1: error: 'impl' does not name a type
  233 | impl<'a> std::ops::BitAnd for &'a BitVector {
      | ^~~~
a.cc:245:1: error: 'impl' does not name a type
  245 | impl std::ops::BitAndAssign for BitVector {
      | ^~~~
a.cc:253:1: error: 'impl' does not name a type
  253 | impl<'a> std::ops::BitOr for &'a BitVector {
      | ^~~~
a.cc:265:1: error: 'impl' does not name a type
  265 | impl std::ops::BitOrAssign for BitVector {
      | ^~~~
a.cc:273:1: error: 'impl' does not name a type
  273 | impl std::ops::BitXorAssign for BitVector {
      | ^~~~
a.cc:283:1: error: 'fn' does not name a type
  283 | fn main() {
      | ^~