Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03804 (python)

Fixed submission:
n,m=input().split()
n,m=int(n),int(m)
a=[]
for i in range(n):
    a.append(input())

b=[]
for i in range(m):
    b.append(input())

#貪欲にやれドアホ
for i in range(n-m):
    for j in range(n-m):
        c=0
        for k in range(m):
            if b[k] == a[i+k][j:j+m]:
                c+=1
            else:
                break
        if c==m:
            break
    if c==m:
        break
#cが定義されない時(m==nでは)エラー
if a==b:
    print("Yes")
elif n==m:
    print("No")
elif c==m:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,m=input().split()
n,m=int(n),int(m)
a=[]
for i in range(n):
    a.append(input())

b=[]
for i in range(m):
    b.append(input())

#貪欲にやれドアホ
for i in range(n-m):
    for j in range(n-m):
        c=0
        for k in range(m):
            if b[k] == a[i+k][j:j+m]:
                c+=1
            else:
                break
        if c==m:
            break
    if c==m:
        break
if c==m or (n==m and a==b):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,m=input().split()
n,m=int(n),int(m)
a=[]
for i in range(n):
    a.append(input())

b=[]
for i in range(m):
    b.append(input())

#貪欲にやれドアホ
for i in range(n-m):
    for j in range(n-m):
        c=0
        for k in range(m):
            if b[k] == a[i+k][j:j+m]:
                c+=1
            else:
                break
        if c==m:
            break
    if c==m:
        break
if c==m:
    print("Yes")
else:
    print("No")
Problem p02623 (python)

Fixed submission:
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])
    
v,j=0,M

for i in range(N+1):
    if a[i]>K:
        break
    while b[j]>K-a[i]:
        j-=1
    v=max(v,i+j)

print(v)

Buggy submission (verdict: Runtime Error):
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])
    
v,j=0,M

for i in range(N+1):
    if a[i]>K:
        break
    while b[j]>K-a[i]:
        j-=1
    v=max(b,i+j)

print(v)
Problem p02688 (python)

Fixed submission:
N,K=map(int,input().split())
S=[0]*N
b=0

for i in range(K):
    d=input()
    A=list(map(int,input().split()))
    for j in A:
        S[j-1]+=1

for i in range(len(S)):
    if S[i]==0:
        b+=1
print(b)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=[]
b=0

for i in (K):
    d=input()
    A=list(map(int,input().split()))
    for i in A:
        S[i]+=1

for i in (len(S)):
    if S[i]==0:
        b+=1
print(b)
Problem p02699 (python)

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

if S>W:
    print("safe")
else:
    print("unsafe")

Buggy submission (verdict: Runtime Error):
S,W=map(int,input().split())

if S>W:
    print("safe")
