It’s relay so difficult to click in “search topics, posts, user or categories” icon, write here “palin” and find: http://discuss.spoj.com/search?expanded=true&q=palin <— then read it all!? 
What this mean: “… positive integer K of not more than 1000000 digits …” !?
|
|
V
positive integer K of not more than 1 digits ==> K < 10
positive integer K of not more than 2 digits ==> K < 100
positive integer K of not more than 3 digits ==> K < 1000
…
positive integer K of not more than 10 digits ==> K < 10000000000
…
positive integer K of not more than 1000000 digits mean K < 100000000000000000000 … 0000000000000000000000000000000000000000000000000000000 … 00000000000000000 = 10^1000000 is’n it? 
Then, what are you doing here:
int num[b]; <-------- here!? int !? for number < 10^1000000
for(int i=0;i<b;i++){
cin>>num[i];
And do you know what is it and for what:
#include <bits/stdc++.h> //;-)
Search icon =
on right upper corner of this page 