The preposition is always "in", but it's combined with the following "dem"
im = in dem
am = an dem
zum = zu dem
In all cases, you can in principle replace the contraction with the two words, but sometimes that sounds a bit unnatural. So it's better to always use the contractions.
There are other contractions like "ins = in das", but these are used mostly in spoken German, and are considered bad style in written German.