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

Fixed submission:
n,m=map(int,input().split())
a=set()
for i in range(m):
    ai=int(input())
    a.add(ai)


mod=10**9+7

t=[0]*(n+1)
t[0]=1

if 1 in a:
    t[1]=0
else:
    t[1]=1

for i in range(2,n+1):
    if i in a:
        t[i]=0
    else:
        t[i]=(t[i-1]+t[i-2])%mod

print(t[n])

Buggy submission (verdict: Runtime Error):

n,m=map(int,input().split())
a=[True]*n
for i in range(m):
    a[int(input())]=False

mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
if a[1]:
    dp[1]=1
else:
    dp[1]=0
for nn in range(2,n):
    if a[nn]:
        dp[nn]=(dp[nn-1]+dp[nn-2])%mod
    else:
        dp[nn]=0
if n>=2:
    dp[n]=(dp[n-1]+dp[n-2])%mod

print(dp[n])

Buggy submission (verdict: Runtime Error):

n,m=map(int,input().split())
a=[True]*n
for i in range(m):
    a[int(input())]=False

mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
if a[1]:
    dp[1]=1
else:
    dp[1]=0
for nn in range(2,n):
    if a[nn]:
        dp[nn]=(dp[nn-1]+dp[nn-2])%mod
    else:
        dp[nn]=0
dp[n]=(dp[n-1]+dp[n-2])%mod

print(dp[n])

Buggy submission (verdict: Runtime Error):
def kjou(kkk):
    ka=1
    for km in range(kkk):
        ka=ka*(km+1)    
    return ka

def fcof(ad):
    k=ad//2
    if k==0 :
        return 1
    kcnt=0
    for kk in range(k+1):
        ar=ad-(kk)*2
        dk=kjou(kk+ar)/kjou(kk)/kjou(ar)
        kcnt=kcnt+ dk
        print(ad,k,kk,ar)
    return kcnt       

n,m=map(int,input().split())
n=20
m=2
a1=int(input())
a1=3
icnt=1
for i in range(m):
    a2=int(input())
    a2=11
    ad=a2-a1-1
    if ad<=0:
        print(0)
    fcof1=fcof(ad) 
    icnt=icnt*fcof1
    a1=a2
    print(icnt)
Problem p03107 (python)

Fixed submission:
s=input()
nall=len(s)
nzero=s.count("0")
none=nall-nzero
if nall==0:
    print(0)
elif none<=nzero:
    print(none*2)
else:
    print(nzero*2)

Buggy submission (verdict: Runtime Error):
s=input()
nall=len(s)
nzero=s.count("0")
none=nall-nzero
if n==0:
    print(0)
elif none<=nzero:
    print(nall-none*2)
else:
    print(nall-nzero*2)
Problem p03252 (python)

Fixed submission:
s=input()
t=input()

st=[]
ts=[]
for i in range(len(s)):
    st.append([s[i],t[i]])
    ts.append([t[i],s[i]])
#print(st)
st.sort()
ts.sort()
#print(st)
    
yesno="Yes"
for i in range(len(st)-1):
    sj,tj=st[len(st)-i-1]
    sk,tk=st[len(st)-i-2]
    if sj==sk and tj!=tk:
        yesno="No"
        break
    tj,sj=ts[len(ts)-i-1]
    tk,sk=ts[len(ts)-i-2]
    if tj==tk and sj!=sk:
        yesno="No"
        break
    
print(yesno)

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

st=[]
for i in range(len(s)):
    st.append([s[i],t[i]])
#print(st)
st.sort()
#print(st)
    
for i in range(len(st)-1):
    if st[len(st)-i-1]==st[len(st)-i-2]:
        del st[len(st)-i-1]
        
#print(st)

yesno="Yes"
for i in range(len(st)-1):
    sj,tj=st[len(st)-i-1]
    sk,tk=st[len(st)-i-2]
    if sj==sk and tj!=tk:
        yesno="No"
        break
    
print(yesno)
Problem p03805 (python)

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

