You don't have a lot of code and aren't calling new/delete (or alloc/free) yourself. SO the problem is likely one of understanding how the library is suppose to work. I've never used GMP so I can't help much.
@BernardMeurer The core language, and any reasonable library, will always have malloc/new-ish and free/delete-ish commands in pairs. Whenever you use one of the former, immediately write exactly one of the latter.
@Mikhail In feynmanlectures.caltech.edu/III_01.html , they had problem in identifying which slit did electron came from. If they pass proton from one slit and neutron from 2nd slit, can't problem be solved. They know which slit did particles come from and also they would see interference pattern?
Soap is dreadful stuff. It destroys cell membranes. You'll hear people say that soap is very good at killing bacteria. Well yes, that's because it's very good at killing everything including your skin cells. The reason it stings when it gets in your eyes is because it's killing the cells in your eyes!