Undefined behaviour in match the streams question of september lunchtime 2018

While working with the problem Match the streams(https://www.codechef.com/LTIME64A/problems/MATCH2), I came across a random behaviour. My code got wrong answer during the contest and since I thought that the solution is mostly right, I submitted the same code just by changing int to long. Although it was not needed to change int to long based on the constraints, to my surprise, the code got accepted. Hence, I decided to again submit the code this time the code got wrong answer. Confused by the behaviour, I decided to submit some other codes that got accepted during the contest. I tried submitting accepted codes of tourist and uwi and to my surprise, they gave segmentation fault in two sub tasks.

My solution that gave wrong answer during contest: https://www.codechef.com/viewsolution/20434297

Same solution with long giving ac: https://www.codechef.com/viewsolution/20464724

Again the same solution giving wa: https://www.codechef.com/viewsolution/20465176

Gennady’s ac solution during contest: https://www.codechef.com/viewsolution/20380581

Same solution getting segmentation fault: https://www.codechef.com/viewsolution/20465654

uwi’s ac solution during contest: https://www.codechef.com/viewsolution/20385666

Same solution throwing exception: https://www.codechef.com/viewsolution/20465278

This looks like quite a random behaviour. Can someone look into this matter and resolve the issue.

I think admin is already aware about this issue… I think they will resolve the problem soon…