I was recently solving a problem called Shoe Shuffling https://codeforces.me/contest/1691/problem/B and when I submitted it it shows runtime error , where logically there is no overflow happening in my code and with reference to another article even when I change to a 64 bit C++20 compiler it shows Memory Limit Exceeded Error 283819411 . It will be helpful if anyone can tell me where I went wrong. Thanks in advance!