MPI_Gatherv is the recommended option to use when gathering unequal lengths of data.
I did not know about MPI_Gatherv initially and started implementing the programs with MPI_Gather.
Using MPI_Gatherv is a better way to self-document the purpose of the code.