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

Fixed submission:
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！

from math import factorial
def cmb(n, r):
    return factorial(n) // factorial(r) // factorial(n - r)


def main():
    n=int(input())
    l=[cmb(i,2) for i in Counter(["".join(sorted(input()))for i in range(n)]).values() if i>1]
    print(sum(l))
                    
        
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！

from math import factorial
def cmb(n, r):
    return factorial(n) // factorial(r) // factorial(n - r)


def main():
    n=int(input())
    l=[cmb(i,2) for i in Counter(["".join(sorted(input()))for i in range(n)]).values()]
    print(sum(l))
                    
        
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    a,b=map(int,input().split())
    print(max(a*b,a-b,a*b))
                    
        
if __name__ == '__main__':
    main()
Problem p02958 (python)

Fixed submission:
n,*a=map(int,open(0).read().split())
*l,=range(1,n+1)
c=0
for i in range(n):
    if a[i]!=l[i]:
        c+=1
if c<=2:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n,*a=map(int,open(0))
*l,=range(1,n+1)
c=0
for i in range(n):
    if a[i]!=l[i]:
        c+=1
if c<=2:
    print("YES")
else:
    print("NO")
Problem p03006 (python)

Fixed submission:
from copy import *
from collections import*
n=int(input())
if n==1:
    print(1)
    exit()
p=[list(map(int,input().split()))for i in range(n)]
l=[]
for i in range(n):
    q=deepcopy(p)
    a,b=q.pop(i)
#    print(a,q)
    l.extend([(s-a,t-b)for s,t in q])
print(n-(Counter(l).most_common()[0][1]+1)+1)

Buggy submission (verdict: Runtime Error):
from copy import *
from collections import*
n=int(input())
p=[list(map(int,input().split()))for i in range(n)]
l=[]
for i in range(n):
    q=deepcopy(p)
    a,b=q.pop(i)
#    print(a,q)
    l.extend([(s-a,t-b)for s,t in q])
print(n-(Counter(l).most_common()[0][1]+1)+1)
Problem p03026 (python)

Fixed submission:
import sys;sys.setrecursionlimit(10**6)
from collections import*
n=int(input())
d=defaultdict(list)

start=float("inf")
for i in range(n-1):
    a,b=map(int,input().split())
    d[a].append(b)
    d[b].append(a)
    start=min(a,start)
p=sorted(map(int,input().split()))

def DFS(point,TFlist):
    global ans
    global score
    if all(TFlist):
        return 1
    for i in d[point]:
        if TFlist[i-1]:
            continue
        TFlist[i-1]=True
        tmp=p.pop()
        ans[i-1]=tmp
        score.append(tmp)
        #print(score)
        DFS(i,TFlist)
        TFlist[i-1]=False
    return score,ans

TFlist=[False]*(n)
TFlist[start-1]=True
ans=[0 for i in range(n)]
score=[]
ans[start-1]=p.pop()
s,t=DFS(start,TFlist)
#print(d)
print(sum(s))
print(*t)

Buggy submission (verdict: Runtime Error):
from collections import*
n=int(input())
d=defaultdict(list)

start=float("inf")
for i in range(n-1):
    a,b=map(int,input().split())
    d[a].append(b)
    d[b].append(a)
    start=min(a,start)
p=sorted(map(int,input().split()))

def DFS(point,TFlist):
    global ans
    global score
    if all(TFlist):
        return 1
    for i in d[point]:
        if TFlist[i-1]:
            continue
        TFlist[i-1]=True
        tmp=p.pop()
        ans[i-1]=tmp
        score.append(tmp)
        #print(score)
        DFS(i,TFlist)
        TFlist[i-1]=False
    return score,ans

TFlist=[False]*(n)
TFlist[start-1]=True
ans=[0 for i in range(n)]
score=[]
ans[start-1]=p.pop()
s,t=DFS(start,TFlist)
#print(d)
print(sum(s))
print(*t)

Buggy submission (verdict: Runtime Error):
from collections import*
n=int(input())
d=defaultdict(list)

start=float("inf")
for i in range(n-1):
    a,b=map(int,input().split())
    d[a].append(b)
    b[a].append(a)
    start=min(a,start)
p=sorted(map(int,input().split()))