for i in range(m):
    ai,bi=map(int,input().split())
    a.append([ai,bi])
              
ni=[0]*n
nii=[]
    
def pathm(n,a,bi,pcnt,ni):
    if n==1:
        pcnt=pcnt+1
#        print("2:","n:",n,"bi:",bi,"pcnt:",pcnt)
        return pcnt
    else:
        n=n-1
        nii.append(bi)
        for mm in range(m):
            if a[mm][0]==bi and not a[mm][1] in nii:
#            if a[mm][0]==bi :
                ni[a[mm][1]-1]=1
#                print("1:","n:",n,"mm:",mm,"a[mm][1]:",a[mm][1],"pcnt:",pcnt)
                pcnt=pathm(n,a,a[mm][1],pcnt,ni)
            if a[mm][1]==bi and not a[mm][0] in nii:
#            if a[mm][1]==bi  and ni[a[mm][0]-1]==0 :
                ni[a[mm][0]-1]=1
#                ni[mm]=1
#                print("1:","n:",n,"mm:",mm,"a[mm][0]:",a[mm][0],"pcnt:",pcnt)
                pcnt=pathm(n,a,a[mm][0],pcnt,ni)
        nii.pop()
        return pcnt       
                
pcnt=0
pcnt1=pathm(n,a,1,pcnt,ni)
print(pcnt1)

Buggy submission (verdict: Runtime Error):
q=[]
qq=[]
def dfs(j,q,icnt,count,n,qq):
    if len(qq)==n:
        count+=1
#        print("1",n,j,icnt,count,q[j],qq)
        return count
    icnt+=1
    
    for j2 in q[j]:
        if not j2 in qq:
            qq.append(j2)
#            print("2",n,j,icnt,count,q[j],qq)
            count=dfs(j2,q,icnt,count,n,qq)
            qq.pop()
#        print("3",n,j,icnt,count,q[j],qq)
    return count

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

#n=3
#m=3
#ab=[[1,2],[1,3],[2,3]]

#n=7
#m=7
#ab=[[1,3],[2,7],[3,4],[4,5],[4,6],[5,6],[6,7]]

q=[[]*2 for i in range(n)]
for i in range(m):
    if not q[ab[i][1]-1] in q[ab[i][0]-1]:
        q[ab[i][0]-1].append(ab[i][1]-1)    
    if not q[ab[i][0]-1] in q[ab[i][1]-1]:
        q[ab[i][1]-1].append(ab[i][0]-1)    
#print(q)    

count=0
j=0
qq=[j]
icnt=1
count=dfs(j,q,icnt,count,n,qq)
print(count)

Buggy submission (verdict: Runtime Error):
q=[]
qq=[]
def dfs(j,q,icnt,count,n,qq):
    if len(qq)==n:
        count+=1
#        print("1",n,j,icnt,count,q[j],qq)
        return count
    icnt+=1
    
    for j2 in q[j]:
        if not j2 in qq:
            qq.append(j2)
#            print("2",n,j,icnt,count,q[j],qq)
            count=dfs(j2,q,icnt,count,n,qq)
            qq.pop()
#        print("3",n,j,icnt,count,q[j],qq)
    return count

n,m=map(int,input().split())
q=[[0]*2 for i in range(m)]
for i in range(m):
    q[i]=set(map(int,input().split()))

#n=3
#m=3
#ab=[[1,2],[1,3],[2,3]]

#n=7
#m=7
#ab=[[1,3],[2,7],[3,4],[4,5],[4,6],[5,6],[6,7]]

q=[[]*2 for i in range(n)]
for i in range(m):
    if not q[ab[i][1]-1] in q[ab[i][0]-1]:
        q[ab[i][0]-1].append(ab[i][1]-1)    
    if not q[ab[i][0]-1] in q[ab[i][1]-1]:
        q[ab[i][1]-1].append(ab[i][0]-1)    
#print(q)    

count=0
j=0
qq=[j]
icnt=1
count=dfs(j,q,icnt,count,n,qq)
print(count)
Problem p02699 (python)

