RUNTIME ERROR in codechef c++ compiler but works fine in Devc++


I’m getting RUNTIME ERROR in codechef c++ compiler But works fine in Dev++.
Can anyone solve this issue please?

First change your swap function to more manual one, use sort() function given in #include<algorithm> and whatever you wrote below //14 20 30 53 isn’t correct, it’s true only for certain numbers only! Devise some other method and change your code accordingly :slight_smile:

Also, change all int to long long datatype, otherwise you’ll get error later on (all the loops where you used int should be replaced :wink:

1 Like

Thank you so much!
Can we use algorithm header file for arrays instead of vectors?