Why my solution is giving Runtime error? (Codeforces Round #661 Div 3)

It is The Problem C of today’s ended contest…

I have tried my solution many times but not getting why my solution is giving TLE…
Problem Statement:-[Problem - C - Codeforces]
My solution which got Runtime error:-
[Submission #89037170 - Codeforces]

*Please help anybody …I will always be grateful to you…

Is it TLE or Runtime Error? Can you link to the submission?

Edit:

This test input triggers Undefined Behaviour:

1
1
1
3 Likes

I tried randomizing from 1 to 50 for problem C for hacking But O(n^3) are also running. Can someone provide some hack test case?

How will you hack solutions with complete brute force search?

The overall complexity should be T*O(N^3) and it should give TLE, but it passes. Any other way/technique to do such hacks?

I have attached my submission link with my post…Please check it once…