Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())

if a == 0:
  print(0)
else:
  x = n % (a + b)
  y = n // (a + b)
  
ans = a * y + min(x, a)
print(ans)

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

x = n % (a + b)
y = n // (a + b) 
ans = a * y + min(x, a)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
count=0
a=[0 for i in range(n)]
for i in range(3,n):
    a[i]=10**i%2019
if n<4:
    print(0)
else:
    for i in reversed(range(2,n)):
        k=int(s[i-2:i+1])
        h=3
        for j in reversed(range(0,i-2)):
            k=k+a[h]*int(s[j])
            h+=1
            if k%2019==0:
                count+=1
    print(count)

Fixed submission:
s,w=map(int,input().split())
if w>=s:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
k=0
for i in range(n):
    s=input()
    if s not in a:
        k+=1
        a.append(s)
print(k)

Fixed submission:
n=int(input())
a=[]

for i in range(n):
    a.append(input())
b=set(a)
print(len(b))
Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
count=0
for i in range(1,h+1):
    for j in range(1,w+1):
        if (i+j)%2==0:
            count=count+1
print(count)

Fixed submission:
h,w=map(int,input().split())
if h ==1 or w==1:
    print(1)
else:
    if h%2==0:
        hk=h//2
        hg=h//2
    else:
        hk=h//2+1
        hg=h//2
    if w%2==0:
        wk=w//2
        wg=w//2
    else:
        wk=w//2+1
        wg=w//2
    print((hk*wk)+(hg*wg))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,m=map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
t=[[0,0,0] for i in range(m)]
for i in range(m):
    a, b,c = map(int, input().split())
    t[i][0]=a
    t[i][1]=b
    t[i][2]=c
k=A[0]+B[0]
for i in range(a):
    for j in range(b):
        if A[i]+B[j]<k:
            k=A[i]+B[j]
for i in range(m):
    if A[t[i][0]-1]+B[t[i][1]-1]-t[i][2]<k:
        k=A[t[i][0]-1]+B[t[i][1]-1]-t[i][2]
print(k)

Fixed submission:
a,b,m=map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
t=[[0,0,0] for i in range(m)]
for i in range(m):
    a, b,c = map(int, input().split())
    t[i][0]=a
    t[i][1]=b
    t[i][2]=c
k=min(A)+min(B)
for i in range(m):
    if A[t[i][0]-1]+B[t[i][1]-1]-t[i][2]<k:
        k=A[t[i][0]-1]+B[t[i][1]-1]-t[i][2]
print(k)
Buggy python submission (verdict: Runtime Error):
a,b,c  = map(int, input().split())
d,e,f  = map(int, input().split())
g,h,i  = map(int, input().split())
n=int(input())
A = []
for j in range(n):
    A.append(int(input()))
if (a in A) and (b in A) and (c in A):
    print("Yes")
elif d in A and e in A and f in A:
    print("Yes")
elif g in A and h in A and i in A:
    print("Yes")
elif a in A and d in A and g in A:
    print("Yes")
elif b in A and e in A and h in A:
    print("Yes")
elif c in A and f in A and i in A:
    print("Yes")
elif a in A and e in A and i in A:
    print("Yes")
elif c in A and e in A and g in A:
    print("Yes")
else:
    print("No")


