Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

S1 = raw_input()
S2 = raw_input()

m = {}

for i in range(len(S1)):
    val = 0
    for j in range(i, len(S1)):
        val += 10000 ** (ord(S1[j]) - ord('a'))
        m[val] = j - i + 1

ans = 0

for i in range(len(S2)):
    val = 0
    for j in range(i, len(S2)):
        val += 10000 ** (ord(S2[j]) - ord('a'))
        #t = hash(val)
        if val in m:
            ans = max(ans, m[val])

print ans


Fixed submission:
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

S1 = raw_input()
S2 = raw_input()

m = {}

for i in range(len(S1)):
    lst = [0 for j in range(26)]
    for j in range(i, len(S1)):
        lst[(ord(S1[j]) - ord('a'))] += 1
        m[hash(tuple(lst))] = j - i + 1

ans = 0

for i in range(len(S2)):
    lst = [0 for j in range(26)]
    for j in range(i, len(S2)):
        lst[(ord(S2[j]) - ord('a'))] += 1
        t = hash(tuple(lst))
        if t in m:
            ans = max(ans, m[t])

print ans

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

S1 = raw_input()
S2 = raw_input()

m = {}

for i in range(len(S1)):
    val = 0
    for j in range(i, len(S1)):
        val += 10000 ** (ord(S1[j]) - ord('a'))
        m[hash(val)] = j - i + 1

ans = 0

for i in range(len(S2)):
    val = 0
    for j in range(i, len(S2)):
        val += 10000 ** (ord(S2[j]) - ord('a'))
        t = hash(val)
        if t in m:
            ans = max(ans, m[t])

print ans


Fixed submission:
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

S1 = raw_input()
S2 = raw_input()

m = {}

for i in range(len(S1)):
    lst = [0 for j in range(26)]
    for j in range(i, len(S1)):
        lst[(ord(S1[j]) - ord('a'))] += 1
        m[hash(tuple(lst))] = j - i + 1

ans = 0

for i in range(len(S2)):
    lst = [0 for j in range(26)]
    for j in range(i, len(S2)):
        lst[(ord(S2[j]) - ord('a'))] += 1
        t = hash(tuple(lst))
        if t in m:
            ans = max(ans, m[t])

print ans
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

while True:
    n = input()
    lst = []
    if n == 0:
        break
    if n == 1:
        num = input()
        print num
        continue
    for loop in range(n):
        S = raw_input()
        lst.append((len(S), S[-1]))
    n += 1
    
    c_lst = [0 for i in range(1000)]
    v_lst = [0 for i in range(1000)]

    rank = 1
    for i in range(n):
        r = lst[i][0]
        c = lst[i][1]
        while r < rank:
            if c_lst[rank - 1] == '+':
                v_lst[rank - 1] += v_lst[rank]
            else:
                v_lst[rank - 1] *= v_lst[rank]
            rank -= 1
        if c == '+':
            r += 1
            c_lst[r] = '+'
            v_lst[r] = 0
            rank += 1
            continue
        elif c == '*':
            r += 1
            c_lst[r] = '*'
            v_lst[r] = 1
            rank += 1
            continue
        if c_lst[r] == '+':
            v_lst[r] += int(c)
        else:
            v_lst[r] *= int(c)
    print v_lst[2]
    


Fixed submission:
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

while True:
    n = input()
    lst = []
    if n == 0:
        break
    if n == 1:
        num = input()
        print num
        continue
    for loop in range(n):
        S = raw_input()
        lst.append((len(S), S[-1]))
    if lst[0][1] == '+':
        lst.append((0, '0'))
    else:
        lst.append((0, '1'))
    n += 1
    
    c_lst = [0 for i in range(1000)]
    v_lst = [0 for i in range(1000)]

    rank = 1
    for i in range(n):
        r = lst[i][0]
        c = lst[i][1]
        while r < rank:
            if c_lst[rank - 1] == '+':
                v_lst[rank - 1] += v_lst[rank]
            else:
                v_lst[rank - 1] *= v_lst[rank]
            rank -= 1
        if c == '+':
            r += 1
            c_lst[r] = '+'
            v_lst[r] = 0
            rank += 1
            continue
        elif c == '*':
            r += 1
            c_lst[r] = '*'
            v_lst[r] = 1
            rank += 1
            continue
        if c_lst[r] == '+':
            v_lst[r] += int(c)
        else:
            v_lst[r] *= int(c)
    print v_lst[2]
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

