HI. I am a beginner in CP. and know only python. While solving the given problem https://codeforces.net/contest/1992/problem/C i was able to write the given code 269990236. but i got a TLE on test 5. i looked at the tutorial and found that my way of thinking and the tutorial's approach were the same. But i am still not sure if the orders of the 'numbers in the middle' matters or not. can someone please look into my code and tell if what i am doing with 'the numbers in the middle' is ok?
link to tutorial: https://youtu.be/9Vv2ZukG1CM?t=2685
also, if his and my methods are the same, am i getting TLE just because of python? or is my method just longer than his is?