Result

AC

Duration

560ms

Code [DL]

0\&6,n;
?\ia*i+4[:{-}]i0(
&\{r9[0
!\{:{:@{@{{:}@:}*}*{-@}}@}*&+&0}}}:?

stdin

40 98 97
49 59 73
39 47 09
78 71 97

stdout

10312

stderr

strace