while True:
    S = reversed(raw_input())
    if S == '0':
        break
    m = [1] + [0 for i in range(10)]
    diff = ans = 0
    even = 1
    for c in S:
        num = int(c)
        diff += num * even
        diff %= 11
        if num != 0:
            ans += m[diff]
        m[diff] += 1
        even *= -1
    print ans


Fixed submission:
while True:
    S = raw_input()[::-1]
    if S == '0' : break
    m = [1] + [0] * 10
    diff = ans = 0
    even = 1
    for c in S:
        num = int(c)
        diff = (diff + num * even) % 11
        if num : ans += m[diff]
        m[diff] += 1
        even *= -1
    print ans

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

def fact(num):
    if num <= 1:
        return 1
    return fact(num - 1) + 1

print fact(200000)


Fixed submission:
while True:
    S = raw_input()[::-1]
    if S == '0' : break
    m = [1] + [0] * 10
    diff = ans = 0
    even = 1
    for c in S:
        num = int(c)
        diff = (diff + num * even) % 11
        if num : ans += m[diff]
        m[diff] += 1
        even *= -1
    print ans
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

N, M, L = map(int, raw_input().split())

def fact(n):
    if n <= 1:
        return 1
    return fact(n - 1) * n
MC = []
for i in range(M + 1):
    MC.append(fact(M) / fact(i) / fact(M - i))

p_lst = []
P_val = []
P_sum = []

for i in range(N):
    P, T, V = map(int, raw_input().split())
    p_lst.append((T, V))
    PP = []
    for k in range(M + 1):
        PP.append(MC[k] * (P ** k) * ((100 - P) ** (M - k)))
    P_val.append(list(PP))
    for k in range(M, 0, -1):
        PP[k - 1] += PP[k]
    P_sum.append(PP)

def comp(p1, p2, k1, k2):
    T1, V1 = p1
    T2, V2 = p2
    return L * (V2 - V1) < V1 * V2 * (k2 * T2 - k1 * T1)

for i in range(N):
    ans = 0
    index_lst = [0 for j in range(N)]
    for k1 in range(M + 1):
        ret = P_val[i][k1]
        for j in range(N):
            if i == j:
                continue
            flag = True
            while True:
                k2 = index_lst[j]
                if k2 > M:
                    ret *= 0
                    break
                if comp(p_lst[i], p_lst[j], k1, k2):
                    ret *= P_sum[j][k2]
                    break
                index_lst[j] += 1
        ans += ret
    ans = float(ans) / 100 ** (N * M)
    print ans



Fixed submission:
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

N, M, L = map(int, raw_input().split())

def fact(n):
    if n <= 1:
        return 1
    return fact(n - 1) * n
MC = []
for i in range(M + 1):
    MC.append(fact(M) / fact(i) / fact(M - i))

p_lst = []
P_val = []
P_sum = []

for i in range(N):
    P, T, V = map(int, raw_input().split())
    p_lst.append((T, V))
    PP = []
    for k in range(M + 1):
        PP.append(float(MC[k] * (P ** k) * ((100 - P) ** (M - k))) / 100 ** M)
    P_val.append(list(PP))
    for k in range(M, 0, -1):
        PP[k - 1] += PP[k]
    P_sum.append(PP)

def comp(p1, p2, k1, k2):
    T1, V1 = p1
    T2, V2 = p2
    return L * (V2 - V1) < V1 * V2 * (k2 * T2 - k1 * T1)

