So I am solving question 3 from here https://www.olympiad.org.uk/papers/2016/bio/bio16-exam.pdf
I have two pieces of code, one in Python and one in C++. (Both attached below as pictures)
Although the both pieces of code seem to be employing the same logic, the Python one seems to be a lot faster than C++.
An example test case could be -> 614700 3643 90149 -> (It should output 18)
Please can someone tell me why this is the case?