Fixed submission:
S,W=map(int,input().split())
if(S<=W):
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
S=input()
S1=int(S)
#print(len(S))
S_count=len(S)
sum=0
sum1=0
ii=0
jj=4
SSSS=int(S_count)
for i in range(S_count):
  sum1+=i
#print(sum1)
for i in range(sum1):
  if ii==int(S_count-1):
    break
  SS=S[ii:jj]
  #print(SS)
  SSS=int(SS)
  if SSS%2019==0:
    sum+=1
  jj+=1
  if jj==int(S_count+1):
    ii+=1
    if ii>=4:
      jj=ii+1
    else:
      jj=4
  
print(sum)
Problem p02723 (python)

Fixed submission:
s1,s2,s3,s4,s5,s6=input()
#print(S)
ans='No'
if(s3==s4):
  if(s5==s6):
    ans='Yes'
else:
  ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
s1,s2,s3,s4,s5,s6=input()
#print(S)
if(s3==s4):
  if(s5==s6):
    ans='Yes'
else:
  ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
s1,s2,s3,s4,s5,s6=input()
#print(S)
if(s3==s4):
  if(s5==s6):
    ans='Yes'
else:
  ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
s1,s2,s3,s4,s5,s6=input()
#print(S)
if(s3==s4):
  if(s5==s6):
    ans='Yes'
else:
  ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
s1,s2,s3,s4,s5,s6=input()
#print(S)
if(s3==s4):
  if(s5==s6):
    ans='Yes'
else:
  ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
s1,s2,s3,s4,s5,s6=input()
#print(S)
if(s3==s4):
  if(s5==s6):
    ans='Yes'
else:
  ans='No'
print(ans)
Problem p02572 (python)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]

s = sum(a)
ans = 0
mod = 10 ** 9 + 7

for i in range(n-1):
    s -= a[i]
    ans += a[i] * s % mod

ans = ans % mod
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]

ans = 0
for i in range(n-1):
    for j in range(n-1-i):
        hoge = a[i]*a[i+1+j] % 1000000007
        ans = ans + hoge
        if ans >= 1000000007:
            ans = ans - 1000000007

print(ans)
Problem p02598 (python)

Fixed submission:
import math

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

m = 1
M = max(A)

while(M-m>0):
    mm = 0

    mid = (M+m)//2
    for i in range(N):
        mm += math.ceil(A[i]/mid)-1

    if mm>K:
        m = mid+1
    else:
        M = mid

print(math.ceil(m))

Buggy submission (verdict: Runtime Error):
import math

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

m = 0
M = max(A)

while(M-m>0):
    mm = 0

    mid = (M+m)//2
    for i in range(N):
        mm += math.ceil(A[i]/mid)-1

    if mm>K:
        m = mid+1
    else:
        M = mid

print(math.ceil(m))
Problem p02819 (python)

Fixed submission:
n = int(input())
x = 10**6
li = [True for i in range(x+10)]
li[0] = False
li[1] = False

for i in range(int(x**0.5)+1):
    if li[i]:
        m = 2
        while(i*m<=x):
            li[i*m] = False
            m += 1
#print(li)
for i in range(x):
    if i>=n and li[i]:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
n = int(input())
x = 10**6
li = [True for i in range(x)]
li[0] = False
li[1] = False

for i in range(int(x**0.5)+1):
    if li[i]:
        m = 2
        while(i*m<=x):
            li[i*m] = False
            m += 1
#print(li)
for i in range(x):
    if i>=n and li[i]:
        print(i)
        break
Problem p02829 (python)

Fixed submission:
a = []
a.append(int(input()))
a.append(int(input()))

for i in range(1,4):
    if not(i in a):
        print(i)

Buggy submission (verdict: Runtime Error):
a = list(int(input()))
a.append(int(input()))

for i in range(1,4):
    if not(i in a):
        print(i)
Problem p02987 (python)

Fixed submission:
s = input()

