I used DP approach the same as editorial gave on codeforces but it gave me WA on 6th testcase line 7446 and I tried a lot but I am unable to find the error. Can someone look to my code -https://codeforces.com/contest/1349/submission/79994169
Link for question - https://codeforces.com/contest/1350/problem/E