Magnetic memory effect in type-II superconductor/ferromagnet bilayers