a = []
for i in s:
    a.append(i)

cnt1 = 0
cnt2 = 0
memo =24
for i in range(1,4):
    if a[0] == a[i]:
        memo = i
        break;
    

ans = "No"
if(memo != 24):
    for i in range(1,4):
        for j in range(i+1,4):
            if (i != memo and j != memo):
                if a[i] == a[j]:
                    if a[0] != a[i]:
                        ans = "Yes"
                        break;


print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
mod = 10**9+7

a = [1 for i in range(2010)]

memo = 1
for i in range(1,2001):
    memo *= i
    a[i] = memo



for i in range(1,k+1):
    if not((n-k+2 > i)):
        print(0)

    else:
        memo1 = a[n-k+1]*a[k-1]
        memo2 = a[i]*a[n-k+1-i]*a[i-1]*a[k-i]

        ans2 = memo1//memo2
        print(ans2%mod)

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



for i in range(1,k+1):
    if (n-k < i):
        print(1)

    else:
        total = 1
        total2 = 1
        total3 = 1
        for j in range(i+1):
            total *= n-k+1-j
            total2 *= j+1
            total3 = int(total/total2)
            
        ww = i**(k-i-2)
        ans = ww * total3

        ans2 = ans % 1000000007

        print(ans2)
Problem p03013 (python)

Fixed submission:
#bin/usr/env python3

n,m = map(int, input().split())
mod = 10**9+7

br = [0 for i in range(n+2)]
for i in range(m):
    a = int(input())
    br[a] = 1

can = [0 for i in range(n+2)]

can[1] = 1
can[2] = 2

if br[1] == 1:
    can[1] = 0
    can[2] = 1
if br[2] == 1:
    can[1] = 1
    can[2] = 0
if br[1] == 1 and br[2] == 1:
    can[1] = 0
    can[2] = 0

for i in range(3, n+1):
    if br[i]!=1 :
        can[i] = (can[i-1] + can[i-2])%mod
    
    else:
        can[i] = 0

print(can[n])

Buggy submission (verdict: Runtime Error):
#bin/usr/env python3

n,m = map(int, input().split())
mod = 10**9+7

br = [0 for i in range(n+1)]
for i in range(m):
    a = int(input())
    br[a] = 1

can = [0 for i in range(n+1)]

can[1] = 1
can[2] = 2

if br[1] == 1:
    can[1] = 0
    can[2] = 1
if br[2] == 1:
    can[1] = 1
    can[2] = 0

for i in range(3, n+1):
    if br[i]!=1 :
        can[i] = (can[i-1] + can[i-2])%mod
    
    else:
        can[i] = 0

print(can[n])
Problem p03017 (python)

Fixed submission:
n,a,b,c,d = map(int,input().split())
sub = "#"+input()
s = list(sub)

con = True
for i in range(a,d+1):
    if s[i-1]=="#" and s[i]=="#":
        print("No")
        con = False
        break

if (con):
    if (c<b) or (c<d):
        print("Yes")
        con = False

if (con):
    for i in range(b-1,d):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print("Yes")
            con = False
            break

if (con):
    print("No")

Buggy submission (verdict: Runtime Error):
n,a,b,c,d = map(int,input().split())
sub = "#"+input()
s = list(sub)

con = True
for i in range(a,d+1):
    if s[i-1]=="#" and s[i]=="#":
        print("No")
        con = False
        break

if (con):
    if (c<b) or (c<d):
        print("Yes")
        con = False

if (con):
    for i in range(b-1,c):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print("Yes")
            con = False
            break

if (con):
    print("No")

Buggy submission (verdict: Runtime Error):
#bin/usr/env python3

n, a, b, c, d = map(int,input().split())
s = input()
s_li = []

for i in s:
    s_li.append(i)

last = c
reach = True

if last < d:
    last = d

if c < d:
    for i in range(a-1,last-1):
        if(s_li[i] == "#" and s_li[i+1] == "#"):
            reach = False
            break