for i in range(N):
    ans = 0
    index_lst = [0 for j in range(N)]
    for k1 in range(M + 1):
        ret = P_val[i][k1]
        for j in range(N):
            if i == j:
                continue
            while True:
                k2 = index_lst[j]
                if k2 > M:
                    ret *= 0
                    break
                if comp(p_lst[i], p_lst[j], k1, k2):
                    ret *= P_sum[j][k2]
                    break
                index_lst[j] += 1
        ans += ret
    print '%.10f' % ans
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

S = raw_input()

def func(lst):
    if type(lst) == type(0):
        return True
    if len(lst) > 2:
        return False
    ret = True
    for l in lst:
        ret = (ret or func(l))
    return ret

S = S.replace('mew', '[1]')
S = S.replace('me', 'm[1]e')
S = S.replace('m', '[')
S = S.replace('e', ',')
S = S.replace('w', ']')

try:
    exec('piyo = ' + S)
except:
    print 'Rabbit'
    exit()
if func(piyo):
    print 'Cat'
else:
    print 'Rabbit'



Fixed submission:
#!/usr/bin/env python

S = raw_input()

S = S.replace('mew', '[1]')
S = S.replace('me', 'm[1]e')
S = S.replace('ew', 'e[1]w')
S = S.replace('m', '[')
S = S.replace('e', ',')
S = S.replace('w', ']')

for i in range(500):
    S = S.replace('[[1],[1]]', '[1]')

if S == '[1]' or S == '':
    print 'Cat'
else:
    print 'Rabbit'
Buggy python submission (verdict: Runtime Error):
n, m = map(int, raw_input())
c = map(int, raw_input())
print 0


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import itertools as ite
import math
import random
import sys
import codecs
from collections import defaultdict

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

n, m = map(int, input().split())
c = list(map(int, input().split()))
DP = [0] + [n] * n
for i in range(m):
    for j in range(c[i], n + 1):
        DP[j] = min(DP[j], DP[j - c[i]] + 1)
print(DP[n])

Buggy python submission (verdict: Runtime Error):
n, m = map(int, raw_input().split())
c = map(int, raw_input()_split())
print 0


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import itertools as ite
import math
import random
import sys
import codecs
from collections import defaultdict

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

n, m = map(int, input().split())
c = list(map(int, input().split()))
DP = [0] + [n] * n
for i in range(m):
    for j in range(c[i], n + 1):
        DP[j] = min(DP[j], DP[j - c[i]] + 1)
print(DP[n])

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
DP = {}

def func(num, yen):
	if num < 0 or yen < 0:
		return 10 ** 18
	if num == 0 and yen == 0:
		return 0
	if not (num, yen) in DP:
		DP[(num, yen)] = min(func(num - 1, yen), func(num, yen - c[num]) + 1)
	return DP[(num, yen)]

print(func(m - 1, n))



Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import itertools as ite
import math
import random
import sys
import codecs
from collections import defaultdict

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

n, m = map(int, input().split())
c = list(map(int, input().split()))
DP = [0] + [n] * n
for i in range(m):
    for j in range(c[i], n + 1):
        DP[j] = min(DP[j], DP[j - c[i]] + 1)
print(DP[n])

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import sys
sys.setrecursionlimit(100000000)

n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
DP = {}

# num 番目までのコインを使い、yen 円支払うときに必要な枚数
def func(num, yen):
	if num < 0 or yen < 0:
		return 10 ** 18
	if num == 0 and yen == 0:
		return 0
	'''
	if not (num, yen) in DP:
		DP[(num, yen)] = min(func(num - 1, yen), func(num, yen - c[num]) + 1)
	return DP[(num, yen)]
	'''
	return min(func(num - 1, yen), func(num, yen - c[num]) + 1)

print(func(m - 1, n))



Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import itertools as ite
import math
import random
import sys
import codecs
from collections import defaultdict

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

