I think it's a situation in which Trey and Matt have the initial idea for an episode and then they discuss it in the "writer's room" and come up with different scenes and jokes together. Trey then writes the first draft of the script (with all the input that came from the others), they discuss it together and change it until the final version. From what I have seen and heard about this process it seems like a lot of team work, but in the end it is Trey who still does the final writing.
By the way: I was very surprised about this articlde today:
http://www.irishexaminer.com/ireland/cwsncwauojoj/We watched David O’Reilly's short film "The external World" (
https://www.youtube.com/watch?v=OxPyN6IK1tM) at our last annual South Park fan meeting - what a coincedence!

I really like his work. He also worked on "Adventure time", "Her" and made a video game that's called "The Mountain" (more a piece of art than a real game).