Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=input()
for i in range(n):
	a=input()
	b=input()
	print(a+b)

Fixed submission:
n=int(input())
for i in range(n):
	a=int(input())
	b=int(input())
	c=a+b
	c=str(c)
	if len(c)>80:
		print("overflow")
	else:
		print(c)
Buggy python submission (verdict: Runtime Error):
n=int(input())
n=int(input())
for i in range(n):
	inputs=list(map(str,input().split()))
	ans=""
	for j in inputs:
		if j[:7]=="Hoshino":
			ans+="Hoshina "
			#print("Hoshina",end=" ")
		else:
			ans+=j+" "
			#print(j,end=" ")
	ans=ans[:-1]
	print(ans)

Fixed submission:
n=int(input())
for i in range(n):
	print(input().replace("Hoshino","Hoshina"))
Buggy python submission (verdict: Runtime Error):
N = int(input())
for _ in range(0, N) :
x1,y1,x2,y2,x3,y3,x4,y4 = list(map(int, input().split()))
  if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) :
    print("YES")
  else :
    print("NO")

Fixed submission:
N = int(input())
for i in range(0, N) :
  x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split()))
  s = x2 - x1
  t = y2 - y1
  u = x4 - x3
  v = y4 - y3;
  if (abs(s * v - t * u) < 1e-10) :
    print("YES")
  else :
    print("NO")

Buggy python submission (verdict: Runtime Error):
N = int(input())
for _ in range(0, N) :
  x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split()))
  if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) :
    print("YES")
  else :
    print("NO")

Fixed submission:
N = int(input())
for i in range(0, N) :
  x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split()))
  s = x2 - x1
  t = y2 - y1
  u = x4 - x3
  v = y4 - y3;
  if (abs(s * v - t * u) < 1e-10) :
    print("YES")
  else :
    print("NO")

Buggy python submission (verdict: Runtime Error):
N = int(input())
for _ in range(0, N) :
  x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split()))
  if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) :
    print("YES")
  else :
    print("NO")

Fixed submission:
N = int(input())
for i in range(0, N) :
  x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split()))
  s = x2 - x1
  t = y2 - y1
  u = x4 - x3
  v = y4 - y3;
  if (abs(s * v - t * u) < 1e-10) :
    print("YES")
  else :
    print("NO")

Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(0, N) :
  x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split()))
  if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) :
    print("YES")
  else :
    print("NO")

Fixed submission:
N = int(input())
for i in range(0, N) :
  x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split()))
  s = x2 - x1
  t = y2 - y1
  u = x4 - x3
  v = y4 - y3;
  if (abs(s * v - t * u) < 1e-10) :
    print("YES")
  else :
    print("NO")
Buggy python submission (verdict: Runtime Error):
s=list();[s.append(eval('{2}{1}{0}'.format(s.pop(),i,s.pop()))if(i in'+-*/')else i)for i in __import__('sys').argv[1:]];print(s[0])

Fixed submission:
exec("try:s=list();[[[s.append(eval('{2}{1}{0}'.format(s.pop(),i,s.pop()))if(i in'+-*/')else i)for i in input().split(' ')]and print(s.pop())]for x in __import__('itertools').count()]\nexcept:pass")

Buggy python submission (verdict: Runtime Error):
s=list();[[[s.append(eval('{2}{1}{0}'.format(s.pop(),i,s.pop()))if(i in'+-*/')else i)for i in input().split(' ')]and print(s.pop())]for x in __import__('itertools').count()]

Fixed submission:
exec("try:s=list();[[[s.append(eval('{2}{1}{0}'.format(s.pop(),i,s.pop()))if(i in'+-*/')else i)for i in input().split(' ')]and print(s.pop())]for x in __import__('itertools').count()]\nexcept:pass")
Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
print((r**2)*math.pi,r*2*math.pi)

