help with next palindrome , c++ .

for - https://www.codechef.com/problems/PALIN .
my c++ code works fine on Xcode but code chef shows wrong answer .

#include<iostream>

using namespace std;

int reverse_number(int n)

{

 int r=0, a;

while(n>=1)

  {

  a=n%10;

 r=r*10+a;

 n=n/10;

 }

 return r;

}

int main()

{int  n ;

cin >> n;

while ( n--)

{ int b;

cin >> b;

for ( int i = b ; i < 100000 ; ++i)

  {

 if (reverse_number(i) == i )

 { cout <<i;

break;}

 }}

 return 0;

}

Read the Q carefully!! It says that-

For a given positive integer K of not more than **1000000 digits**, 

If its 1000000 digits, you will have to take input as a STRING and check for palindrome, you cannot store it as an integer in int or long as these many digits are too large, it will cause overflow.

For reference, long long int stores only 18-19 digits.

//