Assuming I understand this correctly...the true state is either YES or NO. You have an algorithm A that can detect the truth with probability 4/5 and failfails with probability 1/5. You devise an algorithm B that just runs A $n$ times and decides that the truth is YES if B has a sufficient number of YES outcomes out of those $n$ trials. I think that works. You want to find the first values of $n$ and $x$ (with $n/2\le x\le n$) that satisfy:
$$\sum_{y=x}^n {n\choose y} (4/5)^y (1/5)^{n-y} \ge p,$$ and $$\sum_{y=0}^{x-1} {n\choose y} (1/5)^y (4/5)^{n-y} \ge p.$$
In that way, your decision rule for B - return a YES if there are at least $x$ yes outcomes in the $n$ trials - will work with probability at least $p$. If $n$ is odd then you really only need the first inequality.