elif d < c:
    for i in range(a-1,last-1):
        if(s_li[i] == "#" and s_li[i+1] == "#"):
            reach = False
            break
        reach = False

        if(s_li[i+2] == "." and s_li[i] == "." and s_li[i+1] == "."):
            reach = True
            break

if (reach):
    print("Yes")
else:
    print("No")
Problem p03135 (python)

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

T, X = map(int,input().split())

print(T/X)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

N = int(input())
L = input().split()
L_num = []

for i in range(len(L)):
    L_num.append(int(L[i]))

L_num.sort()

total = 0
for j in range(len(L) - 1):
    total += L_num[j]

if total <= L_num[N-1]:
    print("No")
else:
    print("Yes")
Problem p03221 (python)

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

li = [[] for i in range(n)]
memo = [0 for i in range(m)]

def search(p,y):
    fst = 0
    lst = len(li[p])-1

    while(fst <= lst):
        mid = (fst+lst)//2
        if li[p][mid] == y:
            return mid

        elif li[p][mid] < y:
            fst = mid+1
        
        elif li[p][mid] > y:
            lst = mid-1


for i in range(m):
    p,y=map(int,input().split())
    p-=1
    memo[i] = [p,y]
    li[p].append(y)

for i in range(n):
    li[i].sort()

for i in range(m):
    a = memo[i][0]+1
    b = search(memo[i][0],memo[i][1])
    print("{:0>6}".format(a),end ="")
    print("{:0>6}".format(b+1))

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

li = [[] for i in range(n+10)]
memo = [0 for i in range(m+10)]

def search(p,y):
    fst = 0
    lst = len(li[p])-1

    while(fst <= lst):
        mid = (fst+lst)//2
        if li[p][mid] == y:
            return mid

        elif li[p][mid] < y:
            fst = mid+1
        
        elif li[p][mid] > y:
            lst = mid-1


for i in range(m):
    p,y=map(int,input().split())
    memo[i] = [p,y]
    li[p].append(y)

for i in range(n):
    li[i].sort()

for i in range(m):
    a = memo[i][0]
    b = search(memo[i][0],memo[i][1])
    print("{:0>6}".format(a),end ="")
    print("{:0>6}".format(b+1))

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

li = [[] for i in range(n+10)]
memo = [0 for i in range(m+10)]

def search(p,y):
    fst = 0
    lst = len(li[p])-1

    while(fst <= lst):
        mid = (fst+lst)//2
        if li[p][mid] == y:
            return mid

        elif li[p][mid] < y:
            fst = mid+1
        
        elif li[p][mid] > y:
            lst = mid-1


for i in range(m):
    p,y=map(int,input().split())
    memo[i] = [p,y]
    li[p].append(y)

for i in range(n):
    li[i].sort()

for i in range(m):
    a = memo[i][0]
    b = search(memo[i][0],memo[i][1])
    print("{:0>6}".format(a),end ="")
    print("{:0>6}".format(b+1))

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

li = [[] for i in range(n+1)]
memo = [0 for i in range(m)]

def search(p,y):
    fst = 0
    lst = len(li[p])-1

    while(fst <= lst):
        mid = (fst+lst)//2
        if li[p][mid] == y:
            return mid

        elif li[p][mid] < y:
            fst = mid+1
        
        elif li[p][mid] > y:
            lst = mid-1


for i in range(m):
    p,y=map(int,input().split())
    memo[i] = [p,y]
    li[p].append(y)

for i in range(n):
    li[i].sort()

for i in range(m):
    a = memo[i][0]
    b = search(memo[i][0],memo[i][1])
    print("{:0>6}".format(a),end ="")
    print("{:0>6}".format(b+1))
Problem p03804 (python)

Fixed submission:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))


N,M = map(int,input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]

flg1 = 1
flg2 = 0
for i in range(N-M+1):
    if flg2:
        break
    for j in range(N-M+1):
        if flg2:
            break
        flg1 = 1
        
        for k in range(M):
            if not(flg1):
                break
            for l in range(M):
                if A[i+k][j+l]==B[k][l]:
                    continue
                else:
                    flg1 = 0
        else:
            if flg1:
                print("Yes")
                flg2 = 1
