a) \(5-\left(-3\right)^2-14.\left(-8\right)+\left(-31\right)\)
\(=5-9-\left(-112\right)+\left(-31\right)\)
\(=-4+112-31\)
\(=108-31\)
\(=77\)
b) \(6.\left(-2\right)^3+5.\left(-4\right)-\left(-12\right)\)
\(=6.\left(-8\right)+\left(-20\right)+12\)
\(=-48+\left(-20\right)+12\)
\(=-56\)