Result

AC

Duration

6103ms

Code [DL]

import java.util.*
fun main(a:Array<String>){var x=0
val X=IntArray(12)
val s=Scanner(System.`in`)
repeat(12){i->X[i]=s.nextInt()-X[i%3]
val p=(i+1)%3+3
val q=(i+2)%3+6
x+=i/9*X[i]*(X[p]*X[q]-X[p+3]*X[q-3])}
print(x/6)}

stdin

96 91 28
05 68 39
68 22 39
45 02 49

stdout

5142

stderr