We can represent the amount of gold with $g$ and the amount of chests with $c$. We can use the problem to make the following equations: $$ \begin{gathered} 9 c-18=g \textbackslash\textbackslash{} 6 c+3=g \end{gathered} $$ We do this because for $9$ chests there are $2$ empty and if $9$ were in each $9$ multiplied by $2$ is $18$ left.  Therefore, $6 c+3=9 c-18$. This implies that $c=7$. We therefore have $g=45$. So, our answer is (C) 45 
Starting with some gold coins and some empty treasure chests, I tried to put $9$ gold coins in each treasure chest, but that left $2$ treasure chests empty. So instead I put 6 gold coins in each treasure chest, but then I had $3$ gold coins left over. How many gold coins did I have? ( 2017 AMC8, Questions \#17) 
Options:
A: $$9$$ 
B: $$27$$ 
C: $$45$$ 
D: $$63$$ 
E: $$81$$ 