Buggy python submission (verdict: Time Limit Exceeded):
primes = [0,0] + [1]*49999
for i in range(2, 223):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0
while True:
    n = int(input())
    if n == 0:
        break
    ans = 0
    mid = n // 2
    if primes[mid] and n%2 == 0:
        ans += 1
    left = [k for k, b in enumerate(primes[:mid]) if b]
    right = [k+mid+1 for k, b in enumerate(primes[mid+1:n]) if b]
    for i in right:
        for j in left:
            if i+j == n:
                ans += 1
                break
            if i+j > n:
                break
    print(ans)

Fixed submission:
import bisect
primes = [0, 0] + [1] * 49999
for i in range(2, 224):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0
values = [i for i, k in enumerate(primes) if k]
while True:
    n = int(input())
    if n == 0:
        break
    I = bisect.bisect(values, n//2)
    print(len([1 for v in values[:I] if primes[n-v]]))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
primes = [0,0] + [1]*49999
for i in range(2, 223):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0

primes = [k for k, b in enumerate(primes) if b]
while True:
    n = int(input())
    if n == 0:
        break
    ans = 0
    mid = n // 2
    if mid in primes and n%2==0:
        ans += 1
    l, r = bisect.bisect_left(primes, mid), bisect.bisect_left(primes, n)
    left = [v for v in primes[:l]]
    right = [v for v in primes[l:r]]
    for i in right:
        for j in left:
            if i+j == n:
                ans += 1
                break
            if i+j > n:
                break
    print(ans)

Fixed submission:
import bisect
primes = [0, 0] + [1] * 49999
for i in range(2, 224):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0
values = [i for i, k in enumerate(primes) if k]
while True:
    n = int(input())
    if n == 0:
        break
    I = bisect.bisect(values, n//2)
    print(len([1 for v in values[:I] if primes[n-v]]))

Buggy python submission (verdict: Time Limit Exceeded):
primes = [0, 0] + [1] * 49999
for i in range(2, 225):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0

while True:
    n = int(input())
    if n == 0:
        break
    print(sum(primes[i] and primes[n-i] for i in range(2, n//2+1)))

Fixed submission:
import bisect
primes = [0, 0] + [1] * 49999
for i in range(2, 224):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0
values = [i for i, k in enumerate(primes) if k]
while True:
    n = int(input())
    if n == 0:
        break
    I = bisect.bisect(values, n//2)
    print(len([1 for v in values[:I] if primes[n-v]]))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
primes = [0, 0] + [1] * 49999
for i in range(2, 225):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0
values = [i for i, k in enumerate(primes) if k]
while True:
    n = int(input())
    if n == 0:
        break
    I = bisect.bisect(values, n//2)
    tmp = values[:I]
    print(sum(n - t in tmp for t in tmp))

Fixed submission:
import bisect
primes = [0, 0] + [1] * 49999
for i in range(2, 224):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0
values = [i for i, k in enumerate(primes) if k]
while True:
    n = int(input())
    if n == 0:
        break
    I = bisect.bisect(values, n//2)
    print(len([1 for v in values[:I] if primes[n-v]]))

Buggy python submission (verdict: Runtime Error):
import bisect
primes = [0, 0] + [1] * 49999
for i in range(2, 224):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0
values = [i for i, k in enumerate(primes) if k]
while True:
    n = int(input())
    if n == 0:
        break
    I = bisect.bisect(values, n//2)
    print([i for i, v in enumerate(values[:I]) if primes[n-v]][-1] + 1)

Fixed submission:
import bisect
primes = [0, 0] + [1] * 49999
for i in range(2, 224):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0
values = [i for i, k in enumerate(primes) if k]
while True:
    n = int(input())
    if n == 0:
        break
    I = bisect.bisect(values, n//2)
    print(len([1 for v in values[:I] if primes[n-v]]))