Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W, M = map(int, input().split())
map_ = np.zeros((H, W), dtype=np.bool)

h_sum = [0] * H
w_sum = [0] * W

for _ in range(M):
    h, w = map(int, input().split())
    map_[h-1, w-1] = 1
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)


Fixed submission:
# import numpy as np

H, W, M = map(int, input().split())
#map_ = np.zeros((H, W), dtype=np.bool)

h_sum = [0] * H
w_sum = [0] * W
point_list = set()

for _ in range(M):
    h, w = map(int, input().split())
    # map_[h-1, w-1] = 1
    point_list.add((h-1, w-1))
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)

Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W, M = map(int, input().split())
map_ = np.zeros((H, W), dtype=np.uint8)

h_sum = [0] * H
w_sum = [0] * W


Fixed submission:
# import numpy as np

H, W, M = map(int, input().split())
#map_ = np.zeros((H, W), dtype=np.bool)

h_sum = [0] * H
w_sum = [0] * W
point_list = set()

for _ in range(M):
    h, w = map(int, input().split())
    # map_[h-1, w-1] = 1
    point_list.add((h-1, w-1))
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)

Buggy python submission (verdict: Runtime Error):
# import numpy as np

H, W, M = map(int, input().split())
# map_ = np.zeros((H, W), dtype=np.uint8)
map_ = [[0] * W for _ in range(H)]

h_sum = [0] * H
w_sum = [0] * W

for _ in range(M):
    h, w = map(int, input().split())
    map_[h-1, w-1] = 1
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)

Fixed submission:
# import numpy as np

H, W, M = map(int, input().split())
#map_ = np.zeros((H, W), dtype=np.bool)

h_sum = [0] * H
w_sum = [0] * W
point_list = set()

for _ in range(M):
    h, w = map(int, input().split())
    # map_[h-1, w-1] = 1
    point_list.add((h-1, w-1))
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)

Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W, M = map(int, input().split())
map_ = np.zeros((H, W), dtype=np.uint8)

h_sum = [0] * H
w_sum = [0] * W

for _ in range(M):
    h, w = map(int, input().split())
    map_[h-1, w-1] = 1
    h_sum[h-1] += 1
    w_sum[w-1] += 1

ans = 0
h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)

Fixed submission:
# import numpy as np

H, W, M = map(int, input().split())
#map_ = np.zeros((H, W), dtype=np.bool)

h_sum = [0] * H
w_sum = [0] * W
point_list = set()

for _ in range(M):
    h, w = map(int, input().split())
    # map_[h-1, w-1] = 1
    point_list.add((h-1, w-1))
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)

Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W, M = map(int, input().split())
map_ = np.zeros((H, W))

for _ in range(M):
    h, w = map(int, input().split())
    map_[h-1, w-1] = 1

sum_h = np.sum(map_, axis=1)
sum_w = np.sum(map_, axis=0)
ans = 0

for h in range(H):
    for w in range(W):
        ans = max(sum_h[h] + sum_w[w] - map_[h, w], ans)

print(int(ans))

Fixed submission:
# import numpy as np

H, W, M = map(int, input().split())
#map_ = np.zeros((H, W), dtype=np.bool)

h_sum = [0] * H
w_sum = [0] * W
point_list = set()

for _ in range(M):
    h, w = map(int, input().split())
    # map_[h-1, w-1] = 1
    point_list.add((h-1, w-1))
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)