Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys

SUITS = ['S', 'H', 'C', 'D']
exist_cards = {suit:[] for suit in suits}

n = input()

for line in sys.stdin:
    suit, number = line.split()
    exist_cards[suit].append(int(number))


for suit in SUITS:
    for i in range(1, 14):
        if i not in exist_cards[suit]:
            print(suit, i)

Fixed submission:
import sys

SUITS = ('S', 'H', 'C', 'D')
cards = {suit:{i for i in range(1, 14)} for suit in SUITS}

n = input() # 読み捨て

for line in sys.stdin:
    suit, number = line.split()
    cards[suit].discard(int(number))

for suit in SUITS:
    for i in cards[suit]:
        print(suit, i)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m = map(int, input().split())

a = np.zeros([n, m])
for i in range(n):
    a[0] = list(map(int, input().split()))

b = np.zeros(m)
for i in range(m):
    b[i] = int(input())

c = a.dot(b)
for i in c:
    print(i)

Fixed submission:
n, m = map(int, input().split())

a = [0] * n 
for i in range(n):
    a[i] = list(map(int, input().split()))

b = [0] * m
for i in range(m):
    b[i] = int(input())

c = [0] * n    
for i in range(n):
    for aj, bj in zip(a[i], b):
        c[i] += aj * bj
    
for ci in c:
    print(ci)
Buggy python submission (verdict: Runtime Error):
import sys

keyword = input().lowercase()
count = 0
for line in sys.stdin:
    count += sum([1 for word in line.lowercase().split() if word == keyword])
    
print(count)

Fixed submission:
import sys

keyword = input().lower()
count = 0
for line in sys.stdin:
    count += sum([1 for word in line.lower().split() if word == keyword])
    
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import math
def sieve(n):
    p = [1] * (n + 1)
    p[0] = p[1] = 0
    
    for i in range(math.ceil((n + 1) ** 0.5)):
        if p[i]:
            for j in range(2 * i, len(p), i):
                p[j] = 0
    return p

def prime_factor(n):
    p = sieve(n)
    for pi in compress(count(0), p):
        while n % pi == 0:
            n //= pi
            yield pi

from sys import stdin
from itertools import compress, count

readline = stdin.readline

n = int(readline())
print('{}: '.format(n) + ' '.join(map(str, prime_factor(n))))

Fixed submission:
import math
def sieve(n):
    p = [1] * (n + 1)
    p[0] = p[1] = 0
    
    for i in range(math.ceil((n + 1) ** 0.5)):
        if p[i]:
            for j in range(2 * i, len(p), i):
                p[j] = 0
    return p

def prime_factor(n):
    p = sieve(int(n ** 0.5))
    factor = []
    for pi in compress(count(0), p):
        while n % pi == 0:
            n //= pi
            factor.append(pi)

    if n != 1:
        factor.append(n)
    return factor

from sys import stdin
from itertools import compress, count

readline = stdin.readline


