Hi hun sorry to tri hop, had this really bad in tri 2. I found making sure I was really well hydrated helped! I learnt to never ever stretch when I was half asleep, wait till after I'd been up to the loo and then stretch! My yoga instructor showed us some good stretches to prevent cramps too.
If cramp starts, the only way to fix it is to get up immediately and stretch my calf, it always stops it and prevents achey legs for a few days.
Hope some of these tips help you!
Xx