Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
l=[0]*26
for h in sys.stdin:
    for i in h:
        k=ord(i.lower())
        if 96<k<123:l[k-97]+=1
for i in range(26):print chr(i+97),':',l[i]

Fixed submission:
import time
import sys
import io
import re
import math
#start = time.clock()
i = [0]*127
#n = raw_input()
for x in sys.stdin.read().lower():
    i[ord(x)]+=1
for y in range(ord('a'), ord('z')+1):
    print chr(y)+ ' : ' + str(i[y])

Buggy python submission (verdict: Runtime Error):
import sys
import io
import re
import math
start = time.clock()
i = [0]*255
#n = raw_input()
for x in sys.stdin.read().lower:
    i[ord(x)]+=1
for y in xrange(ord('a'), ord('z')+1):
    print chr(y)+ ' : ' +i[y]

Fixed submission:
import time
import sys
import io
import re
import math
#start = time.clock()
i = [0]*127
#n = raw_input()
for x in sys.stdin.read().lower():
    i[ord(x)]+=1
for y in range(ord('a'), ord('z')+1):
    print chr(y)+ ' : ' + str(i[y])

Buggy python submission (verdict: Runtime Error):
import sys
import io
import re
import math

i = [0]*255
#n = raw_input()
for x in sys.stdin.read().lower:
    i[ord(x)]+=1
for y in xrange(ord('a'), ord('z')+1):
    print chr(y)+ ' : ' +i[y]

Fixed submission:
import time
import sys
import io
import re
import math
#start = time.clock()
i = [0]*127
#n = raw_input()
for x in sys.stdin.read().lower():
    i[ord(x)]+=1
for y in range(ord('a'), ord('z')+1):
    print chr(y)+ ' : ' + str(i[y])

Buggy python submission (verdict: Runtime Error):
import sys
import io
import re
import math
#start = time.clock()
i = [0]*127
#n = raw_input()
for x in sys.stdin.read().lower:
    i[ord(x)]+=1
for y in range(ord('a'), ord('z')+1):
    print chr(y)+ ' : ' +i[y]

Fixed submission:
import time
import sys
import io
import re
import math
#start = time.clock()
i = [0]*127
#n = raw_input()
for x in sys.stdin.read().lower():
    i[ord(x)]+=1
for y in range(ord('a'), ord('z')+1):
    print chr(y)+ ' : ' + str(i[y])
Buggy python submission (verdict: Runtime Error):
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        int ans=0;
        string w;
        cin>>w;
        transform(w.begin(), w.end(), w.begin(), ::toupper);
        for(;;){
                string chk;
                cin>>chk;
                if(chk=="END_OF_TEXT")break;
                transform(chk.begin(), chk.end(), chk.begin(), ::toupper);
                if(chk==w)ans+=1;
        }
        cout<<ans<<endl;
        return 0;
}

Fixed submission:
ans=[]
W=raw_input()
while True:
    i = raw_input()
    if i == 'END_OF_TEXT': break
    ans+=[j.lower() for j in i.split()]
print ans.count(W)
Buggy python submission (verdict: Runtime Error):
while 1:
    w=raw_input()
    if w=='-': break
    n=int(raw_input())
    for i in xrange(n):
        l=int(raw_input())
        w=w[l:]+l[:l]
    print w

Fixed submission:
while 1:
    w=raw_input()
    if w=='-': break
    n=int(raw_input())
    for i in range(n):
        l=int(raw_input())
        w=w[l:]+w[:l]
    print w
Buggy python submission (verdict: Runtime Error):
n=input()
l=['print','replace','reverse']
for i in range(n):
    c=map(str,raw_input().split())
    if c[0]==l[0]:
        print w[int(c[1]):int(c[2])+1]
    elif c[0]==l[1]:
        w=w[:int(c[1])]+c[3]+w[int(c[2])+1:]
    else:
        w=w[int(c[1]):int(c[2])+1][::-1]+w[int(c[2])+1:]

