We analyse 27 solar flares observed with GOES and RHESSI in the X-ray bands at 3.1-24.8 keV and 12-25 keV and in Hα. The flaring region diameter in X-rays is found to correlate with the Hα decay duration, and this correlation is used to approximate the flare loop semilength. We propose the method to measure the coronal loop semilengths in young solar-type stars by using the flare Hα decay durations. Assuming the standard plasma dynamics and no loop heating, for the loop semilength we obtain ∼1010 cm. The post-flare heating effect of a flare on a young solar-type star in the NGC2547 cluster was also investigated in X-rays using the emission measures vs. temperature trajectories observed with XMM-Newton. Post-flare heating during the flare decay reduces the loop semilength by a factor of 2 to 10. The XMM-Newton data give approximately the same loop semilengths. Thus, in very young solar-type stars the flare loop semilengths could be comparable to stellar radii.