https://www.codechef.com/submit/TEST

https://www.codechef.com/submit/TEST
please help codechef compiler is giving compilation error but there is no such problem on local machine.

#include
using namespace std;
int main()
{
int a=0;
while(a!=42 && a>=0 && a<100)
{
cin>>a;
if(a!=42)
cout<<a<<endl;
}
return 0;
}

That’s because you’re submitting you C++ code in KOTLIN. I don’t know if C++ code can be compiled with KOTLIN but apparently not.
However your C++ submission also failed because you are exiting the loop if a is negative. That restriction isn’t mentioned anywhere and the editorialist’s solution hints that numbers can be negative too.

Some advice for future posts:

  1. Don’t just copy paste your unindented code in the description. Provide a submission link instead (https://www.codechef.com/viewsolution/24842555 in your case)
1 Like


probably there is some problem on codechef website, my language is already selected to C++ but on server side it is changing to kotlin. i copied your solution just to test the problem.

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

I just submitted your code and got AC
the server is working correctly

It looks like you are submitting through www.codechef.com/ide. Maybe you can try submitting through www.codechef.com/submit/TEST ?

image
You can upload a file and select a language there. I suggest you don’t copy paste your code in the editor there just to see what happens.

If it works here and not in the IDE then there is a problem with the IDE I guess. If it doesn’t work either way, there is a problem on your end.