You should probably edit your document to use #let solu = sys.input.solu == "true"
and use some sort of shell script to produce two outputs
Example in bash:
#!/bin/bash
typst compile --input solu=true --input tdah=false main.typ answers.pdf
typst compile --input solu=false --input tdah=true main.typ questions.pdf
I am writing this from mobile so there may be errors