Fixed submission:
import math
r = float(input())
print((r**2)*math.pi,r*2*math.pi)
Buggy python submission (verdict: Runtime Error):
x=raw_input()
print(x**3)

Fixed submission:
print(pow(int(input()),3))

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

Fixed submission:
print(pow(int(input()),3))
Buggy python submission (verdict: Runtime Error):
str=input()
x,y=map(double,str.split(" "))
print(x*y)

Fixed submission:
x,y=map(int,input().split(" "))
print(x*y,x*2+y*2)

Buggy python submission (verdict: Runtime Error):
str=input()
x,y=int(str.split(" "))
print(x*y)

Fixed submission:
x,y=map(int,input().split(" "))
print(x*y,x*2+y*2)
Buggy python submission (verdict: Runtime Error):
st = []
n = raw_input()

for s in n:
	st.append(s)

s.sort()
a = int("".join())
b = int("".join(s[::-1]))

print b - a

Fixed submission:
i = int(raw_input())

while (i):
	i -= 1
	st = []
	n = raw_input()

	for s in n:
		st.append(s)

	st.sort()
	a = int("".join(st))
	b = int("".join(st[::-1]))

	print b - a

Buggy python submission (verdict: Runtime Error):
i = raw_input()

while (i):
	i -= 1
	st = []
	n = raw_input()

	for s in n:
		st.append(s)

	s.sort()
	a = int("".join())
	b = int("".join(s[::-1]))

	print b - a

Fixed submission:
i = int(raw_input())

while (i):
	i -= 1
	st = []
	n = raw_input()

	for s in n:
		st.append(s)

	st.sort()
	a = int("".join(st))
	b = int("".join(st[::-1]))

	print b - a

Buggy python submission (verdict: Runtime Error):
i = int(raw_input())

while (i):
	i -= 1
	st = []
	n = raw_input()

	for s in n:
		st.append(s)

	s.sort()
	a = int("".join())
	b = int("".join(s[::-1]))

	print b - a

Fixed submission:
i = int(raw_input())

while (i):
	i -= 1
	st = []
	n = raw_input()

	for s in n:
		st.append(s)

	st.sort()
	a = int("".join(st))
	b = int("".join(st[::-1]))

	print b - a

Buggy python submission (verdict: Runtime Error):
i = int(raw_input())

while (i):
	i -= 1
	st = []
	n = raw_input()

	for s in n:
		st.append(s)

	st.sort()
	a = int("".join())
	b = int("".join(st[::-1]))

	print b - a

Fixed submission:
i = int(raw_input())

while (i):
	i -= 1
	st = []
	n = raw_input()

	for s in n:
		st.append(s)

	st.sort()
	a = int("".join(st))
	b = int("".join(st[::-1]))

	print b - a
Buggy python submission (verdict: Runtime Error):
c = 0
try:
	while 1:
		s = raw_input()
		if s[::-1] == s:
			c += 1

print c
	

Fixed submission:
c = 0
try:
	while 1:
		s = raw_input()
		if s[::-1] == s:
			c += 1
except:
	pass

print c
Buggy python submission (verdict: Runtime Error):
data = map(int, raw_input().split())
data = sorted(data)
data.reverse()
for i in range(3):
    print data[i]
    

Fixed submission:
data = [0]

for i in range(10):
    data.append(int(input()))
    
data = sorted(data)
data.reverse()

for i in range(3):
    print data[i]

Buggy python submission (verdict: Runtime Error):
data = map(int, raw_input().split())
data = sorted(data)
data.reverse()

for i in range(3):
    print data[i]
    

Fixed submission:
data = [0]

for i in range(10):
    data.append(int(input()))
    
data = sorted(data)
data.reverse()

for i in range(3):
    print data[i]
Buggy python submission (verdict: Time Limit Exceeded):
import sys

