Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
m=math.pi
s=r*r*m
l=2*r*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
m=float('%03.6f'%math.pi)
s=m*r**2
l=2*r*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
m=float('%03.7f'%math.pi)
s=m*(r**2)
l=(2*r)*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
m=float(math.pi)
s=m*(r**2)
l=(2*r)*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
m=float(math.pi)
s=r**2*m
l=2*r*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
m=float(math.pi)
s=r**2*m
l=2*r*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
m=float(math.pi)
s=r**2*m
l=2*r*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
m=float(math.pi)
s=r**2*m
l=2*r*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
r = int(input())
m=3.141592
s=r**2*m
l=2*r*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
r = int(input())
m=3.141592
s=r**2*m
l=2*r*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
m=float(math.pi)
s=r**2*m
l=2*r*m
print(s,l)

Fixed submission:
import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)
Buggy python submission (verdict: Runtime Error):
while True:
    H,W= map(int, input().split())
    s = "#"
    for i in range(H):
        if H==0 and W==0:
            break
        else:
            x = s*W
            print(x)
    print("")        
              

Fixed submission:
while True:
    H,W= map(int, input().split())
    if H==0 and W==0:
        break
    s = "#"
    for i in range(H):        
        x = s*W
        print(x)
    print("")

Buggy python submission (verdict: Runtime Error):
while True:
    H,W= map(int, input().split())
    s = "#"
    for i in range(H):
        if H==0 and W==0:
            break
        else:
            x = s*W
            print(x)
    print("")
              

Fixed submission:
while True:
    H,W= map(int, input().split())
    if H==0 and W==0:
        break
    s = "#"
    for i in range(H):        
        x = s*W
        print(x)
    print("")
Buggy python submission (verdict: Runtime Error):
while True:
    H,W= map(int, input().split())
    s = "#"
    a = H
    b = "."
    for i in range(H):
        if H==0 and W==0:
            break
        elif a==H or a==1:
            x = s*W
            print(x)
            a-=1
        else:
            y = s+b*(W-2)+s
            print(y)
            a-=1
    print("")

Fixed submission:
while True:
    H,W= map(int, input().split())
    if H==0 and W==0:
        break
    s = "#"
    a = H
    b = "."
    for i in range(H):
        if 1<a<H:
            y = s+b*(W-2)+s
            print(y)
            a-=1
        elif a==H or a==1:
            x = s*W
            print(x)
            a-=1                    
    print("")

Buggy python submission (verdict: Runtime Error):
while True:
    H,W= map(int, input().split())
    s = "#"
    a = H
    b = "."
    for i in range(H):
        if 1<a<H:
            y = s+b*(W-2)+s
            print(y)
            a-=1
        elif a==H or a==1:
            x = s*W
            print(x)
            a-=1
        
        else:
            H==0 and W==0
            break
    print("")

Fixed submission:
while True:
    H,W= map(int, input().split())
    if H==0 and W==0:
        break
    s = "#"
    a = H
    b = "."
    for i in range(H):
        if 1<a<H:
            y = s+b*(W-2)+s
            print(y)
            a-=1
        elif a==H or a==1:
            x = s*W
            print(x)
            a-=1                    
    print("")

Buggy python submission (verdict: Runtime Error):
while True:
    H,W= map(int, input().split())
    s = "#"
    a = H
    b = "."
    for i in range(H):
        if 1<a<H:
            y = s+b*(W-2)+s
            print(y)
            a-=1
        elif a==H or a==1:
            x = s*W
            print(x)
            a-=1
        else:
            H==0 and W==0
            break
    print("")

Fixed submission:
while True:
    H,W= map(int, input().split())
    if H==0 and W==0:
        break
    s = "#"
    a = H
    b = "."
    for i in range(H):
        if 1<a<H:
            y = s+b*(W-2)+s
            print(y)
            a-=1
        elif a==H or a==1:
            x = s*W
            print(x)
            a-=1                    
    print("")
Buggy python submission (verdict: Runtime Error):
a = int(input())
x=-1
y=[]
while x<=a:
    x+=1
    if x%10==3 or x%3==0:
    y.append(str(x))
    
print(" ".join(y))

Fixed submission:
a = int(input())
x=0
y=[]
while x<a:
    x+=1
    if "3" in str(x) or x%3==0:
        y.append(str(x))
print(" "+" ".join(y))

Buggy python submission (verdict: Runtime Error):
a = int(input())
x=-1
y=[]
while x<=a:
    x+=1
    if x%10==3 or x%3==0:
    y.append(str(x))
    