else:
    if not(flg2):
        print("No")

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


N,M = map(int,input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]

flg1 = 1
flg2 = 0
for i in range(N):
    if flg2:
        break
    for j in range(N):
        if flg2:
            break
        flg1 = 1
        
        for k in range(M):
            if not(flg1):
                break
            for l in range(M):
                if A[i+k][j+l]==B[k][l]:
                    continue
                else:
                    flg1 = 0
        else:
            print("Yes")
            flg2 = 1
else:
    print("No")
Problem p02596 (python)

Fixed submission:
K=int(input())

L=9*K//7 if K%7==0 else 9*K

if L%2==0 or L%5==0:
    print('-1')

else:
    surplus=1
    for i in range(1,L):
        surplus=(surplus*10)%L
        if surplus==1:
            print(i)
            break

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

L=9*K/7 if K%7==0 else 9*K

if L%2==0 or L%5==0:
    print('-1')

else:
    surplus=1
    for i in range(1,L):
        surplus=(surplus*10)%L
        if surplus==1:
            print(i)
            break
    print('-1')

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

L=9*K/7 if K%7==0 else 9*K

if L%2==0 or L%5==0:
    print('-1')

else:
    surplus=1

    for i in range(1,L+1):
        surplus=(surplus*10)%L
        if surplus==1:
            print(i)
            break
Problem p02831 (python)

Fixed submission:
n=input().split(' ')
a=int(n[0]);b=int(n[1])
def gcd(a,b):
    x=max(a,b);y=min(a,b)
    if x%y==0:
        return y
    while x%y!=0:
        z=x%y ; x=y ; y=z
    return z
print(int(a*b/gcd(a,b)))

Buggy submission (verdict: Runtime Error):
n=input().split(' ')
a=int(n[0]);b=int(n[1])
import sympy
print(sympy.lcm(a,b))
Problem p02622 (python)

Fixed submission:
s = input()
t = input()
j = 0
     
for i in range(len(s)):
      if s[i] is not t[i]:
            j += 1
     
print(j)

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

for i in range(len(s)):
  if s[i] is not t[i]:
    i++

print(i)
Problem p02580 (python)

Fixed submission:
H, W, M = map(int,input().rstrip().split())
bomb = []
r = [0]*H
c = [0]*W
max_r = 0
max_c = 0
r_i = []
c_j = []
r_num = 0
c_num = 0
for i in range(M):
    h, w = map(int,input().rstrip().split())
    bomb.append([h-1,w-1])
    r[h-1] += 1
    if r[h-1]>max_r:
        max_r = r[h-1]
        r_i = [h-1]
        r_num = 1
    elif r[h-1]==max_r:
        r_i.append(h-1)
        r_num += 1
    c[w-1] += 1
    if c[w-1]>max_c:
        max_c = c[w-1]
        c_j = [w-1]
        c_num = 1
    elif c[w-1]==max_c:
        c_j.append(w-1)
        c_num += 1
r_set = set(r_i)
c_set = set(c_j)
num = 0
for i in range(M):
    if bomb[i][0] in r_set:
        if bomb[i][1] in c_set:
            num += 1
if num<r_num*c_num:
    ans = max_r+max_c
else:
    ans = max_r+max_c-1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W, M = map(int,input().rstrip().split())
l = [[0 for i in range(H)] for j in range(W)]
r = [0]*H
c = [0]*W
max_r = 0
max_c = 0
r_i = []
c_j = []
for i in range(M):
    h, w = map(int,input().rstrip().split())
    l[w-1][h-1] = 1
    r[h-1] += 1
    if r[h-1]>max_r:
        max_r = r[h-1]
        r_i = [h-1]
    elif r[h-1]==max_r:
        r_i.append(h-1)
    c[w-1] += 1
    if c[w-1]>max_c:
        max_c = c[w-1]
        c_j = [w-1]
    elif c[h-1]==max_c:
        c_j.append(w-1)
