Buggy python submission (verdict: Runtime Error):
import math
import bisect
primes=[2]
top=2
nlist=[2*x-1 for x in range(2,5000)]
while top<math.sqrt(10000):
    top=nlist[0]
    primes.append(top)
    newnlist=[]
    for i in nlist:
        if i%top!=0:
            newnlist.append(i)
    nlist=newnlist
primes=primes+nlist

while(1):
    try:
        n=int(raw_input())
    except:
        break
    if n%2==0:
        if n-1 in primes:
            print 2
        else:
            print 0
    else:
        ans=0
        center=(n+1)/2
        distc=[x-center for x in primes]
        if 0 in distc:
            ans=1
            il=bisect.bisect_left(distc,0)-1
            ir=bisect.bisect_left(distc,0)+1
        else:
            il=bisect.bisect_left(distc,0)-1
            ir=bisect.bisect_left(distc,0)
        while(il>=0 and primes[ir]<n+1):
            if distc[il]+distc[ir]==0:
                ans=ans+2
                il=il-1
                ir=ir+1
            elif distc[il]+distc[ir]<0:
                ir=ir+1
            else:
                il=il-1
            #print ir,il
        print ans

Fixed submission:
import math
import bisect
primes=[2]
top=2
nlist=[2*x-1 for x in range(2,5000)]
while top<math.sqrt(10000):
    top=nlist[0]
    primes.append(top)
    newnlist=[]
    for i in nlist:
        if i%top!=0:
            newnlist.append(i)
    nlist=newnlist
primes=primes+nlist
while(1):
    try:
        n=int(raw_input())
    except:
        break
    if n%2==0:
        if n-1 in primes:
            print 2
        else:
            print 0
    else:
        ans=0
        center=(n+1)/2
        distc=[x-center for x in primes[:bisect.bisect(primes,n)]]
        if 0 in distc:
            ans=1
            il=bisect.bisect_left(distc,0)-1
            ir=bisect.bisect_left(distc,0)+1
        else:
            il=bisect.bisect_left(distc,0)-1
            ir=bisect.bisect_left(distc,0)
        while(il>=0 and ir<len(distc)):
            if distc[il]+distc[ir]==0:
                ans=ans+2
                il=il-1
                ir=ir+1
            elif distc[il]+distc[ir]<0:
                ir=ir+1
            else:
                il=il-1
        print ans

Buggy python submission (verdict: Time Limit Exceeded):
import math
import bisect
primes=[2]
top=2
nlist=[2*x-1 for x in range(2,5000)]
while top<math.sqrt(10000):
    top=nlist[0]
    primes.append(top)
    newnlist=[]
    for i in nlist:
        if i%top!=0:
            newnlist.append(i)
    nlist=newnlist
primes=primes+nlist
while(1):
    try:
        n=int(raw_input())
    except:
        break
    if n%2==0:
        if n-1 in primes:
            print 2
        else:
            print 0
    else:
        ans=0
        center=(n+1)/2
        distc=[x-center for x in primes]
        if 0 in distc:
            ans=1
            il=bisect.bisect_left(distc,0)-1
            ir=bisect.bisect_left(distc,0)+1
        else:
            il=bisect.bisect_left(distc,0)-1
            ir=bisect.bisect_left(distc,0)
        while(il>=0 and ir<len(primes)):
            if primes[ir]<n+1:
                if distc[il]+distc[ir]==0:
                    ans=ans+2
                    il=il-1
                    ir=ir+1
                elif distc[il]+distc[ir]<0:
                    ir=ir+1
                else:
                    il=il-1
        print ans

Fixed submission:
import math
import bisect
primes=[2]
top=2
nlist=[2*x-1 for x in range(2,5000)]
while top<math.sqrt(10000):
    top=nlist[0]
    primes.append(top)
    newnlist=[]
    for i in nlist:
        if i%top!=0:
            newnlist.append(i)
    nlist=newnlist
primes=primes+nlist
while(1):
    try:
        n=int(raw_input())
    except:
        break
    if n%2==0:
        if n-1 in primes:
            print 2
        else:
            print 0
    else:
        ans=0
        center=(n+1)/2
        distc=[x-center for x in primes[:bisect.bisect(primes,n)]]
        if 0 in distc:
            ans=1
            il=bisect.bisect_left(distc,0)-1
            ir=bisect.bisect_left(distc,0)+1
        else:
            il=bisect.bisect_left(distc,0)-1
            ir=bisect.bisect_left(distc,0)
        while(il>=0 and ir<len(distc)):
            if distc[il]+distc[ir]==0:
                ans=ans+2
                il=il-1
                ir=ir+1
            elif distc[il]+distc[ir]<0:
                ir=ir+1
            else:
                il=il-1
        print ans