To include this script you would want to open your child theme’s functions.php file and insert the code below (excluding the php open and close php tags <?php at top and ?> at bottom). When removing a user, be sure to remove them from the Entries section of the registration form within the Gravity Forms plugin and not directly from the Users area of WordPress. I believe you can only remove associated users by removing the Gravity Forms entry and not the other way around. Let me know if I am wrong.
I welcome your thoughts, questions or suggestions on my article on how to automatically delete a WordPress User entry when deleting a Gravity Forms entry.
Let me know if you found any errors within my article or if I may further assist you by answering any additional questions you may have.