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)

```
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int palin(long int num)
{
//char *instr=itoa(num);
string s=to_string(num);
int flag=0;
for(int i=0,j=s.length()-1;i<s.length()/2;i++,j--)
{
if(s[i]!=s[j])
{
flag=1;
break;
}
}
if (flag==1)
return 0;
else return 1;
}
int prime(int j)
{
for(int i=2;i<=j/2;i++){
if(j%i==0)
return 0;
}
return 1;
}
int main()
{
long int i;
int x=0,y=0;
cin>>i;
while(x==0 || y==0)
{
y=prime(i);
if(y==1)
x=palin(i);
if(x==0 || y==0)
{
i++;
x=0;
y=0;
}
}
cout<<i<<endl;
return 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 )