by@kurgm
AC
1526ms
import std.stdio;void main(){int p,q,x,i;for(int[12]X;readf("%d ",p);)x+=i/9*(X[i]=p-X[i%3])*(X[p=++i%3+3]*X[q=-~i%3+6]-X[p+3]*X[q-3]);write(x/6);}
54 72 78 02 48 34 71 61 26 01 08 40
23866