ans = max_r+max_c-1
for i in r_i:
    for j in c_j:
        if l[j][i] == 0:
            ans = max_r+max_c
            break
    else:
        continue
    break
print(ans)
Problem p02779 (python)

Fixed submission:
stdin = open(0).read().split('\n')
N = int(stdin[0])
A = list(map(int,stdin[1].split()))
B = set(A)
print('YES' if len(A)==len(B) else 'NO')

Buggy submission (verdict: Runtime Error):
stdin = open(0).read().split('\n')
N = int(stdin[0])
A = list(map(int,stdin[1].split()))
print('Yes' if len(A)==len(B) else'No')
Problem p02829 (python)

Fixed submission:
A=int(input())
B=int(input())
if A!=1 and B!=1:
    print(1)
elif A!=2 and B!=2:
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
A, B = map(int,open(0).read().split('\n'))
if A!=1 and B!=1:
    print(1)
elif A!=2 and B!=2:
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
A, B = map(int,open(0).read().split('\n'))
if A!=1 and B!=1:
    print(1)
elif A!=2 and B!=2:
    print(2)
else:
    print(3)
Problem p03013 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
d = {0:1, 1:1, 2:2}
def countcombi(n):
    if n in d:
        return d[n]
    else:
        d[n] = countcombi(n-1)+countcombi(n-2)
        return d[n]
N, M = list(map(int,input().rstrip().split()))
a_now = 0
a_before = 0
ans = 1
for _ in range(M):
    a_now = int(input().rstrip())
    if a_now-a_before == 0 and a_before != 0:
        print(0)
        break
    ans = (ans * countcombi(a_now-a_before-1)) % 1_000_000_007
    a_before = a_now + 1
else:
    a_now = N
    ans = (ans * countcombi(a_now-a_before)) % 1_000_000_007
    print(ans)

Buggy submission (verdict: Runtime Error):
d = {0:1, 1:1, 2:2}
def countcombi(n):
    if n in d:
        return d[n]
    else:
        d[n] = countcombi(n-1)+countcombi(n-2)
        return d[n]
N, M = list(map(int,input().rstrip().split()))
a_now = 0
a_before = 0
ans = 1
for _ in range(M):
    a_now = int(input().rstrip())
    if a_now-a_before == 0 and a_before != 0:
        print(0)
        break
    ans = (ans * countcombi(a_now-a_before-1)) % 1_000_000_007
    a_before = a_now + 1
else:
    a_now = N
    ans = (ans * countcombi(a_now-a_before)) % 1_000_000_007
    print(ans)
Problem p02547 (python)

Fixed submission:
N=int(input())
j=0
J=0
for i in range(N):
  D1,D2=map(int,input().split())
  if D1==D2:
    j+=1
    if j>=3:
      J=3
  else:
    j=0
if J>=3:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
j=0
for i in range(N):
  D1,D2=map(int,input().split())
  if D1==D2:
    j+=1
    if j>=3:
      J=3
  else:
    j=0
if J>=3:
  print('Yes')
else:
  print('No')
Problem p02570 (python)

Fixed submission:
D,T,S=map(int,input().split())
if D<=T*S:
  print('Yes')
elif D>T*S:
  print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
lst=list(map(int,input().split()))
A=0
for i in range(N-1):
  for j in range(i+1,N):
    A+=(lst[i]%(10**9+7))*(lst[j]%(10**9+7))
print(A%(10**9+7))

Buggy submission (verdict: Runtime Error):
N=int(input())
lst=list(map(int,input().split()))
A=0
for i in range(N-1):
  for j in range(i+1,N):
    A+=(lst[i]%(10**9+7))*(lst[j]%(10**9+7))
print(A%(10**9+7))

Buggy submission (verdict: Runtime Error):
D=int(input())
T=int(input())
S=int(input())
if D<=T*S:
  print('Yes')
elif D>T*S:
  print('No')