Memory and execution time problem

Describe your issue

I wrote a code to solve practice problem and every time I run the code it shows different program execution time and memory for the same code. And assigning more variables is reducing the program memory and run time, Exactly how does this system work. Please explain me how does run time and memory works.

Screenshot

Additional info

Sorry, couldn’t load two instances for proof as I can only upload one file as a beginner(Can’t even upload in pdf format). But please do check it in any problem the issue is in every problem.
Please reply as fast as you can.