Your code that was Accepted should give \text{\red{RTE}}. But it passed somehow. The 2^{nd} for-loop should be for(j = 0; j < n - 1; j++) instead of for(j = 0; j < n; j++).