while (True):
    L = map(float, sys.stdin.readline().split())
    if L:
        (a, b, c, d, e, f) = L
        x = (e * c - b * f) / (a * e - b * d)
        y = (a * f - d * c) / (a * e - b * d)

        print x, y

Fixed submission:
import sys

eps = float(pow(10,-7))

while (True):
    L = map(float, sys.stdin.readline().split())
    if L:
        (a, b, c, d, e, f) = L
        x = (e * c - b * f) / (a * e - b * d)
        y = (a * f - d * c) / (a * e - b * d)

        if (abs(x) < eps):
            x = 0.0
        if (abs(y) < eps):
            y = 0.0

        print "{0:.3f} {1:.3f}".format(x, y)

    else:
        break
Buggy python submission (verdict: Runtime Error):
S = [["0" for i in range(10)] for j in range(10)]

while True:
    check = [[False for i in range(10)] for j in range(10)]
    x = 0
    y = 0
    LOOP = False
    
    H, W = map(int, raw_input().split())
    
    if (H == 0 and W == 0):
        break
    
    for i in range(H):
        S[i] = raw_input()
    
    while (S[y][x] != "."):
        if (check[y][x] == True):
            LOOP = True
            print "LOOP"
            break
        
        check[y][x] = True
        
        if (S[y][x] == "^"):
            y -= 1
        elif (S[y][x] == ">"):
            x += 1
        elif (S[y][x] == "v"):
            y += 1
        else:
            x -= 1

    if (LOOP == False):
        print x, y

Fixed submission:
S = [["0" for i in range(101)] for j in range(101)]

while True:
    check = [[False for i in range(101)] for j in range(101)]
    x = 0
    y = 0
    LOOP = False
    
    H, W = map(int, raw_input().split())
    
    if (H == 0 and W == 0):
        break
    
    for i in range(H):
        S[i] = raw_input()
    
    while (S[y][x] != "."):
        if (check[y][x] == True):
            LOOP = True
            print "LOOP"
            break
        
        check[y][x] = True
        
        if (S[y][x] == "^"):
            y -= 1
        elif (S[y][x] == ">"):
            x += 1
        elif (S[y][x] == "v"):
            y += 1
        else:
            x -= 1

    if (LOOP == False):
        print x, y
Buggy python submission (verdict: Runtime Error):
import math

r = float(input())

print (r * r * math.PI), (2 * r * math.PI)

Fixed submission:
import math

r = float(input())

print "{:.6f} {:.6f}".format((r * r * math.pi), (2 * r * math.pi))
Buggy python submission (verdict: Runtime Error):
while True:
    S = raw_input()

    if (S[2] == "?"):
        break

    print eval(S)
    

Fixed submission:
while True:
    S = raw_input()

    if S.split(" ")[1] == "?":
        break

    print eval(S)

Buggy python submission (verdict: Runtime Error):
while True:
    S = raw_input()

    if (S == "0 ? 0"):
        break

    print eval(S)
    

Fixed submission:
while True:
    S = raw_input()

    if S.split(" ")[1] == "?":
        break

    print eval(S)
Buggy python submission (verdict: Runtime Error):
w = raw_input()

i = 0
count = 0

S = raw_input().split(" ")

while S[i] != "END_OF_TEXT":
    if S[i] == w:
        count += 1
    i += 1
    
print count

Fixed submission:
w = raw_input()

i = 0
count = 0

while True:
    S = raw_input().split(" ")

    for s in S:
        if s.upper() == w.upper():
            count += 1

    if S[-1] == "END_OF_TEXT":
        break    
print count
Buggy python submission (verdict: Runtime Error):
import math

x1, x2, y1, y2 = map(int, raw_input().split(" "))

h = math.sqrt(pow(x1 - y1, 2) + pow(x2 - y2, 2))

print h

Fixed submission:
import math

x1, x2, y1, y2 = map(float, raw_input().split(" "))

h = math.sqrt(pow(x1 - y1, 2) + pow(x2 - y2, 2))

