It seemed to be a simple task, but there is a twist.
For this task 64-bit integers are needed. The confusion starts when people use different C++ compilers on different platforms and architectures.
Apparently, the judge is the 32-bit machine and the task doesn't work when you use data type: "long int" (it still works on 64-bit machine).
I am not sure, what would be the solid standard for defining 64-bit integer. On my Linux machine this type is called "__int64_t", yet it doesn't work with the judge. On the contrary "__int64" works fine, but doesn't compile locally.
One solution that worked for me was to use the type "long long int".
For this task 64-bit integers are needed. The confusion starts when people use different C++ compilers on different platforms and architectures.
Apparently, the judge is the 32-bit machine and the task doesn't work when you use data type: "long int" (it still works on 64-bit machine).
I am not sure, what would be the solid standard for defining 64-bit integer. On my Linux machine this type is called "__int64_t", yet it doesn't work with the judge. On the contrary "__int64" works fine, but doesn't compile locally.
One solution that worked for me was to use the type "long long int".