Chosen Solution

Internal keyboard function badly, and Trackpad stopped working after battery pack change. Keys to be pressed 2-5 times before it works. Hardware diagnostics gave error code 4MEM/9/40000000: 0x78fc6190. Help needed.

That is a memory failure. Of course we don’t know your exact model, could be a bad flash drive or if it uses removable RAM, try reseating it. UPDATE This is a very unusual error for this machine. The first thing I would do is take it in an have it checked for this issue as it might relate to your problem: MacBook Pro Repair Extension Program for Video Issues https://www.apple.com/support/macbookpro