Why am I getting run time error in test case 8 for 318-A
Link to the solution
Atcoder ABC #351 Short Solution Discussion