Cosmic ray and neutrino emission from gamma-ray bursts with a nuclear cascade