I can’t tell if you’re asking if a medium in play or a medium tutored up with siphon get counters.
If medium is in play: the runner gets to 4.4, the run on R&D is successful. Medium and Code Siphon both trigger, meaning that you add a counter and you can replace step 4.5 with Code Siphon’s effect.
If medium is not in play: If the runner gets to 4.4, the run on R&D is successful. Code siphon triggers, allowing you to replace step 4.5 with its effect. After you pull out Medium, the trigger that adds a counter is in the past.