n = int(readline())
print('{}: '.format(n) + ' '.join(map(str, prime_factor(n))))
Buggy python submission (verdict: Time Limit Exceeded):
def power(m, n):
    if n == 1:
        return m
            
    div = 1000000007

    ret = power(m * m, n // 2) % div
    if n % 2:
        ret = (ret * m) % div
    return ret
    

from sys import stdin
readline = stdin.readline


m, n = map(int, readline().split())
print(power(m, n))

Fixed submission:
def power(m, n):
    if n:return power(m * m % 1000000007, n // 2) * (m if n % 2 else 1) % 1000000007
    return 1


from sys import stdin
readline = stdin.readline

m, n = map(int, readline().split())
print(power(m, n))

Buggy python submission (verdict: Time Limit Exceeded):
def power(m, n):
    if n == 1:return m
    return power(m * m, n // 2) * (m if n % 2 else 1) % 1000000007
    

from sys import stdin
readline = stdin.readline

m, n = map(int, readline().split())
print(power(m, n))

Fixed submission:
def power(m, n):
    if n:return power(m * m % 1000000007, n // 2) * (m if n % 2 else 1) % 1000000007
    return 1


from sys import stdin
readline = stdin.readline

m, n = map(int, readline().split())
print(power(m, n))
Buggy python submission (verdict: Runtime Error):
import math
def sieve(n):
    p = [1] * (n + 1)
    p[0] = p[1] = 0
    
    for i in range(math.ceil((n + 1) ** 0.5)):
        if p[i]:
            for j in range(2 * i, len(p), i):
                p[j] = 0
    return p

def prime_factor(n):
    p = sieve(int(n ** 0.5))
    factor = []
    for pi in compress(count(0), p):
        while n % pi == 0:
            n //= pi
            factor.append(pi)

    if n != 1:
        factor.append(n)
    return factor

from collections import Counter
from sys import stdin
readline = stdin.readline

n = int(readline())
c =[Counter(prime_factor(ai)) for ai in map(int, readline().split())]
s = set()
for ci in c:
    s.update(ci.keys())

ret = 1
for i in [i ** max(ci[i] for ci in c) for i in s]:
    ret *= i
print(ret)

Fixed submission:
import math
def sieve(n):
    p = [1] * (n + 1)
    p[0] = p[1] = 0
    
    for i in range(math.ceil((n + 1) ** 0.5)):
        if p[i]:
            for j in range(2 * i, len(p), i):
                p[j] = 0
    return p

from itertools import compress, count
def prime_factor(n):
    p = sieve(int(n ** 0.5))
    factor = []
    for pi in compress(count(0), p):
        while n % pi == 0:
            n //= pi
            factor.append(pi)

    if n != 1:
        factor.append(n)
    return factor

from collections import Counter
from sys import stdin
readline = stdin.readline

n = int(readline())
c =[Counter(prime_factor(ai)) for ai in map(int, readline().split())]
s = set()
for ci in c:
    s.update(ci.keys())

ret = 1
for i in [i ** max(ci[i] for ci in c) for i in s]:
    ret *= i
print(ret)
Buggy python submission (verdict: Runtime Error):
from itertools import compress, count
def prime_factor(n):
    p = sieve(int(n ** 0.5))
    factor = []
    for pi in compress(count(0), p):
        while n % pi == 0:
            n //= pi
            factor.append(pi)

    if n != 1:
        factor.append(n)
    return factor

from sys import stdin
from functools import reduce
from operator import mul
from collections import Counter
readline = stdin.readline

print(reduce(mul, (pow(p, k) - pow(p, k - 1) for p, k in Counter(prime_factor(int(readline()))).items())))

Fixed submission:
import math
def sieve(n):
    p = [1] * (n + 1)
    p[0] = p[1] = 0
    
    for i in range(math.ceil((n + 1) ** 0.5)):
        if p[i]:
            for j in range(2 * i, len(p), i):
                p[j] = 0
    return p

from itertools import compress, count
def prime_factor(n):
    p = sieve(int(n ** 0.5))
    factor = []
    for pi in compress(count(0), p):
        while n % pi == 0:
            n //= pi
            factor.append(pi)

    if n != 1:
        factor.append(n)
    return factor

from sys import stdin
from functools import reduce
from operator import mul
from collections import Counter
readline = stdin.readline

print(reduce(mul, (pow(p, k) - pow(p, k - 1) for p, k in Counter(prime_factor(int(readline()))).items())))
Buggy python submission (verdict: Runtime Error):
n = input()
minSeq = input()
maxv = -float("inf")
for i in range(n):
    R = input()
    if R - minSeq > maxv:
        maxv = R - minSeq
    if R < minSeq:
        minSeq = R
print(maxv)

Fixed submission:
n = input()
minSeq = input()
maxv = -float("inf")
for i in range(n-1):
    R = input()
    if R - minSeq > maxv:
        maxv = R - minSeq
    if R < minSeq:
        minSeq = R
print(maxv)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
a, b = map(int, input().split())
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")

Fixed submission:
#!/usr/bin/env python3
for x in range(1, 10):
    for y in range(1, 10):
        print("{0}x{1}={2}".format(x, y, x * y))

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
a, b = map(int, input().split())
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")

Fixed submission:
#!/usr/bin/env python3
for x in range(1, 10):
    for y in range(1, 10):
        print("{0}x{1}={2}".format(x, y, x * y))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
def right_triangle(edge):
    # a < b < c
    return (edge[0] ** 2 + edge[1] ** 2 == edge[2] ** 2)

n = int(input())
for i in range(n):
    edge = sorted([int(x) for x in input().split()])
    if right_triangle(edge):
        print("YES")
    else:
        print("NO")

Fixed submission:
#!/usr/bin/env python3
def right_triangle(edge):
    # a < b < c
    return (edge[0] ** 2 + edge[1] ** 2 == edge[2] ** 2)

n = int(input())
for i in range(n):
    edge = sorted([int(x) for x in input().split()])
    if right_triangle(edge):
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from functools import lru_cache
from itertools import count, takewhile


def prime():
    prime = []

    def _isPrime(n):
        for d in takewhile(lambda x: x * x <= n, prime):
            if n % d == 0:
                return False
        return True
    for i in count(2):
        if _isPrime(i):
            prime.append(i)
            yield(i)


@lru_cache(maxsize=None)
def isPrime(n):
    if n < 2:
        return False
    for p in takewhile(lambda x: x * x <= n, prime()):
        if n % p == 0:
            return False
    return True

n = int(input())
c = 0
for _ in range(n):
    i = int(input())
    if isPrime(i):
        c += 1
print(c)

Fixed submission:
#!/usr/bin/env python3
from itertools import count, takewhile


def prime():
    prime = []

    def _isPrime(n):
        for d in takewhile(lambda x: x * x <= n, prime):
            if n % d == 0:
                return False
        return True
    for i in count(2):
        if _isPrime(i):
            prime.append(i)
            yield(i)


def is_prime(primes, i):
    for p in takewhile(lambda x: x * x <= i, sorted(primes)):
        if i % p == 0:
            return False
    return True

primes = list(takewhile(lambda x: x < 10000, prime()))

n = int(input())
c = 0
for _ in range(n):
    i = int(input())
    if is_prime(primes, i):
        c += 1
print(c)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
from itertools import takewhile
from math import sqrt


def is_prime(primes, i):
    if i in primes:
        return True
    for p in takewhile(lambda x: x * x <= i, sorted(primes)):
        if i % p == 0:
            return False
    return True


def sieve_of_eratosthenes(max):
    is_prime = [True] * (max + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(sqrt(max)) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * i, max + 1, i):
            is_prime[j] = False
    return filter(lambda x: is_prime[x], range(max + 1))

primes = set(sieve_of_eratosthenes(10000))

n = int(input())
c = 0
for _ in range(n):
    i = int(input())
    if is_prime(i):
        c += 1
print(c)

Fixed submission:
#!/usr/bin/env python3
from itertools import count, takewhile


def prime():
    prime = []

    def _isPrime(n):
        for d in takewhile(lambda x: x * x <= n, prime):
            if n % d == 0:
                return False
        return True
    for i in count(2):
        if _isPrime(i):
            prime.append(i)
            yield(i)


def is_prime(primes, i):
    for p in takewhile(lambda x: x * x <= i, sorted(primes)):
        if i % p == 0:
            return False
    return True

primes = list(takewhile(lambda x: x < 10000, prime()))

n = int(input())
c = 0
for _ in range(n):
    i = int(input())
    if is_prime(primes, i):
        c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from heapq import heappop, heappush
from math import isinf

V, E, r = map(int, input())

e = defaultdict(list)
for i in range(E):
    s, t, length = map(int, input())
    e[s].append((length, t))

distance = [float('inf')] * v          # 各頂点への距離の初期値
distance[r] = 0                        # 始点への距離は 0

# ダイクストラ
heap = [(distance[r], r)]
while heap:
    du, u = heappop(heap)
    for length, v in e[u]:
        if distance[v] > e[u] + length:
            distance[v] = e[u] + length
            heappush(heap, (distance[v], v))

for d in distance:
    print('INF' if math.isinf(di) else di)

Fixed submission:
#!/usr/bin/env python
from collections import defaultdict
from heapq import heappop, heappush
from math import isinf

V, E, r = map(int, input().split())

e = defaultdict(list)
for i in range(E):
    s, t, length = map(int, input().split())
    e[s].append((length, t))

distance = [float('inf')] * V          # 各頂点への距離の初期値
distance[r] = 0                        # 始点への距離は 0

# ダイクストラ
heap = [(distance[r], r)]
while heap:
    du, u = heappop(heap)
    for length, v in e[u]:
        if distance[v] > distance[u] + length:
            distance[v] = distance[u] + length
            heappush(heap, (distance[v], v))

for d in distance:
    print('INF' if isinf(d) else d)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
from math import isinf

V, E, r = map(int, input().split())
vertices = [float('inf')] * V
vertices[r] = 0
edges = []
for i in range(E):
    s, t, d = map(int, input().split())
    edges.append((s, t, d))

for i in range(V - 1):
    for s, t, d in edges:
        if vertices[t] > vertices[s] + d:
            vertices[t] = vertices[s] + d

for s, t, d in edges:
    if vertices[t] > vertices[s] + d:
        neg = True
        print("NEGATIVE CYCLE")

if not neg:
    for v in vertices:
        print('INF' if isinf(v) else v)

Fixed submission:
#!/usr/bin/env python3
from math import isinf


def main():
    V, E, r = map(int, input().split())
    vertices = [float('inf')] * V
    vertices[r] = 0
    edges = []
    for i in range(E):
        s, t, d = map(int, input().split())
        edges.append((s, t, d))

    for i in range(V - 1):
        for s, t, d in edges:
            if vertices[t] > vertices[s] + d:
                vertices[t] = vertices[s] + d

    for s, t, d in edges:
        if vertices[t] > vertices[s] + d:
            print("NEGATIVE CYCLE")
            return

    for v in vertices:
        print('INF' if isinf(v) else v)

main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

from collections import defaultdict
# クラスカル法を使う

V, E = map(int, input().split())
D = 0
tree = []
vertices = defaultdict(set)
for i in range(V):
    tree.append(i)          # 全ての頂点は自分の頂点 index と同じ index の木に属す
    vertices[i].add(i)

edges = []
for i in range(E):
    s, t, d = map(int, input().split())
    edges.append((s, t, d))

edges.sort(key=lambda x: x[2])
while edges:
    if V == 1:
        break
    s, t, d = edges.pop(0)
    if tree[s] != tree[t]:
        new = min(tree[s], tree[t])
        old = max(tree[s], tree[t])
        vertices[new] = vertices[new] | vertices[old]
        for vertex in vertices[new]:
            tree[vertex] = new

        D += d
        V -= 1
print(D)

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

from collections import defaultdict
# クラスカル法を使う

V, E = map(int, input().split())
D = 0
tree = []
vertices = defaultdict(set)
for i in range(V):
    tree.append(i)          # 全ての頂点は自分の頂点 index と同じ index の木に属す
    vertices[i].add(i)

edges = []
for i in range(E):
    s, t, d = map(int, input().split())
    edges.append((s, t, d))

edges.sort(key=lambda x: x[2])
while edges:
    if V == 1:
        break
    s, t, d = edges.pop(0)
    if tree[s] != tree[t]:
        new = min(tree[s], tree[t])
        old = max(tree[s], tree[t])
        vertices[new] = vertices[new] | vertices[old]
        for vertex in vertices[old]:
            tree[vertex] = new

        D += d
        V -= 1
print(D)
Buggy python submission (verdict: Runtime Error):
a,b = input().split(" ")
print(a*b,2*(a+b))

Fixed submission:
n = input().split(" ")
a, b = int(n[0]), int(n[1])
print(a * b, 2 * (a + b))

Buggy python submission (verdict: Runtime Error):
n = input().split(" ")
print(n[0]*n[1],2*(n[0]+n[1]))

Fixed submission:
n = input().split(" ")
a, b = int(n[0]), int(n[1])
print(a * b, 2 * (a + b))
Buggy python submission (verdict: Runtime Error):
s = int(input())
h,m,s = s / 3600, (s/60)%60, s%60
printf("%d:%d:%d",h,m,s)

Fixed submission:
#!/usr/bin/env python3
s = int(input())
h, m, s = int(s / 3600), int(s / 60) % 60, s % 60
print(h, m, s, sep=':')
Buggy python submission (verdict: Runtime Error):
# coding: UTF-8
inputs=[]
for i in range(1,10):
    inputs.append(input())
inputs.sort(reverse=True)
for i in range(0,3):
    print x[i]

Fixed submission:
# coding: UTF-8
inputs=[]
for i in range(0,10):
    inputs.append(input())
inputs.sort(reverse=True)
#print "\n"
for i in range(0,3):
    print inputs[i]
Buggy python submission (verdict: Runtime Error):
# coding: UTF-8
while True:
    num = map(float,raw_input().split())
    x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
    y = (num[5]*num[0]-num[2]*num[3]) / (num[0]*num[4]-num[3]*num[1])

    print "%0.3f %0.3f"%(x,y)

Fixed submission:
import sys
out=[]
for line in sys.stdin.readlines():
    num = map(float, line.strip().split())
    x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
    y = (num[5]*num[0] - num[2]*num[3]) / (num[0]*num[4] - num[3]*num[1])
    if x == 0:
        x=0.00
    if y == 0:
        y=0.00
    out.append( "%.3f %.3f"%(round(x,3),round(y,3)))
for i in xrange(len(out)):
    print out[i]

Buggy python submission (verdict: Runtime Error):
import sys
for line in sys.stdin:
    num = map(float,raw_input().split())
    x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
    y = (num[5]*num[0]-num[2]*num[3]) / (num[0]*num[4]-num[3]*num[1])
    print "%0.3f %0.3f"%(x,y)

Fixed submission:
import sys
out=[]
for line in sys.stdin.readlines():
    num = map(float, line.strip().split())
    x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
    y = (num[5]*num[0] - num[2]*num[3]) / (num[0]*num[4] - num[3]*num[1])
    if x == 0:
        x=0.00
    if y == 0:
        y=0.00
    out.append( "%.3f %.3f"%(round(x,3),round(y,3)))
for i in xrange(len(out)):
    print out[i]

Buggy python submission (verdict: Runtime Error):
import sys
line = sys.stdin.read().splitlines()
for line in len(line):
    num = map(float,raw_input().split())
    x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
    y = (num[5]*num[0]-num[2]*num[3]) / (num[0]*num[4]-num[3]*num[1])
    print "%0.3f %0.3f"%(x,y)

Fixed submission:
import sys
out=[]
for line in sys.stdin.readlines():
    num = map(float, line.strip().split())
    x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
    y = (num[5]*num[0] - num[2]*num[3]) / (num[0]*num[4] - num[3]*num[1])
    if x == 0:
        x=0.00
    if y == 0:
        y=0.00
    out.append( "%.3f %.3f"%(round(x,3),round(y,3)))
for i in xrange(len(out)):
    print out[i]

Buggy python submission (verdict: Runtime Error):
import sys
for line in sys.stdin.readlines():
    num = map(float, line.strip().split())
    x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
    y = (num[5]*num[0]-num[2]*num[3]) / (num[0]*num[4]-num[3]*num[1])
    out.append( "%0.3f %0.3f"%(x,y))
for i in xrange(len(out)):
    print out[i]

Fixed submission:
import sys
out=[]
for line in sys.stdin.readlines():
    num = map(float, line.strip().split())
    x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
    y = (num[5]*num[0] - num[2]*num[3]) / (num[0]*num[4] - num[3]*num[1])
    if x == 0:
        x=0.00
    if y == 0:
        y=0.00
    out.append( "%.3f %.3f"%(round(x,3),round(y,3)))
for i in xrange(len(out)):
    print out[i]
Buggy python submission (verdict: Runtime Error):
while True:
	a = raw_input()
	if a == "":
		break
	temp = a.split()
	x = int(temp[0]) + int(temp[1])

	c = str(x)
	print len(c)

Fixed submission:
while True:
	try:
		a = raw_input()
		temp = a.split()
		x = int(temp[0]) + int(temp[1])
		c = str(x)
		print len(c)
	
	except:
		break

Buggy python submission (verdict: Runtime Error):
while True:
	a = raw_input()
	if a == "":
		break
	temp = a.split()
	x = int(temp[0]) + int(temp[1])

	c = str(x)
	print len(c)

Fixed submission:
while True:
	try:
		a = raw_input()
		temp = a.split()
		x = int(temp[0]) + int(temp[1])
		c = str(x)
		print len(c)
	
	except:
		break
Buggy python submission (verdict: Runtime Error):
import sys

def generate_next_hexes(x, y):
    hexes = [(x, y - 1), (x, y + 1), (x - 1, y), (x + 1, y)]
    if y % 2:
        hexes += [(x - 1, y - 1), (x - 1, y + 1)]
    else:
        hexes += [(x + 1, y - 1), (x + 1, y + 1)]
    hexes = [(a, b) for (a, b) in hexes if 1 <= b <= m and 1 <= b <= n]
    return hexes

def update_map(hex_map, hexes):
    num_updated_hexes = 0
    distance = 0
    while hexes:
        next_hexes = []
        for pos in hexes:
            if pos not in hex_map or distance < hex_map[pos]):
                hex_map[pos] = distance
                num_updated_hexes += 1
                next_hexes += generate_next_hexes(pos[0], pos[1])
        distance += 1
        hexes = next_hexes
    return num_updated_hexes

while True:
    (m, n) = [int(i) for i in sys.stdin.readline().split()]
    if m == n == 0:
        break

    s = int(sys.stdin.readline())
    stores = []
    for i in range(s):
        pos = [int(j) for j in sys.stdin.readline().split()]
        stores.append(tuple(pos))
    hex_map = {}
    update_map(hex_map, stores)

    t = int(sys.stdin.readline())
    candidates = []
    for i in range(t):
        pos = [int(j) for j in sys.stdin.readline().split()]
        candidates.append(tuple(pos))

    max_num_blocks = 0
    for candidate in candidates:
        new_hex_map = hex_map.copy()
        num_blocks = update_map(new_hex_map, [candidate])
        max_num_blocks = max(max_num_blocks, num_blocks)

    print(max_num_blocks)

Fixed submission:
import sys

def generate_next_hexes(x, y):
    hexes = [(x, y - 1), (x, y + 1), (x - 1, y), (x + 1, y)]
    if y % 2:
        hexes += [(x - 1, y - 1), (x - 1, y + 1)]
    else:
        hexes += [(x + 1, y - 1), (x + 1, y + 1)]
    return hexes

def update_map(hex_map, hexes):
    num_updated_hexes = 0
    distance = 0
    while hexes:
        next_hexes = []
        for pos in hexes:
            x = pos[0]
            y = pos[1]
            if (1 <= x <= m and 1 <= y <= n
                    and (pos not in hex_map or distance < hex_map[pos])):
                hex_map[pos] = distance
                num_updated_hexes += 1
                next_hexes += generate_next_hexes(x, y)
        distance += 1
        hexes = next_hexes
    return num_updated_hexes

while True:
    (m, n) = [int(i) for i in sys.stdin.readline().split()]
    if m == n == 0:
        break

    s = int(sys.stdin.readline())
    stores = []
    for i in range(s):
        pos = [int(j) for j in sys.stdin.readline().split()]
        stores.append(tuple(pos))
    hex_map = {}
    update_map(hex_map, stores)

    t = int(sys.stdin.readline())
    candidates = []
    for i in range(t):
        pos = [int(j) for j in sys.stdin.readline().split()]
        candidates.append(tuple(pos))

    max_num_blocks = 0
    for candidate in candidates:
        new_hex_map = hex_map.copy()
        num_blocks = update_map(new_hex_map, [candidate])
        max_num_blocks = max(max_num_blocks, num_blocks)

    print(max_num_blocks)
Buggy python submission (verdict: Runtime Error):
import sys
import math
(x1, y1, x2, y2) = [int(i) for i in sys.stdin.readline().split()]
d = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
print(d)

Fixed submission:
import sys
import math
(x1, y1, x2, y2) = [float(i) for i in sys.stdin.readline().split()]
d = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
print(d)
Buggy python submission (verdict: Runtime Error):
import sys

(a, b) = [int(i) for i in sys.readline().split()]
print("%d %d" % (a * b, (a + b) * 2))

Fixed submission:
import sys
 
(a, b) = [int(i) for i in sys.stdin.readline().split()]
print("%d %d" % (a * b, (a + b) * 2))
Buggy python submission (verdict: Runtime Error):
import sys
l = [int(i) for i in sys.stdin.readline().split()]
l.sort()
print(" ".join(l))

Fixed submission:
import sys
l = [int(i) for i in sys.stdin.readline().split()]
l.sort()
print(" ".join(map(str, l)))