I was wondering why the exact same code
https://codeforces.me/contest/833/submission/53432006
gets a TLE on test 8 when submitted in C11 but
https://codeforces.me/contest/833/submission/53432006
gets AC when submitted in G++14. Does the C++ compiler optimize the operations or something? If I'm not wrong the complexity of this solution should be O(n log max(a*b)) (I assumed the complexity of cuberoot is log n, I don't actually know what it is).