n, m = map(int, input().split())
c = list(map(int, input().split()))
DP = [0] + [n] * n
for i in range(m):
    for j in range(c[i], n + 1):
        DP[j] = min(DP[j], DP[j - c[i]] + 1)
print(DP[n])
Buggy python submission (verdict: Runtime Error):
 a, b = map(int, raw_input().split())
print a * b


Fixed submission:
a, b = map(int, raw_input().split())
print a * b, 2 * (a + b)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if a > b:
  print "a > b"
else if a < b:
  print "a < b"
else:
  print "a == b"

Fixed submission:
a,b=map(int,raw_input().split());print"a "+[["==","<"][a<b],">"][a>b]+" b"
Buggy python submission (verdict: Runtime Error):
hoge = list(map(int, input().split()))
ret = sorted(hoge)
print(str(ret[0]+" "+str(ret[1])+" "+str(ret[2]))


Fixed submission:
l = map(int, raw_input().split())
l.sort()
print l[0], l[1], l[2]

Buggy python submission (verdict: Runtime Error):
hoge = list(map(int, input().split()))
ret = sorted(hoge)
print(str(ret[0]+" "+str(ret[1])+" "+str(ret[2]))


Fixed submission:
l = map(int, raw_input().split())
l.sort()
print l[0], l[1], l[2]
Buggy python submission (verdict: Runtime Error):
 while(True):
    poyo = map(int, raw_input().split())
    if poyo[0] == 0 and poyo[1] == 0:
            break
    poyo.sort()
    print poyo[0], poyo[1]

Fixed submission:
while(True):
  poyo = map(int, raw_input().split())
  if poyo[0] == 0 and poyo[1] == 0:
    break
  poyo.sort()
  print poyo[0], poyo[1]
Buggy python submission (verdict: Runtime Error):
num=int(raw_input())
num=num*num*num
print(num)

Fixed submission:
k=input()
s=int(k)
print(s*s*s)

Buggy python submission (verdict: Runtime Error):
num=int(input())
num***=num
print(num)

Fixed submission:
k=input()
s=int(k)
print(s*s*s)
Buggy python submission (verdict: Runtime Error):
while 1:
    k=input()split()
    k[0]=int(k[0])
    k[2]=int(k[2])
    
    if k[1]=="?":
        break:
    elif k[1]=="+":
        print(k[0]+k[2])
    elif k[1]=="-":
        print(k[0]-k[2])
    elif k[1]=="*":
        print(k[0]*k[2])
    elif k[1]=="/":
        print(k[0]/k[2])



Fixed submission:
while 1:
    k=input().split()
    k[0]=int(k[0])
    k[2]=int(k[2])
    
    if k[1]=="?":
        break
    elif k[1]=="+":
        print(k[0]+k[2])
    elif k[1]=="-":
        print(k[0]-k[2])
    elif k[1]=="*":
        print(k[0]*k[2])
    elif k[1]=="/":
        print(k[0]//k[2])
Buggy python submission (verdict: Runtime Error):
while 1:
    k=input().split()
    a=int(k[0])
    b=int(k[1])
    c=int(k[2])
    if a==-1 and (b==-1 and c==-1):
        break
    if a<0 or b<0:
        ptint("F")
    elif a+b<30:
        print("F")
    elif a+b<50:
        if c>=50:
            print("C")
        else:
            print("D")
    elif a+b<65:
        print("C")
    elif a+b<80:
        print("B")
    else:
        print("A")



Fixed submission:
while 1:
    k=input().split()
    a=int(k[0])
    b=int(k[1])
    c=int(k[2])
    if a==-1 and (b==-1 and c==-1):
        break
    if a<0 or b<0:
        print("F")
    elif a+b<30:
        print("F")
    elif a+b<50:
        if c>=50:
            print("C")
        else:
            print("D")
    elif a+b<65:
        print("C")
    elif a+b<80:
        print("B")
    else:
        print("A")
Buggy python submission (verdict: Time Limit Exceeded):
while 1:
    k=input().split()
    n=int(k[0])
    x=int(k[1])
    if n==0 and x==0 :
        break
    m=0
    for i1 in range(1,n+1):
        for i2 in  range(1,n+1):
            for i3 in  range(1,n+1):
                if (i1!=i2 and i2!=i3) and (i3!=i1 and x==i1+i2+i3):
                    m+=1
    print(m//6)


Fixed submission:
while 1:
    k=input().split()
    n=int(k[0])
    x=int(k[1])
    if n==0 and x==0 :
        break
    m=0
    for i1 in range(1,n-1):
        for i2 in  range(i1+1,n):
            for i3 in  range(i2+1,n+1):
                if (i1!=i2 and i2!=i3) and (i3!=i1 and x==i1+i2+i3):
                    m+=1
    print(m)
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

v = [0] * N
w = [0] * N

for i in range(N):
    v[i], w[i] = map(int, input().split())

def rec(i, j):
    if i == N:
        res = 0
    elif j < w[i]:
        res = rec(i + 1, j)
    else:
        res = max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i])
    return res

print(rec(0, W))

Fixed submission:
N, W = map(int, input().split())

v = [0] * N
w = [0] * N
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

for i in range(N):
    v[i], w[i] = map(int, input().split())

for i in range(N - 1, -1, -1):
    for j in range(W + 1):
        if j < w[i]:
            dp[i][j] = dp[i + 1][j]
        else:
            dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i])

