See if including “#include<bits/stdc++.h” solves the problem or not.
Else refer here - https://stackoverflow.com/questions/5590381/easiest-way-to-convert-int-to-string-in-c
EDIT: itoa isnt available in c++, instead, use to_string() function.
PS: Your prime function has 2 errors, and also check X. Your code has atleast 4-5 bugs which are going to chomp you down in debugging. XD
Here is the code which compiles and runs in C++14, (G 4.9.2)
using namespace std;
int palin(long int num)
else return 1;
int prime(int j)
long int i;
while(x==0 || y==0)
if(x==0 || y==0)
I also fixed errors in your palin function (It is here -
for(int i=0,j=s.length()-1;i<s.length()/2;i++,j--) Here, j should be as “j=s.length()-1” because j=s.length will throw out of index thing, which causes undefined behavior. Here this caused your function to always return 0 and end up as a TLE )