What's wrong with this code for INOI 2015 P2

Can somebody please point the error in this code ? Thanks !

I have used the recursion q(n) = 2^n - \sum_{ m | n, m < n} q(m), where q is the number of aperiodic strings of length n.

https://pastebin.com/raw/EXRMmLg0

Thanks !

i am not having time for debugging now, as i am also appearing for inoi. u can compare ur solution from my solution if needed. https://github.com/JVJplus/IOIPractice/blob/master/INOI%20Previous%20Papers/2015-02%20Periodic%20Strings.cpp