print round(h, 8)

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

x1, x2, y1, y2 = map(int, raw_input().split(" "))

h = math.sqrt(pow(x1 - y1, 2) + pow(x2 - y2, 2))

print round(h, 8)

Fixed submission:
import math

x1, x2, y1, y2 = map(float, raw_input().split(" "))

h = math.sqrt(pow(x1 - y1, 2) + pow(x2 - y2, 2))

print round(h, 8)
Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
S = map(int, raw_input().split())
S = sorted(S)

q = int(raw_input())
T = map(int, raw_input().split())
T = sorted(T)

i = 0
count = 0

while i < q:
    j = 0
    while j < n:
        if j != n - 1:
            while S[j] == S[j + 1]:
                j += 1
        
        if T[i] == S[j]:
            count += 1

        if T[i] < S[j]:
            break
        
        j += 1
    i += 1

print count

Fixed submission:
n = int(raw_input())
S = map(int, raw_input().split())
S = sorted(S)

q = int(raw_input())
T = map(int, raw_input().split())
T = sorted(T)

count = 0
j = 0

for i in range(q):
    for j in range(n):
        if T[i] == S[j]:
            count += 1
            break

print count

Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
S = map(int, raw_input().split())
S = sorted(S)

q = int(raw_input())
T = map(int, raw_input().split())
T = sorted(T)

count = 0
j = 0

for i in range(q):
    while j < n:
        if T[i] == S[j]:
            count += 1
            j += 1
            break
    j += 1

print count

Fixed submission:
n = int(raw_input())
S = map(int, raw_input().split())
S = sorted(S)

q = int(raw_input())
T = map(int, raw_input().split())
T = sorted(T)

count = 0
j = 0

for i in range(q):
    for j in range(n):
        if T[i] == S[j]:
            count += 1
            break

print count
Buggy python submission (verdict: Runtime Error):
a = raw_input().split()
area=a[0]*a[1]
length=2*(a[0]+a[1])
print area+" "+length

Fixed submission:
a = raw_input().split()
area=int(a[0])*int(a[1])
length=2*(int(a[0])+int(a[1]))
print area,length

Buggy python submission (verdict: Runtime Error):
a = raw_input().split()
area=a[0]*a[1]
length=2*(a[0]+a[1])
print area,length

Fixed submission:
a = raw_input().split()
area=int(a[0])*int(a[1])
length=2*(int(a[0])+int(a[1]))
print area,length

Buggy python submission (verdict: Runtime Error):
a = raw_input().split()
area=a[0]*a[1]
length=2*(a[0]+a[1])
print area,length

Fixed submission:
a = raw_input().split()
area=int(a[0])*int(a[1])
length=2*(int(a[0])+int(a[1]))
print area,length

Buggy python submission (verdict: Runtime Error):
a = raw_input().split()
area=a[0]*a[1]
length=2*(a[0]+a[1])
print area,length

Fixed submission:
a = raw_input().split()
area=int(a[0])*int(a[1])
length=2*(int(a[0])+int(a[1]))
print area,length
Buggy python submission (verdict: Runtime Error):
import math
ans = []
while True:
    ufo = []
    n = raw_input().split()
    if n == ["0", "0"]:
        for an in ans:
            print an
        break
    else:
        R = int(n[0])
        for i in range(int(n[1])):
            m = [int(f) for f in raw_input().split()]
            l = math.sqrt(m[0] ** 2 + m[1] ** 2)
            ufo.append([l, l, (m[0], m[1]), m[2], m[3]])
        a = 0
        while len(ufo) > 0:
            flag = True
            for xs in ufo: xs[0] -= xs[4]
            ufo.sort()
            for xs in ufo[:]:
                if xs[0] <= R:
                    a += 1
                    ufo.remove(xs)
                    continue
                elif flag:
                    r = xs[1]
                    pos = xs[2]
                    ufo.remove(xs)
                    flag = False
                    continue
                else:
                    d = xs[0] / xs[1] * abs(pos[0] * xs[2][1] - pos[1] * xs[2][0]) / r
                    if d <= xs[3]:
                        if xs[0] * math.cos(math.atan2(xs[2][1], xs[2][0]) - math.atan2(pos[1], pos[0])) + math.sqrt(xs[3] ** 2 - d ** 2) > R:
                            ufo.remove(xs)
        else:
            ans.append(a)