def DFS(point,TFlist):
    global ans
    global score
    if all(TFlist):
        return 1
    for i in d[point]:
        if TFlist[i-1]:
            continue
        TFlist[i-1]=True
        tmp=p.pop()
        ans[i-1]=tmp
        score.append(tmp)
        #print(score)
        DFS(i,TFlist)
        TFlist[i-1]=False
    return score,ans

TFlist=[False]*(n)
TFlist[start-1]=True
ans=[0 for i in range(n)]
score=[]
ans[start-1]=p.pop()
s,t=DFS(start,TFlist)
#print(d)
print(sum(s))
print(*t)
Problem p03029 (python)

Fixed submission:
a,p=map(int,input().split())
print((a*3+p)//2)

Buggy submission (verdict: Runtime Error):
import sys;input=sys.stdin.readline
from bisect import*

n,q=map(int,input().split())
event=[]
stopped=set([-1])

def doevent(l):
    global stopped
    if l[1]==1:
        if stopped=={-1}:
            stopped=set()
        stopped.add(l[2])
    elif l[1]==-1:
        if l[2] in stopped:
            stopped.remove(l[2])
        if len(stopped)==0:
            stopped={-1}
            
for i in range(n):
    s,t,x=map(int,input().split())
    event.append((s-x,1,x))
    event.append((t-x,-1,x))
event.append((-float("inf"),"x","x"))
event.append((float("inf"),"x","x"))
event.sort(key=lambda x:x[0])
eventtime=[i[0]for i in event]
#print(eventtime)
query=[bisect_right(eventtime,int(input()))-1 for i in range(q)]+[float("inf")]
#print(query)
c=0
#print(event)
for i in range(2*n+1):
    doevent(event[i])
    while i==query[c]:
        print(min(stopped))
        c+=1

Buggy submission (verdict: Runtime Error):
import sys;input=sys.stdin.readline
from bisect import*

n,q=map(int,input().split())
event=[]
stopped={-1}

def doevent(l):
    global stopped
    if l[1]==1:
        if stopped=={-1}:
            stopped=set()
        stopped.add(l[2])
    elif l[1]==-1:
        stopped.remove(l[2])
        if len(stopped)==0:
            stopped={-1}
            
for i in range(n):
    s,t,x=map(int,input().split())
    event.append((s-x,1,x))
    event.append((t-x,-1,x))
event.append((-float("inf"),"x","x"))
event.append((float("inf"),"x","x"))
event.sort(key=lambda x:x[0])
eventtime=[i[0]for i in event]
#print(eventtime)
query=[bisect_right(eventtime,int(input()))-1 for i in range(q)]
#print(query)
c=0
#print(event)
for i in range(2*n):
    doevent(event[i])
    while i==query[c]:
        print(min(stopped))
        c+=1
        if c==q:
            break
for i in range(query.count(2*n)):
    print(-1)
Problem p03031 (python)

Fixed submission:
from numpy import*
n,m=map(int,input().split())
l=[]
for i in range(m):
    *a,=map(int,input().split())
    l.append(a[1:])
*p,=map(int,input().split())

ans=0
for t in range(2**n):
    tmp=array([t>>s&1 for s in range(n)])
    if p==[sum(tmp[array(i)-1])%2for i in l]:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
from numpy import*
n,m=map(int,input().split())
l=[]
for i in range(m):
    *a,=map(int,input().split())
    l.append(a[1:])
*p,=map(int,input().split())

ans=0
for t in range(2**m):
    tmp=array([t>>s&1 for s in range(m)])
    if p==[sum(tmp[array(i)-1])%2for i in l]:
        ans+=1
print(ans)
Problem p03035 (python)

Fixed submission:
a,b=map(int,input().split())
if a>12:
    print(b)
elif 6<=a<=12:
    print(b//2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from heapq import*
n,m=map(int,input().split())
p=sorted(map(int,input().split()))
heapify(p)
q=sorted([list(map(int,input().split()))for i in range(m)],key=lambda x:x[1],reverse=1)

for s,t in q:
    for i in range(s):
        tmp=heappop(p)
        if t>tmp:
            heappush(p,t)
        else:
            heappush(p,tmp)
            print(sum(p))
            exit()
print(sum(p))
#    print(p,q)
Problem p03039 (python)

Fixed submission:
mod=10**9+7
def mod_combination(n, k, mod):
    def ext_gcd(a, b):
        if b == 0:return a, 1, 0
        else:d,x,y = ext_gcd(b,a%b);x-=(a//b)*y 
        return d,y,x
    p,q=1,1
    for i in range(n-k+1,n+1):
        p=(p*i)%mod
    for i in range(2,k+1):
        q=(q*i)%mod
    return int(p*(ext_gcd(q, mod)[1]%mod)%mod)


n,m,k=map(int,input().split())
print(((pow(m,2,mod)*mod_combination(n*m-2,k-2,mod)*sum((n-i)*i%mod for i in range(1,n))%mod)+pow(n,2,mod)*mod_combination(n*m-2,k-2,mod)*sum((m-i)*i%mod for i in range(1,m))%mod)%mod)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
def mod_combination(n, k, mod):
    def ext_gcd(a, b):
        if b == 0:return a, 1, 0
        else:d,x,y = ext_gcd(b,a%b);x-=(a//b)*y 
        return d,y,x
    p,q=1,1
    for i in range(n-k+1,n+1):
        p=(p*i)%mod
    for i in range(2,k+1):
        q=(q*i)%mod
    return int(p*(ext_gcd(q, mod)[1]%mod)%mod)


n,m,k=map(int,input().split())
print(((pow(m,2,mod)*cmb(n*m-2,k-2,mod)*sum((n-i)*i%mod for i in range(1,n))%mod)+pow(n,2,mod)*cmb(n*m-2,k-2,mod)*sum((m-i)*i%mod for i in range(1,m))%mod)%mod)

Buggy submission (verdict: Runtime Error):
from math import factorial
mod=10**9+7
def cmb(n, r):
    return factorial(n) // factorial(r) // factorial(n - r)%mod

n,m,k=map(int,input().split())
print((pow(m,2,mod)*cmb(n*m-2,k-2)*sum((n-i)*i for i in range(1,n)))+pow(n,2,mod)*cmb(n*m-2,k-2)*sum((m-i)*i for i in range(1,m)))%mod)
Problem p03046 (python)

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

if k==0:
    x=[[i]*2 for i in range(2**m)]
    for i in x:
        print(*i,end=" ")
elif m==1:
    print(-1)
elif 2**m<=k:
    print(-1)
else:
    for i in reversed(range(2**m)):
        if i!=k:
            print(i,end=" ")
    print(k,end=" ")
    for i in range(2**m):
        if i!=k:
            print(i,end=" ")
    print(k)

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

if k==0:
    x=[[i]*2 for i in range(2**m)]
    for i in x:
        print(*i,end=" ")
elif m==1:
    print(-1)
elif 2**m<=k:
    print(-1)
else:
    s=set()
    for i in range(m):
        s.add(i)
    a=sorted(s-set(k))
    b=a+[k]+a[::-1]+[k]
    print(*b)

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

if k==0:
    x=[[i]*2 for i in range(2**m)]
    for i in x:
        print(*i,end=" ")
elif m==1:
    print(-1)
elif 2**m<=k:
    print(-1)
else:
    a=sorted(set(range(m))-set(k))
    b=a+[k]+a[::-1]+[k]
    print(*b)
Problem p03047 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
ans=0
for x in range(n//r):
    for y in range(n//g):
        if (d-x*a+y*b)//c==0:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
r,g,b,n=map(int,input().split())
ans=0
for i in range(n//r+1):
    for j in range(n//g+1):
        if (n-(r*i+g*j))%b==0:
            if (n-(r*i+g*j))//b>=0:
                ans+=1
print(ans)
Problem p03048 (python)

Fixed submission:
r,g,b,n=map(int,input().split())
ans=0
for i in range(n//r+1):
    for j in range(n//g+1):
        if (n-(r*i+g*j))%b==0:
            if (n-(r*i+g*j))//b>=0:
                ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
ans=0
for x in range(n//r):
    for y in range(n//g):
        if (d-x*a+y*b)//c==0:
            ans+=1
print(ans)
Problem p03059 (python)

Fixed submission:
a,b,t=map(int,input().split())
t+=0.5
print(int(t//a*b))

Buggy submission (verdict: Runtime Error):
from collections import*
def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return Counter(divisors)
 
n,*a=map(int,open(0).read().split())
ans=Counter()
for i in range(n):
    ans+=dv(a[i])
l=[]
for k,v in ans.items():
    if v==n-1 or v==n:
        l.append(k)
print(max(l))
Problem p03061 (python)

Fixed submission:
from collections import*
from functools import*
from fractions import*
def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return Counter(divisors)

n,*a=map(int,open(0).read().split())
if n<1000:
    ans=Counter()
    for i in range(n):
        ans+=dv(a[i])
    l=[]
    for k,v in ans.items():
        if v==n-1 or v==n:
            l.append(k)
    print(max(l))
else:
    print(max(reduce(gcd,a[n//4:]),reduce(gcd,a[:n//4]+a[n//2:]),reduce(gcd,a[:n//2]+a[3*n//4:]),reduce(gcd,a[:3*n//4])))

Buggy submission (verdict: Runtime Error):
from itertools import*;from fractions import*;u=accumulate;g=gcd;n,a=open(0);*a,=map(int,a.split());a=[0]+a+[0];print(max(starmap(g,zip(u(a,g),list(u(a[:1:-1],g))[::-1]))))
Problem p03067 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a<c<b or b<c<a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from numpy import*
from itertools import*
n=int(input())
s=input()
t=s.count("#")
r=s.count(".")

l=[t,r]
x=[len(list(v))for k,v in groupby(s)if k=="#"]
y=[len(list(v))for k,v in groupby(s)if k=="."]
if len(x)>len(y):
    y=[0]+y
elif len(x)<len(y):
    x=[0]+x
else:
    y=y+[0]
    x=[0]+x

x=array([0]+list(accumulate(x)))
y=array(list(accumulate(y[::-1]))[::-1]+[0])
print(min(x+y))
Problem p03069 (python)

Fixed submission:
n=int(input())
s=input()
r=s.count(".")
ans=[r]
for i in s:
    if i=="#":
        r+=1
    else:
        r-=1
    ans.append(r)
print(min(ans))

Buggy submission (verdict: Runtime Error):
from itertools import*
n=int(input())
s=input()
t=[len(list(v)) for k,v in groupby(s)]
r=s.count("#")
l=0
ans=[r,s.count(".")]

if s[0]=="#":
    for i in range(0,len(t)//2+1,2):
        r-=t[i+1]
        l+=t[i]
        ans.append(r+l)
else:
    for i in range(1,len(t)//2+1,2):
        r-=t[i+1]
        l+=t[i]
        ans.append(r+l)
print(min(ans))

Buggy submission (verdict: Runtime Error):
from numpy import*
from itertools import*
n=int(input())
s=input()
t=s.count("#")
r=s.count(".")
 
l=[t,r]
x=[len(list(v))for k,v in groupby(s)if k=="#"]
y=[len(list(v))for k,v in groupby(s)if k=="."]
if len(x)>len(y):
    y=[0]+y
elif len(x)<len(y):
    x=[0]+x
else:
    if s[0]=="#":
        y=[0]+y
        x=x+[0]
    else:
        y=y+[0]
        x=[0]+x
 
x=array([0]+list(accumulate(x)))
y=array(list(accumulate(y[::-1]))[::-1]+[0])
print([min(x+y),t,r]))

Buggy submission (verdict: Runtime Error):
from numpy import*
from itertools import*
n=int(input())
s=input()
t=s.count("#")
r=s.count(".")

x=[len(list(v))for k,v in groupby(s)if k=="#"]
y=[len(list(v))for k,v in groupby(s)if k=="."]
if len(x)>len(y):
    y=[0]+y
elif len(x)<len(y):
    x=[0]+x
else:
    if s[0]=="#":
        y=[0]+y
        x=x+[0]
    else:
        y=y+[0]
        x=[0]+x
 
x=array([0]+list(accumulate(x)))
y=array(list(accumulate(y[::-1]))[::-1]+[0])
print(min(x+y,t,r))

Buggy submission (verdict: Runtime Error):
from numpy import*
from itertools import*
n=int(input())
s=input()
t=s.count("#")
r=s.count(".")

l=[t,r]
x=[len(list(v))for k,v in groupby(s)if k=="#"]
y=[len(list(v))for k,v in groupby(s)if k=="."]
if len(x)>len(y):
    y=[0]+y
elif len(x)<len(y):
    x=[0]+x
else:
    if s[0]=="#":
        y=[0]+y
        x=x+[0]
    else:
        y=y+[0]
        x=[0]+x
x=array(list(accumulate(x)))
y=array(list(accumulate(y[::-1]))[::-1]+[0]*(s[-1]=="#"))
print(min(x+y))
Problem p03081 (python)

Fixed submission:
n,q=map(int,input().split())
s=[0]+list(input())+[0]
a=[input().split()for i in range(q)][::-1]
l,r=0,n+1
for(m,h)in a:
    if m==s[l+1]and h=="L":
        l+=1
    elif m==s[l]and h=="R":
        l-=1
    if m==s[r-1]and h=="R":
        r-=1
    elif m==s[r]and h=="L":
        r+=1
print(max(0,r-l-1))

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
p=[input().split() for i in range(q)]
def judge_l(x):
    for(k,v)in p:
        if k==s[x]:
            if v=="L":
                x-=1
            else:
                x+=1
        if x<0:
            return True
        elif x>n-1:
            return False
    return False

def judge_r(x):
    for(k,v)in p:
        if k==s[x]:
            if v=="L":
                x-=1
            else:
                x+=1
        if x<0:
            return False
        elif x>n-1:
            return True
    return False

ok=0
ng=n+1

while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if judge_l(mid):
        ok=mid
    else:
        ng=mid
l=ok+1

ok=n
ng=-1

while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if judge_r(mid):
        ok=mid
    else:
        ng=mid
r=n-ok
#print(l,r)
print(max(n-l-r,0))
Problem p03086 (python)

Fixed submission:
s=input()
ans=0
l=[]
for i in range(len(s)):
    #print(s[i],s[i]in"ACGT")
    if s[i] in "ACGT":
        ans+=1
    else:
        l.append(ans)
        ans=0
l.append(ans)
print(max(l))

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
l=[]
for i in range(len(s)):
    if s[i] in "ACGT":
        ans+=1        
        
    else:
        l.append(ans)
        ans=0
#print(l)
print(max(l))

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
l=[]
for i in range(len(s)):
    if s[i] not in "ACGT":
        l.append(ans)
        ans=0
    else:
        ans+=1
print(max(l)or 0)

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
l=[]
for i in range(len(s)):
    if s[i] not in "ACGT":
        l.append(ans)
        ans=0
    else:
        ans+=1
print(max(l))
Problem p03110 (python)

Fixed submission:
n=int(input())
ans=0
for i in range(n):
  a,b=input().split()
  if b=="JPY":
    ans+=int(a)
  else:
    ans+=float(a)*380000.0
print(ans)

Buggy submission (verdict: Runtime Error):
n,*a=open(0).read().split();f=float;;print(sum([f(a[s])*380000,f(a[s])][a[s+1]=="JPY"]for s in range(0,int(n)*2,2)))
Problem p03111 (python)

Fixed submission:
from itertools import*
n,a,b,c,*l=map(int,open(0).read().split())
d=[a,b,c]
ans=float("inf")
for i in product(range(4),repeat=n):
    take=[[],[],[]]
    for k,j in enumerate(i):  #0を捨てる
        if j!=0:
            take[j-1].append(l[k])
    if all(take):
        take2=list(map(sum,take))
        #print(sum(abs(s-t)for s,t in zip(d,take2)),(sum(map(len,take))-3)*10)
        ans=min(ans,sum(abs(s-t)for s,t in zip(d,take2))+(sum(map(len,take))-3)*10)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import*
n,a,b,c,*l=map(int,open(0).read().split())
want=[a,b,c]
ans=0
#print(n,want,l)
for s in range(3):
  if want[s] in l:
    l.remove(want[s])
    want[s]=0
#print(want,l)
want=list(filter(lambda x:x!=0,want))
for s in range(3):
  for t in l:
    if abs(want[s]-t)<10:
      ans+=abs(want[s]-t)
      l.remove(t)
      want[s]=0
want=list(filter(lambda x:x!=0,want))
#print(want,l,ans)
x=[]
y=[]
z=[]
for s in range(1,len(l)+1):
  x.extend(list(combinations(l,s)))
#print(x)
for s in want:
  for t in range(len(x)):
    y.append(abs(s-sum(x[t]))+(len(x[t])-1)*10)
    z.append(x[t])
  ans+=min(y)
#  print(x[y.count(min(y))])
  x[y.count(min(y))]=(999999,9999999)
print(ans)
Problem p03129 (python)

Fixed submission:
n,k=map(int,input().split())
print("YES") if n>=k*2-1 else print("NO")

Buggy submission (verdict: Runtime Error):
n,k=map(int,split())
print("YES") if n/2-1>=k print("NO")
Problem p03139 (python)

Fixed submission:
N,A,B=map(int,input().split(" "))
if N-A-B>0:
	W=0
else:
    W=A+B-N
print(min(A,B),W)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(input())
B=list(input())
C=list(input())
litter=[]
c=0
for s in range(N):
    c+=[0,0,1,2][len(set([A[s],B[s],C[s]]))]
print(c)
Problem p03147 (python)

Fixed submission:
from itertools import*
from numpy import*
n,*a=map(int,open(0).read().split())
if set(a)=={0}:
    print(0)
    exit()
a=array(a)
count=0
ans=0
while 1:
    count=min(a[a!=0])
    ans+=count*sum(k for k,v in groupby(a>0)if k==True)
    a=a-min(a[a!=0])
    a[a<0]=0
    if sum(a)==0:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import*
from numpy import*
n,*a=map(int,open(0).read().split())
a=array(a)
count=0
ans=0
while 1:
    count=min(a[a!=0])
    ans+=count*sum(k for k,v in groupby(a>0)if k==True)
    a=a-min(a[a!=0])
    a[a<0]=0
    if sum(a)==0:
        break
print(ans)
Problem p03160 (python)

Fixed submission:
from collections import*
n,*h=map(int,open(0).read().split())
dp=defaultdict(int)

for i in range(1,n+1):
    dp[i]=float("inf")
dp[0]=0
for i in range(n):
    for j in range(1,3):
        if i+j<n:
            dp[i+j]=min(abs(h[i]-h[i+j])+dp[i],dp[i+j])
        else:
            break
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
from collections import*
import functools
import sys
input=sys.stdin.readline
@functools.lru_cache(maxsize=None)
def Knapsack(N,W):
    for i in range(N):
        w,v=map(int,input().split())
        for k,b in d.copy().items():
            if k+w<=W:
                d[k+w]=max(d[k+w],b+v)
    return max(d.values())
N,W=map(int,input().split())   #pypyで実行！
d=defaultdict(int)
d[0]=0
print(Knapsack(N,W))
Problem p03192 (python)

Fixed submission:
print(input().count("2"))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
ans=0
for s in range(a):
    d,e=map(int,input().split())
    if b<=d and c<=e:
        ans+=1
print(ans)
Problem p03206 (python)

Fixed submission:
print("Christmas"+(25-int(input()))*" Eve")

Buggy submission (verdict: Runtime Error):
_,*a=map(int,open(0).readlines());print(sum(a)-max(a)//2)
Problem p03211 (python)

Fixed submission:
s=input();print(min(abs(int(s[i:i+3])-753)for i in range(len(s)-2)))

Buggy submission (verdict: Runtime Error):
s=input();print(min(abs(int(s[i:i+3])-753)for i in range(7)))

Buggy submission (verdict: Runtime Error):
s=input();print(min(abs(int(s[i:i+3])-753)for i in range(8)))

Buggy submission (verdict: Runtime Error):
s=input();print(min(abs(int(s[i:i+3])-753)for i in range(9)))
Problem p03212 (python)

Fixed submission:
import itertools
n=input()
c=[0,0,6,36,150,540,1806,5796,18150]
b=len(list(a for a in itertools.product(["3","5","7"],repeat=len(n))if len(set(a))==3 and int("".join(a))<=int(n)))
print(sum(c[:len(n)-1])+b)

Buggy submission (verdict: Runtime Error):
import itertools
n=input()
c=[0,0,6,36,150,540,1806,5796,18150]
b=len(list(a for a in itertools.product(["3","5","7"],repeat=len(n))if len(set(a))==3 and int("".join(a))<int(n)))
print(sum(c[:l-1])+b)
Problem p03214 (python)

Fixed submission:
n,*a=map(int,open(0).read().split());b=[abs(i-sum(a)/n)for i in a];print(b.index(min(b)))

Buggy submission (verdict: Runtime Error):
input();a=map(int,input().split());b=[abs(i-sum(a)/n)for i in a];print(b.index(min(b)))