else:
    print("unsafe"
Problem p02701 (python)

Fixed submission:
from collections import Counter
N=int(input())
b=0
S=[]

for i in range(0,N):
    S.append(input())
b=Counter(S)
print(len(b))

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

for i in range(0,N):
    S[i]=input()

b=collections.Counter(S)
print(len(S))
Problem p02546 (python)

Fixed submission:
S = input()
if(S[-1]=='s'):
  S=S+'es'
else:
  S=S+'s'
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
if(S[-1]=='s'):
  del S[-1]
  S=S+'es'
else:
  S=S+'s'
print(S)
Problem p02880 (python)

Fixed submission:
n=int(input())

for i in range(1,10):
    for j in range(i,10):
        if n==i*j:
            print("Yes")
            exit()
print("No")

Buggy submission (verdict: Runtime Error):
n=int(input)

for i in range(1,10):
    for j in range(i,10):
        if n==i*j:
            print("Yes")
            exit()
print("No")
Problem p02546 (python)

Fixed submission:
x=input()

if x[-1]=='s':

  x+="es"

else:

  x+="s"

  

print(x)

Buggy submission (verdict: Runtime Error):
x=input()
if x[-1]=='s'
  x+="es"
else:
  x+="s"
  
print(x)
Problem p02547 (python)

Fixed submission:
n=int(input())
count=0
ren=0
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    if count<3:
      count+=1
      ren=1
  elif count<3:
    count=0
if count>=3:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
count=0
ren=0
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    if count<3:
      count+=1
      ren=1
  else if count<3:
    count=0
if count>=3:
  print("Yes")
else:
  print("No")
Problem p02594 (python)

Fixed submission:
X = int(input())

if X>=30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
X=input()

if X >= 30:
  return Yes
else:
  return No
Problem p02984 (python)

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

sum=0
for i in range(n):
    sum=sum+a[i]

for j in range(1,n,2):
    sum=sum-a[j]*2

ans=[sum]
ch=sum
for i in range(0,n-1):
    ch=a[i]*2-ch
    ans.append(ch)

print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
    n=int(input())
    a=list(map(int,input().split()))
     
    sum=0
    for i in range(n):
        sum=sum+a[i]
     
    for j in range(1,n,2):
        sum=sum-a[j]*2
     
    ans=[sum]
    ch=sum
    for i in range(0,n-1):
        ch=a[i]*2-ch
        ans.append(ch)
     
     
    aaa=str(ans[0])
    for i in range(1,n):
        ccd=str(ans[i])
        aaa=aaa+' '+ccd
    print(aaa)
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
a=[]
for _ in range(m):
   a.append(input())

def fb(num):
    a, b = 1, 0
    for _ in range(num):
        a, b = a + b, a
    if num==-1:
        b=0
    return b 

if m==0:
    print(fb(n+1) % (10**9+7))
    
else:
    sum=fb(int(a[0]))

    for i in range(m-1):
        sum=sum*fb(int(a[i+1])-int(a[i])-1)

    sum=sum*fb(n-int(a[m-1]))

    print(sum % (10**9+7))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for _ in range(m):
   a.append(input())

def fb(num):
    a, b = 1, 0
    for _ in range(num):
        a, b = a + b, a
    if num==-1:
        b=0
    return b 

sum=fb(int(a[0]))

for i in range(m-1):
    sum=sum*fb(int(a[i+1])-int(a[i])-1)

sum=sum*fb(n-int(a[m-1]))

print(sum % (10**9+7))
Problem p02570 (python)

Fixed submission:
d, t, s = map(int, input().split())

if s*t<d:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0

for i in range (len(a)):
  for j in range (i+1,len(a)):
    ans += a[i]*a[j]

ans = ans%m

print(ans)

Buggy submission (verdict: Runtime Error):
d = int(input())
t = int(input())
s = int(input())

if s*t<d:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
d = int(input())
t = int(input())
s = int(input())

if s*t<d:
  print('No')
else:
  print('Yes')
Problem p02572 (python)

Fixed submission:
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in a:
  s -= i
  ans += s*i

ans = ans%m

print(ans)

Buggy submission (verdict: Runtime Error):
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in a:
s -=i
ans += s*i
s+=i

ans = ans%m

print(ans)

Buggy submission (verdict: Runtime Error):
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in range a:
s -=i
ans += s*i
s+=i

ans = ans%m

print(ans)
Problem p02577 (python)

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

Buggy submission (verdict: Runtime Error):
n = input()
if n%9 == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()
ifn%9 == 0:
  print('Yes')
else:
  print('No')
Problem p02596 (python)

Fixed submission:
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break

print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  ans = -1
elif 7%k == 0:
  ans = 1
else:
  for i in range(k)
    ans +=1
    x = x*10+7
    if x%k == 0:
      break


print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  ans = -1
elif 7%k == 0:
  ans = 1
else:
  for i in range(k)
    ans +=1
    x = x*10+7
    if x%k == 0:
      break


print(ans)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c=[]
ac = 0
bc = 0
ans = 0
t = 0
while t<k:
  if bc<=m-1 and ac <=n-1:
    if a[ac] > b[bc]:
      t += b[bc]
      bc +=1
      c.
    else:
      t+= a[ac]
      ac+=1
  elif ac >= n and bc<=m-1:
    t += b[bc]
    bc +=1
    print(t)
  elif bc == m and ac<=n-1:
    t+= a[ac]
    ac+=1
  ans+=1

if t>k:
  ans -=1
  
print(ans)
Problem p02659 (python)

Fixed submission:
a,b = input().split()
a = int(a)
b = int(b.replace(".",""))
print(int(a*b//100))

Buggy submission (verdict: Runtime Error):
a,b = map(float,input().split())
b = int(b.replace(".",""))
print(int(a*b//100))

Buggy submission (verdict: Runtime Error):
a,b = map(float,input().split())
b *=100
print(int(a*b//100))a

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())

print(math.floor(a*b))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input(),split())

print(math.floor(a*b))
Problem p02753 (python)

Fixed submission:
s =input()
if s=='AAA' or s=='BBB':
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
s =input()
if s=='AAA' or s=='BBB:
  print('No')
else:
  print('Yes')
Problem p02766 (python)

Fixed submission:
n,k=map(int,input().split())
ans=0
while n>0:
  n = n//k
  ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
if n<k:
  print(1)
  exit()
for i in range (100):
  if k**i==n:
    print(i)
  else:
     k**i < n <k**(i+1)
    print(i+1)
Problem p02689 (python)

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for m in range(M)]
AB = list(map(list, set(map(tuple, AB))))

i = []
for m in range(len(AB)):
    a = AB[m][0]
    b = AB[m][1]
    if H[a-1] > H[b-1]:
        i.append(b-1)
    elif H[a-1] < H[b-1]:
        i.append(a-1)
    else:
        i.append(a-1)
        i.append(b-1)

i = list(set(i))
print(len(H)-len(i))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for m in range(M)]
AB = list(map(list, set(map(tuple, AB))))

i = []
for m in range(len(AB)):
    a = AB[m][0]
    b = AB[m][1]
    if H[a-1] >= H[b-1]:
        i.append(b-1)
    elif H[a-1] <= H[b-1]:
        i.append(a-1)

i = list(set(i))
for x in i:
    H[i] = 0

cnt = H.count(0)
print(len(H)-cnt)
Problem p02773 (python)

Fixed submission:
import collections
N = int(input())
S = [input() for n in range(N)]

cnt = collections.Counter(S)
m = max(cnt.values())

ans = []
for k, v in cnt.items():
    if v == m:
        ans.append(k)
        
ans.sort()
for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
S = [input() for n in range(N)]

cnt = collections.Counter(S)
m = max(cnt.values())

for k, v in dict(sorted(cnt.items())):
    if v == m:
        print(k)
Problem p02881 (python)

Fixed submission:
N = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

ans = make_divisors(N)
result = []
if len(ans)%2 == 0:
    for i, j in zip(range(0, int(len(ans)/2)), reversed(range(int(len(ans)/2), len(ans)))):
        result.append(int(ans[i]+ans[j])-2)
else:
    x = ans[int(len(ans)/2)]
    result.append((x-1)*2)
print(min(result))

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

ans = sympy.divisors(N)
x = ans[int(len(ans)/2)-1]
y = ans[int(len(ans)/2)]

print((x-1)+(y-1))

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

ans = sympy.divisors(N)
x = ans[int(len(ans)/2)-1]
y = ans[int(len(ans)/2)]

print((x-1)+(y-1))
Problem p03705 (python)

Fixed submission:
import sys
N, A, B = map(int, input().split())

if A > B:
    print(0)
    sys.exit(0)
if N == 1:
    if A == B:
        print(1)
    else:
        print(0)
    sys.exit(0)

x = B*(N-1)+A
n = A*(N-1)+B
print(x-n+1)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

if A > B:
    print(0)
    sys.exit(0)
if N == 1:
    if A == B:
        print(1)
    else:
        print(0)
    sys.exit(0)

x = B*(N-1)+A
n = A*(N-1)+B
print(x-n+1)
Problem p02570 (python)

Fixed submission:
in1 = list(map(int,input().split()))
D = in1[0]
T = in1[1]
S = in1[2]

if D <= T * S:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

max = (10 ** 9) + 7

#入力配列の総和
line = 0
for i in range (n):
    line += a[i]

#a11, a22, ...対角線要素の総和
rem = 0
for i in range(n):
    rem += a[i]*a[i]

sum = ((line*line) - rem) // 2

ans = sum % max

print(ans)

Buggy submission (verdict: Runtime Error):
in1 = list(map(int,input().split()))
D = in1[0]
T = in1[1]
S = in1[2]

if D =< T * S:
    print('Yes')
else:
    print('No')
Problem p02572 (python)

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

max = (10 ** 9) + 7

#一列の総和
wa = 0
for i in range (n):
    wa += a[i]

#a11, a22, ...の総和
rem = 0
for i in range(n):
    rem += a[i]*a[i]

sum = ((wa*wa) - rem) // 2

ans = sum % max

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

max = (10 ** 9) + 7

sum = 0
for i in range (n-1):
    for j in range (n):
        if i > j:
            continue
        if i != j:
            sum += a[i]*a[j]
#        if sum > max:
#            sum - max

if sum > max:
    ans = sum % max

print(ans)
Problem p02597 (python)

Fixed submission:
#参考：https://marco-note.net/abc-174-work-log/
n = int(input())
c = input()

R=c.count('R')
cnt = 0

for i in range(R):
    if c[i]=="R":
        cnt += 1
print(R-cnt)

Buggy submission (verdict: Runtime Error):
#参考：https://marco-note.net/abc-174-work-log/
n = int(input())
c = input()

R.count('R')
cnt = 0

for i in range(R):
    if R[i]=="R":
        cnt += 1
print(R-cnt)
Problem p02577 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
if(n%9==0):
  print('Yes')
else print('No')
Problem p03036 (python)

Fixed submission:
r,d,x=map(int,input().split())
for i in range(10):
  x=x*r-d
  print(x)

Buggy submission (verdict: Runtime Error):
r,d,x=map(int,input().split)
for i in range(10):
  x=x*r-d
  print(x)
Problem p03015 (python)

Fixed submission:
mod = 1000000007
L = input()
ans = 1
n = len(L)
i = n - 1
while i >=0:
    n0 = 0
    n1 = 0
    while L[i] == '0':
        n0 += 1
        i -= 1
    while L[i] == '1':
        n1 += 1
        i -= 1
        if i < 0:
            break
    ans *= pow(2, n1, mod)
    ans += (pow(3, n1, mod) - pow(2, n1, mod)) * pow(3, n - i - 1 - n1, mod)
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
mod = 1000000007

def solve(L):
    n = len(L)
    if n == 0:
        return 1
    n1 = 0
    for i in range(n):
        if L[i] == '1':
            n1 += 1
        else:
            break
    n0 = 0
    for i in range(n1, n):
        if L[i] == '0':
            n0 += 1
        else:
            break
    return (pow(2, n1, mod) * solve(L[n1 + n0:]) + (pow(3, n1, mod) - pow(2, n1, mod)) * pow(3, n - n1, mod)) % mod

L = input()
print(solve(L))

Buggy submission (verdict: Runtime Error):
def solve(L):
    n = len(L)
    if n == 0:
        return 1
    n1 = 0
    for i in range(n):
        if L[i] == '1':
            n1 += 1
        else:
            break
    n0 = 0
    for i in range(n1, n):
        if L[i] == '0':
            n0 += 1
        else:
            break
    return (2 ** n1 * solve(L[n1 + n0:]) + (3 ** n1 - 2 ** n1) * 3 ** (n - n1)) % 1000000007

L = input()
print(solve(L))
Problem p03209 (python)

Fixed submission:
def ans(n, x):
	if n < 0:
		return 0
	if x < 1:
		return 0
	if x < 2 ** (n + 1) - 1:
		return ans(n - 1, x - 1)
	if x == 2 ** (n + 1) - 1:
		return 2 ** n
	return 2 ** n + ans(n - 1, x - 2 ** (n + 1) + 1)
N, X = map(int, input().split())
print(ans(N, X))

Buggy submission (verdict: Runtime Error):
def ans(n, x):
	if x < 1:
		return 0
	if x < 2 ** (n + 1) - 1:
		return ans(n - 1, x - 1)
	if x == 2 ** (n + 1) - 1:
		return 2 ** n
	return 2 ** n + ans(n - 1, x - 2 ** (n + 1) + 1)
N, X = map(int, input().split())
print(ans(N, X))

Buggy submission (verdict: Runtime Error):
def ans(n, x):
	if x == 0:
		return 0
	if x < 2 ** (n + 1) - 1:
		return ans(n - 1, x - 1)
	if x == 2 ** (n + 1) - 1:
		return 2 ** n
	return 2 ** n + ans(n - 1, x - 2 ** (n + 1) + 1)
N, X = map(int, input().split())
print(ans(N, X))
Problem p03232 (python)

Fixed submission:
def congruence(x, y): #=(a, b) such that ax+by=gcd(x,y)
  if x < y:
    (a, b) = congruence(y, x)
    return (b, a)
  z = x % y
  if z == 0:
    return (0, 1)
  (c, d) = congruence(y, z)
  return (d, (c - int(x / y) * d) % 1000000007)

inverse_sum = {1: 1}
for i in range(2, 100001):
  inverse_sum[i] = (inverse_sum[i - 1] + congruence(1000000007, i)[1]) % 1000000007

N = int(input())
A = list(map(int, input().split()))

N_factorial = 1
for i in range(1, N + 1):
  N_factorial = (N_factorial * i) % 1000000007

ans = 0
for i in range(N):
  ans = (ans + (inverse_sum[i + 1] + inverse_sum[N - i] - 1) * A[i] * N_factorial) % 1000000007

print(ans)

Buggy submission (verdict: Runtime Error):
def congruence(x, y): #=(a, b) such that ax+by=gcd(x,y)
  if x < y:
    (a, b) = congruence(y, x)
    return (b, a)
  z = x % y
  if z == 0:
    return (0, 1)
  (c, d) = congruence(y, z)
  return (d, (c - int(x / y) * d) % 1000000007)

inverse_sum = {1: 1}
for i in range(2, 100000):
  inverse_sum[i] = (inverse_sum[i - 1] + congruence(1000000007, i)[1]) % 1000000007

N = int(input())
A = list(map(int, input().split()))

N_factorial = 1
for i in range(1, N + 1):
  N_factorial = (N_factorial * i) % 1000000007

ans = 0
for i in range(N):
  ans = (ans + (inverse_sum[i + 1] + inverse_sum[N - i] - 1) * A[i] * N_factorial) % 1000000007

print(ans)
Problem p02577 (python)

Fixed submission:
n=input()

nn=0
for i in range(len(n)):
    nn+=int(n[i])

if nn%9==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):

import sys
input = sys.stdin.readline

n=input()

nn=0
for i in range(len(n)):
    nn+=int(n[i])

if nn%9==0:
    print("Yes")
else:
    print("No")
Problem p02580 (python)

Fixed submission:

import sys
input=sys.stdin.readline

h,w,m=map(int,input().split())
hs=dict()
ws=dict()
hw=set()
for i in range(m):
    hi,wi=map(int,input().split())
    if hi-1 in ws:
        ws[hi-1]+=1
    else:
        ws[hi-1]=1
    if wi-1 in hs:
        hs[wi-1]+=1
    else:
        hs[wi-1]=1
    hw.add((hi-1,wi-1))    

wmax=max(list(ws.values()))
hh=[]
for ik,wv in ws.items():
    if wv==wmax:
        hh.append(ik)
hmax=max(list(hs.values()))
ww=[]
for jk,hv in hs.items():
    if hv==hmax:
        ww.append(jk)
        
for hi in hh:
    for wi in ww:
        if  not ((hi,wi) in hw):
#            print(hi,wi)
            print(wmax+hmax) 
            sys.exit()
print(wmax+hmax-1)

Buggy submission (verdict: Runtime Error):
h,w,m=map(int,input().split())
hw=[[0]*w for i in range(h)]
for i in range(m):
    hi,wi=map(int,input().split())
    hw[hi-1][wi-1]=1    

ws=[0]*h
for i in range(h):
    ws[i]=0
    for j in range(w):
        ws[i]+=hw[i][j]
hs=[0]*w
for j in range(w):
    hs[j]=0
    for i in range(h):
        hs[j]+=hw[i][j]
        
hwmax=0
for i in range(h):
    for j in range(w):
        if hw[i][j]==1:
            x=ws[i]+hs[j]-1
        else:
            x=ws[i]+hs[j]
#        print(i,j,x)
        hwmax=max(hwmax,x)
        
print(hwmax)

Buggy submission (verdict: Runtime Error):

import sys
input=sys.stdin.readline

h,w,m=map(int,input().split())
hw=[[0]*w for i in range(h)]
for i in range(m):
    hi,wi=map(int,input().split())
    hw[hi-1][wi-1]=1    

ws=[0]*h
for i in range(h):
    ws[i]=0
    for j in range(w):
        ws[i]+=hw[i][j]
hs=[0]*w
for j in range(w):
    hs[j]=0
    for i in range(h):
        hs[j]+=hw[i][j]
        
hwmax=0
for i in range(h):
    for j in range(w):
        if hw[i][j]==1:
            x=ws[i]+hs[j]-1
        else:
            x=ws[i]+hs[j]
#        print(i,j,x)
        hwmax=max(hwmax,x)
        
print(hwmax)
Problem p02629 (python)

Fixed submission:
n=int(input())

a="abcdefghijklmnopqrstuvwxyz"
aa=list(a)

stra=""
kk=n
for i in range(15):
    ki=(kk-1)%26+1
    if ki!=0:
        stra=aa[ki-1]+stra    
    else:
        stra=aa[25]+stra    
    kk=(kk-ki)//26
#    print(kk,ki,stra)
    if kk==0:
        break
    
print(stra)

Buggy submission (verdict: Runtime Error):

n=int(input())

a="abcdefghijklmnopqrstuvwxyz"
aa=list(a)

stra=""
kk=n
for i in range(15):
    ki=kk%26
    if ki!=0:
        stra=aa[ki-1]+stra    
    else:
        stra=aa[26]+stra    
    kk=(kk-ki)//26
#    print(kk,ki,stra)
    if kk==0:
        break
    
print(stra)
Problem p02773 (python)

Fixed submission:
n=int(input())
s=[]
for i in range(n):
    s.append(input())

s.sort()

t=[]
icnt=0
t.append([1,s[0]])
for i in range(1,len(s)):
    if s[i-1]==s[i]:
        t[icnt][0]=t[icnt][0]+1
    else:
        icnt=icnt+1
        t.append([1,s[i]])
        
#print(t)
t.sort(reverse=True)
#print(t)

u=[]
u.append(t[0][1])
for i in range(len(t)-1):
    if t[i][0]==t[i+1][0]:
        u.append(t[i+1][1])
    else:
        break

if len(u)==0:
    print(u[0])    
else:
    u.sort()
    for i in range(len(u)):
        print(u[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
for i in range(n):
    s.append(input())

#n=7
#s.append("beat")
#s.append("vet")
#s.append("beet")
#s.append("bed")
#s.append("vet")
#s.append("bet")
#s.append("beet")

s.sort()

t=[]
icnt=0
t.append([1,s[0]])
for i in range(1,len(s)):
    if s[i-1]==s[i]:
        t[icnt][0]=t[icnt][0]+1
    else:
        icnt=icnt+1
        t.append([1,s[i]])
        
#print(t)
t.sort(reverse=True)
#print(t)

u=[]
u.append(t[0][1])
for i in range(len(t)):
    if t[i][0]==t[i+1][0]:
        u.append(t[i+1][1])
    else:
        break
    
u.sort()

for i in range(len(u)):
    print(u[i])
Problem p02829 (python)

Fixed submission:
icase=0
if icase==0:
    a=int(input())
    b=int(input())
    print(6-a-b)

Buggy submission (verdict: Runtime Error):
icase=0
if icase==0:
    a=input()
    b=input()
    print(6-a-b)