Fixed submission:
import math
ans = []
while True:
    ufo = []
    n = raw_input().split()
    if n == ["0", "0"]:
        for an in ans:
            print an
        break
    else:
        R = int(n[0])
        for i in range(int(n[1])):
            m = [int(f) for f in raw_input().split()]
            l = math.sqrt(m[0] ** 2 + m[1] ** 2)
            ufo.append([l, l, (m[0], m[1]), m[2], m[3]])
        a = 0
        while len(ufo) > 0:
            flag = True
            for xs in ufo: xs[0] -= xs[4]
            ufo.sort()
            for xs in ufo[:]:
                if xs[0] <= R:
                    a += 1
                    ufo.remove(xs)
                    continue
                elif flag:
                    r = xs[1]
                    pos = xs[2]
                    ufo.remove(xs)
                    flag = False
                    continue
                else:
                    d = xs[0] / xs[1] * abs(pos[0] * xs[2][1] - pos[1] * xs[2][0]) / r
                    if d <= xs[3]:
                        if xs[0] * math.cos(math.atan2(xs[2][1], xs[2][0]) - math.atan2(pos[1], pos[0])) + math.sqrt(xs[3] ** 2 - d ** 2) > R:
                            ufo.remove(xs)
        else:
            ans.append(a)
Buggy python submission (verdict: Runtime Error):
import sys

argvs = sys.argv

x = int(argvs[1])
print str(x**3)

Fixed submission:
import sys

argvs = sys.argv

for x in sys.stdin:
    print str(int(x)**3)
Buggy python submission (verdict: Runtime Error):
from Queue import Queue

n, q = [ int( val ) for val in input( ).split( " " ) ]
names = Queue( )
times = Queue( )
for i in range( n ):
	name, time = input( ).split( " " )
	names.put( name )
	times.put( int( time ) )
 
qsum = 0
output = []
while not times.empty( ):
	name = names.get( )
	time = times.get( )
	if time <= q:
		qsum += time
		output.append( "{:s} {:d}".format( name, qsum ) )
	else:
		times.put( time - q )
		names.put( name )
		qsum += q

print( "\n".join( output ) )

Fixed submission:
from collections import deque

n, q = [ int( val ) for val in input( ).split( " " ) ]
processes = deque( )
for i in range( n ):
    name, time = input( ).split( " " )
    processes.append( ( name, int( time ) ) )
  
qsum = 0
output = []
while len( processes ):
    process = processes.popleft( )
    if process[1] <= q:
        qsum += process[1]
        output.append( "{:s} {:d}".format( process[0], qsum ) )
    else:
        processes.append( ( process[0], process[1]- q ) )
        qsum += q
 
print( "\n".join( output ) )
Buggy python submission (verdict: Runtime Error):
section = raw_input( )
depth = 0
area = 0
depthArr = deque( )
areaArr = deque( )

for i, ground in enumerate( section ):
	if "\\" == ground:
		depth += 1
		depthArr.append( i )
	elif 0 < depth and "/" == ground:
		if len( depthArr ):
			j = depthArr.pop( )
			pool =  i - j
			area += pool

			while len( areaArr ):
				preJ, prePool = areaArr.pop( )
				if j <= preJ:
					pool += prePool
				else:
					areaArr.append( ( preJ, prePool ) )
					break
			areaArr.append( ( j, pool ) )

