.
From (2006-a)(2004-a)=2005 you have
2006*2004 - 2006a - 2004a + a^2 = 2005,
2006*2004 - 2*2005*a + a^2 = 2005,
-2*2005*a + a^2 = 2005 - 2006*2004. (1)
Next,
(2006-a)^2 + (2004-a)^2 = 2006^2 -2*2006*a + a^2 + 2004^2 -2*2004*a + a^2 =
= 2006^2 + 2004^2 -4*2005a + 2a^2 = 2006^2 + 2004^2 + (2*(-2*2005a + a^2)) =
Now replace the expression (-2*2005a + a^2) by 2005 - 2006*2007, based on (1), and then you get
= 2006^2 + 2004^2 + 2*(2005 - 2006*2004) = (2006-2004)^2 + 2*2005 = 2^2 + 4010 = 4014.
Answer. 4014.