print(dp[0][W])

Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

v = [0] * N
w = [0] * N
dp = [[-1 for i in range(W + 1)] for j in range(N + 1)]

for i in range(N):
    v[i], w[i] = map(int, input().split())

def rec(i, j):
    if dp[i][j] != -1:
        return dp[i][j]

    if i == N:
        res = 0
    elif j < w[i]:
        res = rec(i + 1, j)
    else:
        res = max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i])
    return res

print(rec(0, W))

Fixed submission:
N, W = map(int, input().split())

v = [0] * N
w = [0] * N
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

for i in range(N):
    v[i], w[i] = map(int, input().split())

for i in range(N - 1, -1, -1):
    for j in range(W + 1):
        if j < w[i]:
            dp[i][j] = dp[i + 1][j]
        else:
            dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i])

print(dp[0][W])

Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

v = [0] * N
w = [0] * N
dp = [[-1 for i in range(W + 1)] for j in range(N + 1)]

for i in range(N):
    v[i], w[i] = map(int, input().split())

def rec(i, j):
    if dp[i][j] != -1:
        return dp[i][j]

    if i == N:
        res = 0
    elif j < w[i]:
        res = rec(i + 1, j)
    else:
        res = max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i])
    return res

print(rec(0, W))

Fixed submission:
N, W = map(int, input().split())

v = [0] * N
w = [0] * N
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

for i in range(N):
    v[i], w[i] = map(int, input().split())

for i in range(N - 1, -1, -1):
    for j in range(W + 1):
        if j < w[i]:
            dp[i][j] = dp[i + 1][j]
        else:
            dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i])

print(dp[0][W])
Buggy python submission (verdict: Runtime Error):
def counts(num):
	if num:counts(map(int, raw_input().split()))
	if num:countlist.append(len(str(num[0]+num[1])))

countlist = []
counts(map(int, raw_input().split()))
countlist.reverse()
for x in countlist:
	print x

Fixed submission:
def counts(num):
	countlist.append(len(str(num[0] + num[1])))

countlist = []
flag = True
while flag :
	try:
		counts(map(int, raw_input().split()))
	except:
		flag = False
		for x in countlist:
			print x
Buggy python submission (verdict: Runtime Error):
while 1:
 x,y=map(int,raw_input().split()).sort
 if y==0:break
 print x,y

Fixed submission:
while 1:
 x,y=sorted(map(int,raw_input().split()))
 if y<1:break
 print x,y