print(" ".join(y))

Fixed submission:
a = int(input())
x=0
y=[]
while x<a:
    x+=1
    if "3" in str(x) or x%3==0:
        y.append(str(x))
print(" "+" ".join(y))
Buggy python submission (verdict: Runtime Error):
N = input()
arr = [[[0 for i in range(10)] for j in range(3)]for r in range(4)]
for i in range(N):
    a=[]
    a.append(map(int, input().split()))
    b=a[0]
    f=a[1]
    r=a[2]
    v=a[3]
    arr[b][f][r]+=v
for i in range(3):
    for j in range(3):
        print(" ".join(arr[i][j])
    print("####################")
for j in range(3):
    print(" ".join(arr[3][j])  

Fixed submission:
N = int(input())
arr = [[[0 for i in range(10)] for j in range(3)]for r in range(4)]
for i in range(N):
    a=[]
    a.append(list(map(int,input().split())))
    b=a[0][0]-1
    f=a[0][1]-1
    r=a[0][2]-1
    v=a[0][3]
    arr[b][f][r]+=v

for i in range(0,3):
    for j in range(0,3):
        print(" "+" ".join(map(str,arr[i][j])))
    print("#"*20)
for i in range(3):
    print(" "+" ".join(map(str,arr[3][i])))

Buggy python submission (verdict: Runtime Error):
N = input()
arr = [[[0 for i in range(10)] for j in range(3)]for r in range(4)]
for i in range(N):
    a=[]
    a.append(map(int, input().split()))
    b=a[0]
    f=a[1]
    r=a[2]
    v=a[3]
    arr[b][f][r]+=v
for i in range(3):
    for j in range(3):
        print(" ".join(arr[i][j])
    print("####################")
for j in range(3):
    print(" ".join(arr[3][j])  

Fixed submission:
N = int(input())
arr = [[[0 for i in range(10)] for j in range(3)]for r in range(4)]
for i in range(N):
    a=[]
    a.append(list(map(int,input().split())))
    b=a[0][0]-1
    f=a[0][1]-1
    r=a[0][2]-1
    v=a[0][3]
    arr[b][f][r]+=v

for i in range(0,3):
    for j in range(0,3):
        print(" "+" ".join(map(str,arr[i][j])))
    print("#"*20)
for i in range(3):
    print(" "+" ".join(map(str,arr[3][i])))
Buggy python submission (verdict: Runtime Error):
for i in range(1,10):
    for j in range(1,10):
        print str(i)+"??"+str(j)+"="+str(i*j)

Fixed submission:
for i in range(1,10):
    for j in range(1,10):
        print str(i)+"x"+str(j)+"="+str(i*j)
Buggy python submission (verdict: Runtime Error):
while 1:
    n = int(input())
    if n == 0:
        break
    lst = []
    for i in range(n+1,n*2+1,1):
        sum = 0
        for j in range(2,i/2+1):
            if i%j == 0:
                sum += 1
        if sum == 0:
            lst.append(i)
    print len(lst)

Fixed submission:
import math
while 1:
	n = int(input())
	if n == 0:
		break
	count = 0
	if n == 1:
		count = 1
		x = n + 2
	elif n % 2 == 1:
		x = n + 2
	elif n == 2:
		count = 1
		x = n + 1
	else:
		x = n + 1
	for i in range(x,n*2+1,2):
		y = math.trunc(math.sqrt(i))+3
		if y % 2 == 1:
			z = y-2
		else:
			z = y-1
		for j in range(3,y,2):
			if i % j == 0:
				break
			if j == z:
				count += 1
	print count

Buggy python submission (verdict: Runtime Error):
import math
while 1:
    n = int(input())
    if n == 0:
        break
    lst = []
    for i in range(n+1,n*2+1,1):
        sum = 0
        if isinstance(math.sqrt(i),int) == False:
            x = math.floor(math.sqrt(i)) + 1
        else:
            x = math.sqrt(i) + 1
        for j in range(2,math.trunc(x)):
            if i%j == 0:
                sum += 1
        if sum == 0:
            lst.append(i)
    print len(lst)

Fixed submission:
import math
while 1:
	n = int(input())
	if n == 0:
		break
	count = 0
	if n == 1:
		count = 1
		x = n + 2
	elif n % 2 == 1:
		x = n + 2
	elif n == 2:
		count = 1
		x = n + 1
	else:
		x = n + 1
	for i in range(x,n*2+1,2):
		y = math.trunc(math.sqrt(i))+3
		if y % 2 == 1:
			z = y-2
		else:
			z = y-1
		for j in range(3,y,2):
			if i % j == 0:
				break
			if j == z:
				count += 1
	print count
Buggy python submission (verdict: Runtime Error):
while 1:
    n = int(input())
    if n == 0:
        break
    lst = []
    b = 0
    for i in range(n):
        s = str(raw_input())
        lst.append(s)
        if s == "Un":
            if ("A" in lst) == True:
                lst.remove("A")
                lst.remove("Un")
            else:
                b = 1
    if b != 0:
        print "NO"
    else:
        if len(lst) != 0:
            print "NO"
        else:
            print "YES"

Fixed submission:
n = int(input())
lst = []
b = 0
for i in range(n):
    s = str(raw_input())
    lst.append(s)
    if s == "Un":
        if ("A" in lst) == True:
            lst.remove("A")
            lst.remove("Un")
        else:
            b = 1
if b != 0:
    print "NO"
else:
    if len(lst) != 0:
        print "NO"
    else:
        print "YES"
Buggy python submission (verdict: Runtime Error):
while 1:
    r,w,c,a = map(int,raw_input().split())
    if r == w == c == a == 0:
        break
    b = 0
    sum = 0
    if r % c == 0:
        if r / c >= w:
            b = 1
    while b == 0:
        sum += 1
        r += a
        if r % c == 0:
            if r/c>=w:
                b = 1
    print sum

Fixed submission:
while 1:
    r,w,c,a = map(int,raw_input().split())
    if r == w == c == a == 0:
        break
    b = 0
    sum = 0
    if r / c >= w:
            b = 1
    while b == 0:
        sum += 1
        r += a
        if r/c>=w:
            b = 1
    print sum
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = map(int,raw_input().split())
q = int(input())
T = map(int,raw_input().split())
count = 0
for v in T:
    for i in range(n):
        if S[i] == v:
            count += 1
            break
print count

Fixed submission:
n = int(input())
S = set(raw_input().split())
q = int(input())
T = set(raw_input().split())
print len(S&T)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = map(int,raw_input().split())
q = int(input())
T = map(int,raw_input().split())
count = 0
lst = []
for v in S:
    if v in lst:
        pass
    else:
        for i in range(q):
            if T[i] == v:
                count += 1
                break
    lst.append(v)
print count

Fixed submission:
n = int(input())
S = set(raw_input().split())
q = int(input())
T = set(raw_input().split())
print len(S&T)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = map(int,raw_input().split())
q = int(input())
T = map(int,raw_input().split())
count = 0
lst = []
for v in S:
    if v in lst:
        pass
    else:
        for i in range(q):
            if T[i] == v:
                count += 1
                break
    lst.append(v)
print count

Fixed submission:
n = int(input())
S = set(raw_input().split())
q = int(input())
T = set(raw_input().split())
print len(S&T)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = map(int,raw_input().split())
q = int(input())
T = map(int,raw_input().split())
count = 0
lst = []
for v in S:
    if v in lst:
        pass
    else:
        for i in range(q):
            if T[i] == v:
                count += 1
                break
    lst.append(v)
print count

Fixed submission:
n = int(input())
S = set(raw_input().split())
q = int(input())
T = set(raw_input().split())
print len(S&T)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = map(int,raw_input().split())
q = int(input())
T = map(int,raw_input().split())
count = 0
lst = []
for v in S:
    if v in lst:
        pass
    else:
        for i in range(q):
            if T[i] == v:
                count += 1
    lst.append(v)
print count

Fixed submission:
n = int(input())
S = set(raw_input().split())
q = int(input())
T = set(raw_input().split())
print len(S&T)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print a*b,(a+b)*2

Fixed submission:
a,b = map(int,raw_input().split())
print a*b,(a+b)*2
Buggy python submission (verdict: Runtime Error):
s = int(input())
a = s / 3600
b = (s - a) / 60
c = s - a - b
print a + ":" + b + ":" + c

Fixed submission:
s = int(input())
a = s /3600
b = (s-a*3600)/60
c = s - 3600*a -60*b
print str(a) + ":" + str(b) + ":" + str(c)
Buggy python submission (verdict: Runtime Error):
While True:
    no = []
    n = int(input())
    if (n = 0):
        return
    
    for i in range(n):
        datas = map(int, input().split())
        li = list(datas) 
        e = li[0]
        p = li[1]
        q = li[2]

        s = p * q
        if (1000000 < s and (e in no) = False):
            print(e)
            no.append(e)
    
    if (len(no) = 0):
        print("NA")




Fixed submission:
while True:
    no = {}
    n = int(input())
    if (n == 0):
        break
    
    for i in range(n):
        datas = map(int, input().split())
        li = list(datas) 
        e = li[0]
        p = li[1]
        q = li[2]

        s = p * q
        if (e not in no):
            no[e] = s
        else:
            no[e] += s

    na = True    
    for k in no.keys():
        if (1000000 <= no[k]):
            print(k)
            na = False
    
    if (na == True):
        print("NA")

Buggy python submission (verdict: Runtime Error):
while True:
    no = []
    n = int(input())
    if (n == 0):
        exit
    
    for i in range(n):
        datas = map(int, input().split())
        li = list(datas) 
        e = li[0]
        p = li[1]
        q = li[2]

        s = p * q
        if (1000000 < s and (e in no) == False):
            print(e)
            no.append(e)
    
    if (len(no) == 0):
        print("NA")




Fixed submission:
while True:
    no = {}
    n = int(input())
    if (n == 0):
        break
    
    for i in range(n):
        datas = map(int, input().split())
        li = list(datas) 
        e = li[0]
        p = li[1]
        q = li[2]

        s = p * q
        if (e not in no):
            no[e] = s
        else:
            no[e] += s

    na = True    
    for k in no.keys():
        if (1000000 <= no[k]):
            print(k)
            na = False
    
    if (na == True):
        print("NA")
Buggy python submission (verdict: Runtime Error):
import math

lst = []
for i in range(200):
    try:
        lst.append(input())
    except EOFError:
        break

nums = [list(map(int, elem.split(' '))) for elem in lst]

# gcd 
res_gcd = [math.gcd(num[0], num[1]) for num in nums]

# lcm
res_lcm = [nums[i][0] * nums[i][1] // res_gcd[i] for i in range(len(nums))]

for (a, b) in zip(res_gcd, res_lcm):
    print('{} {}'.format(a, b))

Fixed submission:
import fractions

lst = []
for i in range(200):
    try:
        lst.append(input())
    except EOFError:
        break

nums = [list(map(int, elem.split(' '))) for elem in lst]

# gcd 
res_gcd = [fractions.gcd(num[0], num[1]) for num in nums]

# lcm
res_lcm = [nums[i][0] * nums[i][1] // res_gcd[i] for i in range(len(nums))]

for (a, b) in zip(res_gcd, res_lcm):
    print('{} {}'.format(a, b))
Buggy python submission (verdict: Runtime Error):
import sys

n = sys.argv

print n*n*n

Fixed submission:
x = int(input())
print(x**3)

Buggy python submission (verdict: Runtime Error):
import sys

n = int(sys.argv[1])
n = n*n*n
print (n)

Fixed submission:
x = int(input())
print(x**3)
Buggy python submission (verdict: Runtime Error):
n = int(input())
first = int(input())
min = first
max = first
sum = first
for i in range(n-1):
	x = int(input())
	if x > max:
		max = x
	if x < min:
		min = x
	sum += x

print(min, max, sum)

Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
min = nums[0]
max = nums[0]
sum = 0
for x in range(n):
	if nums[x] > max:
		max = nums[x]
	if nums[x] < min:
		min = nums[x]
	sum += nums[x]

print(min, max, sum)
Buggy python submission (verdict: Runtime Error):
cards = {
	"S":[0]*13,
	"H":[0]*13,
	"C":[0]*13,
	"D":[0]*13
}

n = int(input())

for i in range(n):
	s, num = input().split()
	c[s][int(num)-1] = 1
	
for i in ["S", "H", "C", "D"]:
	for j in range(13)
		if[i][j] == 0:
			print(i,j+)

Fixed submission:
cards = {
	"S":[0]*13,
	"H":[0]*13,
	"C":[0]*13,
	"D":[0]*13
}

n = int(input())

for i in range(n):
	s, num = input().split()
	cards[s][int(num)-1] = 1
	
for i in ["S", "H", "C", "D"]:
	for j in range(13):
		if cards[i][j] == 0:
			print(i,j+1)

Buggy python submission (verdict: Runtime Error):
cards = {
	"S":[0]*13,
	"H":[0]*13,
	"C":[0]*13,
	"D":[0]*13
}

n = int(input())

for i in range(n):
	s, num = input().split()
	c[s][int(num)-1] = 1
	
for i in ["S", "H", "C", "D"]:
	for j in range(13):
		if[i][j] == 0:
			print(i,j+)

Fixed submission:
cards = {
	"S":[0]*13,
	"H":[0]*13,
	"C":[0]*13,
	"D":[0]*13
}

n = int(input())

for i in range(n):
	s, num = input().split()
	cards[s][int(num)-1] = 1
	
for i in ["S", "H", "C", "D"]:
	for j in range(13):
		if cards[i][j] == 0:
			print(i,j+1)
Buggy python submission (verdict: Runtime Error):
s = input()

for i in s:
	if(i.isupper()):
		print(i.lower(), end="")
	else
		print(i.upper(), end="")

Fixed submission:
s = input()

for i in s:
	if(i.isupper()):
		print(i.lower(), end="")
	else:
		print(i.upper(), end="")
print()
Buggy python submission (verdict: Runtime Error):
import sys
 
string = str()
 
for line in sys.stdin:
    string += line.lower()

string = input().lower()
alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

for letter in alph:
	sum = 0
	n = -1
	while True:
		n = string.find(letter, n + 1)
		if n == -1:
			break
		sum += 1
	print("{} : {}".format(letter, sum))

Fixed submission:
import sys
 
string = str()
 
for line in sys.stdin:
    string += line.lower()

alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

for letter in alph:
	sum = 0
	n = -1
	while True:
		n = string.find(letter, n + 1)
		if n == -1:
			break
		sum += 1
	print("{} : {}".format(letter, sum))
Buggy python submission (verdict: Runtime Error):
word = input()

string = input().lower()
last = ""

while last != "END_OF_TEXT":
	last = input().lower()
	string += last
	
print(string.count(word))

Fixed submission:
word = input()

string = input().lower()
last = ""

while last != "END_OF_TEXT":
	last = input()
	string += " " + last.lower()

list_words = list(string.split())

count = 0

for s in list_words:
	if s == word:
		count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
cards = input()
shuffle = input()

while shuffle != '-':
	n = int(shuffle)
	cards = cards[n:] + cards[:n]
	shuffle = input()
	
print(cards)

Fixed submission:
while True:
	cards = input()
	if cards == '-':
		break
	n = int(input())
	
	for _ in range(n):
		shuffle = int(input())
		cards = cards[shuffle:] + cards[:shuffle]
		
	print(cards)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import bisect
from math import sqrt
import sys
primes = deque([2, 3, 5, 7, 11, 13, 17, 19])
append = primes.append
for i in range(21, 1000000, 2):
    for j in range(3, int(sqrt(i))+1, 2):
        if i%j == 0:
            break
    else:
        append(i)

for l in sys.stdin:
    print(bisect.bisect(primes, int(l)))

Fixed submission:
def get_prime_set(ub):
    from itertools import chain
    from math import sqrt

    if ub < 4:
        return ({}, {}, {2}, {2, 3})[ub]

    ub, ub_sqrt = ub+1, int(sqrt(ub))+1
    primes = {2, 3} | set(chain(range(5, ub, 6), range(7, ub, 6)))
    du = primes.difference_update
    for n in chain(range(5, ub_sqrt, 6), range(7, ub_sqrt, 6)):
        if n in primes:
            du(range(n*3, ub, n*2))

    return primes


import sys
from bisect import bisect_right
primes = list(get_prime_set(999999))
print(*(bisect_right(primes, int(n)) for n in sys.stdin), sep="\n")
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
ub = 50000
primes = {2} | set(range(3, ub, 2))
du = primes.difference_update
for n in range(3, ub, 2):
    if n in primes:
        du(range(n*3, ub, n*2))

primes = list(primes)

while True:
    n = int(input())
    if n == 0:
        break
    l, r = 0, bisect_left(primes, n-2)
    ans = 0
    while l <= r:
        if primes[l]+primes[r] > n:
            r -= 1
        ans += (primes[l]+primes[r] == n)
        l += 1
    print(ans)


Fixed submission:
import sys
from bisect import bisect_right
from itertools import chain, compress

ub = 50000
is_prime = [0, 0, 1, 1] + [0]*(ub-3)
is_prime[5::6] = is_prime[7::6] = [1]*int(ub/6)
primes = [2, 3]
append = primes.append

for n in chain(range(5, ub, 6), range(7, ub, 6)):
    if is_prime[n]:
        append(n)
        is_prime[n*3::n*2] = [0]*((ub-n)//(n*2))
primes.sort()

for n in map(int, sys.stdin):
    if not n:
        break
    if n%2:
        print(is_prime[n-2])
    else:
        print(len([1 for p in primes[:bisect_right(primes, n/2)] if is_prime[n-p]]))