Code submitted by me takes more time

I recently submitted a solution in C to the easy-level problem LECANDY. My execution time was 0.68 seconds.

On the right side of the problem page, the “successful submissions” panel showed that people had achieved an execution time of 0.02 seconds in C.

So I tried to optimize my IO (by using a custom integer-reading function which uses getchar_unlocked) and I reached an execution time of 0.12 s. I had no idea how I could improve my solution further. I viewed the solution submitted by someone else (who had an execution time of 0.02s) and I found out that my code was almost the same. There were minor differences like I used ‘unsigned int’ and the other user had used ‘int’. I copied the code of that person and submitted it as my own code. The execution time was again 0.12 s.

Why is it that exactly the same code is giving a huge difference in execution time when I’m the one submitting it?

it is due to diff versions of the C compiler…those submissions that u see are of C 4.3.2 and the 1 being used now is 4.8.1…hence the diff in time and memory!!!