Fixed submission:
w=raw_input()
n=input()
l=['print','replace','reverse']
for i in range(n):
    c=map(str,raw_input().split())
    if c[0]==l[0]:
        print w[int(c[1]):int(c[2])+1]
    elif c[0]==l[1]:
        w=w[:int(c[1])]+c[3]+w[int(c[2])+1:]
    else:
        w=w[0:int(c[1])]+w[int(c[1]):int(c[2])+1][::-1]+w[int(c[2])+1:]
Buggy python submission (verdict: Time Limit Exceeded):
(m,f,r)=map(int, raw_input().split())
while 1:
    if m==f==r==-1:
        break
    elif m+f>=80:
        print 'A'
    elif m+f>=65:
        print 'B'
    elif m+f>=50:
        print 'C'
    elif m+f>=30 and r>=50:
        print 'C'
    elif m+f>=30:
        print 'C'
    elif m+f<30:
        print 'F'

Fixed submission:
while 1:
    (m,f,r)=map(int, raw_input().split())
    if m==f==r==-1:
        break
    elif m == -1 or f == -1:
        print 'F'
    elif m+f>=80:
        print 'A'
    elif m+f>=65:
        print 'B'
    elif m+f>=50:
        print 'C'
    elif m+f>=30 and r>=50:
        print 'C'
    elif m+f>=30:
        print 'D'
    elif m+f<30:
        print 'F'
Buggy python submission (verdict: Runtime Error):
start = time.clock()
ans=[]
W=raw_input()
while 1:
    i = raw_input()
    if i == 'END_OF_TEXT': break
    ans+=[j.lower() for j in i.split()]
print ans.count(W)

Fixed submission:
ans=[]
W=raw_input()
while 1:
    i = raw_input()
    if i == 'END_OF_TEXT': break
    ans+=[j.lower() for j in i.split()]
print ans.count(W)
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
	a,b = b,a+b


print(a)

Fixed submission:
a,b = 1,1
n = int(input())
for i in range(n):
	a,b = b,a+b


print(a)
Buggy python submission (verdict: Runtime Error):
x = input()
print(x **3 )

Fixed submission:
x = int(input())

print(x ** 3)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
for i in range(0, n):
    a = long(raw_input());
    b = long(raw_input());
    if math.log10(a + b) > 80:
        print "overflow"
    else:
        print a + b;

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
over = 10 ** 80;
for i in range(0, n):
    a = int(raw_input());
    b = int(raw_input());
    if a + b >= over:
        print "overflow"
    else:
        print a + b;

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
for i in range(0, n):
    a = long(raw_input());
    b = long(raw_input());
    if math.log10(a + b) > 80:
        print "overflow"
    else:
        print a + b;

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
over = 10 ** 80;
for i in range(0, n):
    a = int(raw_input());
    b = int(raw_input());
    if a + b >= over:
        print "overflow"
    else:
        print a + b;

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
for i in range(0, n):
    a = long(raw_input());
    b = long(raw_input());
    if math.log10(a + b) > 80:
        print "overflow"
    else:
        print a + b;

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
over = 10 ** 80;
for i in range(0, n):
    a = int(raw_input());
    b = int(raw_input());
    if a + b >= over:
        print "overflow"
    else:
        print a + b;

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
for i in range(0, n):
    a = int(raw_input());
    b = int(raw_input());
    if math.log10(a + b) > 80:
        print "overflow"
    else:
        print a + b;

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
over = 10 ** 80;
for i in range(0, n):
    a = int(raw_input());
    b = int(raw_input());
    if a + b >= over:
        print "overflow"
    else:
        print a + b;
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class point:
    def __init__(self, x, y):
        self.x = x
        self.y = y

