For this Question: Final fight of Harry and Voldemort has began. In order to defeat Lord Voldemort, Harry must use a spell greater than the Voldemort's spell and as Voldemort loves palindromes, Harry's spell must not contain palindromic substring of length more than or equal to X. 

Given X and string S, find a string R such that R is lexicographically larger than S and R does not contain any palindrome substring with length more than or equal to X. Among all possible R, you must chose lexicographically minimum.

This fight will decide the fate of Hogwarts, so please help Harry find an appropriate spell (string R) or tell Harry that no such spell exists.First line of input contains a single integer X.
Second line of input contains a string S (Lord Voldemort's spell).

Constraints:
1 <= |S| <= 100000
1 <= X <= |S|
S contains only lowercase english alphabets

Note: R must contain only lowercase english alphabets.Print a single string R denoting Harry's spell if it exists else print "Impossible".Sample Input
3
bbbbbbb

Sample Output
bbcaabb

Sample Input
2
zyz

Sample Output
Impossible
, I have written this Solution Code: #pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////
auto clk=clock();
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////
#define P 1000000007
#define N 400010
char s[N],t[N];int m,n,a[N],b[N],p[N];
bool F=0;
bool can(int x,int y)
{
    x++;
    if(x<y)return 1;
    int le=a[x]-a[x-y]*p[y],ri=b[x]-b[x-y];
    return le*p[x-y]!=ri;
}
void ff(int x,bool y)
{
    if(x==n){cout<<t,F=1;return;}
    for(t[x]=(y?s[x]:'a');t[x]<='z';t[x]++)
    {
        a[x+1]=a[x]*P+t[x],
        b[x+1]=b[x]+t[x]*p[x];
        if(can(x,m)&&can(x,m+1))ff(x+1,y&&(t[x]==s[x]));
        if(F)return;
    }
    return;
}
signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	cin>>m>>s;
	n=strlen(s);t[n]=0;
    int w=n-1;
    while(w>=0&&s[w]=='z')s[w]='a',w--;
    if(w<0){cout<<"Impossible";return 0;}
    s[w]++;
    p[0]=1;for(int i=1;i<N;i++)p[i]=p[i-1]*P;
    ff(0,1);
    if(!F)cout<<"Impossible";
	#ifdef ANIKET_GOYAL
		// cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
	#endif
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?