Buggy python submission (verdict: Runtime Error):
while 1:
 x,y=map(int,raw_input().split()).sort()
 if y==0:break
 print x,y

Fixed submission:
while 1:
 x,y=sorted(map(int,raw_input().split()))
 if y<1:break
 print x,y
Buggy python submission (verdict: Runtime Error):
n=input();a=[];b="SHCD"
for i in range(4*13):a.append(b[i/13]+" "+str(i%13+1))
for i in range(n):c.remove(raw_input())
for i in c:print i

Fixed submission:
j=input();i=52;a=[""]*i
while i:i-=1;a[i]="SHCD"[i/13]+" "+str(i%13+1)
while j:j-=1;a.remove(raw_input())
for i in a:print i

Buggy python submission (verdict: Runtime Error):
n=input();a=[];b="SHCD"
for i in range(4*13):a.append(b[i/13]+" "+str(i%13+1))
for i in range(n):a.remove(raw_input())
for i in c:print i

Fixed submission:
j=input();i=52;a=[""]*i
while i:i-=1;a[i]="SHCD"[i/13]+" "+str(i%13+1)
while j:j-=1;a.remove(raw_input())
for i in a:print i

Buggy python submission (verdict: Runtime Error):
a=[];n=input()
for i in range(52):
 a.append("SHCD"[i/13]+" "+str(i%13+1))
 if i<n:a.remove(raw_input())
for i in a:print i

Fixed submission:
j=input();i=52;a=[""]*i
while i:i-=1;a[i]="SHCD"[i/13]+" "+str(i%13+1)
while j:j-=1;a.remove(raw_input())
for i in a:print i
Buggy python submission (verdict: Runtime Error):
while 1:
        P = map(float,raw_input().split())
        x = (P[2]*P[4]-P[1]*P[5])/(P[0]*P[4]-P[1]*P[3])
        y = (P[2]*P[3]-P[0]*P[5])/(P[1]*P[3]-P[0]*P[4])
        x = x if x else 0
        y = y if y else 0
        print "{:.3f} {:.3f}".format(x,y)

Fixed submission:
while 1:
        try:
                P = map(float,raw_input().split())
        except EOFError:
                break
        x = (P[2]*P[4]-P[5]*P[1])/(P[0]*P[4]-P[3]*P[1])
        y = (P[2]*P[3]-P[5]*P[0])/(P[1]*P[3]-P[4]*P[0])
        x = x if x else 0
        y = y if y else 0
        print "{:.3f} {:.3f}".format(x,y)
Buggy python submission (verdict: Time Limit Exceeded):
while 1:
        try:
                n, p = input(), 0
        except EOFError:
                break

        for x in range(1,n+1,2):
                for y in range(3,x/2,2):
                        print x, y, x % y
                        if x % y == 0:
                                break
                else:
                        p += 1
        print p

Fixed submission:
p = [0 for x in range(999999)]
for x in xrange(1,999999,2):
        z = int(x**0.5)+1
        for y in xrange(3,z,2):
                if x % y == 0:
                        break
        else:
                p[x] = 1
p[1], p[2] = 0, 1

while 1:
        try:
                n = input()
                print sum(p[:n+1])
        except EOFError:
                break

Buggy python submission (verdict: Time Limit Exceeded):
while 1:
        try:
                n, p = input(), 0
        except EOFError:
                break

        for x in xrange(1,n+1,2):
                for y in xrange(3,int(x**0.5)+1,2):
                        if x % y == 0:
                                break
                else:
                        p += 1
        print p

Fixed submission:
p = [0 for x in range(999999)]
for x in xrange(1,999999,2):
        z = int(x**0.5)+1
        for y in xrange(3,z,2):
                if x % y == 0:
                        break
        else:
                p[x] = 1
p[1], p[2] = 0, 1

while 1:
        try:
                n = input()
                print sum(p[:n+1])
        except EOFError:
                break