print( area )
output = []
output.append( len( areaArr ) )
for arr in areaArr:
	output.append( arr[1] )
print( " ".join( map( str, output ) ) )

Fixed submission:
from collections import deque

section = input( )
area = 0
depthPosArr = deque( )
depthPosPoolArr = deque( )

for ipos, ground in enumerate( section ):
	if "\\" == ground:
		depthPosArr.append( ipos )
	elif "/" == ground:
		if len( depthPosArr ):
			jpos = depthPosArr.pop( )
			pool =  ipos - jpos
			area += pool

			while len( depthPosPoolArr ):
				preJPos, prePool = depthPosPoolArr.pop( )
				if jpos <= preJPos:
					pool += prePool
				else:
					depthPosPoolArr.append( ( preJPos, prePool ) )
					break
			depthPosPoolArr.append( ( jpos, pool ) )

print( area )
output = deque( )
output.append( len( depthPosPoolArr ) )
for arr in depthPosPoolArr:
	output.append( arr[1] )
print( " ".join( map( str, output ) ) )
Buggy python submission (verdict: Runtime Error):
n = int( raw_input( ) )
t = [ int( val ) for val in raw_input( ).split( " " ) ]
q = int( raw_input( ) )
s = [ int( val ) for val in raw_input( ).split( " " ) ]

cnt = 0
for si in s:
	for ti in t:
		if si == ti:
			cnt += 1
			break

print( cnt )

