Buggy python submission (verdict: Time Limit Exceeded):
count = 1
while True:
    try:
        n = int(raw_input())
        for i in range(3, n+1):
            #print i
            for j in range(2, i):
                if i == j+1:
                    count += 1
                    #print i
                    #print 111
                    break
                elif i % j ==0:
                    #print 222
                    break
                else:
                    #print 333
                    continue
            #count += 1
            #print 99999999
    except:
        break

print count

Fixed submission:
n=1000000
pr = [1] * n
pr[0],pr[1]=0,0
for i in range(2, int(n**0.5)+1):
    if pr[i] == 1:
        for j in range(i ** 2, n , i):
                pr[j] =0
for k in range(3, n):
    pr[k] += pr[k-1]
while True:
    try:
        m = int(raw_input())
        print pr[m]
    except:
        break

Buggy python submission (verdict: Time Limit Exceeded):
while True:
    try:
        n = int(raw_input())
        count = 1
        for i in range(3, n+1):
            #print i
            for j in range(2, i):
                if i == j+1:
                    count += 1
                    #print i
                    #print 111
                    break
                elif i % j ==0:
                    #print 222
                    break
                else:
                    #print 333
                    continue
            #count += 1
            #print 99999999
        print count
    except:
        break

Fixed submission:
n=1000000
pr = [1] * n
pr[0],pr[1]=0,0
for i in range(2, int(n**0.5)+1):
    if pr[i] == 1:
        for j in range(i ** 2, n , i):
                pr[j] =0
for k in range(3, n):
    pr[k] += pr[k-1]
while True:
    try:
        m = int(raw_input())
        print pr[m]
    except:
        break

Buggy python submission (verdict: Time Limit Exceeded):
while True:
    try:
        n = int(raw_input())
        count = 1
        for i in range(3, n+1):
            #print i
            for j in range(2, i):
                if i == j+1:
                    count += 1
                    #print i
                    #print 111
                    break
                elif i % j ==0:
                    #print 222
                    break
                else:
                    #print 333
                    continue
            #count += 1
            #print 99999999
        print count
    except:
        break

Fixed submission:
n=1000000
pr = [1] * n
pr[0],pr[1]=0,0
for i in range(2, int(n**0.5)+1):
    if pr[i] == 1:
        for j in range(i ** 2, n , i):
                pr[j] =0
for k in range(3, n):
    pr[k] += pr[k-1]
while True:
    try:
        m = int(raw_input())
        print pr[m]
    except:
        break

Buggy python submission (verdict: Time Limit Exceeded):
while True:
    try:
        n = int(raw_input())
        count = 1
        for i in range(3, n+1):
            #print i
            for j in range(2, i):
                if i == j+1:
                    count += 1
                    #print i
                    #print 111
                    break
                elif i % j ==0:
                    #print 222
                    break
                else:
                    #print 333
                    continue
            #count += 1
            #print 99999999
        print count
    except:
        break

Fixed submission:
n=1000000
pr = [1] * n
pr[0],pr[1]=0,0
for i in range(2, int(n**0.5)+1):
    if pr[i] == 1:
        for j in range(i ** 2, n , i):
                pr[j] =0
for k in range(3, n):
    pr[k] += pr[k-1]
while True:
    try:
        m = int(raw_input())
        print pr[m]
    except:
        break