Next Palindrome

i have done my program in c++ and it is running on ideone but codechef compiler is not accepting it

my code goes here

#include <iostream>
using namespace std;
int main() 
{
	// your code goes here
	int i,t,k[1000000],s,r,rev=0;
	int n;
	cin>>t;
	while(t--)
	{
		for (i=t;i<=t;i++)
		{
			cin>>k[i];
		}
		for(i=t;i<=t;i++)
		{
			s=k[i];
			begin:
			s++;
		n=s;
		while(n!=0)
		{
		r=n%10;
		rev=rev*10+r;
		n/=10;
		}
		if (rev==s)
		{	
		cout<<rev;
		break;
		}
	else 
	{
		r=0;rev=0;n=0;
		goto begin;
	}
}
		}
	
	return 0;
}

please help me!!!