Fixed submission:
n=int(input())
if n%2==0:
    print(n//2)
else:
    print(n//2+1)
Buggy python submission (verdict: Runtime Error):
a,b,c  = map(int, input().split())
d,e,f  = map(int, input().split())
g,h,i  = map(int, input().split())
n=int(input())
A = []
for _ in range(n):
    A.append(int(input())
if (a and b and c) in A:
    print("Yes")
elif (d and e and f) in A:
    print("Yes")
elif (g and h and i) in A:
    print("Yes")
elif (a and d and g) in A:
    print("Yes")
elif (b and e and h) in A:
    print("Yes")
elif (c and f and i) in A:
    print("Yes")
elif (a and e and i) in A:
    print("Yes")
elif (c and e and g) in A:
    print("Yes")
else:
    print("No")

Fixed submission:
a,b,c  = map(int, input().split())
d,e,f  = map(int, input().split())
g,h,i  = map(int, input().split())
n=int(input())
A = []
for j in range(n):
    A.append(int(input()))
if (a in A) and (b in A) and (c in A):
    print("Yes")
elif d in A and e in A and f in A:
    print("Yes")
elif g in A and h in A and i in A:
    print("Yes")
elif a in A and d in A and g in A:
    print("Yes")
elif b in A and e in A and h in A:
    print("Yes")
elif c in A and f in A and i in A:
    print("Yes")
elif a in A and e in A and i in A:
    print("Yes")
elif c in A and e in A and g in A:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c  = map(int, input().split())
d,e,f  = map(int, input().split())
g,h,i  = map(int, input().split())
n=int(input())
A = []
for i in range(n):
    A.append(int(input()))
if (a in A) and (b in A) and (c in A):
    print("Yes")
elif d in A and e in A and f in A:
    print("Yes")
elif g in A and h in A and i in A:
    print("Yes")
elif a in A and d in A and g in A:
    print("Yes")
elif b in A and e in A and h in A:
    print("Yes")
elif c in A and f in A and i in A:
    print("Yes")
elif a in A and e in A and i in A:
    print("Yes")
elif c in A and e in A and g in A:
    print("Yes")
else:
    print("No")

Fixed submission:
n,m=map(int,input().split())
s = [0] * m
c = [0] * m
for i in range(m):
    s[i], c[i] = map(int, input().split())
k=["0"]*n
if m==0 and n==1:
    print(0)
elif m==0 and n!=1:
    print(10**(n-1))
else:
    for i in range(m):
        if k[s[i]-1]=="0":
            k[s[i]-1]=c[i]
        elif k[s[i]-1]==c[i]:
            k[s[i]-1]=c[i]
        else:
            print(-1)
            break

    else:
        t=0
        if k[0]=="0":
            k[0]=1
        if k[0]==0 and n==1:
            print(0)
        elif k[0]==0 and n!=1:
            print(-1)
        else:
            for i in range(n):
                t=t+10**(n-1-i)*int(k[i])
            print(t)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S = []
for j in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=' '.join(sorted(S3))
print(S3)

Fixed submission:
a, b,c = map(int, input().split())
if a==b and a!=c:
    print("Yes")
elif a==c and a!=b:
    print("Yes")
elif b==c and a!=b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import collections
n=int(input())
A = list(map(int, input().split
c=collections.Counter(A)
if c==len(A):
    print("YES")
else:
    print("NO")

Fixed submission:
import collections
n=int(input())
A = list(map(int, input().split()))
c=collections.Counter(A)
if len(c)==len(A):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
n=int(input())
A = list(map(int, input().split
c=collections.Counter(A)
if c==len(A):
    print("YES")
else:
    print("NO")

Fixed submission:
import collections
n=int(input())
A = list(map(int, input().split()))
c=collections.Counter(A)
if len(c)==len(A):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
n=int(input())
A = list(map(int, input().split
c=collections.Counter(A)
if c=len(A):
    print("YES")
else:
    print("NO")

Fixed submission:
import collections
n=int(input())
A = list(map(int, input().split()))
c=collections.Counter(A)
if len(c)==len(A):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A = list(map(int, input().split()))
for i in range(0,n-1):
    for j in range(i+1,n):
        if A[i]==A[j]:
            print("NO")
            break
    else:
        continue
    break
else:
    print("YES")

Fixed submission:
import collections
n=int(input())
A = list(map(int, input().split()))
c=collections.Counter(A)
if len(c)==len(A):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = list(map(int, input().split()))
m=[0]*(n-k+1)

for i in range(0,n-k+1):
    s=0
    for j in range(i,i+k):
        s=s+A[j]
    m[i]=s
print((max(m)+k)/2)

Fixed submission:
n,k = map(int, input().split())
A = list(map(int, input().split()))
s=[0]*(n+1)
for i in range(1,n+1):
    s[i]=s[i-1]+A[i-1]
s1=[0]*(n-k+1)
for i in range(0,n-k+1):
    s1[i]=s[k+i]-s[i]
print((max(s1)+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = list(map(int, input().split()))
m=0
for i in range(0,n-k+1):
    s=0
    for j in range(i,i+k):
        s=s+(A[j]+1)/2
    if s>m:
        m=s
print(m)

Fixed submission:
n,k = map(int, input().split())
A = list(map(int, input().split()))
s=[0]*(n+1)
for i in range(1,n+1):
    s[i]=s[i-1]+A[i-1]
s1=[0]*(n-k+1)
for i in range(0,n-k+1):
    s1[i]=s[k+i]-s[i]
print((max(s1)+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = list(map(int, input().split()))
m=0
for i in range(0,n-k+1):
    s=0
    for j in range(i,i+k):
        s=s+(A[j]*(A[j]+1)/2)*1/A[j]
    if s>m:
        m=s
print(m)

Fixed submission:
n,k = map(int, input().split())
A = list(map(int, input().split()))
s=[0]*(n+1)
for i in range(1,n+1):
    s[i]=s[i-1]+A[i-1]
s1=[0]*(n-k+1)
for i in range(0,n-k+1):
    s1[i]=s[k+i]-s[i]
print((max(s1)+k)/2)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a==b:
    pront("Yes")
else:
    print("No")

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

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a==b:
    pront("Yes")
else:
    print("No")

Fixed submission:
a, b = map(int, input().split())
if a==b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A = list(map(int, input().split()))
if N==1:
    print(1)
else:
    count=0
    for i in range(N-1):
        for j in range(i,N):
            if A[i]<=A[j+1]:
                count=count+1
                break
    print(count)

Fixed submission:
N=int(input())
A = list(map(int, input().split()))
count=1
m=A[0]
for i in range(1,N):
    if m>=A[i]:
        count=count+1
        m=A[i]
print(count)
Buggy python submission (verdict: Runtime Error):
n=int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
import math
r=sorted(p)
t=0
l=0
s=0
for i in range(n):
    if p[i]>q[i]:
        l=p
        s=q
        break
    elif q[i]>p[i]:
        l=q
        s=p
        break
else:
    l=p
    s=q
for i in range(n):
    if l[i]>=s[i]:
        t=t+(r.index(l[i])-r.index(s[i])-1)*math.factorial(n-i-1)
    else:
        t=t+(n-r.index(s[i])-1+r.index(l[i])-1)*math.factrial(n-i-1)

print(t)

Fixed submission:
import itertools
n=int(input())
p=tuple(input().split())
q=tuple(input().split())
h=[]
for i in range(n):
    h+=str(i+1)
k=list(itertools.permutations(h))
p2=-1
q2=-1
for i in range(len(k)):
    if p==k[i]:
        p2=i
    if q==k[i]:
        q2=i
    if p2 != -1 and q2 !=-1:
        break
print(abs(p2-q2))
Buggy python submission (verdict: Runtime Error):
S,T = input().split()
ptint(T+S)

Fixed submission:
S,T = input().split()
print(T+S)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int,input().split())
for i in range(k):
    if a>0:
        a=a-1
    elif b>0:
        b=b-1
print(a,b)


Fixed submission:
a,b,k = map(int,input().split())
if k<a:
    print(a-k,b)
elif a+b-k>0:
    print(0,a+b-k)
else:
    print(0,0)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if abs(a-b)%2==0:
    print(abs(a-b)//2)
else:
    if n-b>a-1:
        print(a+(b-a-1)//2)
    else:
        print(n-b+1(b-a-1)//2)

Fixed submission:
n,a,b=map(int,input().split())
if abs(a-b)%2==0:
    print(abs(a-b)//2)
else:
    if n-b>a-1:
        print(a+(b-a-1)//2)
    else:
        print(n-b+1+(b-a-1)//2)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
for i in range(1,n):
    if a*i%b==0:
        print(a*i)
        break
else:
    print(a*b)

Fixed submission:
a,b=map(int,input().split())
for i in range(1,b):
    if a*i%b==0:
        print(a*i)
        break
else:
    print(a*b)
Buggy python submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
h=1
if a+b<=x<10*a+2*b:
    h=1
if 10*a+b*2<=x<100*a+3*b:
    h=2
if 100*a+b*3<=x<1000*a+4*b:
    h=3
if 1000*a+b*4<=x<10000*a+5*b:
    h=4
if 10000*a+b*5<=x<100000*a+6*b:
    h=5
if 100000*a+b*6<=x<1000000*a+7*b:
    h=6
if 1000000*a+b*7<=x<10000000*a+8*b:
    h=7
if 10000000*a+b*8<=x<100000000*a+9*b:
    h=8
if 100000000*a+b*9<=x<1000000000*a+10*b:
    h=9
if x>=1000000000*a+10*b:
    print(1000000000)
elif x<a+b:
    print(0)
else:
    d=0
    for i in range(10**(h-1),10**h):
        if i*a+b*h>x:
            print(d)
            break
        else:
            d=i
    else:
        print(d)

Fixed submission:
s=input()
if s=="SAT":
    print(1)
if s=="SUN":
    print(7)
if s=="MON":
    print(6)
if s=="TUE":
    print(5)
if s=="WED":
    print(4)
if s=="THU":
    print(3)
if s=="FRI":
    print(2)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(n):
    c=A.index(min(A))
    B.append(c+1)
    A[c]=n+1
print(*B)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
B=[0]*n
for i in range(n):
    B[A[i]-1]=i+1
print(*B)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(n):
    c=A.index(min(A))
    B.append(c+1)
    A[c]=n+1
print(*B)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
B=[0]*n
for i in range(n):
    B[A[i]-1]=i+1
print(*B)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(n):
    B.append(A.index(min(A))+1)
    A[A.index(min(A))]=n+1
print(*B)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
B=[0]*n
for i in range(n):
    B[A[i]-1]=i+1
print(*B)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
count=0
def cc(a,b,c):
    if a%c==0 or b%c==0:
        return (b-a)//c+1
    else:
        return (b-a)//c
print(b-a+2-cc(a,b,c)-cc(a,b,d)+cc(a,b,(a*b)//math.gcd(c,d)))

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())
count=0
def cc(a,b,c):
    if a%c==0:
        k=a
    else:
        k=a+c-(a%c)
    return ((b//c)-(k//c)+1)
print(b-a+1-cc(a,b,c)-cc(a,b,d)+cc(a,b,(c*d)//fractions.gcd(c,d)))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a,b=map(int,input().split())
d=[]
e=[]
f=[]
for i in range(n):
    k=int(input())
    if k<=a:
        d.append(k)
    elif a<k<=b:
        e.append(k)
    else:
        f.append(k)
print(min(len(d),len(e),len(f)))

Fixed submission:
n=int(input())
a,b=map(int,input().split())
H=list(map(int,input().split()))
d=[]
e=[]
f=[]
for i in range(n):
    k=H[i]
    if k<=a:
        d.append(k)
    elif a<k<=b:
        e.append(k)
    else:
        f.append(k)
print(min(len(d),len(e),len(f)))
Buggy python submission (verdict: Runtime Error):
if x%y==0:
    print(-1)
else:
    if x*(y+1)<=10**18:
        print(x*(y+1))
    else:
        print(-1)

Fixed submission:
x,y=map(int,input().split())
if x%y==0:
    print(-1)
else:
    if x*(y+1)<=10**18:
        print(x*(y+1))
    else:
        print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
x,y=map(int,input().split())
for i in range(1,10**18//x):
    if (i*x)%y!=0:
        print(i*x)
        break
else:
    print(-1)

Fixed submission:
x,y=map(int,input().split())
if x%y==0:
    print(-1)
else:
    if x*(y+1)<=10**18:
        print(x*(y+1))
    else:
        print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
mi=abs(sum(a)-2*a[0])
k=a[0]
t=sum(a)
for i in range(1,n-1):
    k=k+a[i]
    if abs(sum(a)-2*k) < mi:
        mi=abs(sum(a)-2*k)
print(mi)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
t=sum(a)
mi=abs(t-2*a[0])
k=a[0]

for i in range(1,n-1):
    k=k+a[i]
    if abs(t-2*k) < mi:
        mi=abs(t-2*k)
print(mi)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
k=0
for i in range(n):
    if s[i]=="I":
        x+=1
        if x>k:
            k=x
    else:
        x+=-1
print(k)

Fixed submission:
n=int(input())
s=input()
k=0
x=0
for i in range(n):
    if s[i]=="I":
        x+=1
        if x>k:
            k=x
    else:
        x+=-1
print(k)
Buggy python submission (verdict: Runtime Error):
n=input()
print(n*(n+1)//2)


Fixed submission:
n=int(input())
print(n*(n+1)//2)
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x>=2000:
    print(1)
else:
    if (x//100)*100<=x<=(x//100)*105:
        print(1)
    else:
        print(0)

Fixed submission:
s=input()
n=len(s)
k=""
t=0
for i in range(n):
    if s[i]=="B" and t!=0:
        k=k[:-1]
        t=t-1
    if s[i]=="0":
        k=k+"0"
        t=t+1
    if s[i]=="1":
        k=k+"1"
        t=t+1
print(k)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
MOD = 10**9 + 7

ret = 0
prev = 0
for i in range(1, N+1):
    if prev == 0:
        val = 8**(i-1) * 9**(N-i)
    else:
        val = prev * 8 // 9
    ret = (ret+val) % MOD
    prev = val

print((10**N - 8**N - ret*2)%MOD)


Fixed submission:
N = int(input())
MOD = 10**9 + 7

def pow_mod(a, n, MOD):
    ret = 1
    for i in range(n):
        ret = a * ret % MOD
    return ret

ans = pow_mod(10, N, MOD) - 2*pow_mod(9, N, MOD) + pow_mod(8, N, MOD)
print(ans % MOD)
Buggy python submission (verdict: Runtime Error):
from dataclasses import dataclass
from operator import itemgetter, attrgetter

@dataclass
class P:
    x: float
    y: float
    def __add__(self, p: P): return P(self.x + p.x, self.y + p.y)
    def __sub__(self, p: P): return P(self.x - p.x, self.y - p.y)
    def dot(self, p: P): return (self.x*p.x + self.y*p.y)
    def cross(self, p: P): return (self.x*p.y - self.y*p.x)
    def abs(self): return (abs(self.x) + abs(self.y))

def convex_hull(Ps):
    Ps.sort(key=attrgetter('x', 'y'))
    ret1, ret2 = list(), list()
    for i in range(len(Ps)):
        k = len(ret1)
        while k>=2 and (Ps[i]-ret1[k-1]).cross(ret1[k-1]-ret1[k-2]) <= 0:
            ret1.pop()
            k = len(ret1)
        ret1.append(Ps[i])
    for i in range(len(Ps)):
        k = len(ret2)
        while k>=2 and (Ps[i]-ret2[k-1]).cross(ret2[k-1]-ret2[k-2]) >= 0:
            ret2.pop()
            k = len(ret2)
        ret2.append(Ps[i])
    return ret1 + ret2[::-1]

N = int(input())
Ps = list()
for i in range(N):
    x, y = list(map(int, input().split()))
    Ps.append(P(x, y))

# produce convex hull
CPs = convex_hull(Ps)

# brute force
ans = 0
for i in range(len(CPs)):
    for j in range(i, len(CPs)):
        mdis = (CPs[i]-CPs[j]).abs()
#        print(i, j, mdis)
        if ans < mdis: ans = mdis

print (ans)


Fixed submission:
from operator import itemgetter, attrgetter

class P:
    def __init__(self, x, y):
        self.x, self.y = x, y
    def __add__(self, p): return P(self.x + p.x, self.y + p.y)
    def __sub__(self, p): return P(self.x - p.x, self.y - p.y)
    def dot(self, p): return (self.x*p.x + self.y*p.y)
    def cross(self, p): return (self.x*p.y - self.y*p.x)
    def abs(self): return (abs(self.x) + abs(self.y))

def convex_hull(Ps):
    Ps.sort(key=attrgetter('x', 'y'))
    ret1, ret2 = list(), list()
    for i in range(len(Ps)):
        k = len(ret1)
        while k>=2 and (Ps[i]-ret1[k-1]).cross(ret1[k-1]-ret1[k-2]) <= 0:
            ret1.pop()
            k = len(ret1)
        ret1.append(Ps[i])
    for i in range(len(Ps)):
        k = len(ret2)
        while k>=2 and (Ps[i]-ret2[k-1]).cross(ret2[k-1]-ret2[k-2]) >= 0:
            ret2.pop()
            k = len(ret2)
        ret2.append(Ps[i])
    return ret1 + ret2[::-1]

N = int(input())
Ps = list()
for i in range(N):
    x, y = list(map(int, input().split()))
    Ps.append(P(x, y))

# produce convex hull
CPs = convex_hull(Ps)

# brute force
ans = 0
for i in range(len(CPs)):
    for j in range(i, len(CPs)):
        mdis = (CPs[i]-CPs[j]).abs()
#        print(i, j, mdis)
        if ans < mdis: ans = mdis

print (ans)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(len(T), 0, -1):
    for j in range(len(T)-i+1):
        subst = T[j:i+j]
        print(subst)
        if S.find(subst, j, len(S)-(len(T)-i-j))>=0:
            print (len(T)-i)
#            print(subst)
            exit(0)



Fixed submission:
S = input()
T = input()

def matchcount(x, y):
    ret = 0
    for i in range(len(x)):
        if x[i] == y[i]: ret += 1
    return ret

rec = len(T)
for i in range(len(S)-len(T)+1):
    subst = S[i:i+len(T)]
#    print(subst, matchcount(subst, T))
    rec = min(rec, len(T) - matchcount(subst, T))

print(rec)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(len(T), 0, -1):
    for j in range(len(T)-i+1):
        subst = T[j:i+j]
#        print(subst)
        if S.find(subst, j, len(S)-(len(T)-i-j))>=0:
            print (len(T)-i)
            print(subst)
#            exit(0)


Fixed submission:
S = input()
T = input()

def matchcount(x, y):
    ret = 0
    for i in range(len(x)):
        if x[i] == y[i]: ret += 1
    return ret

rec = len(T)
for i in range(len(S)-len(T)+1):
    subst = S[i:i+len(T)]
#    print(subst, matchcount(subst, T))
    rec = min(rec, len(T) - matchcount(subst, T))

print(rec)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
M = 10**9 + 7
s = 0
for i in range(N):
    for j in range(N):
        if i < j:
            s += A[i] * A[j]
            s = s % M

print (s)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
M = 10**9 + 7
s = 0

sm = sum(A)

for i in range(N):
    sm -= A[i]
    s += sm * A[i]
    s = s % M

print (s)
Buggy python submission (verdict: Runtime Error):
import bisect
import statistics
n = int(input())
a = list((int(x) for x in input().split()))

a.sort()
incl = []
score = 0

for i in range(len(a)):
    ain = a.pop()
    incl.append(ain)
    if i==0: continue
    if (len(incl)%2 == 1):
        score += incl[ int(len(incl))/2 ]
    else:
        # smaller of middle two
        score += incl[ int(len(incl)/2)-1 ]

print(score)

Fixed submission:
import bisect
import statistics
n = int(input())
a = list((int(x) for x in input().split()))

a.sort()
incl = []
score = 0

for i in range(len(a)):
    ain = a.pop()
    incl.append(ain)
    if i==0: continue
    if (len(incl)%2 == 1):
        score += incl[ int(len(incl)/2) ]
    else:
        # smaller of middle two
        score += incl[ int(len(incl)/2)-1 ]

print(score)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import statistics
n = int(input())
a = list((int(x) for x in input().split()))

a.sort()
incl = []
score = 0

for i in range(len(a)):
    ain = a.pop()
    incl.append(ain)
    if i==0: continue
    if (len(incl)%2 == 1):
        score += statistics.median(incl)
    else:
        # smaller of middle two
        score += incl[ int(len(incl)/2)-1 ]

print(score)

Fixed submission:
import bisect
import statistics
n = int(input())
a = list((int(x) for x in input().split()))

a.sort()
incl = []
score = 0

for i in range(len(a)):
    ain = a.pop()
    incl.append(ain)
    if i==0: continue
    if (len(incl)%2 == 1):
        score += incl[ int(len(incl)/2) ]
    else:
        # smaller of middle two
        score += incl[ int(len(incl)/2)-1 ]

print(score)