Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
start =  26
n = int(input())
ans = []
flag =  False
if n % 26 == 0:
    flag = True
while n:
    ans.append(n%26)
    n //= 26
# print(ans)
ans = ans[::-1]
if flag:
    ans [0] -= 1
    if ans[0] == 0:
        del ans[0]
for i in ans:
    if i == 0:
        i = 26
    printspx(chr(i+ord('a')-1))



'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Fixed submission:
#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

#sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
n = input()
if n >= 'a' and n <= 'z':
    print('a')
else:
    print('A')


'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''
Buggy python submission (verdict: Runtime Error):
def checkPal(s):
  w = s
  w[::-1]
  if w==s:
    return True
  return False
s = input()
if checkPal(s[:(n//2)]) and checkPal(s) and checkPal(s[(n//2)+1:]:
  print("Yes")
else:
  print("No")

Fixed submission:
def checkPal(s):
  if s[::-1]==s:
    return True
  return False
s = input()
n = len(s)
if checkPal(s[:(n//2)]) and checkPal(s) and checkPal(s[(n//2)+1:]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def nc2(n):
	if n<2:
		return 0
	else:
		return (n * (n-1))//2
n = int(input())
li = list(map(int, input().split()))
import collections as cl
d = cl.Counter(li)
# print(d)
for i in li:
	ans = 0
	for k,v in d.items():
		if k!=i:
			ans+=nc2(v)
		else:
			ans+=nc2(v-1)
	print(ans)

Fixed submission:
def nc2(n):
	if n<2:
		return 0
	else:
		return (n * (n-1))//2
n = int(input())
li = list(map(int, input().split()))
s=0; 
d2={}
import collections as cl
d = cl.Counter(li)
for k, v in d.items():
	d2[k] = [nc2(v), nc2(v-1)]
	for v in d2[k]:
		s+=v
		break
# print(d2,s)
for i in li:
	print(s-(d2[i][0])+d2[i][1])
# print(d)
# for i in li:
# 	ans = 0
# 	for k,v in d.items():
# 		if k!=i:
# 			ans+=nc2(v)
# 		else:
# 			ans+=nc2(v-1)
# 	print(ans)
Buggy python submission (verdict: Runtime Error):
#                          JAI SHREE RAM

import math; from collections import *
import sys; from functools import reduce

# sys.setrecursionlimit(10**6)
def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())
def get_string(): return list(input().strip().split())
def printxsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9)+7; SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin=open("input.txt","r");sys.stdout=open("output.txt","w")

# for _testcases_ in range(int(input())):
s = input()
n = s = e = w = False
if 'N' in s: n = True
if 'S' in s: s = True
if 'E' in s: e = True
if 'W' in s: w = True
print("Yes" if not(n^s) and not(e^w) else "No")


'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Fixed submission:
#                          JAI SHREE RAM

import math; from collections import *
import sys; from functools import reduce

# sys.setrecursionlimit(10**6)
def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())
def get_string(): return list(input().strip().split())
def printxsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9)+7; SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin=open("input.txt","r");sys.stdout=open("output.txt","w")

# for _testcases_ in range(int(input())):
st = input()
n = s = e = w = False
if 'N' in st: n = True
if 'S' in st: s = True
if 'E' in st: e = True
if 'W' in st: w = True
print("Yes" if not(n^s) and not(e^w) else "No")


'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''
Buggy python submission (verdict: Time Limit Exceeded):

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    ans = A[0]
    for i in A[1:]:
        ans *= i
    if ans > 1000000000000000000:
        ans = -1
    print(ans)


Fixed submission:
import numpy as np

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    ans = A[0]
    if 0 in A:
        ans = 0
    else:
        for i in A[1:]:
            ans *= i
            if ans > 1000000000000000000:
                ans = -1
                break
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    ans = A[0]
    for i in A[1:]:
        ans *= i
    if ans > 10**18:
        ans = -1
    print(ans)


Fixed submission:
import numpy as np

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    ans = A[0]
    if 0 in A:
        ans = 0
    else:
        for i in A[1:]:
            ans *= i
            if ans > 1000000000000000000:
                ans = -1
                break
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    ans = A[0]
    for i in A[1:]:
        ans *= i
    if ans > 10**18:
        ans = -1
    print(ans)


Fixed submission:
import numpy as np

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    ans = A[0]
    if 0 in A:
        ans = 0
    else:
        for i in A[1:]:
            ans *= i
            if ans > 1000000000000000000:
                ans = -1
                break
    print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import itertools

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if __name__ == "__main__":
    N, M = map(int, input().split())
    ret = 0
    if M != 0:
        ret += combinations_count(M, 2)
    else:
        pass
    if N != 0:
        ret += combinations_count(N, 2)
    else:
        pass
    print(ret)


Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if __name__ == "__main__":
    N, M = map(int, input().split())
    ret = 0
    if M >= 2:
        ret += combinations_count(M, 2)
    else:
        pass
    if N >= 2:
        ret += combinations_count(N, 2)
    else:
        pass
    print(ret)
Buggy python submission (verdict: Runtime Error):

if __name__ == "__main__":
    S = input()
    for i in range(0, len(S), 2):
        if len(S) >= 2 :
            if S[i] == "h" and S[i+1] == "i":
                ret = "Yes"
            else:
                ret = "No"
                break
        else:
            ret = "No"
            break
    print(ret)


Fixed submission:

if __name__ == "__main__":
    S = input()
    if len(S) % 2 == 0:
        for i in range(0, len(S), 2):
            if S[i] == "h" and S[i+1] == "i":
                ret = "Yes"
            else:
                ret = "No"
                break
    else:
        ret = "No"
    print(ret)

Buggy python submission (verdict: Runtime Error):

if __name__ == "__main__":
    S = input()
    for i in range(0, len(S), 2):
        if len(S) >= 1 and S[i] == "h" and S[i+1] == "i":
            ret = "Yes"            
        else:
            ret = "No"
            print(ret)
            exit(0)
    print(ret)


Fixed submission:

if __name__ == "__main__":
    S = input()
    if len(S) % 2 == 0:
        for i in range(0, len(S), 2):
            if S[i] == "h" and S[i+1] == "i":
                ret = "Yes"
            else:
                ret = "No"
                break
    else:
        ret = "No"
    print(ret)

Buggy python submission (verdict: Runtime Error):

if __name__ == "__main__":
    S = input()
    for i in range(0, len(S), 2):
        if len(S) >= 1 and S[i] == "h" and S[i+1] == "i":
            ret = "Yes"            
        else:
            ret = "No"
    print(ret)


Fixed submission:

if __name__ == "__main__":
    S = input()
    if len(S) % 2 == 0:
        for i in range(0, len(S), 2):
            if S[i] == "h" and S[i+1] == "i":
                ret = "Yes"
            else:
                ret = "No"
                break
    else:
        ret = "No"
    print(ret)

Buggy python submission (verdict: Runtime Error):

if __name__ == "__main__":
    S = input()
    for i in range(0, len(S), 2):
        if S[i] == "h" and S[i+1] == "i":
            ret = "Yes"            
        else:
            ret = "No"
    print(ret)


Fixed submission:

if __name__ == "__main__":
    S = input()
    if len(S) % 2 == 0:
        for i in range(0, len(S), 2):
            if S[i] == "h" and S[i+1] == "i":
                ret = "Yes"
            else:
                ret = "No"
                break
    else:
        ret = "No"
    print(ret)
Buggy python submission (verdict: Runtime Error):

if __name__ == "__main__":
    N, A, B = map(int, input().split())
    S = "b" * A + "r" * B 
    S = S * 1000
    ret = S[:N].count("b")
    print(ret)

Fixed submission:
import math

if __name__ == "__main__":
    N, A, B = map(int, input().split())
    ret =  math.floor(N / (A + B)) * A
    if N % (A + B) >= A:
        ret = ret + A
    else:
        ret = ret +  N % (A + B)
    print(ret)
Buggy python submission (verdict: Runtime Error):
import math

if __name__ == "__main__":
    N, A, B = map(int, input().split())
    S = "b" * A + "r" * B
    S = S * math.ceil(1000000000000000000 / len(S))
    ret = S[:N].count("b")
    print(ret)import math

if __name__ == "__main__":
    A, B = map(int, input().split())
    par = A / B
    if par < 0.8:
        print("-1")
        exit(0)
    else:
        a = math.ceil(A / 0.08)
        b = math.ceil(B / 0.1)
        # print(a , b)
        ret = a
        print(a)

Fixed submission:
import math

if __name__ == "__main__":
    A, B = map(int, input().split())
    a = math.ceil(A / 0.08)
    b = math.ceil(B / 0.1)
    # print(a , b)
    if math.floor(a * 0.08) == A and math.floor(a * 0.1) == B:
        ret = a
    elif math.floor(b * 0.08) == A and math.floor(b * 0.1) == B:
        ret = b
    else : 
        ret = -1
    print(ret)
Buggy python submission (verdict: Time Limit Exceeded):


if __name__ == "__main__":
    U = input()
    A = input().split()

    for i in A:
        if A.count(i) > 1:
            ret  = "NO"
            print(ret)
            exit(0)   
    ret = "YES"

    print(ret)


Fixed submission:


if __name__ == "__main__":
    U = input()
    A = input().split()

    A_uni = set(A)

    if len(A) != len(A_uni):
        ret  = "NO"
    else:
        ret = "YES"

    print(ret)
Buggy python submission (verdict: Runtime Error):


C = input()
C_asc ord(C)
ret = chr(C_asc + 1)
print(ret)


Fixed submission:

C = input()
C_asc = ord(C)
ret = chr(C_asc + 1)
print(ret)
Buggy python submission (verdict: Runtime Error):
import math

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    ret = (A * B) // math.gcd(A, B)
    print(ret)


Fixed submission:
import fractions

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    ret = (A * B) // fractions.gcd(A, B)
    print(ret)

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

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    print((A * B) // math.gcd(A, B))


Fixed submission:
import fractions

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    ret = (A * B) // fractions.gcd(A, B)
    print(ret)

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

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    print((A * B) // math.gcd(A, B))


Fixed submission:
import fractions

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    ret = (A * B) // fractions.gcd(A, B)
    print(ret)
Buggy python submission (verdict: Runtime Error):
def input_int:
    hoge = input().split()
    A = int(hoge[0])
    B = int(hoge[1])
    return A, B

if __name__ == "__main__":
    A, B = input_int()
    if A >=10 && B >= 10:
        ret = A * B
    else:
        ret = -1
    print(ret)


Fixed submission:

def input_int():
    hoge = input().split()
    A = int(hoge[0])
    B = int(hoge[1])
    return A, B

if __name__ == "__main__":
    A, B = input_int()
    if A <=9 and B <= 9:
        ret = A * B
    else:
        ret = -1
    print(ret)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    a = input().split(" ")
    K = int(a[0])
    S = int(a[1])
    X = Y = Z = count = 0
    for x in range(K + 1):
        for y in range(K + 1):
            for z in range(K + 1):
                xyz = x + y + z
                if xyz == S:
                    count += 1
    print(count)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a = input().split(" ")
    K = int(a[0])
    S = int(a[1])
    X = Y = Z = count = 0

    for x in range(K + 1):
        for y in range(K + 1):
            xy = x + y
            if S - xy <= K and 0 <= S - xy:
                count += 1
    print(count)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    A = input()
    op = input()
    B = input()
    x = A + op + B
#    print(A + op + B)
    y = eval(x)
    print(y)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    x = input()
    print(eval(x))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import bisect

def query_gcd(a, b):
    if b == 0:
        return a
    return query_gcd(b, a % b)

def query_gcd_3(a, b, c):
    return query_gcd(query_gcd(a, b), c)

def main():
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            for k in range(1, n + 1):
                ans += query_gcd_3(i, j, k)
    print(ans)

if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
import bisect

d = dict()

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def build_table():
    global d
    for i in range(1, 201):
        for j in range(1, 201):
            d[(i, j)] = gcd(i, j)

def query_gcd_3(a, b, c):
    g = d[(a, b)]
    return d[(g, c)]

def main():
    build_table()
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            for k in range(1, n + 1):
                ans += query_gcd_3(i, j, k)
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import math
import bisect

def main():
    a, b = map(int, input())
    A = []
    A.append(a + b)
    A.append(a - b)
    A.append(a * b)
    print(max(A))
    
if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
import bisect

def main():
    a, b = map(int, input().split())
    A = [a + b, a - b, a * b]
    print(max(A))
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import math
import bisect

def main():
    s = input()
    if s == 'A':
        print('T')
    elif s == 'C':
        print('G')
    elif s == 'G'
        print('C')
    elif s == 'T':
        print('A')
    
if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
import bisect

def main():
    s = input()
    if s == 'A':
        print('T')
    elif s == 'C':
        print('G')
    elif s == 'G':
        print('C')
    elif s == 'T':
        print('A')
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import math
import bisect

def main():
    n = int(input())
    if n % (n % 9) == 0:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
import bisect

def query(n):
    ans = 0
    for c in str(n):
        val = ord(c) - ord('0')
        ans += val
    return ans

def main():
    n = int(input())
    if n % query(n) == 0:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import math
import bisect

def main():
	n = int(input())
    print(48 - n)

if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
import bisect
 
def main():
    n = int(input())
    print(48 - n)
 
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import bisect

def solve(n):
    ans = 0
    for i in range(n + 1):
        if i ** 2 <= n:
            ans = i ** 2
    return ans

def main():
    n = int(input())
    print(solve(n))

if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
import bisect

def solve(n):
    return math.floor(math.sqrt(n)) ** 2

def main():
    n = int(input())
    print(solve(n))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import math
import bisect

def main():
    a = ''.join(input().split())
    if a % 4 == 0:
        print('YES')
    else:
        print('NO')
    
if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
import bisect

def main():
    r, g, b = map(int, input().split())
    val = r * 100 + g * 10 + b
    if val % 4 == 0:
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import math
import bisect

def main():
    A = 1, 3, 5, 7, 8, 10, 12]
    B = [4, 6, 9, 11]
    C = [2]
    x, y = map(int, input().split())
    if x in A and y in A:
        print('Yes')
    elif x in B and y in B:
        print('Yes')
    elif x in C and y in C:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()


Fixed submission:
import sys
import math
import bisect

def main():
    A = [1, 3, 5, 7, 8, 10, 12]
    B = [4, 6, 9, 11]
    C = [2]
    x, y = map(int, input().split())
    if x in A and y in A:
        print('Yes')
    elif x in B and y in B:
        print('Yes')
    elif x in C and y in C:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())

D = []
for i in range(N):
    Da,Db = (map(int,input().split()))
    if Da == Db:
        D.append(1)
    else:
        D.append(0)

for i in range(N-2):
    if D[i]==1 and D[i+1] == 1 and D[i+2] == 1:
        ans = "Yes"
        break:
    else:
        ans = "No"
print(ans)

Fixed submission:
N = int(input())

D = []
for i in range(N):
    Da,Db = (map(int,input().split()))
    if Da == Db:
        D.append(1)
    else:
        D.append(0)

for i in range(N-2):
    if D[i]==1 and D[i+1] == 1 and D[i+2] == 1:
        ans = "Yes"
        break
    else:
        ans = "No"
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

D = []
for i in range(N):
    D.append(list(map(int,input().split())))

for i in range(N):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Fixed submission:
N = int(input())

D = []
for i in range(N):
    Da,Db = (map(int,input().split()))
    if Da == Db:
        D.append(1)
    else:
        D.append(0)

for i in range(N-2):
    if D[i]==1 and D[i+1] == 1 and D[i+2] == 1:
        ans = "Yes"
        break
    else:
        ans = "No"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
H,W,M = map(int,input().split())
HW = []

Hmax_temp = [0]*(H+1)
Wmax_temp = [0]*(W+1)
Hmax = 0
Wmax = 0
for i in range(M):
	H_M,W_M = map(int,input().split())
	Hmax_temp[H_M] += 1
	Wmax_temp[W_M] += 1
	HW.append([H_M,W_M])

Hmax = max(Hmax_temp)
Wmax = max(Wmax_temp)

#H方向の走査
y_max = []
for i in range(H+1):
	if Hmax == Hmax_temp[i]:
		y_max.append(i)
		
#W方向の走査
x_max = []
for j in range(W+1):
	if Wmax == Wmax_temp[j]:
		x_max.append(j)

#爆弾設置位置に対象が存在するか？
flag = False
for i in y_max:
	for  j in x_max:
		if [i,j] not in HW:
			flag = True
			break
	if flag:
		break

#答えのセット
if flag:
	ans = Wmax + Hmax
else:
	ans = Wmax + Hmax - 1
print(ans)

Fixed submission:


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

Hmax_temp = [0]*(H+1)
Wmax_temp = [0]*(W+1)
Hmax = 0
Wmax = 0
Bomb = dict()
for i in range(M):
	H_M,W_M = map(int,input().split())
	Hmax_temp[H_M] += 1
	Wmax_temp[W_M] += 1
	Bomb[(H_M,W_M)] = 1

Hmax = max(Hmax_temp)
Wmax = max(Wmax_temp)

#H方向の走査
y_max = []
for i in range(H+1):
	if Hmax == Hmax_temp[i]:
		y_max.append(i)
		
#W方向の走査
x_max = []
for j in range(W+1):
	if Wmax == Wmax_temp[j]:
		x_max.append(j)

#爆弾設置位置に対象が存在するか？
flag = False
for i in y_max:
	for  j in x_max:
		if (i,j) not in Bomb:
			flag = True
			break
	if flag:
		break

#答えのセット
if flag:
	ans = Wmax + Hmax
else:
	ans = Wmax + Hmax - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
H,W,M = map(int,input().split())
HW = []
for i in range(M):
	HW.append(list(map(int,input().split())))

#H方向の走査
Hmax = 0
Hmax_temp = 0
y_max = []
for y in range(1,H+1):
	for j in HW:
		if y == j[0]:
			Hmax_temp += 1
	if Hmax_temp >= Hmax:
		Hmax = Hmax_temp
		y_max.append(y)
	Hmax_temp = 0

#W方向の走査
Wmax = 0
Wmax_temp = 0
x_max = []
for x in range(1,W+1):
	for j in HW:
		if x == j[1]:
			Wmax_temp += 1
	if Wmax_temp >= Wmax:
		Wmax = Wmax_temp
		x_max.append(x)
	Wmax_temp = 0

#爆弾設置位置に対象が存在するか？
flag = False
for i in y_max:
	for  j in x_max:
		if [i,j] not in HW:
			flag = True
			break
	if flag:
		break

#答えのセット
if flag:
	ans = Wmax + Hmax
elif :
	ans = Wmax + Hmax - 1
print(ans)

Fixed submission:


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

Hmax_temp = [0]*(H+1)
Wmax_temp = [0]*(W+1)
Hmax = 0
Wmax = 0
Bomb = dict()
for i in range(M):
	H_M,W_M = map(int,input().split())
	Hmax_temp[H_M] += 1
	Wmax_temp[W_M] += 1
	Bomb[(H_M,W_M)] = 1

Hmax = max(Hmax_temp)
Wmax = max(Wmax_temp)

#H方向の走査
y_max = []
for i in range(H+1):
	if Hmax == Hmax_temp[i]:
		y_max.append(i)
		
#W方向の走査
x_max = []
for j in range(W+1):
	if Wmax == Wmax_temp[j]:
		x_max.append(j)

#爆弾設置位置に対象が存在するか？
flag = False
for i in y_max:
	for  j in x_max:
		if (i,j) not in Bomb:
			flag = True
			break
	if flag:
		break

#答えのセット
if flag:
	ans = Wmax + Hmax
else:
	ans = Wmax + Hmax - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S=str(input())

ans = 0
if S == "SSS":
	ans = 0
	break
elif S == "SSR" or S == "RSS" or S = "RSR":
	ans = 1
	break
elif S == "SRR" or S == "RRS":
	ans = 2
	break
elif S == "RRR":
	ans = 3
	break
print(ans)

Fixed submission:
S=str(input())

ans = 0
if S == "SSS":
	ans = 0
elif S == "SSR" or S == "RSS" or S == "RSR" or S == "SRS":
	ans = 1
elif S == "SRR" or S == "RRS":
	ans = 2
elif S == "RRR":
	ans = 3
print(ans)