Always have at least as weapons as total ship crew. If you have fewer weapons than crew, those crew members above the weapon count automatically die in a boarding action. Medicine is a bit more forgiving, because then it depends on the luck of whether a crew member needs it due to illness/injury, so you don't always need the exact amount of crew members, but it's better to have as much as you can and it doesn't take much cargo space.