Buggy python submission (verdict: Time Limit Exceeded):
def pri(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i=i+1
    return 1

l=[]
for i in range(2,50100):
    if pri(i):
        l.append(i)
s=len(l)
while 1:
    n=int(raw_input())
    ans=set([])
    if n==0:
        break
    for i in range(s):
        for j in range(i,s):
            if l[i]+l[j]==n:
                ans.add((min(l[i],l[j]),max(l[i],l[j])))
            elif i+j>n:
                break
    print len(ans)

Fixed submission:
def pri(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i=i+1
    return 1

l=[]
for i in range(2,50000):
    if pri(i):
        l.append(i)
s=5133
ans={}
for i in range(5132):
    for j in range(i,5133):
        a,b=l[i],l[j]
        if a+b>50000:
            break
        if ans.has_key(a+b):
            ans[a+b]+=1
        else:
            ans[a+b]=1
while 1:
    n=int(raw_input())
    if n==0:
        break
    print ans[n] if ans.has_key(n) else 0

Buggy python submission (verdict: Time Limit Exceeded):
def pri(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i=i+1
    return 1

l=[]
for i in range(2,50100):
    if pri(i):
        l.append(i)
s=5143
while 1:
    n=int(raw_input())
    ans=set([])
    if n==0:
        break
    for i in range(s):
        for j in range(i,s):
            if l[i]+l[j]==n:
                ans.add((min(l[i],l[j]),max(l[i],l[j])))
            elif l[i]+l[j]>n:
                break
    print len(ans)

Fixed submission:
def pri(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i=i+1
    return 1

l=[]
for i in range(2,50000):
    if pri(i):
        l.append(i)
s=5133
ans={}
for i in range(5132):
    for j in range(i,5133):
        a,b=l[i],l[j]
        if a+b>50000:
            break
        if ans.has_key(a+b):
            ans[a+b]+=1
        else:
            ans[a+b]=1
while 1:
    n=int(raw_input())
    if n==0:
        break
    print ans[n] if ans.has_key(n) else 0

Buggy python submission (verdict: Time Limit Exceeded):
def pri(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i=i+1
    return 1

l=[]
for i in range(2,50100):
    if pri(i):
        l.append(i)
s=5143
while 1:
    n=int(raw_input())
    ans=set([])
    if n==0:
        break
    for i in range(s):
        if l[i]>n:
            break
        for j in range(i,s):
            if l[i]+l[j]==n:
                ans.add((min(l[i],l[j]),max(l[i],l[j])))
            elif l[i]+l[j]>n:
                break
    print len(ans)

Fixed submission:
def pri(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i=i+1
    return 1

l=[]
for i in range(2,50000):
    if pri(i):
        l.append(i)
s=5133
ans={}
for i in range(5132):
    for j in range(i,5133):
        a,b=l[i],l[j]
        if a+b>50000:
            break
        if ans.has_key(a+b):
            ans[a+b]+=1
        else:
            ans[a+b]=1
while 1:
    n=int(raw_input())
    if n==0:
        break
    print ans[n] if ans.has_key(n) else 0

Buggy python submission (verdict: Time Limit Exceeded):
def pri(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i=i+1
    return 1

l=[]
for i in range(2,50100):
    if pri(i):
        l.append(i)
s=5143
while 1:
    n=int(raw_input())
    ans=0
    if n==0:
        break
    for i in range(s):
        if l[i]>n:
            break
        elif n-l[i] in l:
            ans+=1
    print ans

Fixed submission:
def pri(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i=i+1
    return 1

l=[]
for i in range(2,50000):
    if pri(i):
        l.append(i)
s=5133
ans={}
for i in range(5132):
    for j in range(i,5133):
        a,b=l[i],l[j]
        if a+b>50000:
            break
        if ans.has_key(a+b):
            ans[a+b]+=1
        else:
            ans[a+b]=1
while 1:
    n=int(raw_input())
    if n==0:
        break
    print ans[n] if ans.has_key(n) else 0