using namespace std;
cin >> n;
if (n != 42)
cout << n << endl;
I checked my code with a variety of inputs and it turns out to be right but after submission they says failed.
You had WA,Compilation Error, and then AC, so I guess you resolved your problem.