Runtime bug issue

The following code runs successfully on codeforces ide but, NOT on codechef / Coding Blocks IDE…
Please can you help me out ?

The coding blocks ide is not working (I am not able to save it freezes)…Hence I am sharing my codechef submission link just to share my code.

https://www.codechef.com/viewsolution/49370908

Sample input:-
2
3
4 2 4
6
2 8 6 2 1 5

Sample output
4
28

hi… which ques are u referring to??? and secondly if ur code is running fine on codeforces means then ur code would be fine only…

This one…
Exactly…thats why I am confused…same code gives run-time on coding blocks ide / codechef submission…
But It worked fine on codeforces / sublime text

Please can you you tell what’s the bug…
If you click on the above link provided you’ll see my code & question too…

in case , this is question…
https://www.codechef.com/problems/BUTYPAIR/


ur code is giving error only bcoz of this part… i removed it and tested it is working…

@Vaibhav277

I am still getting the error…
let me explain u
(refer code for following)

https://www.codechef.com/viewsolution/49374447

If I use “Method 1” then it gives run-time error ( I want to know why ?)
if I use “Method 2” it gives WA.

Please tell me about Method-1 bug ?? (I did tested my ncr and fact functions !)

yrr code bheja to hai upr… its working fine and giving the desired o/p… what method 1 method2 are u talking of???

@Vaibhav277
bhaiya I have added comments in my code (when you’ll open the code you’ll see there are two lines I am referring one as Method 1 and other as 2 …to explain u) see my code and then read previous message…

Go to codechef…try to submit my code for this question…you’ll get an error !! That’s what I’m talking about .

cant see comments anywhere…

@Vaibhav277

bhaiya it is not possible I just clicked on this link and there are two comments !! (PFA screenshot)

https://www.codechef.com/viewsolution/49374447

okay okay… let me see…

@Vaibhav277

??
please tell ! ( My mind is constantly pinging me on this error :sweat_smile:)

u are unnecessarily making things complicated… refer this https://ide.codingblocks.com/s/600983

@Vaibhav277

bhaiya I don’t want solution to problem (though thanks for the effort) … I just want to understand why am I getting some run time error when I submit MY code and how to fix that

can you please just tell me this only … and please reply asap !

I told u here na bcoz of these 2 statements u are getting error… remove them and its working fine in coding blocks ide and not giving any runtime error…

@Vaibhav277

bhaiya I request you to PLEASE DO FOLLOWING

step 1 -> go to this link
https://www.codechef.com/viewsolution/49374447

step 2 -> copy my code and go to this link https://www.codechef.com/problems/BUTYPAIR/

step 3 -> submit it and you’ll get a weird run-time error

step 4 -> Please tell me how to fix that so my code is accepted
on . . . codechef

Please restrict to these steps only. I request you ! ( MaKE CHANGES IN MY CODE ONLY)

@Vaibhav277

??

Please reply its been two days…PLEASE READ MY LAST MESSAGE (the one I’m quoting) before replying

pls explain ur code using comments… like this i am unable to understand what u have written… the runtime error can be due to out of index, division by zero or many other reasons…

@Vaibhav277

https://www.codechef.com/viewsolution/49410549

I request you to please wrap up this time ! ( I have explained each step Also using examples )

Waiting for your reply !

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.