Buggy python submission (verdict: Time Limit Exceeded):
import sys
for line in sys.stdin:
    n=int(line)
    plist = [1 for i in xrange(n+1)]
    plist[0]=0
    plist[1]=0
    for x in xrange(n):
        if plist[x] == 1:
            i=2
            while x*i < len(plist):
                plist[x*i] = 0
                i+=1
    print plist.count(1)

Fixed submission:
#! -*- coding:utf-8 -*-
import sys
# import time
for line in sys.stdin:
  n=int(line)
  # n=input()
  # start = time.time()
  #plist = [1 for i in xrange(n+1)]
  #??¨??¨1???????????????
  #1?????¨???????????????????´???°??¨??????
  plist = [1]*(n+1)
  #0??¨1????´???°?????????????????§0???????????????
  plist[0]=plist[1]=0
  i=2
  #??¶??°????????????????????????
  while True:
      pos0 = 2*i
      if pos0 < len(plist):
          plist[pos0] = 0
      else:
          break
      i+=1
  #???????????¨????????????????????????
  for x in xrange(3,int(n**0.5)+1):
    if plist[x]:
      for pos0 in xrange(x**2,n+1,x):
        plist[pos0] = 0
  # elapsed_time = time.time()-start
  # print elapsed_time
  print plist.count(1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
for line in sys.stdin:
    n=int(line)
    ans=0
    plist = [1 for i in xrange(n+1)]
    plist[0]=0
    plist[1]=0
    for x in xrange(len(plist)):
        if plist[x] == 1:
            ans+=1
            i=2
            while x*i < len(plist):
                plist[x*i] = 0
                i+=1
    print ans

Fixed submission:
#! -*- coding:utf-8 -*-
import sys
# import time
for line in sys.stdin:
  n=int(line)
  # n=input()
  # start = time.time()
  #plist = [1 for i in xrange(n+1)]
  #??¨??¨1???????????????
  #1?????¨???????????????????´???°??¨??????
  plist = [1]*(n+1)
  #0??¨1????´???°?????????????????§0???????????????
  plist[0]=plist[1]=0
  i=2
  #??¶??°????????????????????????
  while True:
      pos0 = 2*i
      if pos0 < len(plist):
          plist[pos0] = 0
      else:
          break
      i+=1
  #???????????¨????????????????????????
  for x in xrange(3,int(n**0.5)+1):
    if plist[x]:
      for pos0 in xrange(x**2,n+1,x):
        plist[pos0] = 0
  # elapsed_time = time.time()-start
  # print elapsed_time
  print plist.count(1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
for line in sys.stdin:
    n=int(line)
    ans=0
    plist = [1 for i in xrange(n+1)]
    plist[0]=0
    plist[1]=0
    for x in xrange(len(plist)):
        if plist[x] == 1:
            ans+=1
            i=2
            while True:
                pos0 = x*i
                if pos0 < len(plist):
                    plist[pos0] = 0
                else:
                    break
                i+=1
    print ans

Fixed submission:
#! -*- coding:utf-8 -*-
import sys
# import time
for line in sys.stdin:
  n=int(line)
  # n=input()
  # start = time.time()
  #plist = [1 for i in xrange(n+1)]
  #??¨??¨1???????????????
  #1?????¨???????????????????´???°??¨??????
  plist = [1]*(n+1)
  #0??¨1????´???°?????????????????§0???????????????
  plist[0]=plist[1]=0
  i=2
  #??¶??°????????????????????????
  while True:
      pos0 = 2*i
      if pos0 < len(plist):
          plist[pos0] = 0
      else:
          break
      i+=1
  #???????????¨????????????????????????
  for x in xrange(3,int(n**0.5)+1):
    if plist[x]:
      for pos0 in xrange(x**2,n+1,x):
        plist[pos0] = 0
  # elapsed_time = time.time()-start
  # print elapsed_time
  print plist.count(1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
for line in sys.stdin:
    n=int(line)
    plist = [1 for i in xrange(n+1)]
    plist[0]=0
    plist[1]=0
    for x in xrange(int(n**0.5)+1):
        if plist[x] == 1:
            i=2
            while True:
                pos0 = x*i
                if pos0 < len(plist):
                    plist[pos0] = 0
                else:
                    break
                i+=1
    print plist.count(1)

Fixed submission:
#! -*- coding:utf-8 -*-
import sys
# import time
for line in sys.stdin:
  n=int(line)
  # n=input()
  # start = time.time()
  #plist = [1 for i in xrange(n+1)]
  #??¨??¨1???????????????
  #1?????¨???????????????????´???°??¨??????
  plist = [1]*(n+1)
  #0??¨1????´???°?????????????????§0???????????????
  plist[0]=plist[1]=0
  i=2
  #??¶??°????????????????????????
  while True:
      pos0 = 2*i
      if pos0 < len(plist):
          plist[pos0] = 0
      else:
          break
      i+=1
  #???????????¨????????????????????????
  for x in xrange(3,int(n**0.5)+1):
    if plist[x]:
      for pos0 in xrange(x**2,n+1,x):
        plist[pos0] = 0
  # elapsed_time = time.time()-start
  # print elapsed_time
  print plist.count(1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
for line in sys.stdin:
    n=int(line)
    plist = [1 for i in xrange(n+1)]
    plist[0]=0
    plist[1]=0
    i=2
    while True:
        pos0 = 2*i
        if pos0 < len(plist):
            plist[pos0] = 0
        else:
            break
        i+=1
    if n>7:
        for x in xrange(3,int(n**0.5)+1):
            if plist[x] == 1:
                i=3
                while True:
                    pos0 = x*i
                    if pos0 < len(plist):
                        plist[pos0] = 0
                    else:
                        break
                    i+=2
    print plist.count(1)

Fixed submission:
#! -*- coding:utf-8 -*-
import sys
# import time
for line in sys.stdin:
  n=int(line)
  # n=input()
  # start = time.time()
  #plist = [1 for i in xrange(n+1)]
  #??¨??¨1???????????????
  #1?????¨???????????????????´???°??¨??????
  plist = [1]*(n+1)
  #0??¨1????´???°?????????????????§0???????????????
  plist[0]=plist[1]=0
  i=2
  #??¶??°????????????????????????
  while True:
      pos0 = 2*i
      if pos0 < len(plist):
          plist[pos0] = 0
      else:
          break
      i+=1
  #???????????¨????????????????????????
  for x in xrange(3,int(n**0.5)+1):
    if plist[x]:
      for pos0 in xrange(x**2,n+1,x):
        plist[pos0] = 0
  # elapsed_time = time.time()-start
  # print elapsed_time
  print plist.count(1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
for line in sys.stdin:
    n=int(line)
    plist = [1 for i in xrange(n+1)]
    plist[0]=0
    plist[1]=0
    i=2
    while True:
        pos0 = 2*i
        if pos0 < len(plist):
            plist[pos0] = 0
        else:
            break
        i+=1
    if n>7:
        for x in xrange(3,int(n**0.5)+1):
            if plist[x] == 1:
                i=3
                while True:
                    pos0 = x*i
                    if pos0 < len(plist):
                        plist[pos0] = 0
                    else:
                        break
                    i+=2
    print plist.count(1)

Fixed submission:
#! -*- coding:utf-8 -*-
import sys
# import time
for line in sys.stdin:
  n=int(line)
  # n=input()
  # start = time.time()
  #plist = [1 for i in xrange(n+1)]
  #??¨??¨1???????????????
  #1?????¨???????????????????´???°??¨??????
  plist = [1]*(n+1)
  #0??¨1????´???°?????????????????§0???????????????
  plist[0]=plist[1]=0
  i=2
  #??¶??°????????????????????????
  while True:
      pos0 = 2*i
      if pos0 < len(plist):
          plist[pos0] = 0
      else:
          break
      i+=1
  #???????????¨????????????????????????
  for x in xrange(3,int(n**0.5)+1):
    if plist[x]:
      for pos0 in xrange(x**2,n+1,x):
        plist[pos0] = 0
  # elapsed_time = time.time()-start
  # print elapsed_time
  print plist.count(1)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python
# import time
import sys
def sieve(n):
    num = [1]*n
    num[0] = num[1] = 0
    for i in xrange(2,int(n**0.5)+1):
        if num[i]:
            for j in xrange(i**2, n, i):
                num[j] = 0
    return num.count(1)

# start = time.time()
for line in sys.stdin:
    hoge = sieve(int(line))
    print hoge
# elapsed_time = time.time()-start
# print elapsed_time
# print hoge

Fixed submission:
#! -*- coding:utf-8 -*-
import sys
# import time
for line in sys.stdin:
  n=int(line)
  # n=input()
  # start = time.time()
  #plist = [1 for i in xrange(n+1)]
  #??¨??¨1???????????????
  #1?????¨???????????????????´???°??¨??????
  plist = [1]*(n+1)
  #0??¨1????´???°?????????????????§0???????????????
  plist[0]=plist[1]=0
  i=2
  #??¶??°????????????????????????
  while True:
      pos0 = 2*i
      if pos0 < len(plist):
          plist[pos0] = 0
      else:
          break
      i+=1
  #???????????¨????????????????????????
  for x in xrange(3,int(n**0.5)+1):
    if plist[x]:
      for pos0 in xrange(x**2,n+1,x):
        plist[pos0] = 0
  # elapsed_time = time.time()-start
  # print elapsed_time
  print plist.count(1)