If you lived in it between June 2011 and July 2016 you will be entitled to some private residents relief. You have to look at the total months occupied, plus the last 18 months of ownership, then take that as a proportion of the gain.
i.e. June 2011 to July 2016 = 62 months + 18 months = 80 months in total.
Total period of ownership is 9 years (let's just use round numbers!) = 108 months.
Your PRR is therefore 80/108 x the gain of £178,000 = £131,852.
(Gain = £500,000 - £10,000 - £300,000 - £12,000 = £178,000)
Therefore the gain to be reported is £178,000 - £131,852 = £46,148, split between the owners of the property as registered with Land Registry.
As to how it all works in terms of your tax returns when you're non-resident, etc, I'm not sure. You may (or may not!) be eligible for the CGT annual exempt amount - I don't know enough about residency status, etc, to say for definite.
The tax rate is 18% or 28% based on whether it's taxed within the basic or higher rate tax bands.
As non-residents, I think you have to report and pay the CGT over to HMRC within 30 days of the conveyance though, so it is worth making sure you get it right.