Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#ABC127-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
import bisect
n,m=IL()
A=IL()
A.sort()

for i in range(m):
    b,c=IL()
    s=bisect.bisect(A,c)
    
    if s<=b:
        A=[c]*s+A[s:]
    else:
        A=A[b:s]+[c]*b+A[s:]
           
print(sum(A))

Fixed submission:
#ABC127-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,m=IL()
A=IL()
A.sort()
Q=[IL() for i in range(m)]
Q.sort(key=lambda x:-x[1])
j=0
for i in range(n):
    if Q[j][1]<A[i]:
        break
    else:
        Q[j][0]-=1
        A[i]=Q[j][1]
    if Q[j][0]==0:
        j+=1
    if j==m:
        break
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
#ABC127-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
import bisect
n,m=IL()
A=IL()
A.sort()
ans=sum(A)
for i in range(m):
    b,c=IL()
    s=bisect.bisect(A,c)
    
    if s<=b:
        m=sum(A[:s])
        A=[c]*s+A[s:]
        ans=ans+c*s-m
    else:
        m=sum(A[:b])
        A=A[b:s]+[c]*b+A[s:]
        ans=ans+c*b-m
    
print(ans)

Fixed submission:
#ABC127-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,m=IL()
A=IL()
A.sort()
Q=[IL() for i in range(m)]
Q.sort(key=lambda x:-x[1])
j=0
for i in range(n):
    if Q[j][1]<A[i]:
        break
    else:
        Q[j][0]-=1
        A[i]=Q[j][1]
    if Q[j][0]==0:
        j+=1
    if j==m:
        break
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
#ABC127-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
import bisect
n,m=IL()
A=IL()
A.sort()
ans=sum(A)
for i in range(m):
    b,c=IL()
    s=bisect.bisect(A,c)
    
    if s<=b:
        m=sum(A[:s])
        A=[c]*s+A[s:]
        ans=ans+c*s-m
    else:
        m=sum(A[:b])
        A=A[b:s]+[c]*b+A[s:]
        ans=ans+c*b-m
    
print(ans)

Fixed submission:
#ABC127-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,m=IL()
A=IL()
A.sort()
Q=[IL() for i in range(m)]
Q.sort(key=lambda x:-x[1])
j=0
for i in range(n):
    if Q[j][1]<A[i]:
        break
    else:
        Q[j][0]-=1
        A[i]=Q[j][1]
    if Q[j][0]==0:
        j+=1
    if j==m:
        break