n = int(raw_input())
for i in range(n):
    xa, ya, xb, yb, xc, yc, xd, yd = map(float, raw_input().split(" "))
    a = point(xa, ya)
    b = point(xb, yb)
    c = point(xc, yc)
    d = point(xd, yd)
    if (a.y - b.y)/(a.x - b.x) - (c.y - d.y)/(c.x - d.x) < 1e-9:print "YES"
    else:print "NO"
    

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
n = int(raw_input())
for i in range(n):
    xa, ya, xb, yb, xc, yc, xd, yd = map(float, raw_input().split(" "))
    if abs((ya - yb)*(xc - xd) - (yc - yd)*(xa - xb)) < 1e-12:print "YES"
    else:print "NO"
Buggy python submission (verdict: Runtime Error):
#coding utf-8
x=input()
y=input()

print x*y
print 2*(y+x)

Fixed submission:
#coding utf-8
x,y = map(int, input().split())
print(x*y, 2*(x+y))

Buggy python submission (verdict: Runtime Error):
#coding utf-8
x,y = map(int, input().split())
print(x*y, 2*(x+y))

Fixed submission:
#coding utf-8
x,y = map(int, input().split())
print(x*y, 2*(x+y))
Buggy python submission (verdict: Runtime Error):
#coding utf-8
x=input()
y=input()
if x > y:
    print("a > b")
elif x==y:
        print("a == b")
else:
        print("a < b")

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
data = map(int, raw_input().split())
if data[0] < data[1]:
    print "a < b"
elif data[0] == data[1]:
    print "a == b"
else:
    print "a > b"

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
data = map(int, raw_input().split())
if data[0] < data[1]:
    print "a < b"
elif data[0] == data[1]:
    print "a == b"
elif:
    print "a > b"

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
data = map(int, raw_input().split())
if data[0] < data[1]:
    print "a < b"
elif data[0] == data[1]:
    print "a == b"
else:
    print "a > b"
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python
# -*- coding: utf-8 -*-


a,b = input()
print "%d %d"% (a*b, 2*(a+b))

Fixed submission:
a,b = map(int,raw_input().split())
print "%d %d"% (a*b, 2*(a+b))
Buggy python submission (verdict: Runtime Error):
x = raw_input()
print(x**3)

Fixed submission:
x = input()
print(x**3)
Buggy python submission (verdict: Runtime Error):
N = input()
input_data = [input() for i in range(N)]

num = 0
while input_data[num] > 0 :
	print("Case","{0}:".format(num+1),"{1}".format(input_data[num]))
	num+=1

Fixed submission:
input_data = []
while 1:
	n = int(input())
	if n == 0:
		break
	input_data.append(n)
n=0
for i in input_data:
	print("Case {}:".format(n+1),"{}".format(input_data[n]))
	n+=1

Buggy python submission (verdict: Runtime Error):
N = input()
input_data = [input() for i in range(N)]

num = 0
#while input_data[num] > 0 :
#	print("Case","{0}:".format(num+1),"{1}".format(input_data[num]))
#	num+=1

Fixed submission:
input_data = []
while 1:
	n = int(input())
	if n == 0:
		break
	input_data.append(n)
n=0
for i in input_data:
	print("Case {}:".format(n+1),"{}".format(input_data[n]))
	n+=1

Buggy python submission (verdict: Runtime Error):
N = input()
input_data = [input() for i in range(N)]

#num = 0
#while input_data[num] > 0 :
#	print("Case","{0}:".format(num+1),"{1}".format(input_data[num]))
#	num+=1

Fixed submission:
input_data = []
while 1:
	n = int(input())
	if n == 0:
		break
	input_data.append(n)
n=0
for i in input_data:
	print("Case {}:".format(n+1),"{}".format(input_data[n]))
	n+=1

Buggy python submission (verdict: Runtime Error):
N = input()
#input_data = [input() for i in range(N)]

#num = 0
#while input_data[num] > 0 :
#	print("Case","{0}:".format(num+1),"{1}".format(input_data[num]))
#	num+=1

Fixed submission:
input_data = []
while 1:
	n = int(input())
	if n == 0:
		break
	input_data.append(n)
n=0
for i in input_data:
	print("Case {}:".format(n+1),"{}".format(input_data[n]))
	n+=1

