I suppose an error is here:
a[f[i]]=1;
even 40th fibonacci number (102334155) will be greater than 200000
, so it will be out of a
's range.
Update: sorry, I haven't noticed that the loop runs until f[i] <= 10000, not i <= 10000.
Another possible problem here is
if(a[n]==1)
you don't check n to be less than a's size, if someone would input a very big number, the code can produce a segfault.