print(sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
L=[r,g,b]
L.sort()
s,m,l=L
ans=0
for i in range(n//l+1):
    for j in range(n//m+1):
        if n-i*l-j*m<0:
            break
        elif (n-i*l-j*m)%s==0:
            ans+=1
            
print(ans)

Fixed submission:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
L=[r,g,b]
L.sort()
s,m,l=L
ans=0
for i in range(n//l+1):
    for j in range(n//m+1):
        if n-i*l-j*m<0:
            break
        elif (n-i*l-j*m)%s==0:
            ans+=1
            
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
ans=0
for i in range(0,n//r+1):
    for j in range(0,n//g+1):
        if (n-i*r-j*g)%b==0 and n-i*r-j*g>=0:
            ans+=1
            
print(ans)

Fixed submission:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
L=[r,g,b]
L.sort()
s,m,l=L
ans=0
for i in range(n//l+1):
    for j in range(n//m+1):
        if n-i*l-j*m<0:
            break
        elif (n-i*l-j*m)%s==0:
            ans+=1
            
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
ans=0
for i in range(0,n+1):
    for j in range(0,n+1):
        if (n-i*r-j*g)%b==0 and n-i*r-j*g>=0:
            ans+=1
            
print(ans)

Fixed submission:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
L=[r,g,b]
L.sort()
s,m,l=L
ans=0
for i in range(n//l+1):
    for j in range(n//m+1):
        if n-i*l-j*m<0:
            break
        elif (n-i*l-j*m)%s==0:
            ans+=1
            
print(ans)
Buggy python submission (verdict: Runtime Error):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
a,b,k=IL()
c=[]
for i in range(1,max(a,b)):
    if a%i==0 and b%i==0:
        c.append(i)
print(c[-k])

Fixed submission:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
a,b,k=IL()
c=[1]
for i in range(2,min(a,b)+1):
    if a%i==0 and b%i==0:
        c.append(i)
print(c[-k])
Buggy python submission (verdict: Runtime Error):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
n,k=IL()
top=dict()
sub=[]
for i in range(n):
    t,d=IL()
    if t in top:
        sub.append(min(top[t],d))
        top[t]=max(top[t],d)
    else:
        top[t]=d

top=sorted(top.items(),key=lambda x:-x[1])
sub.sort(reverse=True)

rtop=[top[0][1]]
rsub=[sub[0]]
for i in range(1,len(top)):
    rtop.append(rtop[-1]+top[i][1])
for i in range(1,len(sub)):
    rsub.append(rsub[-1]+sub[i])

ans=0
for i in range(k):
    if i<len(rtop) and 0<=k-i-2<len(rsub):
        ans=max(ans,rtop[i]+rsub[k-i-2]+(i+1)**2)
print(ans)

Fixed submission:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
n,k=IL()
top=dict()
sub=[]
for i in range(n):
    t,d=IL()
    if t in top:
        sub.append(min(top[t],d))
        top[t]=max(top[t],d)
    else:
        top[t]=d

top=sorted(top.items(),key=lambda x:-x[1])
sub.sort(reverse=True)

rtop=[top[0][1]]
rsub=[0]
for i in range(1,len(top)):
    rtop.append(rtop[-1]+top[i][1])
for i in range(len(sub)):
    rsub.append(rsub[-1]+sub[i])

ans=0
for i in range(k):
    if i<len(rtop) and 0<=k-i-1<len(rsub):
        ans=max(ans,rtop[i]+rsub[k-i-1]+(i+1)**2)
print(ans)

Buggy python submission (verdict: Runtime Error):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
import heapq
n,k=IL()
nl=dict()
for i in range(n+1):
    nl[i]=0
l=[]
ans=[]
f=[]
el=[]
heapq.heapify(el)
s=0
for i in range(n):
    t,d=IL()
    l.append([d,t])
l.sort(reverse=True)
for i in range(k):
    t=l.pop(0)
    el.heappush(t)
    nl[t[1]]+=1
    s+=t[0]
    if t[1] not in f:
        f.append(t[1])
u=len(f)
ans.append(s+u*u)
for i in range(u,k+1):
    if len(l)==0:
        break
    while True:
        t=el.heappop(0)
        if nl[t[1]]!=1:
            nl[t[1]]-=1
            s-=nl[t[0]]
            break
    while len(l)>0:
        t=l.pop(0)
        if nl[t[1]]==0:
            nl[t[1]]+=1
            s+=t[0]
            el.heappush(t)
            break
    ans.append(s+(u+i+1)**2)
    if len(l)==0:
        break
print(max(ans))

Fixed submission:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
n,k=IL()
top=dict()
sub=[]
for i in range(n):
    t,d=IL()
    if t in top:
        sub.append(min(top[t],d))
        top[t]=max(top[t],d)
    else:
        top[t]=d

top=sorted(top.items(),key=lambda x:-x[1])
sub.sort(reverse=True)

rtop=[top[0][1]]
rsub=[0]
for i in range(1,len(top)):
    rtop.append(rtop[-1]+top[i][1])
for i in range(len(sub)):
    rsub.append(rsub[-1]+sub[i])

ans=0
for i in range(k):
    if i<len(rtop) and 0<=k-i-1<len(rsub):
        ans=max(ans,rtop[i]+rsub[k-i-1]+(i+1)**2)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=list(input())
k=["k","e","y","e","n","c","e"]
ans="NO"
c=0
if len(s)>=7:
    while True:
        if s[c]!=k[c]:
            break
        c+=1
    if c==7:
        ans="YES"
    for i in range(7-c):
        if s[-i-1]!=k[-i-1]:
            break
    else:
        ans="YES"
print(ans)

Fixed submission:
s=list(input())
k=["k","e","y","e","n","c","e"]
ans="NO"
c=0
if len(s)>=7:
    while c<7:
        if s[c]!=k[c]:
            break
        c+=1
    if c==7:
        ans="YES"
    for i in range(7-c):
        if s[-i-1]!=k[-i-1]:
            break
    else:
        ans="YES"
print(ans)

Buggy python submission (verdict: Runtime Error):
s=list(input())
k=["k","e","y","e","n","c","e"]
ans="NO"
if len(s)>=7:
    while c<7:
        if s[i]!=k[i]:
            break
        c+=1
    for i in range(7-c):
        if s[-i-1]!=k[-i-1]:
            break
    else:
        ans="YES"
print(ans)

Fixed submission:
s=list(input())
k=["k","e","y","e","n","c","e"]
ans="NO"
c=0
if len(s)>=7:
    while c<7:
        if s[c]!=k[c]:
            break
        c+=1
    if c==7:
        ans="YES"
    for i in range(7-c):
        if s[-i-1]!=k[-i-1]:
            break
    else:
        ans="YES"
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
k="keyence"
c=0
for i in range(len(s)):
    if s[i]==k[c]:
        c+=1
if c==7:
    print("YES")
else:
    print("NO")

Fixed submission:
s=list(input())
k=["k","e","y","e","n","c","e"]
ans="NO"
c=0
if len(s)>=7:
    while c<7:
        if s[c]!=k[c]:
            break
        c+=1
    if c==7:
        ans="YES"
    for i in range(7-c):
        if s[-i-1]!=k[-i-1]:
            break
    else:
        ans="YES"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,k=IL()
h=np.array(IL())
dp=np.full(n,np.inf)
dp[0]=0
for i in range(1,n):
    t=i-min(i,k)
    dp[i]=np.min(dp[t:i]+abs(h[t:i]-h[i]))
print(int(dp[n-1]))

Fixed submission:
import numpy as np
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,k=IL()
h=np.array(IL())
dp=np.full(n,pow(10,6),dtype=int)
dp[0]=0
for i in range(1,n):
    t=i-min(i,k)
    dp[i]=np.min(dp[t:i]+abs(h[t:i]-h[i]))
print(dp[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,k=LI()
h=LI()
dp=[float("INF") for i in range(n)]
dp[0]=0
for i in range(1,n):
    for j in range(1,min(i,k)+1):
        dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[n-1])

Fixed submission:
import numpy as np
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,k=IL()
h=np.array(IL())
dp=np.full(n,pow(10,6),dtype=int)
dp[0]=0
for i in range(1,n):
    t=i-min(i,k)
    dp[i]=np.min(dp[t:i]+abs(h[t:i]-h[i]))
print(dp[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[float("INF") for i in range(n)]
dp[0]=0
for i in range(1,n):
    for j in range(1,min(i,k)+1):
        dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[n-1])

Fixed submission:
import numpy as np
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,k=IL()
h=np.array(IL())
dp=np.full(n,pow(10,6),dtype=int)
dp[0]=0
for i in range(1,n):
    t=i-min(i,k)
    dp[i]=np.min(dp[t:i]+abs(h[t:i]-h[i]))
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
import copy
n,wmax=IL()
dp=[0 for i in range(wmax+1)]
for i in range(1,n+1):
    w,v=IL()
    predp=copy.deepcopy(dp)
    for j in range(w,wmax+1):
        dp[j]=max(predp[j],predp[j-w]+v)
print(dp[wmax])

Fixed submission:
import numpy as np
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

n,wmax=IL()
dp=np.zeros(wmax+1,dtype=int)
for i in range(n):
    w,v=IL()
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[wmax])

Buggy python submission (verdict: Time Limit Exceeded):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

n,wmax=IL()
dp=[[0 for i in range(wmax+1)] for j in range(n+1)]
for i in range(1,n+1):
    w,v=IL()
    for j in range(wmax+1):
        if j<w:
            dp[i][j]=dp[i-1][j]
        else:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
print(dp[n][wmax])

Fixed submission:
import numpy as np
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

n,wmax=IL()
dp=np.zeros(wmax+1,dtype=int)
for i in range(n):
    w,v=IL()
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[wmax])
Buggy python submission (verdict: Runtime Error):
x=int(input())
y=int(input())
print(x+y//2)

Fixed submission:
x,y=map(int,input().split())
print(x+y//2)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
p=[[] for i in range(n)]
y=[]
nl=[]
for i in range(m):
    t1,t2=map(int,input().split())
    p[t1-1].append(t2)
for i in range(n):
    tl=p[i].sort()
    for j in range(len(p[i])):
        u=str(i+1)
        w=tl.index(p[i][j])
        d=str(w+1)
        while len(u)<6:
            u="0"+u
        while len(d)<6:
            d="0"+d
        t=u+d
        nl.append(t)
for i in range(m):
    print(nl[i])

Fixed submission:
n,m=map(int,input().split())
p=[]
for i in range(m):
    t1,t2=map(int,input().split())
    p.append([i,t1,t2])
p.sort(key=lambda x:x[2])
c=[1 for i in range(n+1)]
num=[]
for i,pre,yea in p:
    tmp=str(pre).zfill(6)+str(c[pre]).zfill(6)
    num.append([i,tmp])
    c[pre]+=1
num.sort()
for i in num:
    print(i[1])

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
p=[[] for i in range(m)]
y=[]
nl=[]
for i in range(m):
    t1,t2=map(int,input().split())
    p[t1-1].append(t2)
for i in range(m):
    for j in range(len(p[i])):
        u=str(i+1)
        d=str(j+1)
        while len(u)<6:
            u="0"+u
        while len(d)<6:
            d="0"+d
        t=u+d
        nl.append(t)
for i in range(m):
    print(nl[i])

Fixed submission:
n,m=map(int,input().split())
p=[]
for i in range(m):
    t1,t2=map(int,input().split())
    p.append([i,t1,t2])
p.sort(key=lambda x:x[2])
c=[1 for i in range(n+1)]
num=[]
for i,pre,yea in p:
    tmp=str(pre).zfill(6)+str(c[pre]).zfill(6)
    num.append([i,tmp])
    c[pre]+=1
num.sort()
for i in num:
    print(i[1])
Buggy python submission (verdict: Runtime Error):
import math
import functools
n,x=map(int,input().split())
xl=list(map(int,input().split()))
a=[]
for i in range(n):
    a.append(abs(xl[i]-x))
ans=functools.reduce(math.gcd,a)
print(ans)

Fixed submission:
import fractions
import functools
n,x=map(int,input().split())
xl=list(map(int,input().split()))
a=[]
for i in range(n):
    a.append(abs(xl[i]-x))
ans=functools.reduce(fractions.gcd,a)
print(ans)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
ans=a*b-a-b+1
print(ans)

Fixed submission:
a,b=map(int,input().split())
ans=a*b-a-b+1
print(ans)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(a*b-a-b+1)

Fixed submission:
a,b=map(int,input().split())
ans=a*b-a-b+1
print(ans)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(a*b-a-b+1)

Fixed submission:
a,b=map(int,input().split())
ans=a*b-a-b+1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
print(sum(a)-n)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(sum(a)-n)
Buggy python submission (verdict: Runtime Error):
import copy
input()
a=[int(i) for i in input().split()]
sa=copy.copy(a)
for i in range(len(a)):
    sa[i]=sa[i]-(i+1)
sa.sort()
msa=sa[int(len(sa)/2)]
sb=0
for i in range(len(a)):
    sb=sb+abs(a[i]-(msa+i+1))
print(sb)

Fixed submission:
N=int(input())
if N/2==N//2:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
import copy
input()
a=[int(i) for i in input().split()]
sa=copy.copy(a)
for i in range(len(a)):
    sa[i]=sa[i]-(i+1)
sa.sort()
msa=sa[int(len(sa)/2)]
sb=0
for i in range(len(a)):
    sb=sb+abs(a[i]-(sma+i+1))
print(sb)

Fixed submission:
N=int(input())
if N/2==N//2:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
import copy
input()
a=[int(i) for i in input().split()]
sa=copy.copy(a)
for i in range(len(a)):
    sa[i]=sa[i]-(i+1)
sa.sort()
b=sa[int(len(sa)/2)]
sb=0
for i in range(len(a)):
    sb=sb+abs(a[i]-(b+i+1))
print(sb)

Fixed submission:
N=int(input())
if N/2==N//2:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
import copy
input()
a=[int(i) for i in input().split()]
sa=copy.copy(a)
for i in range(len(a)):
    sa[i]=sa[i]-(i+1)
sa.sort()
b=sa[int(len(sa)/2)]
c=sa[int(len(sa)/2)+1]
sb=0
sc=0
for i in range(len(a)):
    sb=sb+abs(a[i]-(b+i+1))
    sc=sc+abs(a[i]-(c+i+1))
print(min(sb,sc))

Fixed submission:
N=int(input())
if N/2==N//2:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
N=int(input())
if N/2==N//2:
    print(N)
else:
    print(n*2)

Fixed submission:
N=int(input())
if N/2==N//2:
    print(N)
else:
    print(N*2)
Buggy python submission (verdict: Time Limit Exceeded):
#ABC088-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
h,w=IL()
G=[S() for i in range(h)]
used=[[False for i in range(w)] for j in range(h)]
q=[[0,0,1]]
pos=False
while len(q)>0:
    gy,gx,dis=q.pop(0)
    if gy==h-1 and gx==w-1:
        pos=True
        break
    if not used[gy][gx]:
        if gy!=0:
            if G[gy-1][gx]=="." and not used[gy-1][gx]:
                q.append([gy-1,gx,dis+1])
        if gx!=0:
            if G[gy][gx-1]=="." and not used[gy][gx-1]:
                q.append([gy,gx-1,dis+1])
        if gy!=h-1:
            if G[gy+1][gx]=="." and not used[gy+1][gx]:
                q.append([gy+1,gx,dis+1])
        if gx!=w-1:
            if G[gy][gx+1]=="." and not used[gy][gx+1]:
                q.append([gy,gx+1,dis+1])
if pos:
    ans=0
    for i in range(h):
        ans+=G[i].count(".")
    print(ans-dis)
else:
    print(-1)

Fixed submission:
#ABC088-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
h,w=IL()
G=[S() for i in range(h)]
used=[[False for i in range(w)] for j in range(h)]
q=[[0,0,1]]
pos=False
while len(q)>0:
    gy,gx,dis=q.pop(0)
    if gy==h-1 and gx==w-1:
        pos=True
        break
    if not used[gy][gx]:
        if gy!=0:
            if G[gy-1][gx]=="." and not used[gy-1][gx]:
                q.append([gy-1,gx,dis+1])
        if gx!=0:
            if G[gy][gx-1]=="." and not used[gy][gx-1]:
                q.append([gy,gx-1,dis+1])
        if gy!=h-1:
            if G[gy+1][gx]=="." and not used[gy+1][gx]:
                q.append([gy+1,gx,dis+1])
        if gx!=w-1:
            if G[gy][gx+1]=="." and not used[gy][gx+1]:
                q.append([gy,gx+1,dis+1])
    used[gy][gx]=True
if pos:
    ans=0
    for i in range(h):
        ans+=G[i].count(".")
    print(ans-dis)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
#080-C 
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=IL()
F=[int(input().replace(" ",""), 2) for _ in range(n)]
P=[IL() for i in range(n)]
ans=-pow(10,10)
for i in range(1,pow(2,10)):
    t=0
    for f,p in zip(F,P):
        t+=p[bin(f&i).count("1")]
    ans=max(ans,t)
print(ans)

Fixed submission:
#080-C 
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
F=[int(input().replace(" ",""), 2) for _ in range(n)]
P=[IL() for i in range(n)]
ans=-pow(10,10)
for i in range(1,pow(2,10)):
    t=0
    for f,p in zip(F,P):
        t+=p[bin(f&i).count("1")]
    ans=max(ans,t)
print(ans)
Buggy python submission (verdict: Runtime Error):
#078-C 
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,z,w=IL()
a=IL()
print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))

Fixed submission:
#078-C 
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,z,w=IL()
a=IL()
if n==1:
    print(abs(a[-1]-w))
else:
    print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))
Buggy python submission (verdict: Runtime Error):
#075-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
#UnionFindクラス
class UnionFind(object):
 
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
 
    def find(self, x):
  
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
  
    # xとyの根を結合させる
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
  
  # x,yの根が同じかどうかを返す（根が同じ:True、根が異なる:False）
    def same(self, x, y):
        return self.find(x) == self.find(y)
n,m=IL()
nl=[[] for j in range(n)]
for i in range(m):
    f,t=IL()
    nl.append([f-1,t-1])
ans=0
for i in range(m):
    t=nl[i]
    nl.remove(t)
    uf=UnionFind(n)
    for e in nl:
        uf.union(e[0],e[1])
    nl.append(t)
    for j in range(n):
        for k in range(n):
            if not uf.same(j,k):
                ans+=1
                break
            break
        break
print(ans)

Fixed submission:
#075-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
#UnionFindクラス
class UnionFind(object):
 
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
 
    def find(self, x):
  
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
  
    # xとyの根を結合させる
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
  
  # x,yの根が同じかどうかを返す（根が同じ:True、根が異なる:False）
    def same(self, x, y):
        return self.find(x) == self.find(y)
n,m=IL()
nl=[]
for i in range(m):
    f,t=IL()
    nl.append([f-1,t-1])
ans=0
for i in range(m):
    uf=UnionFind(n)
    flag=False
    for j in range(m):
        if i==j:
            continue
        uf.union(nl[j][0],nl[j][1])
    nl.append(t)
    for j in range(n):
        for k in range(n):
            if not uf.same(j,k):
                flag=True
    if flag:
        ans+=1
print(ans)