Fixed submission:
n = int( input( ) )
t = [ int( val ) for val in input( ).rstrip( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
 
cnt = 0
for si in s:
    for ti in t:
        if si == ti:
            cnt += 1
            break
 
print( cnt )

Buggy python submission (verdict: Runtime Error):
n = int( raw_input( ) )
t = [ int( val ) for val in raw_input( ).split( " " ) ]
q = int( raw_input( ) )
s = [ int( val ) for val in raw_input( ).split( " " ) ]

cnt = 0
for si in s:
	for ti in t:
		if si == ti:
			cnt += 1
			break

print( cnt )

Fixed submission:
n = int( input( ) )
t = [ int( val ) for val in input( ).rstrip( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
 
cnt = 0
for si in s:
    for ti in t:
        if si == ti:
            cnt += 1
            break
 
print( cnt )

Buggy python submission (verdict: Runtime Error):
n = int( input( ) )
t = [ int( val ) for val in raw_input( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in raw_input( ).split( " " ) ]

cnt = 0
for si in s:
	for ti in t:
		if si == ti:
			cnt += 1
			break

print( cnt )

Fixed submission:
n = int( input( ) )
t = [ int( val ) for val in input( ).rstrip( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
 
cnt = 0
for si in s:
    for ti in t:
        if si == ti:
            cnt += 1
            break
 
print( cnt )

Buggy python submission (verdict: Runtime Error):
n = int( input( ) )
t = [ int( val ) for val in input( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]

cnt = 0
for si in s:
	for ti in t:
		if si == ti:
			cnt += 1
			break

print( cnt )

Fixed submission:
n = int( input( ) )
t = [ int( val ) for val in input( ).rstrip( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
 
cnt = 0
for si in s:
    for ti in t:
        if si == ti:
            cnt += 1
            break
 
print( cnt )
Buggy python submission (verdict: Runtime Error):
n = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
q = int( input( ) )
t = [ int( val ) for val in input( ).split( " " ) ]

cnt = 0
cnt = 0
for ti in t:
	low = 0
	high = n - 1
	while low <= high:
		m = ( low+high )/2
		if ti < s[m]:
			high = m - 1
		elif s[m] < ti:
			low = m + 1
		else:
			cnt += 1
			break

print( cnt )

Fixed submission:
n = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
q = int( input( ) )
t = [ int( val ) for val in input( ).split( " " ) ]
t.sort( )

cnt = 0
for ti in t:
	low = 0
	high = n - 1
	while low <= high:
		m = ( low+high )//2
		if ti < s[m]:
			high = m - 1
		elif s[m] < ti:
			low = m + 1
		else:
			cnt += 1
			break

print( cnt )
Buggy python submission (verdict: Runtime Error):
n = int( raw_input( ) )
dic = ()
for i in range( n ):
	cmd, word = raw_input( ).split( " " )
	if "insert" == cmd:
		dic[ word ] = True
	elif "find" == cmd:
		if word in dic:
			print( "yes" )
		else:
			print( "no" )

Fixed submission:
n = int( raw_input( ) )
dic = set()
for i in range( n ):
	cmd, word = raw_input( ).split( " " )
	if "insert" == cmd:
		dic.add( word )
	elif "find" == cmd:
		if word in dic:
			print( "yes" )
		else:
			print( "no" )
Buggy python submission (verdict: Runtime Error):
n, k = [ int( val ) for val in raw_input( ).split( " " ) ]
w = [ int( raw_input( ) ) for val in range( n ) ]
sumW = sum( w )
maxW = max( w )

minP = 0
if 1 == k:
	minP = sumW
elif n == k:
	minP = maxW
else:
	left = maxW
	right = 100000*10000
	while left <= right:
		middle = ( left+right )//2
		truckCnt = i = loadings = 0
		while i < n:
			loadings += w[i]
			if middle < loadings:
				truckCnt += 1
				if k < truckCnt+1:
					break
				loadings = w[i]
			i += 1

		if truckCnt+1 <= k:
			minP = middle
		
		if k < truckCnt+1:
			left = middle + 1
		else:
			right = middle - 1

print( minP )

Fixed submission:
n, k = [ int( val ) for val in input( ).split( " " ) ]
w = [ int( input( ) ) for val in range( n ) ]
sumW = sum( w )
maxW = max( w )

minP = 0
if 1 == k:
	minP = sumW
elif n == k:
	minP = maxW
else:
	left = maxW
	right = 100000*10000
	while left <= right:
		middle = ( left+right )//2
		truckCnt = i = loadings = 0
		while i < n:
			loadings += w[i]
			if middle < loadings:
				truckCnt += 1
				if k < truckCnt+1:
					break
				loadings = w[i]
			i += 1

		if truckCnt+1 <= k:
			minP = middle
		
		if k < truckCnt+1:
			left = middle + 1
		else:
			right = middle - 1

print( minP )

Buggy python submission (verdict: Time Limit Exceeded):
n, k = [ int( val ) for val in raw_input( ).split( " " ) ]
w = [ int( raw_input( ) ) for val in xrange( n ) ]
sumW = sum( w )
maxW = max( w )

minP = 0
if 1 == k:
	minP = sumW
elif n == k:
	minP = maxW
else:
	minP = max( maxW, sumW//k )
	while True:
		truckCnt = i = loadings = 0
		while i < n:
			loadings += w[i]
			if minP < loadings:
				truckCnt += 1
				if k < truckCnt+1:
					break
				loadings = w[i]
			i += 1
		if truckCnt+1 <= k:
			break

		minP += 1

print( minP )

Fixed submission:
n, k = [ int( val ) for val in input( ).split( " " ) ]
w = [ int( input( ) ) for val in range( n ) ]
sumW = sum( w )
maxW = max( w )

minP = 0
if 1 == k:
	minP = sumW
elif n == k:
	minP = maxW
else:
	left = maxW
	right = 100000*10000
	while left <= right:
		middle = ( left+right )//2
		truckCnt = i = loadings = 0
		while i < n:
			loadings += w[i]
			if middle < loadings:
				truckCnt += 1
				if k < truckCnt+1:
					break
				loadings = w[i]
			i += 1

		if truckCnt+1 <= k:
			minP = middle
		
		if k < truckCnt+1:
			left = middle + 1
		else:
			right = middle - 1

print( minP )