Test cases are failing for large inputs

https://atcoder.jp/contests/dp/tasks/dp_h -->problem