I am getting Memory limit exceeded on my test case #3 , but my algorithm is sure(I guess ?)
Can you please look at my code and tell me what could I possibly be doing wrong.
Thanks in advance.
Code Link: https://codeforces.net/contest/1167/submission/54276749