Buggy python submission (verdict: Runtime Error):
#N = input()
#input_data = [input() for i in range(N)]

#num = 0
#while input_data[num] > 0 :
#	print("Case","{0}:".format(num+1),"{1}".format(input_data[num]))
#	num+=1

Fixed submission:
input_data = []
while 1:
	n = int(input())
	if n == 0:
		break
	input_data.append(n)
n=0
for i in input_data:
	print("Case {}:".format(n+1),"{}".format(input_data[n]))
	n+=1
Buggy python submission (verdict: Runtime Error):
pi = 3.14159
r = int(input())
print(r*r*pi,2*r*pi)

Fixed submission:
pi = 3.14159265358979
r = float(input())
print("{0:.6f}".format(r*r*pi),"{0:.6f}".format(2*r*pi))
Buggy python submission (verdict: Runtime Error):
ans=[""]
ans.pop()
s=""
w=["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"]
x=[0]
x.pop()
def uni(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

def check(a):
	global s
	global w
	n=len(a)
	# print "before ",a
	for i in range(26):
		if i==0:
			continue
		a=a.replace(w[i],w[i-1],1);
	# print "after ",a
	if a==s[0:n]:
		return True
	else:
		return False

def foo(a,n):
	# print a
	global ans
	global x
	if n==len(a):
		if check(a):
			ans.append(a)
		return
	sz=len(a)
	t=a+s[sz]
	if check(t):
		foo(t,n)
	t=a+w[x[sz]+1]
	# print t
	if check(t):
		# print t
		foo(t,n)



while True:
	s = raw_input()
	if s=="#":
		break
	ans=[""]
	ans.pop()
	x=[0]
	x.pop()
	for i in range(len(s)):
		for j in range(26):
			if w[j]==s[i]:
				x.append(j)
	# print s
	foo("",len(s))
	ans=uni(ans)
	if len(ans)<=10:
		print len(ans)
		for i in range(len(ans)):
			print ans[i]
	else:
		print len(ans)
		for i in range(5):
			print ans[i]
		for i in range(5):
			print ans[len(ans)-1-i]

Fixed submission:
ans=[""]
ans.pop()
s=""
w=["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","}"]
x=[0]
x.pop()
def uni(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

def check(a):
	global s
	global w
	n=len(a)
	# print "before ",a
	for i in range(26):
		if i==0:
			continue
		a=a.replace(w[i],w[i-1],1);
	# print "after ",a
	if a==s[0:n]:
		return True
	else:
		return False

def foo(a,n):
	# print a
	global ans
	global x
	if n==len(a):
		if check(a):
			ans.append(a)
		return
	sz=len(a)
	t=a+s[sz]
	if check(t):
		foo(t,n)
	if w[x[sz]]=="z":
		return
	t=a+w[x[sz]+1]
	# print t
	if check(t):
		# print t
		foo(t,n)



while True:
	s = raw_input()
	if s=="#":
		break
	ans=[""]
	ans.pop()
	x=[0]
	x.pop()
	for i in range(len(s)):
		for j in range(26):
			if w[j]==s[i]:
				x.append(j)
	# print s
	foo("",len(s))
	# ans=uni(ans)
	ans.sort()
	if len(ans)<=10:
		print len(ans)
		for i in range(len(ans)):
			print ans[i]
	else:
		print len(ans)
		for i in range(5):
			print ans[i]
		for i in range(5):
			print ans[len(ans)-5+i]
Buggy python submission (verdict: Time Limit Exceeded):
while True:
	a,b,c,d,e = map(int,raw_input().split())
	if a==0:
		break
	na,nb,nc = map(int,raw_input().split())
	v=[0]*(na+nb+nc)
	for i in range(na):
		v[i]=a
	for i in range(nb):
		v[i+na]=b
	for i in range(nc):
		v[i+na+nb]=c
	t=na+nb+nc
	ans=na*a+nb*b+nc*c
	if t < d:
		if ans > d*e:
			ans=d*e
	else:
		tmp = 0
		for i in range(d):
			tmp += v[len(v)-1-i]
		if tmp >= d*e:
			for i in range(len(v)):
				if e < v[i]:
					v[i] = e
			for i in range(d):
				v[len(v)-1-i] = e
		ans=0
		for i in range(len(v)):
			ans += v[i]

	print ans

Fixed submission:
while True:
	a,b,c,d,e = map(int,raw_input().split())
	if a==0:
		break
	na,nb,nc = map(int,raw_input().split())
	t=na+nb+nc
	ans=na*a+nb*b+nc*c
	if t < d:
		if ans > d*e:
			ans=d*e
	else:
		tmp = 0
		dd=d
		cnt=0
		if dd>=nc:
			cnt+=nc*c
			dd-=nc
		else:
			cnt+=dd*c
			dd=0

		if dd>=nb:
			cnt+=nb*b
			dd-=nb
		else:
			cnt+=dd*b
			dd=0

		if dd>=na:
			cnt+=na*a
			dd-=na
		else:
			cnt+=dd*a
			dd=0
		
		if cnt >= d*e:
			if e<a:
				a=e
			if e<b:
				b=e
			if e<c:
				c=e
			dd=d
			cnt=0
			# print "cnt"
			if dd>=nc:
				cnt+=nc*e
				dd-=nc
			else:
				cnt+=dd*e
				cnt+=(nc-dd)*min(e,c)
				dd=0
			# print cnt
			if dd>=nb:
				cnt+=nb*e
				dd-=nb
			else:
				cnt+=dd*e
				cnt+=(nb-dd)*min(e,b)
				dd=0
# 70 100 340 4 200
# 1 1 2
			# print cnt
			if dd>=na:
				cnt+=na*e
				dd-=na
			else:
				cnt+=dd*e
				cnt+=(na-dd)*min(e,a)
				dd=0
			ans=cnt

	print ans
Buggy python submission (verdict: Runtime Error):
#coding:utf-8

import math

datas = [int(x) for x in input().split()]
p1 = (datas[0], datas[1])
p2 = (datas[2], datas[3])

print(math.sqrt(math.pow(p1[0]-p2[0], 2)+math.pow(p1[1]-p2[1],2)))

Fixed submission:
#coding:utf-8

import math

datas = [float(x) for x in input().split()]
p1 = (datas[0], datas[1])
p2 = (datas[2], datas[3])

print(math.sqrt(math.pow(p1[0]-p2[0], 2)+math.pow(p1[1]-p2[1],2)))
Buggy python submission (verdict: Runtime Error):
#coding:utf-8

data = sorted([int(i) for i in input().split()])
s=""
for x in data:
	s+=(str(x)+" ")
print(s)

Fixed submission:
#coding:utf-8

data = sorted([int(i) for i in input().split()])
s=""
for x in data:
	s+=(str(x)+" ")
print(s[0:len(s) - 1])
Buggy python submission (verdict: Runtime Error):


keyword = raw_input()
N = int(raw_input())

count = 0

for _ in xrange(N):
  s = raw_input()
  if keyword in (s+s):
    count += 1

print count

Fixed submission:


keyword = raw_input()
N = int(raw_input())

count = 0

for _ in xrange(N):
  s = raw_input()
  if keyword in (s+s):
    count += 1

print count
Buggy python submission (verdict: Runtime Error):
def cut(cake,s):
    ret_cake = [(0,0),(0,0)]
    w = cake[2]
    h = cake[1]
    s %= 2*(w+h)
    if w > s:
        ret_cake = [(h,s),(h,w-s)]
    elif w+h > s:
        ret_cake = [(s-w,w),(w+h-s,w)]
    elif 2*w+h > s:
        ret_cake = [(s-w-h,w),(2*w+h-s,w)]
    elif 2*w+2*h > s:
        ret_cake = [(s-2*w-h,w),(2*w+2*h-s,w)]

    return [ (c[0]*c[1],c[0],c[1]) for c in ret_cake]

while True:
    n,w,d = map(int,input().split())
    if n == 0  and w == 0 and d == 0:
        break
    p = [0] * n
    s = [0] * n
    for i in range(n):
        p[i],s[i] = map(int,input().split())
    cake = [ (w*d,d,w) ]

    for i in range(n):
        cake = cake[:p[i]-1] + cake[p[i]:] + cut(cake[p[i]-1],s[i])
    cake.sort()
    print( " ".join(map(str,[c[0] for c in cake])))

Fixed submission:
def cut(cake,s):
    ret_cake = [ (-1,-1),(-1,-1) ]
    w = cake[2]
    h = cake[1]

    s %= 2*(w+h)

    if w > s:
        ret_cake = [(h,s),(h,w-s)]
    elif w+h > s:
        ret_cake = [(s-w,w),(w+h-s,w)]
    elif 2*w+h > s:
        ret_cake = [(h,s-w-h),(h,2*w+h-s)]
    elif 2*w+2*h > s:
        ret_cake = [(s-2*w-h,w),(2*w+2*h-s,w)]

    ret_cake =  [ (c[0]*c[1],c[0],c[1]) for c in ret_cake]
    ret_cake.sort()
    return ret_cake

while True:
    n,w,d = map(int,input().split())
    if n == 0  and w == 0 and d == 0:
        break
    p = [0] * n
    s = [0] * n
    for i in range(n):
        p[i],s[i] = map(int,input().split())
    cake = [ (w*d,d,w) ]

    for i in range(n):
        cake = cake[:p[i]-1] + cake[p[i]:] + cut(cake[p[i]-1],s[i])
    cake.sort()
    print( " ".join(map(str,[c[0] for c in cake])))
Buggy python submission (verdict: Runtime Error):
while True:
    n=int(input())
    a=[]
    for i in range(n):
        a.append(int(input()))
    for i in range(1,n):
        a[i]=max(a[i-1]+a[i],a[i])

    print(max(a))

Fixed submission:
while True:
    n=int(input())
    if n==0:
        break
    a=[]
    for i in range(n):
        a.append(int(input()))
    for i in range(1,n):
        a[i]=max(a[i-1]+a[i],a[i])

    print(max(a))
Buggy python submission (verdict: Time Limit Exceeded):
import math

def is_prime(n):
  if n == 2:
    return True

  if n < 2 or n % 2 == 0:
    return False

  i = 3
  while i <= math.sqrt(n):
    if n % i == 0:
      return False
    i += 2

  return True

while True:
  try:
    n = int(raw_input())
  except EOFError:
    break

  count = 0
  for x in range(2, n + 1):
    if is_prime(x):
      count += 1
  print count

Fixed submission:
from bisect import bisect

def sieve(n):
  prime = [True] * n
  prime[0] = prime[1] = False
  for i in xrange(2, int(n ** 0.5) + 1):
    if prime[i]:
      for j in range(i ** 2, n, i):
        prime[j] = False
  return [i for i in xrange(2, n) if prime[i]]

primes = sieve(999999)
while True:
  try:
    print bisect(primes, input())
  except:
    break

Buggy python submission (verdict: Time Limit Exceeded):
import math

def is_prime(n):
  if n == 2:
    return True

  if n < 2 or n % 2 == 0:
    return False

  i = 3
  while i <= math.sqrt(n):
    if n % i == 0:
      return False
    i += 2

  return True

while True:
  try:
    n = int(raw_input())
  except EOFError:
    break

  count = 0
  for x in range(2, n + 1):
    if is_prime(x):
      count += 1
  print count

Fixed submission:
from bisect import bisect

def sieve(n):
  prime = [True] * n
  prime[0] = prime[1] = False
  for i in xrange(2, int(n ** 0.5) + 1):
    if prime[i]:
      for j in range(i ** 2, n, i):
        prime[j] = False
  return [i for i in xrange(2, n) if prime[i]]

primes = sieve(999999)
while True:
  try:
    print bisect(primes, input())
  except:
    break
Buggy python submission (verdict: Runtime Error):
rail = []
while True:
  n = int(raw_input())
  if n != 0:
    rail.append(n)
  else:
    print rail.pop()

Fixed submission:
try:
  rail = []
  while True:
    n = int(raw_input())
    if n != 0:
      rail.append(n)
    else:
      print rail.pop()
except:
  pass
Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
for i in range(n):
	x, y, z = map(int, raw_input())
	if y*z >= 1000000:
		print x
	else:
		print "NA"

Fixed submission:
while True:
	n = int(raw_input())
	if n == 0:
		break
	data = {}
	order = []
	for i in range(n):
		id,price,quant = map(int, raw_input().split())
		if id in data:
			data[id] += price*quant
		else:
			data[id] = price*quant 
			order.append(id)
	if max(data.values()) <  1000000:
		print "NA"
	else:
		for k in order:
			if data[k] >=  1000000:
				print k

Buggy python submission (verdict: Runtime Error):
while 1:
	n = int(raw_input())
	if n == 0:
		break
	for i in range(n):
		x, y, z = map(int, raw_input())
		if y*z >= 1000000:
			print x
		else:
			print "NA"

Fixed submission:
while True:
	n = int(raw_input())
	if n == 0:
		break
	data = {}
	order = []
	for i in range(n):
		id,price,quant = map(int, raw_input().split())
		if id in data:
			data[id] += price*quant
		else:
			data[id] = price*quant 
			order.append(id)
	if max(data.values()) <  1000000:
		print "NA"
	else:
		for k in order:
			if data[k] >=  1000000:
				print k

Buggy python submission (verdict: Runtime Error):
1001 2000 520
1002 1800 450
1003 1600 625
1001 200 1220

Fixed submission:
while True:
	n = int(raw_input())
	if n == 0:
		break
	data = {}
	order = []
	for i in range(n):
		id,price,quant = map(int, raw_input().split())
		if id in data:
			data[id] += price*quant
		else:
			data[id] = price*quant 
			order.append(id)
	if max(data.values()) <  1000000:
		print "NA"
	else:
		for k in order:
			if data[k] >=  1000000:
				print k
Buggy python submission (verdict: Runtime Error):
while True:
	n = int(raw_input())
	for i in [raw_input().replace("Hoshino", "Hoshina") for i in range(n)]:
		print i
	 

Fixed submission:
n = int(raw_input())
for i in [raw_input().replace("Hoshino", "Hoshina") for i in range(n)]:
	print i

Buggy python submission (verdict: Runtime Error):
while True:
	n = int(raw_input())
	if n == 0:
		break
	for i in [raw_input().replace("Hoshino", "Hoshina") for i in range(n)]:
		print i
	 

Fixed submission:
n = int(raw_input())
for i in [raw_input().replace("Hoshino", "Hoshina") for i in range(n)]:
	print i

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
if n == 0:
	break
for i in [raw_input().replace("Hoshino", "Hoshina") for i in range(n)]:
	print i
	 

Fixed submission:
n = int(raw_input())
for i in [raw_input().replace("Hoshino", "Hoshina") for i in range(n)]:
	print i
Buggy python submission (verdict: Runtime Error):
while True:
	n = input()
	x = []
	y = [0 for i in range(n+1)]
	for i in range(n):
		a = map(int, raw_input().split())
		a.append(sum(a))
		x.append(a)
		for j in range(n+1):
			y[j] += a[j]
	x.append(y)
	for a in x:
		print "".join([str(e).rjust(5) for e in a])

Fixed submission:
while True:
	n = int(raw_input())
	if n == 0:
		break
	a = [map(int, raw_input().split()) for i in xrange(n)]
	a = [l + [sum(l)] for l in a]
	a.append([sum([l[i] for l in a]) for i in xrange(len(a[0]))])
	print "\n".join(["".join([str(i).rjust(5) for i in l]) for l in a])